Further method implementations of ML service

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4738 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-01-05 14:34:40 +00:00
parent 736a7f1ed6
commit 2857106808
2 changed files with 111 additions and 10 deletions

View File

@@ -127,5 +127,46 @@ public class MultilingualContentServiceImplTest extends TestCase
NodeRef mlContainerNodeRef = multilingualContentService.makeTranslation(contentNodeRef, Locale.CHINESE);
// Check it
assertNotNull("Container not created", mlContainerNodeRef);
// Check the container child count
int childCount = nodeService.getChildAssocs(mlContainerNodeRef).size();
assertEquals("Incorrect number of child nodes", 1, childCount);
}
public void testAddTranslationUsingContainer() throws Exception
{
// Make a container with a single translation
NodeRef chineseContentNodeRef = createContent();
NodeRef mlContainerNodeRef = multilingualContentService.makeTranslation(chineseContentNodeRef, Locale.CHINESE);
// Create some more content
NodeRef frenchContentNodeRef = createContent();
// Make this a translation of the Chinese
NodeRef newMLContainerNodeRef = multilingualContentService.addTranslation(
frenchContentNodeRef,
mlContainerNodeRef,
Locale.FRENCH);
// Make sure that the original container was used
assertEquals("Existing container should have been used", mlContainerNodeRef, newMLContainerNodeRef);
// Check the container child count
int childCount = nodeService.getChildAssocs(mlContainerNodeRef).size();
assertEquals("Incorrect number of child nodes", 2, childCount);
}
public void testAddTranslationUsingContent() throws Exception
{
// Make a container with a single translation
NodeRef chineseContentNodeRef = createContent();
NodeRef mlContainerNodeRef = multilingualContentService.makeTranslation(chineseContentNodeRef, Locale.CHINESE);
// Create some more content
NodeRef frenchContentNodeRef = createContent();
// Make this a translation of the Chinese
NodeRef newMLContainerNodeRef = multilingualContentService.addTranslation(
frenchContentNodeRef,
chineseContentNodeRef,
Locale.FRENCH);
// Make sure that the original container was used
assertEquals("Existing container should have been used", mlContainerNodeRef, newMLContainerNodeRef);
// Check the container child count
int childCount = nodeService.getChildAssocs(mlContainerNodeRef).size();
assertEquals("Incorrect number of child nodes", 2, childCount);
}
}