You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2014/07/12 00:21:24 UTC

[11/20] updating xbaya gui to the new airavata

http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/scufl/script/ScuflScript.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/scufl/script/ScuflScript.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/scufl/script/ScuflScript.java
index 27442e4..263dcde 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/scufl/script/ScuflScript.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/scufl/script/ScuflScript.java
@@ -1,539 +1,539 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.scufl.script;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.workflow.model.component.ws.WSComponent;
-import org.apache.airavata.workflow.model.graph.DataPort;
-import org.apache.airavata.workflow.model.graph.GraphException;
-import org.apache.airavata.workflow.model.graph.Node;
-import org.apache.airavata.workflow.model.graph.Port;
-import org.apache.airavata.workflow.model.graph.impl.NodeImpl;
-import org.apache.airavata.workflow.model.graph.system.ConstantNode;
-import org.apache.airavata.workflow.model.graph.system.EndifNode;
-import org.apache.airavata.workflow.model.graph.system.IfNode;
-import org.apache.airavata.workflow.model.graph.system.InputNode;
-import org.apache.airavata.workflow.model.graph.system.MemoNode;
-import org.apache.airavata.workflow.model.graph.system.OutputNode;
-import org.apache.airavata.workflow.model.graph.util.GraphUtil;
-import org.apache.airavata.workflow.model.graph.ws.WSGraph;
-import org.apache.airavata.workflow.model.graph.ws.WSNode;
-import org.apache.airavata.workflow.model.wf.Workflow;
-import org.apache.airavata.xbaya.XBayaConfiguration;
-import org.xmlpull.infoset.impl.XmlElementWithViewsImpl;
-import org.xmlpull.v1.builder.XmlBuilderException;
-import org.xmlpull.v1.builder.XmlDocument;
-import org.xmlpull.v1.builder.XmlElement;
-import org.xmlpull.v1.builder.XmlInfosetBuilder;
-import org.xmlpull.v1.builder.XmlNamespace;
-
-import xsul.XmlConstants;
-import xsul5.wsdl.WsdlMessage;
-import xsul5.wsdl.WsdlMessagePart;
-import xsul5.wsdl.WsdlPort;
-import xsul5.wsdl.WsdlPortType;
-import xsul5.wsdl.WsdlPortTypeOperation;
-import xsul5.wsdl.WsdlService;
-
-public class ScuflScript {
-
-    private Workflow workflow;
-
-    private XBayaConfiguration configuration;
-
-    private WSGraph graph;
-
-    private ArrayList<String> arguments;
-
-    private List<InputNode> inputNodes;
-
-    private List<OutputNode> outputNodes;
-
-    private XmlInfosetBuilder builder = XmlConstants.BUILDER;
-
-    private LinkedList<Node> notYetInvokedNodes;
-
-    private LinkedList<Node> executingNodes;
-
-    private XmlNamespace scuflNS = builder.newNamespace("s", "http://org.embl.ebi.escience/xscufl/0.1alpha");
-
-    private Map<String, XmlElement> sources = new HashMap<String, XmlElement>();
-
-    private List<XmlElement> links = new ArrayList<XmlElement>();
-
-    private List<XmlElement> sinks = new ArrayList<XmlElement>();
-
-    private XmlDocument script;
-
-    public ScuflScript(Workflow workflow, XBayaConfiguration configuration) {
-        this.workflow = workflow;
-        this.configuration = configuration;
-        this.graph = this.workflow.getGraph();
-
-        this.arguments = new ArrayList<String>();
-
-        this.notYetInvokedNodes = new LinkedList<Node>();
-        for (Node node : this.graph.getNodes()) {
-            if (!(node instanceof MemoNode)) {
-                this.notYetInvokedNodes.add(node);
-            }
-        }
-        this.executingNodes = new LinkedList<Node>();
-        this.inputNodes = GraphUtil.getInputNodes(this.graph);
-        this.outputNodes = GraphUtil.getOutputNodes(this.graph);
-    }
-
-    public void create() throws GraphException {
-
-        XmlDocument doc = builder.newDocument();
-
-        XmlElement scufl = doc.addDocumentElement(scuflNS, "scufl");
-        scufl.addAttribute("version", "0.2");
-        scufl.addAttribute("log", "0");
-        XmlElement description = scufl.addElement(scuflNS, "workflowdescription");
-        description.addAttribute("lsid", "urn:lsid:net.sf.taverna:wfDefinition:" + UUID.randomUUID());
-        description.addAttribute("author", "");
-        description.addAttribute("title", workflow.getName());
-        writeServices(scufl);
-
-        writeSplitors(scufl);
-
-        // add links
-        for (XmlElement link : this.links) {
-            scufl.addElement(link);
-        }
-
-        // add source
-        for (String key : this.sources.keySet()) {
-            scufl.addElement(this.sources.get(key));
-        }
-
-        // add sinks
-        for (XmlElement sink : this.sinks) {
-            scufl.addElement(sink);
-        }
-
-        this.script = doc;
-
-    }
-
-    public String getScript() {
-        return builder.serializeToString(this.script);
-    }
-
-    /**
-     * @param scufl
-     * @throws GraphException
-     */
-    private void writeSplitors(XmlElement scufl) throws GraphException {
-
-        Collection<Node> nextNodes = getNextNodes();
-        while (nextNodes.size() > 0) {
-            for (Node node : nextNodes) {
-
-                if (node instanceof WSNode) {
-                    WSNode wsNode = (WSNode) node;
-                    node.getInputPorts();
-                    writeSplitorPerService(scufl, wsNode);
-
-                } else {
-                    // TODO conditions, loops might come here.
-                }
-                this.notYetInvokedNodes.remove(node);
-                nextNodes = getNextNodes();
-            }
-        }
-    }
-
-    /**
-     * @param scufl
-     * @param node
-     * @throws GraphException
-     */
-    private void writeSplitorPerService(XmlElement scufl, WSNode node) throws GraphException {
-        List<DataPort> inputPorts = node.getInputPorts();
-        XmlElement processor = scufl.addElement(scuflNS, "processor");
-        processor.addAttribute("name", getValidName(node) + "InputMessagePartXML");
-        XmlElement local = processor.addElement(scuflNS, "local");
-        local.addChild(0, "org.embl.ebi.escience.scuflworkers.java.XMLInputSplitter");
-        XmlElement extensions = local.addElement(scuflNS, "extensions");
-
-        QName inputName = getInputElementName(node);
-        if (null == inputName) {
-            throw new GraphException("No Valid input type found for WS Node" + node.getName());
-        }
-        if (node.getOutputPorts().size() != 1) {
-            throw new GraphException("Number of out ports in WS node " + node.getName() + "is invalid:"
-                    + node.getOutputPorts().size());
-        }
-        DataPort outputPort = node.getOutputPort(0);
-
-        WSComponent component = node.getComponent();
-        String inputPartName = component.getInputPartName();
-        String inputTypeName = component.getInputTypeName();
-
-        XmlElement complexType = extensions.addElement(scuflNS, "complextype");
-        complexType.addAttribute("optional", "false");
-        complexType.addAttribute("unbounded", "false");
-        complexType.addAttribute("typename", inputTypeName);
-
-        String spliterName = inputPartName;
-        complexType.addAttribute("name", spliterName);
-        complexType.addAttribute("qname", inputName.toString());
-
-        XmlElement element = complexType.addElement(scuflNS, "elements");
-        for (DataPort port : inputPorts) {
-            if ("http://www.w3.org/2001/XMLSchema".equals(port.getType().getNamespaceURI())) {
-                XmlElement baseType = element.addElement(scuflNS, "basetype");
-                baseType.addAttribute("optional", "false");
-                baseType.addAttribute("unbounded", "false");
-                baseType.addAttribute("typename", port.getType().getLocalPart());
-                baseType.addAttribute("name", port.getName());
-                baseType.addAttribute("qname", inputTypeName + "&gt;" + port.getName());
-
-            }
-            // all the sources are written here
-            // the links from input nodes to the spiters are done here
-            // links from the from node output splitter to the this service's
-            // inputsplitter is done here
-
-            if (port.getFromNode() instanceof InputNode) {
-                XmlElement source = builder.newFragment(scuflNS, "source");
-                source.addAttribute("name", port.getFromNode().getID());
-                if (!sourceExist(port.getFromNode().getID())) {
-                    this.sources.put(port.getFromNode().getID(), source);
-                }
-                XmlElement link = builder.newFragment(scuflNS, "link");
-                link.addAttribute("source", port.getFromNode().getID());
-                link.addAttribute("sink", getValidName(node) + "InputMessagePartXML:" + port.getName());
-                this.links.add(link);
-
-            } else if (port.getFromNode() instanceof WSNode) {
-                XmlElement link = builder.newFragment(scuflNS, "link");
-                if (port.getFromNode().getOutputPorts().size() != 1) {
-                    throw new GraphException("Number of out ports in from WS node " + port.getFromNode().getName()
-                            + "is invalid:" + node.getOutputPorts().size());
-                }
-                link.addAttribute("source", getValidName((WSNode) port.getFromNode()) + "OutputMessagePartXML:"
-                        + port.getFromNode().getOutputPort(0).getName());
-                link.addAttribute("sink", getValidName(node) + "InputMessagePartXML:" + port.getName());
-                this.links.add(link);
-            } else {
-                throw new GraphException("Unhandled from node type:" + port.getFromNode() + " for node"
-                        + node.getName());
-            }
-        }
-
-        // link from the spliter to the service
-
-        XmlElement link = builder.newFragment(scuflNS, "link");
-        link.addAttribute("source", getValidName(node) + "InputMessagePartXML:output");
-        link.addAttribute("sink", getValidName(node) + ":" + spliterName);
-        this.links.add(link);
-
-        // link from service out to the ouput spliter
-
-        link = builder.newFragment(scuflNS, "link");
-        link.addAttribute("source", getValidName(node) + ":" + node.getComponent().getOutputPartName());
-        link.addAttribute("sink", getValidName(node) + "OutputMessagePartXML:input");
-        this.links.add(link);
-
-        // /outspiltor
-        XmlElement outProcessor = scufl.addElement(scuflNS, "processor");
-        outProcessor.addAttribute("name", getValidName(node) + "OutputMessagePartXML");
-        XmlElement outLocal = outProcessor.addElement(scuflNS, "local");
-        outLocal.addChild(0, "org.embl.ebi.escience.scuflworkers.java.XMLOutputSplitter");
-        XmlElement outExtensions = outLocal.addElement(scuflNS, "extensions");
-        XmlElement outComplextype = outExtensions.addElement(scuflNS, "complextype");
-        outComplextype.addAttribute("optional", "false");
-        outComplextype.addAttribute("unbounded", "false");
-        outComplextype.addAttribute("typename", component.getOutputTypeName());
-        outComplextype.addAttribute("name", component.getOutputPartName());
-        QName outputName = getOutputElementName(node);
-        if (null == outputName) {
-            throw new GraphException("No Valid output type found for WS Node" + node.getName());
-        }
-        outComplextype.addAttribute("qname", outputName.toString());
-        XmlElement elements = outComplextype.addElement(scuflNS, "elements");
-        XmlElement outBaseType = elements.addElement(scuflNS, "basetype");
-        outBaseType.addAttribute("optional", "false");
-        outBaseType.addAttribute("unbounded", "false");
-
-        outBaseType.addAttribute("typename", outputPort.getType().getLocalPart());
-        String Z = component.getOutputPort(0).getName();
-        outBaseType.addAttribute("name", Z);
-
-        outBaseType.addAttribute("qname", component.getOutputTypeName() + "&gt;" + Z);
-
-        List<DataPort> outputPorts = node.getOutputPorts();
-        for (DataPort port : outputPorts) {
-            List<Node> toNodes = port.getToNodes();
-            for (Node toNode : toNodes) {
-                if (toNode instanceof OutputNode) {
-                    if ("http://www.w3.org/2001/XMLSchema".equals(port.getType().getNamespaceURI())) {
-                        XmlElement sink = builder.newFragment(scuflNS, "sink");
-                        sink.addAttribute("name", toNode.getID());
-                        sinks.add(sink);
-                        link = builder.newFragment(scuflNS, "link");
-                        link.addAttribute("source", getValidName(node) + "OutputMessagePartXML:" + outputPort.getName());
-                        link.addAttribute("sink", toNode.getID());
-                        this.links.add(link);
-                    }
-                }
-            }
-        }
-
-    }
-
-    private boolean sourceExist(String name) {
-        Set<String> keys = this.sources.keySet();
-        for (String string : keys) {
-            if (name.equals(string))
-                return true;
-        }
-        return false;
-    }
-
-    /**
-     * @param node
-     * @return
-     * @throws GraphException
-     */
-    private QName getInputElementName(WSNode node) throws GraphException {
-        WSComponent component = node.getComponent();
-        String portTypeName = component.getPortTypeQName().getLocalPart();
-        WsdlPortType portType = component.getWSDL().getPortType(portTypeName);
-        WsdlPortTypeOperation operation = portType.getOperation(component.getOperationName());
-        QName message = operation.getInput().getMessage();
-        WsdlMessage wsdlMessage = component.getWSDL().getMessage(message.getLocalPart());
-        Iterator<WsdlMessagePart> iterator = wsdlMessage.parts().iterator();
-        QName inputName = null;
-        if (iterator.hasNext()) {
-            inputName = iterator.next().getElement();
-        } else {
-            throw new GraphException("No input part found for WS Node" + node.getName());
-        }
-        return inputName;
-    }
-
-    private QName getOutputElementName(WSNode node) throws GraphException {
-        WSComponent component = node.getComponent();
-        String portTypeName = component.getPortTypeQName().getLocalPart();
-        WsdlPortType portType = component.getWSDL().getPortType(portTypeName);
-        WsdlPortTypeOperation operation = portType.getOperation(component.getOperationName());
-        QName message = operation.getOutput().getMessage();
-        WsdlMessage wsdlMessage = component.getWSDL().getMessage(message.getLocalPart());
-        Iterator<WsdlMessagePart> iterator = wsdlMessage.parts().iterator();
-        QName inputName = null;
-        if (iterator.hasNext()) {
-            inputName = iterator.next().getElement();
-        } else {
-            throw new GraphException("No output part found for WS Node" + node.getName());
-        }
-        return inputName;
-    }
-
-    private void writeServices(XmlElement scufl) throws GraphException {
-
-        Collection<NodeImpl> nextNodes = this.graph.getNodes();
-        for (NodeImpl node : nextNodes) {
-            if (node instanceof WSNode) {
-                WSNode wsNode = (WSNode) node;
-                createWSProcess(wsNode, scufl);
-            }
-        }
-    }
-
-    private XmlElement createWSProcess(WSNode node, XmlElement scufl) throws GraphException, XmlBuilderException {
-
-        XmlElement processor = scufl.addElement(scuflNS, "processor");
-        String name = getValidName(node);
-        processor.addAttribute("name", name);
-        XmlElement description = processor.addElement(scuflNS, "description");
-        String txt = node.getComponent().getDescription();
-        if (null == txt) {
-            description.addChild(name);
-        } else {
-            description.addChild(txt);
-        }
-
-        XmlElement arbitrarywsdl = processor.addElement(scuflNS, "arbitrarywsdl");
-        XmlElement wsdl = arbitrarywsdl.addElement(scuflNS, "wsdl");
-
-        String epr = getEPR(node);
-        if (null == epr) {
-            throw new GraphException("EPR not found for the WS-node:" + builder.serializeToString(node));
-        }
-        wsdl.addChild(epr + "?wsdl");
-
-        XmlElement operation = arbitrarywsdl.addElement(scuflNS, "operation");
-        operation.addChild(node.getOperationName());
-
-        return processor;
-
-    }
-
-    /**
-     * @param node
-     * @return
-     */
-    private String getValidName(WSNode node) {
-        return node.getID();
-        // String name = node.getName();
-        // if (name.indexOf(":") != -1) {
-        // name = name.substring(0, name.indexOf(":"));
-        // }
-        // return name;
-    }
-
-    /**
-     * @param wsNode
-     */
-    private String getEPR(WSNode wsNode) {
-        Iterable<WsdlService> services = wsNode.getComponent().getWSDL().services();
-        Iterator<WsdlService> iterator = services.iterator();
-        if (iterator.hasNext()) {
-            Iterable<WsdlPort> ports = iterator.next().ports();
-            Iterator<WsdlPort> portIterator = ports.iterator();
-            if (portIterator.hasNext()) {
-                WsdlPort port = portIterator.next();
-                Iterable children = port.xml().children();
-                Iterator childIterator = children.iterator();
-                while (childIterator.hasNext()) {
-                    Object next = childIterator.next();
-                    if (next instanceof XmlElementWithViewsImpl) {
-                        org.xmlpull.infoset.XmlAttribute epr = ((XmlElementWithViewsImpl) next).attribute("location");
-                        return epr.getValue();
-                    }
-                }
-            }
-        }
-        return null;
-    }
-
-    public boolean validate(List<String> warnings) {
-        // Empty
-        if (this.graph.getNodes().size() == 0) {
-            String message = "The workflow is empty.";
-            warnings.add(message);
-        }
-
-        // Input ports need to be connected.
-        Collection<Port> inputPorts = GraphUtil.getPorts(this.graph, Port.Kind.DATA_IN);
-        for (Port inputPort : inputPorts) {
-            Collection<Port> fromPorts = inputPort.getFromPorts();
-            if (fromPorts.size() == 0) {
-                Node node = inputPort.getNode();
-                String message = node.getID() + " has an unconnected input " + inputPort.getName();
-                warnings.add(message);
-            }
-        }
-
-        // Input nodes need to be connected.
-        for (InputNode inputNode : this.inputNodes) {
-            if (inputNode.getPort().getToPorts().size() == 0) {
-                String message = inputNode.getID() + " is not connected to any service.";
-                warnings.add(message);
-            }
-        }
-
-        // Cycle
-        if (GraphUtil.containsCycle(this.graph)) {
-            String message = "There is a cycle in the workflow.";
-            warnings.add(message);
-        }
-
-        // Constants are not supported.
-        List<ConstantNode> constantNodes = GraphUtil.getNodes(this.graph, ConstantNode.class);
-        if (constantNodes.size() > 0) {
-            String message = "Constants are not supported for Scufl scripts.";
-            warnings.add(message);
-        }
-
-        // If/endif are not supported.
-        List<IfNode> ifNodes = GraphUtil.getNodes(this.graph, IfNode.class);
-        List<EndifNode> endifNodes = GraphUtil.getNodes(this.graph, EndifNode.class);
-        if (ifNodes.size() > 0 || endifNodes.size() > 0) {
-            String message = "If/endif are not supported for Scufl scripts.";
-            warnings.add(message);
-        }
-
-        if (warnings.size() > 0) {
-            return false;
-        } else {
-            // No error.
-            return true;
-        }
-    }
-
-    private Collection<Node> getNextNodes() throws GraphException {
-        Collection<Node> nextNodes = new ArrayList<Node>();
-        for (Node node : this.notYetInvokedNodes) {
-            if (isNextNode(node)) {
-                nextNodes.add(node);
-            }
-        }
-        return nextNodes;
-    }
-
-    private boolean isNextNode(Node node) throws GraphException {
-        if (node instanceof OutputNode) {
-            return false;
-        }
-        for (Port port : node.getInputPorts()) {
-            Collection<Node> fromNodes = port.getFromNodes();
-            if (fromNodes.isEmpty()) {
-                throw new GraphException("There is a port that is not connected to any.");
-            } else {
-                for (Node fromNode : fromNodes) {
-                    if (this.notYetInvokedNodes.contains(fromNode)) {
-                        // There is a node that should be executed before this
-                        // node.
-                        return false;
-                    }
-                }
-            }
-        }
-        Port port = node.getControlInPort();
-        if (port != null) {
-            Collection<Node> fromNodes = port.getFromNodes();
-            for (Node fromNode : fromNodes) {
-                if (this.notYetInvokedNodes.contains(fromNode)) {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-
-}
\ No newline at end of file
+///*
+// *
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements.  See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership.  The ASF licenses this file
+// * to you under the Apache License, Version 2.0 (the
+// * "License"); you may not use this file except in compliance
+// * with the License.  You may obtain a copy of the License at
+// *
+// *   http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing,
+// * software distributed under the License is distributed on an
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// * KIND, either express or implied.  See the License for the
+// * specific language governing permissions and limitations
+// * under the License.
+// *
+// */
+//
+//package org.apache.airavata.xbaya.scufl.script;
+//
+//import java.util.ArrayList;
+//import java.util.Collection;
+//import java.util.HashMap;
+//import java.util.Iterator;
+//import java.util.LinkedList;
+//import java.util.List;
+//import java.util.Map;
+//import java.util.Set;
+//import java.util.UUID;
+//
+//import javax.xml.namespace.QName;
+//
+//import org.apache.airavata.workflow.model.component.ws.WSComponent;
+//import org.apache.airavata.workflow.model.graph.DataPort;
+//import org.apache.airavata.workflow.model.graph.GraphException;
+//import org.apache.airavata.workflow.model.graph.Node;
+//import org.apache.airavata.workflow.model.graph.Port;
+//import org.apache.airavata.workflow.model.graph.impl.NodeImpl;
+//import org.apache.airavata.workflow.model.graph.system.ConstantNode;
+//import org.apache.airavata.workflow.model.graph.system.EndifNode;
+//import org.apache.airavata.workflow.model.graph.system.IfNode;
+//import org.apache.airavata.workflow.model.graph.system.InputNode;
+//import org.apache.airavata.workflow.model.graph.system.MemoNode;
+//import org.apache.airavata.workflow.model.graph.system.OutputNode;
+//import org.apache.airavata.workflow.model.graph.util.GraphUtil;
+//import org.apache.airavata.workflow.model.graph.ws.WSGraph;
+//import org.apache.airavata.workflow.model.graph.ws.WSNode;
+//import org.apache.airavata.workflow.model.wf.Workflow;
+//import org.apache.airavata.xbaya.XBayaConfiguration;
+//import org.xmlpull.infoset.impl.XmlElementWithViewsImpl;
+//import org.xmlpull.v1.builder.XmlBuilderException;
+//import org.xmlpull.v1.builder.XmlDocument;
+//import org.xmlpull.v1.builder.XmlElement;
+//import org.xmlpull.v1.builder.XmlInfosetBuilder;
+//import org.xmlpull.v1.builder.XmlNamespace;
+//
+//import xsul.XmlConstants;
+//import xsul5.wsdl.WsdlMessage;
+//import xsul5.wsdl.WsdlMessagePart;
+//import xsul5.wsdl.WsdlPort;
+//import xsul5.wsdl.WsdlPortType;
+//import xsul5.wsdl.WsdlPortTypeOperation;
+//import xsul5.wsdl.WsdlService;
+//
+//public class ScuflScript {
+//
+//    private Workflow workflow;
+//
+//    private XBayaConfiguration configuration;
+//
+//    private WSGraph graph;
+//
+//    private ArrayList<String> arguments;
+//
+//    private List<InputNode> inputNodes;
+//
+//    private List<OutputNode> outputNodes;
+//
+//    private XmlInfosetBuilder builder = XmlConstants.BUILDER;
+//
+//    private LinkedList<Node> notYetInvokedNodes;
+//
+//    private LinkedList<Node> executingNodes;
+//
+//    private XmlNamespace scuflNS = builder.newNamespace("s", "http://org.embl.ebi.escience/xscufl/0.1alpha");
+//
+//    private Map<String, XmlElement> sources = new HashMap<String, XmlElement>();
+//
+//    private List<XmlElement> links = new ArrayList<XmlElement>();
+//
+//    private List<XmlElement> sinks = new ArrayList<XmlElement>();
+//
+//    private XmlDocument script;
+//
+//    public ScuflScript(Workflow workflow, XBayaConfiguration configuration) {
+//        this.workflow = workflow;
+//        this.configuration = configuration;
+//        this.graph = this.workflow.getGraph();
+//
+//        this.arguments = new ArrayList<String>();
+//
+//        this.notYetInvokedNodes = new LinkedList<Node>();
+//        for (Node node : this.graph.getNodes()) {
+//            if (!(node instanceof MemoNode)) {
+//                this.notYetInvokedNodes.add(node);
+//            }
+//        }
+//        this.executingNodes = new LinkedList<Node>();
+//        this.inputNodes = GraphUtil.getInputNodes(this.graph);
+//        this.outputNodes = GraphUtil.getOutputNodes(this.graph);
+//    }
+//
+//    public void create() throws GraphException {
+//
+//        XmlDocument doc = builder.newDocument();
+//
+//        XmlElement scufl = doc.addDocumentElement(scuflNS, "scufl");
+//        scufl.addAttribute("version", "0.2");
+//        scufl.addAttribute("log", "0");
+//        XmlElement description = scufl.addElement(scuflNS, "workflowdescription");
+//        description.addAttribute("lsid", "urn:lsid:net.sf.taverna:wfDefinition:" + UUID.randomUUID());
+//        description.addAttribute("author", "");
+//        description.addAttribute("title", workflow.getName());
+//        writeServices(scufl);
+//
+//        writeSplitors(scufl);
+//
+//        // add links
+//        for (XmlElement link : this.links) {
+//            scufl.addElement(link);
+//        }
+//
+//        // add source
+//        for (String key : this.sources.keySet()) {
+//            scufl.addElement(this.sources.get(key));
+//        }
+//
+//        // add sinks
+//        for (XmlElement sink : this.sinks) {
+//            scufl.addElement(sink);
+//        }
+//
+//        this.script = doc;
+//
+//    }
+//
+//    public String getScript() {
+//        return builder.serializeToString(this.script);
+//    }
+//
+//    /**
+//     * @param scufl
+//     * @throws GraphException
+//     */
+//    private void writeSplitors(XmlElement scufl) throws GraphException {
+//
+//        Collection<Node> nextNodes = getNextNodes();
+//        while (nextNodes.size() > 0) {
+//            for (Node node : nextNodes) {
+//
+//                if (node instanceof WSNode) {
+//                    WSNode wsNode = (WSNode) node;
+//                    node.getInputPorts();
+//                    writeSplitorPerService(scufl, wsNode);
+//
+//                } else {
+//                    // TODO conditions, loops might come here.
+//                }
+//                this.notYetInvokedNodes.remove(node);
+//                nextNodes = getNextNodes();
+//            }
+//        }
+//    }
+//
+//    /**
+//     * @param scufl
+//     * @param node
+//     * @throws GraphException
+//     */
+//    private void writeSplitorPerService(XmlElement scufl, WSNode node) throws GraphException {
+//        List<DataPort> inputPorts = node.getInputPorts();
+//        XmlElement processor = scufl.addElement(scuflNS, "processor");
+//        processor.addAttribute("name", getValidName(node) + "InputMessagePartXML");
+//        XmlElement local = processor.addElement(scuflNS, "local");
+//        local.addChild(0, "org.embl.ebi.escience.scuflworkers.java.XMLInputSplitter");
+//        XmlElement extensions = local.addElement(scuflNS, "extensions");
+//
+//        QName inputName = getInputElementName(node);
+//        if (null == inputName) {
+//            throw new GraphException("No Valid input type found for WS Node" + node.getName());
+//        }
+//        if (node.getOutputPorts().size() != 1) {
+//            throw new GraphException("Number of out ports in WS node " + node.getName() + "is invalid:"
+//                    + node.getOutputPorts().size());
+//        }
+//        DataPort outputPort = node.getOutputPort(0);
+//
+//        WSComponent component = node.getComponent();
+//        String inputPartName = component.getInputPartName();
+//        String inputTypeName = component.getInputTypeName();
+//
+//        XmlElement complexType = extensions.addElement(scuflNS, "complextype");
+//        complexType.addAttribute("optional", "false");
+//        complexType.addAttribute("unbounded", "false");
+//        complexType.addAttribute("typename", inputTypeName);
+//
+//        String spliterName = inputPartName;
+//        complexType.addAttribute("name", spliterName);
+//        complexType.addAttribute("qname", inputName.toString());
+//
+//        XmlElement element = complexType.addElement(scuflNS, "elements");
+//        for (DataPort port : inputPorts) {
+//            if ("http://www.w3.org/2001/XMLSchema".equals(port.getType().getNamespaceURI())) {
+//                XmlElement baseType = element.addElement(scuflNS, "basetype");
+//                baseType.addAttribute("optional", "false");
+//                baseType.addAttribute("unbounded", "false");
+//                baseType.addAttribute("typename", port.getType().getLocalPart());
+//                baseType.addAttribute("name", port.getName());
+//                baseType.addAttribute("qname", inputTypeName + "&gt;" + port.getName());
+//
+//            }
+//            // all the sources are written here
+//            // the links from input nodes to the spiters are done here
+//            // links from the from node output splitter to the this service's
+//            // inputsplitter is done here
+//
+//            if (port.getFromNode() instanceof InputNode) {
+//                XmlElement source = builder.newFragment(scuflNS, "source");
+//                source.addAttribute("name", port.getFromNode().getID());
+//                if (!sourceExist(port.getFromNode().getID())) {
+//                    this.sources.put(port.getFromNode().getID(), source);
+//                }
+//                XmlElement link = builder.newFragment(scuflNS, "link");
+//                link.addAttribute("source", port.getFromNode().getID());
+//                link.addAttribute("sink", getValidName(node) + "InputMessagePartXML:" + port.getName());
+//                this.links.add(link);
+//
+//            } else if (port.getFromNode() instanceof WSNode) {
+//                XmlElement link = builder.newFragment(scuflNS, "link");
+//                if (port.getFromNode().getOutputPorts().size() != 1) {
+//                    throw new GraphException("Number of out ports in from WS node " + port.getFromNode().getName()
+//                            + "is invalid:" + node.getOutputPorts().size());
+//                }
+//                link.addAttribute("source", getValidName((WSNode) port.getFromNode()) + "OutputMessagePartXML:"
+//                        + port.getFromNode().getOutputPort(0).getName());
+//                link.addAttribute("sink", getValidName(node) + "InputMessagePartXML:" + port.getName());
+//                this.links.add(link);
+//            } else {
+//                throw new GraphException("Unhandled from node type:" + port.getFromNode() + " for node"
+//                        + node.getName());
+//            }
+//        }
+//
+//        // link from the spliter to the service
+//
+//        XmlElement link = builder.newFragment(scuflNS, "link");
+//        link.addAttribute("source", getValidName(node) + "InputMessagePartXML:output");
+//        link.addAttribute("sink", getValidName(node) + ":" + spliterName);
+//        this.links.add(link);
+//
+//        // link from service out to the ouput spliter
+//
+//        link = builder.newFragment(scuflNS, "link");
+//        link.addAttribute("source", getValidName(node) + ":" + node.getComponent().getOutputPartName());
+//        link.addAttribute("sink", getValidName(node) + "OutputMessagePartXML:input");
+//        this.links.add(link);
+//
+//        // /outspiltor
+//        XmlElement outProcessor = scufl.addElement(scuflNS, "processor");
+//        outProcessor.addAttribute("name", getValidName(node) + "OutputMessagePartXML");
+//        XmlElement outLocal = outProcessor.addElement(scuflNS, "local");
+//        outLocal.addChild(0, "org.embl.ebi.escience.scuflworkers.java.XMLOutputSplitter");
+//        XmlElement outExtensions = outLocal.addElement(scuflNS, "extensions");
+//        XmlElement outComplextype = outExtensions.addElement(scuflNS, "complextype");
+//        outComplextype.addAttribute("optional", "false");
+//        outComplextype.addAttribute("unbounded", "false");
+//        outComplextype.addAttribute("typename", component.getOutputTypeName());
+//        outComplextype.addAttribute("name", component.getOutputPartName());
+//        QName outputName = getOutputElementName(node);
+//        if (null == outputName) {
+//            throw new GraphException("No Valid output type found for WS Node" + node.getName());
+//        }
+//        outComplextype.addAttribute("qname", outputName.toString());
+//        XmlElement elements = outComplextype.addElement(scuflNS, "elements");
+//        XmlElement outBaseType = elements.addElement(scuflNS, "basetype");
+//        outBaseType.addAttribute("optional", "false");
+//        outBaseType.addAttribute("unbounded", "false");
+//
+//        outBaseType.addAttribute("typename", outputPort.getType().getLocalPart());
+//        String Z = component.getOutputPort(0).getName();
+//        outBaseType.addAttribute("name", Z);
+//
+//        outBaseType.addAttribute("qname", component.getOutputTypeName() + "&gt;" + Z);
+//
+//        List<DataPort> outputPorts = node.getOutputPorts();
+//        for (DataPort port : outputPorts) {
+//            List<Node> toNodes = port.getToNodes();
+//            for (Node toNode : toNodes) {
+//                if (toNode instanceof OutputNode) {
+//                    if ("http://www.w3.org/2001/XMLSchema".equals(port.getType().getNamespaceURI())) {
+//                        XmlElement sink = builder.newFragment(scuflNS, "sink");
+//                        sink.addAttribute("name", toNode.getID());
+//                        sinks.add(sink);
+//                        link = builder.newFragment(scuflNS, "link");
+//                        link.addAttribute("source", getValidName(node) + "OutputMessagePartXML:" + outputPort.getName());
+//                        link.addAttribute("sink", toNode.getID());
+//                        this.links.add(link);
+//                    }
+//                }
+//            }
+//        }
+//
+//    }
+//
+//    private boolean sourceExist(String name) {
+//        Set<String> keys = this.sources.keySet();
+//        for (String string : keys) {
+//            if (name.equals(string))
+//                return true;
+//        }
+//        return false;
+//    }
+//
+//    /**
+//     * @param node
+//     * @return
+//     * @throws GraphException
+//     */
+//    private QName getInputElementName(WSNode node) throws GraphException {
+//        WSComponent component = node.getComponent();
+//        String portTypeName = component.getPortTypeQName().getLocalPart();
+//        WsdlPortType portType = component.getWSDL().getPortType(portTypeName);
+//        WsdlPortTypeOperation operation = portType.getOperation(component.getOperationName());
+//        QName message = operation.getInput().getMessage();
+//        WsdlMessage wsdlMessage = component.getWSDL().getMessage(message.getLocalPart());
+//        Iterator<WsdlMessagePart> iterator = wsdlMessage.parts().iterator();
+//        QName inputName = null;
+//        if (iterator.hasNext()) {
+//            inputName = iterator.next().getElement();
+//        } else {
+//            throw new GraphException("No input part found for WS Node" + node.getName());
+//        }
+//        return inputName;
+//    }
+//
+//    private QName getOutputElementName(WSNode node) throws GraphException {
+//        WSComponent component = node.getComponent();
+//        String portTypeName = component.getPortTypeQName().getLocalPart();
+//        WsdlPortType portType = component.getWSDL().getPortType(portTypeName);
+//        WsdlPortTypeOperation operation = portType.getOperation(component.getOperationName());
+//        QName message = operation.getOutput().getMessage();
+//        WsdlMessage wsdlMessage = component.getWSDL().getMessage(message.getLocalPart());
+//        Iterator<WsdlMessagePart> iterator = wsdlMessage.parts().iterator();
+//        QName inputName = null;
+//        if (iterator.hasNext()) {
+//            inputName = iterator.next().getElement();
+//        } else {
+//            throw new GraphException("No output part found for WS Node" + node.getName());
+//        }
+//        return inputName;
+//    }
+//
+//    private void writeServices(XmlElement scufl) throws GraphException {
+//
+//        Collection<NodeImpl> nextNodes = this.graph.getNodes();
+//        for (NodeImpl node : nextNodes) {
+//            if (node instanceof WSNode) {
+//                WSNode wsNode = (WSNode) node;
+//                createWSProcess(wsNode, scufl);
+//            }
+//        }
+//    }
+//
+//    private XmlElement createWSProcess(WSNode node, XmlElement scufl) throws GraphException, XmlBuilderException {
+//
+//        XmlElement processor = scufl.addElement(scuflNS, "processor");
+//        String name = getValidName(node);
+//        processor.addAttribute("name", name);
+//        XmlElement description = processor.addElement(scuflNS, "description");
+//        String txt = node.getComponent().getDescription();
+//        if (null == txt) {
+//            description.addChild(name);
+//        } else {
+//            description.addChild(txt);
+//        }
+//
+//        XmlElement arbitrarywsdl = processor.addElement(scuflNS, "arbitrarywsdl");
+//        XmlElement wsdl = arbitrarywsdl.addElement(scuflNS, "wsdl");
+//
+//        String epr = getEPR(node);
+//        if (null == epr) {
+//            throw new GraphException("EPR not found for the WS-node:" + builder.serializeToString(node));
+//        }
+//        wsdl.addChild(epr + "?wsdl");
+//
+//        XmlElement operation = arbitrarywsdl.addElement(scuflNS, "operation");
+//        operation.addChild(node.getOperationName());
+//
+//        return processor;
+//
+//    }
+//
+//    /**
+//     * @param node
+//     * @return
+//     */
+//    private String getValidName(WSNode node) {
+//        return node.getID();
+//        // String name = node.getName();
+//        // if (name.indexOf(":") != -1) {
+//        // name = name.substring(0, name.indexOf(":"));
+//        // }
+//        // return name;
+//    }
+//
+//    /**
+//     * @param wsNode
+//     */
+//    private String getEPR(WSNode wsNode) {
+//        Iterable<WsdlService> services = wsNode.getComponent().getWSDL().services();
+//        Iterator<WsdlService> iterator = services.iterator();
+//        if (iterator.hasNext()) {
+//            Iterable<WsdlPort> ports = iterator.next().ports();
+//            Iterator<WsdlPort> portIterator = ports.iterator();
+//            if (portIterator.hasNext()) {
+//                WsdlPort port = portIterator.next();
+//                Iterable children = port.xml().children();
+//                Iterator childIterator = children.iterator();
+//                while (childIterator.hasNext()) {
+//                    Object next = childIterator.next();
+//                    if (next instanceof XmlElementWithViewsImpl) {
+//                        org.xmlpull.infoset.XmlAttribute epr = ((XmlElementWithViewsImpl) next).attribute("location");
+//                        return epr.getValue();
+//                    }
+//                }
+//            }
+//        }
+//        return null;
+//    }
+//
+//    public boolean validate(List<String> warnings) {
+//        // Empty
+//        if (this.graph.getNodes().size() == 0) {
+//            String message = "The workflow is empty.";
+//            warnings.add(message);
+//        }
+//
+//        // Input ports need to be connected.
+//        Collection<Port> inputPorts = GraphUtil.getPorts(this.graph, Port.Kind.DATA_IN);
+//        for (Port inputPort : inputPorts) {
+//            Collection<Port> fromPorts = inputPort.getFromPorts();
+//            if (fromPorts.size() == 0) {
+//                Node node = inputPort.getNode();
+//                String message = node.getID() + " has an unconnected input " + inputPort.getName();
+//                warnings.add(message);
+//            }
+//        }
+//
+//        // Input nodes need to be connected.
+//        for (InputNode inputNode : this.inputNodes) {
+//            if (inputNode.getPort().getToPorts().size() == 0) {
+//                String message = inputNode.getID() + " is not connected to any service.";
+//                warnings.add(message);
+//            }
+//        }
+//
+//        // Cycle
+//        if (GraphUtil.containsCycle(this.graph)) {
+//            String message = "There is a cycle in the workflow.";
+//            warnings.add(message);
+//        }
+//
+//        // Constants are not supported.
+//        List<ConstantNode> constantNodes = GraphUtil.getNodes(this.graph, ConstantNode.class);
+//        if (constantNodes.size() > 0) {
+//            String message = "Constants are not supported for Scufl scripts.";
+//            warnings.add(message);
+//        }
+//
+//        // If/endif are not supported.
+//        List<IfNode> ifNodes = GraphUtil.getNodes(this.graph, IfNode.class);
+//        List<EndifNode> endifNodes = GraphUtil.getNodes(this.graph, EndifNode.class);
+//        if (ifNodes.size() > 0 || endifNodes.size() > 0) {
+//            String message = "If/endif are not supported for Scufl scripts.";
+//            warnings.add(message);
+//        }
+//
+//        if (warnings.size() > 0) {
+//            return false;
+//        } else {
+//            // No error.
+//            return true;
+//        }
+//    }
+//
+//    private Collection<Node> getNextNodes() throws GraphException {
+//        Collection<Node> nextNodes = new ArrayList<Node>();
+//        for (Node node : this.notYetInvokedNodes) {
+//            if (isNextNode(node)) {
+//                nextNodes.add(node);
+//            }
+//        }
+//        return nextNodes;
+//    }
+//
+//    private boolean isNextNode(Node node) throws GraphException {
+//        if (node instanceof OutputNode) {
+//            return false;
+//        }
+//        for (Port port : node.getInputPorts()) {
+//            Collection<Node> fromNodes = port.getFromNodes();
+//            if (fromNodes.isEmpty()) {
+//                throw new GraphException("There is a port that is not connected to any.");
+//            } else {
+//                for (Node fromNode : fromNodes) {
+//                    if (this.notYetInvokedNodes.contains(fromNode)) {
+//                        // There is a node that should be executed before this
+//                        // node.
+//                        return false;
+//                    }
+//                }
+//            }
+//        }
+//        Port port = node.getControlInPort();
+//        if (port != null) {
+//            Collection<Node> fromNodes = port.getFromNodes();
+//            for (Node fromNode : fromNodes) {
+//                if (this.notYetInvokedNodes.contains(fromNode)) {
+//                    return false;
+//                }
+//            }
+//        }
+//        return true;
+//    }
+//
+//}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/BPELScriptTestCase.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/BPELScriptTestCase.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/BPELScriptTestCase.java
deleted file mode 100644
index bcfb604..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/BPELScriptTestCase.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.test;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.airavata.common.utils.IOUtil;
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.workflow.model.component.ComponentException;
-import org.apache.airavata.workflow.model.component.ComponentRegistryException;
-import org.apache.airavata.workflow.model.gpel.script.BPELScript;
-import org.apache.airavata.workflow.model.gpel.script.BPELScriptType;
-import org.apache.airavata.workflow.model.gpel.script.WorkflowWSDL;
-import org.apache.airavata.workflow.model.graph.GraphException;
-import org.apache.airavata.workflow.model.wf.Workflow;
-import org.apache.airavata.xbaya.XBayaConstants;
-import org.apache.airavata.xbaya.test.util.WorkflowCreator;
-import org.gpel.model.GpelProcess;
-import org.xmlpull.infoset.XmlElement;
-
-import xsul5.wsdl.WsdlDefinitions;
-
-public class BPELScriptTestCase extends XBayaTestCase {
-
-    // private static final Logger logger = LoggerFactory.getLogger();
-
-    private WorkflowCreator workflowCreator;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        this.workflowCreator = new WorkflowCreator();
-    }
-
-    /**
-     * @throws ComponentException
-     * @throws IOException
-     * @throws GraphException
-     * @throws ComponentRegistryException
-     */
-    public void testSimpleMath() throws ComponentException, IOException, GraphException, ComponentRegistryException {
-        Workflow workflow = this.workflowCreator.createSimpleMathWorkflow();
-        testWrokflow(workflow, "simple-math");
-    }
-
-    /**
-     * @throws ComponentException
-     * @throws IOException
-     * @throws GraphException
-     * @throws ComponentRegistryException
-     */
-    public void testMath() throws ComponentException, IOException, GraphException, ComponentRegistryException {
-        Workflow workflow = this.workflowCreator.createMathWorkflow();
-        testWrokflow(workflow, "math");
-    }
-
-    /**
-     * @throws ComponentException
-     * @throws IOException
-     * @throws GraphException
-     * @throws ComponentRegistryException
-     */
-    public void testComplexMath() throws ComponentException, IOException, GraphException, ComponentRegistryException {
-        Workflow workflow = this.workflowCreator.createComplexMathWorkflow();
-        testWrokflow(workflow, "complex-math");
-    }
-
-    /**
-     * @throws ComponentException
-     * @throws IOException
-     * @throws GraphException
-     * @throws ComponentRegistryException
-     */
-    public void testMathWithConstant() throws ComponentException, IOException, GraphException,
-            ComponentRegistryException {
-        Workflow workflow = this.workflowCreator.createMathWithConstWorkflow();
-        testWrokflow(workflow, "constant-test");
-    }
-
-    /**
-     * @throws ComponentException
-     * @throws GraphException
-     * @throws IOException
-     * @throws ComponentRegistryException
-     */
-    public void testArray() throws ComponentException, GraphException, IOException, ComponentRegistryException {
-        Workflow workflow = this.workflowCreator.createArrayWorkflow();
-        testWrokflow(workflow, "array-test");
-    }
-
-    /**
-     * @throws ComponentException
-     * @throws GraphException
-     * @throws IOException
-     * @throws ComponentRegistryException
-     */
-    public void testForEach() throws ComponentException, GraphException, IOException, ComponentRegistryException {
-        Workflow workflow = this.workflowCreator.createForEachWorkflow();
-        testWrokflow(workflow, "foreach-test");
-    }
-
-    /**
-     * @throws ComponentException
-     * @throws GraphException
-     * @throws IOException
-     * @throws ComponentRegistryException
-     */
-    public void testIf() throws ComponentException, GraphException, IOException, ComponentRegistryException {
-        Workflow workflow = this.workflowCreator.createIfWorkflow();
-        testWrokflow(workflow, "if-test");
-    }
-
-    /**
-     * @throws GraphException
-     * @throws ComponentException
-     * @throws IOException
-     * @throws ComponentRegistryException
-     */
-    public void testReceive() throws GraphException, ComponentException, IOException, ComponentRegistryException {
-        Workflow workflow = this.workflowCreator.createReceiveWorkflow();
-        testWrokflow(workflow, "receive-test");
-    }
-
-    /**
-     * @throws GraphException
-     * @throws ComponentException
-     * @throws IOException
-     * @throws ComponentRegistryException
-     */
-    public void testLoan() throws GraphException, ComponentException, IOException, ComponentRegistryException {
-        Workflow workflow = this.workflowCreator.createLoanWorkflow();
-        testWrokflow(workflow, "loan");
-    }
-
-    private void testWrokflow(Workflow workflow, String filename) throws GraphException, IOException,
-            ComponentException {
-
-        // This one is for debuggin in case something below fails.
-        XMLUtil.saveXML(workflow.toXML(), new File(this.temporalDirectory, filename + "-0.xwf"));
-
-        // Create BPEL
-        BPELScript bpel = new BPELScript(workflow);
-        bpel.create(BPELScriptType.GPEL);
-        GpelProcess gpelProcess = bpel.getGpelProcess();
-        WorkflowWSDL workflowWSDL = bpel.getWorkflowWSDL();
-        WsdlDefinitions definitions = workflowWSDL.getWsdlDefinitions();
-
-        File bpelFile = new File(this.temporalDirectory, filename + XBayaConstants.BPEL_SUFFIX);
-        File wsdlFile = new File(this.temporalDirectory, filename + XBayaConstants.WSDL_SUFFIX);
-        XMLUtil.saveXML(gpelProcess.xml(), bpelFile);
-        XMLUtil.saveXML(definitions.xml(), wsdlFile);
-
-        // Save the workflow
-        File workflowFile = new File(this.temporalDirectory, filename + XBayaConstants.WORKFLOW_FILE_SUFFIX);
-        XMLUtil.saveXML(workflow.toXML(), workflowFile);
-
-        // Read the workflow
-        XmlElement workflowElement = XMLUtil.loadXML(workflowFile);
-        workflow = new Workflow(workflowElement);
-
-        // Create BPEL again
-        bpel = new BPELScript(workflow);
-        bpel.create(BPELScriptType.GPEL);
-        gpelProcess = bpel.getGpelProcess();
-        workflowWSDL = bpel.getWorkflowWSDL();
-        definitions = workflowWSDL.getWsdlDefinitions();
-
-        File bpelFile2 = new File(this.temporalDirectory, filename + "-2" + XBayaConstants.BPEL_SUFFIX);
-        File wsdlFile2 = new File(this.temporalDirectory, filename + "-2" + XBayaConstants.WSDL_SUFFIX);
-        XMLUtil.saveXML(gpelProcess.xml(), bpelFile2);
-        XMLUtil.saveXML(definitions.xml(), wsdlFile2);
-
-        File workflowFile2 = new File(this.temporalDirectory, filename + "-2" + XBayaConstants.WORKFLOW_FILE_SUFFIX);
-        XMLUtil.saveXML(workflow.toXML(), workflowFile2);
-
-        // Compare
-        String workflowString = IOUtil.readFileToString(workflowFile);
-        String workflowString2 = IOUtil.readFileToString(workflowFile2);
-        assertEquals(workflowString, workflowString2);
-
-        String bpelString = IOUtil.readFileToString(bpelFile);
-        String bpelString2 = IOUtil.readFileToString(bpelFile2);
-        assertEquals(bpelString, bpelString2);
-
-        String wsdlString = IOUtil.readFileToString(wsdlFile);
-        String wsdlString2 = IOUtil.readFileToString(wsdlFile2);
-        assertEquals(wsdlString, wsdlString2);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/BrowserTestCase.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/BrowserTestCase.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/BrowserTestCase.java
deleted file mode 100644
index 3d68557..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/BrowserTestCase.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.test;
-
-import junit.framework.TestCase;
-
-import org.apache.airavata.common.utils.BrowserLauncher;
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-
-public class BrowserTestCase extends TestCase {
-
-    /**
-     * @throws WorkflowException
-     * 
-     */
-    public void testBrowserLauncher() throws Exception {
-        BrowserLauncher.openURL("http://www.google.com");
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/DSCTestCase.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/DSCTestCase.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/DSCTestCase.java
deleted file mode 100644
index e6ae107..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/DSCTestCase.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.test;
-
-import java.io.File;
-import java.net.URI;
-
-import junit.framework.TestSuite;
-
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.workflow.model.gpel.DSCUtil;
-import org.apache.airavata.xbaya.file.XBayaPathConstants;
-import org.apache.airavata.xbaya.lead.LeadContextHeaderHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.v1.builder.XmlElement;
-
-import xsul.lead.LeadContextHeader;
-import xsul.util.XsulUtil;
-import xsul.wsif.WSIFMessage;
-import xsul.wsif.WSIFOperation;
-import xsul.wsif.WSIFPort;
-import xsul.xhandler_soap_sticky_header.StickySoapHeaderHandler;
-import xsul.xwsif_runtime.WSIFClient;
-import xsul.xwsif_runtime.WSIFRuntime;
-import xsul.xwsif_runtime_async.WSIFAsyncResponsesCorrelator;
-import xsul.xwsif_runtime_async_http.XsulSoapHttpWsaResponsesCorrelator;
-import xsul5.wsdl.WsdlDefinitions;
-import xsul5.wsdl.WsdlException;
-import xsul5.wsdl.WsdlResolver;
-
-public class DSCTestCase extends XBayaTestCase {
-
-    private static final String SAMPLE_AWSDL = XBayaPathConstants.WSDL_DIRECTORY + "/test/TestCMD_Example1_AWSDL.xml";
-
-    private static final Logger logger = LoggerFactory.getLogger(DSCTestCase.class);
-
-    /**
-     * @param args
-     */
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(new TestSuite(DSCTestCase.class));
-    }
-
-    /**
-     * @see org.apache.airavata.xbaya.test.XBayaTestCase#setUp()
-     */
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
-
-    /**
-     * @throws WsdlException
-     */
-    public void test() throws WsdlException {
-        WsdlDefinitions definitions = WsdlResolver.getInstance().loadWsdl(new File(".").toURI(),
-                new File(SAMPLE_AWSDL).toURI());
-        URI dscURL = this.configuration.getDSCURL();
-        logger.info("dscURL: " + dscURL);
-        DSCUtil.convertToCWSDL(definitions, dscURL);
-
-        logger.info(definitions.xmlStringPretty());
-
-        // client
-        int clientPort = 0;
-        WSIFAsyncResponsesCorrelator correlator = new XsulSoapHttpWsaResponsesCorrelator(clientPort);
-        String serverLoc = ((XsulSoapHttpWsaResponsesCorrelator) correlator).getServerLocation();
-        logger.info("client is waiting at " + serverLoc);
-
-        // LEAD Context Header
-        // Create lead context.
-        LeadContextHeaderHelper leadContextHelper = new LeadContextHeaderHelper();
-        leadContextHelper.setXBayaConfiguration(this.configuration);
-        LeadContextHeader leadContext = leadContextHelper.getLeadContextHeader();
-        leadContext.setWorkflowId(URI.create("http://host/2005/11/09/workflowinstace"));
-        leadContext.setNodeId("decoder1");
-        leadContext.setTimeStep("5");
-        leadContext.setServiceInstanceId(URI.create("decoder-instance-10"));
-
-        XmlElement element3 = XMLUtil.xmlElement5ToXmlElement3(definitions.xml());
-        xsul.wsdl.WsdlDefinitions definitions3 = new xsul.wsdl.WsdlDefinitions(element3);
-
-        WSIFClient wclient = WSIFRuntime.getDefault().newClientFor(definitions3, "TestCMD_Example1SoapPort");
-        StickySoapHeaderHandler handler = new StickySoapHeaderHandler("use-lead-header", leadContext);
-
-        wclient.addHandler(handler);
-        wclient.useAsyncMessaging(correlator);
-        wclient.setAsyncResponseTimeoutInMs(33000L);
-
-        WSIFPort port = wclient.getPort();
-        WSIFOperation operation = port.createOperation("Run");
-        WSIFMessage inputMessage = operation.createInputMessage();
-        WSIFMessage outputMessage = operation.createOutputMessage();
-        WSIFMessage faultMessage = operation.createFaultMessage();
-
-        // inputMessage.setObjectPart("InputParam1", "Hello");
-        inputMessage.setObjectPart("InputParam1", "100");
-
-        logger.info("inputMessage: " + XsulUtil.safeXmlToString((XmlElement) inputMessage));
-        boolean success = operation.executeRequestResponseOperation(inputMessage, outputMessage, faultMessage);
-
-        XmlElement result;
-        if (success) {
-            result = (XmlElement) outputMessage;
-        } else {
-            result = (XmlElement) faultMessage;
-        }
-        logger.info("result:\n" + XsulUtil.safeXmlToString(result));
-
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/DSCUtilTestCase.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/DSCUtilTestCase.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/DSCUtilTestCase.java
deleted file mode 100644
index 866aa6a..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/DSCUtilTestCase.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.test;
-
-import java.io.File;
-
-import org.apache.airavata.workflow.model.component.ComponentException;
-import org.apache.airavata.workflow.model.component.ComponentRegistryException;
-import org.apache.airavata.workflow.model.gpel.DSCUtil;
-import org.apache.airavata.workflow.model.graph.GraphException;
-import org.apache.airavata.workflow.model.wf.Workflow;
-import org.apache.airavata.xbaya.file.XBayaPathConstants;
-import org.apache.airavata.xbaya.test.util.WorkflowCreator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import xsul5.wsdl.WsdlDefinitions;
-import xsul5.wsdl.WsdlException;
-import xsul5.wsdl.WsdlResolver;
-
-public class DSCUtilTestCase extends XBayaTestCase {
-
-    private static final String SAMPLE_AWSDL = XBayaPathConstants.WSDL_DIRECTORY + "/test/adder-awsdl.xml";
-
-    private static final String WSDL_WITH_MULTIPLE_PORT_TYPES = XBayaPathConstants.BPEL_SCRIPT_DIRECTORY
-            + File.separator + "receive-test-wsdl.xml";
-
-    private static final Logger logger = LoggerFactory.getLogger(DSCUtilTestCase.class);
-
-    /**
-     * @throws WsdlException
-     */
-    public void testConvertToCWSDL() throws WsdlException {
-        WsdlDefinitions definitions = WsdlResolver.getInstance().loadWsdl(new File(".").toURI(),
-                new File(SAMPLE_AWSDL).toURI());
-        DSCUtil.convertToCWSDL(definitions, this.configuration.getDSCURL());
-        logger.info(definitions.xmlStringPretty());
-    }
-
-    /**
-     * 
-     */
-    public void testMultiplePortTypes() {
-        WsdlDefinitions definitions = WsdlResolver.getInstance().loadWsdl(new File(".").toURI(),
-                new File(WSDL_WITH_MULTIPLE_PORT_TYPES).toURI());
-        DSCUtil.convertToCWSDL(definitions, this.configuration.getDSCURL());
-        logger.info(definitions.xmlStringPretty());
-    }
-
-    /**
-     * @throws ComponentException
-     * @throws GraphException
-     * @throws ComponentRegistryException
-     */
-    public void testConvertToCWSDLs() throws ComponentException, GraphException, ComponentRegistryException {
-        WorkflowCreator creator = new WorkflowCreator();
-        Workflow workflow = creator.createComplexMathWorkflow();
-        DSCUtil.createCWSDLs(workflow, this.configuration.getDSCURL());
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/GFacServiceCreaterTestCase.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/GFacServiceCreaterTestCase.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/GFacServiceCreaterTestCase.java
deleted file mode 100644
index 1dca11e..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/GFacServiceCreaterTestCase.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.test;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.common.utils.IOUtil;
-import org.apache.airavata.common.utils.WSDLUtil;
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.workflow.model.component.ComponentException;
-import org.apache.airavata.workflow.model.component.ComponentRegistryException;
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-import org.apache.airavata.workflow.model.graph.GraphException;
-import org.apache.airavata.workflow.model.wf.Workflow;
-import org.apache.airavata.xbaya.file.XBayaPathConstants;
-import org.apache.airavata.xbaya.invoker.GenericInvoker;
-import org.apache.airavata.xbaya.invoker.Invoker;
-import org.apache.airavata.xbaya.jython.lib.GFacServiceCreator;
-import org.apache.airavata.xbaya.jython.lib.NotificationSender;
-import org.apache.airavata.xbaya.jython.script.JythonScript;
-import org.apache.airavata.xbaya.test.util.WorkflowCreator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GFacServiceCreaterTestCase extends XBayaTestCase {
-
-    private static final String TEST_SERVICE_QNAME = "{http://www.extreme.indiana.edu/lead}TestCMD_Simple";
-
-    private static final String TEST_AWSDL = XBayaPathConstants.WSDL_DIRECTORY + File.separator
-            + WorkflowCreator.GFAC_TEST_AWSDL;
-
-    private static final Logger logger = LoggerFactory.getLogger(GFacServiceCreaterTestCase.class);
-
-    /**
-     * @throws WorkflowException
-     */
-    public void testCreate() throws WorkflowException {
-        URI gFacURL = this.configuration.getGFacURL();
-        URI gFacWSDLURL = WSDLUtil.appendWSDLQuary(gFacURL);
-        GFacServiceCreator creator = new GFacServiceCreator(gFacWSDLURL);
-        creator.createService(TEST_SERVICE_QNAME);
-        creator.shutdownService();
-    }
-
-    /**
-     * @throws WorkflowException
-     */
-    public void testService() throws WorkflowException {
-        NotificationSender notifier = new NotificationSender(this.configuration.getBrokerURL(), "test-topic2");
-        Invoker invoker = new GenericInvoker(QName.valueOf(TEST_SERVICE_QNAME), TEST_AWSDL, "test-node", null,
-                this.configuration.getGFacURL().toString(), notifier);
-        invoker.setup();
-        invoker.setOperation("Run");
-        invoker.setInput("inparam1", "test");
-        invoker.invoke();
-        Object output = invoker.getOutput("outparam1");
-        logger.info("output: " + output);
-    }
-
-    /**
-     * @throws ComponentException
-     * @throws IOException
-     * @throws GraphException
-     * @throws InterruptedException
-     * @throws ComponentRegistryException
-     */
-    public void testWorkflow() throws ComponentException, IOException, GraphException, InterruptedException,
-            ComponentRegistryException {
-        WorkflowCreator creator = new WorkflowCreator();
-        Workflow workflow = creator.createGFacWorkflow();
-
-        File workflowFile = new File("tmp/gfac-test.xwf");
-        XMLUtil.saveXML(workflow.toXML(), workflowFile);
-
-        JythonScript script = new JythonScript(workflow, this.configuration);
-        script.create();
-        String jythonString = script.getJythonString();
-        String filename = "tmp/gfac-test.py";
-        IOUtil.writeToFile(jythonString, filename);
-
-        // String[] argv = new String[] { filename, "-TestCMD_Simple_wsdl",
-        // GFAC_TEST_WSDL };
-        // jython.main(argv);
-
-        String[] commands = new String[] { "./jython.sh", filename, "-TestCMD_Simple_wsdl", TEST_AWSDL };
-        Process process = Runtime.getRuntime().exec(commands);
-        int exitValue = process.waitFor();
-        logger.info("Exit value: " + exitValue);
-        InputStream inputStream = process.getInputStream();
-        String output = IOUtil.readToString(inputStream);
-        logger.info("output: " + output);
-        InputStream errorStream = process.getErrorStream();
-        String error = IOUtil.readToString(errorStream);
-        logger.info("error: " + error);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/GraphTestCase.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/GraphTestCase.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/GraphTestCase.java
deleted file mode 100644
index e35dacf..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/GraphTestCase.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.test;
-
-import junit.framework.TestCase;
-
-import org.apache.airavata.workflow.model.component.ComponentException;
-import org.apache.airavata.workflow.model.component.ComponentRegistryException;
-import org.apache.airavata.workflow.model.graph.Graph;
-import org.apache.airavata.workflow.model.graph.GraphException;
-import org.apache.airavata.workflow.model.graph.Node;
-import org.apache.airavata.workflow.model.wf.Workflow;
-import org.apache.airavata.xbaya.test.util.WorkflowCreator;
-
-public class GraphTestCase extends TestCase {
-
-    /**
-     * @throws ComponentException
-     * @throws GraphException
-     * @throws ComponentRegistryException
-     */
-    public void testRemoveNode() throws ComponentException, GraphException, ComponentRegistryException {
-        WorkflowCreator creator = new WorkflowCreator();
-        Workflow workflow = creator.createSimpleMathWorkflow();
-        Graph graph = workflow.getGraph();
-
-        Node node = graph.getNode("Adder_add");
-        assertNotNull(node);
-        int originalSize = graph.getPorts().size();
-        int portNum = node.getAllPorts().size();
-        graph.removeNode(node);
-
-        assertEquals(originalSize - portNum, graph.getPorts().size());
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/MetadataTestCase.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/MetadataTestCase.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/MetadataTestCase.java
deleted file mode 100644
index 2ab432f..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/MetadataTestCase.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.test;
-
-import java.awt.Point;
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.workflow.model.component.Component;
-import org.apache.airavata.workflow.model.component.ComponentException;
-import org.apache.airavata.workflow.model.component.ComponentRegistryException;
-import org.apache.airavata.workflow.model.component.local.LocalComponentRegistry;
-import org.apache.airavata.workflow.model.component.system.InputComponent;
-import org.apache.airavata.workflow.model.component.system.OutputComponent;
-import org.apache.airavata.workflow.model.component.ws.WSComponentPort;
-import org.apache.airavata.workflow.model.graph.GraphException;
-import org.apache.airavata.workflow.model.graph.Node;
-import org.apache.airavata.workflow.model.graph.system.InputNode;
-import org.apache.airavata.workflow.model.graph.system.OutputNode;
-import org.apache.airavata.workflow.model.graph.ws.WSGraph;
-import org.apache.airavata.workflow.model.wf.Workflow;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.infoset.XmlElement;
-
-public class MetadataTestCase extends TestCase {
-
-    private static final String WSDL_DIRECTORY = "/u/sshirasu/codes/appservices/gfac2/wsdls";
-
-    private static final String WRF_STATIC_PREPROCESSOR_WSDL = "WrfStaticPreprocessor.wsdl";
-
-    private static final String TERRAIN_PREPROCESSOR_WSDL = "TerrainPreprocessor.wsdl";
-
-    private static final String ADAS_INTERPOLATOR_WSDL = "ADASInterpolator.wsdl";
-
-    private static final String LATERAL_BOUNDARY_INTERPOLATOR_WSDL = "LateralBoundaryInterpolator.wsdl";
-
-    private static final String ARPS2WRF_INTERPOLATOR_WSDL = "ARPS2WRFInterpolator.wsdl";
-
-    private static final String WRF_FORECASTING_MODEL_WSDL = "WRFForecastingModel.wsdl";
-
-    private static final Logger logger = LoggerFactory.getLogger(MetadataTestCase.class);
-
-    /**
-     * @throws ComponentException
-     * @throws GraphException
-     * @throws IOException
-     * @throws ComponentRegistryException
-     */
-    public void testWorkflow() throws ComponentException, GraphException, IOException, ComponentRegistryException {
-        Workflow workflow = createWorkflow();
-
-        File workflowFile = new File("tmp/ADASInitializedWRFForecast.xwf");
-        XMLUtil.saveXML(workflow.toXML(), workflowFile);
-    }
-
-    /**
-     * @throws ComponentException
-     * @throws GraphException
-     * @throws IOException
-     * @throws ComponentRegistryException
-     */
-    public void testPreInvoke() throws ComponentException, GraphException, IOException, ComponentRegistryException {
-        Workflow workflow = createWorkflow();
-        workflow.createScript();
-
-        File workflowWSDLFile = new File("tmp/ADASInitializedWRFForecast-wsdl.xml");
-        XMLUtil.saveXML(workflow.getWorkflowWSDL().xml(), workflowWSDLFile);
-        File bpelFile = new File("tmp/ADASInitializedWRFForecast-bpel.xml");
-        XMLUtil.saveXML(workflow.getGpelProcess().xml(), bpelFile);
-
-        // Get the metadata for input.
-        XmlElement inputAppinfo = workflow.getInputMetadata();
-
-        // Get the input information
-        List<WSComponentPort> inputs = workflow.getInputs();
-
-        for (WSComponentPort input : inputs) {
-            // Show the information of each input.
-
-            // Name
-            String name = input.getName();
-            logger.info("name: " + name);
-
-            // Type
-            QName type = input.getType();
-            logger.info("type: " + type);
-
-            // Metadata as XML
-            XmlElement appinfo = input.getAppinfo();
-            logger.info("appinfo: " + XMLUtil.xmlElementToString(appinfo));
-
-            if (appinfo != null) {
-                // Parse the simple case.
-                for (XmlElement element : appinfo.requiredElementContent()) {
-                    String tag = element.getName();
-                    String value = element.requiredText();
-                    logger.info(tag + " = " + value);
-                }
-            }
-
-            // Set a value to each input.
-            input.setValue("200");
-        }
-    }
-
-    private Workflow createWorkflow() throws ComponentException, GraphException, ComponentRegistryException {
-
-        Workflow workflow = new Workflow();
-
-        // Name, description
-        workflow.setName("ADASInitializedWRFForecast");
-        workflow.setDescription("");
-
-        WSGraph graph = workflow.getGraph();
-
-        LocalComponentRegistry componentRegistry = new LocalComponentRegistry(WSDL_DIRECTORY);
-
-        // WRF_STATIC_PREPROCESSOR_WSDL
-        Component wrfPreComp = componentRegistry.getComponent(WRF_STATIC_PREPROCESSOR_WSDL);
-        Node wrfPreNode = workflow.addNode(wrfPreComp);
-        wrfPreNode.setPosition(new Point(313, 0));
-
-        // TERRAIN_PREPROCESSOR_WSDL
-        Component terrainPreComp = componentRegistry.getComponent(TERRAIN_PREPROCESSOR_WSDL);
-        Node terrainPreNode = workflow.addNode(terrainPreComp);
-        terrainPreNode.setPosition(new Point(59, 289));
-
-        // ADAS_INTERPOLATOR_WSDL
-        Component adasIntComp = componentRegistry.getComponent(ADAS_INTERPOLATOR_WSDL);
-        Node adasIntNode = workflow.addNode(adasIntComp);
-        adasIntNode.setPosition(new Point(373, 235));
-
-        // LATERAL_BOUNDARY_INTERPOLATOR_WSDL
-        Component lateralIntComp = componentRegistry.getComponent(LATERAL_BOUNDARY_INTERPOLATOR_WSDL);
-        Node lateralIntNode = workflow.addNode(lateralIntComp);
-        lateralIntNode.setPosition(new Point(371, 369));
-
-        // ARPS2WRF_INTERPOLATOR_WSDL
-        Component arp2wrfComp = componentRegistry.getComponent(ARPS2WRF_INTERPOLATOR_WSDL);
-        Node arp2wrfNode = workflow.addNode(arp2wrfComp);
-        arp2wrfNode.setPosition(new Point(607, 104));
-
-        // WRF_FORECASTING_MODEL_WSDL
-        Component wrfComp = componentRegistry.getComponent(WRF_FORECASTING_MODEL_WSDL);
-        Node wrfNode = workflow.addNode(wrfComp);
-        wrfNode.setPosition(new Point(781, 14));
-
-        // Parameters
-        Component inputComponent = new InputComponent();
-        Component outputComponent = new OutputComponent();
-
-        // Input parameter node
-        InputNode confInput = (InputNode) workflow.addNode(inputComponent);
-        confInput.setPosition(new Point(0, 100));
-
-        // Input parameter node
-        InputNode adasInput = (InputNode) workflow.addNode(inputComponent);
-        adasInput.setPosition(new Point(286, 145));
-
-        // Input parameter node
-        InputNode namInput = (InputNode) workflow.addNode(inputComponent);
-        namInput.setPosition(new Point(179, 438));
-
-        // Output parameter
-        OutputNode outParamNode = (OutputNode) workflow.addNode(outputComponent);
-        outParamNode.setPosition(new Point(863, 169));
-
-        // Connect ports
-        graph.addEdge(confInput.getOutputPort(0), wrfPreNode.getInputPort(0));
-        graph.addEdge(confInput.getOutputPort(0), arp2wrfNode.getInputPort(0));
-        graph.addEdge(confInput.getOutputPort(0), adasIntNode.getInputPort(1));
-        graph.addEdge(confInput.getOutputPort(0), lateralIntNode.getInputPort(1));
-        graph.addEdge(confInput.getOutputPort(0), terrainPreNode.getInputPort(0));
-        graph.addEdge(terrainPreNode.getOutputPort(0), adasIntNode.getInputPort(2));
-        graph.addEdge(terrainPreNode.getOutputPort(0), lateralIntNode.getInputPort(0));
-        graph.addEdge(adasInput.getOutputPort(0), adasIntNode.getInputPort(0));
-        graph.addEdge(namInput.getOutputPort(0), lateralIntNode.getInputPort(2));
-        graph.addEdge(wrfPreNode.getOutputPort(0), arp2wrfNode.getInputPort(1));
-        graph.addEdge(adasIntNode.getOutputPort(0), arp2wrfNode.getInputPort(2));
-        graph.addEdge(lateralIntNode.getOutputPort(0), arp2wrfNode.getInputPort(3));
-        graph.addEdge(arp2wrfNode.getOutputPort(0), wrfNode.getInputPort(0));
-        graph.addEdge(wrfNode.getOutputPort(0), outParamNode.getInputPort(0));
-
-        // Add metadata
-        String inputMetadata = "<appinfo "
-                + "xmlns:lsm=\"http://www.extreme.indiana.edu/namespaces/2006/lead-service-metadata\">"
-                + "<lsm:constraints>" + "<lsm:constraint type=\"temporalSync\">"
-                + "<lsm:elementref name=\"ADASDataFiles\" />" + "<lsm:elementref name=\"NAMDataFiles\" />"
-                + "</lsm:constraint>" + "</lsm:constraints>" + "</appinfo>";
-        graph.setInputMetadata(XMLUtil.stringToXmlElement(inputMetadata));
-
-        return workflow;
-
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/3e6c815a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/MonitorTestCase.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/MonitorTestCase.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/MonitorTestCase.java
deleted file mode 100644
index 1962104..0000000
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/MonitorTestCase.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.test;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Properties;
-
-import org.apache.airavata.workflow.tracking.Notifier;
-import org.apache.airavata.workflow.tracking.NotifierFactory;
-import org.apache.airavata.workflow.tracking.common.InvocationEntity;
-import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
-import org.apache.airavata.workflow.tracking.impl.state.DataObjImpl;
-import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
-import org.apache.axis2.addressing.EndpointReference;
-
-public class MonitorTestCase extends XBayaTestCase {
-
-    private final static URI WORKFLOW_INSTANCE_ID = URI
-            .create("tag:gpel.leadproject.org,2006:6B9/GFacTestWorkflow1/instance1");
-
-    /**
-     */
-    public void test() {
-        EndpointReference brokerEPR = WseMsgBrokerClient.createEndpointReference(this.configuration.getBrokerURL()
-                .toString(), this.configuration.getTopic());
-
-        Notifier notifier = NotifierFactory.createNotifier();
-
-        WorkflowTrackingContext context = notifier.createTrackingContext(new Properties(), brokerEPR.toString(),
-                URI.create("workflowID"), URI.create("serviceID"), "workflowNodeID", new Integer(1));
-        notifier.publishURL(context, "title", "http://www.google.com", "descriptionAndAnnotation");
-
-        notifier.workflowInitialized(context, WORKFLOW_INSTANCE_ID);
-
-        DataObjImpl dataObj = new DataObjImpl(URI.create("test"), new ArrayList<URI>());
-        notifier.dataConsumed(context, dataObj, "description");
-    }
-
-    /**
-     * 
-     */
-    public void testScalability() {
-        for (int i = 0; i < 100; i++) {
-            test();
-        }
-    }
-}
\ No newline at end of file