Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2013-02-05 15:26:27 +0000
committerjmisinco2013-02-06 19:54:41 +0000
commita5c3eb24e1d06175e24ba11a4fa9afcf4ac4a652 (patch)
tree586e5c4f1302977eedd854c0d1d2e967c5e80157 /plugins/org.eclipse.osee.client.integration.tests
parent00b56b857854f670b72036fa86e324fd62d13407 (diff)
downloadorg.eclipse.osee-a5c3eb24e1d06175e24ba11a4fa9afcf4ac4a652.tar.gz
org.eclipse.osee-a5c3eb24e1d06175e24ba11a4fa9afcf4ac4a652.tar.xz
org.eclipse.osee-a5c3eb24e1d06175e24ba11a4fa9afcf4ac4a652.zip
bug[ats_3XZKD]: Validate RenderTemplates to prevent duplicates
Diffstat (limited to 'plugins/org.eclipse.osee.client.integration.tests')
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/OseeClient_Integration_TestSuite.launch1
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/TemplateArtifactValidatorTest.java134
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/XUiSkynetCoreIntegrationTestSuite.java1
3 files changed, 135 insertions, 1 deletions
diff --git a/plugins/org.eclipse.osee.client.integration.tests/OseeClient_Integration_TestSuite.launch b/plugins/org.eclipse.osee.client.integration.tests/OseeClient_Integration_TestSuite.launch
index 4920f368e4e..b4710a941e6 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/OseeClient_Integration_TestSuite.launch
+++ b/plugins/org.eclipse.osee.client.integration.tests/OseeClient_Integration_TestSuite.launch
@@ -30,7 +30,6 @@
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/OSEE_x86_64"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.osee.client.integration.tests.OseeClientIntegrationTestSuite"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -nosplash"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.osee.client.integration.tests"/>
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/TemplateArtifactValidatorTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/TemplateArtifactValidatorTest.java
new file mode 100644
index 00000000000..04326732216
--- /dev/null
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/TemplateArtifactValidatorTest.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.client.integration.tests.integration.ui.skynet;
+
+import static org.eclipse.osee.client.demo.DemoChoice.OSEE_CLIENT_DEMO;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.osee.client.test.framework.OseeClientIntegrationRule;
+import org.eclipse.osee.client.test.framework.OseeLogMonitorRule;
+import org.eclipse.osee.client.test.framework.TestInfo;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.enums.CoreBranches;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.ui.skynet.templates.TemplateArtifactValidator;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * @author John Misinco
+ */
+public class TemplateArtifactValidatorTest {
+
+ @Rule
+ public OseeClientIntegrationRule integration = new OseeClientIntegrationRule(OSEE_CLIENT_DEMO);
+
+ @Rule
+ public OseeLogMonitorRule monitorRule = new OseeLogMonitorRule();
+
+ @Rule
+ public TestInfo testInfo = new TestInfo();
+
+ private Branch testBranch;
+
+ @Before
+ public void setup() throws OseeCoreException {
+ testBranch = BranchManager.createWorkingBranch(CoreBranches.COMMON, testInfo.getQualifiedTestName());
+ }
+
+ @After
+ public void tearDown() {
+ BranchManager.deleteBranchAndPend(testBranch);
+ }
+
+ @Test
+ public void testIsApplicable() throws OseeCoreException {
+ Artifact newTemplate = ArtifactTypeManager.addArtifact(CoreArtifactTypes.RendererTemplate, testBranch);
+ newTemplate.persist(testInfo.getQualifiedTestName());
+ Artifact newNonTemplate = ArtifactTypeManager.addArtifact(CoreArtifactTypes.Design, testBranch);
+ newNonTemplate.persist(testInfo.getQualifiedTestName());
+
+ TemplateArtifactValidator validator = new TemplateArtifactValidator();
+ for (AttributeType attrType : AttributeTypeManager.getAllTypes()) {
+ boolean correctAttrType = false;
+ if (attrType.equals(CoreAttributeTypes.TemplateMatchCriteria)) {
+ correctAttrType = true;
+ }
+ Assert.assertEquals(correctAttrType, validator.isApplicable(newTemplate, attrType));
+ Assert.assertFalse(validator.isApplicable(newNonTemplate, attrType));
+ }
+ }
+
+ @Test
+ public void testValidateOkStatus() throws OseeCoreException {
+ Artifact newTemplate = ArtifactTypeManager.addArtifact(CoreArtifactTypes.RendererTemplate, testBranch);
+ newTemplate.persist(testInfo.getQualifiedTestName());
+ TemplateArtifactValidator validator = new TemplateArtifactValidator();
+ String templateId = GUID.create();
+ IStatus status = validator.validate(newTemplate, CoreAttributeTypes.TemplateMatchCriteria, templateId);
+ Assert.assertTrue(status.isOK());
+ newTemplate.addAttributeFromString(CoreAttributeTypes.TemplateMatchCriteria, templateId);
+ newTemplate.persist(testInfo.getQualifiedTestName());
+
+ newTemplate = ArtifactTypeManager.addArtifact(CoreArtifactTypes.RendererTemplate, testBranch);
+ newTemplate.persist(testInfo.getQualifiedTestName());
+ templateId = GUID.create();
+ status = validator.validate(newTemplate, CoreAttributeTypes.TemplateMatchCriteria, templateId);
+ Assert.assertTrue(status.isOK());
+ newTemplate.persist(testInfo.getQualifiedTestName());
+ }
+
+ @Test
+ public void testDuplicateCriteriaOnSeparateBranches() throws OseeCoreException {
+ Artifact newTemplate = ArtifactTypeManager.addArtifact(CoreArtifactTypes.RendererTemplate, testBranch);
+ newTemplate.persist(testInfo.getQualifiedTestName());
+ TemplateArtifactValidator validator = new TemplateArtifactValidator();
+ String templateId = GUID.create();
+ IStatus status = validator.validate(newTemplate, CoreAttributeTypes.TemplateMatchCriteria, templateId);
+ Assert.assertTrue(status.isOK());
+ newTemplate.addAttributeFromString(CoreAttributeTypes.TemplateMatchCriteria, templateId);
+ newTemplate.persist(testInfo.getQualifiedTestName());
+
+ Branch testBranch2 =
+ BranchManager.createWorkingBranch(CoreBranches.COMMON, testInfo.getQualifiedTestName() + "2");
+ Artifact newTemplate2 = ArtifactTypeManager.addArtifact(CoreArtifactTypes.RendererTemplate, testBranch2);
+ newTemplate2.persist(testInfo.getQualifiedTestName());
+ status = validator.validate(newTemplate2, CoreAttributeTypes.TemplateMatchCriteria, templateId);
+ Assert.assertTrue(status.isOK());
+ newTemplate2.addAttributeFromString(CoreAttributeTypes.TemplateMatchCriteria, templateId);
+ newTemplate2.persist(testInfo.getQualifiedTestName());
+ BranchManager.deleteBranch(testBranch2);
+ }
+
+ @Test
+ public void testValidateErrorStatus() throws OseeCoreException {
+ TemplateArtifactValidator validator = new TemplateArtifactValidator();
+ String templateId = GUID.create();
+
+ Artifact newTemplate = ArtifactTypeManager.addArtifact(CoreArtifactTypes.RendererTemplate, testBranch);
+ newTemplate.addAttributeFromString(CoreAttributeTypes.TemplateMatchCriteria, templateId);
+ newTemplate.persist(testInfo.getQualifiedTestName());
+
+ // since newTemplate was already persisted with templateId, this check will produce and error status
+ IStatus status = validator.validate(newTemplate, CoreAttributeTypes.TemplateMatchCriteria, templateId);
+ Assert.assertFalse(status.isOK());
+ }
+}
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/XUiSkynetCoreIntegrationTestSuite.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/XUiSkynetCoreIntegrationTestSuite.java
index 09462f5e935..c221d356c7d 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/XUiSkynetCoreIntegrationTestSuite.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/XUiSkynetCoreIntegrationTestSuite.java
@@ -26,6 +26,7 @@ import org.junit.runners.Suite;
RelationIntegrityCheckTest.class,
ReplaceWithBaselineTest.class,
StringGuidsToArtifactListOperationTest.class,
+ TemplateArtifactValidatorTest.class,
ViewWordChangeAndDiffTest.class,
WordArtifactElementExtractorTest.class,
WordEditTest.class,

Back to the top