diff options
author | afinkbein | 2010-04-17 17:12:59 +0000 |
---|---|---|
committer | afinkbein | 2010-04-17 17:12:59 +0000 |
commit | 61d64c44a630d3ae00eb9d1c20b7292e637ee364 (patch) | |
tree | e6fdd5de19f1d1a85b64cb4a5362a2ab0b8f26c6 /plugins/org.eclipse.osee.ote.ui.test.manager | |
parent | 1b056f236f2163a90cdb07c6ad2540cf72677774 (diff) | |
download | org.eclipse.osee-61d64c44a630d3ae00eb9d1c20b7292e637ee364.tar.gz org.eclipse.osee-61d64c44a630d3ae00eb9d1c20b7292e637ee364.tar.xz org.eclipse.osee-61d64c44a630d3ae00eb9d1c20b7292e637ee364.zip |
Diffstat (limited to 'plugins/org.eclipse.osee.ote.ui.test.manager')
-rw-r--r-- | plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerModel.java | 76 |
1 files changed, 36 insertions, 40 deletions
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerModel.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerModel.java index 6c2ba18da9c..8a8398647bc 100644 --- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerModel.java +++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/core/TestManagerModel.java @@ -13,14 +13,18 @@ package org.eclipse.osee.ote.ui.test.manager.core; import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.logging.Level; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.eclipse.osee.framework.jdk.core.util.AFile; -import org.eclipse.osee.framework.jdk.core.util.AXml; import org.eclipse.osee.framework.logging.OseeLog; import org.eclipse.osee.ote.ui.test.manager.internal.TestManagerPlugin; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -34,11 +38,8 @@ public class TestManagerModel { final static String CONFIGURATION = "configuration";
final static String CONTACT = "contact";
final static String DESCRIPTION = "description";
- final static String MACHINE = "machine";
final static String OFP = "ofp";
- final static String PORT = "port";
final static String ROOTNAME = "testManager";
- final static String TARGET = "target";
public boolean finished = false;
private String configuration = "";
private String contact = "";
@@ -46,8 +47,8 @@ public class TestManagerModel { private String[] ofps = null;
private List<String> parseExceptions = new ArrayList<String>();
private String rawXml = "";
- private String[] targets = null;
- protected String filename = "";
+ protected String filename = ""; + private Map<String, String> defaultOfpExe = new HashMap<String,String>();
public TestManagerModel() {
}
@@ -98,13 +99,6 @@ public class TestManagerModel { return rawXml;
}
- /**
- * @return Returns the targets.
- */
- public String[] getTargets() {
- return targets;
- }
-
public boolean hasParseExceptions() {
return !parseExceptions.isEmpty();
}
@@ -139,10 +133,11 @@ public class TestManagerModel { // Create a DOM builder and parse the fragment
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- // Call this to catch parse errors
- factory.newDocumentBuilder().parse(new InputSource(new StringReader(xmlString)));
-
- parseDocument(xmlString);
+ // Call this to catch parse errors +
+ Document document = factory.newDocumentBuilder().parse(new InputSource(new StringReader(xmlString)));
+
+ parseDocument(xmlString, document);
}
catch (ParserConfigurationException e) {
@@ -182,34 +177,35 @@ public class TestManagerModel { this.ofps = ofps;
}
- /**
- * @param targets The targets to set.
- */
- public void setTargets(String[] targets) {
- this.targets = targets;
- }
-
- private void parseDocument(String xmlString) {
- description = AXml.getTagData(xmlString, DESCRIPTION);
- contact = AXml.getTagData(xmlString, CONTACT);
- ofps = AXml.getTagDataArray(xmlString, OFP);
- String targetArray[] = AXml.getTagDataArray(xmlString, TARGET);
- List<String> targetVector = new ArrayList<String>();
- for (int i = 0; i < targetArray.length; i++) {
- String machine = AXml.getTagData(targetArray[i], MACHINE);
- String port = AXml.getTagData(targetArray[i], PORT);
- if (machine != null && port != null)
- targetVector.add(machine + "," + port);
+ private void parseDocument(String xmlString, Document document) { + NodeList nodeList = document.getFirstChild().getChildNodes(); + List<String> ofpList = new ArrayList<String>(); + defaultOfpExe.clear(); + for(int i = 0; i < nodeList.getLength(); i++){ + Node node = nodeList.item(i); + if(node.getNodeName().equals(DESCRIPTION)){ + description = node.getTextContent(); + } else if(node.getNodeName().equals(CONTACT)){ + contact = node.getTextContent(); + } else if(node.getNodeName().equals(OFP)){ + Node defaultType = node.getAttributes().getNamedItem("default"); + if(defaultType != null){ + String defaultTypeAsString = defaultType.getNodeValue(); + defaultOfpExe.put("default_" + defaultTypeAsString, node.getTextContent().trim()); + } + ofpList.add(node.getTextContent().trim()); + } }
- targets = targetVector.toArray(new String[targetVector.size()]);
-
+ + ofps = ofpList.toArray(new String[ofpList.size()]);// AXml.getTagDataArray(xmlString, OFP); OseeLog.log(TestManagerPlugin.class, Level.INFO, "description *" + description + "*");
OseeLog.log(TestManagerPlugin.class, Level.INFO, "contact *" + contact + "*");
for (int i = 0; i < ofps.length; i++) {
OseeLog.log(TestManagerPlugin.class, Level.INFO, "ofp *" + ofps[i] + "*");
}
- for (int i = 0; i < targets.length; i++) {
- OseeLog.log(TestManagerPlugin.class, Level.INFO, "target *" + targets[i] + "*");
- }
+ } + + public Map<String, String> getOfpDefault() { + return defaultOfpExe; }
}
|