diff options
author | David W. Miller | 2017-02-13 22:22:24 +0000 |
---|---|---|
committer | David W. Miller | 2017-02-13 22:22:57 +0000 |
commit | bcd9d85f976da2cf11e59d36e614fcc642312926 (patch) | |
tree | df5dda0c22d0c90ae72ee81aee670a93ca22131d | |
parent | 353409f9d17085f3ca1fb9d2c2338a95876382e5 (diff) | |
download | org.eclipse.osee-bcd9d85f976da2cf11e59d36e614fcc642312926.tar.gz org.eclipse.osee-bcd9d85f976da2cf11e59d36e614fcc642312926.tar.xz org.eclipse.osee-bcd9d85f976da2cf11e59d36e614fcc642312926.zip |
bug[ats_ATS345762]: Fix artifact modification type in change report
Change-Id: Id90ffaa5ee0eae15c60329509b20c458fefa9b94
5 files changed, 53 insertions, 5 deletions
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/README.txt b/plugins/org.eclipse.osee.ats.client.integration.tests/README.txt index daa3985e55b..c616e708aff 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/README.txt +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/README.txt @@ -1,5 +1,5 @@ AtsClient_Integration_TestSuite.launch - Does same as DemoDbInit_Database and DOES run all ATS Integration tests - + - Intended to be run with the OSEE Application Server [HSQLDB] DemoDbInit_Database.launch - Initializes a Demo Database along with ATS and created Demo data with imported requirements, ATS configuration, ATS workflows and Branches. This launch does NOT run any tests. diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtilTest.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtilTest.java index 32c4e04284d..c9f0a44d096 100644 --- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtilTest.java +++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtilTest.java @@ -382,6 +382,32 @@ public class ChangeItemUtilTest { } @Test + public void testHasApplicabilityOnlyChange() { + 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); + + current.setApplicabilityToken(new ApplicabilityToken(789L, "TestAppl")); + destination.setApplicabilityToken(ApplicabilityToken.BASE); + + ChangeItem item = ChangeTestUtility.createItem(200, base, first, current, destination, net); + Assert.assertTrue(ChangeItemUtil.hasApplicabilityOnlyChange(item)); + + item.setApplicabilityCopy(true); + Assert.assertFalse(ChangeItemUtil.hasApplicabilityOnlyChange(item)); + + item.setApplicabilityCopy(false); + item.getCurrentVersion().setModType(ModificationType.DELETED); + Assert.assertFalse(ChangeItemUtil.hasApplicabilityOnlyChange(item)); + + item.getCurrentVersion().setModType(ModificationType.INTRODUCED); + item.getDestinationVersion().setApplicabilityToken(new ApplicabilityToken(789L, "TestAppl")); + Assert.assertFalse(ChangeItemUtil.hasApplicabilityOnlyChange(item)); + } + + @Test public void testSplitForApplicability() { ChangeVersion base = ChangeTestUtility.createChange(1111L, ModificationType.NEW); ChangeVersion first = ChangeTestUtility.createChange(2222L, ModificationType.MODIFIED); diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtil.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtil.java index 3da4ed5eca4..43f8b1436d4 100644 --- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtil.java +++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/change/ChangeItemUtil.java @@ -283,6 +283,9 @@ public final class ChangeItemUtil { } public static boolean hasApplicabilityChange(ChangeItem changeItem) { + if (changeItem.isApplicabilityCopy()) { + return true; + } if (changeItem.getCurrentVersion().isValid() && changeItem.getDestinationVersion().isValid()) { if (!areApplicabilitiesEqual(changeItem.getCurrentVersion(), changeItem.getDestinationVersion())) { return true; @@ -291,4 +294,18 @@ public final class ChangeItemUtil { return false; } + public static boolean hasApplicabilityOnlyChange(ChangeItem changeItem) { + if (changeItem.isApplicabilityCopy()) { + return false; + } + if (isDeleted(changeItem.getCurrentVersion())) { + return false; + } + if (changeItem.getCurrentVersion().isValid() && changeItem.getDestinationVersion().isValid()) { + if (!areApplicabilitiesEqual(changeItem.getCurrentVersion(), changeItem.getDestinationVersion())) { + return true; + } + } + return false; + } } diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ModificationType.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ModificationType.java index 99c7c2eea5a..43e0f886bce 100644 --- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ModificationType.java +++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/ModificationType.java @@ -54,6 +54,7 @@ public enum ModificationType { DELETED_ON_DESTINATION("Deleted on Destination", 9), + // This should never appear in the database, it is only used by the gui to show applicability changes APPLICABILITY("Applicability", 10); private final static Set<ModificationType> ALL_NOT_HARD_DELETED = new HashSet<>(); diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java index 09d401eac9e..4b11f4daaa3 100644 --- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java +++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/revision/ChangeDataLoader.java @@ -87,6 +87,11 @@ public class ChangeDataLoader extends AbstractOperation { BranchId startTxBranch = txDelta.getStartTx().getBranch(); for (ChangeItem item : changeItems) { checkForCancelledStatus(monitor); + if (ChangeItemUtil.hasValueChange(item) && ChangeItemUtil.hasApplicabilityChange(item)) { + ChangeItem splitItem = ChangeItemUtil.splitForApplicability(item); + Change splitChange = computeChange(bulkLoaded, startTxBranch, splitItem); + changes.add(splitChange); + } Change change = computeChange(bulkLoaded, startTxBranch, item); changes.add(change); monitor.worked(calculateWork(workAmount)); @@ -203,9 +208,8 @@ public class ChangeDataLoader extends AbstractOperation { switch (item.getChangeType()) { case ARTIFACT_CHANGE: - if (ChangeItemUtil.hasApplicabilityChange(item)) { + if (item.isApplicabilityCopy() || ChangeItemUtil.hasApplicabilityOnlyChange(item)) { netModType = ModificationType.APPLICABILITY; - change = new ArtifactChange(startTxBranch, itemGammaId, itemId, txDelta, netModType, item.getCurrentVersion().getApplicabilityToken().getName(), item.getDestinationVersion().getApplicabilityToken().getName(), isHistorical, changeArtifact, @@ -217,7 +221,7 @@ public class ChangeDataLoader extends AbstractOperation { break; case ATTRIBUTE_CHANGE: AttributeType attributeType = AttributeTypeManager.getTypeByGuid(item.getItemTypeId()); - if (ChangeItemUtil.hasApplicabilityChange(item)) { + if (item.isApplicabilityCopy() || ChangeItemUtil.hasApplicabilityOnlyChange(item)) { netModType = ModificationType.APPLICABILITY; change = new AttributeChange(startTxBranch, itemGammaId, artId, txDelta, netModType, item.getCurrentVersion().getApplicabilityToken().getName(), @@ -261,7 +265,7 @@ public class ChangeDataLoader extends AbstractOperation { String rationale = item.getCurrentVersion().getValue(); - if (ChangeItemUtil.hasApplicabilityChange(item)) { + if (item.isApplicabilityCopy() || ChangeItemUtil.hasApplicabilityOnlyChange(item)) { netModType = ModificationType.APPLICABILITY; change = new RelationChange(startTxBranch, itemGammaId, artId, txDelta, netModType, endTxBArtifact.getArtId(), itemId, item.getCurrentVersion().getApplicabilityToken().getName(), |