Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormegumi.telles2016-10-05 18:55:52 +0000
committermegumi.telles2016-10-11 16:14:33 +0000
commit2ab1b21cd90b656e779489ebda99251eafc3f4f0 (patch)
treea30e227b3f724645d2400017cc739623e3ce607a /plugins
parent36faa5cf1f97bcae7b0d7cbbe2001664f5778966 (diff)
downloadorg.eclipse.osee-2ab1b21cd90b656e779489ebda99251eafc3f4f0.tar.gz
org.eclipse.osee-2ab1b21cd90b656e779489ebda99251eafc3f4f0.tar.xz
org.eclipse.osee-2ab1b21cd90b656e779489ebda99251eafc3f4f0.zip
bug[ats_ATS317062]: Fix validate requirements unexpected errors
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/UniqueNameRule.java39
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/ValidationReportOperation.java46
2 files changed, 50 insertions, 35 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/UniqueNameRule.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/UniqueNameRule.java
index 74fc94f602f..124d20dfc28 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/UniqueNameRule.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/UniqueNameRule.java
@@ -30,7 +30,7 @@ import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
public class UniqueNameRule extends AbstractValidationRule {
private final IArtifactType artifactType;
- private final Collection<GuidPair> guidPairs = new LinkedList<>();
+ private final Collection<UuidPair> uuidPairs = new LinkedList<>();
public UniqueNameRule(IArtifactType artifactType) {
this.artifactType = artifactType;
@@ -49,9 +49,8 @@ public class UniqueNameRule extends AbstractValidationRule {
List<Artifact> arts = ArtifactQuery.getArtifactListFromTypeWithInheritence(artifactType,
artToValidate.getBranch(), DeletionFlag.EXCLUDE_DELETED);
for (Artifact art : arts) {
- if (art.getName().equalsIgnoreCase(
- artToValidate.getName()) && art.getGuid() != artToValidate.getGuid() && !hasGuidPairAlreadyBeenEvaluated(
- art.getGuid(), artToValidate.getGuid())) {
+ if (art.getName().equalsIgnoreCase(artToValidate.getName()) && !art.getUuid().equals(
+ artToValidate.getUuid()) && !hasUuidPairAlreadyBeenEvaluated(art.getUuid(), artToValidate.getUuid())) {
/**************************************************************************
* Special case: Allow duplicate names of artifacts if<br/>
* 1) Artifact name is numeric <br/>
@@ -73,7 +72,7 @@ public class UniqueNameRule extends AbstractValidationRule {
artToValidate) + " and " + ValidationReportOperation.getRequirementHyperlink(
art) + " have same name value:\"" + artToValidate.getName() + " \"");
validationPassed = false;
- addGuidPair(art.getGuid(), artToValidate.getGuid());
+ addUuidPair(art.getUuid(), artToValidate.getUuid());
}
}
}
@@ -86,34 +85,34 @@ public class UniqueNameRule extends AbstractValidationRule {
childArtifact.getParent().equals(parentArtifact));
}
- private void addGuidPair(String guidA, String guidB) {
- guidPairs.add(new GuidPair(guidA, guidB));
+ private void addUuidPair(Long uuidA, Long uuidB) {
+ uuidPairs.add(new UuidPair(uuidA, uuidB));
}
- private boolean hasGuidPairAlreadyBeenEvaluated(String guidA, String guidB) {
- for (GuidPair guidPair : guidPairs) {
- if (guidPair.getGuidA().equals(guidA) && guidPair.getGuidB().equals(guidB) || guidPair.getGuidA().equals(
- guidB) && guidPair.getGuidB().equals(guidA)) {
+ private boolean hasUuidPairAlreadyBeenEvaluated(Long uuidA, Long uuidB) {
+ for (UuidPair uuidPair : uuidPairs) {
+ if (uuidPair.getUuidA().equals(uuidA) && uuidPair.getUuidB().equals(uuidB) || uuidPair.getUuidA().equals(
+ uuidB) && uuidPair.getUuidB().equals(uuidA)) {
return true;
}
}
return false;
}
- private class GuidPair {
- private final String guidA, guidB;
+ private class UuidPair {
+ private final Long uuidA, uuidB;
- public GuidPair(String guidA, String guidB) {
- this.guidA = guidA;
- this.guidB = guidB;
+ public UuidPair(Long uuidA, Long uuidB) {
+ this.uuidA = uuidA;
+ this.uuidB = uuidB;
}
- public String getGuidA() {
- return guidA;
+ public Long getUuidA() {
+ return uuidA;
}
- public String getGuidB() {
- return guidB;
+ public Long getUuidB() {
+ return uuidB;
}
}
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/ValidationReportOperation.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/ValidationReportOperation.java
index 0b3339f1675..4d5e2fdc27c 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/ValidationReportOperation.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/ValidationReportOperation.java
@@ -18,15 +18,19 @@ import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.ats.api.workflow.IAtsBranchService;
+import org.eclipse.osee.ats.core.client.IAtsClient;
import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
import org.eclipse.osee.ats.core.client.util.AtsUtilClient;
import org.eclipse.osee.ats.internal.Activator;
+import org.eclipse.osee.ats.internal.AtsClientService;
import org.eclipse.osee.ats.util.AtsBranchManager;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
import org.eclipse.osee.framework.core.operation.OperationLogger;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.revision.ChangeData;
@@ -84,24 +88,28 @@ public class ValidationReportOperation extends AbstractOperation {
lastTitle = currentTitle;
}
- int artIndex = 1;
- for (Artifact art : changedArtifacts) {
- monitor.setTaskName(String.format("Validating: Rule[%s of %s] Artifact[%s of %s]", ruleIndex,
- rules.size(), artIndex, changedArtifacts.size()));
- checkForCancelledStatus(monitor);
-
- ValidationResult result = rule.validate(art, monitor);
- if (!result.didValidationPass()) {
- for (String errorMsg : result.getErrorMessages()) {
- if (art.isOfType(CoreArtifactTypes.DirectSoftwareRequirement)) {
- logf("Error: %s", errorMsg);
- } else {
- warnings.add(String.format("Warning: %s", errorMsg));
+ if (isSkipRelationCheck(rule.getRuleTitle())) {
+ logf("INFO: Relations Check skipped: detected committed branches.");
+ } else {
+ int artIndex = 1;
+ for (Artifact art : changedArtifacts) {
+ monitor.setTaskName(String.format("Validating: Rule[%s of %s] Artifact[%s of %s]", ruleIndex,
+ rules.size(), artIndex, changedArtifacts.size()));
+ checkForCancelledStatus(monitor);
+
+ ValidationResult result = rule.validate(art, monitor);
+ if (!result.didValidationPass()) {
+ for (String errorMsg : result.getErrorMessages()) {
+ if (art.isOfType(CoreArtifactTypes.DirectSoftwareRequirement)) {
+ logf("Error: %s", errorMsg);
+ } else {
+ warnings.add(String.format("Warning: %s", errorMsg));
+ }
}
}
+ monitor.worked(workAmount);
+ artIndex++;
}
- monitor.worked(workAmount);
- artIndex++;
}
ruleIndex++;
}
@@ -119,6 +127,14 @@ public class ValidationReportOperation extends AbstractOperation {
}
}
+ private boolean isSkipRelationCheck(String ruleTitle) {
+ IAtsClient atsClient = AtsClientService.get();
+ Conditions.checkNotNull(atsClient, "AtsClientService");
+ IAtsBranchService branchService = atsClient.getBranchService();
+ Conditions.checkNotNull(branchService, "AtsBranchService");
+ return branchService.isBranchesAllCommitted(teamArt) && ruleTitle.equals("Relations Check:");
+ }
+
private final class ValidationRuleComparator implements Comparator<AbstractValidationRule> {
@Override

Back to the top