dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41395
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21086: Minor
------------------------------------------------------------
revno: 21086
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-11-17 12:55:21 +0100
message:
Minor
modified:
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeServiceTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeStoreTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueServiceTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueStoreTest.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-core/src/test/java/org/hisp/dhis/attribute/AttributeServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeServiceTest.java 2015-11-16 05:51:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeServiceTest.java 2015-11-17 11:55:21 +0000
@@ -36,7 +36,7 @@
import static org.junit.Assert.*;
/**
- * @author mortenoh
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
public class AttributeServiceTest
extends DhisSpringTest
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeStoreTest.java 2015-11-16 05:51:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeStoreTest.java 2015-11-17 11:55:21 +0000
@@ -35,33 +35,35 @@
import static org.junit.Assert.assertEquals;
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
public class AttributeStoreTest
extends DhisSpringTest
{
@Autowired
private AttributeStore attributeStore;
- private Attribute attribute1;
-
- private Attribute attribute2;
+ private Attribute atA;
+ private Attribute atB;
@Override
protected void setUpTest()
{
- attribute1 = new Attribute();
- attribute1.setName( "attribute_simple" );
- attribute1.setValueType( ValueType.TEXT );
- attribute1.setIndicatorAttribute( true );
- attribute1.setDataElementAttribute( true );
-
- attribute2 = new Attribute();
- attribute2.setName( "attribute_with_options" );
- attribute2.setValueType( ValueType.TEXT );
- attribute2.setOrganisationUnitAttribute( true );
- attribute2.setDataElementAttribute( true );
-
- attributeStore.save( attribute1 );
- attributeStore.save( attribute2 );
+ atA = new Attribute();
+ atA.setName( "attribute_simple" );
+ atA.setValueType( ValueType.TEXT );
+ atA.setIndicatorAttribute( true );
+ atA.setDataElementAttribute( true );
+
+ atB = new Attribute();
+ atB.setName( "attribute_with_options" );
+ atB.setValueType( ValueType.TEXT );
+ atB.setOrganisationUnitAttribute( true );
+ atB.setDataElementAttribute( true );
+
+ attributeStore.save( atA );
+ attributeStore.save( atB );
}
@Test
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueServiceTest.java 2015-11-16 05:51:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueServiceTest.java 2015-11-17 11:55:21 +0000
@@ -44,15 +44,14 @@
@Autowired
private AttributeService attributeService;
- private AttributeValue attributeValue1;
-
- private AttributeValue attributeValue2;
+ private AttributeValue avA;
+ private AttributeValue avB;
@Override
protected void setUpTest()
{
- attributeValue1 = new AttributeValue( "value 1" );
- attributeValue2 = new AttributeValue( "value 2" );
+ avA = new AttributeValue( "value 1" );
+ avB = new AttributeValue( "value 2" );
Attribute attribute1 = new Attribute( "attribute 1", ValueType.TEXT );
Attribute attribute2 = new Attribute( "attribute 2", ValueType.TEXT );
@@ -60,65 +59,65 @@
attributeService.addAttribute( attribute1 );
attributeService.addAttribute( attribute2 );
- attributeValue1.setAttribute( attribute1 );
- attributeValue2.setAttribute( attribute2 );
+ avA.setAttribute( attribute1 );
+ avB.setAttribute( attribute2 );
- attributeService.addAttributeValue( attributeValue1 );
- attributeService.addAttributeValue( attributeValue2 );
+ attributeService.addAttributeValue( avA );
+ attributeService.addAttributeValue( avB );
}
@Test
public void testAddAttributeValue()
{
- attributeValue1 = attributeService.getAttributeValue( attributeValue1.getId() );
- attributeValue2 = attributeService.getAttributeValue( attributeValue2.getId() );
+ avA = attributeService.getAttributeValue( avA.getId() );
+ avB = attributeService.getAttributeValue( avB.getId() );
- assertNotNull( attributeValue1 );
- assertNotNull( attributeValue2 );
+ assertNotNull( avA );
+ assertNotNull( avB );
}
@Test
public void testUpdateAttributeValue()
{
- attributeValue1.setValue( "updated value 1" );
- attributeValue2.setValue( "updated value 2" );
-
- attributeService.updateAttributeValue( attributeValue1 );
- attributeService.updateAttributeValue( attributeValue2 );
-
- attributeValue1 = attributeService.getAttributeValue( attributeValue1.getId() );
- attributeValue2 = attributeService.getAttributeValue( attributeValue2.getId() );
-
- assertNotNull( attributeValue1 );
- assertNotNull( attributeValue2 );
-
- assertEquals( "updated value 1", attributeValue1.getValue() );
- assertEquals( "updated value 2", attributeValue2.getValue() );
+ avA.setValue( "updated value 1" );
+ avB.setValue( "updated value 2" );
+
+ attributeService.updateAttributeValue( avA );
+ attributeService.updateAttributeValue( avB );
+
+ avA = attributeService.getAttributeValue( avA.getId() );
+ avB = attributeService.getAttributeValue( avB.getId() );
+
+ assertNotNull( avA );
+ assertNotNull( avB );
+
+ assertEquals( "updated value 1", avA.getValue() );
+ assertEquals( "updated value 2", avB.getValue() );
}
@Test
public void testDeleteAttributeValue()
{
- int attributeValueId1 = attributeValue1.getId();
- int attributeValueId2 = attributeValue2.getId();
-
- attributeService.deleteAttributeValue( attributeValue1 );
- attributeService.deleteAttributeValue( attributeValue2 );
-
- attributeValue1 = attributeService.getAttributeValue( attributeValueId1 );
- attributeValue2 = attributeService.getAttributeValue( attributeValueId2 );
-
- assertNull( attributeValue1 );
- assertNull( attributeValue2 );
+ int attributeValueId1 = avA.getId();
+ int attributeValueId2 = avB.getId();
+
+ attributeService.deleteAttributeValue( avA );
+ attributeService.deleteAttributeValue( avB );
+
+ avA = attributeService.getAttributeValue( attributeValueId1 );
+ avB = attributeService.getAttributeValue( attributeValueId2 );
+
+ assertNull( avA );
+ assertNull( avB );
}
@Test
public void testGetAttributeValue()
{
- attributeValue1 = attributeService.getAttributeValue( attributeValue1.getId() );
- attributeValue2 = attributeService.getAttributeValue( attributeValue2.getId() );
+ avA = attributeService.getAttributeValue( avA.getId() );
+ avB = attributeService.getAttributeValue( avB.getId() );
- assertNotNull( attributeValue1 );
- assertNotNull( attributeValue2 );
+ assertNotNull( avA );
+ assertNotNull( avB );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueStoreTest.java 2015-11-17 04:18:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueStoreTest.java 2015-11-17 11:55:21 +0000
@@ -30,13 +30,15 @@
import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.common.ValueType;
-import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
public class AttributeValueStoreTest
extends DhisSpringTest
{
@@ -46,35 +48,34 @@
@Autowired
private AttributeStore attributeStore;
- private AttributeValue attributeValue1;
-
- private AttributeValue attributeValue2;
-
- private Attribute attribute1;
+ private AttributeValue avA;
+ private AttributeValue avB;
+
+ private Attribute atA;
@Override
protected void setUpTest()
{
- attribute1 = new Attribute();
- attribute1.setName( "attribute_simple" );
- attribute1.setValueType( ValueType.TEXT );
-
- attributeStore.save( attribute1 );
-
- attributeValue1 = new AttributeValue( "value 1" );
- attributeValue1.setAttribute( attribute1 );
-
- attributeValue2 = new AttributeValue( "value 2" );
- attributeValue2.setAttribute( attribute1 );
-
- attributeValueStore.save( attributeValue1 );
- attributeValueStore.save( attributeValue2 );
+ atA = new Attribute();
+ atA.setName( "attribute_simple" );
+ atA.setValueType( ValueType.TEXT );
+
+ attributeStore.save( atA );
+
+ avA = new AttributeValue( "value 1" );
+ avA.setAttribute( atA );
+
+ avB = new AttributeValue( "value 2" );
+ avB.setAttribute( atA );
+
+ attributeValueStore.save( avA );
+ attributeValueStore.save( avB );
}
@Test
public void testGetAttribute()
{
- AttributeValue av = attributeValueStore.get( attributeValue1.getId() );
+ AttributeValue av = attributeValueStore.get( avA.getId() );
assertNotNull( av );
assertNotNull( av.getAttribute() );
@@ -83,7 +84,7 @@
@Test
public void testGetValue()
{
- AttributeValue av = attributeValueStore.get( attributeValue1.getId() );
+ AttributeValue av = attributeValueStore.get( avA.getId() );
assertNotNull( av );
assertEquals( "value 1", av.getValue() );