예제 #1
0
  @After
  public void DeleteData() {
    memberSvc.delete("test1");
    memberSvc.delete("test2");
    memberSvc.delete("test3");

    practiceSvc.delete(DateUtil.toDate("2010-10-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    practiceSvc.delete(DateUtil.toDate("2010-12-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
  }
예제 #2
0
 @Test
 public void testSearchFromMemberIdAndPracticeDate() throws Exception {
   assertNotNull(
       service.searchFromMemberIdAndPracticeDate(
           "test1", DateUtil.toDate("2010-10-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN)));
   assertNull(
       service.searchFromMemberIdAndPracticeDate(
           "testXXX", DateUtil.toDate("2010-10-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN)));
   assertNull(
       service.searchFromMemberIdAndPracticeDate(
           "test2", DateUtil.toDate("2010-11-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN)));
   assertNull(service.searchFromMemberIdAndPracticeDate("test1", null));
   assertNull(
       service.searchFromMemberIdAndPracticeDate(
           null, DateUtil.toDate("2010-11-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN)));
 }
예제 #3
0
 @Test
 public void testSearchFromPracticeDate() throws Exception {
   assertEquals(
       2,
       service
           .searchFromPracticeDate(
               DateUtil.toDate("2010-10-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN))
           .size());
   assertEquals(
       1,
       service
           .searchFromPracticeDate(
               DateUtil.toDate("2010-12-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN))
           .size());
   assertNull(
       service.searchFromPracticeDate(
           DateUtil.toDate("2010-11-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN)));
   assertNull(service.searchFromPracticeDate(null));
 }
예제 #4
0
 @Test
 public void testSearchFromKey() throws Exception {
   Member m = memberSvc.searchFromId("test1");
   Practice p =
       practiceSvc.searchFromStartDateTime(
           DateUtil.toDate("2010-10-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
   assertNotNull(service.searchFromKey(service.generateKey(m.getKey(), p.getKey())));
   assertNull(service.searchFromKey(Datastore.createKey(Attendance.class, "XXX")));
   assertNull(service.searchFromKey(null));
 }
예제 #5
0
 @Test
 public void testGetInitalizedAttendance() {
   Attendance attendance =
       service.getInitalizedAttendance(
           memberSvc.searchFromId("test3"),
           practiceSvc.searchFromStartDateTime(
               DateUtil.toDate("2010-10-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN)));
   assertEquals(0, attendance.getAttendance());
   assertEquals(memberSvc.searchFromId("test3").getKey(), attendance.getMemberKey());
   assertEquals(
       practiceSvc
           .searchFromStartDateTime(
               DateUtil.toDate("2010-10-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN))
           .getKey(),
       attendance.getPracticeKey());
   assertEquals(false, attendance.getFinished());
   assertEquals(false, attendance.getInputFlg());
   assertNull(attendance.getRacital());
 }
예제 #6
0
  @Test
  public void testRegistListAndDeleteList() throws Exception {
    Attendance a = null;
    Member m = null;
    Practice p = null;
    List<Attendance> attendanceList = new ArrayList<Attendance>();

    a = new Attendance();
    a.setAttendance(1);
    a.setFinished(false);
    a.setRacital("It's racital, too.");
    m = memberSvc.searchFromId("test3");
    a.setMemberKey(m.getKey());
    p =
        practiceSvc.searchFromStartDateTime(
            DateUtil.toDate("2010-10-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    a.setPracticeKey(p.getKey());
    attendanceList.add(a);

    a = new Attendance();
    a.setAttendance(0);
    a.setFinished(true);
    a.setRacital("It's racital, too.");
    m = memberSvc.searchFromId("test3");
    a.setMemberKey(m.getKey());
    p =
        practiceSvc.searchFromStartDateTime(
            DateUtil.toDate("2010-12-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    a.setPracticeKey(p.getKey());
    attendanceList.add(a);

    attendanceList = service.registList(attendanceList);

    assertNotNull(
        service.searchFromMemberIdAndPracticeDate(
            "test3", DateUtil.toDate("2010-10-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN)));
    assertNotNull(
        service.searchFromMemberIdAndPracticeDate(
            "test3", DateUtil.toDate("2010-10-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN)));

    service.deleteList(attendanceList);

    assertNull(
        service.searchFromMemberIdAndPracticeDate(
            "test3", DateUtil.toDate("2010-10-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN)));
    assertNull(
        service.searchFromMemberIdAndPracticeDate(
            "test3", DateUtil.toDate("2010-10-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN)));
  }
예제 #7
0
  @Before
  public void CreateDate() {

    Member m = null;
    Practice p = null;
    Attendance a = null;

    m = new Member();
    m.setId("test1");
    m.setFirstName("taro");
    m.setLastName("test");
    m.setBirthDay(DateUtil.toDate("2010-10-01", DateUtil.ISO_DATE_PATTERN));
    m.setMailAddress("*****@*****.**");
    m.setTelNo("0120-333-906");
    Datastore.put(m);

    m = new Member();
    m.setId("test2");
    m.setFirstName("ziro");
    m.setLastName("test");
    Datastore.put(m);

    m = new Member();
    m.setId("test3");
    m.setFirstName("savuroh");
    m.setLastName("test");
    Datastore.put(m);

    p = new Practice();
    p.setStartDate(DateUtil.toDate("2010-10-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    p.setEndDate(DateUtil.toDate("2010-10-01T12:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    p.setGatheringDate(DateUtil.toDate("2010-10-01T09:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    p.setPracticePlace("test praza");
    p.setGatheringPoint("front of test praza");
    p.setRecital("It's recital.");
    practiceSvc.regist(p);

    p = new Practice();
    p.setStartDate(DateUtil.toDate("2010-10-11T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    p.setEndDate(DateUtil.toDate("2010-10-11T12:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    p.setGatheringDate(DateUtil.toDate("2010-10-11T09:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    practiceSvc.regist(p);

    p = new Practice();
    p.setStartDate(DateUtil.toDate("2010-12-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    p.setEndDate(DateUtil.toDate("2010-12-01T12:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    p.setGatheringDate(DateUtil.toDate("2010-12-01T09:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    practiceSvc.regist(p);

    a = new Attendance();
    a.setAttendance(1);
    a.setFinished(false);
    a.setRacital("It's racital, too.");
    m = memberSvc.searchFromId("test1");
    a.setMemberKey(m.getKey());
    a.getMemberRef().setModel(m);
    p =
        practiceSvc.searchFromStartDateTime(
            DateUtil.toDate("2010-10-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    a.getPracticeRef().setModel(p);
    a.setPracticeKey(p.getKey());
    service.regist(a);

    a = new Attendance();
    a.setAttendance(1);
    a.setFinished(false);
    a.setRacital("It's racital, too.");
    m = memberSvc.searchFromId("test1");
    a.setMemberKey(m.getKey());
    p =
        practiceSvc.searchFromStartDateTime(
            DateUtil.toDate("2010-12-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    a.setPracticeKey(p.getKey());
    service.regist(a);

    a = new Attendance();
    a.setAttendance(0);
    a.setFinished(true);
    a.setRacital("It's racital, too.");
    m = memberSvc.searchFromId("test2");
    a.setMemberKey(m.getKey());
    p =
        practiceSvc.searchFromStartDateTime(
            DateUtil.toDate("2010-10-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    a.setPracticeKey(p.getKey());
    service.regist(a);

    a = new Attendance();
    a.setAttendance(0);
    a.setFinished(true);
    a.setRacital("It's racital, too.");
    m = memberSvc.searchFromId("test2");
    a.setMemberKey(m.getKey());
    p =
        practiceSvc.searchFromStartDateTime(
            DateUtil.toDate("2010-10-01T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    a.setPracticeKey(p.getKey());
    service.regist(a);

    a = new Attendance();
    a.setAttendance(0);
    a.setFinished(true);
    a.setRacital("It's racital, too.");
    m = memberSvc.searchFromId("test1");
    a.setMemberKey(m.getKey());
    p =
        practiceSvc.searchFromStartDateTime(
            DateUtil.toDate("2010-10-11T10:00:00", DateUtil.ISO_DATE_TIME_PATTERN));
    a.setPracticeKey(p.getKey());
    service.regist(a);
  }
예제 #8
0
 @Test
 public void testSearchFromMemberIdAndPracticeDateSpan() throws Exception {
   assertEquals(
       1,
       service
           .searchFromMemberIdAndPracticeDateSpan(
               "test1",
               DateUtil.toDate("2010-10-10", DateUtil.ISO_DATE_PATTERN),
               DateUtil.toDate("2010-11-30", DateUtil.ISO_DATE_PATTERN))
           .size());
   assertEquals(
       2,
       service
           .searchFromMemberIdAndPracticeDateSpan(
               "test1",
               DateUtil.toDate("2010-10-10", DateUtil.ISO_DATE_PATTERN),
               DateUtil.toDate("2010-12-01", DateUtil.ISO_DATE_PATTERN))
           .size());
   assertEquals(
       2,
       service
           .searchFromMemberIdAndPracticeDateSpan(
               "test1",
               DateUtil.toDate("2010-10-11", DateUtil.ISO_DATE_PATTERN),
               DateUtil.toDate("2010-12-01", DateUtil.ISO_DATE_PATTERN))
           .size());
   assertEquals(
       2,
       service
           .searchFromMemberIdAndPracticeDateSpan(
               "test1",
               DateUtil.toDate("2010-10-11", DateUtil.ISO_DATE_PATTERN),
               DateUtil.toDate("2010-12-02", DateUtil.ISO_DATE_PATTERN))
           .size());
   assertNull(
       service.searchFromMemberIdAndPracticeDateSpan(
           "testXXX",
           DateUtil.toDate("2010-10-01", DateUtil.ISO_DATE_PATTERN),
           DateUtil.toDate("2010-12-01", DateUtil.ISO_DATE_PATTERN)));
   assertEquals(
       1,
       service
           .searchFromMemberIdAndPracticeDateSpan(
               "test2",
               DateUtil.toDate("2010-10-01", DateUtil.ISO_DATE_PATTERN),
               DateUtil.toDate("2010-12-01", DateUtil.ISO_DATE_PATTERN))
           .size());
   assertNull(
       service.searchFromMemberIdAndPracticeDateSpan(
           "test1",
           DateUtil.toDate("2010-10-12", DateUtil.ISO_DATE_PATTERN),
           DateUtil.toDate("2010-11-30", DateUtil.ISO_DATE_PATTERN)));
   assertNull(
       service.searchFromMemberIdAndPracticeDateSpan(
           null,
           DateUtil.toDate("2010-10-02", DateUtil.ISO_DATE_PATTERN),
           DateUtil.toDate("2010-12-02", DateUtil.ISO_DATE_PATTERN)));
   assertNull(
       service.searchFromMemberIdAndPracticeDateSpan(
           "test1", null, DateUtil.toDate("2010-12-02", DateUtil.ISO_DATE_PATTERN)));
   assertNull(
       service.searchFromMemberIdAndPracticeDateSpan(
           "test1", DateUtil.toDate("2010-10-02", DateUtil.ISO_DATE_PATTERN), null));
 }
예제 #9
0
 public void testGetLastDayOfMonth() {
   Date orig = DateUtil.toDate("2003-03-24", "yyyy-MM-dd");
   Date actual = Utils.getLastDayOfMonth(orig);
   assertEquals("2003-03-31", DateUtil.toString(actual));
 }