Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2011-10-21 21:05:28 +0000
committerRoberto E. Escobar2011-10-21 21:05:28 +0000
commit4faaa5303f2e761ce00150174c8251e39c113fc3 (patch)
treef49b8c7fd8244062f2d76bc43a18efc7bc32d4f0 /plugins/org.eclipse.osee.display.presenter
parentb79b5826460e3409b91a03b53fb88570bd72eadf (diff)
downloadorg.eclipse.osee-4faaa5303f2e761ce00150174c8251e39c113fc3.tar.gz
org.eclipse.osee-4faaa5303f2e761ce00150174c8251e39c113fc3.tar.xz
org.eclipse.osee-4faaa5303f2e761ce00150174c8251e39c113fc3.zip
feature[ats_25LS9]: Update presenter tests
Diffstat (limited to 'plugins/org.eclipse.osee.display.presenter')
-rw-r--r--plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/DisplayPresenter.java24
-rw-r--r--plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/Utility.java6
2 files changed, 8 insertions, 22 deletions
diff --git a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/DisplayPresenter.java b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/DisplayPresenter.java
index 1518f0f9ea4..62f70b5c11a 100644
--- a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/DisplayPresenter.java
+++ b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/DisplayPresenter.java
@@ -18,8 +18,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import org.eclipse.osee.display.api.components.ArtifactHeaderComponent;
import org.eclipse.osee.display.api.components.AttributeComponent;
import org.eclipse.osee.display.api.components.DisplaysErrorComponent;
@@ -54,28 +52,12 @@ import org.eclipse.osee.orcs.search.Match;
public class DisplayPresenter<T extends SearchHeaderComponent> implements SearchPresenter<T> {
protected final ArtifactProvider artifactProvider;
- private final static Pattern branchPattern = Pattern.compile("branch=([0-9A-Za-z\\+_=]{20,22})");
- private final static Pattern artifactPattern = Pattern.compile("artifact=([0-9A-Za-z\\+_=]{20,22})");
- private final static Pattern nameOnlyPattern = Pattern.compile("nameOnly=(true|false)");
- private final static Pattern searchPhrasePattern = Pattern.compile("search=([\\d\\w%]*)");
- private final static Pattern verbosePattern = Pattern.compile("verbose=(true|false)");
private final static String SIDE_A_KEY = "sideAName";
private final static String SIDE_B_KEY = "sideBName";
- protected final Matcher branchMatcher;
- protected final Matcher artifactMatcher;
- protected final Matcher nameOnlyMatcher;
- protected final Matcher searchPhraseMatcher;
- protected final Matcher verboseMatcher;
-
public DisplayPresenter(ArtifactProvider artifactProvider) {
this.artifactProvider = artifactProvider;
- branchMatcher = branchPattern.matcher("");
- artifactMatcher = artifactPattern.matcher("");
- nameOnlyMatcher = nameOnlyPattern.matcher("");
- searchPhraseMatcher = searchPhrasePattern.matcher("");
- verboseMatcher = verbosePattern.matcher("");
}
@Override
@@ -240,8 +222,10 @@ public class DisplayPresenter<T extends SearchHeaderComponent> implements Search
return;
}
- relationComponent.setLeftName(relation.getAttribute(SIDE_A_KEY));
- relationComponent.setRightName(relation.getAttribute(SIDE_B_KEY));
+ String leftSideName = Strings.capitalize(relation.getAttribute(SIDE_A_KEY));
+ String rightSideName = Strings.capitalize(relation.getAttribute(SIDE_B_KEY));
+ relationComponent.setLeftName(leftSideName);
+ relationComponent.setRightName(rightSideName);
if (relatedSideA.isEmpty()) {
relationComponent.addLeftRelated(null);
diff --git a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/Utility.java b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/Utility.java
index f8862890893..9d55fcb6bcf 100644
--- a/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/Utility.java
+++ b/plugins/org.eclipse.osee.display.presenter/src/org/eclipse/osee/display/presenter/Utility.java
@@ -68,6 +68,7 @@ public final class Utility {
if (toParse.startsWith("/")) {
toParse = toParse.substring(1, toParse.length());
}
+
Map<String, String> values = new HashMap<String, String>();
String[] lines = toParse.split("&");
for (String line : lines) {
@@ -75,14 +76,15 @@ public final class Utility {
if (data.length == 2) {
String key = data[0];
String value = data[1];
- if (Strings.isValid(value)) {
+ if (Strings.isValid(value) && Strings.isValid(key)) {
try {
value = URLDecoder.decode(value, "UTF-8");
+ key = URLDecoder.decode(key, "UTF-8");
+ values.put(key, value);
} catch (UnsupportedEncodingException ex) {
//
}
}
- values.put(key, value);
}
}
return values;

Back to the top