← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4533: refactored dynamic attribute services

 

------------------------------------------------------------
revno: 4533
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-09-07 10:03:18 +0200
message:
  refactored dynamic attribute services
removed:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeOptionService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValueService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeOptionService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeValueService.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeOptionServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueServiceTest.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
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeOptionService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeOptionService.java	2011-09-06 11:52:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeOptionService.java	1970-01-01 00:00:00 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.hisp.dhis.attribute;
-
-import java.util.Set;
-
-/**
- * @author mortenoh
- */
-public interface AttributeOptionService
-{
-    String ID = AttributeOptionService.class.getName();
-
-    public void addAttributeOption( AttributeOption attributeOption );
-
-    public void updateAttributeOption( AttributeOption attributeOption );
-
-    public void deleteAttributeOption( AttributeOption attributeOption );
-
-    public AttributeOption getAttributeOption( int id );
-
-    public Set<AttributeOption> getAllAttributeOptions();
-}

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java	2011-09-06 11:52:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java	2011-09-07 08:03:18 +0000
@@ -45,4 +45,24 @@
     public Attribute getAttribute( int id );
 
     public Set<Attribute> getAllAttributes();
+
+    public void addAttributeOption( AttributeOption attributeOption );
+
+    public void updateAttributeOption( AttributeOption attributeOption );
+
+    public void deleteAttributeOption( AttributeOption attributeOption );
+
+    public AttributeOption getAttributeOption( int id );
+
+    public Set<AttributeOption> getAllAttributeOptions();
+
+    public void addAttributeValue( AttributeValue attributeValue );
+
+    public void updateAttributeValue( AttributeValue attributeValue );
+
+    public void deleteAttributeValue( AttributeValue attributeValue );
+
+    public AttributeValue getAttributeValue( int id );
+
+    public Set<AttributeValue> getAllAttributeValues();
 }

=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValueService.java	2011-09-06 11:52:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValueService.java	1970-01-01 00:00:00 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.hisp.dhis.attribute;
-
-import java.util.Set;
-
-/**
- * @author mortenoh
- */
-public interface AttributeValueService
-{
-    String ID = AttributeValueStore.class.getName();
-
-    public void addAttributeValue( AttributeValue attributeValue );
-
-    public void updateAttributeValue( AttributeValue attributeValue );
-
-    public void deleteAttributeValue( AttributeValue attributeValue );
-
-    public AttributeValue getAttributeValue( int id );
-
-    public Set<AttributeValue> getAllAttributeValues();
-}

=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeOptionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeOptionService.java	2011-09-06 11:52:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeOptionService.java	1970-01-01 00:00:00 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2004-2010, University of Oslo All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met: *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer. * Redistributions in binary
- * form must reproduce the above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or other materials provided
- * with the distribution. * Neither the name of the HISP project nor the names
- * of its contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission. THIS SOFTWARE IS
- * PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.hisp.dhis.attribute;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * @author mortenoh
- */
-@Transactional
-public class DefaultAttributeOptionService
-    implements AttributeOptionService
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private AttributeOptionStore attributeOptionStore;
-
-    public AttributeOptionStore getAttributeOptionStore()
-    {
-        return attributeOptionStore;
-    }
-
-    public void setAttributeOptionStore( AttributeOptionStore attributeOptionStore )
-    {
-        this.attributeOptionStore = attributeOptionStore;
-    }
-
-    // -------------------------------------------------------------------------
-    // AttributeOptionService implementation
-    // -------------------------------------------------------------------------
-
-    @Override
-    public void addAttributeOption( AttributeOption attributeOption )
-    {
-        attributeOptionStore.save( attributeOption );
-    }
-
-    @Override
-    public void updateAttributeOption( AttributeOption attributeOption )
-    {
-        attributeOptionStore.update( attributeOption );
-    }
-
-    @Override
-    public void deleteAttributeOption( AttributeOption attributeOption )
-    {
-        attributeOptionStore.delete( attributeOption );
-    }
-
-    @Override
-    public AttributeOption getAttributeOption( int id )
-    {
-        return attributeOptionStore.get( id );
-    }
-
-    @Override
-    public Set<AttributeOption> getAllAttributeOptions()
-    {
-        return new HashSet<AttributeOption>( attributeOptionStore.getAll() );
-    }
-}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java	2011-09-06 11:52:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java	2011-09-07 08:03:18 +0000
@@ -51,8 +51,32 @@
         this.attributeStore = attributeStore;
     }
 
+    private AttributeOptionStore attributeOptionStore;
+
+    public AttributeOptionStore getAttributeOptionStore()
+    {
+        return attributeOptionStore;
+    }
+
+    public void setAttributeOptionStore( AttributeOptionStore attributeOptionStore )
+    {
+        this.attributeOptionStore = attributeOptionStore;
+    }
+
+    private AttributeValueStore attributeValueStore;
+
+    public AttributeValueStore getAttributeValueStore()
+    {
+        return attributeValueStore;
+    }
+
+    public void setAttributeValueStore( AttributeValueStore attributeValueStore )
+    {
+        this.attributeValueStore = attributeValueStore;
+    }
+
     // -------------------------------------------------------------------------
-    // AttributeService implementation
+    // Attribute implementation
     // -------------------------------------------------------------------------
 
     @Override
@@ -84,4 +108,73 @@
     {
         return new HashSet<Attribute>( attributeStore.getAll() );
     }
+
+    // -------------------------------------------------------------------------
+    // AttributeOption implementation
+    // -------------------------------------------------------------------------
+    
+    @Override
+    public void addAttributeOption( AttributeOption attributeOption )
+    {
+        attributeOptionStore.save( attributeOption );
+    }
+
+    @Override
+    public void updateAttributeOption( AttributeOption attributeOption )
+    {
+        attributeOptionStore.update( attributeOption );
+    }
+
+    @Override
+    public void deleteAttributeOption( AttributeOption attributeOption )
+    {
+        attributeOptionStore.delete( attributeOption );
+    }
+
+    @Override
+    public AttributeOption getAttributeOption( int id )
+    {
+        return attributeOptionStore.get( id );
+    }
+
+    @Override
+    public Set<AttributeOption> getAllAttributeOptions()
+    {
+        return new HashSet<AttributeOption>( attributeOptionStore.getAll() );
+    }
+
+    // -------------------------------------------------------------------------
+    // AttributeValue implementation
+    // -------------------------------------------------------------------------
+    
+    @Override
+    public void addAttributeValue( AttributeValue attributeValue )
+    {
+        attributeValueStore.save( attributeValue );
+    }
+
+    @Override
+    public void updateAttributeValue( AttributeValue attributeValue )
+    {
+        attributeValueStore.update( attributeValue );
+    }
+
+    @Override
+    public void deleteAttributeValue( AttributeValue attributeValue )
+    {
+        attributeValueStore.delete( attributeValue );
+    }
+
+    @Override
+    public AttributeValue getAttributeValue( int id )
+    {
+        return attributeValueStore.get( id );
+    }
+
+    @Override
+    public Set<AttributeValue> getAllAttributeValues()
+    {
+        return new HashSet<AttributeValue>( attributeValueStore.getAll() );
+    }
+
 }

=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeValueService.java	2011-09-06 11:52:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeValueService.java	1970-01-01 00:00:00 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2004-2010, University of Oslo All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met: *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer. * Redistributions in binary
- * form must reproduce the above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or other materials provided
- * with the distribution. * Neither the name of the HISP project nor the names
- * of its contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission. THIS SOFTWARE IS
- * PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.hisp.dhis.attribute;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * @author mortenoh
- */
-@Transactional
-public class DefaultAttributeValueService
-    implements AttributeValueService
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private AttributeValueStore attributeValueStore;
-
-    public AttributeValueStore getAttributeValueStore()
-    {
-        return attributeValueStore;
-    }
-
-    public void setAttributeValueStore( AttributeValueStore attributeValueStore )
-    {
-        this.attributeValueStore = attributeValueStore;
-    }
-
-    // -------------------------------------------------------------------------
-    // AttributeValueService implementation
-    // -------------------------------------------------------------------------
-
-    @Override
-    public void addAttributeValue( AttributeValue attributeValue )
-    {
-        attributeValueStore.save( attributeValue );
-    }
-
-    @Override
-    public void updateAttributeValue( AttributeValue attributeValue )
-    {
-        attributeValueStore.update( attributeValue );
-    }
-
-    @Override
-    public void deleteAttributeValue( AttributeValue attributeValue )
-    {
-        attributeValueStore.delete( attributeValue );
-    }
-
-    @Override
-    public AttributeValue getAttributeValue( int id )
-    {
-        return attributeValueStore.get( id );
-    }
-
-    @Override
-    public Set<AttributeValue> getAllAttributeValues()
-    {
-        return new HashSet<AttributeValue>( attributeValueStore.getAll() );
-    }
-}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2011-09-06 11:52:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2011-09-07 08:03:18 +0000
@@ -463,13 +463,7 @@
 
   <bean id="org.hisp.dhis.attribute.AttributeService" class="org.hisp.dhis.attribute.DefaultAttributeService">
     <property name="attributeStore" ref="org.hisp.dhis.attribute.AttributeStore" />
-  </bean>
-
-  <bean id="org.hisp.dhis.attribute.AttributeOptionService" class="org.hisp.dhis.attribute.DefaultAttributeOptionService">
     <property name="attributeOptionStore" ref="org.hisp.dhis.attribute.AttributeOptionStore" />
-  </bean>
-
-  <bean id="org.hisp.dhis.attribute.AttributeValueService" class="org.hisp.dhis.attribute.DefaultAttributeValueService">
     <property name="attributeValueStore" ref="org.hisp.dhis.attribute.AttributeValueStore" />
   </bean>
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeOptionServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeOptionServiceTest.java	2011-09-06 11:52:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeOptionServiceTest.java	2011-09-07 08:03:18 +0000
@@ -34,12 +34,12 @@
 public class AttributeOptionServiceTest
     extends DhisSpringTest
 {
-    private AttributeOptionService attributeOptionService;
+    private AttributeService attributeService;
 
     @Override
     protected void setUpTest()
     {
-        attributeOptionService = (AttributeOptionService) getBean( "org.hisp.dhis.attribute.AttributeOptionService" );
+        attributeService = (AttributeService) getBean( "org.hisp.dhis.attribute.AttributeService" );
     }
 
     @Test
@@ -48,11 +48,11 @@
         AttributeOption attributeOption1 = new AttributeOption( "option 1" );
         AttributeOption attributeOption2 = new AttributeOption( "option 2" );
 
-        attributeOptionService.addAttributeOption( attributeOption1 );
-        attributeOptionService.addAttributeOption( attributeOption2 );
+        attributeService.addAttributeOption( attributeOption1 );
+        attributeService.addAttributeOption( attributeOption2 );
 
-        attributeOption1 = attributeOptionService.getAttributeOption( attributeOption1.getId() );
-        attributeOption2 = attributeOptionService.getAttributeOption( attributeOption2.getId() );
+        attributeOption1 = attributeService.getAttributeOption( attributeOption1.getId() );
+        attributeOption2 = attributeService.getAttributeOption( attributeOption2.getId() );
 
         assertNotNull( attributeOption1 );
         assertNotNull( attributeOption2 );
@@ -64,17 +64,17 @@
         AttributeOption attributeOption1 = new AttributeOption( "option 1" );
         AttributeOption attributeOption2 = new AttributeOption( "option 2" );
 
-        attributeOptionService.addAttributeOption( attributeOption1 );
-        attributeOptionService.addAttributeOption( attributeOption2 );
+        attributeService.addAttributeOption( attributeOption1 );
+        attributeService.addAttributeOption( attributeOption2 );
 
         attributeOption1.setValue( "updated option 1" );
         attributeOption2.setValue( "updated option 2" );
 
-        attributeOptionService.updateAttributeOption( attributeOption1 );
-        attributeOptionService.updateAttributeOption( attributeOption2 );
+        attributeService.updateAttributeOption( attributeOption1 );
+        attributeService.updateAttributeOption( attributeOption2 );
 
-        attributeOption1 = attributeOptionService.getAttributeOption( attributeOption1.getId() );
-        attributeOption2 = attributeOptionService.getAttributeOption( attributeOption2.getId() );
+        attributeOption1 = attributeService.getAttributeOption( attributeOption1.getId() );
+        attributeOption2 = attributeService.getAttributeOption( attributeOption2.getId() );
 
         assertNotNull( attributeOption1 );
         assertNotNull( attributeOption2 );
@@ -89,17 +89,17 @@
         AttributeOption attributeOption1 = new AttributeOption( "option 1" );
         AttributeOption attributeOption2 = new AttributeOption( "option 2" );
 
-        attributeOptionService.addAttributeOption( attributeOption1 );
-        attributeOptionService.addAttributeOption( attributeOption2 );
+        attributeService.addAttributeOption( attributeOption1 );
+        attributeService.addAttributeOption( attributeOption2 );
 
         int attributeOptionId1 = attributeOption1.getId();
         int attributeOptionId2 = attributeOption2.getId();
 
-        attributeOptionService.deleteAttributeOption( attributeOption1 );
-        attributeOptionService.deleteAttributeOption( attributeOption2 );
+        attributeService.deleteAttributeOption( attributeOption1 );
+        attributeService.deleteAttributeOption( attributeOption2 );
 
-        assertNull( attributeOptionService.getAttributeOption( attributeOptionId1 ) );
-        assertNull( attributeOptionService.getAttributeOption( attributeOptionId2 ) );
+        assertNull( attributeService.getAttributeOption( attributeOptionId1 ) );
+        assertNull( attributeService.getAttributeOption( attributeOptionId2 ) );
     }
 
     @Test
@@ -108,11 +108,11 @@
         AttributeOption attributeOption1 = new AttributeOption( "option 1" );
         AttributeOption attributeOption2 = new AttributeOption( "option 2" );
 
-        attributeOptionService.addAttributeOption( attributeOption1 );
-        attributeOptionService.addAttributeOption( attributeOption2 );
+        attributeService.addAttributeOption( attributeOption1 );
+        attributeService.addAttributeOption( attributeOption2 );
 
-        attributeOption1 = attributeOptionService.getAttributeOption( attributeOption1.getId() );
-        attributeOption2 = attributeOptionService.getAttributeOption( attributeOption2.getId() );
+        attributeOption1 = attributeService.getAttributeOption( attributeOption1.getId() );
+        attributeOption2 = attributeService.getAttributeOption( attributeOption2.getId() );
 
         assertNotNull( attributeOption1 );
         assertNotNull( attributeOption2 );
@@ -124,9 +124,9 @@
         AttributeOption attributeOption1 = new AttributeOption( "option 1" );
         AttributeOption attributeOption2 = new AttributeOption( "option 2" );
 
-        attributeOptionService.addAttributeOption( attributeOption1 );
-        attributeOptionService.addAttributeOption( attributeOption2 );
+        attributeService.addAttributeOption( attributeOption1 );
+        attributeService.addAttributeOption( attributeOption2 );
 
-        assertEquals( 2, attributeOptionService.getAllAttributeOptions().size() );
+        assertEquals( 2, attributeService.getAllAttributeOptions().size() );
     }
 }

=== 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	2011-09-06 11:52:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueServiceTest.java	2011-09-07 08:03:18 +0000
@@ -34,12 +34,12 @@
 public class AttributeValueServiceTest
     extends DhisSpringTest
 {
-    private AttributeValueService attributeValueService;
+    private AttributeService attributeService;
 
     @Override
     protected void setUpTest()
     {
-        attributeValueService = (AttributeValueService) getBean( "org.hisp.dhis.attribute.AttributeValueService" );
+        attributeService = (AttributeService) getBean( "org.hisp.dhis.attribute.AttributeService" );
     }
 
     @Test
@@ -48,11 +48,11 @@
         AttributeValue attributeValue1 = new AttributeValue( "value 1" );
         AttributeValue attributeValue2 = new AttributeValue( "value 2" );
 
-        attributeValueService.addAttributeValue( attributeValue1 );
-        attributeValueService.addAttributeValue( attributeValue2 );
+        attributeService.addAttributeValue( attributeValue1 );
+        attributeService.addAttributeValue( attributeValue2 );
 
-        attributeValue1 = attributeValueService.getAttributeValue( attributeValue1.getId() );
-        attributeValue2 = attributeValueService.getAttributeValue( attributeValue2.getId() );
+        attributeValue1 = attributeService.getAttributeValue( attributeValue1.getId() );
+        attributeValue2 = attributeService.getAttributeValue( attributeValue2.getId() );
 
         assertNotNull( attributeValue1 );
         assertNotNull( attributeValue2 );
@@ -64,17 +64,17 @@
         AttributeValue attributeValue1 = new AttributeValue( "value 1" );
         AttributeValue attributeValue2 = new AttributeValue( "value 2" );
 
-        attributeValueService.addAttributeValue( attributeValue1 );
-        attributeValueService.addAttributeValue( attributeValue2 );
+        attributeService.addAttributeValue( attributeValue1 );
+        attributeService.addAttributeValue( attributeValue2 );
 
         attributeValue1.setValue( "updated value 1" );
         attributeValue2.setValue( "updated value 2" );
 
-        attributeValueService.updateAttributeValue( attributeValue1 );
-        attributeValueService.updateAttributeValue( attributeValue2 );
+        attributeService.updateAttributeValue( attributeValue1 );
+        attributeService.updateAttributeValue( attributeValue2 );
 
-        attributeValue1 = attributeValueService.getAttributeValue( attributeValue1.getId() );
-        attributeValue2 = attributeValueService.getAttributeValue( attributeValue2.getId() );
+        attributeValue1 = attributeService.getAttributeValue( attributeValue1.getId() );
+        attributeValue2 = attributeService.getAttributeValue( attributeValue2.getId() );
 
         assertNotNull( attributeValue1 );
         assertNotNull( attributeValue2 );
@@ -89,17 +89,17 @@
         AttributeValue attributeValue1 = new AttributeValue( "value 1" );
         AttributeValue attributeValue2 = new AttributeValue( "value 2" );
 
-        attributeValueService.addAttributeValue( attributeValue1 );
-        attributeValueService.addAttributeValue( attributeValue2 );
+        attributeService.addAttributeValue( attributeValue1 );
+        attributeService.addAttributeValue( attributeValue2 );
 
         int attributeValueId1 = attributeValue1.getId();
         int attributeValueId2 = attributeValue2.getId();
 
-        attributeValueService.deleteAttributeValue( attributeValue1 );
-        attributeValueService.deleteAttributeValue( attributeValue2 );
+        attributeService.deleteAttributeValue( attributeValue1 );
+        attributeService.deleteAttributeValue( attributeValue2 );
 
-        attributeValue1 = attributeValueService.getAttributeValue( attributeValueId1 );
-        attributeValue2 = attributeValueService.getAttributeValue( attributeValueId2 );
+        attributeValue1 = attributeService.getAttributeValue( attributeValueId1 );
+        attributeValue2 = attributeService.getAttributeValue( attributeValueId2 );
 
         assertNull( attributeValue1 );
         assertNull( attributeValue2 );
@@ -111,11 +111,11 @@
         AttributeValue attributeValue1 = new AttributeValue( "value 1" );
         AttributeValue attributeValue2 = new AttributeValue( "value 2" );
 
-        attributeValueService.addAttributeValue( attributeValue1 );
-        attributeValueService.addAttributeValue( attributeValue2 );
+        attributeService.addAttributeValue( attributeValue1 );
+        attributeService.addAttributeValue( attributeValue2 );
 
-        attributeValue1 = attributeValueService.getAttributeValue( attributeValue1.getId() );
-        attributeValue2 = attributeValueService.getAttributeValue( attributeValue2.getId() );
+        attributeValue1 = attributeService.getAttributeValue( attributeValue1.getId() );
+        attributeValue2 = attributeService.getAttributeValue( attributeValue2.getId() );
 
         assertNotNull( attributeValue1 );
         assertNotNull( attributeValue2 );
@@ -127,9 +127,9 @@
         AttributeValue attributeValue1 = new AttributeValue( "value 1" );
         AttributeValue attributeValue2 = new AttributeValue( "value 2" );
 
-        attributeValueService.addAttributeValue( attributeValue1 );
-        attributeValueService.addAttributeValue( attributeValue2 );
+        attributeService.addAttributeValue( attributeValue1 );
+        attributeService.addAttributeValue( attributeValue2 );
 
-        assertEquals( 2, attributeValueService.getAllAttributeValues().size() );
+        assertEquals( 2, attributeService.getAllAttributeValues().size() );
     }
 }