Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngel Avila2015-03-19 17:34:51 -0400
committerAngel Avila2015-03-19 17:34:51 -0400
commit16d6f7ef8479b053a3df4b0f66411306e86d5f7e (patch)
tree655097e1908d1959cdff22d9ee90b92e530629b1 /plugins/org.eclipse.osee.orcs.db.test
parent9422eee01a56004b6799060d7da355e1ad271250 (diff)
downloadorg.eclipse.osee-16d6f7ef8479b053a3df4b0f66411306e86d5f7e.tar.gz
org.eclipse.osee-16d6f7ef8479b053a3df4b0f66411306e86d5f7e.tar.xz
org.eclipse.osee-16d6f7ef8479b053a3df4b0f66411306e86d5f7e.zip
refactor: Generalize ChangeItem class
Use type enumeration to identify different change items. Allow construction of change items through default constructor. Make change item serialization friendly. Change-Id: I962caffc8806e08a32e2a851587e97ad3aaf1bb1 Signed-off-by: Angel Avila <angel.avila2@boeing.com>
Diffstat (limited to 'plugins/org.eclipse.osee.orcs.db.test')
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeItemConflictTest.java7
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeTestUtility.java12
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryTest.java30
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MockChangeItem.java24
4 files changed, 28 insertions, 45 deletions
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeItemConflictTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeItemConflictTest.java
index aaf1631061..bea7678a7d 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeItemConflictTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeItemConflictTest.java
@@ -14,9 +14,8 @@ import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.model.change.ArtifactChangeItem;
-import org.eclipse.osee.framework.core.model.change.AttributeChangeItem;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
+import org.eclipse.osee.framework.core.model.change.ChangeItemUtil;
import org.eclipse.osee.framework.core.model.change.ChangeVersion;
import org.junit.Assert;
import org.junit.Ignore;
@@ -89,9 +88,9 @@ public class ChangeItemConflictTest {
// but since we don't seem to handle the mixed case of say artifact on src and attribute on destination
ChangeItem item;
if (itemType == ItemType.artifact) {
- item = new ArtifactChangeItem(0, 0, GAMMA, ModificationType.MODIFIED);
+ item = ChangeItemUtil.newArtifactChange(0, 0, GAMMA, ModificationType.MODIFIED);
} else {
- item = new AttributeChangeItem(0, 0, 0, GAMMA, ModificationType.MODIFIED, "change");
+ item = ChangeItemUtil.newAttributeChange(0, 0, 0, GAMMA, ModificationType.MODIFIED, "change");
}
buildTestCase(GAMMA, item);
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeTestUtility.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeTestUtility.java
index 10a61647ab..4d6ca45796 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeTestUtility.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/ChangeTestUtility.java
@@ -40,8 +40,16 @@ public final class ChangeTestUtility {
}
public static ChangeItem createItem(int itemId, ChangeVersion base, ChangeVersion first, ChangeVersion current, ChangeVersion destination, ChangeVersion net) {
- MockChangeItem change =
- new MockChangeItem(itemId, itemId * 10, itemId * 100, current.getGammaId(), current.getModType());
+ ChangeItem change = new ChangeItem();
+
+ change.setItemId(itemId);
+ change.setItemTypeId(itemId * 10);
+ change.setArtId(itemId * 100);
+
+ ChangeVersion currentVersion = change.getCurrentVersion();
+ currentVersion.setGammaId(current.getGammaId());
+ currentVersion.setModType(current.getModType());
+
if (base != null) {
change.getBaselineVersion().copy(base);
}
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryTest.java
index 4a56566a0a..7658816a58 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MissingChangeItemFactoryTest.java
@@ -21,10 +21,8 @@ import java.util.List;
import org.eclipse.osee.executor.admin.HasCancellation;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.model.change.ArtifactChangeItem;
-import org.eclipse.osee.framework.core.model.change.AttributeChangeItem;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
-import org.eclipse.osee.framework.core.model.change.RelationChangeItem;
+import org.eclipse.osee.framework.core.model.change.ChangeItemUtil;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.jdk.core.util.Strings;
@@ -184,7 +182,7 @@ public class MissingChangeItemFactoryTest {
long artGamma = 7L;
ChangeItem ci1 =
- new AttributeChangeItem(ci1AttrId, 2, artId, 4L, ModificationType.MODIFIED, Strings.EMPTY_STRING);
+ ChangeItemUtil.newAttributeChange(ci1AttrId, 2, artId, 4L, ModificationType.MODIFIED, Strings.EMPTY_STRING);
changes.add(ci1);
List<AttributeData> attrDatas = new LinkedList<AttributeData>();
@@ -217,7 +215,7 @@ public class MissingChangeItemFactoryTest {
int artA = 65;
int artB = 2;
long srcGamma = 7L;
- ChangeItem ci1 = new RelationChangeItem(relId, 0, srcGamma, ModificationType.NEW, artA, artB, "");
+ ChangeItem ci1 = ChangeItemUtil.newRelationChange(relId, 0, srcGamma, ModificationType.NEW, artA, artB, "");
changes.add(ci1);
List<AttributeData> attrDatas = new LinkedList<AttributeData>();
@@ -254,7 +252,8 @@ public class MissingChangeItemFactoryTest {
List<ChangeItem> changes = new LinkedList<ChangeItem>();
final int artId = 3;
- ChangeItem ci1 = new AttributeChangeItem(22, 2, artId, 4L, ModificationType.DELETED, Strings.EMPTY_STRING);
+ ChangeItem ci1 =
+ ChangeItemUtil.newAttributeChange(22, 2, artId, 4L, ModificationType.DELETED, Strings.EMPTY_STRING);
changes.add(ci1);
List<AttributeData> attrDatas = new LinkedList<AttributeData>();
@@ -283,7 +282,7 @@ public class MissingChangeItemFactoryTest {
final int artId = 3;
ChangeItem ci1 =
- new AttributeChangeItem(22, 2, artId, 4L, ModificationType.ARTIFACT_DELETED, Strings.EMPTY_STRING);
+ ChangeItemUtil.newAttributeChange(22, 2, artId, 4L, ModificationType.ARTIFACT_DELETED, Strings.EMPTY_STRING);
changes.add(ci1);
List<AttributeData> attrDatas = new LinkedList<AttributeData>();
@@ -312,18 +311,19 @@ public class MissingChangeItemFactoryTest {
}
}
- private static RelationChangeItem createExpected(RelationData data) {
- return new RelationChangeItem(data.getLocalId(), 0, data.getVersion().getGammaId(), determineModType(data),
- data.getArtIdA(), data.getArtIdB(), "");
+ private static ChangeItem createExpected(RelationData data) {
+ return ChangeItemUtil.newRelationChange(data.getLocalId(), 0, data.getVersion().getGammaId(),
+ determineModType(data), data.getArtIdA(), data.getArtIdB(), "");
}
- private static AttributeChangeItem createExpected(AttributeData data) {
- return new AttributeChangeItem(data.getLocalId(), 0, data.getArtifactId(), data.getVersion().getGammaId(),
- determineModType(data), "");
+ private static ChangeItem createExpected(AttributeData data) {
+ return ChangeItemUtil.newAttributeChange(data.getLocalId(), 0, data.getArtifactId(),
+ data.getVersion().getGammaId(), determineModType(data), "");
}
- private static ArtifactChangeItem createExpected(ArtifactData data) {
- return new ArtifactChangeItem(data.getLocalId(), 0, data.getVersion().getGammaId(), determineModType(data));
+ private static ChangeItem createExpected(ArtifactData data) {
+ return ChangeItemUtil.newArtifactChange(data.getLocalId(), 0, data.getVersion().getGammaId(),
+ determineModType(data));
}
private ChangeItem getMatchingChangeItem(ChangeItem item) {
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MockChangeItem.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MockChangeItem.java
deleted file mode 100644
index e04ebd8114..0000000000
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/change/MockChangeItem.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * 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.orcs.db.internal.change;
-
-import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.model.change.ChangeItem;
-
-/**
- * @author Roberto E. Escobar
- */
-public class MockChangeItem extends ChangeItem {
-
- public MockChangeItem(int itemId, int itemTypeId, int artId, long currentSourceGammaId, ModificationType currentSourceModType) {
- super(itemId, itemTypeId, artId, currentSourceGammaId, currentSourceModType);
- }
-} \ No newline at end of file

Back to the top