← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14677: EventServiceTest, removed overloads

 

------------------------------------------------------------
revno: 14677
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-04-04 22:46:36 +0200
message:
  EventServiceTest, removed overloads
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/DefaultEventStore.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventStore.java
  dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java
  dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java
  dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java	2014-04-01 04:22:49 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java	2014-04-04 20:46:36 +0000
@@ -315,100 +315,6 @@
     // -------------------------------------------------------------------------
 
     @Override
-    public Events getEvents( Program program, OrganisationUnit organisationUnit )
-    {
-        List<Event> eventList = eventStore.getAll( program, organisationUnit );
-        Events events = new Events();
-        events.setEvents( eventList );
-
-        return events;
-    }
-
-    @Override
-    public Events getEvents( Program program, OrganisationUnit organisationUnit, Date startDate, Date endDate )
-    {
-        List<Event> eventList = eventStore.getAll( program, organisationUnit, startDate, endDate );
-        Events events = new Events();
-        events.setEvents( eventList );
-
-        return events;
-    }
-
-    @Override
-    public Events getEvents( Program program, OrganisationUnit organisationUnit, TrackedEntityInstance trackedEntityInstance, Date startDate,
-        Date endDate )
-    {
-        List<Event> eventList = eventStore.getAll( program, organisationUnit, trackedEntityInstance, startDate, endDate );
-        Events events = new Events();
-        events.setEvents( eventList );
-
-        return events;
-    }
-
-    @Override
-    public Events getEvents( ProgramStage programStage, OrganisationUnit organisationUnit )
-    {
-        List<Event> eventList = eventStore.getAll( programStage, organisationUnit );
-        Events events = new Events();
-        events.setEvents( eventList );
-
-        return events;
-    }
-
-    @Override
-    public Events getEvents( ProgramStage programStage, OrganisationUnit organisationUnit, Date startDate, Date endDate )
-    {
-        List<Event> eventList = eventStore.getAll( programStage, organisationUnit, startDate, endDate );
-        Events events = new Events();
-        events.setEvents( eventList );
-
-        return events;
-    }
-
-    @Override
-    public Events getEvents( ProgramStage programStage, OrganisationUnit organisationUnit, TrackedEntityInstance trackedEntityInstance,
-        Date startDate, Date endDate )
-    {
-        List<Event> eventList = eventStore.getAll( programStage, organisationUnit, trackedEntityInstance, startDate, endDate );
-        Events events = new Events();
-        events.setEvents( eventList );
-
-        return events;
-    }
-
-    @Override
-    public Events getEvents( Program program, ProgramStage programStage, OrganisationUnit organisationUnit )
-    {
-        List<Event> eventList = eventStore.getAll( program, programStage, organisationUnit );
-        Events events = new Events();
-        events.setEvents( eventList );
-
-        return events;
-    }
-
-    @Override
-    public Events getEvents( Program program, ProgramStage programStage, OrganisationUnit organisationUnit,
-        TrackedEntityInstance trackedEntityInstance )
-    {
-        List<Event> eventList = eventStore.getAll( program, programStage, organisationUnit, trackedEntityInstance );
-        Events events = new Events();
-        events.setEvents( eventList );
-
-        return events;
-    }
-
-    @Override
-    public Events getEvents( Program program, ProgramStage programStage, OrganisationUnit organisationUnit,
-        Date startDate, Date endDate )
-    {
-        List<Event> eventList = eventStore.getAll( program, programStage, organisationUnit, startDate, endDate );
-        Events events = new Events();
-        events.setEvents( eventList );
-
-        return events;
-    }
-
-    @Override
     public Events getEvents( Program program, ProgramStage programStage, OrganisationUnit organisationUnit,
         TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate )
     {
@@ -421,17 +327,6 @@
 
     @Override
     public Events getEvents( List<Program> programs, List<ProgramStage> programStages,
-        List<OrganisationUnit> organisationUnits, Date startDate, Date endDate )
-    {
-        List<Event> eventList = eventStore.getAll( programs, programStages, organisationUnits, startDate, endDate );
-        Events events = new Events();
-        events.setEvents( eventList );
-
-        return events;
-    }
-
-    @Override
-    public Events getEvents( List<Program> programs, List<ProgramStage> programStages,
         List<OrganisationUnit> organisationUnits, TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate )
     {
         List<Event> eventList = eventStore.getAll( programs, programStages, organisationUnits, trackedEntityInstance, startDate,

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/DefaultEventStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/DefaultEventStore.java	2014-03-20 12:18:15 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/DefaultEventStore.java	2014-04-04 20:46:36 +0000
@@ -66,74 +66,6 @@
     private static final ObjectMapper objectMapper = new ObjectMapper();
 
     @Override
-    public List<Event> getAll( Program program, OrganisationUnit organisationUnit )
-    {
-        return getAll( Arrays.asList( program ), new ArrayList<ProgramStage>(), Arrays.asList( organisationUnit ),
-            null, null, null );
-    }
-
-    @Override
-    public List<Event> getAll( Program program, OrganisationUnit organisationUnit, Date startDate, Date endDate )
-    {
-        return getAll( Arrays.asList( program ), new ArrayList<ProgramStage>(), Arrays.asList( organisationUnit ),
-            null, startDate, endDate );
-    }
-
-    @Override
-    public List<Event> getAll( Program program, OrganisationUnit organisationUnit, TrackedEntityInstance trackedEntityInstance, Date startDate,
-        Date endDate )
-    {
-        return getAll( Arrays.asList( program ), new ArrayList<ProgramStage>(), Arrays.asList( organisationUnit ),
-            trackedEntityInstance, startDate, endDate );
-    }
-
-    @Override
-    public List<Event> getAll( ProgramStage programStage, OrganisationUnit organisationUnit )
-    {
-        return getAll( new ArrayList<Program>(), Arrays.asList( programStage ), Arrays.asList( organisationUnit ),
-            null, null, null );
-    }
-
-    @Override
-    public List<Event> getAll( ProgramStage programStage, OrganisationUnit organisationUnit, Date startDate,
-        Date endDate )
-    {
-        return getAll( new ArrayList<Program>(), Arrays.asList( programStage ), Arrays.asList( organisationUnit ),
-            null, startDate, endDate );
-    }
-
-    @Override
-    public List<Event> getAll( ProgramStage programStage, OrganisationUnit organisationUnit, TrackedEntityInstance trackedEntityInstance,
-        Date startDate, Date endDate )
-    {
-        return getAll( new ArrayList<Program>(), Arrays.asList( programStage ), Arrays.asList( organisationUnit ),
-            trackedEntityInstance, startDate, endDate );
-    }
-
-    @Override
-    public List<Event> getAll( Program program, ProgramStage programStage, OrganisationUnit organisationUnit )
-    {
-        return getAll( Arrays.asList( program ), Arrays.asList( programStage ), Arrays.asList( organisationUnit ),
-            null, null, null );
-    }
-
-    @Override
-    public List<Event> getAll( Program program, ProgramStage programStage, OrganisationUnit organisationUnit,
-        TrackedEntityInstance trackedEntityInstance )
-    {
-        return getAll( Arrays.asList( program ), Arrays.asList( programStage ), Arrays.asList( organisationUnit ),
-            trackedEntityInstance, null, null );
-    }
-
-    @Override
-    public List<Event> getAll( Program program, ProgramStage programStage, OrganisationUnit organisationUnit,
-        Date startDate, Date endDate )
-    {
-        return getAll( Arrays.asList( program ), Arrays.asList( programStage ), Arrays.asList( organisationUnit ),
-            null, startDate, endDate );
-    }
-
-    @Override
     public List<Event> getAll( Program program, ProgramStage programStage, OrganisationUnit organisationUnit,
         TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate )
     {
@@ -142,27 +74,6 @@
     }
 
     @Override
-    public List<Event> getAll( Program program, List<ProgramStage> programStages, OrganisationUnit organisationUnit )
-    {
-        return getAll( Arrays.asList( program ), programStages, Arrays.asList( organisationUnit ), null, null, null );
-    }
-
-    @Override
-    public List<Event> getAll( Program program, List<ProgramStage> programStages, OrganisationUnit organisationUnit,
-        Date startDate, Date endDate )
-    {
-        return getAll( Arrays.asList( program ), programStages, Arrays.asList( organisationUnit ), null, startDate,
-            endDate );
-    }
-
-    @Override
-    public List<Event> getAll( List<Program> programs, List<ProgramStage> programStages,
-        List<OrganisationUnit> organisationUnits, Date startDate, Date endDate )
-    {
-        return getAll( programs, programStages, organisationUnits, null, startDate, endDate );
-    }
-
-    @Override
     public List<Event> getAll( List<Program> programs, List<ProgramStage> programStages,
         List<OrganisationUnit> organisationUnits, TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate )
     {

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventService.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventService.java	2014-04-04 20:46:36 +0000
@@ -52,28 +52,8 @@
     // READ
     // -------------------------------------------------------------------------
 
-    Events getEvents( Program program, OrganisationUnit organisationUnit );
-
-    Events getEvents( Program program, OrganisationUnit organisationUnit, Date startDate, Date endDate );
-
-    Events getEvents( Program program, OrganisationUnit organisationUnit, TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate );
-
-    Events getEvents( ProgramStage programStage, OrganisationUnit organisationUnit );
-
-    Events getEvents( ProgramStage programStage, OrganisationUnit organisationUnit, Date startDate, Date endDate );
-
-    Events getEvents( ProgramStage programStage, OrganisationUnit organisationUnit, TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate );
-
-    Events getEvents( Program program, ProgramStage programStage, OrganisationUnit organisationUnit );
-
-    Events getEvents( Program program, ProgramStage programStage, OrganisationUnit organisationUnit, TrackedEntityInstance trackedEntityInstance );
-
-    Events getEvents( Program program, ProgramStage programStage, OrganisationUnit organisationUnit, Date startDate, Date endDate );
-
     Events getEvents( Program program, ProgramStage programStage, OrganisationUnit organisationUnit, TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate );
 
-    Events getEvents( List<Program> programs, List<ProgramStage> programStages, List<OrganisationUnit> organisationUnits, Date startDate, Date endDate );
-
     Events getEvents( List<Program> programs, List<ProgramStage> programStages, List<OrganisationUnit> organisationUnits, TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate );
 
     Event getEvent( String uid );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventStore.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventStore.java	2014-04-04 20:46:36 +0000
@@ -41,32 +41,8 @@
  */
 public interface EventStore
 {
-    List<Event> getAll( Program program, OrganisationUnit organisationUnit );
-
-    List<Event> getAll( Program program, OrganisationUnit organisationUnit, Date startDate, Date endDate );
-
-    List<Event> getAll( ProgramStage programStage, OrganisationUnit organisationUnit );
-
-    List<Event> getAll( ProgramStage programStage, OrganisationUnit organisationUnit, Date startDate, Date endDate );
-
-    List<Event> getAll( Program program, ProgramStage programStage, OrganisationUnit organisationUnit );
-
-    List<Event> getAll( Program program, ProgramStage programStage, OrganisationUnit organisationUnit, TrackedEntityInstance trackedEntityInstance );
-
-    List<Event> getAll( Program program, ProgramStage programStage, OrganisationUnit organisationUnit, Date startDate, Date endDate );
-
-    List<Event> getAll( Program program, List<ProgramStage> programStages, OrganisationUnit organisationUnit );
-
-    List<Event> getAll( Program program, List<ProgramStage> programStages, OrganisationUnit organisationUnit, Date startDate, Date endDate );
+    List<Event> getAll( Program program, ProgramStage programStage, OrganisationUnit organisationUnit, TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate );
 
     List<Event> getAll( List<Program> programs, List<ProgramStage> programStages, List<OrganisationUnit> organisationUnits,
         TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate );
-
-    List<Event> getAll( Program program, OrganisationUnit organisationUnit, TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate );
-
-    List<Event> getAll( ProgramStage programStage, OrganisationUnit organisationUnit, TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate );
-
-    List<Event> getAll( Program program, ProgramStage programStage, OrganisationUnit organisationUnit, TrackedEntityInstance trackedEntityInstance, Date startDate, Date endDate );
-
-    List<Event> getAll( List<Program> programs, List<ProgramStage> programStages, List<OrganisationUnit> organisationUnits, Date startDate, Date endDate );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java	2014-04-04 20:46:36 +0000
@@ -130,51 +130,6 @@
     }
 
     @Test
-    public void testGetPersonsByProgramOrgUnit()
-    {
-        for ( int i = 0; i < 10; i++ )
-        {
-            Event event = createEvent( programA.getUid(), organisationUnitA.getUid() );
-
-            ImportSummary importSummary = eventService.addEvent( event );
-            assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
-            assertNotNull( importSummary.getReference() );
-        }
-
-        assertEquals( 10, eventService.getEvents( programA, organisationUnitA ).getEvents().size() );
-    }
-
-    @Test
-    public void testGetPersonsByProgramStageOrgUnit()
-    {
-        for ( int i = 0; i < 10; i++ )
-        {
-            Event event = createEvent( programA.getUid(), organisationUnitA.getUid() );
-
-            ImportSummary importSummary = eventService.addEvent( event );
-            assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
-            assertNotNull( importSummary.getReference() );
-        }
-
-        assertEquals( 10, eventService.getEvents( programStageA, organisationUnitA ).getEvents().size() );
-    }
-
-    @Test
-    public void testGetPersonsByProgramProgramStageOrgUnit()
-    {
-        for ( int i = 0; i < 10; i++ )
-        {
-            Event event = createEvent( programA.getUid(), organisationUnitA.getUid() );
-
-            ImportSummary importSummary = eventService.addEvent( event );
-            assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
-            assertNotNull( importSummary.getReference() );
-        }
-
-        assertEquals( 10, eventService.getEvents( programA, programStageA, organisationUnitA ).getEvents().size() );
-    }
-
-    @Test
     public void testGetPersonsByProgramStageInstance()
     {
         Event event = createEvent( programA.getUid(), organisationUnitA.getUid() );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java	2014-03-20 13:46:11 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java	2014-04-04 20:46:36 +0000
@@ -233,7 +233,7 @@
         importSummary = eventService.addEvent( event );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
-        assertEquals( 1, eventService.getEvents( programA, programStageA, organisationUnitA ).getEvents().size() );
+        assertEquals( 1, eventService.getEvents( programA, programStageA, organisationUnitA, null, null, null ).getEvents().size() );
     }
 
     @Test
@@ -254,14 +254,14 @@
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
         sessionFactory.getCurrentSession().flush();
-        assertEquals( 2, eventService.getEvents( programA, organisationUnitA ).getEvents().size() );
+        assertEquals( 2, eventService.getEvents( programA, null, organisationUnitA, null, null, null ).getEvents().size() );
 
         event = createEvent( programA.getUid(), programStageB.getUid(), organisationUnitA.getUid(),
             trackedEntityInstanceMaleA.getTrackedEntityInstance(), dataElementB.getUid() );
         importSummary = eventService.addEvent( event );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
-        assertEquals( 3, eventService.getEvents( programA, organisationUnitA ).getEvents().size() );
+        assertEquals( 3, eventService.getEvents( programA, null, organisationUnitA, null, null, null ).getEvents().size() );
     }
 
     @Test
@@ -282,7 +282,7 @@
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
         sessionFactory.getCurrentSession().flush();
-        assertEquals( 2, eventService.getEvents( programA, organisationUnitA ).getEvents().size() );
+        assertEquals( 2, eventService.getEvents( programA, null, organisationUnitA, null, null, null ).getEvents().size() );
 
         event = createEvent( programA.getUid(), programStageB.getUid(), organisationUnitA.getUid(),
             trackedEntityInstanceMaleA.getTrackedEntityInstance(), dataElementB.getUid() );
@@ -290,14 +290,14 @@
         importSummary = eventService.addEvent( event );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
-        assertEquals( 2, eventService.getEvents( programA, organisationUnitA ).getEvents().size() );
+        assertEquals( 2, eventService.getEvents( programA, null, organisationUnitA, null, null, null ).getEvents().size() );
 
         event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(),
             trackedEntityInstanceMaleA.getTrackedEntityInstance(), dataElementA.getUid() );
         importSummary = eventService.addEvent( event );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
-        assertEquals( 2, eventService.getEvents( programA, organisationUnitA ).getEvents().size() );
+        assertEquals( 2, eventService.getEvents( programA, null, organisationUnitA, null, null, null ).getEvents().size() );
     }
 
     private Enrollment createEnrollment( String program, String person )

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java	2014-03-26 14:01:14 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java	2014-04-04 20:46:36 +0000
@@ -188,19 +188,19 @@
         importSummary = eventService.addEvent( event );
         assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
 
-        assertEquals( 1, eventService.getEvents( programA, organisationUnitA ).getEvents().size() );
-
-        event = createEvent( programA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
-        importSummary = eventService.addEvent( event );
-        assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
-
-        assertEquals( 1, eventService.getEvents( programA, organisationUnitA ).getEvents().size() );
-
-        event = createEvent( programA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
-        importSummary = eventService.addEvent( event );
-        assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
-
-        assertEquals( 1, eventService.getEvents( programA, organisationUnitA ).getEvents().size() );
+        assertEquals( 1, eventService.getEvents( programA, null, organisationUnitA, null, null, null ).getEvents().size() );
+
+        event = createEvent( programA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
+        importSummary = eventService.addEvent( event );
+        assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
+
+        assertEquals( 1, eventService.getEvents( programA, null, organisationUnitA, null, null, null ).getEvents().size() );
+
+        event = createEvent( programA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
+        importSummary = eventService.addEvent( event );
+        assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
+
+        assertEquals( 1, eventService.getEvents( programA, null, organisationUnitA, null, null, null ).getEvents().size() );
     }
 
     @Test