dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40904
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20838: remove unused addEvent method, updated tests
------------------------------------------------------------
revno: 20838
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-10-22 10:05:41 +0700
message:
remove unused addEvent method, updated tests
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/EventService.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 2015-10-20 08:14:51 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java 2015-10-22 03:05:41 +0000
@@ -237,12 +237,6 @@
}
@Override
- public ImportSummary addEvent( Event event )
- {
- return addEvent( event, null );
- }
-
- @Override
public ImportSummary addEvent( Event event, ImportOptions importOptions )
{
return addEvent( event, currentUserService.getCurrentUser(), importOptions );
=== 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 2015-10-01 10:05:20 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/EventService.java 2015-10-22 03:05:41 +0000
@@ -70,8 +70,6 @@
// CREATE
// -------------------------------------------------------------------------
- ImportSummary addEvent( Event event );
-
ImportSummary addEvent( Event event, ImportOptions importOptions );
ImportSummaries addEvents( List<Event> events, ImportOptions importOptions );
=== 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 2015-09-11 11:54:53 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java 2015-10-22 03:05:41 +0000
@@ -133,7 +133,7 @@
{
Event event = createEvent( programA.getUid(), organisationUnitA.getUid() );
- ImportSummary importSummary = eventService.addEvent( event );
+ ImportSummary importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
assertNotNull( importSummary.getReference() );
@@ -148,7 +148,7 @@
{
Event event = createEvent( programA.getUid(), organisationUnitA.getUid() );
- ImportSummary importSummary = eventService.addEvent( event );
+ ImportSummary importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
assertNotNull( importSummary.getReference() );
@@ -159,7 +159,7 @@
public void testSaveEvent()
{
Event event = createEvent( programA.getUid(), organisationUnitA.getUid() );
- ImportSummary importSummary = eventService.addEvent( event );
+ ImportSummary importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
assertEquals( 0, importSummary.getConflicts().size() );
assertNotNull( importSummary.getReference() );
@@ -174,7 +174,7 @@
{
Event event = createEvent( programA.getUid(), organisationUnitA.getUid() );
- ImportSummary importSummary = eventService.addEvent( event );
+ ImportSummary importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
assertNotNull( importSummary.getReference() );
@@ -193,7 +193,7 @@
{
Event event = createEvent( programA.getUid(), organisationUnitA.getUid() );
- ImportSummary importSummary = eventService.addEvent( event );
+ ImportSummary importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
assertNotNull( importSummary.getReference() );
=== 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 2015-09-11 15:53:13 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java 2015-10-22 03:05:41 +0000
@@ -28,12 +28,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
-import java.util.Date;
-import java.util.HashSet;
-
import org.hamcrest.CoreMatchers;
import org.hibernate.SessionFactory;
import org.hisp.dhis.DhisSpringTest;
@@ -63,6 +57,12 @@
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
+import java.util.Date;
+import java.util.HashSet;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -86,13 +86,13 @@
@Autowired
private SessionFactory sessionFactory;
-
- @Autowired
+
+ @Autowired
private IdentifiableObjectManager identifiableObjectManager;
-
+
@Autowired
private UserService _userService;
-
+
private org.hisp.dhis.trackedentity.TrackedEntityInstance maleA;
private org.hisp.dhis.trackedentity.TrackedEntityInstance maleB;
@@ -199,7 +199,7 @@
{
Event event = createEvent( programA.getUid(), null, organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance(),
dataElementA.getUid() );
- ImportSummary importSummary = eventService.addEvent( event );
+ ImportSummary importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.ERROR, importSummary.getStatus() );
assertThat( importSummary.getDescription(),
CoreMatchers.containsString( "Event.programStage does not point to a valid programStage" ) );
@@ -210,7 +210,7 @@
{
Event event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(),
trackedEntityInstanceMaleA.getTrackedEntityInstance(), dataElementA.getUid() );
- ImportSummary importSummary = eventService.addEvent( event );
+ ImportSummary importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.ERROR, importSummary.getStatus() );
assertThat( importSummary.getDescription(), CoreMatchers.containsString( "is not enrolled in program" ) );
}
@@ -224,17 +224,17 @@
Event event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(),
trackedEntityInstanceMaleA.getTrackedEntityInstance(), dataElementA.getUid() );
- importSummary = eventService.addEvent( event );
- assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
-
- event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(),
- trackedEntityInstanceMaleA.getTrackedEntityInstance(), dataElementA.getUid() );
- importSummary = eventService.addEvent( event );
- assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
-
- event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(),
- trackedEntityInstanceMaleA.getTrackedEntityInstance(), dataElementA.getUid() );
- importSummary = eventService.addEvent( event );
+ importSummary = eventService.addEvent( event, null );
+ assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
+
+ event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(),
+ trackedEntityInstanceMaleA.getTrackedEntityInstance(), dataElementA.getUid() );
+ importSummary = eventService.addEvent( event, null );
+ assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
+
+ event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(),
+ trackedEntityInstanceMaleA.getTrackedEntityInstance(), dataElementA.getUid() );
+ importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
EventSearchParams params = new EventSearchParams();
@@ -242,7 +242,7 @@
params.setProgramStage( programStageA );
params.setOrgUnit( organisationUnitA );
params.setOrgUnitSelectionMode( OrganisationUnitSelectionMode.SELECTED );
-
+
assertEquals( 1, eventService.getEvents( params ).getEvents().size() );
}
@@ -255,27 +255,27 @@
Event event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(),
trackedEntityInstanceMaleA.getTrackedEntityInstance(), dataElementA.getUid() );
- importSummary = eventService.addEvent( event );
+ importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
event = createEvent( programA.getUid(), programStageB.getUid(), organisationUnitA.getUid(),
trackedEntityInstanceMaleA.getTrackedEntityInstance(), dataElementB.getUid() );
- importSummary = eventService.addEvent( event );
+ importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
sessionFactory.getCurrentSession().flush();
-
+
EventSearchParams params = new EventSearchParams();
params.setProgram( programA );
params.setOrgUnit( organisationUnitA );
params.setOrgUnitSelectionMode( OrganisationUnitSelectionMode.SELECTED );
-
+
assertEquals( 2, eventService.getEvents( params ).getEvents().size() );
event = createEvent( programA.getUid(), programStageB.getUid(), organisationUnitA.getUid(),
trackedEntityInstanceMaleA.getTrackedEntityInstance(), dataElementB.getUid() );
-
- importSummary = eventService.addEvent( event );
+
+ importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
assertEquals( 3, eventService.getEvents( params ).getEvents().size() );
@@ -290,12 +290,12 @@
Event event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(),
trackedEntityInstanceMaleA.getTrackedEntityInstance(), dataElementA.getUid() );
- importSummary = eventService.addEvent( event );
+ importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
event = createEvent( programA.getUid(), programStageB.getUid(), organisationUnitA.getUid(),
trackedEntityInstanceMaleA.getTrackedEntityInstance(), dataElementB.getUid() );
- importSummary = eventService.addEvent( event );
+ importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
sessionFactory.getCurrentSession().flush();
@@ -304,20 +304,20 @@
params.setProgram( programA );
params.setOrgUnit( organisationUnitA );
params.setOrgUnitSelectionMode( OrganisationUnitSelectionMode.SELECTED );
-
+
assertEquals( 2, eventService.getEvents( params ).getEvents().size() );
event = createEvent( programA.getUid(), programStageB.getUid(), organisationUnitA.getUid(),
trackedEntityInstanceMaleA.getTrackedEntityInstance(), dataElementB.getUid() );
event.setEvent( importSummary.getReference() );
- importSummary = eventService.addEvent( event );
+ importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
assertEquals( 2, eventService.getEvents( params ).getEvents().size() );
event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(),
trackedEntityInstanceMaleA.getTrackedEntityInstance(), dataElementA.getUid() );
- importSummary = eventService.addEvent( event );
+ importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
assertEquals( 2, eventService.getEvents( params ).getEvents().size() );
=== 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 2015-09-11 15:53:13 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java 2015-10-22 03:05:41 +0000
@@ -28,12 +28,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-
-import java.util.Date;
-import java.util.HashSet;
-
import org.hamcrest.CoreMatchers;
import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.common.IdentifiableObjectManager;
@@ -62,6 +56,12 @@
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
+import java.util.Date;
+import java.util.HashSet;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -82,13 +82,13 @@
@Autowired
private EnrollmentService enrollmentService;
-
- @Autowired
+
+ @Autowired
private IdentifiableObjectManager identifiableObjectManager;
-
+
@Autowired
private UserService _userService;
-
+
private org.hisp.dhis.trackedentity.TrackedEntityInstance maleA;
private org.hisp.dhis.trackedentity.TrackedEntityInstance maleB;
private org.hisp.dhis.trackedentity.TrackedEntityInstance femaleA;
@@ -162,7 +162,7 @@
public void testSaveWithoutEnrollmentShouldFail()
{
Event event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
- ImportSummary importSummary = eventService.addEvent( event );
+ ImportSummary importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.ERROR, importSummary.getStatus() );
assertThat( importSummary.getDescription(), CoreMatchers.containsString( "is not enrolled in program" ) );
}
@@ -175,7 +175,7 @@
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
Event event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
- importSummary = eventService.addEvent( event );
+ importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
}
@@ -187,24 +187,24 @@
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
Event event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
- importSummary = eventService.addEvent( event );
+ importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
EventSearchParams params = new EventSearchParams();
params.setProgram( programA );
params.setOrgUnit( organisationUnitA );
params.setOrgUnitSelectionMode( OrganisationUnitSelectionMode.SELECTED );
-
+
assertEquals( 1, eventService.getEvents( params ).getEvents().size() );
event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
- importSummary = eventService.addEvent( event );
+ importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
assertEquals( 1, eventService.getEvents( params ).getEvents().size() );
event = createEvent( programA.getUid(), programStageA.getUid(), organisationUnitA.getUid(), trackedEntityInstanceMaleA.getTrackedEntityInstance() );
- importSummary = eventService.addEvent( event );
+ importSummary = eventService.addEvent( event, null );
assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() );
assertEquals( 1, eventService.getEvents( params ).getEvents().size() );