Exemplo n.º 1
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)));
  }
Exemplo n.º 2
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);
  }