Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid W. Miller2017-10-03 19:33:49 -0400
committerDavid W. Miller2017-10-04 11:30:01 -0400
commit31f5ae9ba86ea0c6794ec5ced8b91db3c80ad3c5 (patch)
treec3a4e5453466c0adc789319301144e228fbee3c6
parent3c53b7c2387c074dd01f15e045ac0019b67e1b68 (diff)
downloadorg.eclipse.osee-31f5ae9ba86ea0c6794ec5ced8b91db3c80ad3c5.tar.gz
org.eclipse.osee-31f5ae9ba86ea0c6794ec5ced8b91db3c80ad3c5.tar.xz
org.eclipse.osee-31f5ae9ba86ea0c6794ec5ced8b91db3c80ad3c5.zip
bug[ats_TW2213]: Add utility to help with feature name comparison
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/MatchingApplicabilityTagsRule.java20
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordApplicabilityTest.java21
-rw-r--r--plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordUpdateArtifact.java2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/actions/CatchWordMlChanges.java19
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ApplicabilityUtility.java39
5 files changed, 46 insertions, 55 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/MatchingApplicabilityTagsRule.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/MatchingApplicabilityTagsRule.java
index 97b6c88f34..2353465671 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/MatchingApplicabilityTagsRule.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/util/validate/MatchingApplicabilityTagsRule.java
@@ -13,15 +13,13 @@ package org.eclipse.osee.ats.util.validate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
-import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.osee.ats.core.client.IAtsClient;
-import org.eclipse.osee.framework.core.data.FeatureDefinitionData;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.util.WordCoreUtil;
import org.eclipse.osee.framework.jdk.core.type.HashCollection;
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.utility.ApplicabilityUtility;
import org.eclipse.osee.framework.skynet.core.word.WordUtil;
/**
@@ -29,30 +27,16 @@ import org.eclipse.osee.framework.skynet.core.word.WordUtil;
*/
public class MatchingApplicabilityTagsRule extends AbstractValidationRule {
- private final IAtsClient atsClient;
- private List<FeatureDefinitionData> featureDefinitionData;
private HashCollection<String, String> validFeatureValues;
private HashSet<String> validConfigurations;
- public MatchingApplicabilityTagsRule(IAtsClient atsClient) {
- this.atsClient = atsClient;
- }
-
@Override
protected ValidationResult validate(Artifact artToValidate, IProgressMonitor monitor) throws OseeCoreException {
Collection<String> errorMessages = new ArrayList<>();
String wordml = artToValidate.getSoleAttributeValue(CoreAttributeTypes.WordTemplateContent, "");
- if (featureDefinitionData == null) {
- featureDefinitionData =
- atsClient.getOseeClient().getApplicabilityEndpoint(artToValidate.getBranch()).getFeatureDefinitionData();
- }
-
if (validFeatureValues == null) {
- validFeatureValues = new HashCollection<>();
- for (FeatureDefinitionData feat : featureDefinitionData) {
- validFeatureValues.put(feat.getName(), feat.getValues());
- }
+ validFeatureValues = ApplicabilityUtility.getValidFeatureValuesForBranch(artToValidate.getBranch());
}
if (validConfigurations == null) {
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordApplicabilityTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordApplicabilityTest.java
index b6998857a4..a38a7acd5f 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordApplicabilityTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/ui/skynet/WordApplicabilityTest.java
@@ -14,16 +14,13 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.HashSet;
-import java.util.List;
import org.eclipse.osee.framework.core.data.BranchId;
-import org.eclipse.osee.framework.core.data.FeatureDefinitionData;
import org.eclipse.osee.framework.core.enums.DemoBranches;
import org.eclipse.osee.framework.core.util.WordCoreUtil;
import org.eclipse.osee.framework.jdk.core.type.HashCollection;
import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.skynet.core.utility.ApplicabilityUtility;
import org.eclipse.osee.framework.skynet.core.word.WordUtil;
-import org.eclipse.osee.framework.ui.skynet.internal.ServiceUtil;
-import org.eclipse.osee.orcs.rest.client.OseeClient;
import org.junit.Before;
import org.junit.Test;
@@ -37,14 +34,12 @@ public class WordApplicabilityTest {
private static final String TEST_ElSE_TAGS = "support/WordApplicabilityElseTags.xml";
private static final String TEST_EMBEDDED_TAGS = "support/WordApplicabilityEmbeddedTags.xml";
- private OseeClient oseeClient;
HashCollection<String, String> validFeatureValuesForBranch;
HashSet<String> validConfigurations;
@Before
public void setup() {
- oseeClient = ServiceUtil.getOseeClient();
- validFeatureValuesForBranch = getValidFeatureValuesForBranch(DemoBranches.SAW_Bld_1);
+ validFeatureValuesForBranch = ApplicabilityUtility.getValidFeatureValuesForBranch(DemoBranches.SAW_Bld_1);
validConfigurations = getValidConfigurations(DemoBranches.SAW_Bld_1);
}
@@ -80,18 +75,6 @@ public class WordApplicabilityTest {
validConfigurations));
}
- private HashCollection<String, String> getValidFeatureValuesForBranch(BranchId branch) {
- List<FeatureDefinitionData> featureDefinitionData =
- oseeClient.getApplicabilityEndpoint(branch).getFeatureDefinitionData();
-
- HashCollection<String, String> validFeatureValues = new HashCollection<>();
- for (FeatureDefinitionData feat : featureDefinitionData) {
- validFeatureValues.put(feat.getName(), feat.getValues());
- }
-
- return validFeatureValues;
- }
-
private HashSet<String> getValidConfigurations(BranchId branch) {
return WordUtil.getValidConfigurations(branch);
}
diff --git a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordUpdateArtifact.java b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordUpdateArtifact.java
index d1f8aa0347..b57c6509db 100644
--- a/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordUpdateArtifact.java
+++ b/plugins/org.eclipse.osee.define.report/src/org/eclipse/osee/define/report/internal/wordupdate/WordUpdateArtifact.java
@@ -250,7 +250,7 @@ public class WordUpdateArtifact {
HashCollection<String, String> validFeatureValues = new HashCollection<>();
for (FeatureDefinitionData feat : featureDefinitionData) {
- validFeatureValues.put(feat.getName(), feat.getValues());
+ validFeatureValues.put(feat.getName().toUpperCase(), feat.getValues());
}
return validFeatureValues;
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/actions/CatchWordMlChanges.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/actions/CatchWordMlChanges.java
index 9ffc5e0d75..3aaacb229a 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/actions/CatchWordMlChanges.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/commit/actions/CatchWordMlChanges.java
@@ -14,25 +14,22 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.osee.framework.core.data.BranchId;
-import org.eclipse.osee.framework.core.data.FeatureDefinitionData;
import org.eclipse.osee.framework.core.exception.OseeWrappedException;
import org.eclipse.osee.framework.core.operation.IOperation;
import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.jdk.core.type.HashCollection;
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.Attribute;
import org.eclipse.osee.framework.skynet.core.attribute.WordAttribute;
import org.eclipse.osee.framework.skynet.core.change.AttributeChange;
import org.eclipse.osee.framework.skynet.core.change.Change;
-import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil;
import org.eclipse.osee.framework.skynet.core.revision.ChangeManager;
import org.eclipse.osee.framework.skynet.core.revision.LoadChangeType;
+import org.eclipse.osee.framework.skynet.core.utility.ApplicabilityUtility;
import org.eclipse.osee.framework.skynet.core.utility.OseeInfo;
import org.eclipse.osee.framework.skynet.core.validation.IOseeValidator;
import org.eclipse.osee.framework.skynet.core.validation.OseeValidator;
@@ -72,7 +69,7 @@ public class CatchWordMlChanges implements CommitAction {
Boolean.valueOf(OseeInfo.getCachedValue("osee.are.applicability.tags.invalid"));
Boolean isInvalidTags =
useInvalidTagsCheck ? (((WordAttribute) attribute).areApplicabilityTagsInvalid(destinationBranch,
- getValidFeatureValuesForBranch(destinationBranch),
+ ApplicabilityUtility.getValidFeatureValuesForBranch(destinationBranch),
WordUtil.getValidConfigurations(destinationBranch))) : useInvalidTagsCheck;
if (isInvalidTags) {
applicabilityTags.put(attribute.getArtifact().getArtId(), attribute.getArtifact().getSafeName());
@@ -125,16 +122,4 @@ public class CatchWordMlChanges implements CommitAction {
return String.format("Error validating: [(%s)(%s) - %s] on branchUuid:[%s]", artifact.getArtId(),
artifact.getGuid(), artifact.getName(), artifact.getBranch());
}
-
- private HashCollection<String, String> getValidFeatureValuesForBranch(BranchId branch) {
- List<FeatureDefinitionData> featureDefinitionData =
- ServiceUtil.getOseeClient().getApplicabilityEndpoint(branch).getFeatureDefinitionData();
-
- HashCollection<String, String> validFeatureValues = new HashCollection<>();
- for (FeatureDefinitionData feat : featureDefinitionData) {
- validFeatureValues.put(feat.getName(), feat.getValues());
- }
-
- return validFeatureValues;
- }
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ApplicabilityUtility.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ApplicabilityUtility.java
new file mode 100644
index 0000000000..d1bf5c6731
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/utility/ApplicabilityUtility.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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.framework.skynet.core.utility;
+
+import java.util.List;
+import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.FeatureDefinitionData;
+import org.eclipse.osee.framework.jdk.core.type.HashCollection;
+import org.eclipse.osee.framework.skynet.core.internal.ServiceUtil;
+import org.eclipse.osee.orcs.rest.client.OseeClient;
+
+/**
+ * @author David W. Miller
+ */
+public class ApplicabilityUtility {
+
+ public static HashCollection<String, String> getValidFeatureValuesForBranch(BranchId branch) {
+
+ OseeClient oseeClient = ServiceUtil.getOseeClient();
+
+ List<FeatureDefinitionData> featureDefinitionData =
+ oseeClient.getApplicabilityEndpoint(branch).getFeatureDefinitionData();
+
+ HashCollection<String, String> validFeatureValues = new HashCollection<>();
+ for (FeatureDefinitionData feat : featureDefinitionData) {
+ validFeatureValues.put(feat.getName().toUpperCase(), feat.getValues());
+ }
+
+ return validFeatureValues;
+ }
+}

Back to the top