← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21983: minor test fix

 

------------------------------------------------------------
revno: 21983
committer: Morten Olav Hansen <morten@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2016-02-17 12:45:31 +0700
message:
  minor test fix
removed:
  dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/de_deletes1.json
added:
  dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/de_simple_delete_code.json
  dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/de_simple_delete_uid.json
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceTest.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/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceTest.java	2016-02-17 05:33:53 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/metadata2/objectbundle/ObjectBundleServiceTest.java	2016-02-17 05:45:31 +0000
@@ -379,10 +379,10 @@
     }
 
     @Test
-    public void testDeletes1() throws IOException
+    public void testSimpleDataElementDeleteUID() throws IOException
     {
         Map<Class<? extends IdentifiableObject>, List<IdentifiableObject>> metadata = renderService.fromMetadata(
-            new ClassPathResource( "dxf2/de_deletes1.json" ).getInputStream(), RenderFormat.JSON );
+            new ClassPathResource( "dxf2/de_simple_delete_uid.json" ).getInputStream(), RenderFormat.JSON );
         defaultSetup();
 
         ObjectBundleParams params = new ObjectBundleParams();
@@ -399,6 +399,28 @@
         assertEquals( "deabcdefghB", dataElements.get( 0 ).getUid() );
     }
 
+    @Test
+    public void testSimpleDataElementDeleteCODE() throws IOException
+    {
+        Map<Class<? extends IdentifiableObject>, List<IdentifiableObject>> metadata = renderService.fromMetadata(
+            new ClassPathResource( "dxf2/de_simple_delete_code.json" ).getInputStream(), RenderFormat.JSON );
+        defaultSetup();
+
+        ObjectBundleParams params = new ObjectBundleParams();
+        params.setObjectBundleMode( ObjectBundleMode.COMMIT );
+        params.setPreheatIdentifier( PreheatIdentifier.CODE );
+        params.setImportMode( ImportStrategy.DELETE );
+        params.setObjects( metadata );
+
+        ObjectBundle bundle = objectBundleService.create( params );
+        objectBundleService.validate( bundle );
+        objectBundleService.commit( bundle );
+
+        List<DataElement> dataElements = manager.getAll( DataElement.class );
+        assertEquals( 1, dataElements.size() );
+        assertEquals( "DataElementCodeD", dataElements.get( 0 ).getCode() );
+    }
+
     private void defaultSetup()
     {
         DataElement de1 = createDataElement( 'A' );

=== removed file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/de_deletes1.json'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/de_deletes1.json	2016-02-17 05:33:53 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/de_deletes1.json	1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
-{
-  "dataElements": [
-    {
-      "id": "deabcdefghA"
-    },
-    {
-      "id": "deabcdefghC"
-    },
-    {
-      "id": "deabcdefghD"
-    }
-  ]
-}
\ No newline at end of file

=== added file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/de_simple_delete_code.json'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/de_simple_delete_code.json	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/de_simple_delete_code.json	2016-02-17 05:45:31 +0000
@@ -0,0 +1,13 @@
+{
+  "dataElements": [
+    {
+      "code": "DataElementCodeB"
+    },
+    {
+      "code": "DataElementCodeC"
+    },
+    {
+      "code": "DataElementCodeA"
+    }
+  ]
+}
\ No newline at end of file

=== added file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/de_simple_delete_uid.json'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/de_simple_delete_uid.json	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/resources/dxf2/de_simple_delete_uid.json	2016-02-17 05:45:31 +0000
@@ -0,0 +1,13 @@
+{
+  "dataElements": [
+    {
+      "id": "deabcdefghA"
+    },
+    {
+      "id": "deabcdefghC"
+    },
+    {
+      "id": "deabcdefghD"
+    }
+  ]
+}
\ No newline at end of file