Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2010-03-12 18:27:25 +0000
committerrescobar2010-03-12 18:27:25 +0000
commit205aa057fa925d37a3a5375aa8418b9567e99c6d (patch)
treed33f80b9f727c479b8031aeb352494c38ad9878d /plugins/org.eclipse.osee.framework.core.test
parent0e6d2b595cfb4d54eccdf3479e7c5d74d9c736a5 (diff)
downloadorg.eclipse.osee-205aa057fa925d37a3a5375aa8418b9567e99c6d.tar.gz
org.eclipse.osee-205aa057fa925d37a3a5375aa8418b9567e99c6d.tar.xz
org.eclipse.osee-205aa057fa925d37a3a5375aa8418b9567e99c6d.zip
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.test')
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/.classpath7
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/.project28
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/.settings/org.eclipse.pde.core.prefs5
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/META-INF/MANIFEST.MF14
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/build.properties4
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/FrameworkCoreTestSuite.java36
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/AbstractOseeCacheTest.java274
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/ArtifactTypeCacheTest.java70
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/AttributeTypeCacheTest.java70
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/BranchCacheTest.java71
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/CacheTestSuite.java30
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/ModelAsserts.java302
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/OseeEnumTypeCacheTest.java82
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/RelationTypeCacheTest.java70
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/BranchCommitRequestTest.java80
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/BranchCommitResponseTest.java58
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/CacheUpdateRequestTest.java41
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/ChangeItemTest.java100
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/ChangeTestUtility.java68
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/ChangeVersionTest.java100
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/DataTestSuite.java33
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/PurgeBranchRequestTest.java55
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/TransactionCacheUpdateResponseTest.java60
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/TransactionRecordTest.java161
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/ArtifactSuperTypeFieldTest.java99
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/ArtifactTypeAttributesFieldTest.java106
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/AssociatedArtifactFieldTest.java50
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/BaseOseeFieldTest.java119
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/BranchAliasesFieldTest.java56
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/CollectionFieldTest.java77
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/EnumEntryFieldTest.java150
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/FieldGetSetTestData.java58
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/FieldTestSuite.java32
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/FieldTestUtil.java37
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/OseeFieldMainTest.java118
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/OseeFieldTestData.java58
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/UniqueIdFieldTest.java51
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockAbstractOseeType.java23
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockChangeItem.java29
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockDataFactory.java211
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockOseeCachingServiceProvider.java31
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockOseeDataAccessor.java56
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockOseeModelFactoryServiceProvider.java33
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockOseeTransactionDataAccessor.java75
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/AbstractOseeTypeTest.java124
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/ArtifactTypeTest.java312
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/AttributeTypeTest.java51
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/BaseOseeTypeTest.java43
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/BranchTest.java331
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/ModelTestSuite.java30
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/OseeEnumTypeTest.java47
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/RelationTypeTest.java124
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BaseTranslatorTest.java43
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchChangeArchivedStateRequestTranslatorTest.java53
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchChangeStateRequestTranslatorTest.java52
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchChangeTypeRequestTranslatorTest.java53
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchCommitRequestTranslatorTest.java53
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchCommitResponseTranslatorTest.java67
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchCreationRequestTranslatorTest.java52
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchCreationResponseTranslatorTest.java52
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/CacheUpdateRequestTranslatorTest.java58
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeItemTranslatorTest.java61
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeReportResponseTranslatorTest.java72
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeVersionTranslatorTest.java54
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/DataAsserts.java282
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/DataTranslationServiceFactoryTest.java101
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/DataTranslationServiceTest.java213
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/OseeImportModelRequestTranslatorTest.java52
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/OseeImportModelResponseTranslatorTest.java69
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/PurgeBranchRequestTranslatorTest.java52
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/TableDataTranslatorTest.java54
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/TransactionCacheUpdateResponseTranslatorTest.java67
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/TransactionRecordTranslatorTest.java55
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/TranslationTestSuite.java43
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/ChangeItemUtilTest.java363
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/CompareTest.java92
-rw-r--r--plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/UtilTestSuite.java27
78 files changed, 6498 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.test/.classpath b/plugins/org.eclipse.osee.framework.core.test/.classpath
new file mode 100644
index 00000000000..8a8f1668cdc
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.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.test/.project b/plugins/org.eclipse.osee.framework.core.test/.project
new file mode 100644
index 00000000000..1032294b52e
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.framework.core.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.test/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.osee.framework.core.test/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..a56ff1afe60
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Tue Nov 10 09:31:00 MST 2009
+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.test/.settings/org.eclipse.pde.core.prefs b/plugins/org.eclipse.osee.framework.core.test/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 00000000000..3b969cca462
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,5 @@
+#Tue Nov 10 09:31:00 MST 2009
+eclipse.preferences.version=1
+pluginProject.equinox=false
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/plugins/org.eclipse.osee.framework.core.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.core.test/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..4400c0aee71
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Framework Core Test
+Bundle-SymbolicName: org.eclipse.osee.framework.core.test;singleton:=true
+Bundle-Version: 0.9.2.qualifier
+Bundle-Vendor: Eclipse.org
+Fragment-Host: org.eclipse.osee.framework.core;bundle-version="0.8.3"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.junit4;bundle-version="4.5.0"
+Export-Package: org.eclipse.osee.framework.core.test,
+ org.eclipse.osee.framework.core.test.cache,
+ org.eclipse.osee.framework.core.test.data,
+ org.eclipse.osee.framework.core.test.mocks
+Import-Package: org.eclipse.osee.framework.jdk.core.util
diff --git a/plugins/org.eclipse.osee.framework.core.test/build.properties b/plugins/org.eclipse.osee.framework.core.test/build.properties
new file mode 100644
index 00000000000..41eb6ade2b4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/FrameworkCoreTestSuite.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/FrameworkCoreTestSuite.java
new file mode 100644
index 00000000000..00a7ea113e3
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/FrameworkCoreTestSuite.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.test;
+
+import org.eclipse.osee.framework.core.test.cache.CacheTestSuite;
+import org.eclipse.osee.framework.core.test.data.DataTestSuite;
+import org.eclipse.osee.framework.core.test.fields.FieldTestSuite;
+import org.eclipse.osee.framework.core.test.model.ModelTestSuite;
+import org.eclipse.osee.framework.core.test.translation.TranslationTestSuite;
+import org.eclipse.osee.framework.core.test.util.UtilTestSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {//
+CacheTestSuite.class, //
+ DataTestSuite.class, //
+ TranslationTestSuite.class, //
+ FieldTestSuite.class, //
+ ModelTestSuite.class, //
+ UtilTestSuite.class, //
+})
+/**
+ * @author Roberto E. Escobar
+ */
+public class FrameworkCoreTestSuite {
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/AbstractOseeCacheTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/AbstractOseeCacheTest.java
new file mode 100644
index 00000000000..b52a44dcc5f
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/AbstractOseeCacheTest.java
@@ -0,0 +1,274 @@
+/*******************************************************************************
+ * 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.test.cache;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.cache.AbstractOseeCache;
+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.exception.OseeTypeDoesNotExist;
+import org.eclipse.osee.framework.core.model.AbstractOseeType;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Test Case for {@link AbstractOseeCache}
+ *
+ * @author Roberto E. Escobar
+ */
+public abstract class AbstractOseeCacheTest<T extends AbstractOseeType> {
+ private final List<T> data;
+ private final AbstractOseeCache<T> cache;
+ private final TypeComparator comparator;
+
+ public AbstractOseeCacheTest(List<T> artifactTypes, AbstractOseeCache<T> typeCache) {
+ this.comparator = new TypeComparator();
+ this.data = artifactTypes;
+ this.cache = typeCache;
+ }
+
+ @org.junit.Test
+ public void testAllItems() throws OseeCoreException {
+ List<T> actualTypes = new ArrayList<T>(cache.getAll());
+ java.util.Collections.sort(actualTypes, comparator);
+
+ java.util.Collections.sort(data, comparator);
+ Assert.assertEquals(data.size(), actualTypes.size());
+ for (int index = 0; index < data.size(); index++) {
+ Assert.assertNotNull(actualTypes.get(index));
+ checkEquals(data.get(index), actualTypes.get(index));
+ }
+ }
+
+ @org.junit.Test
+ public void testExistByGuid() throws OseeCoreException {
+ for (T expected : data) {
+ Assert.assertTrue(cache.existsByGuid(expected.getGuid()));
+ }
+ Assert.assertFalse(cache.existsByGuid("notExist"));
+ }
+
+ @org.junit.Test
+ public void testCacheByGuid() throws OseeCoreException {
+ for (T expected : data) {
+ T actual = cache.getByGuid(expected.getGuid());
+ Assert.assertNotNull(actual);
+ checkEquals(expected, actual);
+ }
+ }
+
+ @org.junit.Test
+ public void testCacheById() throws OseeCoreException {
+ for (T expected : data) {
+ T actual = cache.getById(expected.getId());
+ Assert.assertNotNull(actual);
+ checkEquals(expected, actual);
+ }
+ }
+
+ @org.junit.Test
+ public void testCacheByName() throws OseeCoreException {
+ for (T expected : data) {
+ T actual = cache.getUniqueByName(expected.getName());
+ Assert.assertNotNull(actual);
+ checkEquals(expected, actual);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @org.junit.Test
+ public void testDecache() throws OseeCoreException {
+ T item1 = data.get(0);
+ checkCached(item1, true);
+
+ cache.decache(item1);
+ checkCached(item1, false);
+
+ cache.cache(item1);
+ checkCached(item1, true);
+
+ T item2 = data.get(1);
+ checkCached(item2, true);
+
+ cache.decache(item1, item2);
+ checkCached(item1, false);
+ checkCached(item2, false);
+
+ cache.cache(item1, item2);
+ checkCached(item1, true);
+ checkCached(item2, true);
+ }
+
+ private void checkCached(T item, boolean isInCacheExpected) throws OseeCoreException {
+ if (isInCacheExpected) {
+ Assert.assertEquals(item, cache.getByGuid(item.getGuid()));
+ Assert.assertEquals(item, cache.getById(item.getId()));
+ Assert.assertEquals(item, cache.getUniqueByName(item.getName()));
+ Assert.assertTrue(cache.getAll().contains(item));
+ } else {
+ Assert.assertNull(cache.getByGuid(item.getGuid()));
+ Assert.assertNull(cache.getById(item.getId()));
+ Assert.assertNull(cache.getUniqueByName(item.getName()));
+ Assert.assertFalse(cache.getAll().contains(item));
+ }
+ }
+
+ @org.junit.Test
+ public void testGetByName() throws OseeCoreException {
+ for (T expected : data) {
+ Collection<T> actual = cache.getByName(expected.getName());
+ Assert.assertNotNull(actual);
+ Assert.assertEquals(1, actual.size());
+ checkEquals(expected, actual.iterator().next());
+ }
+ }
+
+ @org.junit.Test
+ public void testMultipleGetByName() throws OseeCoreException {
+ T item1 = data.get(0);
+ T item2 = data.get(1);
+ Assert.assertNotNull(item1);
+ Assert.assertNotNull(item2);
+
+ Collection<T> actual = cache.getByName(item1.getName());
+ Assert.assertNotNull(actual);
+ Assert.assertEquals(1, actual.size());
+ checkEquals(item1, actual.iterator().next());
+
+ actual = cache.getByName(item2.getName());
+ Assert.assertNotNull(actual);
+ Assert.assertEquals(1, actual.size());
+ checkEquals(item2, actual.iterator().next());
+
+ String originalName = item1.getName();
+ if (item1 instanceof AbstractOseeType) {
+ cache.decache(item1);
+
+ ((AbstractOseeType) item1).setName(item2.getName());
+
+ if (cache.isNameUniquenessEnforced()) {
+ try {
+ cache.cache(item1);
+ Assert.fail("This line should not be executed");
+ } catch (OseeCoreException ex) {
+ Assert.assertTrue(ex instanceof OseeStateException);
+ }
+
+ actual = cache.getByName(originalName);
+ Assert.assertNotNull(actual);
+ Assert.assertEquals(0, actual.size());
+
+ } else {
+ cache.cache(item1);
+
+ actual = cache.getByName(originalName);
+ Assert.assertNotNull(actual);
+ Assert.assertEquals(0, actual.size());
+
+ actual = cache.getByName(item2.getName());
+ Assert.assertNotNull(actual);
+ Assert.assertEquals(2, actual.size());
+
+ checkEquals(item2, actual.iterator().next());
+ }
+ ((AbstractOseeType) item1).setName(originalName);
+ }
+ }
+
+ @Test
+ public void testReload() throws OseeCoreException {
+ int fullCacheSize = cache.size();
+ Assert.assertTrue(fullCacheSize > 0);
+ for (T type : cache.getAll()) {
+ cache.decache(type);
+ }
+ Assert.assertEquals(0, cache.size());
+ cache.reloadCache();
+ Assert.assertEquals(fullCacheSize, cache.size());
+ }
+
+ @Test(expected = OseeTypeDoesNotExist.class)
+ public void testNonExistingPersist() throws OseeCoreException {
+ cache.storeByGuid(Collections.singleton(GUID.create()));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test(expected = OseeArgumentException.class)
+ public void testStoreNull2() throws OseeCoreException {
+ cache.storeItems((T) null);
+ }
+
+ @Test(expected = OseeArgumentException.class)
+ public void testStoreNull3() throws OseeCoreException {
+ cache.storeItems((Collection<T>) null);
+ }
+
+ @Ignore
+ @Test
+ public void testPersist() throws OseeCoreException {
+ // T item1 = data.get(0);
+ // T item2 = data.get(1);
+ //
+ // String name1 = item1.getName();
+ // String name2 = item2.getName();
+ //
+ // AbstractOseeType t1 = (AbstractOseeType) item1;
+ // AbstractOseeType t2 = (AbstractOseeType) item2;
+ //
+ // t1.setName("changed_1");
+ // t2.setName("changed_2");
+ //
+ // cache.storeByGuid(guids);
+
+ // T item2 = data.get(1);
+ //
+ //
+ // cache.storeItem(item);
+ // cache.storeItems(toStore);
+ // cache.storeItems(items);
+ // public void storeItem(AbstractOseeType item) throws OseeCoreException {
+
+ // public void storeItems(T... items) throws OseeCoreException {
+
+ // public void storeItems(Collection<T> toStore) throws OseeCoreException {
+ }
+
+ protected void checkEquals(T expected, T actual) throws OseeCoreException {
+ Assert.assertEquals(expected, actual);
+ }
+
+ private final class TypeComparator implements Comparator<T> {
+
+ /*
+ * (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public int compare(T o1, T o2) {
+ int result = -1;
+ if (o1 == null && o2 == null) {
+ result = 0;
+ } else if (o1 != null && o2 != null) {
+ result = o1.getName().compareTo(o2.getName());
+ } else if (o2 == null) {
+ result = 1;
+ }
+ return result;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/ArtifactTypeCacheTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/ArtifactTypeCacheTest.java
new file mode 100644
index 00000000000..f34da12ac70
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/ArtifactTypeCacheTest.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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.test.cache;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.framework.core.cache.ArtifactTypeCache;
+import org.eclipse.osee.framework.core.cache.IOseeCache;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.ArtifactType;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.test.mocks.MockOseeDataAccessor;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
+/**
+ * Test Case for {@link ArtifactTypeCache}
+ *
+ * @author Roberto E. Escobar
+ */
+public class ArtifactTypeCacheTest extends AbstractOseeCacheTest<ArtifactType> {
+
+ private static List<ArtifactType> artifactTypes;
+ private static ArtifactTypeCache artCache;
+
+ @BeforeClass
+ public static void prepareTestData() throws OseeCoreException {
+ artifactTypes = new ArrayList<ArtifactType>();
+
+ ArtifactDataAccessor artData = new ArtifactDataAccessor(artifactTypes);
+ artCache = new ArtifactTypeCache(artData);
+
+ artCache.ensurePopulated();
+ Assert.assertTrue(artData.wasLoaded());
+ }
+
+ public ArtifactTypeCacheTest() {
+ super(artifactTypes, artCache);
+ }
+
+ private final static class ArtifactDataAccessor extends MockOseeDataAccessor<ArtifactType> {
+ private final List<ArtifactType> artifactTypes;
+
+ public ArtifactDataAccessor(List<ArtifactType> artifactTypes) {
+ super();
+ this.artifactTypes = artifactTypes;
+ }
+
+ @Override
+ public void load(IOseeCache<ArtifactType> cache) throws OseeCoreException {
+ super.load(cache);
+
+ int typeId = 100;
+ for (int index = 0; index < 10; index++) {
+ ArtifactType item = MockDataFactory.createArtifactType(index);
+ artifactTypes.add(item);
+ item.setId(typeId++);
+ cache.cache(item);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/AttributeTypeCacheTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/AttributeTypeCacheTest.java
new file mode 100644
index 00000000000..e67c86a776e
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/AttributeTypeCacheTest.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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.test.cache;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.framework.core.cache.AttributeTypeCache;
+import org.eclipse.osee.framework.core.cache.IOseeCache;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.AttributeType;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.test.mocks.MockOseeDataAccessor;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
+/**
+ * Test Case for {@link AttributeTypeCache}
+ *
+ * @author Roberto E. Escobar
+ */
+public class AttributeTypeCacheTest extends AbstractOseeCacheTest<AttributeType> {
+
+ private static List<AttributeType> attributeTypes;
+ private static AttributeTypeCache attrCache;
+
+ @BeforeClass
+ public static void prepareTestData() throws OseeCoreException {
+ attributeTypes = new ArrayList<AttributeType>();
+
+ AttributeDataAccessor attrData = new AttributeDataAccessor(attributeTypes);
+ attrCache = new AttributeTypeCache(attrData);
+
+ attrCache.ensurePopulated();
+ Assert.assertTrue(attrData.wasLoaded());
+ }
+
+ public AttributeTypeCacheTest() {
+ super(attributeTypes, attrCache);
+ }
+
+ private final static class AttributeDataAccessor extends MockOseeDataAccessor<AttributeType> {
+
+ private final List<AttributeType> attributeTypes;
+
+ public AttributeDataAccessor(List<AttributeType> attributeTypes) {
+ super();
+ this.attributeTypes = attributeTypes;
+ }
+
+ @Override
+ public void load(IOseeCache<AttributeType> cache) throws OseeCoreException {
+ super.load(cache);
+ int typeId = 100;
+ for (int index = 0; index < 10; index++) {
+ AttributeType item = MockDataFactory.createAttributeType(index, null);
+ attributeTypes.add(item);
+ item.setId(typeId++);
+ cache.cache(item);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/BranchCacheTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/BranchCacheTest.java
new file mode 100644
index 00000000000..ca08778c631
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/BranchCacheTest.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * 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.test.cache;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.framework.core.cache.BranchCache;
+import org.eclipse.osee.framework.core.cache.IOseeCache;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.test.mocks.MockOseeDataAccessor;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
+/**
+ * Test Case for {@link BranchCache}
+ *
+ * @author Roberto E. Escobar
+ */
+public class BranchCacheTest extends AbstractOseeCacheTest<Branch> {
+
+ private static List<Branch> branchData;
+ private static BranchCache cache;
+
+ @BeforeClass
+ public static void prepareTestData() throws OseeCoreException {
+ branchData = new ArrayList<Branch>();
+
+ BranchDataAccessor branchAccessor = new BranchDataAccessor(branchData);
+ cache = new BranchCache(branchAccessor);
+ cache.ensurePopulated();
+
+ Assert.assertTrue(branchAccessor.wasLoaded());
+
+ }
+
+ public BranchCacheTest() {
+ super(branchData, cache);
+ }
+
+ private final static class BranchDataAccessor extends MockOseeDataAccessor<Branch> {
+
+ private final List<Branch> data;
+
+ public BranchDataAccessor(List<Branch> data) {
+ super();
+ this.data = data;
+ }
+
+ @Override
+ public void load(IOseeCache<Branch> cache) throws OseeCoreException {
+ super.load(cache);
+ int typeId = 100;
+ for (int index = 0; index < 10; index++) {
+ Branch item = MockDataFactory.createBranch(index);
+ data.add(item);
+ item.setId(typeId++);
+ cache.cache(item);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/CacheTestSuite.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/CacheTestSuite.java
new file mode 100644
index 00000000000..8126dc12e53
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/CacheTestSuite.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.test.cache;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {//
+
+ArtifactTypeCacheTest.class, //
+ AttributeTypeCacheTest.class, //
+ RelationTypeCacheTest.class, //
+ OseeEnumTypeCacheTest.class, //
+ BranchCacheTest.class //
+})
+/**
+ * @author Roberto E. Escobar
+ */
+public class CacheTestSuite {
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/ModelAsserts.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/ModelAsserts.java
new file mode 100644
index 00000000000..4190bf4b634
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/ModelAsserts.java
@@ -0,0 +1,302 @@
+/*******************************************************************************
+ * 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.test.cache;
+
+import static org.junit.Assert.assertEquals;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.cache.AbstractOseeCache;
+import org.eclipse.osee.framework.core.cache.BranchCache;
+import org.eclipse.osee.framework.core.cache.IOseeTypeFactory;
+import org.eclipse.osee.framework.core.enums.BranchState;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.enums.RelationSide;
+import org.eclipse.osee.framework.core.enums.RelationTypeMultiplicity;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.ArtifactType;
+import org.eclipse.osee.framework.core.model.AttributeType;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.MergeBranch;
+import org.eclipse.osee.framework.core.model.OseeEnumEntry;
+import org.eclipse.osee.framework.core.model.OseeEnumType;
+import org.eclipse.osee.framework.core.model.RelationType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ModelAsserts {
+
+ private ModelAsserts() {
+
+ }
+
+ public static void createAlias(BranchCache cache, String branchGuid, String... aliases) throws OseeCoreException {
+ Branch branch = cache.getByGuid(branchGuid);
+ Assert.assertNotNull(branch);
+ // cache.setAliases(branch, Arrays.asList(aliases));
+ }
+
+ public static void checkMergeBranch(BranchCache cache, String expectedMergeBranchGuid, String sourceBranchGuid, String destinationBranchGuid) throws OseeCoreException {
+ Branch sourceBranch = cache.getByGuid(sourceBranchGuid);
+ Assert.assertNotNull(sourceBranch);
+ Branch destionationBranch = cache.getByGuid(destinationBranchGuid);
+ Assert.assertNotNull(destionationBranch);
+
+ Branch actualMergeBranch = cache.findMergeBranch(sourceBranch, destionationBranch);
+ if (expectedMergeBranchGuid == null) {
+ Assert.assertNull(actualMergeBranch);
+ } else {
+ Branch mergeBranch = cache.getByGuid(expectedMergeBranchGuid);
+ Assert.assertNotNull(mergeBranch);
+ Assert.assertEquals(mergeBranch, actualMergeBranch);
+ }
+ }
+
+ public static void createMergeBranch(BranchCache cache, String mergeBranchGuid, String sourceBranchGuid, String destinationBranchGuid) throws OseeCoreException {
+ Branch mergeBranch = cache.getByGuid(mergeBranchGuid);
+ Assert.assertNotNull(mergeBranch);
+ Branch sourceBranch = cache.getByGuid(sourceBranchGuid);
+ Assert.assertNotNull(sourceBranch);
+ Branch destionationBranch = cache.getByGuid(destinationBranchGuid);
+ Assert.assertNotNull(destionationBranch);
+ Assert.assertTrue(mergeBranch instanceof MergeBranch);
+ MergeBranch mBranch = (MergeBranch) mergeBranch;
+ mBranch.setSourceBranch(sourceBranch);
+ mBranch.setDestinationBranch(destionationBranch);
+ }
+
+ public static void checkHierarchy(BranchCache cache, String parentGuid, String... expected) throws OseeCoreException {
+ Branch parentBranch = cache.getByGuid(parentGuid);
+ Assert.assertNotNull(parentBranch);
+ Collection<Branch> children = parentBranch.getChildren();
+ Assert.assertEquals(expected.length, children.size());
+ int index = 0;
+ for (Branch child : children) {
+ Branch expectedBranch = cache.getByGuid(expected[index]);
+ Assert.assertNotNull(expectedBranch);
+ Assert.assertEquals(expectedBranch, child);
+ Assert.assertEquals(parentBranch, child.getParentBranch());
+ index++;
+ }
+ }
+
+ public static void createBranchHierarchy(BranchCache cache, String parentGuid, String... childrenGuids) throws OseeCoreException {
+ Branch parentBranch = cache.getByGuid(parentGuid);
+ Assert.assertNotNull(parentBranch);
+ Assert.assertNotNull(childrenGuids);
+ Assert.assertTrue(childrenGuids.length > 0);
+ for (String childGuid : childrenGuids) {
+ Branch childBranch = cache.getByGuid(childGuid);
+ Assert.assertNotNull(childBranch);
+ childBranch.setParentBranch(parentBranch);
+ }
+ }
+
+ public static RelationType createRelationType(AbstractOseeCache<ArtifactType> artCache, String guid, String name, String aGUID, String bGUID, RelationTypeMultiplicity multiplicity) throws OseeCoreException {
+ ArtifactType type1 = artCache.getByGuid(aGUID);
+ ArtifactType type2 = artCache.getByGuid(bGUID);
+ RelationType relationType =
+ new RelationType(guid, name, name + "_A", name + "_B", type1, type2, multiplicity, "");
+ Assert.assertNotNull(relationType);
+ return relationType;
+ }
+
+ public static Branch createBranch(String guid, String name, BranchType branchType, BranchState branchState, boolean isArchived) throws OseeCoreException {
+ Branch branch;
+ if (branchType.isMergeBranch()) {
+ branch = new MergeBranch(guid, name, branchType, branchState, isArchived);
+ } else {
+ branch = new Branch(guid, name, branchType, branchState, isArchived);
+ }
+ Assert.assertNotNull(branch);
+ return branch;
+ }
+
+ public static AttributeType createAttributeType(String guid, String name) throws OseeCoreException {
+ AttributeType attributeType =
+ new AttributeType(guid, name, "DummyBase", "DummyProvider", "none", "none", 1, 1, "test data", null);
+ Assert.assertNotNull(attributeType);
+ return attributeType;
+ }
+
+ public static void checkOseeEnumEntries(OseeEnumEntry[] actual, Object... entries) {
+ Assert.assertEquals(entries.length / 2, actual.length);
+ int index2 = 0;
+ for (int index = 0; index < entries.length; index++, index2++) {
+ String itemName = (String) entries[index];
+ Integer ordinal = (Integer) entries[++index];
+
+ Assert.assertEquals(itemName, actual[index2].getName());
+ Assert.assertEquals((int) ordinal, actual[index2].ordinal());
+ }
+ }
+
+ public static OseeEnumType createEnumType(IOseeTypeFactory factory, String guid, String name, Object... entries) throws OseeCoreException {
+ OseeEnumType type = new OseeEnumType(guid, name);
+ if (entries != null && entries.length > 0) {
+ List<OseeEnumEntry> items = new ArrayList<OseeEnumEntry>();
+ for (int index = 0; index < entries.length; index++) {
+ String itemName = (String) entries[index];
+ Integer ordinal = (Integer) entries[++index];
+ items.add(new OseeEnumEntry(null, itemName, ordinal));
+ }
+ type.setEntries(items);
+ }
+ return type;
+ }
+
+ public static void checkEnumType(String expectedName, String[] expectedEntries, Integer[] expectedOrdinals, OseeEnumType actualEnumType) throws OseeCoreException {
+ assertEquals(expectedName, actualEnumType.getName());
+ OseeEnumEntry[] enumEntries = actualEnumType.values();
+ assertEquals(expectedEntries.length, enumEntries.length);
+ for (int index = 0; index < expectedEntries.length && index < expectedOrdinals.length; index++) {
+ checkEnumEntry(expectedEntries[index], expectedOrdinals[index], actualEnumType, enumEntries[index]);
+ }
+ }
+
+ public static void checkEnumEntry(String expectedName, int expectedOrdinal, OseeEnumType parent, OseeEnumEntry entry) throws OseeCoreException {
+ assertEquals(expectedName, entry.getName());
+ assertEquals(expectedOrdinal, entry.ordinal());
+ // assertEquals(parent, entry.getDeclaringClass());
+ assertEquals(parent.getId(), entry.getId());
+ assertEquals(parent.getName(), entry.getName());
+ // OseeEnumEntry[] expected = parent.values();
+ // // OseeEnumEntry[] actual = entry.getDeclaringClass().values();
+ // assertEquals(expected.length, actual.length);
+ // for (int index = 0; index < expected.length; index++) {
+ // assertEquals(expected[index], actual[index]);
+ // }
+ }
+
+ public static void checkEnumType(OseeEnumType expected, OseeEnumType actual) throws OseeCoreException {
+ OseeEnumEntry[] expectedValues = expected.values();
+ OseeEnumEntry[] actualValues = actual.values();
+ Assert.assertEquals(expectedValues.length, actualValues.length);
+
+ for (int index = 0; index < expectedValues.length; index++) {
+ checkEnumEntry(expectedValues[index], actualValues[index]);
+ }
+ }
+
+ public static void checkEnumEntry(OseeEnumEntry expected, OseeEnumEntry actual) throws OseeCoreException {
+ Assert.assertEquals(expected.getName(), actual.getName());
+ Assert.assertEquals(expected.ordinal(), actual.ordinal());
+ // Assert.assertEquals(expected.getDeclaringClass(), actual.getDeclaringClass());
+ Assert.assertEquals(expected.getGuid(), actual.getGuid());
+ }
+
+ public static void checkInheritance(AbstractOseeCache<ArtifactType> artCache, String artTypeGuid, String... superTypeGuids) throws OseeCoreException {
+ ArtifactType target = artCache.getByGuid(artTypeGuid);
+ Assert.assertNotNull(target);
+
+ List<ArtifactType> expectedSuperTypes = new ArrayList<ArtifactType>();
+ for (String superTyperGuid : superTypeGuids) {
+ ArtifactType superArtifactType = artCache.getByGuid(superTyperGuid);
+ Assert.assertNotNull(superArtifactType);
+ expectedSuperTypes.add(superArtifactType);
+ }
+
+ for (ArtifactType testAgainstType : artCache.getAll()) {
+ boolean result = target.inheritsFrom(testAgainstType);
+ if (expectedSuperTypes.contains(testAgainstType) || target.equals(testAgainstType)) {
+ Assert.assertTrue(String.format("[%s] does not inherit from [%s]", target.getName(),
+ testAgainstType.getName()), result);
+ } else {
+ Assert.assertFalse(String.format("[%s] should not inherit from [%s]", target.getName(),
+ testAgainstType.getName()), result);
+ }
+ }
+ }
+
+ public static void checkDescendants(AbstractOseeCache<ArtifactType> artCache, String artTypeGuid, boolean isAllLevels, String... descendantGuids) throws OseeCoreException {
+ ArtifactType target = artCache.getByGuid(artTypeGuid);
+ Assert.assertNotNull(target);
+
+ List<ArtifactType> expectedDescendants = new ArrayList<ArtifactType>();
+ for (String type : descendantGuids) {
+ ArtifactType childType = artCache.getByGuid(type);
+ Assert.assertNotNull(childType);
+ expectedDescendants.add(childType);
+ }
+
+ Collection<ArtifactType> descendants =
+ isAllLevels ? target.getAllDescendantTypes() : target.getFirstLevelDescendantTypes();
+
+ Assert.assertEquals(expectedDescendants.size(), descendants.size());
+ for (ArtifactType child : descendants) {
+ boolean result = expectedDescendants.contains(target);
+ if (result) {
+ Assert.assertTrue(String.format("[%s] inherits from [%s]", child.getName(), target.getName()), result);
+ } else {
+ Assert.assertFalse(String.format("[%s] does not inherit from [%s]", child.getName(), target.getName()),
+ result);
+ }
+ if (target.hasSuperArtifactTypes()) {
+ Assert.assertEquals(true, child.inheritsFrom(target));
+ }
+ }
+ }
+
+ public static void checkAttributes(AbstractOseeCache<ArtifactType> artCache, AbstractOseeCache<AttributeType> attrCache, String artTypeGuid, Branch branch, String... attributeGuids) throws OseeCoreException {
+ ArtifactType artifactType = artCache.getByGuid(artTypeGuid);
+ Assert.assertNotNull(artifactType);
+
+ List<AttributeType> expectedAttributes = new ArrayList<AttributeType>();
+ for (String attrGuid : attributeGuids) {
+ AttributeType attributeType = attrCache.getByGuid(attrGuid);
+ Assert.assertNotNull(attributeType);
+ expectedAttributes.add(attributeType);
+ }
+
+ Collection<AttributeType> actualTypes = artifactType.getAttributeTypes(branch);
+ Assert.assertEquals(String.format("ArtifactType [%s] - incorrect number of attributes actual - %s expected - %s",
+ artTypeGuid, actualTypes, expectedAttributes), expectedAttributes.size(), actualTypes.size());
+
+ Collection<AttributeType> typesNotFound =
+ org.eclipse.osee.framework.jdk.core.util.Collections.setComplement(expectedAttributes, actualTypes);
+ Assert.assertTrue(String.format("Artifact [%s] for branch [%s] did not have the following attributes [%s]",
+ artifactType.getName(), branch.getName(), typesNotFound), typesNotFound.isEmpty());
+
+ typesNotFound =
+ org.eclipse.osee.framework.jdk.core.util.Collections.setComplement(actualTypes, expectedAttributes);
+ Assert.assertTrue(String.format("Artifact [%s] for branch [%s] the following additional attributes [%s]",
+ artifactType.getName(), branch.getName(), typesNotFound), typesNotFound.isEmpty());
+ }
+
+ public static void checkRelationTypeInheritance(AbstractOseeCache<RelationType> cache, AbstractOseeCache<ArtifactType> artCache, String relGuid, RelationSide relationSide, int maxValue, String... artifactTypesAllowed) throws OseeCoreException {
+ RelationType relationType = cache.getByGuid(relGuid);
+ Assert.assertNotNull(relationType);
+
+ Assert.assertEquals(maxValue, relationType.getMultiplicity().getLimit(relationSide));
+ Assert.assertEquals(maxValue == Integer.MAX_VALUE ? "n" : "1", relationType.getMultiplicity().asLimitLabel(
+ relationSide));
+
+ List<ArtifactType> allowedTypes = new ArrayList<ArtifactType>();
+ for (String guid : artifactTypesAllowed) {
+ ArtifactType type = artCache.getByGuid(guid);
+ Assert.assertNotNull(type);
+ allowedTypes.add(type);
+ }
+
+ for (ArtifactType artifactType : artCache.getAll()) {
+ boolean result = relationType.isArtifactTypeAllowed(relationSide, artifactType);
+ if (allowedTypes.contains(artifactType)) {
+ Assert.assertTrue(String.format("ArtifactType [%s] was not allowed", artifactType), result);
+ } else {
+ Assert.assertFalse(String.format("ArtifactType [%s] was allowed even though it should not have been",
+ artifactType), result);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/OseeEnumTypeCacheTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/OseeEnumTypeCacheTest.java
new file mode 100644
index 00000000000..cd1a56456f3
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/OseeEnumTypeCacheTest.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * 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.test.cache;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.framework.core.cache.IOseeCache;
+import org.eclipse.osee.framework.core.cache.OseeEnumTypeCache;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.OseeEnumEntry;
+import org.eclipse.osee.framework.core.model.OseeEnumType;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.test.mocks.MockOseeDataAccessor;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
+/**
+ * Test Case for {@link OseeEnumTypeCache}
+ *
+ * @author Roberto E. Escobar
+ */
+public class OseeEnumTypeCacheTest extends AbstractOseeCacheTest<OseeEnumType> {
+
+ private static List<OseeEnumType> data;
+ private static OseeEnumTypeCache cache;
+
+ @BeforeClass
+ public static void prepareTestData() throws OseeCoreException {
+ data = new ArrayList<OseeEnumType>();
+
+ EnumDataAccessor enumAccessor = new EnumDataAccessor(data);
+ cache = new OseeEnumTypeCache(enumAccessor);
+
+ cache.ensurePopulated();
+ Assert.assertTrue(enumAccessor.wasLoaded());
+ }
+
+ public OseeEnumTypeCacheTest() {
+ super(data, cache);
+ }
+
+ @Override
+ protected void checkEquals(OseeEnumType expected, OseeEnumType actual) throws OseeCoreException {
+ ModelAsserts.checkEnumType(expected, actual);
+ }
+
+ private final static class EnumDataAccessor extends MockOseeDataAccessor<OseeEnumType> {
+ private final List<OseeEnumType> oseeEnumTypes;
+
+ public EnumDataAccessor(List<OseeEnumType> oseeEnumTypes) {
+ super();
+ this.oseeEnumTypes = oseeEnumTypes;
+ }
+
+ @Override
+ public void load(IOseeCache<OseeEnumType> cache) throws OseeCoreException {
+ super.load(cache);
+ int typeId = 100;
+ for (int index = 0; index < 10; index++) {
+ OseeEnumType item = MockDataFactory.createEnumType(index);
+ List<OseeEnumEntry> entries = new ArrayList<OseeEnumEntry>();
+ for (int j = 1; j <= 5; j++) {
+ OseeEnumEntry enumEntry = MockDataFactory.createEnumEntry(index + j);
+ entries.add(enumEntry);
+ }
+ item.setEntries(entries);
+
+ oseeEnumTypes.add(item);
+ item.setId(typeId++);
+ cache.cache(item);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/RelationTypeCacheTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/RelationTypeCacheTest.java
new file mode 100644
index 00000000000..b92968d5a0d
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/cache/RelationTypeCacheTest.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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.test.cache;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.framework.core.cache.IOseeCache;
+import org.eclipse.osee.framework.core.cache.RelationTypeCache;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.RelationType;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.test.mocks.MockOseeDataAccessor;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+
+/**
+ * Test Case for {@link RelationTypeCache}
+ *
+ * @author Roberto E. Escobar
+ */
+public class RelationTypeCacheTest extends AbstractOseeCacheTest<RelationType> {
+
+ private static List<RelationType> data;
+ private static RelationTypeCache cache;
+
+ @BeforeClass
+ public static void prepareTestData() throws OseeCoreException {
+ data = new ArrayList<RelationType>();
+
+ RelationDataAccessor relationAccessor = new RelationDataAccessor(data);
+ cache = new RelationTypeCache(relationAccessor);
+
+ cache.ensurePopulated();
+ Assert.assertTrue(relationAccessor.wasLoaded());
+ }
+
+ public RelationTypeCacheTest() {
+ super(data, cache);
+ }
+
+ private final static class RelationDataAccessor extends MockOseeDataAccessor<RelationType> {
+ private final List<RelationType> relationTypes;
+
+ public RelationDataAccessor(List<RelationType> relationTypes) {
+ super();
+ this.relationTypes = relationTypes;
+ }
+
+ @Override
+ public void load(IOseeCache<RelationType> cache) throws OseeCoreException {
+ super.load(cache);
+ int typeId = 100;
+ for (int index = 0; index < 10; index++) {
+ RelationType item = MockDataFactory.createRelationType(index, null, null);
+ relationTypes.add(item);
+ item.setId(typeId++);
+ cache.cache(item);
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/BranchCommitRequestTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/BranchCommitRequestTest.java
new file mode 100644
index 00000000000..8654e5b303f
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/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.test.data;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.data.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.test/src/org/eclipse/osee/framework/core/test/data/BranchCommitResponseTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/BranchCommitResponseTest.java
new file mode 100644
index 00000000000..4e273db72a4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/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.test.data;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.data.BranchCommitResponse;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.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.test/src/org/eclipse/osee/framework/core/test/data/CacheUpdateRequestTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/CacheUpdateRequestTest.java
new file mode 100644
index 00000000000..8067f446017
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/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.test.data;
+
+import java.util.Arrays;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.data.CacheUpdateRequest;
+import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
+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.test/src/org/eclipse/osee/framework/core/test/data/ChangeItemTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/ChangeItemTest.java
new file mode 100644
index 00000000000..503445c88a7
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/ChangeItemTest.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * 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.test.data;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.osee.framework.core.data.ChangeItem;
+import org.eclipse.osee.framework.core.data.ChangeVersion;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+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 testGetSetArtId() {
+ item.setArtId(Integer.MAX_VALUE);
+ assertEquals(Integer.MAX_VALUE, 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.test/src/org/eclipse/osee/framework/core/test/data/ChangeTestUtility.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/ChangeTestUtility.java
new file mode 100644
index 00000000000..a4250ed8001
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/ChangeTestUtility.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.test.data;
+
+import org.eclipse.osee.framework.core.data.ChangeItem;
+import org.eclipse.osee.framework.core.data.ChangeVersion;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.test.mocks.MockChangeItem;
+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, 0);
+ }
+
+ 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());
+ Assert.assertEquals(message, expected.getTransactionNumber(), actual.getTransactionNumber());
+ }
+
+ 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(current.getGammaId(), current.getModType(), current.getTransactionNumber());
+ change.setItemId(itemId);
+ 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.test/src/org/eclipse/osee/framework/core/test/data/ChangeVersionTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/ChangeVersionTest.java
new file mode 100644
index 00000000000..12283f6b1b2
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/ChangeVersionTest.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * 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.test.data;
+
+import org.eclipse.osee.framework.core.data.ChangeVersion;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+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, 54);
+ expected.setValue(null);
+ expected.setGammaId(45L);
+ expected.setModType(ModificationType.NEW);
+ expected.setTransactionNumber(54);
+ ChangeTestUtility.checkChange(expected, actual);
+
+ actual = new ChangeVersion("hello", 47L, ModificationType.MERGED, 46);
+ expected.setValue("hello");
+ expected.setGammaId(47L);
+ expected.setModType(ModificationType.MERGED);
+ expected.setTransactionNumber(46);
+ ChangeTestUtility.checkChange(expected, actual);
+ }
+
+ @Test
+ public void testCopy() {
+ ChangeVersion expected = new ChangeVersion("hello", 47L, ModificationType.MERGED, 46);
+ ChangeVersion actual = new ChangeVersion();
+ actual.copy(expected);
+ ChangeTestUtility.checkChange(expected, actual);
+
+ expected = new ChangeVersion(null, 47L, ModificationType.MERGED, null);
+ 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, 46);
+ ChangeVersion actual2 = new ChangeVersion("hello", 47L, ModificationType.MERGED, 46);
+ 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, 46);
+ Assert.assertEquals("[46,47,MERGED]", actual1.toString());
+
+ ChangeVersion expected = new ChangeVersion();
+ Assert.assertEquals("[null,null,null]", expected.toString());
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/DataTestSuite.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/DataTestSuite.java
new file mode 100644
index 00000000000..47ff00ea1c0
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/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.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, //
+ ChangeVersionTest.class, //
+ TransactionCacheUpdateResponseTest.class, //
+ TransactionRecordTest.class, //
+ PurgeBranchRequestTest.class, //
+})
+/**
+ * @author Roberto E. Escobar
+ */
+public class DataTestSuite {
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/PurgeBranchRequestTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/PurgeBranchRequestTest.java
new file mode 100644
index 00000000000..2b74d90d2db
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/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.test.data;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.data.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.test/src/org/eclipse/osee/framework/core/test/data/TransactionCacheUpdateResponseTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/TransactionCacheUpdateResponseTest.java
new file mode 100644
index 00000000000..47803dc470b
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/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.test.data;
+
+import java.util.ArrayList;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.data.TransactionCacheUpdateResponse;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.test.translation.DataAsserts;
+import org.eclipse.osee.framework.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.test/src/org/eclipse/osee/framework/core/test/data/TransactionRecordTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/TransactionRecordTest.java
new file mode 100644
index 00000000000..27dce04eb61
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/data/TransactionRecordTest.java
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * 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.test.data;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link TransactionRecord}
+ *
+ * @author Megumi Telles
+ */
+@RunWith(Parameterized.class)
+public class TransactionRecordTest {
+
+ private final TransactionRecord transaction;
+ private final int transactionNumber;
+ private final int branchId;
+ private final TransactionDetailsType txType;
+
+ private final String comment;
+ private final Date time;
+ private final int authorArtId;
+ private final int commitArtId;
+
+ public TransactionRecordTest(int transactionNumber, int branchId, String comment, Date time, int authorArtId, int commitArtId, TransactionDetailsType txType) {
+ this.transaction =
+ new TransactionRecord(transactionNumber, branchId, comment, time, authorArtId, commitArtId, txType);
+ this.transactionNumber = transactionNumber;
+ this.branchId = branchId;
+ this.comment = comment;
+ this.time = time;
+ this.authorArtId = authorArtId;
+ this.commitArtId = commitArtId;
+ this.txType = txType;
+ }
+
+ @Test
+ public void getBranch() {
+ Assert.assertEquals(branchId, transaction.getBranchId());
+ }
+
+ @Test
+ public void getId() {
+ Assert.assertEquals(transactionNumber, transaction.getId());
+ }
+
+ @Test
+ public void getTxType() {
+ Assert.assertEquals(txType, transaction.getTxType());
+ }
+
+ @Test
+ public void testGetSetComment() {
+ Assert.assertEquals(comment, transaction.getComment());
+
+ transaction.setComment("test set comment");
+ Assert.assertEquals("test set comment", transaction.getComment());
+
+ transaction.setComment(comment);
+ }
+
+ @Test
+ public void testGetSetDate() {
+ Assert.assertEquals(time, transaction.getTimeStamp());
+
+ Date anotherDate = new Date(11111111111L);
+ transaction.setTimeStamp(anotherDate);
+ Assert.assertEquals(anotherDate, transaction.getTimeStamp());
+
+ transaction.setTimeStamp(time);
+ }
+
+ @Test
+ public void testGetSetAuthor() {
+ Assert.assertEquals(authorArtId, transaction.getAuthor());
+
+ transaction.setAuthor(authorArtId * 101);
+ Assert.assertEquals(authorArtId * 101, transaction.getAuthor());
+
+ transaction.setAuthor(authorArtId);
+ }
+
+ @Test
+ public void testGetSetCommit() {
+ Assert.assertEquals(commitArtId, transaction.getCommit());
+
+ transaction.setCommit(commitArtId * 333);
+ Assert.assertEquals(commitArtId * 333, transaction.getCommit());
+
+ transaction.setCommit(commitArtId);
+ }
+
+ @Test
+ public void testEqualsAndHashCode() {
+ TransactionRecord tx1 = MockDataFactory.createTransaction(99, 1);
+ TransactionRecord tx2 = MockDataFactory.createTransaction(99, 2);
+
+ // Add some variation to tx2 so we are certain that only the txId is used in the equals method;
+ tx2.setAuthor(0);
+ tx2.setComment("a");
+ tx2.setCommit(1);
+ tx2.setTimeStamp(new Date(11111111111L));
+
+ Assert.assertNotSame(tx1, tx2);
+ Assert.assertTrue(tx1.equals(tx2));
+ Assert.assertTrue(tx2.equals(tx1));
+ Assert.assertEquals(tx1.hashCode(), tx2.hashCode());
+
+ Assert.assertFalse(transaction.equals(tx1));
+ Assert.assertFalse(transaction.equals(tx2));
+ Assert.assertFalse(transaction.hashCode() == tx1.hashCode());
+ Assert.assertFalse(transaction.hashCode() == tx2.hashCode());
+ }
+
+ @Test
+ public void testAdaptable() {
+ Assert.assertNull(transaction.getAdapter(null));
+ Assert.assertNull(transaction.getAdapter(Object.class));
+ Assert.assertSame(transaction, transaction.getAdapter(TransactionRecord.class));
+ }
+
+ @Test
+ public void testToString() {
+ Assert.assertEquals(transactionNumber + ":" + branchId, transaction.toString());
+ }
+
+ @Parameters
+ public static Collection<Object[]> getData() {
+ Collection<Object[]> data = new ArrayList<Object[]>();
+ for (int index = 1; index <= 2; index++) {
+ int transactionNumber = index * 11;
+ int branchId = index * 9;
+ String comment = GUID.create();
+ Date time = new Date();
+ int authorArtId = index * 47;
+ int commitArtId = index * 37;
+ TransactionDetailsType txType = TransactionDetailsType.toEnum(index % TransactionDetailsType.values().length);
+ data.add(new Object[] {transactionNumber, branchId, comment, time, authorArtId, commitArtId, txType});
+ }
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/ArtifactSuperTypeFieldTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/ArtifactSuperTypeFieldTest.java
new file mode 100644
index 00000000000..50d93d39bfa
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/ArtifactSuperTypeFieldTest.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.test.fields;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeInvalidInheritanceException;
+import org.eclipse.osee.framework.core.internal.fields.ArtifactSuperTypeField;
+import org.eclipse.osee.framework.core.model.ArtifactType;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test Case For {@link ArtifactSuperTypeField}
+ *
+ * @author Roberto E. Escobar
+ */
+public class ArtifactSuperTypeFieldTest {
+
+ private static ArtifactType art1;
+ private static ArtifactType art2;
+ private static ArtifactType art3;
+ private static ArtifactType base;
+ private static ArtifactType containingArt;
+
+ @BeforeClass
+ public static void prepareTest() {
+ containingArt = MockDataFactory.createArtifactType(999);
+ art1 = MockDataFactory.createArtifactType(1);
+ art2 = MockDataFactory.createArtifactType(2);
+ art3 = MockDataFactory.createArtifactType(3);
+ base = new ArtifactType(CoreArtifactTypes.Artifact.getGuid(), CoreArtifactTypes.Artifact.getName(), false);
+ }
+
+ @Test
+ public void testSetGet() throws OseeCoreException {
+ List<ArtifactType> input = new ArrayList<ArtifactType>();
+ ArtifactSuperTypeField field = new ArtifactSuperTypeField(containingArt, input);
+ Assert.assertEquals(false, field.isDirty());
+
+ FieldTestUtil.assertSetGet(field, Arrays.asList(art1, art2, art3), Arrays.asList(art1, art2, art3), true);
+ field.clearDirty();
+ Assert.assertEquals(false, field.isDirty());
+
+ // Add again in a different order
+ FieldTestUtil.assertSetGet(field, Arrays.asList(art3, art1, art2), Arrays.asList(art1, art2, art3), false);
+
+ // Remove
+ FieldTestUtil.assertSetGet(field, Arrays.asList(art3), Arrays.asList(art3), true);
+ field.clearDirty();
+ Assert.assertEquals(false, field.isDirty());
+
+ // Add
+ FieldTestUtil.assertSetGet(field, Arrays.asList(art3, art2), Arrays.asList(art3, art2), true);
+ field.clearDirty();
+ Assert.assertEquals(false, field.isDirty());
+ }
+
+ @Test(expected = OseeInvalidInheritanceException.class)
+ public void testBaseCircularity() throws OseeCoreException {
+ List<ArtifactType> input = new ArrayList<ArtifactType>();
+ ArtifactSuperTypeField field = new ArtifactSuperTypeField(containingArt, input);
+ Assert.assertEquals(false, field.isDirty());
+
+ field.set(Collections.singletonList(containingArt));
+ }
+
+ @Test(expected = OseeInvalidInheritanceException.class)
+ public void testBaseArtifact() throws OseeCoreException {
+ List<ArtifactType> input = new ArrayList<ArtifactType>();
+ ArtifactSuperTypeField field = new ArtifactSuperTypeField(containingArt, input);
+ Assert.assertEquals(false, field.isDirty());
+
+ field.set(Collections.<ArtifactType> emptyList());
+ }
+
+ @Test
+ public void testBaseArtifactNoSuperTypeRequired() throws OseeCoreException {
+ List<ArtifactType> input = new ArrayList<ArtifactType>();
+ ArtifactSuperTypeField field = new ArtifactSuperTypeField(base, input);
+ Assert.assertEquals(false, field.isDirty());
+
+ field.set(Collections.<ArtifactType> emptyList());
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/ArtifactTypeAttributesFieldTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/ArtifactTypeAttributesFieldTest.java
new file mode 100644
index 00000000000..4753cece9a5
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/ArtifactTypeAttributesFieldTest.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * 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.test.fields;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.internal.fields.ArtifactTypeAttributesField;
+import org.eclipse.osee.framework.core.model.AttributeType;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.util.Compare;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test Case For {@link ArtifactTypeAttributesField}
+ *
+ * @author Roberto E. Escobar
+ */
+public class ArtifactTypeAttributesFieldTest {
+
+ private static AttributeType attr1;
+ private static AttributeType attr2;
+ private static AttributeType attr3;
+ private static AttributeType attr4;
+ private static Branch br1;
+ private static Branch br2;
+
+ @BeforeClass
+ public static void prepareTest() throws OseeCoreException {
+ attr1 = MockDataFactory.createAttributeType(1, null);
+ attr2 = MockDataFactory.createAttributeType(2, null);
+ attr3 = MockDataFactory.createAttributeType(3, null);
+ attr4 = MockDataFactory.createAttributeType(4, null);
+
+ br1 = MockDataFactory.createBranch(1);
+ br2 = MockDataFactory.createBranch(2);
+ }
+
+ @Test
+ public void testGetSet() throws OseeCoreException {
+ Map<Branch, Collection<AttributeType>> input = new LinkedHashMap<Branch, Collection<AttributeType>>();
+ ArtifactTypeAttributesField field = new ArtifactTypeAttributesField(input);
+
+ Assert.assertEquals(false, field.isDirty());
+
+ assertSetGet(field, map(br1, attr1, attr2, attr3), map(br1, attr1, attr2, attr3), true);
+ field.clearDirty();
+
+ // Add again in different order
+ assertSetGet(field, map(br1, attr2, attr3, attr1), map(br1, attr1, attr2, attr3), false);
+
+ // Remove from list
+ assertSetGet(field, map(br1, attr2), map(br1, attr2), true);
+ field.clearDirty();
+
+ // Add to list
+ assertSetGet(field, map(br1, attr2, attr4), map(br1, attr2, attr4), true);
+ field.clearDirty();
+
+ // Add to entry
+ Map<Branch, Collection<AttributeType>> values = map(br1, attr2, attr4);
+ map(values, br2, attr3, attr1);
+ assertSetGet(field, values, values, true);
+ field.clearDirty();
+
+ // Add to emptylist
+ assertSetGet(field, Collections.<Branch, Collection<AttributeType>> emptyMap(),
+ Collections.<Branch, Collection<AttributeType>> emptyMap(), true);
+ field.clearDirty();
+ }
+
+ private static Map<Branch, Collection<AttributeType>> map(Branch branch, AttributeType... attrs) {
+ Map<Branch, Collection<AttributeType>> map = new LinkedHashMap<Branch, Collection<AttributeType>>();
+ map.put(branch, Arrays.asList(attrs));
+ return map;
+ }
+
+ private static Map<Branch, Collection<AttributeType>> map(Map<Branch, Collection<AttributeType>> map, Branch branch, AttributeType... attrs) {
+ map.put(branch, Arrays.asList(attrs));
+ return map;
+ }
+
+ private static void assertSetGet(ArtifactTypeAttributesField field, Map<Branch, Collection<AttributeType>> setValues, Map<Branch, Collection<AttributeType>> expected, boolean expectedDirty) throws OseeCoreException {
+ field.set(setValues);
+ Assert.assertEquals(expectedDirty, field.isDirty());
+
+ Map<Branch, Collection<AttributeType>> actual = field.get();
+ Assert.assertEquals(expected.size(), actual.size());
+
+ Assert.assertFalse(Compare.isDifferent(actual, expected));
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/AssociatedArtifactFieldTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/AssociatedArtifactFieldTest.java
new file mode 100644
index 00000000000..17aa6e34b86
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/AssociatedArtifactFieldTest.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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.test.fields;
+
+import org.eclipse.osee.framework.core.data.IBasicArtifact;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.internal.fields.AssociatedArtifactField;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test Case For {@link AssociatedArtifactField}
+ *
+ * @author Roberto E. Escobar
+ */
+public class AssociatedArtifactFieldTest {
+
+ private static IBasicArtifact<?> art1;
+ private static IBasicArtifact<?> art2;
+
+ // private static IBasicArtifact<?> art3;
+
+ @BeforeClass
+ public static void prepareTest() {
+ art1 = MockDataFactory.createArtifact(1);
+ art2 = MockDataFactory.createArtifact(2);
+ // art3 = MockDataFactory.createArtifact(3);
+ }
+
+ @Test
+ public void test() throws OseeCoreException {
+ AssociatedArtifactField field = new AssociatedArtifactField(art1);
+ Assert.assertEquals(false, field.isDirty());
+
+ field.set(art2);
+ Assert.assertEquals(true, field.isDirty());
+ field.clearDirty();
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/BaseOseeFieldTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/BaseOseeFieldTest.java
new file mode 100644
index 00000000000..9d0d24960cb
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/BaseOseeFieldTest.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * 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.test.fields;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.internal.fields.OseeField;
+import org.eclipse.osee.framework.core.util.Compare;
+import org.junit.Test;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class BaseOseeFieldTest {
+ private final OseeFieldTestData<?> test;
+
+ protected BaseOseeFieldTest(OseeFieldTestData<?> test) {
+ this.test = test;
+ }
+
+ @Test
+ public void testInitialValues() throws OseeCoreException {
+ String message = "InitTest";
+ checkObjects(message, test.getInitExpectedValue(), test.getField().get());
+ Assert.assertEquals(message, test.isInitExpectedDirty(), test.getField().isDirty());
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testSettterGetter() throws OseeCoreException {
+ int index = 0;
+ for (FieldGetSetTestData testData : test.getTestDatas()) {
+ String message = String.format("Test Data [%s]", ++index);
+ if (testData.isClearBeforeRun()) {
+ test.getField().clearDirty();
+ Assert.assertFalse(message, test.getField().isDirty());
+ }
+
+ if (testData.throwsError()) {
+ try {
+ test.doSetValue(testData);
+ Assert.assertNull(message, "This line should never be executed");
+ } catch (Exception ex) {
+ Class<?> clazz = testData.getError();
+ Assert.assertTrue(message, ex.getClass().isAssignableFrom(clazz));
+ }
+ } else {
+ test.doSetValue(testData);
+ }
+
+ checkObjects(message, testData.getExpectedValue(), test.getField().get());
+ Assert.assertEquals(message, testData.isExpectedDirty(), test.getField().isDirty());
+ }
+ }
+
+ private void checkObjects(String message, Object expected, Object actual) {
+ Assert.assertFalse(String.format("%s expected[%s] actual[%s]", message, expected, actual),
+ Compare.isDifferent(expected, actual));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ Collection<Object[]> data = new ArrayList<Object[]>();
+
+ data.add(new Object[] {//
+ new OseeFieldTestData<Object>(new OseeField<Object>(), //
+ null, false, //
+ new FieldGetSetTestData<Object>(true, "one test", "one test", true), //
+ new FieldGetSetTestData<Object>(false, "two test", "two test", true), //
+ new FieldGetSetTestData<Object>(true, "three test", "three test", true)//
+ )});//
+
+ data.add(new Object[] { //
+ new OseeFieldTestData<Integer>(new OseeField<Integer>(), //
+ null, false, //
+ new FieldGetSetTestData<Integer>(true, 1, 1, true), //
+ new FieldGetSetTestData<Integer>(false, 5, 5, true), //
+ new FieldGetSetTestData<Integer>(true, Integer.MIN_VALUE, Integer.MIN_VALUE, true)//
+ )});
+
+ data.add(new Object[] { //
+ new OseeFieldTestData<Boolean>(new OseeField<Boolean>(), //
+ null, false, //
+ new FieldGetSetTestData<Boolean>(true, true, true, true), //
+ new FieldGetSetTestData<Boolean>(false, true, true, true), //
+ new FieldGetSetTestData<Boolean>(true, false, false, true),//
+ new FieldGetSetTestData<Boolean>(false, false, false, true)//
+ )});
+
+ data.add(new Object[] {new OseeFieldTestData<Object>(new OseeField<Object>("string1"), "string1", true)});
+ data.add(new Object[] {new OseeFieldTestData<Integer>(new OseeField<Integer>(Integer.MIN_VALUE),
+ Integer.MIN_VALUE, true)});
+ data.add(new Object[] {new OseeFieldTestData<Boolean>(new OseeField<Boolean>(true), true, true)});
+ data.add(new Object[] {new OseeFieldTestData<Boolean>(new OseeField<Boolean>(false), false, true)});
+
+ data.add(new Object[] {//
+ new OseeFieldTestData<String>(new OseeField<String>("string2"), "string2", true, //
+ new FieldGetSetTestData<String>(false, "another", "another", true), //
+ new FieldGetSetTestData<String>(true, "something", "something", true)//
+ )});
+
+ // IOseeTypeFactory factory = new OseeTypeFactory();
+ // data.add(createAssociatedArtifactTest(factory));
+ return data;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/BranchAliasesFieldTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/BranchAliasesFieldTest.java
new file mode 100644
index 00000000000..5253dc6ddfa
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/BranchAliasesFieldTest.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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.test.fields;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.internal.fields.BranchAliasesField;
+import org.junit.Test;
+
+/**
+ * Test Case For {@link BranchAliasesField}
+ *
+ * @author Roberto E. Escobar
+ */
+public class BranchAliasesFieldTest {
+
+ @Test
+ public void testSetGet() throws OseeCoreException {
+ Collection<String> aliases = new ArrayList<String>();
+ BranchAliasesField field = new BranchAliasesField(aliases);
+ Assert.assertEquals(false, field.isDirty());
+
+ FieldTestUtil.assertSetGet(field, Arrays.asList("A", "B", "C"), Arrays.asList("a", "b", "c"), true);
+ field.clearDirty();
+ Assert.assertEquals(false, field.isDirty());
+
+ // Same but with changed order and case
+ FieldTestUtil.assertSetGet(field, Arrays.asList("C", "a", "b"), Arrays.asList("a", "b", "c"), false);
+ Assert.assertEquals(false, field.isDirty());
+
+ // Remove two
+ FieldTestUtil.assertSetGet(field, Arrays.asList("C"), Arrays.asList("c"), true);
+ field.clearDirty();
+
+ // Add
+ FieldTestUtil.assertSetGet(field, Arrays.asList("C", "WhaT!21", "AgAin"), Arrays.asList("c", "what!21", "again"),
+ true);
+ field.clearDirty();
+
+ // Add Empty
+ FieldTestUtil.assertSetGet(field, Collections.<String> emptyList(), Collections.<String> emptyList(), true);
+ field.clearDirty();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/CollectionFieldTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/CollectionFieldTest.java
new file mode 100644
index 00000000000..ef886f95f1d
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/CollectionFieldTest.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * 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.test.fields;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.internal.fields.CollectionField;
+import org.junit.Test;
+
+/**
+ * author Roberto E. Escobar
+ */
+public class CollectionFieldTest {
+
+ @Test
+ public void testSetGetString() throws OseeCoreException {
+ List<String> values = new ArrayList<String>();
+ CollectionField<String> field = new CollectionField<String>(values);
+ Assert.assertFalse(field.isDirty());
+
+ FieldTestUtil.assertSetGet(field, Arrays.asList("a", "b", "c"), Arrays.asList("a", "b", "c"), true);
+ field.clearDirty();
+
+ // Test order doesn't matter
+ FieldTestUtil.assertSetGet(field, Arrays.asList("b", "c", "a"), Arrays.asList("a", "b", "c"), false);
+
+ // Test remove one
+ FieldTestUtil.assertSetGet(field, Arrays.asList("a", "b"), Arrays.asList("a", "b"), true);
+ field.clearDirty();
+
+ // Test add one
+ FieldTestUtil.assertSetGet(field, Arrays.asList("a", "b", "d"), Arrays.asList("a", "b", "d"), true);
+ field.clearDirty();
+
+ // Add Empty
+ FieldTestUtil.assertSetGet(field, Collections.<String> emptyList(), Collections.<String> emptyList(), true);
+ field.clearDirty();
+ }
+
+ @Test
+ public void testSetGetInteger() throws OseeCoreException {
+ List<Integer> values = new ArrayList<Integer>();
+ CollectionField<Integer> field = new CollectionField<Integer>(values);
+ Assert.assertFalse(field.isDirty());
+
+ FieldTestUtil.assertSetGet(field, Arrays.asList(1, 2, 3), Arrays.asList(1, 2, 3), true);
+ field.clearDirty();
+
+ // Test order doesn't matter
+ FieldTestUtil.assertSetGet(field, Arrays.asList(2, 3, 1), Arrays.asList(1, 2, 3), false);
+
+ // Test remove one
+ FieldTestUtil.assertSetGet(field, Arrays.asList(1, 2), Arrays.asList(1, 2), true);
+ field.clearDirty();
+
+ // Test add
+ FieldTestUtil.assertSetGet(field, Arrays.asList(1, 2, 4, 5), Arrays.asList(1, 2, 4, 5), true);
+ field.clearDirty();
+
+ // Add Empty
+ FieldTestUtil.assertSetGet(field, Collections.<Integer> emptyList(), Collections.<Integer> emptyList(), true);
+ field.clearDirty();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/EnumEntryFieldTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/EnumEntryFieldTest.java
new file mode 100644
index 00000000000..f58a5dc3cd8
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/EnumEntryFieldTest.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * 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.test.fields;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.internal.fields.EnumEntryField;
+import org.eclipse.osee.framework.core.model.OseeEnumEntry;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test Case For {@link EnumEntryField}
+ *
+ * @author Roberto E. Escobar
+ */
+public class EnumEntryFieldTest {
+
+ private static OseeEnumEntry e1;
+ private static OseeEnumEntry e2;
+ private static OseeEnumEntry e3;
+ private static OseeEnumEntry e4;
+
+ @BeforeClass
+ public static void prepareTest() {
+ e1 = MockDataFactory.createEnumEntry(1);
+ e2 = MockDataFactory.createEnumEntry(2);
+ e3 = MockDataFactory.createEnumEntry(3);
+ e4 = MockDataFactory.createEnumEntry(4);
+ }
+
+ @Test
+ public void testSetGet() throws OseeCoreException {
+ Collection<OseeEnumEntry> enumEntries = new ArrayList<OseeEnumEntry>();
+ EnumEntryField field = new EnumEntryField(enumEntries);
+ Assert.assertEquals(false, field.isDirty());
+
+ FieldTestUtil.assertSetGet(field, Arrays.asList(e1, e2, e3), Arrays.asList(e1, e2, e3), true);
+ field.clearDirty();
+ Assert.assertEquals(false, field.isDirty());
+
+ // Same but with changed order and case
+ FieldTestUtil.assertSetGet(field, Arrays.asList(e3, e1, e2), Arrays.asList(e1, e2, e3), false);
+ Assert.assertEquals(false, field.isDirty());
+
+ // Remove two
+ FieldTestUtil.assertSetGet(field, Arrays.asList(e3), Arrays.asList(e3), true);
+ field.clearDirty();
+
+ FieldTestUtil.assertSetGet(field, Arrays.asList(e3, e4, e2), Arrays.asList(e3, e4, e2), true);
+ field.clearDirty();
+
+ // Add Empty
+ FieldTestUtil.assertSetGet(field, Collections.<OseeEnumEntry> emptyList(),
+ Collections.<OseeEnumEntry> emptyList(), true);
+ field.clearDirty();
+ }
+
+ @Test
+ public void testEnumEntryDirtyOrdinal() throws OseeCoreException {
+ Collection<OseeEnumEntry> enumEntries = new ArrayList<OseeEnumEntry>();
+ EnumEntryField field = new EnumEntryField(enumEntries);
+
+ FieldTestUtil.assertSetGet(field, Arrays.asList(e1, e2, e3), Arrays.asList(e1, e2, e3), true);
+ field.clearDirty();
+
+ e1.setOrdinal(4);
+ Assert.assertEquals(true, e1.isDirty());
+ Assert.assertEquals(true, field.isDirty());
+
+ field.clearDirty();
+ Assert.assertEquals(false, field.isDirty());
+ Assert.assertEquals(false, e1.isDirty());
+ }
+
+ @Test
+ public void testEnumEntryDirtyName() throws OseeCoreException {
+ Collection<OseeEnumEntry> enumEntries = new ArrayList<OseeEnumEntry>();
+ EnumEntryField field = new EnumEntryField(enumEntries);
+
+ FieldTestUtil.assertSetGet(field, Arrays.asList(e1, e2, e3), Arrays.asList(e1, e2, e3), true);
+ field.clearDirty();
+
+ e3.setName(GUID.create());
+ Assert.assertEquals(true, e3.isDirty());
+ Assert.assertEquals(true, field.isDirty());
+
+ field.clearDirty();
+ Assert.assertEquals(false, field.isDirty());
+ Assert.assertEquals(false, e3.isDirty());
+ }
+
+ @Test(expected = OseeArgumentException.class)
+ public void testEnumEntryNameUniqueness() throws OseeCoreException {
+ Collection<OseeEnumEntry> enumEntries = new ArrayList<OseeEnumEntry>();
+ EnumEntryField field = new EnumEntryField(enumEntries);
+
+ FieldTestUtil.assertSetGet(field, Arrays.asList(e1, e2, e3), Arrays.asList(e1, e2, e3), true);
+ field.clearDirty();
+
+ OseeEnumEntry eX = MockDataFactory.createEnumEntry(1);
+ field.set(Arrays.asList(e1, e2, e3, eX));
+ }
+
+ @Test(expected = OseeArgumentException.class)
+ public void testEnumEntryOrdinalUniqueness() throws OseeCoreException {
+ Collection<OseeEnumEntry> enumEntries = new ArrayList<OseeEnumEntry>();
+ enumEntries.add(e1);
+ enumEntries.add(e2);
+ EnumEntryField field = new EnumEntryField(enumEntries);
+
+ OseeEnumEntry eX = MockDataFactory.createEnumEntry(1);
+ eX.setName("hello");
+ eX.setOrdinal(e1.ordinal());
+ field.set(Arrays.asList(e1, e2, eX));
+ }
+
+ @Test(expected = OseeArgumentException.class)
+ public void testEnumEntryNullName() throws OseeCoreException {
+ EnumEntryField field = new EnumEntryField(Collections.<OseeEnumEntry> emptyList());
+ OseeEnumEntry eX = MockDataFactory.createEnumEntry(1);
+ eX.setName(null);
+ eX.setOrdinal(5);
+ field.set(Collections.singleton(eX));
+ }
+
+ @Test(expected = OseeArgumentException.class)
+ public void testEnumEntryNegativeOrdinal() throws OseeCoreException {
+ EnumEntryField field = new EnumEntryField(Collections.<OseeEnumEntry> emptyList());
+ OseeEnumEntry eX = MockDataFactory.createEnumEntry(1);
+ eX.setName("not empty");
+ eX.setOrdinal(-1);
+ field.set(Collections.singleton(eX));
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/FieldGetSetTestData.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/FieldGetSetTestData.java
new file mode 100644
index 00000000000..d2508b50be9
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/FieldGetSetTestData.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.test.fields;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class FieldGetSetTestData<T> {
+ private final T setValue;
+ private final T expectedValue;
+ private final boolean expectedDirty;
+ private final boolean clearBeforeRun;
+ private final Class<? extends Throwable> error;
+
+ public FieldGetSetTestData(boolean clearBeforeRun, T setValue, T expectedValue, boolean expectedDirty, Class<? extends Throwable> error) {
+ this.clearBeforeRun = clearBeforeRun;
+ this.setValue = setValue;
+ this.expectedValue = expectedValue;
+ this.expectedDirty = expectedDirty;
+ this.error = error;
+ }
+
+ public FieldGetSetTestData(boolean clearBeforeRun, T setValue, T expectedValue, boolean expectedDirty) {
+ this(clearBeforeRun, setValue, expectedValue, expectedDirty, null);
+ }
+
+ public boolean isClearBeforeRun() {
+ return clearBeforeRun;
+ }
+
+ public T getSetValue() {
+ return setValue;
+ }
+
+ public T getExpectedValue() {
+ return expectedValue;
+ }
+
+ public boolean isExpectedDirty() {
+ return expectedDirty;
+ }
+
+ public boolean throwsError() {
+ return getError() != null;
+ }
+
+ public Class<? extends Throwable> getError() {
+ return error;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/FieldTestSuite.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/FieldTestSuite.java
new file mode 100644
index 00000000000..c299652770f
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/FieldTestSuite.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.test.fields;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {//
+ArtifactSuperTypeFieldTest.class, //
+ ArtifactTypeAttributesFieldTest.class, //
+ AssociatedArtifactFieldTest.class, //
+ BranchAliasesFieldTest.class, //
+ CollectionFieldTest.class, //
+ EnumEntryFieldTest.class, //
+ OseeFieldMainTest.class, //
+ UniqueIdFieldTest.class, //
+})
+/**
+ * @author Roberto E. Escobar
+ */
+public class FieldTestSuite {
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/FieldTestUtil.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/FieldTestUtil.java
new file mode 100644
index 00000000000..a528fcaa9db
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/FieldTestUtil.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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.test.fields;
+
+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.internal.fields.CollectionField;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class FieldTestUtil {
+
+ private FieldTestUtil() {
+ }
+
+ public static <T> void assertSetGet(CollectionField<T> field, List<T> setValues, List<T> expected, boolean expectedDirty) throws OseeCoreException {
+ field.set(setValues);
+ Assert.assertEquals(expectedDirty, field.isDirty());
+
+ List<T> actual = new ArrayList<T>(field.get());
+ Assert.assertEquals(expected.size(), actual.size());
+ Assert.assertTrue(Collections.setComplement(actual, expected).isEmpty());
+ Assert.assertTrue(Collections.setComplement(expected, actual).isEmpty());
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/OseeFieldMainTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/OseeFieldMainTest.java
new file mode 100644
index 00000000000..0baf0fcf6b9
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/OseeFieldMainTest.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * 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.test.fields;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.internal.fields.OseeField;
+import org.eclipse.osee.framework.core.util.Compare;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * @author Roberto E. Escobar
+ */
+@RunWith(Parameterized.class)
+public class OseeFieldMainTest {
+ private final OseeFieldTestData<?> test;
+
+ public OseeFieldMainTest(OseeFieldTestData<?> test) {
+ this.test = test;
+ }
+
+ @Test
+ public void testInitialValues() throws OseeCoreException {
+ String message = "InitTest";
+ checkObjects(message, test.getInitExpectedValue(), test.getField().get());
+ Assert.assertEquals(message, test.isInitExpectedDirty(), test.getField().isDirty());
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testSettterGetter() throws OseeCoreException {
+ int index = 0;
+ for (FieldGetSetTestData testData : test.getTestDatas()) {
+ String message = String.format("Test Data [%s]", ++index);
+ if (testData.isClearBeforeRun()) {
+ test.getField().clearDirty();
+ Assert.assertFalse(message, test.getField().isDirty());
+ }
+
+ if (testData.throwsError()) {
+ try {
+ test.doSetValue(testData);
+ Assert.assertNull(message, "This line should never be executed");
+ } catch (Exception ex) {
+ Class<?> clazz = testData.getError();
+ Assert.assertTrue(message, ex.getClass().isAssignableFrom(clazz));
+ }
+ } else {
+ test.doSetValue(testData);
+ }
+
+ checkObjects(message, testData.getExpectedValue(), test.getField().get());
+ Assert.assertEquals(message, testData.isExpectedDirty(), test.getField().isDirty());
+ }
+ }
+
+ private void checkObjects(String message, Object expected, Object actual) {
+ Assert.assertFalse(String.format("%s expected[%s] actual[%s]", message, expected, actual),
+ Compare.isDifferent(expected, actual));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ Collection<Object[]> data = new ArrayList<Object[]>();
+
+ data.add(new Object[] {//
+ new OseeFieldTestData<Object>(new OseeField<Object>(), //
+ null, false, //
+ new FieldGetSetTestData<Object>(true, "one test", "one test", true), //
+ new FieldGetSetTestData<Object>(false, "two test", "two test", true), //
+ new FieldGetSetTestData<Object>(true, "three test", "three test", true)//
+ )});//
+
+ data.add(new Object[] { //
+ new OseeFieldTestData<Integer>(new OseeField<Integer>(), //
+ null, false, //
+ new FieldGetSetTestData<Integer>(true, 1, 1, true), //
+ new FieldGetSetTestData<Integer>(false, 5, 5, true), //
+ new FieldGetSetTestData<Integer>(true, Integer.MIN_VALUE, Integer.MIN_VALUE, true)//
+ )});
+
+ data.add(new Object[] { //
+ new OseeFieldTestData<Boolean>(new OseeField<Boolean>(), //
+ null, false, //
+ new FieldGetSetTestData<Boolean>(true, true, true, true), //
+ new FieldGetSetTestData<Boolean>(false, true, true, true), //
+ new FieldGetSetTestData<Boolean>(true, false, false, true),//
+ new FieldGetSetTestData<Boolean>(false, false, false, true)//
+ )});
+
+ data.add(new Object[] {new OseeFieldTestData<Object>(new OseeField<Object>("string1"), "string1", true)});
+ data.add(new Object[] {new OseeFieldTestData<Integer>(new OseeField<Integer>(Integer.MIN_VALUE),
+ Integer.MIN_VALUE, true)});
+ data.add(new Object[] {new OseeFieldTestData<Boolean>(new OseeField<Boolean>(true), true, true)});
+ data.add(new Object[] {new OseeFieldTestData<Boolean>(new OseeField<Boolean>(false), false, true)});
+
+ data.add(new Object[] {//
+ new OseeFieldTestData<String>(new OseeField<String>("string2"), "string2", true, //
+ new FieldGetSetTestData<String>(false, "another", "another", true), //
+ new FieldGetSetTestData<String>(true, "something", "something", true)//
+ )});
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/OseeFieldTestData.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/OseeFieldTestData.java
new file mode 100644
index 00000000000..9a67160f6db
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/OseeFieldTestData.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.test.fields;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.internal.fields.IOseeField;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OseeFieldTestData<T> {
+ private final IOseeField<T> field;
+ private final Object initExpectedValue;
+ private final boolean initExpectedDirty;
+
+ private final Collection<FieldGetSetTestData<T>> testDatas;
+
+ public OseeFieldTestData(IOseeField<T> field, Object initExpectedValue, boolean initExpectedDirty, FieldGetSetTestData<T>... testDatas) {
+ this.field = field;
+ this.initExpectedValue = initExpectedValue;
+ this.initExpectedDirty = initExpectedDirty;
+ this.testDatas = new ArrayList<FieldGetSetTestData<T>>();
+ if (testDatas != null && testDatas.length > 0) {
+ this.testDatas.addAll(Arrays.asList(testDatas));
+ }
+ }
+
+ public IOseeField<T> getField() {
+ return field;
+ }
+
+ public Object getInitExpectedValue() {
+ return initExpectedValue;
+ }
+
+ public boolean isInitExpectedDirty() {
+ return initExpectedDirty;
+ }
+
+ public Collection<FieldGetSetTestData<T>> getTestDatas() {
+ return testDatas;
+ }
+
+ public void doSetValue(FieldGetSetTestData<T> testData) throws OseeCoreException {
+ getField().set(testData.getSetValue());
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/UniqueIdFieldTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/UniqueIdFieldTest.java
new file mode 100644
index 00000000000..26d607d82ae
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/fields/UniqueIdFieldTest.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.test.fields;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.internal.fields.UniqueIdField;
+import org.eclipse.osee.framework.core.model.IOseeStorable;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case For {@link UniqueIdField}
+ *
+ * @author Roberto E. Escobar
+ */
+@RunWith(Parameterized.class)
+public class UniqueIdFieldTest extends BaseOseeFieldTest {
+
+ public UniqueIdFieldTest(OseeFieldTestData<?> test) {
+ super(test);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Parameters
+ public static Collection<Object[]> data() throws OseeCoreException {
+ Collection<Object[]> data = new ArrayList<Object[]>();
+ data.add(new Object[] {new OseeFieldTestData<Integer>(new UniqueIdField(), //
+ IOseeStorable.UNPERSISTED_VALUE, true, //
+ new FieldGetSetTestData<Integer>(false, IOseeStorable.UNPERSISTED_VALUE,
+ IOseeStorable.UNPERSISTED_VALUE, true), //
+ new FieldGetSetTestData<Integer>(true, IOseeStorable.UNPERSISTED_VALUE,
+ IOseeStorable.UNPERSISTED_VALUE, false), //
+ new FieldGetSetTestData<Integer>(false, 100, 100, true), //
+ new FieldGetSetTestData<Integer>(false, 200, 100, true, OseeStateException.class),//
+ new FieldGetSetTestData<Integer>(true, 300, 100, false, OseeStateException.class)//
+ )});
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockAbstractOseeType.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockAbstractOseeType.java
new file mode 100644
index 00000000000..5dc3178ba1a
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockAbstractOseeType.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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.test.mocks;
+
+import org.eclipse.osee.framework.core.model.AbstractOseeType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class MockAbstractOseeType extends AbstractOseeType {
+
+ public MockAbstractOseeType(String guid, String name) {
+ super(guid, name);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockChangeItem.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockChangeItem.java
new file mode 100644
index 00000000000..829669738d8
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockChangeItem.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.test.mocks;
+
+import org.eclipse.osee.framework.core.data.ChangeItem;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class MockChangeItem extends ChangeItem {
+
+ public MockChangeItem(long currentSourceGammaId, ModificationType currentSourceModType, int currentSourceTransactionNumber) {
+ super(currentSourceGammaId, currentSourceModType, currentSourceTransactionNumber);
+ }
+
+ @Override
+ public void setItemId(int itemId) {
+ super.setItemId(itemId);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockDataFactory.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockDataFactory.java
new file mode 100644
index 00000000000..dbd04f3d8c8
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockDataFactory.java
@@ -0,0 +1,211 @@
+/*******************************************************************************
+ * 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.test.mocks;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import org.eclipse.osee.framework.core.cache.ArtifactTypeCache;
+import org.eclipse.osee.framework.core.cache.AttributeTypeCache;
+import org.eclipse.osee.framework.core.cache.BranchCache;
+import org.eclipse.osee.framework.core.cache.OseeEnumTypeCache;
+import org.eclipse.osee.framework.core.cache.RelationTypeCache;
+import org.eclipse.osee.framework.core.cache.TransactionCache;
+import org.eclipse.osee.framework.core.data.ArtifactChangeItem;
+import org.eclipse.osee.framework.core.data.BranchCreationRequest;
+import org.eclipse.osee.framework.core.data.BranchCreationResponse;
+import org.eclipse.osee.framework.core.data.CacheUpdateRequest;
+import org.eclipse.osee.framework.core.data.ChangeVersion;
+import org.eclipse.osee.framework.core.data.DefaultBasicArtifact;
+import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.data.IBasicArtifact;
+import org.eclipse.osee.framework.core.enums.BranchState;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
+import org.eclipse.osee.framework.core.enums.RelationOrderBaseTypes;
+import org.eclipse.osee.framework.core.enums.RelationTypeMultiplicity;
+import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.ArtifactType;
+import org.eclipse.osee.framework.core.model.ArtifactTypeFactory;
+import org.eclipse.osee.framework.core.model.AttributeType;
+import org.eclipse.osee.framework.core.model.AttributeTypeFactory;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.BranchFactory;
+import org.eclipse.osee.framework.core.model.OseeCachingService;
+import org.eclipse.osee.framework.core.model.OseeEnumEntry;
+import org.eclipse.osee.framework.core.model.OseeEnumType;
+import org.eclipse.osee.framework.core.model.OseeEnumTypeFactory;
+import org.eclipse.osee.framework.core.model.OseeModelFactoryService;
+import org.eclipse.osee.framework.core.model.RelationType;
+import org.eclipse.osee.framework.core.model.RelationTypeFactory;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.model.TransactionRecordFactory;
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.framework.core.services.IOseeCachingServiceProvider;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryService;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public final class MockDataFactory {
+
+ private MockDataFactory() {
+ }
+
+ public static IBasicArtifact<?> createArtifact(int index) {
+ return new DefaultBasicArtifact(index * 37, GUID.create(), "user_" + index);
+ }
+
+ public static ArtifactChangeItem createArtifactChangeItem() throws OseeArgumentException {
+ int artId = (int) Math.random();
+ int transactionNumber = (int) Math.random();
+ Long gammaIdNumber = Long.valueOf((int) Math.random());
+
+ ArtifactChangeItem changeItem =
+ new ArtifactChangeItem(gammaIdNumber, ModificationType.getMod(1), transactionNumber, artId);
+ 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, index * 11);
+ }
+
+ 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.setTransactionNumber(index * 37);
+ changeVersion.setValue("change_version_value_" + index);
+ }
+
+ public static AttributeType createAttributeType() throws OseeCoreException {
+ OseeEnumTypeFactory oseeEnumTypeFactory = new OseeEnumTypeFactory();
+ AttributeType attributeType =
+ new AttributeType(GUID.create(), "name", "baseType", "providerName", ".xml", "", 1, 1, "description",
+ "tagger");
+ attributeType.setOseeEnumType(oseeEnumTypeFactory.createEnumType(GUID.create(), "enum type name"));
+ return attributeType;
+ }
+
+ public static Branch createBranch(int index) {
+ BranchState branchState = BranchState.values()[Math.abs(index % BranchState.values().length)];
+ BranchType branchType = BranchType.values()[Math.abs(index % BranchType.values().length)];
+ boolean isArchived = index % 2 == 0 ? true : false;
+ return new Branch(GUID.create(), "branch_" + index, branchType, branchState, isArchived);
+ }
+
+ public static TransactionRecord createTransaction(int index, int branchId) {
+ TransactionDetailsType type =
+ TransactionDetailsType.values()[Math.abs(index % TransactionDetailsType.values().length)];
+ int value = index;
+ if (value == 0) {
+ value++;
+ }
+ return new TransactionRecord(value * 47, branchId, "comment_" + value, new Date(), value * 37, value * 42, type);
+ }
+
+ public static OseeEnumEntry createEnumEntry(int index) {
+ return new OseeEnumEntry(GUID.create(), "entry_" + index, Math.abs(index * 37));
+ }
+
+ public static OseeEnumType createEnumType(int index) {
+ return new OseeEnumType(GUID.create(), "enum_" + index);
+ }
+
+ public static AttributeType createAttributeType(int index, OseeEnumType oseeEnumType) throws OseeCoreException {
+ AttributeType type =
+ new AttributeType(GUID.create(), "attrType_" + index, "baseClass_" + index, "providerId_" + index,
+ "ext_" + index, "default_" + index, index * 2, index * 7, "description_" + index, "tag_" + index);
+ type.setOseeEnumType(oseeEnumType);
+ return type;
+ }
+
+ public static ArtifactType createArtifactType(int index) {
+ return new ArtifactType(GUID.create(), "art_" + index, index % 2 == 0);
+ }
+
+ public static ArtifactType createBaseArtifactType() {
+ IArtifactType baseType = CoreArtifactTypes.Artifact;
+ return new ArtifactType(baseType.getGuid(), baseType.getName(), true);
+ }
+
+ public static RelationType createRelationType(int index, ArtifactType artTypeA, ArtifactType artTypeB) {
+ RelationTypeMultiplicity multiplicity =
+ RelationTypeMultiplicity.values()[Math.abs(index % RelationTypeMultiplicity.values().length)];
+ String order = RelationOrderBaseTypes.values[index % RelationTypeMultiplicity.values().length].getGuid();
+ return new RelationType(GUID.create(), "relType_" + index, "sideA_" + index, "sideB_" + index, artTypeA,
+ artTypeB, multiplicity, order);
+ }
+
+ 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 IOseeModelFactoryService createFactoryService() {
+ return new OseeModelFactoryService(new BranchFactory(), new TransactionRecordFactory(),
+ new ArtifactTypeFactory(), new AttributeTypeFactory(), new RelationTypeFactory(), new OseeEnumTypeFactory());
+ }
+
+ public static IOseeModelFactoryServiceProvider createFactoryProvider() {
+ return new MockOseeModelFactoryServiceProvider(createFactoryService());
+ }
+
+ public static IOseeCachingServiceProvider createCachingProvider() {
+ BranchCache brCache = new BranchCache(new MockOseeDataAccessor<Branch>());
+ TransactionCache txCache = new TransactionCache();
+ txCache.setAccessor(new MockOseeTransactionDataAccessor());
+ ArtifactTypeCache artCache = new ArtifactTypeCache(new MockOseeDataAccessor<ArtifactType>());
+ AttributeTypeCache attrCache = new AttributeTypeCache(new MockOseeDataAccessor<AttributeType>());
+ RelationTypeCache relCache = new RelationTypeCache(new MockOseeDataAccessor<RelationType>());
+ OseeEnumTypeCache enumCache = new OseeEnumTypeCache(new MockOseeDataAccessor<OseeEnumType>());
+
+ IOseeCachingService service = new OseeCachingService(brCache, txCache, artCache, attrCache, relCache, enumCache);
+ return new MockOseeCachingServiceProvider(service);
+ }
+
+ 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.test/src/org/eclipse/osee/framework/core/test/mocks/MockOseeCachingServiceProvider.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockOseeCachingServiceProvider.java
new file mode 100644
index 00000000000..4d60c4c2642
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockOseeCachingServiceProvider.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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.test.mocks;
+
+import org.eclipse.osee.framework.core.services.IOseeCachingService;
+import org.eclipse.osee.framework.core.services.IOseeCachingServiceProvider;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class MockOseeCachingServiceProvider implements IOseeCachingServiceProvider {
+
+ private final IOseeCachingService service;
+
+ public MockOseeCachingServiceProvider(IOseeCachingService service) {
+ this.service = service;
+ }
+
+ @Override
+ public IOseeCachingService getOseeCachingService() {
+ return service;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockOseeDataAccessor.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockOseeDataAccessor.java
new file mode 100644
index 00000000000..079664f77f9
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockOseeDataAccessor.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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.test.mocks;
+
+import java.util.Collection;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.cache.IOseeCache;
+import org.eclipse.osee.framework.core.cache.IOseeDataAccessor;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.IOseeStorable;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class MockOseeDataAccessor<T extends IOseeStorable> implements IOseeDataAccessor<T> {
+
+ private boolean wasLoadCalled = false;
+ private boolean wasStoreCalled = false;
+
+ public void setLoadCalled(boolean wasLoadCalled) {
+ this.wasLoadCalled = wasLoadCalled;
+ }
+
+ public void setStoreCalled(boolean wasStoreCalled) {
+ this.wasStoreCalled = wasStoreCalled;
+ }
+
+ public boolean wasLoaded() {
+ return wasLoadCalled;
+ }
+
+ public boolean wasStoreCalled() {
+ return wasStoreCalled;
+ }
+
+ @Override
+ public void load(IOseeCache<T> cache) throws OseeCoreException {
+ Assert.assertNotNull(cache);
+ setLoadCalled(true);
+ }
+
+ @Override
+ public void store(Collection<T> types) throws OseeCoreException {
+ Assert.assertNotNull(types);
+ setStoreCalled(true);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockOseeModelFactoryServiceProvider.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockOseeModelFactoryServiceProvider.java
new file mode 100644
index 00000000000..28fbdd22c08
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/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.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.test/src/org/eclipse/osee/framework/core/test/mocks/MockOseeTransactionDataAccessor.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockOseeTransactionDataAccessor.java
new file mode 100644
index 00000000000..2cd875db449
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/mocks/MockOseeTransactionDataAccessor.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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.test.mocks;
+
+import java.util.Collection;
+import org.eclipse.osee.framework.core.cache.ITransactionDataAccessor;
+import org.eclipse.osee.framework.core.cache.TransactionCache;
+import org.eclipse.osee.framework.core.enums.TransactionVersion;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class MockOseeTransactionDataAccessor implements ITransactionDataAccessor {
+
+ private boolean wasLoadCalled = false;
+ private boolean wasStoreCalled = false;
+
+ public void setLoadCalled(boolean wasLoadCalled) {
+ this.wasLoadCalled = wasLoadCalled;
+ }
+
+ public void setStoreCalled(boolean wasStoreCalled) {
+ this.wasStoreCalled = wasStoreCalled;
+ }
+
+ public boolean wasLoaded() {
+ return wasLoadCalled;
+ }
+
+ public boolean wasStoreCalled() {
+ return wasStoreCalled;
+ }
+
+ // @Override
+ // public void load(AbstractOseeCache<T> cache) throws OseeCoreException {
+ // Assert.assertNotNull(cache);
+ // setLoadCalled(true);
+ // }
+ //
+ // @Override
+ // public void store(Collection<T> types) throws OseeCoreException {
+ // Assert.assertNotNull(types);
+ // setStoreCalled(true);
+ // }
+
+ @Override
+ public void loadTransactionRecord(TransactionCache cache, Collection<Integer> transactionIds) throws OseeCoreException {
+ wasLoadCalled = true;
+ }
+
+ @Override
+ public void loadTransactionRecord(TransactionCache cache, Branch branch) throws OseeCoreException {
+ }
+
+ @Override
+ public TransactionRecord loadTransactionRecord(TransactionCache cache, Branch branch, TransactionVersion transactionType) throws OseeCoreException {
+ return null;
+ }
+
+ @Override
+ public void load(TransactionCache transactionCache) throws OseeCoreException {
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/AbstractOseeTypeTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/AbstractOseeTypeTest.java
new file mode 100644
index 00000000000..9dd288943e1
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/AbstractOseeTypeTest.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * 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.test.model;
+
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.enums.StorageState;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.model.AbstractOseeType;
+import org.eclipse.osee.framework.core.model.IOseeStorable;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.junit.Test;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AbstractOseeTypeTest<T extends AbstractOseeType> {
+
+ private final T type;
+ private final String name;
+ private final String guid;
+
+ protected AbstractOseeTypeTest(T type, String guid, String name) {
+ this.type = type;
+ this.name = name;
+ this.guid = guid;
+ }
+
+ protected T getType() {
+ return type;
+ }
+
+ protected String getExpectedName() {
+ return name;
+ }
+
+ protected String getExpectedGuid() {
+ return guid;
+ }
+
+ @Test
+ public void testSetGetGuid() {
+ Assert.assertEquals(getExpectedGuid(), type.getGuid());
+ }
+
+ @Test
+ public void testGetId() {
+ Assert.assertEquals(IOseeStorable.UNPERSISTED_VALUE, Integer.valueOf(type.getId()));
+ }
+
+ @Test(expected = OseeStateException.class)
+ public void testSetGetId() throws OseeCoreException {
+ type.setId(Integer.MAX_VALUE);
+ Assert.assertEquals(Integer.MAX_VALUE, type.getId());
+
+ type.setId(Integer.MAX_VALUE - 1);
+ }
+
+ @Test
+ public void testSetGetName() throws OseeCoreException {
+ Assert.assertEquals(getExpectedName(), type.getName());
+ String originalName = type.getName();
+
+ type.clearDirty();
+ Assert.assertFalse(type.isDirty());
+ Assert.assertFalse(type.areFieldsDirty(AbstractOseeType.NAME_FIELD_KEY));
+
+ // Check reassign doesn't mark as dirty
+ type.setName(originalName);
+ Assert.assertFalse(type.areFieldsDirty(AbstractOseeType.NAME_FIELD_KEY));
+
+ String newName = GUID.create();
+ type.setName(newName);
+ Assert.assertEquals(newName, type.getName());
+
+ Assert.assertTrue(type.isDirty());
+ Assert.assertTrue(type.areFieldsDirty(AbstractOseeType.NAME_FIELD_KEY));
+
+ type.clearDirty();
+ Assert.assertFalse(type.isDirty());
+ Assert.assertFalse(type.areFieldsDirty(AbstractOseeType.NAME_FIELD_KEY));
+
+ type.setName(originalName);
+ type.clearDirty();
+ }
+
+ @Test
+ public void testSetGetModificationType() {
+ Assert.assertEquals(StorageState.LOADED, type.getStorageState());
+ Assert.assertFalse(type.isDirty());
+
+ type.setStorageState(StorageState.MODIFIED);
+ Assert.assertFalse(type.isDirty());
+ type.clearDirty();
+ Assert.assertFalse(type.isDirty());
+ Assert.assertEquals(StorageState.LOADED, type.getStorageState());
+
+ type.setStorageState(StorageState.PURGED);
+ Assert.assertFalse(type.isDirty());
+ type.clearDirty();
+ Assert.assertFalse(type.isDirty());
+ Assert.assertEquals(StorageState.PURGED, type.getStorageState());
+
+ type.setStorageState(StorageState.CREATED);
+ Assert.assertFalse(type.isDirty());
+ type.clearDirty();
+ Assert.assertFalse(type.isDirty());
+ Assert.assertEquals(StorageState.LOADED, type.getStorageState());
+ }
+
+ @Test
+ public void testToString() {
+ Assert.assertEquals(String.format("%s - [%s]", name, guid), type.toString());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/ArtifactTypeTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/ArtifactTypeTest.java
new file mode 100644
index 00000000000..ba0fc9dfbe3
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/ArtifactTypeTest.java
@@ -0,0 +1,312 @@
+/*******************************************************************************
+ * 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.test.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.ArtifactType;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link ArtifactType}
+ *
+ * @author Roberto E. Escobar
+ */
+@RunWith(Parameterized.class)
+public class ArtifactTypeTest extends AbstractOseeTypeTest<ArtifactType> {
+
+ private final boolean isAbstract;
+
+ public ArtifactTypeTest(ArtifactType type, String guid, String name, boolean isAbstract) {
+ super(type, guid, name);
+ this.isAbstract = isAbstract;
+ }
+
+ @Test
+ public void testSetGetIsAbstract() throws OseeCoreException {
+ Assert.assertEquals(isAbstract, getType().isAbstract());
+ getType().clearDirty();
+ Assert.assertFalse(getType().isDirty());
+ Assert.assertFalse(getType().areFieldsDirty(ArtifactType.ARTIFACT_IS_ABSTRACT_FIELD_KEY));
+
+ // Check assigning the same value does not affect dirty
+ getType().setAbstract(isAbstract);
+ Assert.assertFalse(getType().isDirty());
+ Assert.assertFalse(getType().areFieldsDirty(ArtifactType.ARTIFACT_IS_ABSTRACT_FIELD_KEY));
+
+ getType().setAbstract(!isAbstract);
+ Assert.assertEquals(!isAbstract, getType().isAbstract());
+ Assert.assertTrue(getType().isDirty());
+ Assert.assertTrue(getType().areFieldsDirty(ArtifactType.ARTIFACT_IS_ABSTRACT_FIELD_KEY));
+
+ getType().setAbstract(isAbstract);
+ getType().clearDirty();
+ }
+
+ @Ignore
+ @Test
+ public void test() {
+
+ // getType().compareTo(other);
+
+ // getType().getAttributeTypes(branch);
+ // getType().setAttributeTypes(attributeTypes, branch);
+
+ // getType().getFieldNames();
+
+ // getType().getFirstLevelDescendantTypes();
+ // getType().getAllDescendantTypes();
+
+ // getType().getLocalAttributeTypes();
+ // getType().getSuperArtifactTypes();
+
+ // getType().setSuperType(superType);
+ }
+
+ @Override
+ public void testToString() {
+ Assert.assertEquals(getExpectedName(), getType().toString());
+ }
+
+ @Parameters
+ public static Collection<Object[]> getData() {
+ Collection<Object[]> data = new ArrayList<Object[]>();
+ boolean isAbstract = true;
+ for (int index = 1; index <= 3; index++) {
+ String guid = GUID.create();
+ String name = "index: " + index;
+ isAbstract ^= isAbstract;
+ data.add(new Object[] {new ArtifactType(guid, name, isAbstract), guid, name, isAbstract});
+ }
+ return data;
+ }
+
+ // @Override
+ // @Ignore
+ // @Test
+ // public void testPersist() throws OseeCoreException {
+ //
+ // // T item1 = data.get(0);
+ // // T item2 = data.get(1);
+ // //
+ // // cache.storeByGuid(guids);
+ // // cache.storeItem(item);
+ // // cache.storeItems(toStore);
+ // // cache.storeItems(items);
+ // // public void storeItem(AbstractOseeType item) throws OseeCoreException {
+ //
+ // // public void storeItems(T... items) throws OseeCoreException {
+ //
+ // // public void storeItems(Collection<T> toStore) throws OseeCoreException {
+ // }
+
+ // @org.junit.Test
+ // public void testArtifactInheritanceCycleDetect() throws OseeCoreException {
+ // ArtifactType baseType = artCache.getUniqueByName("BaseArtifactType");
+ // Assert.assertNotNull(baseType);
+ //
+ // Set<ArtifactType> baseSuperType = new HashSet<ArtifactType>();
+ // baseSuperType.add(baseType);
+ //
+ // try {
+ // artCache.cacheArtifactSuperType(baseType, baseSuperType);
+ // Assert.assertTrue(
+ // "This line should not be execute, an inheritance cycle should have been detected and an exception should have been thrown",
+ // false);
+ // } catch (OseeInvalidInheritanceException ex) {
+ // Assert.assertNotNull(ex);
+ // }
+ // }
+ //
+ // @org.junit.Test
+ // public void testArtifactInheritance() throws OseeCoreException {
+ // OseeTypesUtil.checkInheritance(artCache, "000", "000");// inherits from returns true if comparing against itself
+ // OseeTypesUtil.checkInheritance(artCache, "111", "000");
+ // OseeTypesUtil.checkInheritance(artCache, "222", "000");
+ // OseeTypesUtil.checkInheritance(artCache, "333", "000", "222");
+ // OseeTypesUtil.checkInheritance(artCache, "444", "000", "222", "333");
+ // OseeTypesUtil.checkInheritance(artCache, "555", "000", "444", "333", "222");
+ // OseeTypesUtil.checkInheritance(artCache, "666", "000", "333", "222");
+ // }
+ //
+ // @org.junit.Test
+ // public void testArtifactInheritanceDescendants() throws OseeCoreException {
+ // OseeTypesUtil.checkDescendants(artCache, "000", false, "111", "222");
+ // OseeTypesUtil.checkDescendants(artCache, "000", true, "111", "222", "333", "444", "555", "666");
+ //
+ // OseeTypesUtil.checkDescendants(artCache, "111", false);
+ // OseeTypesUtil.checkDescendants(artCache, "111", true);
+ //
+ // OseeTypesUtil.checkDescendants(artCache, "222", false, "333");
+ // OseeTypesUtil.checkDescendants(artCache, "222", true, "333", "444", "555", "666");
+ //
+ // OseeTypesUtil.checkDescendants(artCache, "333", false, "333", "444");
+ // OseeTypesUtil.checkDescendants(artCache, "333", true, "444", "555", "666");
+ //
+ // OseeTypesUtil.checkDescendants(artCache, "444", false, "555");
+ // OseeTypesUtil.checkDescendants(artCache, "444", true, "555");
+ // }
+ //
+ // @org.junit.Test
+ // public void testNullArtifactInheritanceCheck() throws OseeCoreException {
+ // ArtifactType baseType = artCache.getUniqueByName("BaseArtifactType");
+ // // Check for null inheritance
+ // Assert.assertFalse(baseType.inheritsFrom((ArtifactType) null));
+ // }
+ //
+ // @org.junit.Test
+ // public void testArtifactInheritanceByName() throws OseeCoreException {
+ // Assert.assertTrue(artCache.getByGuid("666").inheritsFrom("ArtifactType3")); // check inherits from using artifact name
+ // }
+ //
+ // @org.junit.Test
+ // public void testAddArtifactSuperTypeMethod() throws OseeCoreException {
+ // ArtifactType artifactType = factory.createArtifactType(artCache, "myGUID", false, "TestMethodCreated");
+ // artCache.cache(artifactType);
+ //
+ // ArtifactType baseType = artCache.getUniqueByName("BaseArtifactType");
+ // Assert.assertFalse(artifactType.inheritsFrom(baseType));
+ // Assert.assertEquals(0, artifactType.getSuperArtifactTypes().size());
+ //
+ // artifactType.setSuperType(new HashSet<ArtifactType>(Arrays.asList(baseType)));
+ // Assert.assertEquals(1, artifactType.getSuperArtifactTypes().size());
+ // Assert.assertTrue(artifactType.inheritsFrom(baseType));
+ // artCache.decache(artifactType);
+ // }
+ //
+ // @org.junit.Test
+ // public void testInheritedAttributeTypes() throws OseeCoreException {
+ // Branch branch1 = branchCache.getByGuid("ROOT");
+ // Branch branch2 = branchCache.getByGuid("TEST");
+ // Assert.assertNotNull(branch1);
+ // Assert.assertNotNull(branch2);
+ // OseeTypesUtil.checkAttributes(artCache, attrCache, "000", branch1, "AAA");
+ // OseeTypesUtil.checkAttributes(artCache, attrCache, "111", branch1, "AAA", "BBB");
+ // OseeTypesUtil.checkAttributes(artCache, attrCache, "222", branch1, "AAA", "CCC");
+ // OseeTypesUtil.checkAttributes(artCache, attrCache, "333", branch1, "AAA", "DDD", "CCC");
+ // OseeTypesUtil.checkAttributes(artCache, attrCache, "444", branch1, "AAA", "FFF", "CCC", "DDD");
+ // OseeTypesUtil.checkAttributes(artCache, attrCache, "555", branch1, "AAA", "GGG", "FFF", "CCC", "DDD");
+ // OseeTypesUtil.checkAttributes(artCache, attrCache, "666", branch1, "AAA", "HHH", "DDD", "CCC");
+ //
+ // OseeTypesUtil.checkAttributes(artCache, attrCache, "000", branch2, "AAA");
+ // OseeTypesUtil.checkAttributes(artCache, attrCache, "111", branch2, "AAA", "BBB");
+ // OseeTypesUtil.checkAttributes(artCache, attrCache, "222", branch2, "AAA", "CCC");
+ // OseeTypesUtil.checkAttributes(artCache, attrCache, "333", branch2, "AAA", "DDD", "CCC", "EEE"); // EEE only visible on branch2
+ // OseeTypesUtil.checkAttributes(artCache, attrCache, "444", branch2, "AAA", "FFF", "CCC", "DDD", "EEE");
+ // OseeTypesUtil.checkAttributes(artCache, attrCache, "555", branch2, "AAA", "GGG", "FFF", "CCC", "DDD", "EEE");
+ // OseeTypesUtil.checkAttributes(artCache, attrCache, "666", branch2, "AAA", "HHH", "DDD", "CCC", "EEE");
+ // }
+ //
+ // /*
+ // * (non-Javadoc)
+ // * @see org.eclipse.osee.framework.skynet.core.test.types.AbstractOseeCacheTest#testDirty()
+ // */
+ // @Override
+ // public void testDirty() throws OseeCoreException {
+ // }
+ //
+ // private final static class BranchDataAccessor extends MockOseeDataAccessor<Branch> {
+ //
+ // @Override
+ // public void load(AbstractOseeCache<Branch> cache) throws OseeCoreException {
+ // super.load(cache);
+ // Branch branch1 =
+ // OseeTypesUtil.createBranch(cache, factory, "ROOT", "Root Branch", BranchType.SYSTEM_ROOT,
+ // BranchState.CREATED, false);
+ // branch1.setId(999);
+ // cache.cache(branch1);
+ //
+ // Branch branch2 =
+ // OseeTypesUtil.createBranch(cache, factory, "TEST", "Test Branch", BranchType.BASELINE,
+ // BranchState.CREATED, false);
+ // branch2.setId(998);
+ // cache.cache(branch2);
+ //
+ // ((BranchCache) cache).setBranchParent(branch1, branch2);
+ // }
+ //
+ // }
+ //
+ // private final static class AttributeDataAccessor extends MockOseeDataAccessor<AttributeType> {
+ //
+ // private final List<AttributeType> attributeTypes;
+ //
+ // public AttributeDataAccessor(List<AttributeType> attributeTypes) {
+ // super();
+ // this.attributeTypes = attributeTypes;
+ // }
+ //
+ // private AttributeType createAttributeTypeHelper(AbstractOseeCache<AttributeType> cache, IOseeTypeFactory factory, String guid, String name) throws OseeCoreException {
+ // return factory.createAttributeType(cache, guid, name, "DummyBase", "DummyProvider", "none", "none", null, 1,
+ // 1, "test data", null);
+ // }
+ //
+ // @Override
+ // public void load(AbstractOseeCache<AttributeType> cache) throws OseeCoreException {
+ // super.load(cache);
+ // attributeTypes.add(createAttributeTypeHelper(cache, factory, "AAA", "Attribute1"));
+ // attributeTypes.add(createAttributeTypeHelper(cache, factory, "BBB", "Attribute2"));
+ // attributeTypes.add(createAttributeTypeHelper(cache, factory, "CCC", "Attribute3"));
+ // attributeTypes.add(createAttributeTypeHelper(cache, factory, "DDD", "Attribute4"));
+ // attributeTypes.add(createAttributeTypeHelper(cache, factory, "EEE", "Attribute5"));
+ // attributeTypes.add(createAttributeTypeHelper(cache, factory, "FFF", "Attribute6"));
+ // attributeTypes.add(createAttributeTypeHelper(cache, factory, "GGG", "Attribute7"));
+ // attributeTypes.add(createAttributeTypeHelper(cache, factory, "HHH", "Attribute8"));
+ // int typeId = 200;
+ // for (AttributeType type : attributeTypes) {
+ // type.setId(typeId++);
+ // cache.cache(type);
+ // }
+ // }
+ // }
+ //
+
+ // private void setUpArtifactTypeInheritance(ArtifactTypeCache cache) throws OseeCoreException {
+ // ArtifactType baseType = cache.getUniqueByName("BaseArtifactType");
+ //
+ // Set<ArtifactType> baseSuperType = new HashSet<ArtifactType>();
+ // baseSuperType.add(baseType);
+ // // 0<-1
+ // cache.cacheArtifactSuperType(cache.getByGuid("111"), baseSuperType);
+ // // 0<-2
+ // cache.cacheArtifactSuperType(cache.getByGuid("222"), baseSuperType);
+ // // 2<-3
+ // cache.cacheArtifactSuperType(cache.getByGuid("333"), Arrays.asList(cache.getByGuid("222")));
+ // // 3<-4
+ // cache.cacheArtifactSuperType(cache.getByGuid("444"), Arrays.asList(cache.getByGuid("333")));
+ // // 4<-5
+ // cache.cacheArtifactSuperType(cache.getByGuid("555"), Arrays.asList(cache.getByGuid("444")));
+ // // 3<-6
+ // cache.cacheArtifactSuperType(cache.getByGuid("666"), Arrays.asList(cache.getByGuid("333")));
+ // }
+ //
+ // private void setUpTypeValidity(ArtifactTypeCache cache) throws OseeCoreException {
+ // Branch branch1 = branchCache.getByGuid("ROOT");
+ // Branch branch2 = branchCache.getByGuid("TEST");
+ // Assert.assertNotNull(branch1);
+ // Assert.assertNotNull(branch2);
+ // cache.cacheTypeValidity(cache.getByGuid("000"), attributeCache.getByGuid("AAA"), branch1);
+ // cache.cacheTypeValidity(cache.getByGuid("111"), attributeCache.getByGuid("BBB"), branch1);
+ // cache.cacheTypeValidity(cache.getByGuid("222"), attributeCache.getByGuid("CCC"), branch1);
+ // cache.cacheTypeValidity(cache.getByGuid("333"), attributeCache.getByGuid("DDD"), branch1);
+ // cache.cacheTypeValidity(cache.getByGuid("333"), attributeCache.getByGuid("EEE"), branch2);
+ // cache.cacheTypeValidity(cache.getByGuid("444"), attributeCache.getByGuid("FFF"), branch1);
+ // cache.cacheTypeValidity(cache.getByGuid("555"), attributeCache.getByGuid("GGG"), branch1);
+ // cache.cacheTypeValidity(cache.getByGuid("666"), attributeCache.getByGuid("HHH"), branch1);
+ // }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/AttributeTypeTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/AttributeTypeTest.java
new file mode 100644
index 00000000000..6eac8c2f1a0
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/AttributeTypeTest.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.test.model;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AttributeTypeTest {
+ @Ignore
+ @Test
+ public void test() {
+
+ }
+ //
+ // @Override
+ // public void testDirty() throws OseeCoreException {
+ // AttributeType attributeType = OseeTypesUtil.createAttributeType(attrCache, factory, "GUID", "AttributeDirtyTest");
+ // Assert.assertTrue(attributeType.isDirty());
+ // attributeType.clearDirty();
+ //
+ // String initialValue = attributeType.getName();
+ // attributeType.setName("My Name Has Changes");
+ // Assert.assertTrue(attributeType.isDirty());
+ //
+ // // Remains Dirty
+ // attributeType.setName(initialValue);
+ // Assert.assertTrue(attributeType.isDirty());
+ //
+ // // attributeType.setFields(name, baseAttributeTypeId, attributeProviderNameId, baseAttributeClass,
+ // // providerAttributeClass, fileTypeExtension, defaultValue, oseeEnumType, minOccurrences, maxOccurrences,
+ // // description, taggerId);
+ //
+ // }
+ //
+ // // private void checkDirty(AttributeType attributeType) {
+ // // // DirtyStateDetail details = attributeType.getDirtyDetails();
+ // // // details.
+ // // }
+ //
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/BaseOseeTypeTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/BaseOseeTypeTest.java
new file mode 100644
index 00000000000..04360388073
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/BaseOseeTypeTest.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.test.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import org.eclipse.osee.framework.core.test.mocks.MockAbstractOseeType;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link AbstractOseeTest}
+ *
+ * @author Roberto E. Escobar
+ */
+@RunWith(Parameterized.class)
+public class BaseOseeTypeTest extends AbstractOseeTypeTest<MockAbstractOseeType> {
+
+ public BaseOseeTypeTest(MockAbstractOseeType type, String guid, String name) {
+ super(type, guid, name);
+ }
+
+ @Parameters
+ public static Collection<Object[]> getData() {
+ Collection<Object[]> data = new ArrayList<Object[]>();
+ for (int index = 1; index <= 2; index++) {
+ String guid = GUID.create();
+ String name = "index: " + index;
+ data.add(new Object[] {new MockAbstractOseeType(guid, name), guid, name});
+ }
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/BranchTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/BranchTest.java
new file mode 100644
index 00000000000..c047ba5200e
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/BranchTest.java
@@ -0,0 +1,331 @@
+/*******************************************************************************
+ * 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.test.model;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class BranchTest {
+
+ @Ignore
+ @Test
+ public void test() {
+
+ }
+
+ // @Test
+ // public void testSystemRootBranch() throws OseeCoreException {
+ // Branch systemRootBranch = cache.getSystemRootBranch();
+ // Assert.assertNotNull(systemRootBranch);
+ // }
+ //
+ // @Test
+ // public void testBranchHierarchy() throws OseeCoreException {
+ // OseeTypesUtil.checkHierarchy(cache, "AAA", "BBB", "CCC");
+ // OseeTypesUtil.checkHierarchy(cache, "BBB", "DDD", "EEE");
+ // OseeTypesUtil.checkHierarchy(cache, "CCC", "FFF", "GGG", "HHH");
+ // }
+ //
+ // @Test
+ // public void testMergeBranches() throws OseeCoreException {
+ // OseeTypesUtil.checkMergeBranch(cache, null, "HHH", "AAA");
+ // OseeTypesUtil.checkMergeBranch(cache, "III", "DDD", "BBB");
+ // OseeTypesUtil.checkMergeBranch(cache, "JJJ", "GGG", "CCC");
+ // OseeTypesUtil.checkMergeBranch(cache, "KKK", "HHH", "CCC");
+ // }
+ //
+ // @Test
+ // public void testBranchAliases() throws OseeCoreException {
+ // OseeTypesUtil.checkAliases(cache, "AAA", "root", "system", "main");
+ // OseeTypesUtil.checkAliases(cache, "BBB", "base 1", "build 1", "common");
+ // OseeTypesUtil.checkAliases(cache, "CCC", "base 2", "build 2");
+ //
+ // OseeTypesUtil.checkAliases(cache, "DDD");
+ // OseeTypesUtil.checkAliases(cache, "EEE");
+ // OseeTypesUtil.checkAliases(cache, "FFF");
+ // OseeTypesUtil.checkAliases(cache, "GGG");
+ // OseeTypesUtil.checkAliases(cache, "HHH");
+ // OseeTypesUtil.checkAliases(cache, "III");
+ // }
+ //
+ // @Test
+ // public void testSameAliasForMultipleBranches() throws OseeCoreException {
+ // OseeTypesUtil.checkAliases(cache, "JJJ", "a merge branch");
+ // OseeTypesUtil.checkAliases(cache, "KKK", "a merge branch");
+ //
+ // List<Branch> aliasedbranch = new ArrayList<Branch>(cache.getByAlias("a merge branch"));
+ // Assert.assertEquals(2, aliasedbranch.size());
+ //
+ // Collections.sort(aliasedbranch);
+ // Assert.assertEquals(cache.getByGuid("JJJ"), aliasedbranch.get(0));
+ // Assert.assertEquals(cache.getByGuid("KKK"), aliasedbranch.get(1));
+ // }
+ //
+ // @Test
+ // public void testSetAliasForBranch() throws OseeCoreException {
+ // Branch branch = cache.getByGuid("JJJ");
+ // Assert.assertNotNull(branch);
+ //
+ // branch.setAliases("One", "Two", "Three");
+ // OseeTypesUtil.checkAliases(cache, "JJJ", "one", "two", "three");
+ //
+ // branch.setAliases("One", "Three");
+ // OseeTypesUtil.checkAliases(cache, "JJJ", "one", "three");
+ //
+ // branch.setAliases();
+ // OseeTypesUtil.checkAliases(cache, "JJJ");
+ //
+ // branch.setAliases("a merge branch");
+ // OseeTypesUtil.checkAliases(cache, "JJJ", "a merge branch");
+ // }
+ //
+ // @Test
+ // public void testBaseTransaction() throws OseeCoreException {
+ // Branch branch = cache.getByGuid("BBB");
+ // Assert.assertNotNull(branch);
+ //
+ // Assert.assertNull(branch.getBaseTransaction());
+ //
+ // TransactionRecord expectedTx =
+ // new TransactionRecord(1, branch, "Transaction 1", new Date(), 1, 2, TransactionDetailsType.Baselined);
+ // cache.cacheBaseTransaction(branch, expectedTx);
+ //
+ // TransactionRecord actualTx = branch.getBaseTransaction();
+ // Assert.assertEquals(expectedTx, actualTx);
+ // }
+ //
+ // @Test
+ // public void testInvalidBaseTransactionCaching() throws OseeCoreException {
+ // Branch branch = cache.getByGuid("BBB");
+ // Assert.assertNotNull(branch);
+ // TransactionRecord expectedTx =
+ // new TransactionRecord(1, branch, "Transaction 1", new Date(), 1, 2, TransactionDetailsType.NonBaselined);
+ //
+ // try {
+ // cache.cacheBaseTransaction(null, expectedTx);
+ // Assert.assertTrue("This line should not be executed", true);
+ // } catch (Exception ex) {
+ // Assert.assertTrue(ex instanceof OseeArgumentException);
+ // }
+ //
+ // try {
+ // cache.cacheBaseTransaction(branch, null);
+ // Assert.assertTrue("This line should not be executed", true);
+ // } catch (Exception ex) {
+ // Assert.assertTrue(ex instanceof OseeArgumentException);
+ // }
+ //
+ // try {
+ // cache.cacheBaseTransaction(branch, expectedTx);
+ // Assert.assertTrue("This line should not be executed", true);
+ // } catch (Exception ex) {
+ // Assert.assertTrue(ex instanceof OseeArgumentException);
+ // }
+ // }
+ //
+ // @Test
+ // public void testSourceTransaction() throws OseeCoreException {
+ // Branch branch = cache.getByGuid("BBB");
+ // Assert.assertNotNull(branch);
+ //
+ // Assert.assertNull(branch.getSourceTransaction());
+ //
+ // TransactionRecord expectedTx =
+ // new TransactionRecord(1, null, "Transaction 1", new Date(), 1, 2, TransactionDetailsType.NonBaselined);
+ // cache.cacheSourceTransaction(branch, expectedTx);
+ //
+ // TransactionRecord actualTx = branch.getSourceTransaction();
+ // Assert.assertEquals(expectedTx, actualTx);
+ // }
+ //
+ // @Test
+ // public void testInvalidSourceTransaction() throws OseeCoreException {
+ // Branch branch = cache.getByGuid("BBB");
+ // Assert.assertNotNull(branch);
+ // TransactionRecord expectedTx =
+ // new TransactionRecord(1, branch, "Transaction 1", new Date(), 1, 2, TransactionDetailsType.NonBaselined);
+ // cache.cacheSourceTransaction(branch, expectedTx);
+ //
+ // try {
+ // cache.cacheSourceTransaction(null, expectedTx);
+ // Assert.assertTrue("This line should not be executed", true);
+ // } catch (Exception ex) {
+ // Assert.assertTrue(ex instanceof OseeArgumentException);
+ // }
+ //
+ // try {
+ // cache.cacheSourceTransaction(branch, null);
+ // Assert.assertTrue("This line should not be executed", true);
+ // } catch (Exception ex) {
+ // Assert.assertTrue(ex instanceof OseeArgumentException);
+ // }
+ // }
+ //
+ // @Test
+ // public void testAssociatedArtifact() throws OseeCoreException {
+ // Assert.assertEquals(defaultAssociatedArtifact, cache.getDefaultAssociatedArtifact());
+ //
+ // Branch branch = cache.getByGuid("BBB");
+ // Assert.assertNotNull(branch);
+ //
+ // Assert.assertEquals(defaultAssociatedArtifact, branch.getAssociatedArtifact());
+ //
+ // String guid = GUID.create();
+ // IBasicArtifact<?> expectedArtifact = new TestArtifact(100, guid, "Test Artifact");
+ // branch.setAssociatedArtifact(expectedArtifact);
+ //
+ // Assert.assertEquals(branch.getAssociatedArtifact(), expectedArtifact);
+ //
+ // branch.setAssociatedArtifact(null);
+ // Assert.assertEquals(defaultAssociatedArtifact, branch.getAssociatedArtifact());
+ // }
+ //
+ // @Override
+ // public void testDirty() throws OseeCoreException {
+ // // TODO test Rename
+ //
+ // // AttributeType attributeType = OseeTypesUtil.createAttributeType(attrCache, factory, "GUID", "AttributeDirtyTest");
+ // // Assert.assertTrue(attributeType.isDirty());
+ // // attributeType.clearDirty();
+ // //
+ // // String initialValue = attributeType.getName();
+ // // attributeType.setName("My Name Has Changes");
+ // // Assert.assertTrue(attributeType.isDirty());
+ // //
+ // // // Remains Dirty
+ // // attributeType.setName(initialValue);
+ // // Assert.assertTrue(attributeType.isDirty());
+ // //
+ // // // attributeType.setFields(name, baseAttributeTypeId, attributeProviderNameId, baseAttributeClass,
+ // // // providerAttributeClass, fileTypeExtension, defaultValue, oseeEnumType, minOccurrences, maxOccurrences,
+ // // // description, taggerId);
+ //
+ // }
+ //
+ // private final static class TestArtifact implements IBasicArtifact<Object> {
+ //
+ // private final int artId;
+ // private final String guid;
+ // private final String name;
+ //
+ // public TestArtifact(int uniqueId, String guid, String name) {
+ // this.artId = uniqueId;
+ // this.guid = guid;
+ // this.name = name;
+ // }
+ //
+ // @Override
+ // public int getArtId() {
+ // return artId;
+ // }
+ //
+ // @Override
+ // public ArtifactType getArtifactType() {
+ // return null;
+ // }
+ //
+ // @Override
+ // public IBasicArtifact<Object> getFullArtifact() throws OseeCoreException {
+ // return null;
+ // }
+ //
+ // @Override
+ // public String getGuid() {
+ // return guid;
+ // }
+ //
+ // @Override
+ // public String getName() {
+ // return name;
+ // }
+ //
+ // @Override
+ // public Branch getBranch() {
+ // return null;
+ // }
+ // }
+ //
+ // private final static class BranchDataAccessor extends MockOseeDataAccessor<Branch> {
+ //
+ // private final List<Branch> data;
+ //
+ // public BranchDataAccessor(List<Branch> data) {
+ // super();
+ // this.data = data;
+ // }
+ //
+ // @Override
+ // public void load(AbstractOseeCache<Branch> cache) throws OseeCoreException {
+ // super.load(cache);
+ // data.add(OseeTypesUtil.createBranch(cache, factory, "AAA", "Root", BranchType.SYSTEM_ROOT,
+ // BranchState.CREATED, false));
+ //
+ // data.add(OseeTypesUtil.createBranch(cache, factory, "BBB", "B-Branch", BranchType.BASELINE,
+ // BranchState.CREATED, false));
+ // data.add(OseeTypesUtil.createBranch(cache, factory, "CCC", "C-Branch", BranchType.BASELINE,
+ // BranchState.MODIFIED, false));
+ //
+ // data.add(OseeTypesUtil.createBranch(cache, factory, "DDD", "D-Branch", BranchType.WORKING,
+ // BranchState.MODIFIED, false));
+ // data.add(OseeTypesUtil.createBranch(cache, factory, "EEE", "E-Branch", BranchType.WORKING,
+ // BranchState.MODIFIED, false));
+ //
+ // data.add(OseeTypesUtil.createBranch(cache, factory, "FFF", "F-Branch", BranchType.WORKING,
+ // BranchState.MODIFIED, false));
+ // data.add(OseeTypesUtil.createBranch(cache, factory, "GGG", "G-Branch", BranchType.WORKING,
+ // BranchState.MODIFIED, true));
+ // data.add(OseeTypesUtil.createBranch(cache, factory, "HHH", "H-Branch", BranchType.WORKING,
+ // BranchState.MODIFIED, true));
+ //
+ // // Merge Branches
+ // data.add(OseeTypesUtil.createBranch(cache, factory, "III", "Merge-A", BranchType.MERGE, BranchState.CREATED,
+ // false));
+ // data.add(OseeTypesUtil.createBranch(cache, factory, "JJJ", "Merge-B", BranchType.MERGE, BranchState.CREATED,
+ // false));
+ // data.add(OseeTypesUtil.createBranch(cache, factory, "KKK", "Merge-C", BranchType.MERGE, BranchState.CREATED,
+ // false));
+ //
+ // int typeId = 500;
+ // for (Branch type : data) {
+ // type.setId(typeId++);
+ // cache.cache(type);
+ // }
+ // BranchCache branchCache = (BranchCache) cache;
+ // loadBranchHierarchy(branchCache);
+ // loadMergeBranches(branchCache);
+ // loadBranchAliases(branchCache);
+ // }
+ //
+ // private void loadBranchHierarchy(BranchCache cache) throws OseeCoreException {
+ // OseeTypesUtil.createBranchHierarchy(cache, "AAA", "BBB", "CCC");
+ // OseeTypesUtil.createBranchHierarchy(cache, "BBB", "DDD", "EEE");
+ // OseeTypesUtil.createBranchHierarchy(cache, "CCC", "FFF", "GGG", "HHH");
+ // }
+ //
+ // private void loadMergeBranches(BranchCache branchCache) throws OseeCoreException {
+ // OseeTypesUtil.createMergeBranch(cache, "III", "DDD", "BBB");
+ // OseeTypesUtil.createMergeBranch(cache, "JJJ", "GGG", "CCC");
+ // OseeTypesUtil.createMergeBranch(cache, "KKK", "HHH", "CCC");
+ // }
+ //
+ // private void loadBranchAliases(BranchCache branchCache) throws OseeCoreException {
+ // OseeTypesUtil.createAlias(cache, "AAA", "Root", "System", "Main");
+ // OseeTypesUtil.createAlias(cache, "BBB", "Base 1", "Build 1", "common");
+ // OseeTypesUtil.createAlias(cache, "CCC", "Base 2", "Build 2");
+ //
+ // OseeTypesUtil.createAlias(cache, "JJJ", "a merge branch");
+ // OseeTypesUtil.createAlias(cache, "KKK", "a merge branch");
+ // }
+ // }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/ModelTestSuite.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/ModelTestSuite.java
new file mode 100644
index 00000000000..bbc1e3c9941
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/ModelTestSuite.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.test.model;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {//
+ArtifactTypeTest.class, //
+ AttributeTypeTest.class, //
+ BaseOseeTypeTest.class, //
+ BranchTest.class, //
+ OseeEnumTypeTest.class, //
+ RelationTypeTest.class, //
+})
+/**
+ * @author Roberto E. Escobar
+ */
+public class ModelTestSuite {
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/OseeEnumTypeTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/OseeEnumTypeTest.java
new file mode 100644
index 00000000000..73980d79659
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/OseeEnumTypeTest.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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.test.model;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OseeEnumTypeTest {
+ @Ignore
+ @Test
+ public void test() {
+
+ }
+ // @Override
+ // public void testDirty() throws OseeCoreException {
+ // }
+ //
+ // @org.junit.Test
+ // public void testAddOseeEnumEntry() throws OseeCoreException {
+ // OseeEnumType enum1 =
+ // OseeTypesUtil.createEnumType(cache, factory, "Test 1", "Test 1", "OneEntry", 0, "TwoEntry", 1);
+ // OseeTypesUtil.checkOseeEnumEntries(enum1.values(), "OneEntry", 0, "TwoEntry", 1);
+ //
+ // OseeEnumEntry entry = factory.createEnumEntry(cache, "C", "AddedEntry", 4);
+ // enum1.addEntry(entry);
+ //
+ // OseeTypesUtil.checkOseeEnumEntries(enum1.values(), "OneEntry", 0, "TwoEntry", 1, "AddedEntry", 4);
+ //
+ // enum1.removeEntry(entry);
+ // OseeTypesUtil.checkOseeEnumEntries(enum1.values(), "OneEntry", 0, "TwoEntry", 1);
+ //
+ // enum1.removeEntry(enum1.values()[0]);
+ // OseeTypesUtil.checkOseeEnumEntries(enum1.values(), "TwoEntry", 1);
+ // }
+ //
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/RelationTypeTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/RelationTypeTest.java
new file mode 100644
index 00000000000..d436d7d1d24
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/model/RelationTypeTest.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * 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.test.model;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class RelationTypeTest {
+ @Ignore
+ @Test
+ public void test() {
+
+ }
+ // @org.junit.Test
+ // public void testRelationTypeSides() throws OseeCoreException {
+ // OseeTypesUtil.checkRelationTypeInheritance(cache, artCache, "1A", RelationSide.SIDE_A, 1, "111");
+ // OseeTypesUtil.checkRelationTypeInheritance(cache, artCache, "1A", RelationSide.SIDE_B, 1, "444", "555");
+ //
+ // OseeTypesUtil.checkRelationTypeInheritance(cache, artCache, "2B", RelationSide.SIDE_A, 1, "555");
+ // OseeTypesUtil.checkRelationTypeInheritance(cache, artCache, "2B", RelationSide.SIDE_B, Integer.MAX_VALUE, "000",
+ // "111", "222", "333", "444", "555", "666");
+ //
+ // OseeTypesUtil.checkRelationTypeInheritance(cache, artCache, "3C", RelationSide.SIDE_A, Integer.MAX_VALUE, "222",
+ // "333", "444", "555", "666");
+ // OseeTypesUtil.checkRelationTypeInheritance(cache, artCache, "3C", RelationSide.SIDE_B, 1, "333", "444", "555",
+ // "666");
+ //
+ // OseeTypesUtil.checkRelationTypeInheritance(cache, artCache, "4D", RelationSide.SIDE_A, Integer.MAX_VALUE, "666");
+ // OseeTypesUtil.checkRelationTypeInheritance(cache, artCache, "4D", RelationSide.SIDE_B, Integer.MAX_VALUE, "666");
+ // }
+ //
+ // @Override
+ // public void testDirty() throws OseeCoreException {
+ // }
+ //
+ // private final static class ArtifactDataAccessor extends MockOseeDataAccessor<ArtifactType> {
+ // private final List<ArtifactType> artifactTypes;
+ //
+ // public ArtifactDataAccessor(List<ArtifactType> artifactTypes) {
+ // super();
+ // this.artifactTypes = artifactTypes;
+ // }
+ //
+ // @Override
+ // public void load(AbstractOseeCache<ArtifactType> cache) throws OseeCoreException {
+ // super.load(cache);
+ // artifactTypes.add(factory.createArtifactType(cache, "000", true, "BaseArtifactType"));
+ // artifactTypes.add(factory.createArtifactType(cache, "111", true, "ArtifactType1"));
+ // artifactTypes.add(factory.createArtifactType(cache, "222", false, "ArtifactType2"));
+ // artifactTypes.add(factory.createArtifactType(cache, "333", true, "ArtifactType3"));
+ // artifactTypes.add(factory.createArtifactType(cache, "444", false, "ArtifactType4"));
+ // artifactTypes.add(factory.createArtifactType(cache, "555", true, "ArtifactType5"));
+ // artifactTypes.add(factory.createArtifactType(cache, "666", false, "ArtifactType6"));
+ // int typeId = 100;
+ // for (ArtifactType type : artifactTypes) {
+ // type.setId(typeId++);
+ // cache.cache(type);
+ // }
+ // ArtifactTypeCache artCache = (ArtifactTypeCache) cache;
+ // setUpArtifactTypeInheritance(artCache);
+ // }
+ //
+ // private void setUpArtifactTypeInheritance(ArtifactTypeCache cache) throws OseeCoreException {
+ // ArtifactType baseType = cache.getUniqueByName("BaseArtifactType");
+ //
+ // Set<ArtifactType> baseSuperType = new HashSet<ArtifactType>();
+ // baseSuperType.add(baseType);
+ // // 0<-1
+ // cache.cacheArtifactSuperType(cache.getByGuid("111"), baseSuperType);
+ // // 0<-2
+ // cache.cacheArtifactSuperType(cache.getByGuid("222"), baseSuperType);
+ // // 2<-3
+ // cache.cacheArtifactSuperType(cache.getByGuid("333"), Arrays.asList(cache.getByGuid("222")));
+ // // 2,3<-4
+ // cache.cacheArtifactSuperType(cache.getByGuid("444"), Arrays.asList(cache.getByGuid("222"),
+ // cache.getByGuid("333"), baseType));
+ // // 4<-5
+ // cache.cacheArtifactSuperType(cache.getByGuid("555"), Arrays.asList(cache.getByGuid("444"), baseType));
+ // // 3<-6
+ // cache.cacheArtifactSuperType(cache.getByGuid("666"), Arrays.asList(cache.getByGuid("333"), baseType));
+ // }
+ // }
+ //
+ // private final static class RelationDataAccessor extends MockOseeDataAccessor<RelationType> {
+ // private final List<RelationType> relationTypes;
+ // private final AbstractOseeCache<ArtifactType> artCache;
+ //
+ // public RelationDataAccessor(AbstractOseeCache<ArtifactType> artCache, List<RelationType> relationTypes) {
+ // super();
+ // this.artCache = artCache;
+ // this.relationTypes = relationTypes;
+ // }
+ //
+ // @Override
+ // public void load(AbstractOseeCache<RelationType> cache) throws OseeCoreException {
+ // artCache.ensurePopulated();
+ // super.load(cache);
+ // relationTypes.add(OseeTypesUtil.createRelationType(cache, artCache, factory, "1A", "REL_1", "111", "444",
+ // RelationTypeMultiplicity.ONE_TO_ONE));
+ // relationTypes.add(OseeTypesUtil.createRelationType(cache, artCache, factory, "2B", "REL_2", "555", "000",
+ // RelationTypeMultiplicity.ONE_TO_MANY));
+ // relationTypes.add(OseeTypesUtil.createRelationType(cache, artCache, factory, "3C", "REL_3", "222", "333",
+ // RelationTypeMultiplicity.MANY_TO_ONE));
+ // relationTypes.add(OseeTypesUtil.createRelationType(cache, artCache, factory, "4D", "REL_4", "666", "666",
+ // RelationTypeMultiplicity.MANY_TO_MANY));
+ // int typeId = 300;
+ // for (RelationType type : relationTypes) {
+ // type.setId(typeId++);
+ // cache.cache(type);
+ // }
+ // }
+ // }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BaseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BaseTranslatorTest.java
new file mode 100644
index 00000000000..6ad5435673b
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/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.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.test/src/org/eclipse/osee/framework/core/test/translation/BranchChangeArchivedStateRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchChangeArchivedStateRequestTranslatorTest.java
new file mode 100644
index 00000000000..2c5032c5802
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchChangeArchivedStateRequestTranslatorTest.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.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.data.ChangeBranchArchiveStateRequest;
+import org.eclipse.osee.framework.core.enums.BranchArchivedState;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.translation.BranchChangeArchivedStateRequestTranslator;
+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.test/src/org/eclipse/osee/framework/core/test/translation/BranchChangeStateRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchChangeStateRequestTranslatorTest.java
new file mode 100644
index 00000000000..e202a60e67c
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchChangeStateRequestTranslatorTest.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.data.ChangeBranchStateRequest;
+import org.eclipse.osee.framework.core.enums.BranchState;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.translation.BranchChangeStateRequestTranslator;
+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.test/src/org/eclipse/osee/framework/core/test/translation/BranchChangeTypeRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchChangeTypeRequestTranslatorTest.java
new file mode 100644
index 00000000000..e3143a7855f
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchChangeTypeRequestTranslatorTest.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.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.data.ChangeBranchTypeRequest;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.translation.BranchChangeStateRequestTranslator;
+import org.eclipse.osee.framework.core.translation.BranchChangeTypeRequestTranslator;
+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.test/src/org/eclipse/osee/framework/core/test/translation/BranchCommitRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchCommitRequestTranslatorTest.java
new file mode 100644
index 00000000000..6a113257b71
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchCommitRequestTranslatorTest.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.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.data.BranchCommitRequest;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.translation.BranchCommitRequestTranslator;
+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.test/src/org/eclipse/osee/framework/core/test/translation/BranchCommitResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchCommitResponseTranslatorTest.java
new file mode 100644
index 00000000000..90fdbc7e2ff
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchCommitResponseTranslatorTest.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.data.BranchCommitResponse;
+import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.services.IDataTranslationService;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.translation.BranchCommitResponseTranslator;
+import org.eclipse.osee.framework.core.translation.DataTranslationService;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.core.translation.TransactionRecordTranslator;
+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 = MockDataFactory.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.test/src/org/eclipse/osee/framework/core/test/translation/BranchCreationRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchCreationRequestTranslatorTest.java
new file mode 100644
index 00000000000..5c0aa9a406e
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchCreationRequestTranslatorTest.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.data.BranchCreationRequest;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.translation.BranchCreationRequestTranslator;
+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[] {MockDataFactory.createBranchCreateRequest(45), translator});
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchCreationResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchCreationResponseTranslatorTest.java
new file mode 100644
index 00000000000..ac0931a6f27
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/BranchCreationResponseTranslatorTest.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.data.BranchCreationResponse;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.translation.BranchCreationResponseTranslator;
+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[] {MockDataFactory.createBranchCreateResponse(55), translator});
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/CacheUpdateRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/CacheUpdateRequestTranslatorTest.java
new file mode 100644
index 00000000000..5ef8e831a5d
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/CacheUpdateRequestTranslatorTest.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * 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.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.data.CacheUpdateRequest;
+import org.eclipse.osee.framework.core.enums.OseeCacheEnum;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.translation.CacheUpdateRequestTranslator;
+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[] {MockDataFactory.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.test/src/org/eclipse/osee/framework/core/test/translation/ChangeItemTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeItemTranslatorTest.java
new file mode 100644
index 00000000000..26d87eaa55e
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeItemTranslatorTest.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * 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.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.eclipse.osee.framework.core.data.ChangeItem;
+import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.translation.ChangeItemTranslator;
+import org.eclipse.osee.framework.core.translation.ChangeVersionTranslator;
+import org.eclipse.osee.framework.core.translation.DataTranslationService;
+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[] {MockDataFactory.createArtifactChangeItem(), translator});
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeReportResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeReportResponseTranslatorTest.java
new file mode 100644
index 00000000000..fcbf58aac94
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/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.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.osee.framework.core.data.ChangeItem;
+import org.eclipse.osee.framework.core.data.ChangeReportResponse;
+import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.translation.ChangeItemTranslator;
+import org.eclipse.osee.framework.core.translation.ChangeReportResponseTranslator;
+import org.eclipse.osee.framework.core.translation.ChangeVersionTranslator;
+import org.eclipse.osee.framework.core.translation.DataTranslationService;
+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(MockDataFactory.createArtifactChangeItem());
+ response.addItem(MockDataFactory.createArtifactChangeItem());
+ response.addItem(MockDataFactory.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.test/src/org/eclipse/osee/framework/core/test/translation/ChangeVersionTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeVersionTranslatorTest.java
new file mode 100644
index 00000000000..f447ad651a6
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/ChangeVersionTranslatorTest.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.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.eclipse.osee.framework.core.data.ChangeVersion;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.translation.ChangeVersionTranslator;
+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[] {MockDataFactory.createChangeVersion(22), translator});
+ return data;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/DataAsserts.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/DataAsserts.java
new file mode 100644
index 00000000000..ae6875dfa47
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/DataAsserts.java
@@ -0,0 +1,282 @@
+/*******************************************************************************
+ * 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.test.translation;
+
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.data.BranchCommitRequest;
+import org.eclipse.osee.framework.core.data.BranchCommitResponse;
+import org.eclipse.osee.framework.core.data.BranchCreationRequest;
+import org.eclipse.osee.framework.core.data.BranchCreationResponse;
+import org.eclipse.osee.framework.core.data.CacheUpdateRequest;
+import org.eclipse.osee.framework.core.data.ChangeBranchArchiveStateRequest;
+import org.eclipse.osee.framework.core.data.ChangeBranchStateRequest;
+import org.eclipse.osee.framework.core.data.ChangeBranchTypeRequest;
+import org.eclipse.osee.framework.core.data.ChangeItem;
+import org.eclipse.osee.framework.core.data.ChangeVersion;
+import org.eclipse.osee.framework.core.data.IBasicArtifact;
+import org.eclipse.osee.framework.core.data.OseeImportModelRequest;
+import org.eclipse.osee.framework.core.data.OseeImportModelResponse;
+import org.eclipse.osee.framework.core.data.PurgeBranchRequest;
+import org.eclipse.osee.framework.core.data.TableData;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.AbstractOseeType;
+import org.eclipse.osee.framework.core.model.ArtifactType;
+import org.eclipse.osee.framework.core.model.AttributeType;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.RelationType;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.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.getTransactionNumber(), actual.getTransactionNumber());
+ 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.test/src/org/eclipse/osee/framework/core/test/translation/DataTranslationServiceFactoryTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/DataTranslationServiceFactoryTest.java
new file mode 100644
index 00000000000..f9622d526e4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/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.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.services.IDataTranslationService;
+import org.eclipse.osee.framework.core.services.ITranslatorId;
+import org.eclipse.osee.framework.core.test.mocks.MockOseeCachingServiceProvider;
+import org.eclipse.osee.framework.core.test.mocks.MockOseeModelFactoryServiceProvider;
+import org.eclipse.osee.framework.core.translation.ArtifactTypeCacheUpdateResponseTranslator;
+import org.eclipse.osee.framework.core.translation.AttributeTypeCacheUpdateResponseTranslator;
+import org.eclipse.osee.framework.core.translation.BranchCacheStoreRequestTranslator;
+import org.eclipse.osee.framework.core.translation.BranchCacheUpdateResponseTranslator;
+import org.eclipse.osee.framework.core.translation.BranchCommitRequestTranslator;
+import org.eclipse.osee.framework.core.translation.BranchCommitResponseTranslator;
+import org.eclipse.osee.framework.core.translation.BranchCreationRequestTranslator;
+import org.eclipse.osee.framework.core.translation.BranchCreationResponseTranslator;
+import org.eclipse.osee.framework.core.translation.CacheUpdateRequestTranslator;
+import org.eclipse.osee.framework.core.translation.ChangeItemTranslator;
+import org.eclipse.osee.framework.core.translation.ChangeReportRequestTranslator;
+import org.eclipse.osee.framework.core.translation.ChangeReportResponseTranslator;
+import org.eclipse.osee.framework.core.translation.ChangeVersionTranslator;
+import org.eclipse.osee.framework.core.translation.DataTranslationServiceFactory;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.core.translation.OseeEnumTypeCacheUpdateResponseTranslator;
+import org.eclipse.osee.framework.core.translation.OseeImportModelRequestTranslator;
+import org.eclipse.osee.framework.core.translation.OseeImportModelResponseTranslator;
+import org.eclipse.osee.framework.core.translation.RelationTypeCacheUpdateResponseTranslator;
+import org.eclipse.osee.framework.core.translation.TableDataTranslator;
+import org.eclipse.osee.framework.core.translation.TransactionCacheUpdateResponseTranslator;
+import org.eclipse.osee.framework.core.translation.TransactionRecordTranslator;
+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.test/src/org/eclipse/osee/framework/core/test/translation/DataTranslationServiceTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/DataTranslationServiceTest.java
new file mode 100644
index 00000000000..f6c43dc6fcd
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/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.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.services.IDataTranslationService;
+import org.eclipse.osee.framework.core.services.ITranslatorId;
+import org.eclipse.osee.framework.core.translation.DataTranslationService;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+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.test/src/org/eclipse/osee/framework/core/test/translation/OseeImportModelRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/OseeImportModelRequestTranslatorTest.java
new file mode 100644
index 00000000000..7a8db7d9b27
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/OseeImportModelRequestTranslatorTest.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.data.OseeImportModelRequest;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.core.translation.OseeImportModelRequestTranslator;
+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.test/src/org/eclipse/osee/framework/core/test/translation/OseeImportModelResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/OseeImportModelResponseTranslatorTest.java
new file mode 100644
index 00000000000..7ccb581df5c
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/OseeImportModelResponseTranslatorTest.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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.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.data.OseeImportModelResponse;
+import org.eclipse.osee.framework.core.data.TableData;
+import org.eclipse.osee.framework.core.enums.CoreTranslatorId;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.services.IDataTranslationService;
+import org.eclipse.osee.framework.core.translation.DataTranslationService;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.core.translation.OseeImportModelResponseTranslator;
+import org.eclipse.osee.framework.core.translation.TableDataTranslator;
+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.test/src/org/eclipse/osee/framework/core/test/translation/PurgeBranchRequestTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/PurgeBranchRequestTranslatorTest.java
new file mode 100644
index 00000000000..cec4e678a6a
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/PurgeBranchRequestTranslatorTest.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.framework.core.data.PurgeBranchRequest;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.core.translation.PurgeBranchRequestTranslator;
+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.test/src/org/eclipse/osee/framework/core/test/translation/TableDataTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/TableDataTranslatorTest.java
new file mode 100644
index 00000000000..c5a5ce5a2f0
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/TableDataTranslatorTest.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.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.data.TableData;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.core.translation.TableDataTranslator;
+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.test/src/org/eclipse/osee/framework/core/test/translation/TransactionCacheUpdateResponseTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/TransactionCacheUpdateResponseTranslatorTest.java
new file mode 100644
index 00000000000..0f2bd026085
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/TransactionCacheUpdateResponseTranslatorTest.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.test.translation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.framework.core.data.TransactionCacheUpdateResponse;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.TransactionRecord;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.core.translation.TransactionCacheUpdateResponseTranslator;
+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 = MockDataFactory.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.test/src/org/eclipse/osee/framework/core/test/translation/TransactionRecordTranslatorTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/TransactionRecordTranslatorTest.java
new file mode 100644
index 00000000000..cc3adb13d7a
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/TransactionRecordTranslatorTest.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.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.model.TransactionRecord;
+import org.eclipse.osee.framework.core.services.IOseeModelFactoryServiceProvider;
+import org.eclipse.osee.framework.core.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.core.translation.ITranslator;
+import org.eclipse.osee.framework.core.translation.TransactionRecordTranslator;
+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 = MockDataFactory.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.test/src/org/eclipse/osee/framework/core/test/translation/TranslationTestSuite.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/translation/TranslationTestSuite.java
new file mode 100644
index 00000000000..8e5acda0eed
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/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.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 {
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/ChangeItemUtilTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/ChangeItemUtilTest.java
new file mode 100644
index 00000000000..507c5b32288
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/ChangeItemUtilTest.java
@@ -0,0 +1,363 @@
+/*******************************************************************************
+ * 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.test.util;
+
+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.data.ChangeItem;
+import org.eclipse.osee.framework.core.data.ChangeVersion;
+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.test.data.ChangeTestUtility;
+import org.eclipse.osee.framework.core.util.ChangeItemUtil;
+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(0, item.getArtId());
+ assertEquals(200, item.getItemId());
+ 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());
+
+ item.setArtId(400);
+ assertEquals(400, item.getArtId());
+ }
+
+ @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, 1234);
+
+ 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.test/src/org/eclipse/osee/framework/core/test/util/CompareTest.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/CompareTest.java
new file mode 100644
index 00000000000..5f93ebd6b89
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/CompareTest.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * 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.test.util;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.osee.framework.core.util.Compare;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Test Case for {@link Compare}
+ * @author Roberto E. Escobar
+ */
+@RunWith(Parameterized.class)
+public class CompareTest {
+
+ protected final Object object1;
+ protected final Object object2;
+ protected final boolean expected;
+
+ public CompareTest(Object object1, Object object2, boolean expected) {
+ this.object1 = object1;
+ this.object2 = object2;
+ this.expected = expected;
+ }
+
+ @Test
+ public void testObjects() {
+ boolean actual = Compare.isDifferent(object1, object2);
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Parameters
+ public static Collection<Object[]> data() {
+ Collection<Object[]> data = new ArrayList<Object[]>();
+ data.add(new Object[] {"abc", "abc", false});
+ data.add(new Object[] {"abc", "abc1", true});
+ data.add(new Object[] {null, "abc", true});
+ data.add(new Object[] {"abc", null, true});
+ data.add(new Object[] {null, null, false});
+
+ data.add(new Object[] {1, null, true});
+ data.add(new Object[] {null, 2, true});
+ data.add(new Object[] {1, 1, false});
+
+ data.add(new Object[] {"1", 1, true});
+
+ data.add(new Object[] {Arrays.asList("one", "two", "three"), Arrays.asList("one", "two", "three"), false});
+ data.add(new Object[] {Arrays.asList("two", "one", "three"), Arrays.asList("three", "one", "two"), false});
+ data.add(new Object[] {Arrays.asList("one", "three"), Arrays.asList("one", "two", "three"), true});
+
+ data.add(new Object[] {new String[] {"one", "two", "three"}, new String[] {"one", "two", "three"}, false});
+ data.add(new Object[] {new String[] {"two", "one", "three"}, new String[] {"three", "one", "two"}, false});
+ data.add(new Object[] {new String[] {"one", "three"}, new String[] {"one", "two", "three"}, true});
+ data.add(new Object[] {new String[] {"one", "two", "two", "three"}, new String[] {"one", "two", "three"}, true});
+
+ data.add(new Object[] {map("a", "b", "c", "d"), map("a", "b", "c", "d"), false});
+ data.add(new Object[] {map("a", "b", "c", "d"), map("a", "c", "b", "d"), false});
+ data.add(new Object[] {map("a", "b", "c", "d"), map("a", "c", "b", "b", "d"), true});
+ return data;
+ }
+
+ private static Map<Object, Collection<Object>> map(Object key, Object... values) {
+ Map<Object, Collection<Object>> map = new HashMap<Object, Collection<Object>>();
+ Collection<Object> objects = map.get(key);
+ if (objects == null) {
+ objects = new ArrayList<Object>();
+ map.put(key, objects);
+ } else {
+ objects.clear();
+ }
+ if (values != null && values.length > 0) {
+ objects.addAll(Arrays.asList(values));
+ }
+ return map;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/UtilTestSuite.java b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/UtilTestSuite.java
new file mode 100644
index 00000000000..41cb8af75a2
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core.test/src/org/eclipse/osee/framework/core/test/util/UtilTestSuite.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.test.util;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {//
+ChangeItemUtilTest.class, //
+ CompareTest.class, //
+})
+/**
+ * @author Roberto E. Escobar
+ */
+public class UtilTestSuite {
+
+}

Back to the top