Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2017-03-17 21:30:53 +0000
committerdonald.g.dunne2017-03-21 17:12:04 +0000
commit3f9c74382853e096cf0173c2e631a32d98c36dd1 (patch)
tree691ad0b76c7ceff72903981f1120b3dbaa25e602 /plugins/org.eclipse.osee.client.integration.tests
parentce65260dcc0159b16d52dd81fcd41280e0eaae43 (diff)
downloadorg.eclipse.osee-3f9c74382853e096cf0173c2e631a32d98c36dd1.tar.gz
org.eclipse.osee-3f9c74382853e096cf0173c2e631a32d98c36dd1.tar.xz
org.eclipse.osee-3f9c74382853e096cf0173c2e631a32d98c36dd1.zip
bug[ats_ATS360232]: Setting attribute to same value causes new transaction
Diffstat (limited to 'plugins/org.eclipse.osee.client.integration.tests')
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactTest.java78
1 files changed, 73 insertions, 5 deletions
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactTest.java
index 2192570d0b7..6b913a83d6d 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactTest.java
@@ -20,17 +20,20 @@ import static org.eclipse.osee.framework.core.enums.DemoBranches.SAW_Bld_2;
import org.eclipse.osee.client.demo.DemoTypes;
import org.eclipse.osee.client.test.framework.OseeClientIntegrationRule;
import org.eclipse.osee.client.test.framework.OseeLogMonitorRule;
+import org.eclipse.osee.framework.core.data.TransactionToken;
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.model.event.DefaultBasicGuidArtifact;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Assert;
-import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
@@ -45,11 +48,27 @@ public final class ArtifactTest {
@Rule
public OseeLogMonitorRule monitorRule = new OseeLogMonitorRule();
- private Artifact artifactWithSpecialAttr;
+ private static final String BREAKER_NAME = "ArtifactTest Breaker";
+ private static Artifact artifactWithSpecialAttr;
+ private static Artifact breakerArt;
- @Before
- public void setUp() throws Exception {
+ @BeforeClass
+ public static void setUp() throws Exception {
artifactWithSpecialAttr = ArtifactTypeManager.addArtifact(DemoTypes.DemoTestRequirement, SAW_Bld_1);
+ breakerArt = ArtifactTypeManager.addArtifact(CoreArtifactTypes.Breaker, COMMON);
+ breakerArt.setName(BREAKER_NAME);
+ breakerArt.persist("ArtifactTest");
+ }
+
+ @BeforeClass
+ @AfterClass
+ public static void cleanUp() throws Exception {
+ if (breakerArt != null) {
+ breakerArt.deleteAndPersist();
+ }
+ if (artifactWithSpecialAttr != null) {
+ ArtifactCache.deCache(artifactWithSpecialAttr);
+ }
}
@After
@@ -94,11 +113,60 @@ public final class ArtifactTest {
}
@Test
- public void setSoleAttributeValueTest() throws Exception {
+ public void testSetSoleAttributeValue() throws Exception {
artifactWithSpecialAttr.setName("ArtifactTest-artifactWithSpecialAttr");
artifactWithSpecialAttr.setSoleAttributeValue(CoreAttributeTypes.Partition, "Navigation");
}
+ /**
+ * Setting same value should not change artifact
+ */
+ @Test
+ public void testSetSoleAttributeValueSameValueBoolean() throws Exception {
+ breakerArt.setSoleAttributeValue(CoreAttributeTypes.RequireConfirmation, true);
+ breakerArt.persist("Set RequireConfirmation");
+ Assert.assertEquals(true, breakerArt.getSoleAttributeValue(CoreAttributeTypes.RequireConfirmation, false));
+ TransactionToken currentTrans = breakerArt.getTransaction();
+
+ breakerArt.setSoleAttributeValue(CoreAttributeTypes.RequireConfirmation, true);
+ breakerArt.persist("Re-set RequireConfirmation");
+ Assert.assertEquals(true, breakerArt.getSoleAttributeValue(CoreAttributeTypes.RequireConfirmation, false));
+
+ TransactionToken newTransaction = breakerArt.getTransaction();
+ Assert.assertEquals(currentTrans, newTransaction);
+ }
+
+ @Test
+ public void testSetSoleAttributeValueSameValueString() throws Exception {
+ Assert.assertEquals(BREAKER_NAME, breakerArt.getName());
+ TransactionToken currentTrans = breakerArt.getTransaction();
+
+ breakerArt.setName(BREAKER_NAME);
+ breakerArt.persist("Re-set Name");
+ Assert.assertEquals(BREAKER_NAME, breakerArt.getName());
+
+ TransactionToken newTransaction = breakerArt.getTransaction();
+ Assert.assertEquals(currentTrans, newTransaction);
+ }
+
+ @Test
+ public void testSetSoleAttributeValueSameValueInteger() throws Exception {
+ breakerArt.setSoleAttributeValue(CoreAttributeTypes.CircuitBreakerId, 34);
+ breakerArt.persist("Set CircuitBreakerId");
+
+ Assert.assertEquals(Integer.valueOf(34),
+ breakerArt.getSoleAttributeValue(CoreAttributeTypes.CircuitBreakerId, 0));
+ TransactionToken currentTrans = breakerArt.getTransaction();
+
+ breakerArt.setSoleAttributeValue(CoreAttributeTypes.CircuitBreakerId, 34);
+ breakerArt.persist("Re-Set CircuitBreakerId");
+ Assert.assertEquals(Integer.valueOf(34),
+ breakerArt.getSoleAttributeValue(CoreAttributeTypes.CircuitBreakerId, 0));
+
+ TransactionToken newTransaction = breakerArt.getTransaction();
+ Assert.assertEquals(currentTrans, newTransaction);
+ }
+
@Test
public void testHashCode() throws OseeCoreException {
Artifact art = ArtifactTypeManager.addArtifact(GeneralData, COMMON, ArtifactTest.class.getSimpleName());

Back to the top