dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #00281
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 90: dhis-service-jdbc-test: Updated JDBC service test
------------------------------------------------------------
revno: 90
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: dhis2
timestamp: Thu 2009-03-19 16:51:25 +0100
message:
dhis-service-jdbc-test: Updated JDBC service test
modified:
dhis-2/dhis-services/dhis-service-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementBatchHandlerTest.java
dhis-2/dhis-services/dhis-service-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorBatchHandlerTest.java
=== modified file 'dhis-2/dhis-services/dhis-service-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementBatchHandlerTest.java'
--- dhis-2/dhis-services/dhis-service-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementBatchHandlerTest.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementBatchHandlerTest.java 2009-03-19 15:51:25 +0000
@@ -32,6 +32,7 @@
import org.hisp.dhis.DhisConvenienceTest;
import org.hisp.dhis.jdbc.BatchHandler;
import org.hisp.dhis.jdbc.BatchHandlerFactory;
+import org.hisp.dhis.cache.HibernateCacheManager;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryComboService;
@@ -44,6 +45,8 @@
public class DataElementBatchHandlerTest
extends DhisConvenienceTest
{
+ private HibernateCacheManager cacheManager;
+
private BatchHandlerFactory batchHandlerFactory;
private BatchHandler batchHandler;
@@ -60,6 +63,8 @@
public void setUpTest()
{
+ cacheManager = (HibernateCacheManager) getBean( HibernateCacheManager.ID );
+
dataElementService = (DataElementService) getBean( DataElementService.ID );
batchHandlerFactory = (BatchHandlerFactory) getBean( BatchHandlerFactory.ID );
@@ -94,6 +99,8 @@
batchHandler.flush();
+ cacheManager.clearCache();
+
Collection<DataElement> dataElements = dataElementService.getAllDataElements();
assertTrue( dataElements.contains( dataElementA ) );
@@ -106,6 +113,8 @@
int idA = batchHandler.insertObject( dataElementA, true );
int idB = batchHandler.insertObject( dataElementB, true );
int idC = batchHandler.insertObject( dataElementC, true );
+
+ cacheManager.clearCache();
assertNotNull( dataElementService.getDataElement( idA ) );
assertNotNull( dataElementService.getDataElement( idB ) );
@@ -119,6 +128,8 @@
dataElementA.setName( "UpdatedName" );
batchHandler.updateObject( dataElementA );
+
+ cacheManager.clearCache();
assertEquals( dataElementService.getDataElement( id ).getName(), "UpdatedName" );
}
@@ -126,7 +137,7 @@
public void testGetObjectIdentifier()
{
int referenceId = dataElementService.addDataElement( dataElementA );
-
+
int retrievedId = batchHandler.getObjectIdentifier( "DataElementA" );
assertEquals( referenceId, retrievedId );
=== modified file 'dhis-2/dhis-services/dhis-service-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorBatchHandlerTest.java'
--- dhis-2/dhis-services/dhis-service-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorBatchHandlerTest.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorBatchHandlerTest.java 2009-03-19 15:51:25 +0000
@@ -32,6 +32,7 @@
import org.hisp.dhis.DhisConvenienceTest;
import org.hisp.dhis.jdbc.BatchHandler;
import org.hisp.dhis.jdbc.BatchHandlerFactory;
+import org.hisp.dhis.cache.HibernateCacheManager;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.indicator.IndicatorType;
@@ -43,6 +44,8 @@
public class IndicatorBatchHandlerTest
extends DhisConvenienceTest
{
+ private HibernateCacheManager cacheManager;
+
private BatchHandlerFactory batchHandlerFactory;
private BatchHandler batchHandler;
@@ -57,6 +60,8 @@
public void setUpTest()
{
+ cacheManager = (HibernateCacheManager) getBean( HibernateCacheManager.ID );
+
indicatorService = (IndicatorService) getBean( IndicatorService.ID );
batchHandlerFactory = (BatchHandlerFactory) getBean( BatchHandlerFactory.ID );
@@ -91,6 +96,8 @@
batchHandler.flush();
+ cacheManager.clearCache();
+
Collection<Indicator> indicators = indicatorService.getAllIndicators();
assertTrue( indicators.contains( indicatorA ) );
@@ -103,6 +110,8 @@
int idA = batchHandler.insertObject( indicatorA, true );
int idB = batchHandler.insertObject( indicatorB, true );
int idC = batchHandler.insertObject( indicatorC, true );
+
+ cacheManager.clearCache();
assertNotNull( indicatorService.getIndicator( idA ) );
assertNotNull( indicatorService.getIndicator( idB ) );
@@ -116,6 +125,8 @@
indicatorA.setName( "UpdatedName" );
batchHandler.updateObject( indicatorA );
+
+ cacheManager.clearCache();
assertEquals( indicatorService.getIndicator( id ).getName(), "UpdatedName" );
}
--
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.