Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2014-03-28 15:48:55 +0000
committerdonald.g.dunne2014-04-09 15:32:55 +0000
commit1f8e94e66234595711ccb229869d8ca2b4ed9489 (patch)
tree6febe577cd4f1d9a548d942e626695fd7214f6bf /plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org
parent568a307e7e6655ada9a1638e2cb76cb9f79699b7 (diff)
downloadorg.eclipse.osee-1f8e94e66234595711ccb229869d8ca2b4ed9489.tar.gz
org.eclipse.osee-1f8e94e66234595711ccb229869d8ca2b4ed9489.tar.xz
org.eclipse.osee-1f8e94e66234595711ccb229869d8ca2b4ed9489.zip
feature[ats_ATS19845]: Convert IOseeBranch to Identity-Long
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org')
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactMatchInterpreterTest.java40
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/OseeDslSegmentParserTest.java38
2 files changed, 40 insertions, 38 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactMatchInterpreterTest.java b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactMatchInterpreterTest.java
index 15d397e4bb2..1cb2d955e74 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactMatchInterpreterTest.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactMatchInterpreterTest.java
@@ -29,9 +29,9 @@ import org.eclipse.osee.framework.core.model.IBasicArtifact;
import org.eclipse.osee.framework.core.model.type.ArtifactType;
import org.eclipse.osee.framework.core.model.type.RelationType;
import org.eclipse.osee.framework.jdk.core.type.Identity;
-import org.eclipse.osee.framework.jdk.core.type.Named;
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.Lib;
import org.junit.Assert;
import org.junit.Test;
@@ -113,11 +113,11 @@ public class ArtifactMatchInterpreterTest {
DslAsserts.assertEquals(matcher.getConditions().iterator().next(), MatchField.BRANCH_NAME, CompareOp.EQ,
"branch1");
- ArtifactProxy proxy = createProxy(GUID.create(), "art1", GUID.create(), "branch2");
+ ArtifactProxy proxy = createProxy(GUID.create(), "art1", Lib.generateUuid(), "branch2");
boolean actual = interpreter.matches(matcher, proxy);
Assert.assertEquals(false, actual);
- proxy = createProxy(GUID.create(), "art1", GUID.create(), "branch1");
+ proxy = createProxy(GUID.create(), "art1", Lib.generateUuid(), "branch1");
actual = interpreter.matches(matcher, proxy);
Assert.assertEquals(true, actual);
}
@@ -130,31 +130,32 @@ public class ArtifactMatchInterpreterTest {
DslAsserts.assertEquals(matcher.getConditions().iterator().next(), MatchField.BRANCH_NAME, CompareOp.LIKE,
".*hello.*");
- ArtifactProxy proxy = createProxy(GUID.create(), "art1", GUID.create(), "this is the hello branch");
+ ArtifactProxy proxy = createProxy(GUID.create(), "art1", Lib.generateUuid(), "this is the hello branch");
boolean actual = interpreter.matches(matcher, proxy);
Assert.assertEquals(true, actual);
}
@Test
- public void testArtifactBranchGuidEq() throws OseeCoreException {
- String guid = GUID.create();
+ public void testArtifactBranchUuidEq() throws OseeCoreException {
+ long uuid = Lib.generateUuid();
XArtifactMatcher matcher =
- MockModel.createMatcher("artifactMatcher \"Test\" where branchGuid EQ \"" + guid + "\";");
+ MockModel.createMatcher("artifactMatcher \"Test\" where branchUuid EQ \"" + uuid + "\";");
- DslAsserts.assertEquals(matcher.getConditions().iterator().next(), MatchField.BRANCH_GUID, CompareOp.EQ, guid);
+ DslAsserts.assertEquals(matcher.getConditions().iterator().next(), MatchField.BRANCH_UUID, CompareOp.EQ,
+ String.valueOf(uuid));
- ArtifactProxy proxy = createProxy(GUID.create(), "art1", guid, "");
+ ArtifactProxy proxy = createProxy(GUID.create(), "art1", uuid, "");
boolean actual = interpreter.matches(matcher, proxy);
Assert.assertEquals(true, actual);
}
@Test
- public void testArtifactBranchGuidLike() throws OseeCoreException {
- XArtifactMatcher matcher = MockModel.createMatcher("artifactMatcher \"Test\" where branchGuid LIKE \"\\w+\";");
+ public void testArtifactBranchUuidLike() throws OseeCoreException {
+ XArtifactMatcher matcher = MockModel.createMatcher("artifactMatcher \"Test\" where branchUuid LIKE \"\\w+\";");
- DslAsserts.assertEquals(matcher.getConditions().iterator().next(), MatchField.BRANCH_GUID, CompareOp.LIKE, "\\w+");
+ DslAsserts.assertEquals(matcher.getConditions().iterator().next(), MatchField.BRANCH_UUID, CompareOp.LIKE, "\\w+");
- ArtifactProxy proxy = createProxy(GUID.create(), "art1", "ABCDEFGHIJK123456789", "");
+ ArtifactProxy proxy = createProxy(GUID.create(), "art1", Lib.generateUuid(), "");
boolean actual = interpreter.matches(matcher, proxy);
Assert.assertEquals(true, actual);
}
@@ -200,7 +201,7 @@ public class ArtifactMatchInterpreterTest {
@Test
public void testCompoundCondition2() throws OseeCoreException {
XArtifactMatcher matcher =
- MockModel.createMatcher("artifactMatcher \"Test\" where artifactGuid EQ \"ABCDEFGHIJK123456789\" AND (branchName EQ \"myArtifact\" OR branchGuid EQ \"123456789101112131415\");");
+ MockModel.createMatcher("artifactMatcher \"Test\" where artifactGuid EQ \"ABCDEFGHIJK123456789\" AND (branchName EQ \"myArtifact\" OR branchUuid EQ \"3456789101112131415\");");
Assert.assertEquals(2, matcher.getConditions().size());
Iterator<Condition> iterator = matcher.getConditions().iterator();
@@ -218,17 +219,18 @@ public class ArtifactMatchInterpreterTest {
Iterator<SimpleCondition> iterator2 = compoundCondition.getConditions().iterator();
DslAsserts.assertEquals(iterator2.next(), MatchField.BRANCH_NAME, CompareOp.EQ, "myArtifact");
- DslAsserts.assertEquals(iterator2.next(), MatchField.BRANCH_GUID, CompareOp.EQ, "123456789101112131415");
+ DslAsserts.assertEquals(iterator2.next(), MatchField.BRANCH_UUID, CompareOp.EQ,
+ String.valueOf(3456789101112131415L));
Assert.assertEquals(1, compoundCondition.getOperators().size());
Assert.assertEquals(XLogicOperator.OR, compoundCondition.getOperators().iterator().next());
String badArtGuid = "1BCDEFGHIJK123456789";
- String badBranchGuid = "ABCDEFGHIJK123456789";
+ long badBranchGuid = 333333333123456789L;
String badBranchName = "xArtifact";
String goodArtGuid = "ABCDEFGHIJK123456789";
- String goodBranchGuid = "123456789101112131415";
+ long goodBranchGuid = 3456789101112131415L;
String goodBranchName = "myArtifact";
ArtifactProxy proxy1 = createProxy(badArtGuid, "", badBranchGuid, badBranchName);
@@ -252,10 +254,10 @@ public class ArtifactMatchInterpreterTest {
}
private static ArtifactProxy createProxy(String artGuid, String artifactName) {
- return createProxy(artGuid, artifactName, GUID.create(), "dummy");
+ return createProxy(artGuid, artifactName, Lib.generateUuid(), "dummy");
}
- private static ArtifactProxy createProxy(final String artGuid, final String artifactName, final String branchGuid, final String branchName) {
+ private static ArtifactProxy createProxy(final String artGuid, final String artifactName, final long branchGuid, final String branchName) {
return new ArtifactProxy() {
@Override
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/OseeDslSegmentParserTest.java b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/OseeDslSegmentParserTest.java
index 7224ee5c801..0a811796ba3 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/OseeDslSegmentParserTest.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/util/OseeDslSegmentParserTest.java
@@ -71,19 +71,19 @@ public class OseeDslSegmentParserTest {
final String artifactGuid = GUID.create();
final String artifactName = "artifactTest";
final String branchName = branch.getName();
- final String branchGuid = branch.getGuid();
+ final Long branchUuid = branch.getUuid();
IBasicArtifact<?> artifact = new MockArtifact(artifactGuid, artifactName, branch, CoreArtifactTypes.Artifact, 45);
String actual = parser.getStartTag(artifact);
String expected =
- String.format("//@start_artifact branch/%s/artifact/%s/ (%s:%s)", branchGuid, artifactGuid, branchName,
+ String.format("//@start_artifact branch/%d/artifact/%s/ (%s:%s)", branchUuid, artifactGuid, branchName,
artifactName);
Assert.assertEquals(expected, actual);
actual = parser.getEndTag(artifact);
expected =
- String.format("//@end_artifact branch/%s/artifact/%s/ (%s:%s)", branchGuid, artifactGuid, branchName,
+ String.format("//@end_artifact branch/%d/artifact/%s/ (%s:%s)", branchUuid, artifactGuid, branchName,
artifactName);
Assert.assertEquals(expected, actual);
}
@@ -96,16 +96,16 @@ public class OseeDslSegmentParserTest {
@Test
public void testGetLocations() throws OseeCoreException {
final String artifactGuid = GUID.create();
- final String branchGuid = CoreBranches.COMMON.getGuid();
+ final Long branchUuid = CoreBranches.COMMON.getUuid();
String data = null;
- data = String.format("//@start_artifact branch/%s/artifact/%s/ ()", branchGuid, artifactGuid);
- checkGetTagLocations(data, new TagLocation(true, branchGuid, artifactGuid, 0, data.length()));
+ data = String.format("//@start_artifact branch/%d/artifact/%s/ ()", branchUuid, artifactGuid);
+ checkGetTagLocations(data, new TagLocation(true, branchUuid, artifactGuid, 0, data.length()));
- data = String.format("//@end_artifact branch/%s/artifact/%s/ ()", branchGuid, artifactGuid);
- checkGetTagLocations(data, new TagLocation(false, branchGuid, artifactGuid, 0, data.length()));
+ data = String.format("//@end_artifact branch/%d/artifact/%s/ ()", branchUuid, artifactGuid);
+ checkGetTagLocations(data, new TagLocation(false, branchUuid, artifactGuid, 0, data.length()));
- data = String.format("//@end_artifact branch/%s/artifact/%s/", branchGuid, artifactGuid);
+ data = String.format("//@end_artifact branch/%d/artifact/%s/", branchUuid, artifactGuid);
checkGetTagLocations(data);
data = "//@end_artifact branch//artifact/";
@@ -124,8 +124,8 @@ public class OseeDslSegmentParserTest {
@Test(expected = OseeStateException.class)
public void testGetSegmentsUnMatched() throws OseeCoreException {
- TagLocation start = new TagLocation(true, "1", "2", 0, 2);
- TagLocation end = new TagLocation(false, "1", "2", 0, 2);
+ TagLocation start = new TagLocation(true, 1L, "2", 0, 2);
+ TagLocation end = new TagLocation(false, 1L, "2", 0, 2);
Collection<TagLocation> locations = Arrays.asList(start, start, end);
parser.getSegments(locations);
@@ -133,16 +133,16 @@ public class OseeDslSegmentParserTest {
@Test
public void testOrderedSegments() throws OseeCoreException {
- TagLocation start1 = new TagLocation(true, "branch_1", "art_1", 0, 6);
- TagLocation end1 = new TagLocation(false, "branch_1", "art_1", 10, 12);
+ TagLocation start1 = new TagLocation(true, 1L, "art_1", 0, 6);
+ TagLocation end1 = new TagLocation(false, 1L, "art_1", 10, 12);
- TagLocation start2 = new TagLocation(true, "branch_2", "art_2", 13, 56);
- TagLocation end2 = new TagLocation(false, "branch_2", "art_2", 79, 80);
+ TagLocation start2 = new TagLocation(true, 2L, "art_2", 13, 56);
+ TagLocation end2 = new TagLocation(false, 2L, "art_2", 79, 80);
// Segments should capture in-between data
- OseeDslSegment segment1 = new OseeDslSegment("branch_1", "art_1", 6, 10);
- OseeDslSegment segment2 = new OseeDslSegment("branch_2", "art_2", 56, 79);
+ OseeDslSegment segment1 = new OseeDslSegment(1L, "art_1", 6, 10);
+ OseeDslSegment segment2 = new OseeDslSegment(2L, "art_2", 56, 79);
Collection<TagLocation> locations = Arrays.asList(start1, end1, start2, end2);
Collection<OseeDslSegment> segments = parser.getSegments(locations);
@@ -195,7 +195,7 @@ public class OseeDslSegmentParserTest {
Assert.assertNull(actual);
} else {
Assert.assertEquals("isStartTag - " + index, expected.isStartTag(), actual.isStartTag());
- Assert.assertEquals("branchguid - " + index, expected.getBranchGuid(), actual.getBranchGuid());
+ Assert.assertEquals("branchguid - " + index, expected.getBranchUuid(), actual.getBranchUuid());
Assert.assertEquals("artguid - " + index, expected.getArtifactGuid(), actual.getArtifactGuid());
Assert.assertEquals("start - " + index, expected.start(), actual.start());
Assert.assertEquals("end - " + index, expected.end(), actual.end());
@@ -206,7 +206,7 @@ public class OseeDslSegmentParserTest {
if (expected == null) {
Assert.assertNull(actual);
} else {
- Assert.assertEquals("branchguid - " + index, expected.getBranchGuid(), actual.getBranchGuid());
+ Assert.assertEquals("branchguid - " + index, expected.getBranchUuid(), actual.getBranchUuid());
Assert.assertEquals("artguid - " + index, expected.getArtifactGuid(), actual.getArtifactGuid());
Assert.assertEquals("start - " + index, expected.start(), actual.start());
Assert.assertEquals("end - " + index, expected.end(), actual.end());

Back to the top