From b0c584b9771c3ff4ca8c2868db63fb764fb3d5ec Mon Sep 17 00:00:00 2001 From: "fabio.simeoni" Date: Fri, 7 Feb 2014 16:44:20 +0000 Subject: [PATCH] merged from trunk git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/branches/common/common-gcore-stubs/1.0@91159 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 16 +- distro/changelog.xml | 5 +- pom.xml | 103 +---- src/test/java/org/acme/ConfigTest.java | 55 --- src/test/java/org/acme/StubTest.java | 258 ------------- src/test/java/org/acme/TestHandler.java | 41 -- .../java/org/acme/jaxws/stubs/BarInput.java | 15 - .../java/org/acme/jaxws/stubs/BarOutput.java | 13 - .../org/acme/jaxws/stubs/FooException.java | 13 - .../org/acme/jaxws/stubs/StatefulStub.java | 33 -- .../org/acme/jaxws/stubs/StatelessStub.java | 90 ----- src/test/java/org/acme/jaxws/stubs/Types.java | 61 --- .../org/acme/jaxws/stubs/VoidWrapper.java | 8 - src/test/java/org/acme/service/Factory.java | 39 -- src/test/java/org/acme/service/Home.java | 11 - src/test/java/org/acme/service/Resource.java | 50 --- .../java/org/acme/service/ServiceContext.java | 25 -- src/test/java/org/acme/service/Stateful.java | 35 -- .../org/acme/service/StatefulContext.java | 34 -- src/test/java/org/acme/service/Stateless.java | 158 -------- .../org/acme/service/StatelessContext.java | 28 -- src/test/java/org/acme/service/Utils.java | 17 - ...n.clients.stubs.jaxws.handlers.CallHandler | 1 - src/test/resources/log4j.properties | 10 - .../test-service/etc/deploy-jndi-config.xml | 31 -- .../test-service/etc/deploy-server.wsdd | 32 -- .../resources/test-service/etc/profile.xml | 39 -- .../resources/test-service/wsdl/Stateful.wsdl | 47 --- .../test-service/wsdl/Stateless.wsdl | 352 ------------------ 29 files changed, 10 insertions(+), 1610 deletions(-) delete mode 100644 src/test/java/org/acme/ConfigTest.java delete mode 100644 src/test/java/org/acme/StubTest.java delete mode 100644 src/test/java/org/acme/TestHandler.java delete mode 100644 src/test/java/org/acme/jaxws/stubs/BarInput.java delete mode 100644 src/test/java/org/acme/jaxws/stubs/BarOutput.java delete mode 100644 src/test/java/org/acme/jaxws/stubs/FooException.java delete mode 100644 src/test/java/org/acme/jaxws/stubs/StatefulStub.java delete mode 100644 src/test/java/org/acme/jaxws/stubs/StatelessStub.java delete mode 100644 src/test/java/org/acme/jaxws/stubs/Types.java delete mode 100644 src/test/java/org/acme/jaxws/stubs/VoidWrapper.java delete mode 100644 src/test/java/org/acme/service/Factory.java delete mode 100644 src/test/java/org/acme/service/Home.java delete mode 100644 src/test/java/org/acme/service/Resource.java delete mode 100644 src/test/java/org/acme/service/ServiceContext.java delete mode 100644 src/test/java/org/acme/service/Stateful.java delete mode 100644 src/test/java/org/acme/service/StatefulContext.java delete mode 100644 src/test/java/org/acme/service/Stateless.java delete mode 100644 src/test/java/org/acme/service/StatelessContext.java delete mode 100644 src/test/java/org/acme/service/Utils.java delete mode 100644 src/test/resources/META-INF/services/org.gcube.common.clients.stubs.jaxws.handlers.CallHandler delete mode 100644 src/test/resources/log4j.properties delete mode 100755 src/test/resources/test-service/etc/deploy-jndi-config.xml delete mode 100644 src/test/resources/test-service/etc/deploy-server.wsdd delete mode 100644 src/test/resources/test-service/etc/profile.xml delete mode 100644 src/test/resources/test-service/wsdl/Stateful.wsdl delete mode 100644 src/test/resources/test-service/wsdl/Stateless.wsdl diff --git a/.classpath b/.classpath index ef1ba90..953de0b 100644 --- a/.classpath +++ b/.classpath @@ -22,21 +22,15 @@ - - - - - - - - - - - + + + + + diff --git a/distro/changelog.xml b/distro/changelog.xml index 85d2c92..9543198 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -2,8 +2,11 @@ First Release - + Modular handler discovery and delegation Fix: WSDL cache now releases the lock it acquires when clearing + + Moved tests to separate suite + \ No newline at end of file diff --git a/pom.xml b/pom.xml index a87e7b1..31eef40 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.gcube.core common-gcore-stubs - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT GCore Stubs JAXWS Stub Support for gCore Service @@ -39,15 +39,6 @@ - - - org.gcube.core - gcf - [1.5.0-SNAPSHOT,2.0.0-SNAPSHOT) - provided - - - org.slf4j slf4j-simple @@ -55,23 +46,6 @@ test - - - org.gcube.tools - my-container - 2.0.0-SNAPSHOT - test - - - - - org.gcube.tools - my-container - 2.0.0-SNAPSHOT - tar.gz - distro - test - @@ -124,81 +98,6 @@ - - - - - org.gcube.tools - maven-service-plugin - 1.0.0 - - org.acme.sample - src/test/resources/test-service/wsdl - src/test/resources/test-service/etc - - - Stateless - http://acme.org - - - Stateful - http://acme.org - - - - - - generate-stubs - generate-test-resources - - stub-gen - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.7 - - - add-source - generate-test-sources - - add-test-source - - - - ${project.basedir}/target/generated-sources/stubs - - - - - - - - - maven-dependency-plugin - - - install-my-container - generate-test-resources - - my-container - tar.gz - false - ${project.basedir} - ${project.basedir} - - - unpack-dependencies - - - - - diff --git a/src/test/java/org/acme/ConfigTest.java b/src/test/java/org/acme/ConfigTest.java deleted file mode 100644 index 9c5d366..0000000 --- a/src/test/java/org/acme/ConfigTest.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.acme; - -import static org.acme.jaxws.stubs.StatelessStub.*; -import static org.gcube.common.clients.stubs.jaxws.StubFactory.*; -import static org.junit.Assert.*; - -import java.net.URI; - -import org.acme.jaxws.stubs.StatelessStub; -import org.gcube.common.clients.stubs.jaxws.handlers.HandlerRegistry; -import org.gcube.common.mycontainer.Deployment; -import org.gcube.common.mycontainer.Gar; -import org.gcube.common.mycontainer.MyContainerTestRunner; -import org.gcube.common.scope.api.ScopeProvider; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; - -@RunWith(MyContainerTestRunner.class) -public class ConfigTest { - - @Deployment - static Gar testservice = new Gar("test-service").addConfigurations("src/test/resources/test-service/etc").addInterfaces("src/test/resources/test-service/wsdl"); - - static StatelessStub stub; - - @BeforeClass - public static void setup() { - - ScopeProvider.instance.set("/gcube/devsec"); - - stub = stubFor(stateless).at(URI.create("http://localhost:9999/wsrf/services/acme/service/stateless")); - - } - - @Test - public void handlerTest() { - - TestHandler handler = new TestHandler(); - - assertTrue(HandlerRegistry.handlers().contains(handler)); - - String input = "input"; - String output = stub.foo(input); - - assertEquals(input, output); - - handler.called=true; - - assertTrue(HandlerRegistry.handlers().contains(handler)); - - } - - -} diff --git a/src/test/java/org/acme/StubTest.java b/src/test/java/org/acme/StubTest.java deleted file mode 100644 index 414568f..0000000 --- a/src/test/java/org/acme/StubTest.java +++ /dev/null @@ -1,258 +0,0 @@ -package org.acme; - -import static org.acme.jaxws.stubs.StatefulStub.*; -import static org.acme.jaxws.stubs.StatelessStub.*; -import static org.gcube.common.clients.stubs.jaxws.StubFactory.*; -import static org.junit.Assert.*; - -import java.net.URI; -import java.util.Arrays; -import java.util.List; - -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.ws.EndpointReference; -import javax.xml.ws.soap.SOAPFaultException; -import javax.xml.ws.wsaddressing.W3CEndpointReference; - -import org.acme.jaxws.stubs.BarInput; -import org.acme.jaxws.stubs.BarOutput; -import org.acme.jaxws.stubs.FooException; -import org.acme.jaxws.stubs.StatefulStub; -import org.acme.jaxws.stubs.StatelessStub; -import org.acme.jaxws.stubs.Types.AnyElement; -import org.acme.jaxws.stubs.Types.ChoiceOne; -import org.acme.jaxws.stubs.Types.PolyWrapped; -import org.acme.jaxws.stubs.Types.Sometype; -import org.acme.jaxws.stubs.Types.Subone; -import org.acme.jaxws.stubs.Types.Subtwo; -import org.acme.jaxws.stubs.VoidWrapper; -import org.gcube.common.clients.stubs.jaxws.JAXWSUtils; -import org.gcube.common.mycontainer.Deployment; -import org.gcube.common.mycontainer.Gar; -import org.gcube.common.mycontainer.MyContainerTestRunner; -import org.gcube.common.scope.api.ScopeProvider; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -@RunWith(MyContainerTestRunner.class) -public class StubTest { - - @Deployment - static Gar testservice = new Gar("test-service").addConfigurations("src/test/resources/test-service/etc").addInterfaces("src/test/resources/test-service/wsdl"); - - static StatelessStub stub; - - @BeforeClass - public static void setup() { - - //setProxy("localhost",8081); //comment after on-the-wire analysis - - ScopeProvider.instance.set("/gcube/devsec"); - - stub = stubFor(stateless).at(URI.create("http://localhost:9999/wsrf/services/acme/service/stateless")); - - } - - @Test - public void fooTest() { - - String input = "input"; - String output = stub.foo(input); - - assertEquals(input, output); - } - - @Test - public void fooWrappedTest() { - - String input = "input"; - String output = stub.fooWrapped(input); - - assertEquals(input, output); - } - - - @Test - public void fooMixedTest() { - - String input = "input"; - String output = stub.fooMixed(input).ret; - - assertEquals(input, output); - } - - @Test - public void fooBulkTest() { - - String[] input = new String[]{"1","2","3"}; - String output = stub.fooBulk(Arrays.asList(input)); - - assertEquals(Arrays.deepToString(input), output); - } - - @Test - public void fooContingencyTest() { - - try { - stub.fooFault("contingency"); - fail(); - } - catch(FooException e) { - - } - - } - - @Test - public void fooOutageTest() throws Exception { - - try { - stub.fooFault("outage"); - fail(); - } - catch(SOAPFaultException e) { - - } - - } - - @Test - public void fooProperOutageTest() throws Exception { - - try { - stub.fooFault("proper"); - fail(); - } - catch(SOAPFaultException e) { - new RuntimeException(JAXWSUtils.remoteCause(e)).printStackTrace(); - } - - } - - @Test - public void barTest() throws Exception { - - String input = "input"; - BarInput request = new BarInput(); - request.in1 = input; - request.in2 = 3; - BarOutput response = stub.bar(request); - - List expected = Arrays.asList(input,input); - - assertEquals(expected, response.output); - - } - - @Test - public void bazTest() { - - String response = stub.baz(new VoidWrapper()); - - assertNotNull(response); - - } - - @Test - public void nothingTest() { - - stub.nothing(); - - } - - @Test - public void barWrappedTest() throws Exception { - - String in1 = "input"; - Integer in2 = 3; - List response = stub.barWrapped(in1,in2); - - List expected = Arrays.asList(in1,in1); - - assertEquals(expected, response); - - } - - @Test - public void createWithEPRTest() throws Exception { - - W3CEndpointReference ref = stub.create("input"); - - assertNotNull(ref); - - } - - @Test - public void callsTest() throws Exception { - - EndpointReference ref = stub.create("input"); - - StatefulStub stub = stubFor(stateful).at(ref); - - assertNotNull(stub.calls()); - - - } - - @Test - public void anyTypeTest() throws Exception { - - String ref = stub.any("input"); - - assertEquals(String.class.getName(),ref); - - Sometype st = new Sometype(); - st.some="hello"; - - ref = stub.any(st); - - assertEquals(org.acme.sample.stubs.Sometype.class.getName(),ref); - } - - @Test - public void anyElementTest() throws Exception { - - Document d = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); - Element root = d.createElement("root"); - root.appendChild(d.createElement("empty")); - root.setAttribute("foo", "val"); - AnyElement e = new AnyElement(); - e.some=root; - stub.anyElement(e); - } - - @Test - public void poly() throws Exception { - - stub.poly(new Subone()); - stub.poly(new Subtwo()); - - } - - @Test - public void polyWrapped() throws Exception { - - Subone one = new Subone(); - one.one="one"; - PolyWrapped wrapped = new PolyWrapped(); - wrapped.param=one; - stub.polyWrapped(wrapped); - - - } - - @Test - public void choice() throws Exception { - - Subone sub = new Subone(); - ChoiceOne one = new ChoiceOne(); - one.one=sub; - stub.choice(one); - - - } - -} diff --git a/src/test/java/org/acme/TestHandler.java b/src/test/java/org/acme/TestHandler.java deleted file mode 100644 index f6f8aa0..0000000 --- a/src/test/java/org/acme/TestHandler.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.acme; - -import javax.xml.soap.SOAPHeader; -import javax.xml.ws.handler.soap.SOAPMessageContext; - -import org.gcube.common.clients.stubs.jaxws.GCoreService; -import org.gcube.common.clients.stubs.jaxws.handlers.AbstractHandler; - -public class TestHandler extends AbstractHandler { - - public boolean called=false; - - @Override - public void handleRequest(GCoreService target, SOAPHeader header, SOAPMessageContext context) throws Exception { - called=true; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (called ? 1231 : 1237); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - TestHandler other = (TestHandler) obj; - if (called != other.called) - return false; - return true; - } - - -} diff --git a/src/test/java/org/acme/jaxws/stubs/BarInput.java b/src/test/java/org/acme/jaxws/stubs/BarInput.java deleted file mode 100644 index b2caee9..0000000 --- a/src/test/java/org/acme/jaxws/stubs/BarInput.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.acme.jaxws.stubs; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - - -@XmlRootElement -public class BarInput { - - @XmlElement - public String in1; - - @XmlElement - public int in2; -} diff --git a/src/test/java/org/acme/jaxws/stubs/BarOutput.java b/src/test/java/org/acme/jaxws/stubs/BarOutput.java deleted file mode 100644 index 588f4b8..0000000 --- a/src/test/java/org/acme/jaxws/stubs/BarOutput.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.acme.jaxws.stubs; - -import java.util.List; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -public class BarOutput { - - @XmlElement - public List output; -} diff --git a/src/test/java/org/acme/jaxws/stubs/FooException.java b/src/test/java/org/acme/jaxws/stubs/FooException.java deleted file mode 100644 index 2efed5a..0000000 --- a/src/test/java/org/acme/jaxws/stubs/FooException.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.acme.jaxws.stubs; - -import javax.xml.ws.WebFault; - -@WebFault(name="SampleFault") -public class FooException extends Exception { - - private static final long serialVersionUID = 1L; - - public FooException(String s) { - super(s); - } -} diff --git a/src/test/java/org/acme/jaxws/stubs/StatefulStub.java b/src/test/java/org/acme/jaxws/stubs/StatefulStub.java deleted file mode 100644 index c646118..0000000 --- a/src/test/java/org/acme/jaxws/stubs/StatefulStub.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.acme.jaxws.stubs; - -import static org.acme.jaxws.stubs.StatefulStub.*; -import static org.gcube.common.clients.stubs.jaxws.GCoreServiceBuilder.*; - -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.xml.namespace.QName; - -import org.gcube.common.clients.stubs.jaxws.GCoreService; - -@WebService(name=porttype,targetNamespace=porttypeNS) -public interface StatefulStub { - - public static final String namespace = "http://acme.org/service"; - public static final String localname = "StatefulService"; - public static final QName name = new QName(namespace,localname); - - public static final String porttypeNS = "http://acme.org"; - static final String porttype = "StatefulPortType"; - static final String port = "StatefulPortTypePort"; - - public static String service_class="samples"; - public static String service_name="test-service"; - - static final GCoreService stateful = service(). - withName(name). - coordinates(service_class,service_name). - andInterface(StatefulStub.class); - - @WebResult(name="output") - String calls(); -} diff --git a/src/test/java/org/acme/jaxws/stubs/StatelessStub.java b/src/test/java/org/acme/jaxws/stubs/StatelessStub.java deleted file mode 100644 index 3e5a735..0000000 --- a/src/test/java/org/acme/jaxws/stubs/StatelessStub.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.acme.jaxws.stubs; - -import static javax.jws.soap.SOAPBinding.ParameterStyle.*; -import static org.acme.jaxws.stubs.StatelessStub.*; -import static org.gcube.common.clients.stubs.jaxws.GCoreServiceBuilder.*; - -import java.util.List; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.jws.soap.SOAPBinding; -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.namespace.QName; -import javax.xml.ws.wsaddressing.W3CEndpointReference; - -import org.acme.jaxws.stubs.Types.AnyElement; -import org.acme.jaxws.stubs.Types.Base; -import org.acme.jaxws.stubs.Types.Choice; -import org.acme.jaxws.stubs.Types.MixedWrapper; -import org.acme.jaxws.stubs.Types.PolyWrapped; -import org.acme.jaxws.stubs.Types.Sometype; -import org.gcube.common.clients.stubs.jaxws.GCoreService; - -@WebService(name=porttypeLN,targetNamespace=porttypeNS) -@SOAPBinding(parameterStyle=BARE) -@XmlSeeAlso(Sometype.class) -public interface StatelessStub { - - public class AcmeConstants { - - public static final String serviceNS = "http://acme.org"; - public static final String porttypeNS = "http://acme.org"; - public static final QName name = new QName(serviceNS,"AcmeService"); - public static final String porttypeLN = "AcmePortType"; - } - - public static final QName name = new QName("http://acme.org/service","StatelessService"); - - public static final String porttypeNS = "http://acme.org"; - static final String porttypeLN = "StatelessPortType"; - - public static String service_class="samples"; - public static String service_name="test-service"; - - static final GCoreService stateless = service(). - withName(name). - coordinates(service_class,service_name). - andInterface(StatelessStub.class); - - String foo(String s); - - @SOAPBinding(parameterStyle=WRAPPED) - @WebResult(name="anything") - String fooWrapped(@WebParam(name="param") String s); - - MixedWrapper fooMixed(String s); - - @SOAPBinding(parameterStyle=WRAPPED) - @WebResult(name="return") - String fooBulk(@WebParam(name="param") List elements); - - String fooFault(String s) throws FooException; - - String baz(VoidWrapper v); - - @SOAPBinding(parameterStyle=WRAPPED) - void nothing(); - - BarOutput bar(BarInput s); - - @SOAPBinding(parameterStyle=WRAPPED) - @WebMethod(operationName="bar") - @WebResult(name="output") - List barWrapped(@WebParam(name="in1")String s,@WebParam(name="in2")int i); - - W3CEndpointReference create(String s); - - String any(Object o); - - void anyElement(AnyElement e); - - void poly(Base one); - - void polyWrapped(PolyWrapped one); - - public void choice(Choice c); - -} diff --git a/src/test/java/org/acme/jaxws/stubs/Types.java b/src/test/java/org/acme/jaxws/stubs/Types.java deleted file mode 100644 index fe8c91e..0000000 --- a/src/test/java/org/acme/jaxws/stubs/Types.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.acme.jaxws.stubs; - -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSeeAlso; - -import org.w3c.dom.Element; - -public class Types { - - public static class MixedWrapper{ - @XmlElement(name="anything") - public String ret; - } - - public static class AnyElement { - @XmlAnyElement - public Element some; - } - - public static class Sometype { - @XmlElement - public String some; - } - - public static class SomeElement { - @XmlAnyElement - public Element some; - } - - @XmlRootElement - public static class PolyWrapped { - @XmlElement - public Base param; - } - - @XmlSeeAlso({Subone.class,Subtwo.class}) - public static class Base{} - - - @XmlRootElement - public static class Subone extends Base { - @XmlElement - public String one; - } - - @XmlRootElement - public static class Subtwo extends Base { - @XmlElement - public String two; - } - - @XmlSeeAlso({ChoiceOne.class}) - public static abstract class Choice {} - - public static class ChoiceOne extends Choice { - @XmlElement - public Subone one; - } -} diff --git a/src/test/java/org/acme/jaxws/stubs/VoidWrapper.java b/src/test/java/org/acme/jaxws/stubs/VoidWrapper.java deleted file mode 100644 index 689087b..0000000 --- a/src/test/java/org/acme/jaxws/stubs/VoidWrapper.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.acme.jaxws.stubs; - -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -public class VoidWrapper { - -} diff --git a/src/test/java/org/acme/service/Factory.java b/src/test/java/org/acme/service/Factory.java deleted file mode 100644 index f1ac2ca..0000000 --- a/src/test/java/org/acme/service/Factory.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.acme.service; - -import org.apache.axis.message.addressing.EndpointReferenceType; -import org.gcube.common.core.contexts.GCUBEStatefulPortTypeContext; -import org.gcube.common.core.faults.GCUBEFault; -import org.gcube.common.core.faults.GCUBEUnrecoverableException; -import org.gcube.common.core.porttypes.GCUBEPortType; -import org.gcube.common.core.state.GCUBEWSHome; -import org.gcube.common.core.state.GCUBEWSResource; -import org.gcube.common.core.state.GCUBEWSResourceKey; -import org.gcube.common.core.utils.logging.GCUBELog; - -public class Factory extends GCUBEPortType { - - GCUBELog logger = new GCUBELog(this); - - - @Override - protected ServiceContext getServiceContext() { - return ServiceContext.getContext(); - } - - - public EndpointReferenceType create(String name) throws GCUBEFault { - //create/reuse the resource - try { - GCUBEStatefulPortTypeContext ptcxt = StatefulContext.getContext(); - GCUBEWSHome home = ptcxt.getWSHome(); - GCUBEWSResourceKey key = ptcxt.makeKey(name); - GCUBEWSResource ws = home.create(key,name); - ws.store(); - return ws.getEPR(); - - } catch (Exception e) { - logger.error("unable to logon", e); - throw new GCUBEUnrecoverableException(e).toFault(); - } - } -} diff --git a/src/test/java/org/acme/service/Home.java b/src/test/java/org/acme/service/Home.java deleted file mode 100644 index edfab43..0000000 --- a/src/test/java/org/acme/service/Home.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.acme.service; - -import org.gcube.common.core.contexts.GCUBEStatefulPortTypeContext; -import org.gcube.common.core.state.GCUBEWSHome; - -public class Home extends GCUBEWSHome { - - @Override - public GCUBEStatefulPortTypeContext getPortTypeContext() {return StatefulContext.getContext();} - -} diff --git a/src/test/java/org/acme/service/Resource.java b/src/test/java/org/acme/service/Resource.java deleted file mode 100644 index 581de7e..0000000 --- a/src/test/java/org/acme/service/Resource.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.acme.service; - -import org.gcube.common.core.state.GCUBEWSResource; -import org.globus.wsrf.ResourceProperty; - -public class Resource extends GCUBEWSResource { - - - - private static final String NAME_RP_NAME = "Name"; - /** Client visits.*/ - int calls; - /** Client name. */ - String name; - - /**{@inheritDoc}*/ - public void initialise(Object... args) throws Exception { - if (args == null || args.length!=1) throw new IllegalArgumentException(); - this.setName((String) args[0]); - } - - /** Returns the number of client visits. - * @return the visits.*/ - public synchronized int getVisits() {return calls;} - - /** Returns the client name. - * @return the name.*/ - public synchronized String getName() { - return (String) this.getResourcePropertySet().get(NAME_RP_NAME).get(0); - - } - - /** Sets the client name. - * @params the name.*/ - public synchronized void setName(String name) { - ResourceProperty property = this.getResourcePropertySet().get(NAME_RP_NAME); - property.clear(); - property.add(name); - } - - /**Sets the number of client visits. - * the visits.*/ - protected synchronized void addVisit() {this.calls++;} - - @Override - protected String[] getPropertyNames() { - return new String[]{NAME_RP_NAME}; - } - -} diff --git a/src/test/java/org/acme/service/ServiceContext.java b/src/test/java/org/acme/service/ServiceContext.java deleted file mode 100644 index 686abca..0000000 --- a/src/test/java/org/acme/service/ServiceContext.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.acme.service; - -import static org.acme.service.Utils.*; - -import org.gcube.common.core.contexts.GCUBEServiceContext; - -public class ServiceContext extends GCUBEServiceContext { - - - /** Single context instance, created eagerly */ - private static ServiceContext cache = new ServiceContext(); - - /** Returns cached instance */ - public static ServiceContext getContext() {return cache;} - - /** Prevents accidental creation of more instances */ - private ServiceContext(){}; - - /** {@inheritDoc} */ - protected String getJNDIName() {return NAME;} - - - - -} diff --git a/src/test/java/org/acme/service/Stateful.java b/src/test/java/org/acme/service/Stateful.java deleted file mode 100644 index 9d86d54..0000000 --- a/src/test/java/org/acme/service/Stateful.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.acme.service; - -import org.acme.sample.stubs.CallsResponse; -import org.gcube.common.core.porttypes.GCUBEPortType; -import org.gcube.common.core.types.VOID; -import org.globus.wsrf.ResourceException; - -public class Stateful extends GCUBEPortType { - - @Override - protected ServiceContext getServiceContext() {return ServiceContext.getContext();} - - public CallsResponse calls(VOID voidType) { - try { - Resource resource = this.getResource(); - return new CallsResponse(resource.getVisits()+" for "+resource.getName()); - } - catch (Exception e) { - throw new RuntimeException("problem",e); - } - - } - - /** - * - * @return the stateful resource - * @throws ResourceException if no resource was found in the current context - */ - private Resource getResource() throws ResourceException { - return (Resource) StatefulContext.getContext().getWSHome().find(); - } - - - -} diff --git a/src/test/java/org/acme/service/StatefulContext.java b/src/test/java/org/acme/service/StatefulContext.java deleted file mode 100644 index bf19723..0000000 --- a/src/test/java/org/acme/service/StatefulContext.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.acme.service; - -import static org.acme.service.Utils.*; - -import org.gcube.common.core.contexts.GCUBEServiceContext; -import org.gcube.common.core.contexts.GCUBEStatefulPortTypeContext; - -public class StatefulContext extends GCUBEStatefulPortTypeContext { - - - /** Single context instance, created eagerly */ - private static GCUBEStatefulPortTypeContext cache = new StatefulContext(); - - /**Create an instance, privately */ - private StatefulContext(){} - - /** Returns singleton context. - * @return the context. */ - public static GCUBEStatefulPortTypeContext getContext() {return cache;} - - /** {@inheritDoc} **/ - public String getJNDIName() {return STATEFUL_NAME;} - - /** {@inheritDoc} **/ - public String getNamespace() {return NS;} - - /** {@inheritDoc} **/ - public GCUBEServiceContext getServiceContext() {return ServiceContext.getContext();} - - - - - -} diff --git a/src/test/java/org/acme/service/Stateless.java b/src/test/java/org/acme/service/Stateless.java deleted file mode 100644 index 71252a1..0000000 --- a/src/test/java/org/acme/service/Stateless.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * - */ -package org.acme.service; - -import java.io.StringWriter; -import java.util.Arrays; - -import javax.xml.namespace.QName; - -import org.acme.sample.stubs.AnyElement; -import org.acme.sample.stubs.AnyElementResponse; -import org.acme.sample.stubs.Bar; -import org.acme.sample.stubs.BarResponse; -import org.acme.sample.stubs.Base; -import org.acme.sample.stubs.Choice; -import org.acme.sample.stubs.ChoiceResponse; -import org.acme.sample.stubs.FooBulk; -import org.acme.sample.stubs.FooBulkResponse; -import org.acme.sample.stubs.FooWrapped; -import org.acme.sample.stubs.FooWrappedResponse; -import org.acme.sample.stubs.Nothing; -import org.acme.sample.stubs.PolyResponse; -import org.acme.sample.stubs.PolyWrapped; -import org.acme.sample.stubs.SampleFault; -import org.apache.axis.message.addressing.EndpointReferenceType; -import org.gcube.common.core.contexts.GCUBEServiceContext; -import org.gcube.common.core.contexts.GCUBEStatefulPortTypeContext; -import org.gcube.common.core.faults.FaultUtils; -import org.gcube.common.core.faults.GCUBEFault; -import org.gcube.common.core.porttypes.GCUBEPortType; -import org.gcube.common.core.state.GCUBEWSHome; -import org.gcube.common.core.state.GCUBEWSResource; -import org.gcube.common.core.state.GCUBEWSResourceKey; -import org.gcube.common.core.types.VOID; -import org.globus.wsrf.encoding.ObjectSerializer; - -/** - * @author Fabio Simeoni - * - */ -public class Stateless extends GCUBEPortType { - - public String foo(String s) { - - return s; - } - - public FooWrappedResponse fooWrapped(FooWrapped wrapped) { - - return new FooWrappedResponse(wrapped.getParam()); - } - - public FooWrappedResponse fooMixed(String s) { - - return new FooWrappedResponse(s); - } - - public FooBulkResponse fooBulk(FooBulk bulk) { - - System.out.println(Arrays.asList(bulk.getParam())); - - return new FooBulkResponse(Arrays.deepToString(bulk.getParam())); - } - - public Nothing nothing(Nothing n) { - System.err.println("invoked NOTHING "+n); - return new Nothing(); - } - - public String fooFault(String flag) throws SampleFault, GCUBEFault { - - if (flag.equals("contingency")) - throw new SampleFault(); - else if (flag.equals("proper")) - throw FaultUtils.newFault(new GCUBEFault(), new RuntimeException("generic problem")); - else - throw new RuntimeException("generic problem"); - } - - public BarResponse bar(Bar s) { - - return new BarResponse(new String[] { s.getIn1(), s.getIn1() }); - } - - public String baz(VOID v) { - - return "called"; - } - - public EndpointReferenceType create(String input) { - - try { - GCUBEStatefulPortTypeContext ptcxt = StatefulContext.getContext(); - GCUBEWSHome home = ptcxt.getWSHome(); - GCUBEWSResourceKey key = ptcxt.makeKey(input); - GCUBEWSResource ws = home.create(key, input); - ws.store(); - return ws.getEPR(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public String createAsString(String input) { - - try { - GCUBEStatefulPortTypeContext ptcxt = StatefulContext.getContext(); - GCUBEWSHome home = ptcxt.getWSHome(); - GCUBEWSResourceKey key = ptcxt.makeKey(input); - GCUBEWSResource ws = home.create(key, input); - ws.store(); - - StringWriter w = new StringWriter(); - ObjectSerializer.serialize(w,ws.getEPR(), new QName("http://foo","test")); - - return w.toString(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - - public String any(Object o) { - System.err.println(o); - return o.getClass().getName(); - } - - public AnyElementResponse anyElement(AnyElement o) { - System.out.println(Arrays.deepToString(o.get_any())); - return new AnyElementResponse(); - } - - public PolyResponse poly(Base b) { - System.err.println(b.getClass()); - return new PolyResponse(); - } - - public PolyResponse polyWrapped(PolyWrapped w) { - System.err.println(w.getParam().getClass()); - return new PolyResponse(); - } - - public ChoiceResponse choice(Choice c) { - System.err.println("one:"+c.getOne()); - System.err.println("two:"+c.getTwo()); - return new ChoiceResponse(); - } - - /** {@inheritDoc} */ - @Override - public GCUBEServiceContext getServiceContext() { - return ServiceContext.getContext(); - } - - - -} diff --git a/src/test/java/org/acme/service/StatelessContext.java b/src/test/java/org/acme/service/StatelessContext.java deleted file mode 100644 index c51accd..0000000 --- a/src/test/java/org/acme/service/StatelessContext.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.acme.service; - -import static org.acme.service.Utils.*; - -import org.gcube.common.core.contexts.GCUBEPortTypeContext; -import org.gcube.common.core.contexts.GCUBEServiceContext; - -public class StatelessContext extends GCUBEPortTypeContext { - - - /** Single context instance, created eagerly */ - private static StatelessContext cache = new StatelessContext(); - - private StatelessContext(){} - - /** Returns cached instance */ - public static StatelessContext getContext() {return cache;} - - /**{@inheritDoc}*/ - public String getJNDIName() {return STATELESS_NAME;} - - /** {@inheritDoc}*/ - public String getNamespace() {return NS;} - - /** {@inheritDoc}*/ - public GCUBEServiceContext getServiceContext() {return ServiceContext.getContext();} - -} diff --git a/src/test/java/org/acme/service/Utils.java b/src/test/java/org/acme/service/Utils.java deleted file mode 100644 index 2ab5d65..0000000 --- a/src/test/java/org/acme/service/Utils.java +++ /dev/null @@ -1,17 +0,0 @@ -/** - * - */ -package org.acme.service; - -/** - * @author Fabio Simeoni - * - */ -public class Utils { - - public static final String NS="http://acme.org/service"; - public static final String NAME="acme/service"; - - public static final String STATELESS_NAME="acme/service/stateless"; - public static final String STATEFUL_NAME="acme/service/stateful"; -} diff --git a/src/test/resources/META-INF/services/org.gcube.common.clients.stubs.jaxws.handlers.CallHandler b/src/test/resources/META-INF/services/org.gcube.common.clients.stubs.jaxws.handlers.CallHandler deleted file mode 100644 index 0b229d5..0000000 --- a/src/test/resources/META-INF/services/org.gcube.common.clients.stubs.jaxws.handlers.CallHandler +++ /dev/null @@ -1 +0,0 @@ -org.acme.TestHandler \ No newline at end of file diff --git a/src/test/resources/log4j.properties b/src/test/resources/log4j.properties deleted file mode 100644 index 305cc41..0000000 --- a/src/test/resources/log4j.properties +++ /dev/null @@ -1,10 +0,0 @@ -log4j.appender.ROOT=org.apache.log4j.ConsoleAppender -log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout -log4j.appender.ROOT.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %c{2} [%t,%M:%L] %m%n -log4j.rootLogger=DEBUG,ROOT - -log4j.appender.SAMPLE=org.apache.log4j.ConsoleAppender -log4j.appender.SAMPLE.layout=org.apache.log4j.PatternLayout -log4j.appender.SAMPLE.layout.ConversionPattern=[SAMPLE] %d{HH:mm:ss,SSS} %-5p %c{2} [%t,%M:%L] %m%n - -log4j.category.org.acme=TRACE,SAMPLE \ No newline at end of file diff --git a/src/test/resources/test-service/etc/deploy-jndi-config.xml b/src/test/resources/test-service/etc/deploy-jndi-config.xml deleted file mode 100755 index 7668b61..0000000 --- a/src/test/resources/test-service/etc/deploy-jndi-config.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - factory - org.globus.wsrf.jndi.BeanFactory - - - resourceClass - org.acme.service.Resource - - - - - - - diff --git a/src/test/resources/test-service/etc/deploy-server.wsdd b/src/test/resources/test-service/etc/deploy-server.wsdd deleted file mode 100644 index cc104f4..0000000 --- a/src/test/resources/test-service/etc/deploy-server.wsdd +++ /dev/null @@ -1,32 +0,0 @@ - - - - - share/schema/test-service/Stateless_service.wsdl - - - - - - - - - - - - - - - - share/schema/test-service/Stateful_service.wsdl - - - - - - - - diff --git a/src/test/resources/test-service/etc/profile.xml b/src/test/resources/test-service/etc/profile.xml deleted file mode 100644 index 1921231..0000000 --- a/src/test/resources/test-service/etc/profile.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - Service - - samples - test-service - 1.0.0 - -
- test-service - 1.0.0-SNAPSHOT - - org.gcube.samples - test-service - 1.0.0-SNAPSHOT - - test-service-1.0.0-SNAPSHOT.gar - - acme/sample/stateless - -
- - test-service-stubs - 1.0.0-SNAPSHOT - - org.gcube.samples - test-service-stubs - 1.0.0-SNAPSHOT - - library - - test-service-stubs-1.0.0-SNAPSHOT.jar - - -
-
-
- diff --git a/src/test/resources/test-service/wsdl/Stateful.wsdl b/src/test/resources/test-service/wsdl/Stateful.wsdl deleted file mode 100644 index 5376b1d..0000000 --- a/src/test/resources/test-service/wsdl/Stateful.wsdl +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/test-service/wsdl/Stateless.wsdl b/src/test/resources/test-service/wsdl/Stateless.wsdl deleted file mode 100644 index 4fd9668..0000000 --- a/src/test/resources/test-service/wsdl/Stateless.wsdl +++ /dev/null @@ -1,352 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -