Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2010-06-19 01:12:08 +0000
committerrescobar2010-06-19 01:12:08 +0000
commit524afe296876d796dcae9e058b30c357c44b3a22 (patch)
treebc8a5c082c2b1fa4a66583716a3cef4029e96065 /plugins
parentb286863f6951f9ba52e23bc785f663fe81047d85 (diff)
downloadorg.eclipse.osee-524afe296876d796dcae9e058b30c357c44b3a22.tar.gz
org.eclipse.osee-524afe296876d796dcae9e058b30c357c44b3a22.tar.xz
org.eclipse.osee-524afe296876d796dcae9e058b30c357c44b3a22.zip
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/.classpath7
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/.project28
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/.settings/org.eclipse.pde.core.prefs5
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/META-INF/MANIFEST.MF13
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/build.properties4
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/AllCoreMessageTestSuite.java28
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/BranchCommitRequestTest.java80
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/BranchCommitResponseTest.java58
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/CacheUpdateRequestTest.java41
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/ChangeItemTest.java103
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/ChangeItemUtilTest.java358
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/ChangeVersionTest.java99
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/DataTestSuite.java33
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/PurgeBranchRequestTest.java55
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/TransactionCacheUpdateResponseTest.java60
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/ChangeTestUtility.java65
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/DataAsserts.java281
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockChangeItem.java24
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockOseeModelFactoryServiceProvider.java33
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockRequestFactory.java84
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BaseTranslatorTest.java43
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchChangeArchivedStateRequestTranslatorTest.java54
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchChangeStateRequestTranslatorTest.java53
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchChangeTypeRequestTranslatorTest.java54
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitRequestTranslatorTest.java54
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java69
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCreationRequestTranslatorTest.java53
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCreationResponseTranslatorTest.java53
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/CacheUpdateRequestTranslatorTest.java59
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/ChangeItemTranslatorTest.java60
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/ChangeReportResponseTranslatorTest.java72
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/ChangeVersionTranslatorTest.java53
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceFactoryTest.java101
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceTest.java213
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/OseeImportModelRequestTranslatorTest.java53
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/OseeImportModelResponseTranslatorTest.java70
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/PurgeBranchRequestTranslatorTest.java53
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TableDataTranslatorTest.java55
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionCacheUpdateResponseTranslatorTest.java69
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java57
-rw-r--r--plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TranslationTestSuite.java43
42 files changed, 2858 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/.classpath b/plugins/org.eclipse.osee.framework.core.message.test/.classpath
new file mode 100644
index 00000000000..8a8f1668cdc
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/.project b/plugins/org.eclipse.osee.framework.core.message.test/.project
new file mode 100644
index 00000000000..582a5436e76
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.framework.core.message.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.osee.framework.core.message.test/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..193fa40a0aa
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Jun 18 16:26:56 MST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/.settings/org.eclipse.pde.core.prefs b/plugins/org.eclipse.osee.framework.core.message.test/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 00000000000..e4e744b7a01
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,5 @@
+#Fri Jun 18 16:26:56 MST 2010
+eclipse.preferences.version=1
+pluginProject.equinox=false
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.message.test/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..4a7eaa12ba2
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OSEE Core Message Test
+Bundle-SymbolicName: org.eclipse.osee.framework.core.message.test;singleton:=true
+Bundle-Version: 0.9.5.qualifier
+Bundle-Vendor: Eclipse.org
+Fragment-Host: org.eclipse.osee.framework.core.message;bundle-version="0.9.5"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.junit4;bundle-version="4.5.0"
+Export-Package: org.eclipse.osee.framework.core.message.test,
+ org.eclipse.osee.framework.core.message.test.mocks
+Import-Package: org.eclipse.osee.framework.core.model.test.mocks,
+ org.eclipse.osee.framework.jdk.core.util
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/build.properties b/plugins/org.eclipse.osee.framework.core.message.test/build.properties
new file mode 100644
index 00000000000..41eb6ade2b4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/AllCoreMessageTestSuite.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/AllCoreMessageTestSuite.java
new file mode 100644
index 00000000000..db0737ffbd4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/AllCoreMessageTestSuite.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test;
+
+import org.eclipse.osee.framework.core.message.test.data.DataTestSuite;
+import org.eclipse.osee.framework.core.message.test.translation.TranslationTestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {//
+ DataTestSuite.class, //
+ TranslationTestSuite.class, //
+})
+/**
+ * @author Roberto E. Escobar
+ */
+public class AllCoreMessageTestSuite {
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/BranchCommitRequestTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/BranchCommitRequestTest.java
new file mode 100644
index 00000000000..5371faa487f
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/BranchCommitRequestTest.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.data;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.message.BranchCommitRequest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link BranchCommitRequest}
+ *
+ * @author Roberto E. Escobar
+ */
+@RunWith(Parameterized.class)
+public class BranchCommitRequestTest {
+
+ private final BranchCommitRequest item;
+
+ private final int expectedUser;
+ private final int expectedSrcBranch;
+ private final int expectedDestBranch;
+ private final boolean expectedArchive;
+
+ public BranchCommitRequestTest(int expectedUser, int expectedSrcBranch, int expectedDestBranch, boolean expectedArchive) {
+ super();
+ this.item = new BranchCommitRequest(expectedUser, expectedSrcBranch, expectedDestBranch, expectedArchive);
+ this.expectedUser = expectedUser;
+ this.expectedSrcBranch = expectedSrcBranch;
+ this.expectedDestBranch = expectedDestBranch;
+ this.expectedArchive = expectedArchive;
+ }
+
+ @Test
+ public void testGetDestinationBranch() {
+ Assert.assertEquals(expectedDestBranch, item.getDestinationBranchId());
+ }
+
+ @Test
+ public void testGetSourceBranch() {
+ Assert.assertEquals(expectedSrcBranch, item.getSourceBranchId());
+ }
+
+ @Test
+ public void testGetUser() {
+ Assert.assertEquals(expectedUser, item.getUserArtId());
+ }
+
+ @Test
+ public void testIsArchive() {
+ Assert.assertEquals(expectedArchive, item.isArchiveAllowed());
+ }
+
+ @Parameters
+ public static Collection<Object[]> getData() {
+ Collection<Object[]> data = new ArrayList<Object[]>();
+ boolean archiveIt = false;
+ for (int index = 1; index <= 2; index++) {
+ int sourceBranch = index * 7;
+ int destinationBranch = index * 9;
+ int userArt = index * 11;
+ archiveIt ^= archiveIt;
+ data.add(new Object[] {userArt, sourceBranch, destinationBranch, archiveIt});
+ }
+ return data;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/BranchCommitResponseTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/BranchCommitResponseTest.java
new file mode 100644
index 00000000000..39338254c34
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/BranchCommitResponseTest.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.data;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.message.BranchCommitResponse;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.test.mocks.MockDataFactory;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link BranchCommitResponse}
+ *
+ * @author Roberto E. Escobar
+ */
+@RunWith(Parameterized.class)
+public class BranchCommitResponseTest {
+
+ private final BranchCommitResponse response;
+ private final TransactionRecord transaction;
+
+ public BranchCommitResponseTest(BranchCommitResponse response, TransactionRecord transaction) {
+ this.response = response;
+ this.transaction = transaction;
+ }
+
+ @Test
+ public void testGetSetTransaction() {
+ Assert.assertNull(response.getTransaction());
+ response.setTransaction(transaction);
+
+ Assert.assertNotNull(response.getTransaction());
+ Assert.assertEquals(transaction, response.getTransaction());
+ }
+
+ @Parameters
+ public static Collection<Object[]> getData() {
+ Collection<Object[]> data = new ArrayList<Object[]>();
+ for (int index = 1; index <= 2; index++) {
+ TransactionRecord transaction = MockDataFactory.createTransaction(index, 2);
+ data.add(new Object[] {new BranchCommitResponse(), transaction});
+ }
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/CacheUpdateRequestTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/CacheUpdateRequestTest.java
new file mode 100644
index 00000000000..5f252a3a11d
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/CacheUpdateRequestTest.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.data;
+
+import java.util.Arrays;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
+import org.eclipse.osee.framework.core.message.CacheUpdateRequest;
+import org.junit.Test;
+
+/**
+ * Test Case for {@link CacheUpdateRequest}
+ *
+ * @author Roberto E. Escobar
+ */
+public class CacheUpdateRequestTest {
+
+ @Test
+ public void testNoGuids() {
+ CacheUpdateRequest request = new CacheUpdateRequest(OseeCacheEnum.ARTIFACT_TYPE_CACHE);
+ Assert.assertEquals(OseeCacheEnum.ARTIFACT_TYPE_CACHE, request.getCacheId());
+ Assert.assertTrue(request.getItemsIds().isEmpty());
+ }
+
+ @Test
+ public void testWithGuids() {
+ List<Integer> guids = Arrays.asList(45, 55);
+ CacheUpdateRequest request = new CacheUpdateRequest(OseeCacheEnum.ATTRIBUTE_TYPE_CACHE, guids);
+ Assert.assertEquals(OseeCacheEnum.ATTRIBUTE_TYPE_CACHE, request.getCacheId());
+ Assert.assertEquals(guids, request.getItemsIds());
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/ChangeItemTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/ChangeItemTest.java
new file mode 100644
index 00000000000..418f318749f
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/ChangeItemTest.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.data;
+
+import static org.junit.Assert.assertEquals;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.message.ChangeItem;
+import org.eclipse.osee.framework.core.message.ChangeVersion;
+import org.eclipse.osee.framework.core.message.test.mocks.ChangeTestUtility;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link ChangeItem}
+ *
+ * @author Roberto E. Escobar
+ */
+@RunWith(Parameterized.class)
+public class ChangeItemTest {
+ private final ChangeItem item;
+ private final ChangeVersion base;
+ private final ChangeVersion first;
+ private final ChangeVersion current;
+ private final ChangeVersion destination;
+ private final ChangeVersion net;
+ private final int itemId;
+
+ public ChangeItemTest(int itemId, ChangeVersion base, ChangeVersion first, ChangeVersion current, ChangeVersion destination, ChangeVersion net) {
+ this.itemId = itemId;
+ this.base = base;
+ this.first = first;
+ this.current = current;
+ this.destination = destination;
+ this.net = net;
+ item = ChangeTestUtility.createItem(itemId, base, first, current, destination, net);
+ }
+
+ @Test
+ public void testGetItemId() {
+ assertEquals(itemId, item.getItemId());
+ }
+
+ @Test
+ public void testGetBaselineVersion() {
+ ChangeTestUtility.checkChange(base, item.getBaselineVersion());
+ }
+
+ @Test
+ public void testGetFirstNonCurrentVersion() {
+ ChangeTestUtility.checkChange(first, item.getFirstNonCurrentChange());
+ }
+
+ @Test
+ public void testGetCurrentVersion() {
+ ChangeTestUtility.checkChange(current, item.getCurrentVersion());
+ }
+
+ @Test
+ public void testGetDestinationVersion() {
+ ChangeTestUtility.checkChange(destination, item.getDestinationVersion());
+ }
+
+ @Test
+ public void testGetNetVersion() {
+ ChangeTestUtility.checkChange(net, item.getNetChange());
+ }
+
+ @Test
+ public void testGetItemTypeId() {
+ assertEquals(item.getItemId() * 10, item.getItemTypeId());
+ }
+
+ @Test
+ public void testGetArtId() {
+ assertEquals(item.getItemId() * 100, item.getArtId());
+ }
+
+ @Parameters
+ public static List<Object[]> getData() {
+ List<Object[]> data = new ArrayList<Object[]>();
+
+ ChangeVersion base = ChangeTestUtility.createChange(1111L, ModificationType.NEW);
+ ChangeVersion first = ChangeTestUtility.createChange(2222L, ModificationType.MODIFIED);
+ ChangeVersion current = ChangeTestUtility.createChange(3333L, ModificationType.INTRODUCED);
+ ChangeVersion destination = ChangeTestUtility.createChange(4444L, ModificationType.MERGED);
+ ChangeVersion net = ChangeTestUtility.createChange(5555L, ModificationType.DELETED);
+
+ data.add(new Object[] {200, base, first, current, destination, net});
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/ChangeItemUtilTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/ChangeItemUtilTest.java
new file mode 100644
index 00000000000..dd5b5bbeee3
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/ChangeItemUtilTest.java
@@ -0,0 +1,358 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.core.message.test.data;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.message.ChangeItem;
+import org.eclipse.osee.framework.core.message.ChangeItemUtil;
+import org.eclipse.osee.framework.core.message.ChangeVersion;
+import org.eclipse.osee.framework.core.message.test.mocks.ChangeTestUtility;
+import org.eclipse.osee.framework.jdk.core.type.Triplet;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test Case for {@link ChangeItemUtil}
+ *
+ * @author Roberto E. Escobar
+ */
+public class ChangeItemUtilTest {
+
+ public ChangeItemUtilTest() {
+ }
+
+ @Test
+ public void testGetSet() {
+ ChangeVersion base = ChangeTestUtility.createChange(1111L, ModificationType.NEW);
+ ChangeVersion first = ChangeTestUtility.createChange(2222L, ModificationType.MODIFIED);
+ ChangeVersion current = ChangeTestUtility.createChange(3333L, ModificationType.INTRODUCED);
+ ChangeVersion destination = ChangeTestUtility.createChange(4444L, ModificationType.MERGED);
+ ChangeVersion net = ChangeTestUtility.createChange(5555L, ModificationType.DELETED);
+
+ ChangeItem item = ChangeTestUtility.createItem(200, base, first, current, destination, net);
+ assertEquals(200, item.getItemId());
+ assertEquals(2000, item.getItemTypeId());
+ assertEquals(20000, item.getArtId());
+ ChangeTestUtility.checkChange(base, item.getBaselineVersion());
+ ChangeTestUtility.checkChange(first, item.getFirstNonCurrentChange());
+ ChangeTestUtility.checkChange(current, item.getCurrentVersion());
+ ChangeTestUtility.checkChange(destination, item.getDestinationVersion());
+ ChangeTestUtility.checkChange(net, item.getNetChange());
+ }
+
+ @Test
+ public void testHasBeenDeletedInDestination() {
+ ChangeVersion current = ChangeTestUtility.createChange(3333L, ModificationType.INTRODUCED);
+ ChangeVersion destination = ChangeTestUtility.createChange(4444L, ModificationType.DELETED);
+
+ ChangeItem item = ChangeTestUtility.createItem(200, null, null, current, destination, null);
+ assertTrue(ChangeItemUtil.hasBeenDeletedInDestination(item));
+
+ item = ChangeTestUtility.createItem(200, null, null, current, null, null);
+ assertFalse(ChangeItemUtil.hasBeenDeletedInDestination(item));
+ }
+
+ @Test
+ public void testAlreadyOnDestination() {
+ ChangeVersion current = ChangeTestUtility.createChange(3333L, ModificationType.INTRODUCED);
+ ChangeVersion destination = ChangeTestUtility.createChange(3333L, ModificationType.INTRODUCED);
+ ChangeItem item = ChangeTestUtility.createItem(200, null, null, current, destination, null);
+ assertTrue(ChangeItemUtil.isAlreadyOnDestination(item));
+
+ destination = ChangeTestUtility.createChange(4444L, ModificationType.INTRODUCED);
+ item = ChangeTestUtility.createItem(200, null, null, current, destination, null);
+ assertFalse(ChangeItemUtil.isAlreadyOnDestination(item));
+
+ destination = ChangeTestUtility.createChange(3333L, ModificationType.DELETED);
+ item = ChangeTestUtility.createItem(200, null, null, current, destination, null);
+ assertFalse(ChangeItemUtil.isAlreadyOnDestination(item));
+
+ current = ChangeTestUtility.createChange(3333L, ModificationType.DELETED);
+ item = ChangeTestUtility.createItem(200, null, null, current, destination, null);
+ assertTrue(ChangeItemUtil.isAlreadyOnDestination(item));
+
+ }
+
+ @Test
+ public void isDeletedAndDoesNotExistInDestination() {
+ ChangeVersion dest, current;
+ ChangeItem item;
+
+ current = ChangeTestUtility.createChange(2222L, ModificationType.DELETED);
+ dest = null;
+ item = ChangeTestUtility.createItem(200, null, null, current, dest, null);
+ assertTrue(ChangeItemUtil.isDeletedAndDoesNotExistInDestination(item));
+
+ dest = ChangeTestUtility.createChange(3333L, ModificationType.NEW);
+ item = ChangeTestUtility.createItem(200, null, null, current, dest, null);
+ assertFalse(ChangeItemUtil.isDeletedAndDoesNotExistInDestination(item));
+
+ dest = ChangeTestUtility.createChange(3333L, null);
+ item = ChangeTestUtility.createItem(200, null, null, current, dest, null);
+ assertTrue(ChangeItemUtil.isDeletedAndDoesNotExistInDestination(item));
+ }
+
+ @Test
+ public void testDestinationEqualOrNewerThanCurrent() {
+ ChangeVersion isNew = ChangeTestUtility.createChange(2222L, ModificationType.NEW);
+ ChangeVersion isIntroduced = ChangeTestUtility.createChange(2222L, ModificationType.NEW);
+ ChangeVersion destination = ChangeTestUtility.createChange(1111L, ModificationType.NEW);
+ ChangeItem item = ChangeTestUtility.createItem(200, null, null, isNew, destination, null);
+ assertTrue(ChangeItemUtil.isDestinationEqualOrNewerThanCurrent(item));
+
+ item = ChangeTestUtility.createItem(200, null, null, isIntroduced, destination, null);
+ assertTrue(ChangeItemUtil.isDestinationEqualOrNewerThanCurrent(item));
+
+ ChangeVersion isNotNew = ChangeTestUtility.createChange(2222L, ModificationType.MODIFIED);
+ item = ChangeTestUtility.createItem(200, null, null, isNotNew, destination, null);
+ assertFalse(ChangeItemUtil.isDestinationEqualOrNewerThanCurrent(item));
+ }
+
+ @Test
+ public void testIgnoreCase() {
+ ChangeVersion isNew = ChangeTestUtility.createChange(2222L, ModificationType.NEW);
+
+ ChangeVersion deletedCurrent = ChangeTestUtility.createChange(3333L, ModificationType.DELETED);
+ ChangeItem item = ChangeTestUtility.createItem(200, null, isNew, deletedCurrent, null, null);
+ assertTrue(ChangeItemUtil.isIgnoreCase(item));
+
+ ChangeVersion current = ChangeTestUtility.createChange(3333L, ModificationType.INTRODUCED);
+ ChangeVersion destination = ChangeTestUtility.createChange(3333L, ModificationType.INTRODUCED);
+ item = ChangeTestUtility.createItem(200, null, null, current, destination, null);
+ assertTrue(ChangeItemUtil.isIgnoreCase(item));
+
+ ChangeVersion dest;
+
+ current = ChangeTestUtility.createChange(2222L, ModificationType.DELETED);
+ dest = null;
+ item = ChangeTestUtility.createItem(200, null, null, current, dest, null);
+ assertTrue(ChangeItemUtil.isIgnoreCase(item));
+
+ current = ChangeTestUtility.createChange(3333L, ModificationType.INTRODUCED);
+ destination = ChangeTestUtility.createChange(4444L, ModificationType.DELETED);
+
+ item = ChangeTestUtility.createItem(200, null, null, current, destination, null);
+ assertTrue(ChangeItemUtil.isIgnoreCase(item));
+
+ isNew = ChangeTestUtility.createChange(2222L, ModificationType.NEW);
+ destination = ChangeTestUtility.createChange(3333L, ModificationType.NEW);
+ item = ChangeTestUtility.createItem(200, null, null, isNew, destination, null);
+ assertTrue(ChangeItemUtil.isIgnoreCase(item));
+ }
+
+ @Test
+ public void testCreatedAndDeleted() {
+ ChangeVersion isNew = ChangeTestUtility.createChange(2222L, ModificationType.NEW);
+
+ ChangeVersion deletedCurrent = ChangeTestUtility.createChange(3333L, ModificationType.DELETED);
+ ChangeItem item = ChangeTestUtility.createItem(200, null, isNew, deletedCurrent, null, null);
+ assertTrue(ChangeItemUtil.wasCreatedAndDeleted(item));
+
+ ChangeVersion notDeletedCurrent = ChangeTestUtility.createChange(3333L, ModificationType.INTRODUCED);
+ item = ChangeTestUtility.createItem(200, null, isNew, notDeletedCurrent, null, null);
+ assertFalse(ChangeItemUtil.wasCreatedAndDeleted(item));
+ }
+
+ @Test
+ public void testNewOnSource() {
+ ChangeVersion newType = ChangeTestUtility.createChange(2222L, ModificationType.NEW);
+ ChangeVersion modified = ChangeTestUtility.createChange(2223L, ModificationType.MODIFIED);
+
+ ChangeItem item = ChangeTestUtility.createItem(200, null, newType, modified, null, null);
+ assertTrue(ChangeItemUtil.wasNewOnSource(item));
+
+ item = ChangeTestUtility.createItem(200, null, null, newType, null, null);
+ assertTrue(ChangeItemUtil.wasNewOnSource(item));
+
+ item = ChangeTestUtility.createItem(200, null, modified, modified, null, null);
+ assertFalse(ChangeItemUtil.wasNewOnSource(item));
+ }
+
+ @Test
+ public void testNewOrIntroducedOnSource() {
+ ChangeVersion introduced = ChangeTestUtility.createChange(2222L, ModificationType.INTRODUCED);
+ ChangeVersion modified = ChangeTestUtility.createChange(1234L, ModificationType.MODIFIED);
+ ChangeItem item;
+
+ item = ChangeTestUtility.createItem(200, null, introduced, modified, null, null);
+ assertTrue(ChangeItemUtil.wasNewOrIntroducedOnSource(item));
+
+ item = ChangeTestUtility.createItem(200, null, null, introduced, null, null);
+ assertTrue(ChangeItemUtil.wasNewOrIntroducedOnSource(item));
+
+ item = ChangeTestUtility.createItem(200, null, null, modified, null, null);
+ assertFalse(ChangeItemUtil.wasNewOrIntroducedOnSource(item));
+
+ ChangeVersion newType = ChangeTestUtility.createChange(2222L, ModificationType.NEW);
+ modified = ChangeTestUtility.createChange(2223L, ModificationType.MODIFIED);
+
+ item = ChangeTestUtility.createItem(200, null, newType, modified, null, null);
+ assertTrue(ChangeItemUtil.wasNewOrIntroducedOnSource(item));
+
+ item = ChangeTestUtility.createItem(200, null, null, newType, null, null);
+ assertTrue(ChangeItemUtil.wasNewOrIntroducedOnSource(item));
+
+ item = ChangeTestUtility.createItem(200, null, modified, modified, null, null);
+ assertFalse(ChangeItemUtil.wasNewOrIntroducedOnSource(item));
+ }
+
+ @Test
+ public void testIntroducedOnSource() {
+ ChangeVersion introduced = ChangeTestUtility.createChange(2222L, ModificationType.INTRODUCED);
+ ChangeVersion modified = ChangeTestUtility.createChange(1234L, ModificationType.MODIFIED);
+ ChangeItem item;
+
+ item = ChangeTestUtility.createItem(200, null, introduced, modified, null, null);
+ assertTrue(ChangeItemUtil.wasIntroducedOnSource(item));
+
+ item = ChangeTestUtility.createItem(200, null, null, introduced, null, null);
+ assertTrue(ChangeItemUtil.wasIntroducedOnSource(item));
+
+ item = ChangeTestUtility.createItem(200, null, null, modified, null, null);
+ assertFalse(ChangeItemUtil.wasIntroducedOnSource(item));
+ }
+
+ @Test
+ public void testIsNewIntroducedDeleted() {
+ ChangeVersion object1 = ChangeTestUtility.createChange(200L, null);
+ for (ModificationType modType : ModificationType.values()) {
+ object1.setModType(null);
+ Assert.assertNull(object1.getModType());
+
+ Assert.assertEquals(false, ChangeItemUtil.isNew(object1));
+ Assert.assertEquals(false, ChangeItemUtil.isIntroduced(object1));
+ Assert.assertEquals(false, ChangeItemUtil.isDeleted(object1));
+
+ object1.setModType(modType);
+ Assert.assertEquals(modType, object1.getModType());
+ Assert.assertEquals(modType == ModificationType.NEW, ChangeItemUtil.isNew(object1));
+ Assert.assertEquals(modType == ModificationType.INTRODUCED, ChangeItemUtil.isIntroduced(object1));
+ Assert.assertEquals(modType == ModificationType.DELETED || modType == ModificationType.ARTIFACT_DELETED,
+ ChangeItemUtil.isDeleted(object1));
+ }
+
+ Assert.assertEquals(false, ChangeItemUtil.isNew(null));
+ Assert.assertEquals(false, ChangeItemUtil.isIntroduced(null));
+ Assert.assertEquals(false, ChangeItemUtil.isDeleted(null));
+
+ }
+
+ @Test
+ public void testIsModType() {
+ ChangeVersion object1 = ChangeTestUtility.createChange(200L, null);
+ Assert.assertNull(object1.getModType());
+ Assert.assertEquals(true, ChangeItemUtil.isModType(object1, null));
+
+ for (ModificationType modType : ModificationType.values()) {
+ object1.setModType(null);
+ Assert.assertNull(object1.getModType());
+ object1.setModType(modType);
+
+ Assert.assertEquals(modType, object1.getModType());
+ Assert.assertTrue(ChangeItemUtil.isModType(object1, modType));
+ }
+ Assert.assertEquals(false, ChangeItemUtil.isModType(null, ModificationType.NEW));
+ }
+
+ @Test
+ public void testGammasEqual() {
+ List<Triplet<ChangeVersion, ChangeVersion, Boolean>> cases =
+ new ArrayList<Triplet<ChangeVersion, ChangeVersion, Boolean>>();
+
+ cases.add(createTriplet(3000L, ModificationType.MODIFIED, 3000L, ModificationType.NEW, true));
+ cases.add(createTriplet(null, ModificationType.MODIFIED, 3000L, ModificationType.NEW, false));
+ cases.add(createTriplet(3000L, null, 3000L, ModificationType.NEW, true));
+ cases.add(createTriplet(3000L, ModificationType.MODIFIED, null, ModificationType.NEW, false));
+ cases.add(createTriplet(3000L, ModificationType.MODIFIED, 3000L, null, true));
+ cases.add(createTriplet(null, null, null, null, true));
+ cases.add(createTriplet(3000L, null, 3001L, null, false));
+
+ int index = 0;
+ for (Triplet<ChangeVersion, ChangeVersion, Boolean> test : cases) {
+ boolean actual = ChangeItemUtil.areGammasEqual(test.getFirst(), test.getSecond());
+ Assert.assertTrue("Test " + ++index + ":", test.getThird() == actual);
+ }
+ assertTrue(ChangeItemUtil.areGammasEqual(null, null));
+ }
+
+ @Test
+ public void testGetStartingVersion() throws OseeCoreException {
+ ChangeVersion ver1 = ChangeTestUtility.createChange(111L, ModificationType.NEW);
+ ChangeVersion ver2 = ChangeTestUtility.createChange(222L, ModificationType.MODIFIED);
+ ChangeVersion ver3 = ChangeTestUtility.createChange(333L, ModificationType.DELETED);
+ ChangeVersion invalid = ChangeTestUtility.createChange(999L, null);
+
+ try {
+ ChangeItemUtil.getStartingVersion(null);
+ Assert.fail("This line should not be executed");
+ } catch (OseeCoreException ex) {
+ Assert.assertTrue(ex instanceof OseeArgumentException);
+ }
+
+ ChangeItem item = ChangeTestUtility.createItem(1, ver1, ver2, ver3, null, null);
+ Assert.assertEquals(ver1, ChangeItemUtil.getStartingVersion(item));
+
+ item = ChangeTestUtility.createItem(2, invalid, ver2, ver3, null, null);
+ Assert.assertEquals(ver2, ChangeItemUtil.getStartingVersion(item));
+
+ item = ChangeTestUtility.createItem(3, invalid, invalid, ver3, null, null);
+ Assert.assertEquals(ver3, ChangeItemUtil.getStartingVersion(item));
+
+ try {
+ item = ChangeTestUtility.createItem(3, invalid, invalid, invalid, null, null);
+ ChangeItemUtil.getStartingVersion(item);
+ Assert.fail("This line should not be executed");
+ } catch (OseeCoreException ex) {
+ Assert.assertTrue(ex instanceof OseeStateException);
+ }
+ }
+
+ @Test
+ public void testCopy() throws OseeCoreException {
+ ChangeVersion expected = new ChangeVersion(5679L, ModificationType.MERGED);
+
+ ChangeVersion actual = new ChangeVersion();
+ ChangeItemUtil.copy(expected, actual);
+
+ ChangeTestUtility.checkChange(expected, actual);
+
+ try {
+ ChangeItemUtil.copy(null, expected);
+ Assert.fail("Should not be executed");
+ } catch (Exception ex) {
+ Assert.assertTrue(ex instanceof OseeArgumentException);
+ }
+
+ try {
+ ChangeItemUtil.copy(expected, null);
+ Assert.fail("Should not be executed");
+ } catch (Exception ex) {
+ Assert.assertTrue(ex instanceof OseeArgumentException);
+ }
+
+ }
+
+ private Triplet<ChangeVersion, ChangeVersion, Boolean> createTriplet(Long long1, ModificationType mod1, Long long2, ModificationType mod2, boolean expected) {
+ return new Triplet<ChangeVersion, ChangeVersion, Boolean>(//
+ ChangeTestUtility.createChange(long1, mod1), //
+ ChangeTestUtility.createChange(long2, mod2), //
+ expected);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/ChangeVersionTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/ChangeVersionTest.java
new file mode 100644
index 00000000000..5c968ad0030
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/ChangeVersionTest.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.data;
+
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.message.ChangeVersion;
+import org.eclipse.osee.framework.core.message.test.mocks.ChangeTestUtility;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test Case for {@link ChangeVersion}
+ *
+ * @author Roberto E. Escobar
+ */
+public class ChangeVersionTest {
+
+ @Test
+ public void testConstruction() {
+ ChangeVersion actual = new ChangeVersion();
+ ChangeVersion expected = new ChangeVersion();
+ ChangeTestUtility.checkChange(expected, actual);
+
+ actual = new ChangeVersion(45L, ModificationType.NEW);
+ expected.setValue(null);
+ expected.setGammaId(45L);
+ expected.setModType(ModificationType.NEW);
+ ChangeTestUtility.checkChange(expected, actual);
+
+ actual = new ChangeVersion("hello", 47L, ModificationType.MERGED);
+ expected.setValue("hello");
+ expected.setGammaId(47L);
+ expected.setModType(ModificationType.MERGED);
+ ChangeTestUtility.checkChange(expected, actual);
+ }
+
+ @Test
+ public void testCopy() {
+ ChangeVersion expected = new ChangeVersion("hello", 47L, ModificationType.MERGED);
+ ChangeVersion actual = new ChangeVersion();
+ actual.copy(expected);
+ ChangeTestUtility.checkChange(expected, actual);
+
+ expected = new ChangeVersion(null, 47L, ModificationType.MERGED);
+ actual.copy(expected);
+ ChangeTestUtility.checkChange(expected, actual);
+ }
+
+ @Test
+ public void testExists() {
+ ChangeVersion actual = new ChangeVersion();
+ Assert.assertFalse(actual.isValid());
+
+ actual.setGammaId(45L);
+ Assert.assertFalse(actual.isValid());
+
+ actual.setModType(ModificationType.MODIFIED);
+ Assert.assertTrue(actual.isValid());
+ }
+
+ @Test
+ public void testEquals() {
+ ChangeVersion actual1 = new ChangeVersion("hello", 47L, ModificationType.MERGED);
+ ChangeVersion actual2 = new ChangeVersion("hello", 47L, ModificationType.MERGED);
+ ChangeVersion expected = new ChangeVersion();
+
+ Assert.assertEquals(actual2, actual1);
+ Assert.assertTrue(actual2.hashCode() == actual1.hashCode());
+
+ Assert.assertTrue(!expected.equals(actual1));
+ Assert.assertTrue(!expected.equals(actual2));
+
+ Assert.assertTrue(expected.hashCode() != actual1.hashCode());
+ Assert.assertTrue(expected.hashCode() != actual2.hashCode());
+
+ expected.copy(actual1);
+ Assert.assertEquals(expected, actual1);
+ Assert.assertEquals(expected, actual2);
+
+ }
+
+ @Test
+ public void testToString() {
+ ChangeVersion actual1 = new ChangeVersion("hello", 47L, ModificationType.MERGED);
+ Assert.assertEquals("[47,MERGED]", actual1.toString());
+
+ ChangeVersion expected = new ChangeVersion();
+ Assert.assertEquals("[null,null]", expected.toString());
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/DataTestSuite.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/DataTestSuite.java
new file mode 100644
index 00000000000..bc1bd6f3107
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/DataTestSuite.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.core.message.test.data;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( { //
+BranchCommitRequestTest.class, //
+ BranchCommitResponseTest.class, //
+ CacheUpdateRequestTest.class, //
+ ChangeItemTest.class, //
+ ChangeItemUtilTest.class, //
+ ChangeVersionTest.class, //
+ PurgeBranchRequestTest.class, //
+ TransactionCacheUpdateResponseTest.class, //
+})
+/**
+ * @author Roberto E. Escobar
+ */
+public class DataTestSuite {
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/PurgeBranchRequestTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/PurgeBranchRequestTest.java
new file mode 100644
index 00000000000..a89229bc1d9
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/PurgeBranchRequestTest.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.data;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.message.PurgeBranchRequest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link PurgeBranchRequest}
+ *
+ * @author Megumi Telles
+ * @author Jeff C. Phillips
+ */
+@RunWith(Parameterized.class)
+public class PurgeBranchRequestTest {
+
+ private final PurgeBranchRequest request;
+ private final int branchId;
+
+ public PurgeBranchRequestTest(int expectedBranchId) {
+ super();
+ this.request = new PurgeBranchRequest(expectedBranchId);
+ this.branchId = expectedBranchId;
+ }
+
+ @Test
+ public void testGetBranchId() {
+ Assert.assertEquals(branchId, request.getBranchId());
+ }
+
+ @Parameters
+ public static Collection<Object[]> getData() {
+ Collection<Object[]> data = new ArrayList<Object[]>();
+ for (int index = 1; index <= 2; index++) {
+ int branchId = index * 7;
+ data.add(new Object[] {branchId});
+ }
+ return data;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/TransactionCacheUpdateResponseTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/TransactionCacheUpdateResponseTest.java
new file mode 100644
index 00000000000..6d90b6486f7
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/data/TransactionCacheUpdateResponseTest.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.data;
+
+import java.util.ArrayList;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.TransactionCacheUpdateResponse;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
+import org.eclipse.osee.framework.core.model.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.jdk.core.util.Compare;
+import org.junit.Test;
+
+/**
+ * Test Case for {@link TransactionCacheUpdateResponse}
+ *
+ * @author Roberto E. Escobar
+ */
+public class TransactionCacheUpdateResponseTest {
+
+ @Test
+ public void testGetRows() {
+ List<TransactionRecord> expected = new ArrayList<TransactionRecord>();
+ for (int j = 1; j <= 2; j++) {
+ expected.add(MockDataFactory.createTransaction(j, j * 3));
+ }
+
+ TransactionCacheUpdateResponse response = new TransactionCacheUpdateResponse(expected);
+ List<TransactionRecord> actual = response.getTxRows();
+ Assert.assertFalse(Compare.isDifferent(expected, actual));
+ }
+
+ @Test
+ public void testFromCache() throws OseeCoreException {
+
+ List<TransactionRecord> data = new ArrayList<TransactionRecord>();
+ for (int j = 1; j <= 2; j++) {
+ data.add(MockDataFactory.createTransaction(j, j * 3));
+ }
+
+ TransactionRecordFactory factory = new TransactionRecordFactory();
+ TransactionCacheUpdateResponse response = TransactionCacheUpdateResponse.fromCache(factory, data);
+ List<TransactionRecord> actual = response.getTxRows();
+ Assert.assertEquals(data.size(), actual.size());
+ for (int index = 0; index < data.size(); index++) {
+ DataAsserts.assertEquals(data.get(index), actual.get(index));
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/ChangeTestUtility.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/ChangeTestUtility.java
new file mode 100644
index 00000000000..ca37a26dbe1
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/ChangeTestUtility.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.mocks;
+
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.message.ChangeItem;
+import org.eclipse.osee.framework.core.message.ChangeVersion;
+import org.junit.Assert;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ChangeTestUtility {
+
+ private ChangeTestUtility() {
+ }
+
+ public static ChangeVersion createChange(Long long1, ModificationType mod1) {
+ return new ChangeVersion(long1, mod1);
+ }
+
+ public static void checkChange(String message, ChangeVersion expected, ChangeVersion actual) {
+ Assert.assertEquals(message, expected.getGammaId(), actual.getGammaId());
+ Assert.assertEquals(message, expected.getModType(), actual.getModType());
+
+ Assert.assertEquals(message, expected.getValue(), actual.getValue());
+ }
+
+ public static void checkChange(ChangeVersion expected, ChangeVersion actual) {
+ checkChange(null, expected, actual);
+ }
+
+ public static ChangeItem createItem(int itemId, ChangeVersion base, ChangeVersion first, ChangeVersion current, ChangeVersion destination, ChangeVersion net) {
+ MockChangeItem change =
+ new MockChangeItem(itemId, itemId * 10, itemId * 100, current.getGammaId(), current.getModType());
+ if (base != null) {
+ change.getBaselineVersion().copy(base);
+ }
+ if (first != null) {
+ change.getFirstNonCurrentChange().copy(first);
+ }
+ if (destination != null) {
+ change.getDestinationVersion().copy(destination);
+ }
+ if (net != null) {
+ change.getNetChange().copy(net);
+ }
+ Assert.assertNotNull(change);
+ Assert.assertNotNull(change.getBaselineVersion());
+ Assert.assertNotNull(change.getFirstNonCurrentChange());
+ Assert.assertNotNull(change.getCurrentVersion());
+ Assert.assertNotNull(change.getDestinationVersion());
+ Assert.assertNotNull(change.getNetChange());
+ return change;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/DataAsserts.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/DataAsserts.java
new file mode 100644
index 00000000000..277066bdf60
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/DataAsserts.java
@@ -0,0 +1,281 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.mocks;
+
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.BranchCommitRequest;
+import org.eclipse.osee.framework.core.message.BranchCommitResponse;
+import org.eclipse.osee.framework.core.message.BranchCreationRequest;
+import org.eclipse.osee.framework.core.message.BranchCreationResponse;
+import org.eclipse.osee.framework.core.message.CacheUpdateRequest;
+import org.eclipse.osee.framework.core.message.ChangeBranchArchiveStateRequest;
+import org.eclipse.osee.framework.core.message.ChangeBranchStateRequest;
+import org.eclipse.osee.framework.core.message.ChangeBranchTypeRequest;
+import org.eclipse.osee.framework.core.message.ChangeItem;
+import org.eclipse.osee.framework.core.message.ChangeVersion;
+import org.eclipse.osee.framework.core.message.OseeImportModelRequest;
+import org.eclipse.osee.framework.core.message.OseeImportModelResponse;
+import org.eclipse.osee.framework.core.message.PurgeBranchRequest;
+import org.eclipse.osee.framework.core.message.TableData;
+import org.eclipse.osee.framework.core.model.AbstractOseeType;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.IBasicArtifact;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.type.ArtifactType;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.core.model.type.RelationType;
+import org.eclipse.osee.framework.jdk.core.util.Compare;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class DataAsserts {
+
+ private DataAsserts() {
+ }
+
+ public static void assertEquals(ChangeItem expected, ChangeItem actual) throws OseeCoreException {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ Assert.assertEquals(expected.getArtId(), actual.getArtId());
+ Assert.assertEquals(expected.getItemId(), actual.getItemId());
+
+ assertEquals(expected.getBaselineVersion(), actual.getBaselineVersion());
+ assertEquals(expected.getCurrentVersion(), actual.getCurrentVersion());
+ assertEquals(expected.getDestinationVersion(), actual.getDestinationVersion());
+ assertEquals(expected.getNetChange(), actual.getNetChange());
+ assertEquals(expected.getFirstNonCurrentChange(), actual.getFirstNonCurrentChange());
+ }
+ }
+
+ public static void assertEquals(AttributeType expected, AttributeType actual) throws OseeCoreException {
+ Assert.assertEquals(expected.getAttributeProviderId(), actual.getAttributeProviderId());
+ Assert.assertEquals(expected.getBaseAttributeTypeId(), actual.getBaseAttributeTypeId());
+ Assert.assertEquals(expected.getDefaultValue(), actual.getDefaultValue());
+ Assert.assertEquals(expected.getDescription(), actual.getDescription());
+ Assert.assertEquals(expected.getFileTypeExtension(), actual.getFileTypeExtension());
+ Assert.assertEquals(expected.getGuid(), actual.getGuid());
+ Assert.assertEquals(expected.getId(), actual.getId());
+ Assert.assertEquals(expected.getMaxOccurrences(), actual.getMaxOccurrences());
+ Assert.assertEquals(expected.getMinOccurrences(), actual.getMinOccurrences());
+ Assert.assertEquals(expected.getTaggerId(), actual.getTaggerId());
+ Assert.assertEquals(expected.getOseeEnumType(), actual.getOseeEnumType());
+ }
+
+ public static void assertEquals(ArtifactType expected, ArtifactType actual) throws OseeCoreException {
+ Assert.assertEquals(expected.getId(), actual.getId());
+ Assert.assertEquals(expected.getName(), actual.getName());
+ Assert.assertEquals(expected.isAbstract(), actual.isAbstract());
+ }
+
+ public static void assertEquals(Branch expected, Branch actual) throws OseeCoreException {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ assertEquals((AbstractOseeType) expected, (AbstractOseeType) actual);
+ Assert.assertEquals(expected.getShortName(), actual.getShortName());
+ Assert.assertEquals(expected.getAccessControlBranch(), actual.getAccessControlBranch());
+ Assert.assertEquals(expected.getAncestors(), actual.getAncestors());
+ Assert.assertEquals(expected.getArchiveState(), actual.getArchiveState());
+ Assert.assertEquals(expected.getAssociatedArtifact(), actual.getAssociatedArtifact());
+ Assert.assertEquals(expected.getBaseTransaction(), actual.getBaseTransaction());
+ Assert.assertEquals(expected.getSourceTransaction(), actual.getSourceTransaction());
+ Assert.assertEquals(expected.getParentBranch(), actual.getParentBranch());
+ }
+ }
+
+ public static void assertEquals(TransactionRecord expected, TransactionRecord actual) throws OseeCoreException {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ Assert.assertEquals(expected.getId(), actual.getId());
+ Assert.assertEquals(expected.getAuthor(), actual.getAuthor());
+ Assert.assertEquals(expected.getComment(), actual.getComment());
+ Assert.assertEquals(expected.getCommit(), actual.getCommit());
+ Assert.assertEquals(expected.getTimeStamp(), actual.getTimeStamp());
+ Assert.assertEquals(expected.getTxType(), actual.getTxType());
+ Assert.assertEquals(expected.getBranchId(), actual.getBranchId());
+ }
+ }
+
+ public static void assertEquals(IBasicArtifact<?> expected, IBasicArtifact<?> actual) throws OseeCoreException {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ Assert.assertEquals(expected.getArtId(), actual.getArtId());
+ Assert.assertEquals(expected.getGuid(), actual.getGuid());
+ Assert.assertEquals(expected.getName(), actual.getName());
+ Assert.assertEquals(expected.getFullArtifact(), actual.getFullArtifact());
+ }
+ }
+
+ public static void assertEquals(BranchCommitRequest expected, BranchCommitRequest actual) throws OseeCoreException {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ Assert.assertEquals(expected.getUserArtId(), actual.getUserArtId());
+ Assert.assertEquals(expected.isArchiveAllowed(), actual.isArchiveAllowed());
+ Assert.assertEquals(expected.getSourceBranchId(), actual.getSourceBranchId());
+ Assert.assertEquals(expected.getDestinationBranchId(), actual.getDestinationBranchId());
+ }
+ }
+
+ public static void assertEquals(BranchCommitResponse expected, BranchCommitResponse actual) throws OseeCoreException {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ assertEquals(expected.getTransaction(), actual.getTransaction());
+ }
+ }
+
+ public static void assertEquals(CacheUpdateRequest expected, CacheUpdateRequest actual) {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ Assert.assertEquals(expected.getCacheId(), actual.getCacheId());
+ Assert.assertFalse(Compare.isDifferent(expected.getItemsIds(), actual.getItemsIds()));
+ }
+ }
+
+ public static void assertEquals(RelationType expected, RelationType actual) throws OseeCoreException {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ assertEquals((AbstractOseeType) expected, (AbstractOseeType) actual);
+ Assert.assertEquals(expected.getSideAName(), actual.getSideAName());
+ Assert.assertEquals(expected.getSideBName(), actual.getSideBName());
+ Assert.assertEquals(expected.getMultiplicity(), actual.getMultiplicity());
+ Assert.assertEquals(expected.getDefaultOrderTypeGuid(), actual.getDefaultOrderTypeGuid());
+ assertEquals(expected.getArtifactTypeSideA(), actual.getArtifactTypeSideA());
+ assertEquals(expected.getArtifactTypeSideB(), actual.getArtifactTypeSideB());
+ }
+ }
+
+ public static void assertEquals(AbstractOseeType expected, AbstractOseeType actual) {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ Assert.assertEquals(expected.getId(), actual.getId());
+ Assert.assertEquals(expected.getGuid(), actual.getGuid());
+ Assert.assertEquals(expected.getName(), actual.getName());
+ Assert.assertEquals(expected.getStorageState(), actual.getStorageState());
+ Assert.assertEquals(expected.isDirty(), actual.isDirty());
+ }
+ }
+
+ public static void assertEquals(BranchCreationRequest expected, BranchCreationRequest actual) {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ Assert.assertEquals(expected.getAssociatedArtifactId(), actual.getAssociatedArtifactId());
+ Assert.assertEquals(expected.getAuthorId(), actual.getAuthorId());
+ Assert.assertEquals(expected.getBranchGuid(), actual.getBranchGuid());
+ Assert.assertEquals(expected.getBranchName(), actual.getBranchName());
+ Assert.assertEquals(expected.getCreationComment(), actual.getCreationComment());
+ Assert.assertEquals(expected.getDestinationBranchId(), actual.getDestinationBranchId());
+ Assert.assertEquals(expected.getParentBranchId(), actual.getParentBranchId());
+ Assert.assertEquals(expected.getPopulateBaseTxFromAddressingQueryId(),
+ actual.getPopulateBaseTxFromAddressingQueryId());
+ Assert.assertEquals(expected.getSourceTransactionId(), actual.getSourceTransactionId());
+ Assert.assertEquals(expected.getBranchType(), actual.getBranchType());
+ }
+ }
+
+ public static void assertEquals(BranchCreationResponse expected, BranchCreationResponse actual) {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ Assert.assertEquals(expected.getBranchId(), actual.getBranchId());
+ }
+ }
+
+ public static void assertEquals(ChangeVersion expected, ChangeVersion actual) {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ Assert.assertEquals(expected.isValid(), actual.isValid());
+ Assert.assertEquals(expected.getGammaId(), actual.getGammaId());
+ Assert.assertEquals(expected.getModType(), actual.getModType());
+ Assert.assertEquals(expected.getValue(), actual.getValue());
+ }
+ }
+
+ public static void assertEquals(OseeImportModelRequest expected, OseeImportModelRequest actual) {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ Assert.assertEquals(expected.getModel(), actual.getModel());
+ Assert.assertEquals(expected.getModelName(), actual.getModelName());
+ Assert.assertEquals(expected.isCreateCompareReport(), actual.isCreateCompareReport());
+ Assert.assertEquals(expected.isCreateTypeChangeReport(), actual.isCreateTypeChangeReport());
+ Assert.assertEquals(expected.isPersistAllowed(), actual.isPersistAllowed());
+ }
+ }
+
+ public static void assertEquals(OseeImportModelResponse expected, OseeImportModelResponse actual) {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ Assert.assertEquals(expected.getComparisonSnapshotModelName(), actual.getComparisonSnapshotModelName());
+ Assert.assertEquals(expected.getComparisonSnapshotModel(), actual.getComparisonSnapshotModel());
+ List<TableData> expDatas = expected.getReportData();
+ List<TableData> actualData = actual.getReportData();
+ Assert.assertEquals(expDatas.size(), actualData.size());
+ for (int index = 0; index < expDatas.size(); index++) {
+ assertEquals(expDatas.get(index), actualData.get(index));
+ }
+ }
+ }
+
+ public static void assertEquals(PurgeBranchRequest expected, PurgeBranchRequest actual) throws OseeCoreException {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ Assert.assertEquals(expected.getBranchId(), actual.getBranchId());
+ }
+ }
+
+ public static void assertEquals(TableData expected, TableData actual) {
+ Assert.assertEquals(expected.getTitle(), actual.getTitle());
+ Assert.assertFalse(Compare.isDifferent(expected.getColumns(), actual.getColumns()));
+ Assert.assertFalse(Compare.isDifferent(expected.getRows(), actual.getRows()));
+ }
+
+ public static void assertEquals(ChangeBranchTypeRequest expected, ChangeBranchTypeRequest actual) throws OseeCoreException {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ Assert.assertEquals(expected.getBranchId(), actual.getBranchId());
+ Assert.assertEquals(expected.getType(), actual.getType());
+ }
+ }
+
+ public static void assertEquals(ChangeBranchArchiveStateRequest expected, ChangeBranchArchiveStateRequest actual) throws OseeCoreException {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ Assert.assertEquals(expected.getBranchId(), actual.getBranchId());
+ Assert.assertEquals(expected.getState(), actual.getState());
+ }
+ }
+
+ public static void assertEquals(ChangeBranchStateRequest expected, ChangeBranchStateRequest actual) throws OseeCoreException {
+ if (expected == null) {
+ Assert.assertNull(actual);
+ } else {
+ Assert.assertEquals(expected.getBranchId(), actual.getBranchId());
+ Assert.assertEquals(expected.getState(), actual.getState());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockChangeItem.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockChangeItem.java
new file mode 100644
index 00000000000..901259c1172
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockChangeItem.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.mocks;
+
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.message.ChangeItem;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class MockChangeItem extends ChangeItem {
+
+ public MockChangeItem(int itemId, int itemTypeId, int artId, long currentSourceGammaId, ModificationType currentSourceModType) {
+ super(itemId, itemTypeId, artId, currentSourceGammaId, currentSourceModType);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockOseeModelFactoryServiceProvider.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockOseeModelFactoryServiceProvider.java
new file mode 100644
index 00000000000..ae270fcba29
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockOseeModelFactoryServiceProvider.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.mocks;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class MockOseeModelFactoryServiceProvider implements IOseeModelFactoryServiceProvider {
+
+ private final IOseeModelFactoryService service;
+
+ public MockOseeModelFactoryServiceProvider(IOseeModelFactoryService service) {
+ this.service = service;
+ }
+
+ @Override
+ public IOseeModelFactoryService getOseeFactoryService() throws OseeCoreException {
+ return service;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockRequestFactory.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockRequestFactory.java
new file mode 100644
index 00000000000..eb8b020b470
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/mocks/MockRequestFactory.java
@@ -0,0 +1,84 @@
+/*
+ * Created on Jun 18, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.core.message.test.mocks;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.message.ArtifactChangeItem;
+import org.eclipse.osee.framework.core.message.BranchCreationRequest;
+import org.eclipse.osee.framework.core.message.BranchCreationResponse;
+import org.eclipse.osee.framework.core.message.CacheUpdateRequest;
+import org.eclipse.osee.framework.core.message.ChangeVersion;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+
+public final class MockRequestFactory {
+ private MockRequestFactory() {
+ }
+
+ public static IOseeModelFactoryServiceProvider createFactoryProvider(){
+ return new MockOseeModelFactoryServiceProvider(null);
+ }
+
+ public static ArtifactChangeItem createArtifactChangeItem() throws OseeArgumentException {
+ int artId = (int) Math.random();
+ Long gammaIdNumber = Long.valueOf((int) Math.random());
+ int artTypeId = artId * 10;
+ ArtifactChangeItem changeItem =
+ new ArtifactChangeItem(artId, artTypeId, gammaIdNumber, ModificationType.getMod(1));
+ populateChangeVersion(changeItem.getDestinationVersion(), 22);
+ populateChangeVersion(changeItem.getCurrentVersion(), 15);
+ return changeItem;
+ }
+
+ public static ChangeVersion createChangeVersion(int index) {
+ ModificationType modType = ModificationType.values()[index % ModificationType.values().length];
+ return new ChangeVersion("change_version_value_" + index, (long) (index * Integer.MAX_VALUE), modType);
+ }
+
+ public static void populateChangeVersion(ChangeVersion changeVersion, int index) {
+ ModificationType modType = ModificationType.values()[index % ModificationType.values().length];
+ changeVersion.setGammaId((long) (index * Integer.MAX_VALUE));
+ changeVersion.setModType(modType);
+ changeVersion.setValue("change_version_value_" + index);
+ }
+
+ public static CacheUpdateRequest createRequest(int index) {
+ OseeCacheEnum cacheEnum = OseeCacheEnum.values()[Math.abs(index % OseeCacheEnum.values().length)];
+ List<Integer> guids = new ArrayList<Integer>();
+ for (int j = 1; j <= index * 3; j++) {
+ guids.add(j * index);
+ }
+ return new CacheUpdateRequest(cacheEnum, guids);
+ }
+
+ public static BranchCreationRequest createBranchCreateRequest(int index) {
+ BranchType branchType = BranchType.values()[Math.abs(index % BranchType.values().length)];
+ String branchName = "branch_" + index;
+ int parentBranchId = index;
+ int associatedArtifactId = index * 3;
+ int sourceTransactionId = index * 7;
+ String branchGuid = GUID.create();
+
+ int authorId = index * 7;
+
+ String creationComment = "creation_comment_" + index;
+
+ int populateBaseTxFromAddressingQueryId = -1;
+ int destinationBranchId = -1;
+
+ return new BranchCreationRequest(branchType, sourceTransactionId, parentBranchId, branchGuid, branchName,
+ associatedArtifactId, authorId, creationComment, populateBaseTxFromAddressingQueryId, destinationBranchId);
+ }
+
+ public static Object createBranchCreateResponse(int index) {
+ return new BranchCreationResponse(index);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BaseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BaseTranslatorTest.java
new file mode 100644
index 00000000000..34e3fc094d1
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BaseTranslatorTest.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+import org.junit.Test;
+
+/**
+ * Test Case For {@link ITranslator}
+ *
+ * @author Roberto E. Escobar
+ */
+public abstract class BaseTranslatorTest<T> {
+
+ private final ITranslator<T> translator;
+ private final T data;
+
+ protected BaseTranslatorTest(T data, ITranslator<T> translator) {
+ this.data = data;
+ this.translator = translator;
+ }
+
+ @Test
+ public void testTranslation() throws OseeCoreException {
+ PropertyStore propertyStore = translator.convert(data);
+ T actual = translator.convert(propertyStore);
+
+ checkEquals(data, actual);
+ }
+
+ protected abstract void checkEquals(T expected, T actual) throws OseeCoreException;
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchChangeArchivedStateRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchChangeArchivedStateRequestTranslatorTest.java
new file mode 100644
index 00000000000..4c8b37c6ab4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchChangeArchivedStateRequestTranslatorTest.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.enums.BranchArchivedState;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.ChangeBranchArchiveStateRequest;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchChangeArchivedStateRequestTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link BranchChangeArchivedStateRequestTranslator}
+ *
+ * @author Megumi Telles
+ */
+@RunWith(Parameterized.class)
+public class BranchChangeArchivedStateRequestTranslatorTest extends BaseTranslatorTest<ChangeBranchArchiveStateRequest> {
+
+ public BranchChangeArchivedStateRequestTranslatorTest(ChangeBranchArchiveStateRequest data, ITranslator<ChangeBranchArchiveStateRequest> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(ChangeBranchArchiveStateRequest expected, ChangeBranchArchiveStateRequest actual) throws OseeCoreException {
+ DataAsserts.assertEquals(expected, actual);
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ List<Object[]> data = new ArrayList<Object[]>();
+ ITranslator<ChangeBranchArchiveStateRequest> translator = new BranchChangeArchivedStateRequestTranslator();
+ int state = 0;
+ for (int index = 1; index <= 2; index++) {
+ data.add(new Object[] {new ChangeBranchArchiveStateRequest(index * 3, BranchArchivedState.valueOf(state++)),
+ translator});
+ }
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchChangeStateRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchChangeStateRequestTranslatorTest.java
new file mode 100644
index 00000000000..8525a967eab
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchChangeStateRequestTranslatorTest.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.enums.BranchState;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.ChangeBranchStateRequest;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchChangeStateRequestTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link BranchChangeStateRequestTranslator}
+ *
+ * @author Megumi Telles
+ */
+@RunWith(Parameterized.class)
+public class BranchChangeStateRequestTranslatorTest extends BaseTranslatorTest<ChangeBranchStateRequest> {
+
+ public BranchChangeStateRequestTranslatorTest(ChangeBranchStateRequest data, ITranslator<ChangeBranchStateRequest> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(ChangeBranchStateRequest expected, ChangeBranchStateRequest actual) throws OseeCoreException {
+ DataAsserts.assertEquals(expected, actual);
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ List<Object[]> data = new ArrayList<Object[]>();
+ ITranslator<ChangeBranchStateRequest> translator = new BranchChangeStateRequestTranslator();
+
+ for (int index = 1; index <= 2; index++) {
+ data.add(new Object[] {new ChangeBranchStateRequest(index * 3, BranchState.getBranchState(index)), translator});
+ }
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchChangeTypeRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchChangeTypeRequestTranslatorTest.java
new file mode 100644
index 00000000000..debfa903329
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchChangeTypeRequestTranslatorTest.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.ChangeBranchTypeRequest;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchChangeStateRequestTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchChangeTypeRequestTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link BranchChangeStateRequestTranslator}
+ *
+ * @author Megumi Telles
+ */
+@RunWith(Parameterized.class)
+public class BranchChangeTypeRequestTranslatorTest extends BaseTranslatorTest<ChangeBranchTypeRequest> {
+
+ public BranchChangeTypeRequestTranslatorTest(ChangeBranchTypeRequest data, ITranslator<ChangeBranchTypeRequest> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(ChangeBranchTypeRequest expected, ChangeBranchTypeRequest actual) throws OseeCoreException {
+ DataAsserts.assertEquals(expected, actual);
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ List<Object[]> data = new ArrayList<Object[]>();
+ ITranslator<ChangeBranchTypeRequest> translator = new BranchChangeTypeRequestTranslator();
+
+ for (int index = 1; index <= 2; index++) {
+ data.add(new Object[] {new ChangeBranchTypeRequest(index * 3, BranchType.valueOf(++index)), translator});
+ }
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitRequestTranslatorTest.java
new file mode 100644
index 00000000000..d51073f7e20
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitRequestTranslatorTest.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.BranchCommitRequest;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchCommitRequestTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link BranchCommitRequestTranslator}
+ *
+ * @author Megumi Telles
+ */
+@RunWith(Parameterized.class)
+public class BranchCommitRequestTranslatorTest extends BaseTranslatorTest<BranchCommitRequest> {
+
+ public BranchCommitRequestTranslatorTest(BranchCommitRequest data, ITranslator<BranchCommitRequest> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(BranchCommitRequest expected, BranchCommitRequest actual) throws OseeCoreException {
+ DataAsserts.assertEquals(expected, actual);
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ List<Object[]> data = new ArrayList<Object[]>();
+ ITranslator<BranchCommitRequest> translator = new BranchCommitRequestTranslator();
+
+ boolean archive = false;
+ for (int index = 1; index <= 2; index++) {
+ archive ^= archive;
+ data.add(new Object[] {new BranchCommitRequest(index * 3, index * 2, index * 4, archive), translator});
+ }
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java
new file mode 100644
index 00000000000..0ed595b5fed
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCommitResponseTranslatorTest.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.BranchCommitResponse;
+import org.eclipse.osee.framework.core.message.internal.DataTranslationService;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchCommitResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.TransactionRecordTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.message.test.mocks.MockRequestFactory;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
+import org.eclipse.osee.framework.core.translation.IDataTranslationService;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link BranchCommitResponseTranslator}
+ *
+ * @author Megumi Telles
+ */
+@RunWith(Parameterized.class)
+public class BranchCommitResponseTranslatorTest extends BaseTranslatorTest<BranchCommitResponse> {
+
+ public BranchCommitResponseTranslatorTest(BranchCommitResponse data, ITranslator<BranchCommitResponse> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(BranchCommitResponse expected, BranchCommitResponse actual) throws OseeCoreException {
+ DataAsserts.assertEquals(expected, actual);
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ IOseeModelFactoryServiceProvider factoryProvider = MockRequestFactory.createFactoryProvider();
+
+ List<Object[]> data = new ArrayList<Object[]>();
+ IDataTranslationService service = new DataTranslationService();
+ service.addTranslator(new TransactionRecordTranslator(factoryProvider), CoreTranslatorId.TRANSACTION_RECORD);
+
+ ITranslator<BranchCommitResponse> translator = new BranchCommitResponseTranslator(service);
+ for (int index = 1; index <= 2; index++) {
+ TransactionRecord tx = MockDataFactory.createTransaction(index, index * 3);
+
+ BranchCommitResponse response = new BranchCommitResponse();
+ response.setTransaction(tx);
+ data.add(new Object[] {response, translator});
+ }
+ data.add(new Object[] {new BranchCommitResponse(), translator});
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCreationRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCreationRequestTranslatorTest.java
new file mode 100644
index 00000000000..4b640d2121f
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCreationRequestTranslatorTest.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.BranchCreationRequest;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchCreationRequestTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.message.test.mocks.MockRequestFactory;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.Assert;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link BranchCreationRequestTranslator}
+ *
+ * @author Roberto E. Escobar
+ */
+@RunWith(Parameterized.class)
+public class BranchCreationRequestTranslatorTest extends BaseTranslatorTest<BranchCreationRequest> {
+
+ public BranchCreationRequestTranslatorTest(BranchCreationRequest data, ITranslator<BranchCreationRequest> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(BranchCreationRequest expected, BranchCreationRequest actual) throws OseeCoreException {
+ Assert.assertNotSame(expected, actual);
+ DataAsserts.assertEquals(expected, actual);
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ List<Object[]> data = new ArrayList<Object[]>();
+ ITranslator<BranchCreationRequest> translator = new BranchCreationRequestTranslator();
+
+ data.add(new Object[] {MockRequestFactory.createBranchCreateRequest(45), translator});
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCreationResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCreationResponseTranslatorTest.java
new file mode 100644
index 00000000000..eafbd6bf0d3
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/BranchCreationResponseTranslatorTest.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.BranchCreationResponse;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchCreationResponseTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.message.test.mocks.MockRequestFactory;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.Assert;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link BranchCreationResponseTranslator}
+ *
+ * @author Roberto E. Escobar
+ */
+@RunWith(Parameterized.class)
+public class BranchCreationResponseTranslatorTest extends BaseTranslatorTest<BranchCreationResponse> {
+
+ public BranchCreationResponseTranslatorTest(BranchCreationResponse data, ITranslator<BranchCreationResponse> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(BranchCreationResponse expected, BranchCreationResponse actual) throws OseeCoreException {
+ Assert.assertNotSame(expected, actual);
+ DataAsserts.assertEquals(expected, actual);
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ List<Object[]> data = new ArrayList<Object[]>();
+ ITranslator<BranchCreationResponse> translator = new BranchCreationResponseTranslator();
+
+ data.add(new Object[] {MockRequestFactory.createBranchCreateResponse(55), translator});
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/CacheUpdateRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/CacheUpdateRequestTranslatorTest.java
new file mode 100644
index 00000000000..d5c351d1a3a
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/CacheUpdateRequestTranslatorTest.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.CacheUpdateRequest;
+import org.eclipse.osee.framework.core.message.internal.translation.CacheUpdateRequestTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.message.test.mocks.MockRequestFactory;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link CacheUpdateRequestTranslator}
+ *
+ * @author Roberto E. Escobar
+ * @author Jeff C. Phillips
+ */
+@RunWith(Parameterized.class)
+public class CacheUpdateRequestTranslatorTest extends BaseTranslatorTest<CacheUpdateRequest> {
+
+ public CacheUpdateRequestTranslatorTest(CacheUpdateRequest data, ITranslator<CacheUpdateRequest> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(CacheUpdateRequest expected, CacheUpdateRequest actual) throws OseeCoreException {
+ Assert.assertNotSame(expected, actual);
+ DataAsserts.assertEquals(expected, actual);
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ CacheUpdateRequestTranslator translator = new CacheUpdateRequestTranslator();
+
+ List<Object[]> data = new ArrayList<Object[]>();
+ for (int index = 1; index <= 5; index++) {
+ data.add(new Object[] {MockRequestFactory.createRequest(index), translator});
+ }
+ //
+ data.add(new Object[] {new CacheUpdateRequest(OseeCacheEnum.ARTIFACT_TYPE_CACHE), translator});
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/ChangeItemTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/ChangeItemTranslatorTest.java
new file mode 100644
index 00000000000..8542a18b063
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/ChangeItemTranslatorTest.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.ChangeItem;
+import org.eclipse.osee.framework.core.message.internal.DataTranslationService;
+import org.eclipse.osee.framework.core.message.internal.translation.ChangeItemTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.ChangeVersionTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.message.test.mocks.MockRequestFactory;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case For {@link ChangeItemTranslator}
+ *
+ * @author Jeff C. Phillips
+ */
+@RunWith(Parameterized.class)
+public class ChangeItemTranslatorTest extends BaseTranslatorTest<ChangeItem> {
+
+ public ChangeItemTranslatorTest(ChangeItem data, ITranslator<ChangeItem> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(ChangeItem expected, ChangeItem actual) throws OseeCoreException {
+ Assert.assertNotSame(expected, actual);
+ DataAsserts.assertEquals(expected, actual);
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ DataTranslationService dataTranslationService = new DataTranslationService();
+ dataTranslationService.addTranslator(new ChangeVersionTranslator(),
+ CoreTranslatorId.CHANGE_VERSION);
+
+ List<Object[]> data = new ArrayList<Object[]>();
+ ITranslator<ChangeItem> translator = new ChangeItemTranslator(dataTranslationService);
+ data.add(new Object[] {MockRequestFactory.createArtifactChangeItem(), translator});
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/ChangeReportResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/ChangeReportResponseTranslatorTest.java
new file mode 100644
index 00000000000..4971d9b04bd
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/ChangeReportResponseTranslatorTest.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.ChangeItem;
+import org.eclipse.osee.framework.core.message.ChangeReportResponse;
+import org.eclipse.osee.framework.core.message.internal.DataTranslationService;
+import org.eclipse.osee.framework.core.message.internal.translation.ChangeItemTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.ChangeReportResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.ChangeVersionTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.message.test.mocks.MockRequestFactory;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case For {@link ChangeReportResponseTranslator}
+ *
+ * @author Jeff C. Phillips
+ */
+@RunWith(Parameterized.class)
+public class ChangeReportResponseTranslatorTest extends BaseTranslatorTest<ChangeReportResponse> {
+
+ public ChangeReportResponseTranslatorTest(ChangeReportResponse data, ITranslator<ChangeReportResponse> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(ChangeReportResponse expected, ChangeReportResponse actual) throws OseeCoreException {
+ List<ChangeItem> expectedChangeItems = expected.getChangeItems();
+ List<ChangeItem> actualChangeItems = actual.getChangeItems();
+
+ for (int i = 0; i < expected.getChangeItems().size(); i++) {
+ DataAsserts.assertEquals(expectedChangeItems.get(i), actualChangeItems.get(i));
+ }
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ DataTranslationService dataTranslationService = new DataTranslationService();
+ dataTranslationService.addTranslator(new ChangeItemTranslator(dataTranslationService),
+ CoreTranslatorId.CHANGE_ITEM);
+ dataTranslationService.addTranslator(new ChangeVersionTranslator(), CoreTranslatorId.CHANGE_VERSION);
+
+ ChangeReportResponse response = new ChangeReportResponse();
+ response.addItem(MockRequestFactory.createArtifactChangeItem());
+ response.addItem(MockRequestFactory.createArtifactChangeItem());
+ response.addItem(MockRequestFactory.createArtifactChangeItem());
+
+ List<Object[]> data = new ArrayList<Object[]>();
+ ITranslator<ChangeReportResponse> translator = new ChangeReportResponseTranslator(dataTranslationService);
+
+ data.add(new Object[] { response, translator });
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/ChangeVersionTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/ChangeVersionTranslatorTest.java
new file mode 100644
index 00000000000..d97ba030e6d
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/ChangeVersionTranslatorTest.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.ChangeVersion;
+import org.eclipse.osee.framework.core.message.internal.translation.ChangeVersionTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.message.test.mocks.MockRequestFactory;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case For {@link ChangeVersionTranslator}
+ *
+ * @author Jeff C. Phillips
+ */
+@RunWith(Parameterized.class)
+public class ChangeVersionTranslatorTest extends BaseTranslatorTest<ChangeVersion> {
+
+ public ChangeVersionTranslatorTest(ChangeVersion data, ITranslator<ChangeVersion> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(ChangeVersion expected, ChangeVersion actual) throws OseeCoreException {
+ Assert.assertNotSame(expected, actual);
+ DataAsserts.assertEquals(expected, actual);
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() {
+ List<Object[]> data = new ArrayList<Object[]>();
+ ITranslator<ChangeVersion> translator = new ChangeVersionTranslator();
+ data.add(new Object[] {MockRequestFactory.createChangeVersion(22), translator});
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceFactoryTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceFactoryTest.java
new file mode 100644
index 00000000000..c9115758bde
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceFactoryTest.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.internal.DataTranslationServiceFactory;
+import org.eclipse.osee.framework.core.message.internal.translation.ArtifactTypeCacheUpdateResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.AttributeTypeCacheUpdateResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchCacheStoreRequestTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchCacheUpdateResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchCommitRequestTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchCommitResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchCreationRequestTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.BranchCreationResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.CacheUpdateRequestTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.ChangeItemTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.ChangeReportRequestTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.ChangeReportResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.ChangeVersionTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.OseeEnumTypeCacheUpdateResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.OseeImportModelRequestTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.OseeImportModelResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.RelationTypeCacheUpdateResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.TableDataTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.TransactionCacheUpdateResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.TransactionRecordTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.MockOseeModelFactoryServiceProvider;
+import org.eclipse.osee.framework.core.model.test.mocks.MockOseeCachingServiceProvider;
+import org.eclipse.osee.framework.core.translation.IDataTranslationService;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.core.translation.ITranslatorId;
+import org.junit.Test;
+
+/**
+ * Test Case for {@link DataTranslationServiceFactory}
+ *
+ * @author Roberto E. Escobar
+ */
+public class DataTranslationServiceFactoryTest {
+
+ @Test
+ public void testServiceCreation() throws OseeCoreException {
+ IDataTranslationService srvc =
+ new DataTranslationServiceFactory().createService(new MockOseeCachingServiceProvider(null),
+ new MockOseeModelFactoryServiceProvider(null));
+
+ checkExists(srvc, TransactionRecordTranslator.class, CoreTranslatorId.TRANSACTION_RECORD);
+
+ checkExists(srvc, BranchCreationRequestTranslator.class, CoreTranslatorId.BRANCH_CREATION_REQUEST);
+ checkExists(srvc, BranchCreationResponseTranslator.class, CoreTranslatorId.BRANCH_CREATION_RESPONSE);
+
+ checkExists(srvc, BranchCommitRequestTranslator.class, CoreTranslatorId.BRANCH_COMMIT_REQUEST);
+ checkExists(srvc, BranchCommitResponseTranslator.class, CoreTranslatorId.BRANCH_COMMIT_RESPONSE);
+ checkExists(srvc, ChangeVersionTranslator.class, CoreTranslatorId.CHANGE_VERSION);
+ checkExists(srvc, ChangeItemTranslator.class, CoreTranslatorId.CHANGE_ITEM);
+ checkExists(srvc, ChangeReportRequestTranslator.class, CoreTranslatorId.CHANGE_REPORT_REQUEST);
+ checkExists(srvc, ChangeReportResponseTranslator.class, CoreTranslatorId.CHANGE_REPORT_RESPONSE);
+
+ checkExists(srvc, CacheUpdateRequestTranslator.class, CoreTranslatorId.OSEE_CACHE_UPDATE_REQUEST);
+ checkExists(srvc, ArtifactTypeCacheUpdateResponseTranslator.class,
+ CoreTranslatorId.ARTIFACT_TYPE_CACHE_UPDATE_RESPONSE);
+ checkExists(srvc, AttributeTypeCacheUpdateResponseTranslator.class,
+ CoreTranslatorId.ATTRIBUTE_TYPE_CACHE_UPDATE_RESPONSE);
+ checkExists(srvc, RelationTypeCacheUpdateResponseTranslator.class,
+ CoreTranslatorId.RELATION_TYPE_CACHE_UPDATE_RESPONSE);
+ checkExists(srvc, OseeEnumTypeCacheUpdateResponseTranslator.class,
+ CoreTranslatorId.OSEE_ENUM_TYPE_CACHE_UPDATE_RESPONSE);
+ checkExists(srvc, BranchCacheUpdateResponseTranslator.class, CoreTranslatorId.BRANCH_CACHE_UPDATE_RESPONSE);
+ checkExists(srvc, BranchCacheStoreRequestTranslator.class, CoreTranslatorId.BRANCH_CACHE_STORE_REQUEST);
+ checkExists(srvc, TransactionCacheUpdateResponseTranslator.class, CoreTranslatorId.TX_CACHE_UPDATE_RESPONSE);
+
+ checkExists(srvc, OseeImportModelRequestTranslator.class, CoreTranslatorId.OSEE_IMPORT_MODEL_REQUEST);
+ checkExists(srvc, OseeImportModelResponseTranslator.class, CoreTranslatorId.OSEE_IMPORT_MODEL_RESPONSE);
+ checkExists(srvc, TableDataTranslator.class, CoreTranslatorId.TABLE_DATA);
+
+ // checkExists(srvc, BasicArtifactTranslator.class, CoreTranslatorId.ARTIFACT_METADATA);
+ // checkExists(srvc, BranchTranslator.class, CoreTranslatorId.BRANCH);
+ // checkExists(srvc, ArtifactTypeTranslator.class, CoreTranslatorId.ARTIFACT_TYPE);
+ // checkExists(srvc, AttributeTypeTranslator.class, CoreTranslatorId.ATTRIBUTE_TYPE);
+ // checkExists(srvc, RelationTypeTranslator.class, CoreTranslatorId.RELATION_TYPE);
+ // checkExists(srvc, OseeEnumTypeTranslator.class, CoreTranslatorId.OSEE_ENUM_TYPE);
+ // checkExists(srvc, OseeEnumEntryTranslator.class, CoreTranslatorId.OSEE_ENUM_ENTRY);
+ }
+
+ @SuppressWarnings("unchecked")
+ private void checkExists(IDataTranslationService service, Class<? extends ITranslator> expected, ITranslatorId key) throws OseeCoreException {
+ ITranslator<?> actual = service.getTranslator(key);
+ Assert.assertNotNull(actual);
+ Assert.assertEquals(expected, actual.getClass());
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceTest.java
new file mode 100644
index 00000000000..56f286e33a2
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/DataTranslationServiceTest.java
@@ -0,0 +1,213 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.message.internal.DataTranslationService;
+import org.eclipse.osee.framework.core.translation.IDataTranslationService;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.core.translation.ITranslatorId;
+import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test Case for {@link DataTranslationService}
+ *
+ * @author Roberto E. Escobar
+ */
+public class DataTranslationServiceTest {
+
+ private enum TxId implements ITranslatorId {
+ STRING_TX, INTEGER_TX, OBJECT_TX, DUMMY_TX;
+
+ @Override
+ public String getKey() {
+ return name();
+ }
+
+ }
+
+ @Test
+ public void testAddRemoveTranslator() throws OseeCoreException {
+ IDataTranslationService service = new DataTranslationService();
+
+ ITranslator<String> tx1 = new DataTranslatorAdapter<String>();
+ ITranslator<Integer> tx2 = new DataTranslatorAdapter<Integer>();
+ ITranslator<Object> tx3 = new DataTranslatorAdapter<Object>();
+
+ Assert.assertTrue(service.getSupportedClasses().isEmpty());
+
+ Assert.assertTrue(service.addTranslator(tx1, TxId.STRING_TX));
+ Assert.assertTrue(service.addTranslator(tx2, TxId.INTEGER_TX));
+ Assert.assertFalse(service.addTranslator(tx2, TxId.INTEGER_TX)); // Add again
+
+ Assert.assertTrue(service.addTranslator(tx3, TxId.OBJECT_TX));
+ Assert.assertEquals(3, service.getSupportedClasses().size());
+
+ Assert.assertEquals(tx1, service.getTranslator(TxId.STRING_TX));
+ Assert.assertEquals(tx2, service.getTranslator(TxId.INTEGER_TX));
+ Assert.assertEquals(tx3, service.getTranslator(TxId.OBJECT_TX));
+
+ try {
+ service.getTranslator(TxId.DUMMY_TX);
+ Assert.fail("Should not be executed");
+ } catch (OseeCoreException ex) {
+ Assert.assertTrue(ex instanceof OseeStateException);
+ }
+
+ Assert.assertTrue(service.removeTranslator(TxId.INTEGER_TX));
+ Assert.assertEquals(2, service.getSupportedClasses().size());
+
+ Assert.assertFalse(service.removeTranslator(TxId.INTEGER_TX));
+
+ Assert.assertTrue(service.removeTranslator(TxId.STRING_TX));
+ Assert.assertEquals(1, service.getSupportedClasses().size());
+
+ Assert.assertFalse(service.removeTranslator(TxId.DUMMY_TX));
+ Assert.assertEquals(1, service.getSupportedClasses().size());
+
+ Assert.assertTrue(service.removeTranslator(TxId.OBJECT_TX));
+ Assert.assertTrue(service.getSupportedClasses().isEmpty());
+ }
+
+ @Test
+ public void testConvert() throws OseeCoreException {
+ DataTranslationService service = new DataTranslationService();
+ service.addTranslator(new TestObjectTranslator(), TxId.OBJECT_TX);
+
+ TestObject value = new TestObject("hello", 1, 1.0);
+ PropertyStore propertyStore = service.convert(value, TxId.OBJECT_TX);
+ Assert.assertFalse(propertyStore.isEmpty());
+ TestObject actual = service.convert(propertyStore, TxId.OBJECT_TX);
+
+ Assert.assertEquals(value.one, actual.one);
+ Assert.assertEquals(value.two, actual.two);
+ Assert.assertEquals(value.three, actual.three);
+ }
+
+ @Test
+ public void testConvertStreams() throws OseeCoreException {
+ DataTranslationService service = new DataTranslationService();
+ service.addTranslator(new TestObjectTranslator(), TxId.OBJECT_TX);
+
+ TestObject expected = new TestObject("streamTest", 45, 1.0);
+ TestObject actual = null;
+ InputStream stream = null;
+ try {
+ stream = service.convertToStream(expected, TxId.OBJECT_TX);
+ actual = service.convert(stream, TxId.OBJECT_TX);
+
+ } finally {
+ Lib.close(stream);
+ }
+ Assert.assertNotNull(actual);
+ Assert.assertNotSame(expected, actual);
+ Assert.assertEquals(expected.one, actual.one);
+ Assert.assertEquals(expected.two, actual.two);
+ Assert.assertEquals(expected.three, actual.three);
+ }
+
+ @Test
+ public void testNullConverts() throws Exception {
+ DataTranslationService service = new DataTranslationService();
+
+ assertEmpty(service.convert((Object) null, TxId.OBJECT_TX));
+ assertEmpty(service.convertToStream(null, TxId.OBJECT_TX));
+ Assert.assertNull(service.convert((PropertyStore) null, TxId.OBJECT_TX));
+ }
+
+ private void assertEmpty(InputStream inputStream) throws Exception {
+ PropertyStore toCheck = new PropertyStore();
+ Assert.assertTrue(toCheck.isEmpty());
+ toCheck.load(inputStream);
+ assertEmpty(toCheck);
+ }
+
+ private void assertEmpty(PropertyStore toCheck) throws Exception {
+ Assert.assertTrue(toCheck.arrayKeySet().isEmpty());
+ Assert.assertTrue(toCheck.keySet().isEmpty());
+ Assert.assertTrue(toCheck.innerStoresKeySet().isEmpty());
+ Assert.assertTrue(toCheck.isEmpty());
+ }
+
+ @Test(expected = OseeArgumentException.class)
+ public void testNullClazz() throws Exception {
+ DataTranslationService service = new DataTranslationService();
+ service.convert(new ByteArrayInputStream(new byte[0]), (ITranslatorId) null);
+ }
+
+ @Test(expected = OseeArgumentException.class)
+ public void testNullClazz2() throws Exception {
+ DataTranslationService service = new DataTranslationService();
+ service.convert(new PropertyStore(), (ITranslatorId) null);
+ }
+
+ @Test(expected = OseeArgumentException.class)
+ public void testNullInputStream() throws Exception {
+ DataTranslationService service = new DataTranslationService();
+ service.convert((InputStream) null, TxId.OBJECT_TX);
+ }
+
+ @Test(expected = OseeArgumentException.class)
+ public void testNullGetTranslator() throws Exception {
+ DataTranslationService service = new DataTranslationService();
+ service.getTranslator((ITranslatorId) null);
+ }
+
+ private class TestObject {
+ String one;
+ Integer two;
+ Double three;
+
+ public TestObject(String one, Integer two, Double three) {
+ super();
+ this.one = one;
+ this.two = two;
+ this.three = three;
+ }
+
+ }
+
+ private class DataTranslatorAdapter<T> implements ITranslator<T> {
+ @Override
+ public T convert(PropertyStore propertyStore) {
+ return null;
+ }
+
+ @Override
+ public PropertyStore convert(T object) {
+ return null;
+ }
+ }
+
+ private class TestObjectTranslator implements ITranslator<TestObject> {
+ @Override
+ public TestObject convert(PropertyStore propertyStore) {
+ return new TestObject(propertyStore.get("one"), propertyStore.getInt("two"), propertyStore.getDouble("three"));
+ }
+
+ @Override
+ public PropertyStore convert(TestObject object) {
+ PropertyStore propertyStore = new PropertyStore();
+ propertyStore.put("one", object.one);
+ propertyStore.put("two", object.two);
+ propertyStore.put("three", object.three);
+ return propertyStore;
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/OseeImportModelRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/OseeImportModelRequestTranslatorTest.java
new file mode 100644
index 00000000000..26ea952360d
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/OseeImportModelRequestTranslatorTest.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.OseeImportModelRequest;
+import org.eclipse.osee.framework.core.message.internal.translation.OseeImportModelRequestTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link OseeImportModelRequest}
+ *
+ * @author Roberto E. Escobar
+ */
+@RunWith(Parameterized.class)
+public class OseeImportModelRequestTranslatorTest extends BaseTranslatorTest<OseeImportModelRequest> {
+
+ public OseeImportModelRequestTranslatorTest(OseeImportModelRequest data, ITranslator<OseeImportModelRequest> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(OseeImportModelRequest expected, OseeImportModelRequest actual) throws OseeCoreException {
+ Assert.assertNotSame(expected, actual);
+ DataAsserts.assertEquals(expected, actual);
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ ITranslator<OseeImportModelRequest> translator = new OseeImportModelRequestTranslator();
+
+ List<Object[]> data = new ArrayList<Object[]>();
+ data.add(new Object[] {new OseeImportModelRequest("dummy:/model.osee", "dummy model", false, true, false),
+ translator});
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/OseeImportModelResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/OseeImportModelResponseTranslatorTest.java
new file mode 100644
index 00000000000..ac5523e5afa
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/OseeImportModelResponseTranslatorTest.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.OseeImportModelResponse;
+import org.eclipse.osee.framework.core.message.TableData;
+import org.eclipse.osee.framework.core.message.internal.DataTranslationService;
+import org.eclipse.osee.framework.core.message.internal.translation.OseeImportModelResponseTranslator;
+import org.eclipse.osee.framework.core.message.internal.translation.TableDataTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.translation.IDataTranslationService;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link OseeImportModelResponse}
+ *
+ * @author Roberto E. Escobar
+ */
+@RunWith(Parameterized.class)
+public class OseeImportModelResponseTranslatorTest extends BaseTranslatorTest<OseeImportModelResponse> {
+
+ public OseeImportModelResponseTranslatorTest(OseeImportModelResponse data, ITranslator<OseeImportModelResponse> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(OseeImportModelResponse expected, OseeImportModelResponse actual) throws OseeCoreException {
+ Assert.assertNotSame(expected, actual);
+ Assert.assertNotNull(actual);
+ DataAsserts.assertEquals(expected, actual);
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ IDataTranslationService service = new DataTranslationService();
+ service.addTranslator(new TableDataTranslator(), CoreTranslatorId.TABLE_DATA);
+ ITranslator<OseeImportModelResponse> translator = new OseeImportModelResponseTranslator(service);
+
+ List<Object[]> data = new ArrayList<Object[]>();
+ OseeImportModelResponse response = new OseeImportModelResponse();
+ response.setComparisonSnapshotModel("dummy compare");
+ response.setComparisonSnapshotModelName("dummy compare name");
+ response.setPersisted(true);
+
+ List<TableData> tableDatas = new ArrayList<TableData>();
+ tableDatas.add(new TableData("hello", new String[] {"col1", "col2"}, Arrays.asList(new String[] {"one1", "two2"},
+ new String[] {"one3", "two4"})));
+ response.setReportData(tableDatas);
+ data.add(new Object[] {response, translator});
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/PurgeBranchRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/PurgeBranchRequestTranslatorTest.java
new file mode 100644
index 00000000000..b96707468c8
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/PurgeBranchRequestTranslatorTest.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.PurgeBranchRequest;
+import org.eclipse.osee.framework.core.message.internal.translation.PurgeBranchRequestTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link PurgeBranchRequestTranslator}
+ *
+ * @author Megumi Telles
+ * @author Jeff C. Phillips
+ */
+@RunWith(Parameterized.class)
+public class PurgeBranchRequestTranslatorTest extends BaseTranslatorTest<PurgeBranchRequest> {
+
+ public PurgeBranchRequestTranslatorTest(PurgeBranchRequest data, ITranslator<PurgeBranchRequest> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(PurgeBranchRequest expected, PurgeBranchRequest actual) throws OseeCoreException {
+ DataAsserts.assertEquals(expected, actual);
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ List<Object[]> data = new ArrayList<Object[]>();
+ ITranslator<PurgeBranchRequest> translator = new PurgeBranchRequestTranslator();
+
+ for (int index = 1; index <= 2; index++) {
+ data.add(new Object[] {new PurgeBranchRequest(index * 3), translator});
+ }
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TableDataTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TableDataTranslatorTest.java
new file mode 100644
index 00000000000..ad4cb8039d5
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TableDataTranslatorTest.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.TableData;
+import org.eclipse.osee.framework.core.message.internal.translation.TableDataTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link TableData}
+ *
+ * @author Roberto E. Escobar
+ */
+@RunWith(Parameterized.class)
+public class TableDataTranslatorTest extends BaseTranslatorTest<TableData> {
+
+ public TableDataTranslatorTest(TableData data, ITranslator<TableData> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(TableData expected, TableData actual) throws OseeCoreException {
+ Assert.assertNotSame(expected, actual);
+ DataAsserts.assertEquals(expected, actual);
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ ITranslator<TableData> translator = new TableDataTranslator();
+
+ List<Object[]> data = new ArrayList<Object[]>();
+ String[] columns = new String[] {"col1", "col2"};
+ List<String[]> rows = Arrays.asList(new String[] {"one1", "two2"}, new String[] {"one3", "two4"});
+ data.add(new Object[] {new TableData("title", columns, rows), translator});
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionCacheUpdateResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionCacheUpdateResponseTranslatorTest.java
new file mode 100644
index 00000000000..2f28e64db08
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionCacheUpdateResponseTranslatorTest.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.TransactionCacheUpdateResponse;
+import org.eclipse.osee.framework.core.message.internal.translation.TransactionCacheUpdateResponseTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.message.test.mocks.MockRequestFactory;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link TransactionCacheUpdateResponseTranslator}
+ *
+ * @author Roberto E. Escobar
+ */
+@RunWith(Parameterized.class)
+public class TransactionCacheUpdateResponseTranslatorTest extends BaseTranslatorTest<TransactionCacheUpdateResponse> {
+
+ public TransactionCacheUpdateResponseTranslatorTest(TransactionCacheUpdateResponse data, ITranslator<TransactionCacheUpdateResponse> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(TransactionCacheUpdateResponse expected, TransactionCacheUpdateResponse actual) throws OseeCoreException {
+ Assert.assertNotSame(expected, actual);
+ List<TransactionRecord> expectedRows = expected.getTxRows();
+ List<TransactionRecord> actualRows = actual.getTxRows();
+ Assert.assertEquals(expectedRows.size(), actualRows.size());
+ for (int index = 0; index < expectedRows.size(); index++) {
+ DataAsserts.assertEquals(expectedRows.get(index), actualRows.get(index));
+ }
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ IOseeModelFactoryServiceProvider factoryProvider = MockRequestFactory.createFactoryProvider();
+ ITranslator<TransactionCacheUpdateResponse> translator =
+ new TransactionCacheUpdateResponseTranslator(factoryProvider);
+
+ List<Object[]> data = new ArrayList<Object[]>();
+ for (int index = 1; index <= 2; index++) {
+ List<TransactionRecord> txRecords = new ArrayList<TransactionRecord>();
+ for (int j = 1; j <= index; j++) {
+ txRecords.add(MockDataFactory.createTransaction(j, j * 3));
+ }
+ data.add(new Object[] {new TransactionCacheUpdateResponse(txRecords), translator});
+ }
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java
new file mode 100644
index 00000000000..778bccad89f
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TransactionRecordTranslatorTest.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.message.internal.translation.TransactionRecordTranslator;
+import org.eclipse.osee.framework.core.message.test.mocks.DataAsserts;
+import org.eclipse.osee.framework.core.message.test.mocks.MockRequestFactory;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.junit.Assert;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case For {@link TransactionRecordTranslator}
+ *
+ * @author Roberto E. Escobar
+ */
+@RunWith(Parameterized.class)
+public class TransactionRecordTranslatorTest extends BaseTranslatorTest<TransactionRecord> {
+
+ public TransactionRecordTranslatorTest(TransactionRecord data, ITranslator<TransactionRecord> translator) {
+ super(data, translator);
+ }
+
+ @Override
+ protected void checkEquals(TransactionRecord expected, TransactionRecord actual) throws OseeCoreException {
+ Assert.assertNotSame(expected, actual);
+ DataAsserts.assertEquals(expected, actual);
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ IOseeModelFactoryServiceProvider factoryProvider = MockRequestFactory.createFactoryProvider();
+ ITranslator<TransactionRecord> translator = new TransactionRecordTranslator(factoryProvider);
+ List<Object[]> data = new ArrayList<Object[]>();
+ for (int index = 1; index <= 2; index++) {
+ data.add(new Object[] {MockDataFactory.createTransaction(index * 10, index * 3), translator});
+ }
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TranslationTestSuite.java b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TranslationTestSuite.java
new file mode 100644
index 00000000000..63ba8d18de4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.message.test/src/org/eclipse/osee/framework/core/message/test/translation/TranslationTestSuite.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.message.test.translation;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {//
+BranchCommitRequestTranslatorTest.class, //
+ BranchCommitResponseTranslatorTest.class, //
+ BranchCreationRequestTranslatorTest.class, //
+ BranchCreationResponseTranslatorTest.class, //
+ CacheUpdateRequestTranslatorTest.class, //
+ ChangeItemTranslatorTest.class, //
+ ChangeVersionTranslatorTest.class, //
+ ChangeReportResponseTranslatorTest.class,//
+ DataTranslationServiceFactoryTest.class, //
+ DataTranslationServiceTest.class, //
+ OseeImportModelRequestTranslatorTest.class, //
+ OseeImportModelResponseTranslatorTest.class, //
+ TableDataTranslatorTest.class, //
+ TransactionCacheUpdateResponseTranslatorTest.class, //
+ TransactionRecordTranslatorTest.class, //
+ PurgeBranchRequestTranslatorTest.class, //
+ BranchChangeTypeRequestTranslatorTest.class, //
+ BranchChangeStateRequestTranslatorTest.class, //
+ BranchChangeArchivedStateRequestTranslatorTest.class//
+})
+/**
+ * @author Roberto E. Escobar
+ */
+public class TranslationTestSuite {
+
+}

Back to the top