You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by re...@apache.org on 2015/03/19 14:43:45 UTC
[17/35] incubator-taverna-common-activities git commit: package names
changed to org.apache.taverna.*
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-activity/src/test/java/net/sf/taverna/t2/activities/wsdl/xmlsplitter/AddXMLSplitterEditTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity/src/test/java/net/sf/taverna/t2/activities/wsdl/xmlsplitter/AddXMLSplitterEditTest.java b/taverna-wsdl-activity/src/test/java/net/sf/taverna/t2/activities/wsdl/xmlsplitter/AddXMLSplitterEditTest.java
deleted file mode 100644
index 4e31fcd..0000000
--- a/taverna-wsdl-activity/src/test/java/net/sf/taverna/t2/activities/wsdl/xmlsplitter/AddXMLSplitterEditTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.activities.wsdl.xmlsplitter;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import net.sf.taverna.t2.activities.testutils.LocationConstants;
-import net.sf.taverna.t2.activities.wsdl.WSDLActivity;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.impl.DataflowImpl;
-import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import com.fasterxml.jackson.databind.node.JsonNodeFactory;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class AddXMLSplitterEditTest implements LocationConstants {
-
- private static final JsonNodeFactory JSON_NODE_FACTORY = JsonNodeFactory.instance;
-
- private WSDLActivity activity;
- private DataflowImpl dataflow;
- private ObjectNode configBean;
- private static ObjectNode operationConfigBean;
- private String wsdlLocation = WSDL_TEST_BASE
- + "eutils/eutils_lite.wsdl";
- private Edits edits;
-
- @Ignore("Integration test")
- @Before
- public void setUp() throws Exception {
- activity = new WSDLActivity(null);
- configBean = JSON_NODE_FACTORY.objectNode();
- operationConfigBean = configBean.objectNode();
- configBean.put("operation", operationConfigBean);
- operationConfigBean.put("name", "run_eInfo");
- operationConfigBean.put("wsdl", wsdlLocation);
- activity.configure(configBean);
- edits = new EditsImpl();
-
- dataflow = (DataflowImpl)edits.createDataflow();
- Processor p=edits.createProcessor("run_eInfo");
- edits.getDefaultDispatchStackEdit(p).doEdit();
- edits.getAddActivityEdit(p, activity).doEdit();
- edits.getMapProcessorPortsForActivityEdit(p).doEdit();
- edits.getAddProcessorEdit(dataflow, p).doEdit();
-
- }
-
- @Ignore("Integration test")
- @Test
- public void testAddOutputSplitterToWSDLActivity() throws Exception {
- AddXMLSplitterEdit edit = new AddXMLSplitterEdit(dataflow,activity,"parameters",false, new EditsImpl());
- edit.doEdit();
- assertEquals("The workflow should now contain 2 services",2,dataflow.getProcessors().size());
- Processor processor=null;
- for (Processor p : dataflow.getProcessors()) {
- if (p.getLocalName().equals("parametersXML")) {
- processor = p;
- break;
- }
- }
- assertNotNull("There should be a processor named parametersXML",processor);
- assertEquals("There should be 1 activity",1,processor.getActivityList().size());
-
- assertEquals("The processor should have 3 output ports",3,processor.getOutputPorts().size());
- assertEquals("The processor should have 1 input port",1,processor.getInputPorts().size());
-
- Activity<?>a = processor.getActivityList().get(0);
- assertEquals("The activity should have 3 output ports",3,a.getOutputPorts().size());
- assertEquals("The activity should have 1 input port",1,a.getInputPorts().size());
-
- assertEquals("There should be 1 datalink",1,dataflow.getLinks().size());
- }
-
- @Ignore("Integration test")
- @Test
- public void testUndo() throws Exception {
- AddXMLSplitterEdit edit = new AddXMLSplitterEdit(dataflow,activity,"parameters",false, new EditsImpl());
- edit.doEdit();
- edit.undo();
- assertEquals("There should be only 1 processor",1,dataflow.getProcessors().size());
- assertEquals("The processor should be called run_eInfo","run_eInfo",dataflow.getProcessors().get(0).getLocalName());
- assertEquals("There should be no datalinks",0,dataflow.getLinks().size());
- }
-
- @Ignore("Integration test")
- @Test
- public void testAddInputSplitterToWSDLActivity() throws Exception {
- AddXMLSplitterEdit edit = new AddXMLSplitterEdit(dataflow,activity,"parameters",true, new EditsImpl());
- edit.doEdit();
- assertEquals("The workflow should now contain 2 services",2,dataflow.getProcessors().size());
- Processor processor=null;
- for (Processor p : dataflow.getProcessors()) {
- if (p.getLocalName().equals("parametersXML")) {
- processor = p;
- break;
- }
- }
- assertNotNull("There should be a processor named parametersXML",processor);
- assertEquals("There should be 1 activity",1,processor.getActivityList().size());
- assertEquals("THe processor should have 3 input ports",3,processor.getInputPorts().size());
- assertEquals("THe processor should have 1 output port",1,processor.getOutputPorts().size());
-
- Activity<?>a = processor.getActivityList().get(0);
-
- assertEquals("The activity should have 3 input ports",3,a.getInputPorts().size());
- assertEquals("The activity 1 output port",1,a.getOutputPorts().size());
-
- assertEquals("There should be 1 datalink",1,dataflow.getLinks().size());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-activity/src/test/java/net/sf/taverna/t2/activities/wsdl/xmlsplitter/XMLInputSplitterActivityTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity/src/test/java/net/sf/taverna/t2/activities/wsdl/xmlsplitter/XMLInputSplitterActivityTest.java b/taverna-wsdl-activity/src/test/java/net/sf/taverna/t2/activities/wsdl/xmlsplitter/XMLInputSplitterActivityTest.java
deleted file mode 100644
index 9a73adf..0000000
--- a/taverna-wsdl-activity/src/test/java/net/sf/taverna/t2/activities/wsdl/xmlsplitter/XMLInputSplitterActivityTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.activities.wsdl.xmlsplitter;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.StringReader;
-
-import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
-import net.sf.taverna.wsdl.parser.BaseTypeDescriptor;
-import net.sf.taverna.wsdl.parser.ComplexTypeDescriptor;
-
-import org.jdom.Element;
-import org.jdom.input.SAXBuilder;
-import org.junit.Test;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-public class XMLInputSplitterActivityTest {
-
- @Test
- public void testGetTypeDescriptorForInputPort() throws Exception {
- String xml = "<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"personToString\" name=\"parameters\" qname=\"{http://xfire.codehaus.org/BookService}personToString\"><s:elements><s:complextype optional=\"false\" unbounded=\"false\" typename=\"Person\" name=\"person\" qname=\"{http://xfire.codehaus.org/BookService}>personToString>person\"><s:elements><s:complextype optional=\"true\" unbounded=\"false\" typename=\"Address\" name=\"address\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>address\"><s:elements><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"city\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>city\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"road\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>road\" /><s:basetype optional=\"true\" unbounded=\"false\" typ
ename=\"int\" name=\"roadNumber\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>roadNumber\" /></s:elements></s:complextype><s:basetype optional=\"true\" unbounded=\"false\" typename=\"int\" name=\"age\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>age\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"firstName\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>firstName\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"lastName\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>lastName\" /></s:elements></s:complextype></s:elements></s:complextype></s:extensions>";
- Element element = new SAXBuilder().build(new StringReader(xml)).getRootElement();
- JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForInput(element);
- XMLInputSplitterActivity a = new XMLInputSplitterActivity();
- a.configure(bean);
- XMLInputSplitterActivityFactory af = new XMLInputSplitterActivityFactory();
- af.setEdits(new EditsImpl());
-
- boolean exists = false;
- for (ActivityInputPort p : af.getInputPorts(bean)) {
- if (p.getName().equals("person")) {
- exists=true;
- break;
- }
- }
-
- assertTrue("The input port named person should have been found",exists);
-
- assertNotNull("There should be a type descriptor for person",a.getTypeDescriptorForInputPort("person"));
- assertTrue("The descriptor should be complex",a.getTypeDescriptorForInputPort("person") instanceof ComplexTypeDescriptor);
- }
-
- @Test
- public void testGetTypeDescriptorForInputPort2() throws Exception {
- String xml = "<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"Person\" name=\"person\" qname=\"{http://xfire.codehaus.org/BookService}>personToString>person\"><s:elements><s:complextype optional=\"true\" unbounded=\"false\" typename=\"Address\" name=\"address\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>address\"><s:elements><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"city\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>city\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"road\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>road\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"int\" name=\"roadNumber\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>roadNumber\" /></s:elements></s:complextype><s:basetype optional=\"true\" unb
ounded=\"false\" typename=\"int\" name=\"age\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>age\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"firstName\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>firstName\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"lastName\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>lastName\" /></s:elements></s:complextype></s:extensions>";
- Element element = new SAXBuilder().build(new StringReader(xml)).getRootElement();
- JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForInput(element);
- XMLInputSplitterActivity a = new XMLInputSplitterActivity();
- a.configure(bean);
- XMLInputSplitterActivityFactory af = new XMLInputSplitterActivityFactory();
- af.setEdits(new EditsImpl());
-
- boolean exists = false;
- for (ActivityInputPort p : af.getInputPorts(bean)) {
- if (p.getName().equals("firstName")) {
- exists=true;
- break;
- }
- }
-
- assertTrue("The input port named firstName should have been found",exists);
-
- assertNotNull("There should be a type descriptor for person",a.getTypeDescriptorForInputPort("firstName"));
- assertTrue("The descriptor should be base type",a.getTypeDescriptorForInputPort("firstName") instanceof BaseTypeDescriptor);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-activity/src/test/java/net/sf/taverna/t2/activities/wsdl/xmlsplitter/XMLOutputSplitterActivityTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity/src/test/java/net/sf/taverna/t2/activities/wsdl/xmlsplitter/XMLOutputSplitterActivityTest.java b/taverna-wsdl-activity/src/test/java/net/sf/taverna/t2/activities/wsdl/xmlsplitter/XMLOutputSplitterActivityTest.java
deleted file mode 100644
index b98e243..0000000
--- a/taverna-wsdl-activity/src/test/java/net/sf/taverna/t2/activities/wsdl/xmlsplitter/XMLOutputSplitterActivityTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.activities.wsdl.xmlsplitter;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.StringReader;
-
-import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
-import net.sf.taverna.wsdl.parser.ComplexTypeDescriptor;
-
-import org.jdom.Element;
-import org.jdom.input.SAXBuilder;
-import org.junit.Test;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-public class XMLOutputSplitterActivityTest {
-
- @Test
- public void testGetTypeDescriptorForOutputPort() throws Exception {
-
- String xml = "<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"getPersonResponse\" name=\"parameters\" qname=\"{http://testing.org}getPersonResponse\"><s:elements><s:complextype optional=\"false\" unbounded=\"false\" typename=\"Person\" name=\"getPersonReturn\" qname=\"{http://testing.org}>getPersonResponse>getPersonReturn\"><s:elements><s:complextype optional=\"false\" unbounded=\"false\" typename=\"Address\" name=\"address\" qname=\"{http://testing.org}Person>address\"><s:elements><s:basetype optional=\"false\" unbounded=\"false\" typename=\"string\" name=\"city\" qname=\"{http://testing.org}Address>city\" /><s:basetype optional=\"false\" unbounded=\"false\" typename=\"int\" name=\"number\" qname=\"{http://testing.org}Address>number\" /><s:basetype optional=\"false\" unbounded=\"false\" typename=\"string\" name=\"road\" qname=\"{http://testing.org}Address>road\" /></s:element
s></s:complextype><s:basetype optional=\"false\" unbounded=\"false\" typename=\"int\" name=\"age\" qname=\"{http://testing.org}Person>age\" /><s:basetype optional=\"false\" unbounded=\"false\" typename=\"string\" name=\"name\" qname=\"{http://testing.org}Person>name\" /></s:elements></s:complextype></s:elements></s:complextype></s:extensions>";
- Element element = new SAXBuilder().build(new StringReader(xml)).getRootElement();
- JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForOutput(element);
- XMLOutputSplitterActivity a = new XMLOutputSplitterActivity();
- a.setEdits(new EditsImpl());
- a.configure(bean);
-
- assertNotNull("There should be a descriptor for the port getPersonReturn",a.getTypeDescriptorForOutputPort("getPersonReturn"));
- assertTrue("The descriptor should be complex",a.getTypeDescriptorForOutputPort("getPersonReturn") instanceof ComplexTypeDescriptor);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-activity/src/test/java/net/sf/taverna/t2/activities/wsdl/xmlsplitter/XMLSplitterConfigurationBeanBuilderTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity/src/test/java/net/sf/taverna/t2/activities/wsdl/xmlsplitter/XMLSplitterConfigurationBeanBuilderTest.java b/taverna-wsdl-activity/src/test/java/net/sf/taverna/t2/activities/wsdl/xmlsplitter/XMLSplitterConfigurationBeanBuilderTest.java
deleted file mode 100644
index a3d2f3b..0000000
--- a/taverna-wsdl-activity/src/test/java/net/sf/taverna/t2/activities/wsdl/xmlsplitter/XMLSplitterConfigurationBeanBuilderTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.activities.wsdl.xmlsplitter;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.StringReader;
-
-import org.jdom.Element;
-import org.jdom.input.SAXBuilder;
-import org.junit.Test;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-public class XMLSplitterConfigurationBeanBuilderTest {
-
- @Test
- public void testBuildBeanForInput() throws Exception {
- String xml = "<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"personToString\" name=\"parameters\" qname=\"{http://xfire.codehaus.org/BookService}personToString\"><s:elements><s:complextype optional=\"false\" unbounded=\"false\" typename=\"Person\" name=\"person\" qname=\"{http://xfire.codehaus.org/BookService}>personToString>person\"><s:elements><s:complextype optional=\"true\" unbounded=\"false\" typename=\"Address\" name=\"address\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>address\"><s:elements><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"city\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>city\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"road\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>road\" /><s:basetype optional=\"true\" unbounded=\"false\" typ
ename=\"int\" name=\"roadNumber\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>roadNumber\" /></s:elements></s:complextype><s:basetype optional=\"true\" unbounded=\"false\" typename=\"int\" name=\"age\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>age\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"firstName\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>firstName\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"lastName\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>lastName\" /></s:elements></s:complextype></s:elements></s:complextype></s:extensions>";
- Element element = new SAXBuilder().build(new StringReader(xml)).getRootElement();
- JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForInput(element);
- assertNotNull("The bean should not be null",bean);
-
- assertEquals("There should be 1 input",1,bean.get("inputPorts").size());
- assertEquals("There should be 1 output",1,bean.get("outputPorts").size());
-
- assertEquals("The input should be named person","person",bean.get("inputPorts").get(0).get("name").textValue());
- assertEquals("The output should be named output","output",bean.get("outputPorts").get(0).get("name").textValue());
-
- assertEquals("The type xml definition should match",xml,bean.get("wrappedType").textValue());
- }
-
- @Test
- public void testBuildBeanForInput2() throws Exception {
- String xml = "<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"Person\" name=\"person\" qname=\"{http://xfire.codehaus.org/BookService}>personToString>person\"><s:elements><s:complextype optional=\"true\" unbounded=\"false\" typename=\"Address\" name=\"address\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>address\"><s:elements><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"city\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>city\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"road\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>road\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"int\" name=\"roadNumber\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>roadNumber\" /></s:elements></s:complextype><s:basetype optional=\"true\" unb
ounded=\"false\" typename=\"int\" name=\"age\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>age\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"firstName\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>firstName\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"lastName\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>lastName\" /></s:elements></s:complextype></s:extensions>";
- Element element = new SAXBuilder().build(new StringReader(xml)).getRootElement();
-
- JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForInput(element);
- assertNotNull("The bean should not be null",bean);
-
- assertEquals("There should be 4 inputs",4,bean.get("inputPorts").size());
- assertEquals("There should be 1 output",1,bean.get("outputPorts").size());
-
- assertEquals("The first input should be named address","address",bean.get("inputPorts").get(0).get("name").textValue());
- assertEquals("The output should be named output","output",bean.get("outputPorts").get(0).get("name").textValue());
-
- assertEquals("The type xml definition should match",xml,bean.get("wrappedType").textValue());
- }
-
- @Test
- public void testBuildBeanForOutput() throws Exception {
- String xml = "<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"getPersonResponse\" name=\"parameters\" qname=\"{http://testing.org}getPersonResponse\"><s:elements><s:complextype optional=\"false\" unbounded=\"false\" typename=\"Person\" name=\"getPersonReturn\" qname=\"{http://testing.org}>getPersonResponse>getPersonReturn\"><s:elements><s:complextype optional=\"false\" unbounded=\"false\" typename=\"Address\" name=\"address\" qname=\"{http://testing.org}Person>address\"><s:elements><s:basetype optional=\"false\" unbounded=\"false\" typename=\"string\" name=\"city\" qname=\"{http://testing.org}Address>city\" /><s:basetype optional=\"false\" unbounded=\"false\" typename=\"int\" name=\"number\" qname=\"{http://testing.org}Address>number\" /><s:basetype optional=\"false\" unbounded=\"false\" typename=\"string\" name=\"road\" qname=\"{http://testing.org}Address>road\" /></s:element
s></s:complextype><s:basetype optional=\"false\" unbounded=\"false\" typename=\"int\" name=\"age\" qname=\"{http://testing.org}Person>age\" /><s:basetype optional=\"false\" unbounded=\"false\" typename=\"string\" name=\"name\" qname=\"{http://testing.org}Person>name\" /></s:elements></s:complextype></s:elements></s:complextype></s:extensions>";
- Element element = new SAXBuilder().build(new StringReader(xml)).getRootElement();
- JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForOutput(element);
-
- assertNotNull("The bean should not be null",bean);
-
- assertEquals("There should be 1 input",1,bean.get("inputPorts").size());
- assertEquals("There should be 1 output",1,bean.get("outputPorts").size());
-
- assertEquals("The input should be named input","input",bean.get("inputPorts").get(0).get("name").textValue());
- assertEquals("The output shouldbe named getPersonResponse","getPersonReturn",bean.get("outputPorts").get(0).get("name").textValue());
-
- assertEquals("The type xml definition should match",xml,bean.get("wrappedType").textValue());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/WSDLActivityFactoryTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/WSDLActivityFactoryTest.java b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/WSDLActivityFactoryTest.java
new file mode 100644
index 0000000..9a0541d
--- /dev/null
+++ b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/WSDLActivityFactoryTest.java
@@ -0,0 +1,63 @@
+/*
+* 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.taverna.activities.wsdl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.net.URI;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ * @author David Withers
+ */
+public class WSDLActivityFactoryTest {
+
+ private WSDLActivityFactory factory;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ factory = new WSDLActivityFactory();
+ }
+
+ /**
+ * Test method for {@link net.sf.taverna.t2.activities.beanshell.BeanshellActivityFactory#createActivity()}.
+ */
+ @Test
+ public void testCreateActivity() {
+ WSDLActivity createActivity = factory.createActivity();
+ assertNotNull(createActivity);
+ }
+
+ /**
+ * Test method for {@link net.sf.taverna.t2.activities.beanshell.BeanshellActivityFactory#getActivityType()}.
+ */
+ @Test
+ public void testGetActivityURI() {
+ assertEquals(URI.create(WSDLActivity.URI), factory.getActivityType());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/WSDLActivityTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/WSDLActivityTest.java b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/WSDLActivityTest.java
new file mode 100644
index 0000000..d857ede
--- /dev/null
+++ b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/WSDLActivityTest.java
@@ -0,0 +1,147 @@
+/*
+* 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.taverna.activities.wsdl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import net.sf.taverna.t2.activities.testutils.ActivityInvoker;
+import net.sf.taverna.t2.activities.testutils.LocationConstants;
+import net.sf.taverna.t2.workflowmodel.OutputPort;
+import org.apache.taverna.wsdl.parser.ComplexTypeDescriptor;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+public class WSDLActivityTest implements LocationConstants {
+
+ private static final JsonNodeFactory JSON_NODE_FACTORY = JsonNodeFactory.instance;
+
+ private static WSDLActivity activity;
+ private static ObjectNode configBean;
+ private static ObjectNode operationConfigBean;
+ private static String wsdlLocation = WSDL_TEST_BASE
+ + "eutils/eutils_lite.wsdl";
+
+ //@BeforeClass
+ @Ignore("Integration test")
+ public static void setUp() throws Exception {
+ activity = new WSDLActivity(null);
+ configBean = JSON_NODE_FACTORY.objectNode();
+ operationConfigBean = configBean.objectNode();
+ configBean.put("operation", operationConfigBean);
+ operationConfigBean.put("name", "run_eInfo");
+ operationConfigBean.put("wsdl", wsdlLocation);
+ activity.configure(configBean);
+ }
+
+ @Test
+ @Ignore("Integration test")
+ public void testConfigureWSDLActivityConfigurationBean() throws Exception {
+ assertEquals("There should be 1 input ports", 1, activity
+ .getInputPorts().size());
+ assertEquals("There should be 2 output ports", 2, activity
+ .getOutputPorts().size());
+
+ assertEquals("parameters", activity.getInputPorts().iterator().next()
+ .getName());
+
+ List<String> expectedOutputNames = new ArrayList<String>();
+ expectedOutputNames.add("parameters");
+ expectedOutputNames.add("attachmentList");
+ for (OutputPort port : activity.getOutputPorts()) {
+ assertTrue("Unexpected output name:" + port.getName(),
+ expectedOutputNames.contains(port.getName()));
+ expectedOutputNames.remove(port.getName());
+ }
+ assertEquals(
+ "Not all of the expected outputs were found, those remainng are:"
+ + expectedOutputNames.toArray(), 0, expectedOutputNames
+ .size());
+ }
+
+ @Test
+ @Ignore("Integration test")
+ public void testGetConfiguration() throws Exception {
+ assertSame(configBean, activity.getConfiguration());
+ }
+
+ @Test
+ @Ignore("Service is broken")
+ public void testExecuteAsynchMapOfStringEntityIdentifierAsynchronousActivityCallback()
+ throws Exception {
+ Map<String, Object> inputMap = new HashMap<String, Object>();
+ inputMap.put("parameters", "<parameters><db>pubmed</db></parameters>");
+
+ Map<String, Class<?>> expectedOutputs = new HashMap<String, Class<?>>();
+ expectedOutputs.put("parameters", String.class);
+
+ Map<String, Object> outputMap = ActivityInvoker.invokeAsyncActivity(
+ activity, inputMap, expectedOutputs);
+ assertNotNull("there should be an output named parameters", outputMap
+ .get("parameters"));
+ String xml;
+ if (outputMap.get("parameters") instanceof String) {
+ xml = (String) outputMap.get("parameters");
+ } else {
+ byte[] bytes = (byte[]) outputMap.get("parameters");
+ xml = new String(bytes);
+ }
+
+ assertTrue("the xml is not what was expected", xml
+ .contains("<DbName>pubmed</DbName>"));
+ }
+
+ @Ignore("Integration test")
+ @Test
+ public void testGetTypeDescriptorForOutputPort() throws Exception {
+ assertNotNull("The type for the port 'paremeters' could not be found",
+ activity.getTypeDescriptorForOutputPort("parameters"));
+ assertTrue(
+ "The type for the port 'paremeters' shoule be complex",
+ activity.getTypeDescriptorForOutputPort("parameters") instanceof ComplexTypeDescriptor);
+ assertNull("There should be no type descriptor for 'fred' port",
+ activity.getTypeDescriptorForOutputPort("fred"));
+ }
+
+ @Ignore("Integration test")
+ @Test
+ public void testGetTypeDescriptorForInputPort() throws Exception {
+ assertNotNull("The type for the port 'parameters' could not be found",
+ activity.getTypeDescriptorForInputPort("parameters"));
+ assertTrue(
+ "The type for the port 'parameters' shoule be complex",
+ activity.getTypeDescriptorForInputPort("parameters") instanceof ComplexTypeDescriptor);
+ assertNull("There should be no type descriptor for 'fred' port",
+ activity.getTypeDescriptorForInputPort("fred"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/WSRFActivityTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/WSRFActivityTest.java b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/WSRFActivityTest.java
new file mode 100644
index 0000000..887ff88
--- /dev/null
+++ b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/WSRFActivityTest.java
@@ -0,0 +1,196 @@
+/*
+* 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.taverna.activities.wsdl;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
+import org.apache.taverna.wsdl.parser.WSDLParser;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import org.junit.Before;
+import org.junit.Test;
+
+public class WSRFActivityTest {
+
+ public class DummyInvoker extends T2WSDLSOAPInvoker {
+
+ public DummyInvoker(String wsrfEndpoint) {
+ super(wsdlParser, "add", Arrays.asList("attachmentList"),
+ wsrfEndpoint, null);
+ }
+
+ @Override
+ public SOAPMessage call(SOAPMessage message) throws Exception{
+ requestXML = message;
+ MessageFactory factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
+ return factory.createMessage();
+ }
+ }
+
+ private URL counterServiceWSDL;
+ private WSDLParser wsdlParser;
+ protected SOAPMessage requestXML;
+
+ @Before
+ public void makeWSDLParser() throws Exception {
+ String path = "wsrf/counterService/CounterService_.wsdl";
+ counterServiceWSDL = getClass().getResource(path);
+ assertNotNull("Coult not find test WSDL " + path, counterServiceWSDL);
+ wsdlParser = new WSDLParser(counterServiceWSDL.toExternalForm());
+ }
+
+ public void noHeaders() throws Exception {
+
+ }
+
+ @Test
+ public void insertedEndpoint() throws Exception {
+ // From T2-677 - support wsa:EndpointReference directly as well
+ String wsrfEndpoint = "" +
+ "<wsa:EndpointReference "
+ + "xmlns:wsa='http://schemas.xmlsoap.org/ws/2004/03/addressing' "
+ + "xmlns:counter='http://counter.com'>"
+ + " <wsa:Address>http://130.88.195.110:8080/wsrf/services/CounterService</wsa:Address>"
+ + " <wsa:ReferenceProperties>"
+ + " <counter:CounterKey>15063581</counter:CounterKey>"
+ + " <difficult:one xmlns:difficult='http://difficult.com/' "
+ + " difficult:attrib='something' attrib='else' >"
+ + " <difficult:fish><counter:fish /></difficult:fish> "
+ + " </difficult:one>" + " <emptyNamespace>"
+ + " <defaultNamespace xmlns='http://default/'>"
+ + "\n default \n " + "</defaultNamespace>"
+ + " <stillEmpty />" + " </emptyNamespace>"
+ + " </wsa:ReferenceProperties>"
+ + " <wsa:ReferenceParameters/>" + "</wsa:EndpointReference>";
+
+ // Note: We'll subclass to avoid calling service
+ // and request attachmentList to trigger TAV-617-code and avoid
+ // parsing of the (missing) response
+ T2WSDLSOAPInvoker invoker = new DummyInvoker(wsrfEndpoint);
+ Map<String, Object> results = invoker.invoke(Collections.singletonMap("add", "10"));
+ assertEquals(1, results.size());
+ assertEquals("attachmentList", results.keySet().iterator().next());
+
+ SOAPEnvelope envelope = requestXML.getSOAPPart().getEnvelope();
+ SOAPHeader header = envelope.getHeader();
+
+ checkHeader(header);
+ }
+
+
+ @Test
+ public void insertedEndpointWrapped() throws Exception {
+ // From T2-677 - support wsa:EndpointReference wrapped in <*> to avoid
+ // unnecessary XML splitters and to support legacy workflows
+
+ // Example from http://www.mygrid.org.uk/dev/issues/browse/TAV-23
+ String wsrfEndpoint = "" +
+ "<c:createCounterResponse xmlns:c='http://counter.com'>" +
+ "<wsa:EndpointReference "
+ + "xmlns:wsa='http://schemas.xmlsoap.org/ws/2004/03/addressing' "
+ + "xmlns:counter='http://counter.com'>"
+ + " <wsa:Address>http://130.88.195.110:8080/wsrf/services/CounterService</wsa:Address>"
+ + " <wsa:ReferenceProperties>"
+ + " <counter:CounterKey>15063581</counter:CounterKey>"
+ + " <difficult:one xmlns:difficult='http://difficult.com/' "
+ + " difficult:attrib='something' attrib='else' >"
+ + " <difficult:fish><counter:fish /></difficult:fish> "
+ + " </difficult:one>" + " <emptyNamespace>"
+ + " <defaultNamespace xmlns='http://default/'>"
+ + "\n default \n " + "</defaultNamespace>"
+ + " <stillEmpty />" + " </emptyNamespace>"
+ + " </wsa:ReferenceProperties>"
+ + " <wsa:ReferenceParameters/>" + "</wsa:EndpointReference>" +
+ "</c:createCounterResponse>";
+
+ // Note: We'll subclass to avoid calling service
+ // and request attachmentList to trigger TAV-617-code and avoid
+ // parsing of the (missing) response
+ T2WSDLSOAPInvoker invoker = new DummyInvoker(wsrfEndpoint);
+ Map<String, Object> results = invoker.invoke(Collections.singletonMap(
+ "add", "10"));
+ assertEquals(1, results.size());
+ assertEquals("attachmentList", results.keySet().iterator().next());
+
+ SOAPEnvelope envelope = requestXML.getSOAPPart().getEnvelope();
+ SOAPHeader header = envelope.getHeader();
+
+ checkHeader(header);
+ }
+
+ private void checkHeader(SOAPHeader header)
+ {
+ Iterator<SOAPHeaderElement> headers = header.examineAllHeaderElements();
+ assertTrue("no headers found", headers.hasNext());
+
+ Map<QName, SOAPHeaderElement> elements = new HashMap<QName, SOAPHeaderElement>();
+ while (headers.hasNext()) {
+ SOAPHeaderElement element = headers.next();
+ elements.put(new QName(element.getNamespaceURI(), element.getLocalName()), element);
+ }
+
+ SOAPHeaderElement counterKey = elements.get(new QName("http://counter.com", "CounterKey"));
+ assertNotNull("Could not find {http://counter.com}CounterKey header", counterKey);
+ assertEquals("15063581", counterKey.getTextContent());
+
+ SOAPHeaderElement difficultChild = elements.get(new QName("http://difficult.com/", "one"));
+ assertNotNull("Could not find {http://difficult.com/}one header", difficultChild);
+
+ assertEquals("something", difficultChild.getAttributeNS("http://difficult.com/","attrib"));
+ assertEquals("else", difficultChild.getAttributeNS(null, "attrib"));
+
+ Iterator<SOAPElement> difficultFishes = difficultChild.getChildElements(new QName("http://difficult.com/", "fish"));
+ assertTrue("no {http://difficult.com/}fish element found", difficultFishes.hasNext());
+ SOAPElement difficultFish = difficultFishes.next();
+ assertFalse("more than one {http://difficult.com/}fish element found", difficultFishes.hasNext());
+
+ Iterator<SOAPElement> counterFishes = difficultFish.getChildElements(new QName("http://counter.com", "fish"));
+ assertTrue("no {http://counter.com}fish element found", counterFishes.hasNext());
+ SOAPElement counterFish = counterFishes.next();
+ assertFalse("more than one {http://counter.com}fish element found", counterFishes.hasNext());
+
+ SOAPHeaderElement emptyNamespace = elements.get(new QName("emptyNamespace"));
+ assertNotNull("Could not find {}emptyNamespace header", emptyNamespace);
+
+ Iterator<SOAPElement> defaultNamespaces = emptyNamespace.getChildElements(new QName("http://default/", "defaultNamespace"));
+ assertTrue("no {http://default/}defaultNamespace element found", defaultNamespaces.hasNext());
+ SOAPElement defaultNamespace = defaultNamespaces.next();
+ assertFalse("more than one {http://default/}defaultNamespace element found", defaultNamespaces.hasNext());
+
+ Iterator<SOAPElement> stillEmpties = emptyNamespace.getChildElements(new QName("stillEmpty"));
+ assertTrue("no {}stillEmpty element found", stillEmpties.hasNext());
+ SOAPElement stillEmpty = stillEmpties.next();
+ assertFalse("more than one {}stillEmpty element found", stillEmpties.hasNext());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/security/HTTPSConnectionsTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/security/HTTPSConnectionsTest.java b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/security/HTTPSConnectionsTest.java
new file mode 100644
index 0000000..1045eb1
--- /dev/null
+++ b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/security/HTTPSConnectionsTest.java
@@ -0,0 +1,69 @@
+/*
+* 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.taverna.activities.wsdl.security;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.cert.Certificate;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLHandshakeException;
+
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class HTTPSConnectionsTest {
+
+ @Test()
+ @Ignore("https://rpc103.cs.man.ac.uk:8443/wsrf/services no available")
+ public void testHTTPSConnections(){
+
+ String serviceURL = "https://rpc103.cs.man.ac.uk:8443/wsrf/services";
+
+ URL url;
+ try {
+ url = new URL(serviceURL);
+ SSLUtilities.trustAllHttpsCertificates();
+ HttpsURLConnection httpsConnection = (HttpsURLConnection) url.openConnection();
+ httpsConnection.connect();
+ Certificate[] certificates = httpsConnection.getServerCertificates();
+ Assert.assertFalse(certificates.length == 0);
+
+ SSLUtilities.stopTrustingAllHttpsCertificates();
+ HttpsURLConnection httpsConnection2 = (HttpsURLConnection) url.openConnection();
+ httpsConnection2.connect(); // This should now throw an SSLHandshakeException which is a subclass of IOException
+
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+
+ } catch(SSLHandshakeException e){
+ // This is what we are expecting
+ e.printStackTrace();
+ }
+ catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/security/SecureServicesInvokerTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/security/SecureServicesInvokerTest.java b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/security/SecureServicesInvokerTest.java
new file mode 100644
index 0000000..7b4fecd
--- /dev/null
+++ b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/security/SecureServicesInvokerTest.java
@@ -0,0 +1,153 @@
+/*
+* 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.taverna.activities.wsdl.security;
+
+import static org.junit.Assert.*;
+
+import java.util.Hashtable;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLPeerUnverifiedException;
+import javax.net.ssl.SSLSession;
+import javax.xml.namespace.QName;
+
+//import org.apache.axis.MessageContext;
+//import org.apache.axis.SimpleChain;
+//import org.apache.axis.client.Call;
+//import org.apache.axis.client.Service;
+//import org.apache.axis.client.Transport;
+//import org.apache.axis.configuration.BasicClientConfig;
+//import org.apache.axis.configuration.SimpleProvider;
+//import org.apache.axis.configuration.XMLStringProvider;
+//import org.apache.axis.encoding.Base64;
+//import org.apache.axis.transport.http.HTTPConstants;
+//import org.apache.axis.transport.http.HTTPSender;
+//import org.apache.axis.transport.http.HTTPTransport;
+//import org.apache.ws.axis.security.WSDoAllSender;
+//import org.apache.ws.security.WSConstants;
+//import org.apache.ws.security.handler.WSHandlerConstants;
+import org.junit.Test;
+
+public class SecureServicesInvokerTest {
+
+ @Test
+ public void testCreteCallAndInvoke() {
+// try {
+//
+//
+// String endpoint = "http://www.mygrid.org.uk/axis/services/UsernameHelloService"; // test server
+// //endpoint = "http://rpc212.cs.man.ac.uk/taverna/";
+//
+// HostnameVerifier hv = new HostnameVerifier() {
+// public boolean verify(String hostName, SSLSession session) {
+// return true;
+// }
+// };
+// HttpsURLConnection.setDefaultHostnameVerifier(hv);
+// //endpoint = "https://rpc103.cs.man.ac.uk:8443/wsrf/services/cagrid/SecureHelloWorld?wsdl";
+//
+// // Set the system property "javax.net.ssl.Truststore" to use Taverna's truststore
+// //System.setProperty("javax.net.ssl.trustStore", "/Users/alex/Desktop/t2truststore.jks");
+// //System.setProperty("javax.net.ssl.trustStorePassword", "raehiekooshe0eghiPhi");
+// //System.clearProperty("javax.net.ssl.trustStoreType");
+// //System.clearProperty("javax.net.ssl.trustStoreProvider");
+//
+// //String endpoint = "http://www.mygrid.org.uk/axis/services/UsernameTimestampHelloService"; // test server
+// //String endpoint = "http://www.mygrid.org.uk/axis/services/UsernameDigestHelloService"; // test server
+// //String endpoint = "http://www.mygrid.org.uk/axis/services/UsernameDigestTimestampHelloService"; // test server
+//
+// //String endpoint = "http://localhost:8080/axis/services/UsernameHelloService" ; // local server
+// //String endpoint = "http://localhost:8080/axis/services/UsernameTimestampHelloService" ;
+// //String endpoint = "http://localhost:8080/axis/services/UsernameDigestHelloService" ;
+// //String endpoint = "http://localhost:8080/axis/services/UsernameDigestTimestampHelloService" ;
+//
+// //Service service = new org.apache.axis.client.Service() ;
+//
+// //String wssEngineConfigurationString = WSSecurityProfiles.wssUTTimestampProfile;
+// //String wssEngineConfigurationString = WSSecurityProfiles.wssUTDigestProfile;
+// //String wssEngineConfigurationString = WSSecurityProfiles.wssUTDigestTimestampProfile;
+//
+// XMLStringProvider wssEngineConfiguration = new XMLStringProvider("<deployment xmlns=\"http://xml.apache.org/axis/wsdd/\" " +
+// "xmlns:java=\"http://xml.apache.org/axis/wsdd/providers/java\">" +
+// "<globalConfiguration>" +
+// "<requestFlow>" +
+// "<handler type=\"java:org.apache.ws.axis.security.WSDoAllSender\">" +
+// "<parameter name=\"action\" value=\"UsernameToken\"/>" +
+// "<parameter name=\"passwordType\" value=\"PasswordDigest\"/>" +
+// "</handler>"+
+// "</requestFlow>" +
+// "</globalConfiguration>" +
+// "<transport name=\"http\" pivot=\"java:org.apache.axis.transport.http.HTTPSender\"/>"+
+// "</deployment>");
+//
+// Service service = new Service(wssEngineConfiguration);
+//
+// Call call = new Call(service);
+//
+// //call.setTransport(new HTTPTransport());
+// call.setTargetEndpointAddress(endpoint) ;
+// call.setOperationName(new QName("hello")) ;
+//
+// String username = "testuser";
+// String password = "testpasswd";
+//
+// //WSS4J WSDoAllSender's invoke() method expects username not to be empty before the agent takes over
+// // to set it so we set it to the WSDL location here (that is used as keystore alias) and later on overwrite it
+// call.setProperty(Call.USERNAME_PROPERTY, "testuser");
+// call.setProperty(Call.PASSWORD_PROPERTY, "testpasswd");
+//
+//
+// // Set HTTP Basic AuthN
+//// MessageContext context = call.getMessageContext();
+//// Hashtable headers = (Hashtable) context
+//// .getProperty(HTTPConstants.REQUEST_HEADERS);
+//// if (headers == null) {
+//// headers = new Hashtable();
+//// context.setProperty(HTTPConstants.REQUEST_HEADERS, headers);
+//// }
+////// String authorization = Base64.encode(("hudsonadmin" + ":"
+////// + "ch33se").getBytes());
+//// String authorization = Base64.encode((username + ":"
+//// + password).getBytes());
+//// headers.put("Authorization", "Basic " + authorization);
+//// System.out.println("HTTP Authorization header: "
+//// + headers.get("Authorization"));
+//// HTTPSender http = new HTTPSender();
+////
+//// Transport transport = call.getTransportForProtocol("https");
+//// System.out.println(transport.getClass());
+////
+//
+//
+//
+// String nickName = "Beauty" ;
+// System.out.println("Sent: '" + nickName + "'") ;
+// String ret = (String) call.invoke(new Object[] {nickName}) ;
+// System.out.println("Got: '" + ret + "'") ;
+// assertEquals(ret, "Hello Beauty!");
+// }
+// catch (Exception e) {
+// e.printStackTrace() ;
+// }
+// System.exit(0) ;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/AddXMLSplitterEditTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/AddXMLSplitterEditTest.java b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/AddXMLSplitterEditTest.java
new file mode 100644
index 0000000..e45e0fa
--- /dev/null
+++ b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/AddXMLSplitterEditTest.java
@@ -0,0 +1,135 @@
+/*
+* 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.taverna.activities.wsdl.xmlsplitter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import net.sf.taverna.t2.activities.testutils.LocationConstants;
+import org.apache.taverna.activities.wsdl.WSDLActivity;
+import net.sf.taverna.t2.workflowmodel.Edits;
+import net.sf.taverna.t2.workflowmodel.Processor;
+import net.sf.taverna.t2.workflowmodel.impl.DataflowImpl;
+import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
+import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+public class AddXMLSplitterEditTest implements LocationConstants {
+
+ private static final JsonNodeFactory JSON_NODE_FACTORY = JsonNodeFactory.instance;
+
+ private WSDLActivity activity;
+ private DataflowImpl dataflow;
+ private ObjectNode configBean;
+ private static ObjectNode operationConfigBean;
+ private String wsdlLocation = WSDL_TEST_BASE
+ + "eutils/eutils_lite.wsdl";
+ private Edits edits;
+
+ @Ignore("Integration test")
+ @Before
+ public void setUp() throws Exception {
+ activity = new WSDLActivity(null);
+ configBean = JSON_NODE_FACTORY.objectNode();
+ operationConfigBean = configBean.objectNode();
+ configBean.put("operation", operationConfigBean);
+ operationConfigBean.put("name", "run_eInfo");
+ operationConfigBean.put("wsdl", wsdlLocation);
+ activity.configure(configBean);
+ edits = new EditsImpl();
+
+ dataflow = (DataflowImpl)edits.createDataflow();
+ Processor p=edits.createProcessor("run_eInfo");
+ edits.getDefaultDispatchStackEdit(p).doEdit();
+ edits.getAddActivityEdit(p, activity).doEdit();
+ edits.getMapProcessorPortsForActivityEdit(p).doEdit();
+ edits.getAddProcessorEdit(dataflow, p).doEdit();
+
+ }
+
+ @Ignore("Integration test")
+ @Test
+ public void testAddOutputSplitterToWSDLActivity() throws Exception {
+ AddXMLSplitterEdit edit = new AddXMLSplitterEdit(dataflow,activity,"parameters",false, new EditsImpl());
+ edit.doEdit();
+ assertEquals("The workflow should now contain 2 services",2,dataflow.getProcessors().size());
+ Processor processor=null;
+ for (Processor p : dataflow.getProcessors()) {
+ if (p.getLocalName().equals("parametersXML")) {
+ processor = p;
+ break;
+ }
+ }
+ assertNotNull("There should be a processor named parametersXML",processor);
+ assertEquals("There should be 1 activity",1,processor.getActivityList().size());
+
+ assertEquals("The processor should have 3 output ports",3,processor.getOutputPorts().size());
+ assertEquals("The processor should have 1 input port",1,processor.getInputPorts().size());
+
+ Activity<?>a = processor.getActivityList().get(0);
+ assertEquals("The activity should have 3 output ports",3,a.getOutputPorts().size());
+ assertEquals("The activity should have 1 input port",1,a.getInputPorts().size());
+
+ assertEquals("There should be 1 datalink",1,dataflow.getLinks().size());
+ }
+
+ @Ignore("Integration test")
+ @Test
+ public void testUndo() throws Exception {
+ AddXMLSplitterEdit edit = new AddXMLSplitterEdit(dataflow,activity,"parameters",false, new EditsImpl());
+ edit.doEdit();
+ edit.undo();
+ assertEquals("There should be only 1 processor",1,dataflow.getProcessors().size());
+ assertEquals("The processor should be called run_eInfo","run_eInfo",dataflow.getProcessors().get(0).getLocalName());
+ assertEquals("There should be no datalinks",0,dataflow.getLinks().size());
+ }
+
+ @Ignore("Integration test")
+ @Test
+ public void testAddInputSplitterToWSDLActivity() throws Exception {
+ AddXMLSplitterEdit edit = new AddXMLSplitterEdit(dataflow,activity,"parameters",true, new EditsImpl());
+ edit.doEdit();
+ assertEquals("The workflow should now contain 2 services",2,dataflow.getProcessors().size());
+ Processor processor=null;
+ for (Processor p : dataflow.getProcessors()) {
+ if (p.getLocalName().equals("parametersXML")) {
+ processor = p;
+ break;
+ }
+ }
+ assertNotNull("There should be a processor named parametersXML",processor);
+ assertEquals("There should be 1 activity",1,processor.getActivityList().size());
+ assertEquals("THe processor should have 3 input ports",3,processor.getInputPorts().size());
+ assertEquals("THe processor should have 1 output port",1,processor.getOutputPorts().size());
+
+ Activity<?>a = processor.getActivityList().get(0);
+
+ assertEquals("The activity should have 3 input ports",3,a.getInputPorts().size());
+ assertEquals("The activity 1 output port",1,a.getOutputPorts().size());
+
+ assertEquals("There should be 1 datalink",1,dataflow.getLinks().size());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/XMLInputSplitterActivityTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/XMLInputSplitterActivityTest.java b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/XMLInputSplitterActivityTest.java
new file mode 100644
index 0000000..b9bfe85
--- /dev/null
+++ b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/XMLInputSplitterActivityTest.java
@@ -0,0 +1,87 @@
+/*
+* 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.taverna.activities.wsdl.xmlsplitter;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.StringReader;
+
+import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
+import org.apache.taverna.wsdl.parser.BaseTypeDescriptor;
+import org.apache.taverna.wsdl.parser.ComplexTypeDescriptor;
+
+import org.jdom.Element;
+import org.jdom.input.SAXBuilder;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+public class XMLInputSplitterActivityTest {
+
+ @Test
+ public void testGetTypeDescriptorForInputPort() throws Exception {
+ String xml = "<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"personToString\" name=\"parameters\" qname=\"{http://xfire.codehaus.org/BookService}personToString\"><s:elements><s:complextype optional=\"false\" unbounded=\"false\" typename=\"Person\" name=\"person\" qname=\"{http://xfire.codehaus.org/BookService}>personToString>person\"><s:elements><s:complextype optional=\"true\" unbounded=\"false\" typename=\"Address\" name=\"address\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>address\"><s:elements><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"city\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>city\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"road\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>road\" /><s:basetype optional=\"true\" unbounded=\"false\" typ
ename=\"int\" name=\"roadNumber\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>roadNumber\" /></s:elements></s:complextype><s:basetype optional=\"true\" unbounded=\"false\" typename=\"int\" name=\"age\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>age\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"firstName\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>firstName\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"lastName\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>lastName\" /></s:elements></s:complextype></s:elements></s:complextype></s:extensions>";
+ Element element = new SAXBuilder().build(new StringReader(xml)).getRootElement();
+ JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForInput(element);
+ XMLInputSplitterActivity a = new XMLInputSplitterActivity();
+ a.configure(bean);
+ XMLInputSplitterActivityFactory af = new XMLInputSplitterActivityFactory();
+ af.setEdits(new EditsImpl());
+
+ boolean exists = false;
+ for (ActivityInputPort p : af.getInputPorts(bean)) {
+ if (p.getName().equals("person")) {
+ exists=true;
+ break;
+ }
+ }
+
+ assertTrue("The input port named person should have been found",exists);
+
+ assertNotNull("There should be a type descriptor for person",a.getTypeDescriptorForInputPort("person"));
+ assertTrue("The descriptor should be complex",a.getTypeDescriptorForInputPort("person") instanceof ComplexTypeDescriptor);
+ }
+
+ @Test
+ public void testGetTypeDescriptorForInputPort2() throws Exception {
+ String xml = "<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"Person\" name=\"person\" qname=\"{http://xfire.codehaus.org/BookService}>personToString>person\"><s:elements><s:complextype optional=\"true\" unbounded=\"false\" typename=\"Address\" name=\"address\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>address\"><s:elements><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"city\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>city\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"road\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>road\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"int\" name=\"roadNumber\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>roadNumber\" /></s:elements></s:complextype><s:basetype optional=\"true\" unb
ounded=\"false\" typename=\"int\" name=\"age\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>age\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"firstName\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>firstName\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"lastName\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>lastName\" /></s:elements></s:complextype></s:extensions>";
+ Element element = new SAXBuilder().build(new StringReader(xml)).getRootElement();
+ JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForInput(element);
+ XMLInputSplitterActivity a = new XMLInputSplitterActivity();
+ a.configure(bean);
+ XMLInputSplitterActivityFactory af = new XMLInputSplitterActivityFactory();
+ af.setEdits(new EditsImpl());
+
+ boolean exists = false;
+ for (ActivityInputPort p : af.getInputPorts(bean)) {
+ if (p.getName().equals("firstName")) {
+ exists=true;
+ break;
+ }
+ }
+
+ assertTrue("The input port named firstName should have been found",exists);
+
+ assertNotNull("There should be a type descriptor for person",a.getTypeDescriptorForInputPort("firstName"));
+ assertTrue("The descriptor should be base type",a.getTypeDescriptorForInputPort("firstName") instanceof BaseTypeDescriptor);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/XMLOutputSplitterActivityTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/XMLOutputSplitterActivityTest.java b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/XMLOutputSplitterActivityTest.java
new file mode 100644
index 0000000..948a65d
--- /dev/null
+++ b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/XMLOutputSplitterActivityTest.java
@@ -0,0 +1,52 @@
+/*
+* 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.taverna.activities.wsdl.xmlsplitter;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.StringReader;
+
+import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
+import org.apache.taverna.wsdl.parser.ComplexTypeDescriptor;
+
+import org.jdom.Element;
+import org.jdom.input.SAXBuilder;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+public class XMLOutputSplitterActivityTest {
+
+ @Test
+ public void testGetTypeDescriptorForOutputPort() throws Exception {
+
+ String xml = "<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"getPersonResponse\" name=\"parameters\" qname=\"{http://testing.org}getPersonResponse\"><s:elements><s:complextype optional=\"false\" unbounded=\"false\" typename=\"Person\" name=\"getPersonReturn\" qname=\"{http://testing.org}>getPersonResponse>getPersonReturn\"><s:elements><s:complextype optional=\"false\" unbounded=\"false\" typename=\"Address\" name=\"address\" qname=\"{http://testing.org}Person>address\"><s:elements><s:basetype optional=\"false\" unbounded=\"false\" typename=\"string\" name=\"city\" qname=\"{http://testing.org}Address>city\" /><s:basetype optional=\"false\" unbounded=\"false\" typename=\"int\" name=\"number\" qname=\"{http://testing.org}Address>number\" /><s:basetype optional=\"false\" unbounded=\"false\" typename=\"string\" name=\"road\" qname=\"{http://testing.org}Address>road\" /></s:element
s></s:complextype><s:basetype optional=\"false\" unbounded=\"false\" typename=\"int\" name=\"age\" qname=\"{http://testing.org}Person>age\" /><s:basetype optional=\"false\" unbounded=\"false\" typename=\"string\" name=\"name\" qname=\"{http://testing.org}Person>name\" /></s:elements></s:complextype></s:elements></s:complextype></s:extensions>";
+ Element element = new SAXBuilder().build(new StringReader(xml)).getRootElement();
+ JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForOutput(element);
+ XMLOutputSplitterActivity a = new XMLOutputSplitterActivity();
+ a.setEdits(new EditsImpl());
+ a.configure(bean);
+
+ assertNotNull("There should be a descriptor for the port getPersonReturn",a.getTypeDescriptorForOutputPort("getPersonReturn"));
+ assertTrue("The descriptor should be complex",a.getTypeDescriptorForOutputPort("getPersonReturn") instanceof ComplexTypeDescriptor);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/XMLSplitterConfigurationBeanBuilderTest.java
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/XMLSplitterConfigurationBeanBuilderTest.java b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/XMLSplitterConfigurationBeanBuilderTest.java
new file mode 100644
index 0000000..0f47e7c
--- /dev/null
+++ b/taverna-wsdl-activity/src/test/java/org/apache/taverna/activities/wsdl/xmlsplitter/XMLSplitterConfigurationBeanBuilderTest.java
@@ -0,0 +1,66 @@
+package org.apache.taverna.activities.wsdl.xmlsplitter;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.StringReader;
+
+import org.jdom.Element;
+import org.jdom.input.SAXBuilder;
+import org.junit.Test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+public class XMLSplitterConfigurationBeanBuilderTest {
+
+ @Test
+ public void testBuildBeanForInput() throws Exception {
+ String xml = "<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"personToString\" name=\"parameters\" qname=\"{http://xfire.codehaus.org/BookService}personToString\"><s:elements><s:complextype optional=\"false\" unbounded=\"false\" typename=\"Person\" name=\"person\" qname=\"{http://xfire.codehaus.org/BookService}>personToString>person\"><s:elements><s:complextype optional=\"true\" unbounded=\"false\" typename=\"Address\" name=\"address\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>address\"><s:elements><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"city\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>city\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"road\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>road\" /><s:basetype optional=\"true\" unbounded=\"false\" typ
ename=\"int\" name=\"roadNumber\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>roadNumber\" /></s:elements></s:complextype><s:basetype optional=\"true\" unbounded=\"false\" typename=\"int\" name=\"age\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>age\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"firstName\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>firstName\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"lastName\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>lastName\" /></s:elements></s:complextype></s:elements></s:complextype></s:extensions>";
+ Element element = new SAXBuilder().build(new StringReader(xml)).getRootElement();
+ JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForInput(element);
+ assertNotNull("The bean should not be null",bean);
+
+ assertEquals("There should be 1 input",1,bean.get("inputPorts").size());
+ assertEquals("There should be 1 output",1,bean.get("outputPorts").size());
+
+ assertEquals("The input should be named person","person",bean.get("inputPorts").get(0).get("name").textValue());
+ assertEquals("The output should be named output","output",bean.get("outputPorts").get(0).get("name").textValue());
+
+ assertEquals("The type xml definition should match",xml,bean.get("wrappedType").textValue());
+ }
+
+ @Test
+ public void testBuildBeanForInput2() throws Exception {
+ String xml = "<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"Person\" name=\"person\" qname=\"{http://xfire.codehaus.org/BookService}>personToString>person\"><s:elements><s:complextype optional=\"true\" unbounded=\"false\" typename=\"Address\" name=\"address\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>address\"><s:elements><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"city\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>city\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"road\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>road\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"int\" name=\"roadNumber\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Address>roadNumber\" /></s:elements></s:complextype><s:basetype optional=\"true\" unb
ounded=\"false\" typename=\"int\" name=\"age\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>age\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"firstName\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>firstName\" /><s:basetype optional=\"true\" unbounded=\"false\" typename=\"string\" name=\"lastName\" qname=\"{http://complex.pojo.axis2.menagerie.googlecode}Person>lastName\" /></s:elements></s:complextype></s:extensions>";
+ Element element = new SAXBuilder().build(new StringReader(xml)).getRootElement();
+
+ JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForInput(element);
+ assertNotNull("The bean should not be null",bean);
+
+ assertEquals("There should be 4 inputs",4,bean.get("inputPorts").size());
+ assertEquals("There should be 1 output",1,bean.get("outputPorts").size());
+
+ assertEquals("The first input should be named address","address",bean.get("inputPorts").get(0).get("name").textValue());
+ assertEquals("The output should be named output","output",bean.get("outputPorts").get(0).get("name").textValue());
+
+ assertEquals("The type xml definition should match",xml,bean.get("wrappedType").textValue());
+ }
+
+ @Test
+ public void testBuildBeanForOutput() throws Exception {
+ String xml = "<s:extensions xmlns:s=\"http://org.embl.ebi.escience/xscufl/0.1alpha\"><s:complextype optional=\"false\" unbounded=\"false\" typename=\"getPersonResponse\" name=\"parameters\" qname=\"{http://testing.org}getPersonResponse\"><s:elements><s:complextype optional=\"false\" unbounded=\"false\" typename=\"Person\" name=\"getPersonReturn\" qname=\"{http://testing.org}>getPersonResponse>getPersonReturn\"><s:elements><s:complextype optional=\"false\" unbounded=\"false\" typename=\"Address\" name=\"address\" qname=\"{http://testing.org}Person>address\"><s:elements><s:basetype optional=\"false\" unbounded=\"false\" typename=\"string\" name=\"city\" qname=\"{http://testing.org}Address>city\" /><s:basetype optional=\"false\" unbounded=\"false\" typename=\"int\" name=\"number\" qname=\"{http://testing.org}Address>number\" /><s:basetype optional=\"false\" unbounded=\"false\" typename=\"string\" name=\"road\" qname=\"{http://testing.org}Address>road\" /></s:element
s></s:complextype><s:basetype optional=\"false\" unbounded=\"false\" typename=\"int\" name=\"age\" qname=\"{http://testing.org}Person>age\" /><s:basetype optional=\"false\" unbounded=\"false\" typename=\"string\" name=\"name\" qname=\"{http://testing.org}Person>name\" /></s:elements></s:complextype></s:elements></s:complextype></s:extensions>";
+ Element element = new SAXBuilder().build(new StringReader(xml)).getRootElement();
+ JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForOutput(element);
+
+ assertNotNull("The bean should not be null",bean);
+
+ assertEquals("There should be 1 input",1,bean.get("inputPorts").size());
+ assertEquals("There should be 1 output",1,bean.get("outputPorts").size());
+
+ assertEquals("The input should be named input","input",bean.get("inputPorts").get(0).get("name").textValue());
+ assertEquals("The output shouldbe named getPersonResponse","getPersonReturn",bean.get("outputPorts").get(0).get("name").textValue());
+
+ assertEquals("The type xml definition should match",xml,bean.get("wrappedType").textValue());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-common-activities/blob/433612be/taverna-wsdl-activity/src/test/resources/net/sf/taverna/t2/activities/wsdl/wsrf/counterService/CounterService_.wsdl
----------------------------------------------------------------------
diff --git a/taverna-wsdl-activity/src/test/resources/net/sf/taverna/t2/activities/wsdl/wsrf/counterService/CounterService_.wsdl b/taverna-wsdl-activity/src/test/resources/net/sf/taverna/t2/activities/wsdl/wsrf/counterService/CounterService_.wsdl
deleted file mode 100644
index 7e628e0..0000000
--- a/taverna-wsdl-activity/src/test/resources/net/sf/taverna/t2/activities/wsdl/wsrf/counterService/CounterService_.wsdl
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<wsdl:definitions name="Counter" targetNamespace="http://counter.com/service" xmlns:binding="http://counter.com/bindings" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:import location="counter_bindings.wsdl" namespace="http://counter.com/bindings"/>
- <wsdl:service name="CounterService">
- <wsdl:port binding="binding:CounterPortTypeSOAPBinding" name="CounterPortTypePort">
- <soap:address location="http://localhost:8080/wsrf/services/CounterService"/>
- </wsdl:port>
- </wsdl:service>
-</wsdl:definitions>