← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1009: Improved testing of TranslationStore.

 

------------------------------------------------------------
revno: 1009
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-11-09 19:17:36 +0100
message:
  Improved testing of TranslationStore.
added:
  dhis-2/dhis-i18n/dhis-i18n-db/src/test/java/org/hisp/dhis/translation/TranslationServiceTest.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationStore.java
  dhis-2/dhis-i18n/dhis-i18n-db/src/main/java/org/hisp/dhis/translation/hibernate/HibernateTranslationStore.java
  dhis-2/dhis-i18n/dhis-i18n-db/src/main/java/org/hisp/dhis/translation/impl/DefaultTranslationService.java
  dhis-2/dhis-i18n/dhis-i18n-db/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-i18n/dhis-i18n-db/src/test/java/org/hisp/dhis/translation/TranslationStoreTest.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-api/src/main/java/org/hisp/dhis/translation/TranslationService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationService.java	2009-11-08 20:18:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationService.java	2009-11-09 18:17:36 +0000
@@ -37,22 +37,77 @@
 public interface TranslationService
 {
     String ID = TranslationService.class.getName();
-    
+
+    /**
+     * Adds a Translation.
+     * 
+     * @param translation the Translation.
+     */
+    void addTranslation( Translation translation );
+
+    /**
+     * Updates a Translation.
+     * 
+     * @param translation the Translation.
+     */
+    void updateTranslation( Translation translation );
+
+    /**
+     * Retrieves a Translation.
+     * 
+     * @param className the class name.
+     * @param id the id.
+     * @param locale the locale.
+     * @param property the property.
+     * @return a Translation.
+     */
     Translation getTranslation( String className, int id, Locale locale, String property );
 
+    /**
+     * Retrieves a Collection of Translations.
+     * 
+     * @param className the class name.
+     * @param id the id.
+     * @param locale the locale.
+     * @return a Collection of Translations.
+     */
     Collection<Translation> getTranslations( String className, int id, Locale locale );
 
+    /**
+     * Retrieves a Collection of Translations.
+     * 
+     * @param className the class name.
+     * @param locale the locale.
+     * @return a Collection of Translations.
+     */
     Collection<Translation> getTranslations( String className, Locale locale );
 
+    /**
+     * Retrieves a Collection of all Translations.
+     * 
+     * @return a Collection of all Translations.
+     */
     Collection<Translation> getAllTranslations();
 
-    void addTranslation( Translation translation );
-
-    void updateTranslation( Translation translation );
-
+    /**
+     * Deletes a Translation.
+     * 
+     * @param translation the Translation.
+     */
     void deleteTranslation( Translation translation );
 
+    /**
+     * Deletes Translations.
+     * 
+     * @param className the class name.
+     * @param id the id.
+     */
+    void deleteTranslations( String className, int id );
+    
+    /**
+     * Retrieves all available Locales.
+     * 
+     * @return a Collection of all available Locales.
+     */
     Collection<Locale> getAvailableLocales();
-
-    void deleteTranslations( String className, int id );
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationStore.java	2009-11-08 20:18:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/translation/TranslationStore.java	2009-11-09 18:17:36 +0000
@@ -37,21 +37,77 @@
 {
     String ID = TranslationStore.class.getName();
 
+    /**
+     * Adds a Translation.
+     * 
+     * @param translation the Translation.
+     */
+    void addTranslation( Translation translation );
+
+    /**
+     * Updates a Translation.
+     * 
+     * @param translation the Translation.
+     */
+    void updateTranslation( Translation translation );
+
+    /**
+     * Retrieves a Translation.
+     * 
+     * @param className the class name.
+     * @param id the id.
+     * @param locale the locale.
+     * @param property the property.
+     * @return a Translation.
+     */
     Translation getTranslation( String className, int id, Locale locale, String property );
 
+    /**
+     * Retrieves a Collection of Translations.
+     * 
+     * @param className the class name.
+     * @param id the id.
+     * @param locale the locale.
+     * @return a Collection of Translations.
+     */
     Collection<Translation> getTranslations( String className, int id, Locale locale );
 
+    /**
+     * Retrieves a Collection of Translations.
+     * 
+     * @param className the class name.
+     * @param locale the locale.
+     * @return a Collection of Translations.
+     */
     Collection<Translation> getTranslations( String className, Locale locale );
 
+    /**
+     * Retrieves a Collection of all Translations.
+     * 
+     * @return a Collection of all Translations.
+     */
     Collection<Translation> getAllTranslations();
 
-    void addTranslation( Translation translation );
-
-    void updateTranslation( Translation translation );
-
+    /**
+     * Deletes a Translation.
+     * 
+     * @param translation the Translation.
+     */
     void deleteTranslation( Translation translation );
 
+    /**
+     * Deletes Translations.
+     * 
+     * @param className the class name.
+     * @param id the id.
+     */
+    void deleteTranslations( String className, int id );
+
+    /**
+     * Retrieves all available Locales.
+     * 
+     * @return a Collection of all available Locales.
+     */
     Collection<Locale> getAvailableLocales();
 
-    void deleteTranslations( String className, int id );
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-i18n/dhis-i18n-db/src/main/java/org/hisp/dhis/translation/hibernate/HibernateTranslationStore.java'
--- dhis-2/dhis-i18n/dhis-i18n-db/src/main/java/org/hisp/dhis/translation/hibernate/HibernateTranslationStore.java	2009-11-08 20:18:11 +0000
+++ dhis-2/dhis-i18n/dhis-i18n-db/src/main/java/org/hisp/dhis/translation/hibernate/HibernateTranslationStore.java	2009-11-09 18:17:36 +0000
@@ -37,6 +37,7 @@
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
 import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.i18n.util.LocaleUtils;
 import org.hisp.dhis.translation.Translation;
 import org.hisp.dhis.translation.TranslationStore;
 
@@ -165,47 +166,11 @@
 
         for ( Object object : objlist )
         {
-            Locale locale = getLocale( object.toString() );
+            Locale locale = LocaleUtils.getLocale( object.toString() );
 
             locales.add( locale );
         }
 
         return locales;
     }
-
-    // -------------------------------------------------------------------------
-    // Supportive methods
-    // -------------------------------------------------------------------------
-
-    /**
-     * Creates a Locale object based on the input String
-     *
-     * @param localestr String to parse
-     * @return A locale object or null if not valid
-     */
-    private Locale getLocale( String localestr )
-    {
-        String[] parts = localestr.split( "_" );
-
-        Locale thisLocale;
-
-        if ( parts.length == 1 )
-        {
-            thisLocale = new Locale( parts[0] );
-        }
-        else if ( parts.length == 2 )
-        {
-            thisLocale = new Locale( parts[0], parts[1] );
-        }
-        else if ( parts.length == 3 )
-        {
-            thisLocale = new Locale( parts[0], parts[1], parts[2] );
-        }
-        else
-        {
-            return null;
-        }
-
-        return thisLocale;
-    }
 }

=== modified file 'dhis-2/dhis-i18n/dhis-i18n-db/src/main/java/org/hisp/dhis/translation/impl/DefaultTranslationService.java'
--- dhis-2/dhis-i18n/dhis-i18n-db/src/main/java/org/hisp/dhis/translation/impl/DefaultTranslationService.java	2009-11-08 20:18:11 +0000
+++ dhis-2/dhis-i18n/dhis-i18n-db/src/main/java/org/hisp/dhis/translation/impl/DefaultTranslationService.java	2009-11-09 18:17:36 +0000
@@ -43,13 +43,31 @@
 public class DefaultTranslationService
     implements TranslationService
 {
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
     private TranslationStore translationStore;
 
     public void setTranslationStore( TranslationStore translationStore )
     {
         this.translationStore = translationStore;
     }
-    
+
+    // -------------------------------------------------------------------------
+    // Translation
+    // -------------------------------------------------------------------------
+
+    public void addTranslation( Translation translation )
+    {
+        translationStore.addTranslation( translation );
+    }
+
+    public void updateTranslation( Translation translation )
+    {
+        translationStore.updateTranslation( translation );
+    }
+
     public Translation getTranslation( String className, int id, Locale locale, String property )
     {
         return translationStore.getTranslation( className, id, locale, property );
@@ -70,28 +88,18 @@
         return translationStore.getAllTranslations();
     }
 
-    public void addTranslation( Translation translation )
-    {
-        translationStore.addTranslation( translation );
-    }
-
-    public void updateTranslation( Translation translation )
-    {
-        translationStore.updateTranslation( translation );
-    }
-
     public void deleteTranslation( Translation translation )
     {
         translationStore.deleteTranslation( translation );
     }
 
+    public void deleteTranslations( String className, int id )
+    {
+        translationStore.deleteTranslations( className, id );
+    }
+
     public Collection<Locale> getAvailableLocales()
     {
         return translationStore.getAvailableLocales();
     }
-
-    public void deleteTranslations( String className, int id )
-    {
-        translationStore.deleteTranslations( className, id );
-    }
 }

=== modified file 'dhis-2/dhis-i18n/dhis-i18n-db/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-i18n/dhis-i18n-db/src/main/resources/META-INF/dhis/beans.xml	2009-11-04 06:39:59 +0000
+++ dhis-2/dhis-i18n/dhis-i18n-db/src/main/resources/META-INF/dhis/beans.xml	2009-11-09 18:17:36 +0000
@@ -9,16 +9,16 @@
   </bean>
 
   <!-- Event listener definitions -->
-
+  <!--
   <bean id="org.hisp.dhis.i18n.hibernate.HibernateI18nPostLoadEventListener"
     class="org.hisp.dhis.i18n.hibernate.HibernateI18nPostLoadEventListener">
     <property name="i18nService">
       <ref bean="org.hisp.dhis.i18n.I18nService"/>
     </property>
   </bean>
-
+  -->
   <!-- Event listener registrations -->
-
+  <!--
   <bean id="addI18nPostLoadEventListener" 
     class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
     <property name="targetObject">
@@ -34,7 +34,7 @@
       </list>
     </property>
   </bean>
-  
+  -->
   <!-- I18n object definitions -->
 
   <bean id="I18nDataElement"

=== added file 'dhis-2/dhis-i18n/dhis-i18n-db/src/test/java/org/hisp/dhis/translation/TranslationServiceTest.java'
--- dhis-2/dhis-i18n/dhis-i18n-db/src/test/java/org/hisp/dhis/translation/TranslationServiceTest.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-i18n/dhis-i18n-db/src/test/java/org/hisp/dhis/translation/TranslationServiceTest.java	2009-11-09 18:17:36 +0000
@@ -0,0 +1,184 @@
+package org.hisp.dhis.translation;
+
+/*
+ * Copyright (c) 2004-2007, 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.
+ */
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+
+import java.util.Collection;
+import java.util.Locale;
+
+import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.junit.Test;
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public class TranslationServiceTest
+    extends DhisSpringTest
+{
+    private TranslationService translationService;
+
+    // -------------------------------------------------------------------------
+    // Set up/tear down
+    // -------------------------------------------------------------------------
+
+    @Override
+    public void setUpTest()
+    {
+        translationService = (TranslationService) getBean( TranslationService.ID );
+    }
+
+    // -------------------------------------------------------------------------
+    // Testdata
+    // -------------------------------------------------------------------------
+
+    private int id1 = 0;
+    private int id2 = 1;
+
+    private String locale1 = Locale.UK.toString();
+    private String locale2 = Locale.US.toString();
+    private String locale3 = Locale.FRANCE.toString();
+
+    private String className1 = OrganisationUnit.class.getName();
+    private String className2 = DataElement.class.getName();
+
+    private Translation translation1a = new Translation( className1, id1, locale1, "name", "cheers" );
+    private Translation translation1b = new Translation( className1, id1, locale1, "shortName", "goodbye" );
+    private Translation translation2a = new Translation( className1, id1, locale2, "name", "hello" );
+    private Translation translation2b = new Translation( className2, id1, locale2, "name", "hey" );
+    private Translation translation2c = new Translation( className2, id2, locale3, "name", "bonjour" );
+
+    // -------------------------------------------------------------------------
+    // Tests
+    // -------------------------------------------------------------------------
+
+    @Test
+    public void testAddGet()
+    {
+        translationService.addTranslation( translation1a );
+        translationService.addTranslation( translation1b );
+        
+        assertEquals( translation1a, translationService.getTranslation( className1, id1, Locale.UK, "name" ) );
+        assertEquals( translation1b, translationService.getTranslation( className1, id1, Locale.UK, "shortName" ) );
+    }
+    
+    @Test
+    public void delete()
+    {
+        translationService.addTranslation( translation1a );
+        translationService.addTranslation( translation1b );
+        
+        assertNotNull( translationService.getTranslation( className1, id1, Locale.UK, "name" ) );
+        assertNotNull( translationService.getTranslation( className1, id1, Locale.UK, "shortName" ) );
+        
+        translationService.deleteTranslation( translation1a );
+        
+        assertNull( translationService.getTranslation( className1, id1, Locale.UK, "name" ) );
+        assertNotNull( translationService.getTranslation( className1, id1, Locale.UK, "shortName" ) );
+
+        translationService.deleteTranslation( translation1b );
+
+        assertNull( translationService.getTranslation( className1, id1, Locale.UK, "name" ) );
+        assertNull( translationService.getTranslation( className1, id1, Locale.UK, "shortName" ) );
+    }
+    
+    @Test
+    public void testUpdateTranslation()
+    {
+        translationService.addTranslation( translation1a );
+        
+        assertEquals( translation1a, translationService.getTranslation( className1, id1, Locale.UK, "name" ) );
+        
+        translation1a.setValue( "regards" );
+        
+        translationService.updateTranslation( translation1a );
+
+        assertEquals( "regards", translationService.getTranslation( className1, id1, Locale.UK, "name" ).getValue() );
+    }
+
+    @Test
+    public void testGetTranslations1()
+    {
+        translationService.addTranslation( translation1a );
+        translationService.addTranslation( translation1b );
+        translationService.addTranslation( translation2a );
+        translationService.addTranslation( translation2b );
+        translationService.addTranslation( translation2c );
+        
+        assertEquals( 2, translationService.getTranslations( className1, id1, Locale.UK ).size() );
+        assertTrue( translationService.getTranslations( className1, id1, Locale.UK ).contains( translation1a ) );
+        assertTrue( translationService.getTranslations( className1, id1, Locale.UK ).contains( translation1b ) );
+    }
+
+    @Test
+    public void testGetTranslations2()
+    {
+        translationService.addTranslation( translation1a );
+        translationService.addTranslation( translation1b );
+        translationService.addTranslation( translation2a );
+        translationService.addTranslation( translation2b );
+        translationService.addTranslation( translation2c );
+        
+        assertEquals( 2, translationService.getTranslations( className1, Locale.UK ).size() );
+        assertTrue( translationService.getTranslations( className1, id1, Locale.UK ).contains( translation1a ) );
+        assertTrue( translationService.getTranslations( className1, id1, Locale.UK ).contains( translation1b ) );
+    }
+    
+    @Test
+    public void testGetAllTranslations()
+    {
+        translationService.addTranslation( translation1a );
+        translationService.addTranslation( translation1b );
+        translationService.addTranslation( translation2a );
+        translationService.addTranslation( translation2b );
+        translationService.addTranslation( translation2c );
+        
+        assertEquals( 5, translationService.getAllTranslations().size() );
+    }
+    
+    @Test
+    public void testGetAvailableLocales()
+        throws Exception
+    {
+        translationService.addTranslation( translation1a );
+        translationService.addTranslation( translation1b );
+        translationService.addTranslation( translation2a );
+        translationService.addTranslation( translation2b );
+        translationService.addTranslation( translation2c );
+
+        Collection<Locale> locales = translationService.getAvailableLocales();
+
+        assertEquals( 3, locales.size() );
+    }
+}

=== modified file 'dhis-2/dhis-i18n/dhis-i18n-db/src/test/java/org/hisp/dhis/translation/TranslationStoreTest.java'
--- dhis-2/dhis-i18n/dhis-i18n-db/src/test/java/org/hisp/dhis/translation/TranslationStoreTest.java	2009-06-18 12:45:22 +0000
+++ dhis-2/dhis-i18n/dhis-i18n-db/src/test/java/org/hisp/dhis/translation/TranslationStoreTest.java	2009-11-09 18:17:36 +0000
@@ -27,8 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.*;
 
 import java.util.Collection;
 import java.util.Locale;
@@ -70,83 +69,112 @@
     private String className1 = OrganisationUnit.class.getName();
     private String className2 = DataElement.class.getName();
 
-    private Translation translation1a = new Translation( className1, id1, locale1, "name", "orgunitss" );
-    private Translation translation1b = new Translation( className1, id1, locale1, "shortName", "orgs" );
-    private Translation translation2a = new Translation( className1, id1, locale2, "name", "orgunitzz" );
-    private Translation translation2b = new Translation( className2, id1, locale2, "name", "dataelement1" );
-    private Translation translation2c = new Translation( className2, id2, locale2, "name", "dataelement2" );
-    private Translation translation3 = new Translation( className1, id1, locale3, "name", "orgunit" );
+    private Translation translation1a = new Translation( className1, id1, locale1, "name", "cheers" );
+    private Translation translation1b = new Translation( className1, id1, locale1, "shortName", "goodbye" );
+    private Translation translation2a = new Translation( className1, id1, locale2, "name", "hello" );
+    private Translation translation2b = new Translation( className2, id1, locale2, "name", "hey" );
+    private Translation translation2c = new Translation( className2, id2, locale3, "name", "bonjour" );
 
     // -------------------------------------------------------------------------
     // Tests
     // -------------------------------------------------------------------------
 
     @Test
-    public void testAddGetUpdateDelete()
-        throws Exception
-    {
-        // Add
-        translationStore.addTranslation( translation1a );
-        translationStore.addTranslation( translation1b );
-        translationStore.addTranslation( translation2a );
-        translationStore.addTranslation( translation2b );
-        translationStore.addTranslation( translation2c );
-        translationStore.addTranslation( translation3 );
-
-        // Get
-        Translation savedTranslation1a = translationStore.getTranslation( className1, id1, Locale.UK, "name" );
-        Translation savedTranslation1b = translationStore.getTranslation( className1, id1, Locale.UK, "shortName" );
-        Translation savedTranslation2b = translationStore.getTranslation( className2, id1, Locale.US, "name" );
-        Translation savedTranslation2c = translationStore.getTranslation( className2, id2, Locale.US, "name" );
-
-        assertEquals( "orgunitss", savedTranslation1a.getValue() );
-        assertEquals( "orgs", savedTranslation1b.getValue() );
-        assertEquals( "dataelement1", savedTranslation2b.getValue() );
-        assertEquals( "dataelement2", savedTranslation2c.getValue() );
-
-        Collection<Translation> col = translationStore.getTranslations( className1, id1, Locale.UK );
-
-        assertEquals( "Unexpected amount of translations received", 2, col.size() );
-
-        // Update
-        translation1a.setValue( "org-unitssz" );
-        translation2c.setValue( "dataelement-2" );
-
+    public void testAddGet()
+    {
+        translationStore.addTranslation( translation1a );
+        translationStore.addTranslation( translation1b );
+        
+        assertEquals( translation1a, translationStore.getTranslation( className1, id1, Locale.UK, "name" ) );
+        assertEquals( translation1b, translationStore.getTranslation( className1, id1, Locale.UK, "shortName" ) );
+    }
+    
+    @Test
+    public void delete()
+    {
+        translationStore.addTranslation( translation1a );
+        translationStore.addTranslation( translation1b );
+        
+        assertNotNull( translationStore.getTranslation( className1, id1, Locale.UK, "name" ) );
+        assertNotNull( translationStore.getTranslation( className1, id1, Locale.UK, "shortName" ) );
+        
+        translationStore.deleteTranslation( translation1a );
+        
+        assertNull( translationStore.getTranslation( className1, id1, Locale.UK, "name" ) );
+        assertNotNull( translationStore.getTranslation( className1, id1, Locale.UK, "shortName" ) );
+
+        translationStore.deleteTranslation( translation1b );
+
+        assertNull( translationStore.getTranslation( className1, id1, Locale.UK, "name" ) );
+        assertNull( translationStore.getTranslation( className1, id1, Locale.UK, "shortName" ) );
+    }
+    
+    @Test
+    public void testUpdateTranslation()
+    {
+        translationStore.addTranslation( translation1a );
+        
+        assertEquals( translation1a, translationStore.getTranslation( className1, id1, Locale.UK, "name" ) );
+        
+        translation1a.setValue( "regards" );
+        
         translationStore.updateTranslation( translation1a );
-        translationStore.updateTranslation( translation2c );
-
-        Translation savedTranslationAfterUpdate1 =
-            translationStore.getTranslation( className1, id1, Locale.UK, "name" );
-        Translation savedTranslationAfterUpdate2 =
-            translationStore.getTranslation( className2, id2, Locale.US, "name" );
-
-        assertEquals( "org-unitssz", savedTranslationAfterUpdate1.getValue() );
-        assertEquals( "dataelement-2", savedTranslationAfterUpdate2.getValue() );
-
-        // Delete
-        translationStore.deleteTranslation( translation3 );
-
-        Translation deletedTranslation = translationStore.getTranslation(className1, id1, Locale.FRANCE ,"name" );
-
-        assertNull(deletedTranslation);
-
-        translationStore.deleteTranslations(className1, id1);
-
-        col = translationStore.getAllTranslations();
-
-        assertEquals( "Unexpected amount of translations received after delete", 2, col.size() );
-    }
-
+
+        assertEquals( "regards", translationStore.getTranslation( className1, id1, Locale.UK, "name" ).getValue() );
+    }
+
+    @Test
+    public void testGetTranslations1()
+    {
+        translationStore.addTranslation( translation1a );
+        translationStore.addTranslation( translation1b );
+        translationStore.addTranslation( translation2a );
+        translationStore.addTranslation( translation2b );
+        translationStore.addTranslation( translation2c );
+        
+        assertEquals( 2, translationStore.getTranslations( className1, id1, Locale.UK ).size() );
+        assertTrue( translationStore.getTranslations( className1, id1, Locale.UK ).contains( translation1a ) );
+        assertTrue( translationStore.getTranslations( className1, id1, Locale.UK ).contains( translation1b ) );
+    }
+
+    @Test
+    public void testGetTranslations2()
+    {
+        translationStore.addTranslation( translation1a );
+        translationStore.addTranslation( translation1b );
+        translationStore.addTranslation( translation2a );
+        translationStore.addTranslation( translation2b );
+        translationStore.addTranslation( translation2c );
+        
+        assertEquals( 2, translationStore.getTranslations( className1, Locale.UK ).size() );
+        assertTrue( translationStore.getTranslations( className1, id1, Locale.UK ).contains( translation1a ) );
+        assertTrue( translationStore.getTranslations( className1, id1, Locale.UK ).contains( translation1b ) );
+    }
+    
+    @Test
+    public void testGetAllTranslations()
+    {
+        translationStore.addTranslation( translation1a );
+        translationStore.addTranslation( translation1b );
+        translationStore.addTranslation( translation2a );
+        translationStore.addTranslation( translation2b );
+        translationStore.addTranslation( translation2c );
+        
+        assertEquals( 5, translationStore.getAllTranslations().size() );
+    }
+    
     @Test
     public void testGetAvailableLocales()
         throws Exception
     {
         translationStore.addTranslation( translation1a );
+        translationStore.addTranslation( translation1b );
         translationStore.addTranslation( translation2a );
-        translationStore.addTranslation( translation3 );
+        translationStore.addTranslation( translation2b );
+        translationStore.addTranslation( translation2c );
 
         Collection<Locale> locales = translationStore.getAvailableLocales();
 
-        assertEquals( "Unexpected size of available locales", 3, locales.size() );
+        assertEquals( 3, locales.size() );
     }
 }