You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2016/05/26 21:46:01 UTC

[33/50] [abbrv] cxf git commit: Squash commit of ws-transfer implementation from Erich Duda (dudaerich) This closes #33

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/IntegrationBaseTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/IntegrationBaseTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/IntegrationBaseTest.java
new file mode 100644
index 0000000..2059a7a
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/IntegrationBaseTest.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.cxf.ws.transfer.integration;
+
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.BindingProvider;
+
+import org.w3c.dom.Document;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.ContextUtils;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.apache.cxf.ws.transfer.resource.ResourceLocal;
+import org.apache.cxf.ws.transfer.resource.ResourceRemote;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactoryImpl;
+import org.apache.cxf.ws.transfer.resourcefactory.resolver.SimpleResourceResolver;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+public class IntegrationBaseTest {
+    
+    public static final String RESOURCE_FACTORY_ADDRESS = "local://ResourceFactory";
+    
+    public static final String RESOURCE_ADDRESS = "local://ResourceLocal";
+    
+    public static final String RESOURCE_REMOTE_ADDRESS = "local://ResourceRemote";
+    
+    public static final String RESOURCE_REMOTE_MANAGER_ADDRESS = "local://ResourceRemote"
+            + TransferConstants.RESOURCE_REMOTE_SUFFIX;
+    
+    public static final String RESOURCE_LOCAL_ADDRESS = "local://ResourceLocal";
+    
+    protected static DocumentBuilderFactory documentBuilderFactory;
+    
+    protected static DocumentBuilder documentBuilder;
+    
+    protected static Document document;
+    
+    protected Bus bus;
+    
+    @BeforeClass
+    public static void beforeClass() throws ParserConfigurationException {
+        documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        documentBuilder = documentBuilderFactory.newDocumentBuilder();
+        document = documentBuilder.newDocument();
+    }
+    
+    @AfterClass
+    public static void afterClass() {
+        documentBuilderFactory = null;
+        documentBuilder = null;
+        document = null;
+    }
+    
+    @Before
+    public void before() {
+        bus = BusFactory.getDefaultBus();
+    }
+    
+    @After
+    public void after() {
+        bus.shutdown(true);
+        bus = null;
+    }
+    
+    protected Server createLocalResourceFactory(ResourceManager manager) {
+        ResourceFactoryImpl implementor = new ResourceFactoryImpl();
+        implementor.setResourceResolver(new SimpleResourceResolver(RESOURCE_ADDRESS, manager));
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setBus(bus);
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setAddress(RESOURCE_FACTORY_ADDRESS);
+        factory.setServiceBean(implementor);
+        
+        return factory.create();
+    }
+    
+    protected Server createRemoteResourceFactory() {
+        ResourceFactoryImpl implementor = new ResourceFactoryImpl();
+        implementor.setResourceResolver(new SimpleResourceResolver(RESOURCE_REMOTE_ADDRESS, null));
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setBus(bus);
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setAddress(RESOURCE_FACTORY_ADDRESS);
+        factory.setServiceBean(implementor);
+        return factory.create();
+    }
+    
+    protected Server createRemoteResource(ResourceManager manager) {
+        ResourceRemote implementor = new ResourceRemote();
+        implementor.setManager(manager);
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        
+        Map<String, Object> props = factory.getProperties(true);
+        props.put("jaxb.additionalContextClasses",
+                org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType.class);
+        factory.setProperties(props);
+        
+        factory.setBus(bus);
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setAddress(RESOURCE_REMOTE_MANAGER_ADDRESS);
+        factory.setServiceBean(implementor);
+        return factory.create();
+    }
+    
+    protected Server createLocalResource(ResourceManager manager) {
+        ResourceLocal implementor = new ResourceLocal();
+        implementor.setManager(manager);
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        
+        Map<String, Object> props = factory.getProperties(true);
+        props.put("jaxb.additionalContextClasses",
+                org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType.class);
+        factory.setProperties(props);
+        
+        factory.setBus(bus);
+        factory.setServiceClass(Resource.class);
+        factory.setAddress(RESOURCE_LOCAL_ADDRESS);
+        factory.setServiceBean(implementor);
+        return factory.create();
+    }
+
+    protected Representation getRepresentation(String content) throws XMLStreamException {
+        Document doc = null;
+        doc = StaxUtils.read(new StringReader(content));
+        Representation representation = new Representation();
+        representation.setAny(doc.getDocumentElement());
+        return representation;
+    }
+
+    protected Resource createClient(ReferenceParametersType refParams) {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+
+        Map<String, Object> props = factory.getProperties();
+        if (props == null) {
+            props = new HashMap<String, Object>();
+        }
+        props.put("jaxb.additionalContextClasses",
+                ExpressionType.class);
+        factory.setProperties(props);
+
+        factory.setBus(bus);
+        factory.setServiceClass(Resource.class);
+        factory.setAddress(RESOURCE_ADDRESS);
+        Resource proxy = (Resource) factory.create();
+
+        // Add reference parameters
+        AddressingProperties addrProps = new AddressingProperties();
+        EndpointReferenceType endpoint = new EndpointReferenceType();
+        endpoint.setReferenceParameters(refParams);
+        endpoint.setAddress(ContextUtils.getAttributedURI(RESOURCE_ADDRESS));
+        addrProps.setTo(endpoint);
+        ((BindingProvider) proxy).getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps);
+
+        return proxy;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceFactoryTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceFactoryTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceFactoryTest.java
new file mode 100644
index 0000000..85dabb0
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceFactoryTest.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.cxf.ws.transfer.integration;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ResourceFactoryTest extends IntegrationBaseTest {
+    
+    private static final String RESOURCE_UUID = "123456";
+    
+    private static final String REF_PARAM_NAMESPACE = "org.apache.cxf.transfer/manager";
+    
+    private static final String REF_PARAM_LOCAL_NAME = "UUID";
+    
+    private ReferenceParametersType createReferenceParameters() {
+        ReferenceParametersType refParam = new ReferenceParametersType();
+        Element uuidEl = DOMUtils.createDocument().createElementNS(
+                REF_PARAM_NAMESPACE, REF_PARAM_LOCAL_NAME);
+        uuidEl.setTextContent(RESOURCE_UUID);
+        refParam.getAny().add(uuidEl);
+        return refParam;
+    }
+    
+    private Element createXMLRepresentation() {
+        Element root = document.createElement("root");
+        Element child1 = document.createElement("child1");
+        Element child2 = document.createElement("child2");
+        root.appendChild(child1);
+        root.appendChild(child2);
+        return root;
+    }
+    
+    private ResourceFactory createClient() {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setBus(bus);
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setAddress(RESOURCE_FACTORY_ADDRESS);
+        return (ResourceFactory) factory.create();
+    }
+    
+    @Test
+    public void createLocalResourceTest() {
+        ReferenceParametersType refParams = createReferenceParameters();
+        ResourceManager manager = EasyMock.createMock(ResourceManager.class);
+        EasyMock.expect(manager.create(EasyMock.isA(Representation.class)))
+                .andReturn(refParams);
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(manager);
+        
+        Server localResourceFactory = createLocalResourceFactory(manager);
+        ResourceFactory client = createClient();
+        
+        Create createRequest = new Create();
+        Representation representation = new Representation();
+        representation.setAny(createXMLRepresentation());
+        createRequest.setRepresentation(representation);
+        
+        CreateResponse response = client.create(createRequest);
+        EasyMock.verify(manager);
+        
+        Assert.assertEquals("ResourceAddress is other than expected.", RESOURCE_ADDRESS,
+                response.getResourceCreated().getAddress().getValue());
+        Element refParamEl = (Element) response.getResourceCreated().getReferenceParameters().getAny().get(0);
+        Assert.assertEquals(REF_PARAM_NAMESPACE, refParamEl.getNamespaceURI());
+        Assert.assertEquals(REF_PARAM_LOCAL_NAME, refParamEl.getLocalName());
+        Assert.assertEquals(RESOURCE_UUID, refParamEl.getTextContent());
+        Assert.assertEquals("root", ((Element) response.getRepresentation().getAny()).getLocalName());
+        Assert.assertEquals(2, ((Element) response.getRepresentation().getAny()).getChildNodes().getLength());
+        
+        localResourceFactory.destroy();
+    }
+    
+    @Test
+    public void createRemoteResourceTest() {
+        ReferenceParametersType refParams = createReferenceParameters();
+        ResourceManager manager = EasyMock.createMock(ResourceManager.class);
+        EasyMock.expect(manager.create(EasyMock.isA(Representation.class)))
+                .andReturn(refParams);
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(manager);
+        
+        Server remoteResourceFactory = createRemoteResourceFactory();
+        Server remoteResource = createRemoteResource(manager);
+        ResourceFactory client = createClient();
+        
+        Create createRequest = new Create();
+        Representation representation = new Representation();
+        representation.setAny(createXMLRepresentation());
+        createRequest.setRepresentation(representation);
+        
+        CreateResponse response = client.create(createRequest);
+        EasyMock.verify(manager);
+        
+        Assert.assertEquals("ResourceAddress is other than expected.", RESOURCE_REMOTE_ADDRESS,
+                response.getResourceCreated().getAddress().getValue());
+        Element refParamEl = (Element) response.getResourceCreated().getReferenceParameters().getAny().get(0);
+        Assert.assertEquals(REF_PARAM_NAMESPACE, refParamEl.getNamespaceURI());
+        Assert.assertEquals(REF_PARAM_LOCAL_NAME, refParamEl.getLocalName());
+        Assert.assertEquals(RESOURCE_UUID, refParamEl.getTextContent());
+        Assert.assertEquals("root", ((Element) response.getRepresentation().getAny()).getLocalName());
+        Assert.assertEquals(2, ((Element) response.getRepresentation().getAny()).getChildNodes().getLength());
+        
+        remoteResourceFactory.destroy();
+        remoteResource.destroy();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceTest.java
new file mode 100644
index 0000000..e2d4a3c
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/integration/ResourceTest.java
@@ -0,0 +1,168 @@
+/**
+ * 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.cxf.ws.transfer.integration;
+
+import javax.xml.ws.BindingProvider;
+import org.w3c.dom.Element;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.ContextUtils;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Delete;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.GetResponse;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.PutResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ResourceTest extends IntegrationBaseTest {
+    
+    private static final String UUID_VALUE = "123456";
+    
+    private static final String REPRESENTATION_NAME = "name1";
+    
+    private static final String REPRESENTATION_NAMESPACE = "test";
+    
+    private static final String REPRESENTATION_VALUE = "value1";
+    
+    protected Resource createClient(ReferenceParametersType refParams) {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setBus(bus);
+        factory.setServiceClass(Resource.class);
+        factory.setAddress(RESOURCE_LOCAL_ADDRESS);
+        Resource proxy = (Resource) factory.create();
+
+        // Add reference parameters
+        AddressingProperties addrProps = new AddressingProperties();
+        EndpointReferenceType endpoint = new EndpointReferenceType();
+        endpoint.setReferenceParameters(refParams);
+        endpoint.setAddress(ContextUtils.getAttributedURI(RESOURCE_ADDRESS));
+        addrProps.setTo(endpoint);
+        ((BindingProvider) proxy).getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps);
+
+        return proxy;
+    }
+    
+    @Test
+    public void getRequestTest() {
+        Element representationEl = document.createElementNS(REPRESENTATION_NAMESPACE, REPRESENTATION_NAME);
+        representationEl.setTextContent(REPRESENTATION_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+        
+        ResourceManager manager = EasyMock.createMock(ResourceManager.class);
+        EasyMock.expect(manager.get(EasyMock.isA(ReferenceParametersType.class))).andReturn(representation);
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(manager);
+
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = document.createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent(UUID_VALUE);
+        refParams.getAny().add(uuid);
+        
+        Server server = createLocalResource(manager);
+        Resource client = createClient(refParams);
+        
+        GetResponse response = client.get(new Get());
+        EasyMock.verify(manager);
+        
+        representationEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("Namespace is other than expected.",
+                REPRESENTATION_NAMESPACE, representationEl.getNamespaceURI());
+        Assert.assertEquals("Element name is other than expected",
+                REPRESENTATION_NAME, representationEl.getLocalName());
+        Assert.assertEquals("Value is other than expected.",
+                REPRESENTATION_VALUE, representationEl.getTextContent());
+        
+        server.destroy();
+    }
+    
+    @Test
+    public void putRequestTest() {
+        ResourceManager manager = EasyMock.createMock(ResourceManager.class);
+        EasyMock.expect(manager.get(EasyMock.isA(ReferenceParametersType.class))).andReturn(new Representation());
+        EasyMock.expectLastCall().once();
+        manager.put(EasyMock.isA(ReferenceParametersType.class), EasyMock.isA(Representation.class));
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(manager);
+
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = document.createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent(UUID_VALUE);
+        refParams.getAny().add(uuid);
+        
+        Element representationEl = document.createElementNS(REPRESENTATION_NAMESPACE, REPRESENTATION_NAME);
+        representationEl.setTextContent(REPRESENTATION_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+        
+        Server server = createLocalResource(manager);
+        Resource client = createClient(refParams);
+        
+        Put putRequest = new Put();
+        putRequest.setRepresentation(representation);
+        
+        PutResponse response = client.put(putRequest);
+        EasyMock.verify(manager);
+        
+        representationEl = (Element) response.getRepresentation().getAny();
+        Assert.assertEquals("Namespace is other than expected.",
+                REPRESENTATION_NAMESPACE, representationEl.getNamespaceURI());
+        Assert.assertEquals("Element name is other than expected",
+                REPRESENTATION_NAME, representationEl.getLocalName());
+        Assert.assertEquals("Value is other than expected.",
+                REPRESENTATION_VALUE, representationEl.getTextContent());
+        
+        server.destroy();
+    }
+    
+    @Test
+    public void deleteRequestTest() {
+        ResourceManager manager = EasyMock.createMock(ResourceManager.class);
+        manager.delete(EasyMock.isA(ReferenceParametersType.class));
+        EasyMock.expectLastCall().once();
+        EasyMock.replay(manager);
+
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = document.createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent(UUID_VALUE);
+        refParams.getAny().add(uuid);
+        
+        Server server = createLocalResource(manager);
+        Resource client = createClient(refParams);
+        
+        client.delete(new Delete());
+        EasyMock.verify(manager);
+        
+        server.destroy();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/MemoryResourceManagerTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/MemoryResourceManagerTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/MemoryResourceManagerTest.java
new file mode 100644
index 0000000..f473339
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/MemoryResourceManagerTest.java
@@ -0,0 +1,204 @@
+/**
+ * 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.cxf.ws.transfer.unit;
+
+import javax.xml.parsers.ParserConfigurationException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.shared.faults.UnknownResource;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class MemoryResourceManagerTest {
+    
+    public static final String ELEMENT_NAMESPACE = "test";
+    
+    public static final String ELEMENT_NAME = "name1";
+    
+    public static final String ELEMENT_VALUE = "value1";
+    
+    public static final String ELEMENT_VALUE_NEW = "value2";
+    
+    private static Document document;
+    
+    private ResourceManager resourceManager;
+    
+    @BeforeClass
+    public static void beforeClass() throws ParserConfigurationException {
+        document = DOMUtils.createDocument();
+    }
+    
+    @AfterClass
+    public static void afterClass() {
+        document = null;
+    }
+    
+    @Before
+    public void before() {
+        resourceManager = new MemoryResourceManager();
+    }
+    
+    @After
+    public void after() {
+        resourceManager = null;
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void getEmptyReferenceParamsTest() {
+        resourceManager.get(new ReferenceParametersType());
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void getUnknownReferenceParamsTest() {
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = DOMUtils.createDocument().createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent("123456");
+        refParams.getAny().add(uuid);
+        resourceManager.get(refParams);
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void putEmptyReferenceParamsTest() {
+        resourceManager.put(new ReferenceParametersType(), new Representation());
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void putUnknownReferenceParamsTest() {
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = DOMUtils.createDocument().createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent("123456");
+        refParams.getAny().add(uuid);
+        resourceManager.put(refParams, new Representation());
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void deleteEmptyReferenceParamsTest() {
+        resourceManager.delete(new ReferenceParametersType());
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void deleteUnknownReferenceParamsTest() {
+        ReferenceParametersType refParams = new ReferenceParametersType();
+        Element uuid = DOMUtils.createDocument().createElementNS(
+                MemoryResourceManager.REF_NAMESPACE, MemoryResourceManager.REF_LOCAL_NAME);
+        uuid.setTextContent("123456");
+        refParams.getAny().add(uuid);
+        resourceManager.delete(refParams);
+    }
+    
+    @Test
+    public void createTest() {
+        Element representationEl = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
+        representationEl.setTextContent(ELEMENT_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+
+        ReferenceParametersType refParams = resourceManager.create(representation);
+        Assert.assertTrue("ResourceManager returned unexpected count of reference elements.",
+                refParams.getAny().size() == 1);
+    }
+    
+    @Test
+    public void getTest() {
+        Element representationEl = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
+        representationEl.setTextContent(ELEMENT_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+
+        ReferenceParametersType refParams = resourceManager.create(representation);
+        Representation returnedRepresentation = resourceManager.get(refParams);
+        
+        Element returnedEl = (Element) returnedRepresentation.getAny();
+        Assert.assertEquals("Namespace is other than expected.",
+                ELEMENT_NAMESPACE, returnedEl.getNamespaceURI());
+        Assert.assertEquals("Element name is other than expected",
+                ELEMENT_NAME, returnedEl.getLocalName());
+        Assert.assertEquals("Value is other than expected.",
+                ELEMENT_VALUE, returnedEl.getTextContent());
+    }
+    
+    @Test
+    public void putTest() {
+        Element representationEl = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
+        representationEl.setTextContent(ELEMENT_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+        
+        Element representationElNew = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
+        representationElNew.setTextContent(ELEMENT_VALUE_NEW);
+        Representation representationNew = new Representation();
+        representationNew.setAny(representationElNew);
+
+        ReferenceParametersType refParams = resourceManager.create(representation);
+        resourceManager.put(refParams, representationNew);
+        Representation returnedRepresentation = resourceManager.get(refParams);
+        
+        Element returnedEl = (Element) returnedRepresentation.getAny();
+        Assert.assertEquals("Namespace is other than expected.",
+                ELEMENT_NAMESPACE, returnedEl.getNamespaceURI());
+        Assert.assertEquals("Element name is other than expected",
+                ELEMENT_NAME, returnedEl.getLocalName());
+        Assert.assertEquals("Value is other than expected.",
+                ELEMENT_VALUE_NEW, returnedEl.getTextContent());
+    }
+    
+    @Test(expected = UnknownResource.class)
+    public void deleteTest() {
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        resourceManager.delete(refParams);
+        resourceManager.get(refParams);
+    }
+    
+    @Test
+    public void createEmptyRepresentationTest() {
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        Assert.assertTrue("ResourceManager returned unexpected count of reference elements.",
+                refParams.getAny().size() == 1);
+    }
+    
+    @Test
+    public void putEmptyRepresentationTest() {
+        Element representationEl = document.createElementNS(ELEMENT_NAMESPACE, ELEMENT_NAME);
+        representationEl.setTextContent(ELEMENT_VALUE);
+        Representation representation = new Representation();
+        representation.setAny(representationEl);
+
+        ReferenceParametersType refParams = resourceManager.create(representation);
+        resourceManager.put(refParams, new Representation());
+    }
+    
+    @Test
+    public void getEmptyRepresentationTest() {
+        ReferenceParametersType refParams = resourceManager.create(new Representation());
+        Representation returnedRepresentation = resourceManager.get(refParams);
+        Assert.assertNull(returnedRepresentation.getAny());
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSDResourceValidatorTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSDResourceValidatorTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSDResourceValidatorTest.java
new file mode 100644
index 0000000..45af31f
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSDResourceValidatorTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.cxf.ws.transfer.unit;
+
+import java.io.InputStream;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.transform.stream.StreamSource;
+import org.w3c.dom.Document;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.validationtransformation.XSDResourceValidator;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class XSDResourceValidatorTest {
+    
+
+    private Representation loadRepresentation(InputStream input) throws XMLStreamException {
+        Document doc = StaxUtils.read(input);
+        Representation representation = new Representation();
+        representation.setAny(doc.getDocumentElement());
+        return representation;
+    }
+    
+    @Test
+    public void validRepresentationTest() throws XMLStreamException {
+        XSDResourceValidator validator = new XSDResourceValidator(
+                new StreamSource(getClass().getResourceAsStream("/xml/xsdresourcevalidator/schema.xsd")));
+        boolean result = validator.validate(loadRepresentation(
+                getClass().getResourceAsStream("/xml/xsdresourcevalidator/validRepresentation.xml")), null);
+        Assert.assertTrue(result);
+    }
+    
+    @Test
+    public void invalidRepresentationTest() throws XMLStreamException {
+        XSDResourceValidator validator = new XSDResourceValidator(
+                new StreamSource(getClass().getResourceAsStream("/xml/xsdresourcevalidator/schema.xsd")));
+        boolean result = validator.validate(loadRepresentation(
+                getClass().getResourceAsStream("/xml/xsdresourcevalidator/invalidRepresentation.xml")), null);
+        Assert.assertFalse(result);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSLTResourceTransformerTest.java
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSLTResourceTransformerTest.java b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSLTResourceTransformerTest.java
new file mode 100644
index 0000000..f70b9c2
--- /dev/null
+++ b/rt/ws/transfer/src/test/java/org/apache/cxf/ws/transfer/unit/XSLTResourceTransformerTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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.cxf.ws.transfer.unit;
+
+import java.io.InputStream;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.transform.stream.StreamSource;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.validationtransformation.ResourceTransformer;
+import org.apache.cxf.ws.transfer.validationtransformation.XSLTResourceTransformer;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class XSLTResourceTransformerTest {
+    
+    private Representation loadRepresentation(InputStream input) throws XMLStreamException {
+        Document doc = StaxUtils.read(input);
+        Representation representation = new Representation();
+        representation.setAny(doc.getDocumentElement());
+        return representation;
+    }
+    
+    @Test
+    public void transformTest() throws XMLStreamException {
+        ResourceTransformer transformer = new XSLTResourceTransformer(new StreamSource(
+                getClass().getResourceAsStream("/xml/xsltresourcetransformer/stylesheet.xsl")));
+        Representation representation = loadRepresentation(
+                getClass().getResourceAsStream("/xml/xsltresourcetransformer/representation.xml"));
+        
+        transformer.transform(representation, null);
+
+        Element representationEl = (Element) representation.getAny();
+        Assert.assertEquals("Expected root element with name \"person\".", "person",
+                representationEl.getLocalName());
+        Assert.assertTrue("Expected one element \"firstname\".",
+                representationEl.getElementsByTagName("firstname").getLength() == 1);
+        Assert.assertTrue("Expected one element \"lastname\".",
+                representationEl.getElementsByTagName("lastname").getLength() == 1);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/invalidRepresentation.xml
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/invalidRepresentation.xml b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/invalidRepresentation.xml
new file mode 100644
index 0000000..52be6ce
--- /dev/null
+++ b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/invalidRepresentation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+
+<person>
+    <name>Name</name>
+    <surname>Surname</surname>
+</person>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/schema.xsd
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/schema.xsd b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/schema.xsd
new file mode 100644
index 0000000..6a0e7f5
--- /dev/null
+++ b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/schema.xsd
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<xs:schema version="1.0"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+
+    <xs:element name="person">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="name" type="xs:string"/>
+                <xs:element name="surname" type="xs:string"/>
+                <xs:element name="address" type="xs:string"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/validRepresentation.xml
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/validRepresentation.xml b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/validRepresentation.xml
new file mode 100644
index 0000000..7d81e0f
--- /dev/null
+++ b/rt/ws/transfer/src/test/resources/xml/xsdresourcevalidator/validRepresentation.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+
+<person>
+    <name>Name</name>
+    <surname>Surname</surname>
+    <address>Address</address>
+</person>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/representation.xml
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/representation.xml b/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/representation.xml
new file mode 100644
index 0000000..a472f3c
--- /dev/null
+++ b/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/representation.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+
+<person>
+    <name>Name</name>
+    <surname>Surname</surname>
+</person>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/stylesheet.xsl
----------------------------------------------------------------------
diff --git a/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/stylesheet.xsl b/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/stylesheet.xsl
new file mode 100644
index 0000000..5519af8
--- /dev/null
+++ b/rt/ws/transfer/src/test/resources/xml/xsltresourcetransformer/stylesheet.xsl
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  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.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+    <xsl:output method="xml"/>
+
+    <xsl:template match="/">
+        <xsl:element name="person">
+            <xsl:apply-templates/>
+        </xsl:element>
+    </xsl:template>
+   
+    <xsl:template match="/person/name">
+        <xsl:element name="firstname">
+            <xsl:value-of select="."/>
+        </xsl:element>
+    </xsl:template>
+    
+    <xsl:template match="/person/surname">
+        <xsl:element name="lastname">
+            <xsl:value-of select="."/>
+        </xsl:element>
+    </xsl:template>
+
+</xsl:stylesheet>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/pom.xml
----------------------------------------------------------------------
diff --git a/systests/pom.xml b/systests/pom.xml
index b935926..3a5ba50 100644
--- a/systests/pom.xml
+++ b/systests/pom.xml
@@ -50,6 +50,7 @@
         <module>cdi</module>
         <module>rs-http-sci</module>
         <module>tracing</module>
-	<module>jibx</module>
+        <module>jibx</module>
+        <module>ws-transfer</module>
     </modules>
 </project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/pom.xml
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/pom.xml b/systests/ws-transfer/pom.xml
new file mode 100644
index 0000000..f032f51
--- /dev/null
+++ b/systests/ws-transfer/pom.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    
+    <artifactId>cxf-systests-ws-transfer</artifactId>
+    <name>Apache CXF WS-Transfer System Tests</name>
+    <description>Apache CXF WS-Transfer System Tests</description>
+    <url>http://cxf.apache.org</url>
+    
+    <parent>
+        <artifactId>cxf-parent</artifactId>
+        <groupId>org.apache.cxf</groupId>
+        <version>3.2.0-SNAPSHOT</version>
+        <relativePath>../../parent/pom.xml</relativePath>
+    </parent>
+    
+    <dependencies>
+        <dependency>
+          <groupId>junit</groupId>
+          <artifactId>junit</artifactId>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>${project.groupId}</groupId>
+          <artifactId>cxf-rt-frontend-jaxws</artifactId>
+          <version>${project.version}</version>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>${project.groupId}</groupId>
+          <artifactId>cxf-rt-ws-transfer</artifactId>
+          <version>${project.version}</version>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+          <groupId>${project.groupId}</groupId>
+          <artifactId>cxf-rt-transports-http-jetty</artifactId>
+          <version>${project.version}</version>
+          <scope>test</scope>
+        </dependency>
+    </dependencies>
+    
+</project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateStudentTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateStudentTest.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateStudentTest.java
new file mode 100644
index 0000000..2f9feaa
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateStudentTest.java
@@ -0,0 +1,103 @@
+/**
+ * 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.cxf.systest.ws.transfer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+import org.w3c.dom.Document;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CreateStudentTest {
+    
+    
+    @BeforeClass
+    public static void beforeClass() {
+        TestUtils.createStudentsServers();
+        TestUtils.createTeachersServers();
+    }
+    
+    @AfterClass
+    public static void afterClass() {
+        TestUtils.destroyStudentsServers();
+        TestUtils.destroyTeachersServers();
+    }
+    
+    @Test
+    public void createStudentTest() throws XMLStreamException {
+        Document createStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createStudent.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createStudentXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        CreateResponse response = rf.create(request);
+        
+        Assert.assertEquals(TestUtils.RESOURCE_STUDENTS_URL,
+            response.getResourceCreated().getAddress().getValue());
+    }
+
+    @Test
+    public void createStudentPartialTest() throws XMLStreamException {
+        Document createStudentPartialXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createStudentPartial.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createStudentPartialXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        CreateResponse response = rf.create(request);
+        
+        Assert.assertEquals(TestUtils.RESOURCE_STUDENTS_URL,
+            response.getResourceCreated().getAddress().getValue());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void createStudentWrongTest() throws XMLStreamException {
+        Document createStudentWrongXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createStudentWrong.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createStudentWrongXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        rf.create(request);
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void createRandomTest() throws XMLStreamException {
+        Document randomXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/random.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(randomXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        rf.create(request);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateTeacherTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateTeacherTest.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateTeacherTest.java
new file mode 100644
index 0000000..9a67b9a
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/CreateTeacherTest.java
@@ -0,0 +1,91 @@
+/**
+ * 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.cxf.systest.ws.transfer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+import org.w3c.dom.Document;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class CreateTeacherTest {
+    
+    @BeforeClass
+    public static void beforeClass() {
+        TestUtils.createStudentsServers();
+        TestUtils.createTeachersServers();
+    }
+    
+    @AfterClass
+    public static void afterClass() {
+        TestUtils.destroyStudentsServers();
+        TestUtils.destroyTeachersServers();
+    }
+    
+    @Test
+    public void createTeacherTest() throws XMLStreamException {
+        Document createTeacherXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createTeacher.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createTeacherXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        CreateResponse response = rf.create(request);
+        
+        Assert.assertEquals(TestUtils.RESOURCE_TEACHERS_URL,
+            response.getResourceCreated().getAddress().getValue());
+    }
+
+    @Test
+    public void createTeacherPartialTest() throws XMLStreamException {
+        Document createTeacherPartialXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createTeacherPartial.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createTeacherPartialXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        CreateResponse response = rf.create(request);
+        
+        Assert.assertEquals(TestUtils.RESOURCE_TEACHERS_URL,
+            response.getResourceCreated().getAddress().getValue());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void createTeacherWrongTest() throws XMLStreamException {
+        Document createTeacherWrongXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createTeacherWrong.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createTeacherWrongXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        rf.create(request);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/DeleteTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/DeleteTest.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/DeleteTest.java
new file mode 100644
index 0000000..b25a944
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/DeleteTest.java
@@ -0,0 +1,118 @@
+/**
+ * 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.cxf.systest.ws.transfer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+import org.w3c.dom.Document;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Delete;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class DeleteTest {
+    
+    @Before
+    public void before() {
+        TestUtils.createStudentsServers();
+        TestUtils.createTeachersServers();
+    }
+    
+    @After
+    public void after() {
+        TestUtils.destroyStudentsServers();
+        TestUtils.destroyTeachersServers();
+    }
+    
+    @Test
+    public void deleteStudent() throws XMLStreamException {
+        CreateResponse response = createStudent();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void getDeletedStudent() throws XMLStreamException {
+        CreateResponse response = createStudent();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+        client.get(new Get());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void deleteDeletedStudent() throws XMLStreamException {
+        CreateResponse response = createStudent();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+        client.delete(new Delete());
+    }
+    
+    @Test
+    public void deleteTeacher() throws XMLStreamException {
+        CreateResponse response = createTeacher();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void getDeletedTeacher() throws XMLStreamException {
+        CreateResponse response = createTeacher();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+        client.get(new Get());
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void deleteDeletedTeacher() throws XMLStreamException {
+        CreateResponse response = createTeacher();
+        Resource client = TestUtils.createResourceClient(response.getResourceCreated());
+        client.delete(new Delete());
+        client.delete(new Delete());
+    }
+    
+    private CreateResponse createStudent() throws XMLStreamException {
+        Document createStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createStudent.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createStudentXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        return rf.create(request);
+    }
+    
+    private CreateResponse createTeacher() throws XMLStreamException {
+        Document createTeacherXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createTeacher.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createTeacherXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        return rf.create(request);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/GetTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/GetTest.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/GetTest.java
new file mode 100644
index 0000000..65fdce7
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/GetTest.java
@@ -0,0 +1,111 @@
+/**
+ * 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.cxf.systest.ws.transfer;
+
+import javax.xml.stream.XMLStreamException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.Get;
+import org.apache.cxf.ws.transfer.GetResponse;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class GetTest {
+    
+    private static EndpointReferenceType studentRef;
+    
+    private static EndpointReferenceType teacherRef;
+    
+    @BeforeClass
+    public static void beforeClass() throws XMLStreamException {
+        TestUtils.createStudentsServers();
+        TestUtils.createTeachersServers();
+
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        
+        Document createStudentXML = StaxUtils.read(
+                GetTest.class.getResourceAsStream("/xml/createStudent.xml"));
+        Create studentRequest = new Create();
+        studentRequest.setRepresentation(new Representation());
+        studentRequest.getRepresentation().setAny(createStudentXML.getDocumentElement());
+        studentRef = rf.create(studentRequest).getResourceCreated();
+        
+        Document createTeacherXML = StaxUtils.read(
+                GetTest.class.getResourceAsStream("/xml/createTeacher.xml"));
+        Create teacherRequest = new Create();
+        teacherRequest.setRepresentation(new Representation());
+        teacherRequest.getRepresentation().setAny(createTeacherXML.getDocumentElement());
+        teacherRef = rf.create(teacherRequest).getResourceCreated();
+    }
+    
+    @AfterClass
+    public static void afterClass() {
+        TestUtils.destroyStudentsServers();
+        TestUtils.destroyTeachersServers();
+    }
+    
+    @Test
+    public void getStudentTest() {
+        Resource client = TestUtils.createResourceClient(studentRef);
+        GetResponse response = client.get(new Get());
+        
+        Element representation = (Element) response.getRepresentation().getAny();
+        NodeList children = representation.getChildNodes();
+        for (int i = 0; i < children.getLength(); i++) {
+            Element child = (Element) children.item(i);
+            if ("name".equals(child.getLocalName())) {
+                Assert.assertEquals("John", child.getTextContent());
+            } else if ("surname".equals(child.getLocalName())) {
+                Assert.assertEquals("Smith", child.getTextContent());
+            } else if ("address".equals(child.getLocalName())) {
+                Assert.assertEquals("Street 21", child.getTextContent());
+            }
+        }
+    }
+    
+    @Test
+    public void getTeacherTest() {
+        Resource client = TestUtils.createResourceClient(teacherRef);
+        GetResponse response = client.get(new Get());
+        
+        Element representation = (Element) response.getRepresentation().getAny();
+        NodeList children = representation.getChildNodes();
+        for (int i = 0; i < children.getLength(); i++) {
+            Element child = (Element) children.item(i);
+            if ("name".equals(child.getLocalName())) {
+                Assert.assertEquals("Bob", child.getTextContent());
+            } else if ("surname".equals(child.getLocalName())) {
+                Assert.assertEquals("Stuart", child.getTextContent());
+            } else if ("address".equals(child.getLocalName())) {
+                Assert.assertEquals("Street 526", child.getTextContent());
+            }
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/PutTest.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/PutTest.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/PutTest.java
new file mode 100644
index 0000000..ec906b6
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/PutTest.java
@@ -0,0 +1,129 @@
+/**
+ * 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.cxf.systest.ws.transfer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.ws.soap.SOAPFaultException;
+import org.w3c.dom.Document;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.CreateResponse;
+import org.apache.cxf.ws.transfer.Put;
+import org.apache.cxf.ws.transfer.Representation;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PutTest {
+    
+    @Before
+    public void before() {
+        TestUtils.createStudentsServers();
+        TestUtils.createTeachersServers();
+    }
+    
+    @After
+    public void after() {
+        TestUtils.destroyStudentsServers();
+        TestUtils.destroyTeachersServers();
+    }
+    
+    @Test
+    public void rightStudentPutTest() throws XMLStreamException {
+        CreateResponse createResponse = createStudent();
+        
+        Document putStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/putStudent.xml"));
+        Put request = new Put();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(putStudentXML.getDocumentElement());
+        
+        Resource client = TestUtils.createResourceClient(createResponse.getResourceCreated());
+        client.put(request);
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void wrongStudentPutTest() throws XMLStreamException {
+        createStudent();
+        CreateResponse createResponse = createStudent();
+        
+        Document putStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/putStudent.xml"));
+        Put request = new Put();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(putStudentXML.getDocumentElement());
+        
+        Resource client = TestUtils.createResourceClient(createResponse.getResourceCreated());
+        client.put(request);
+    }
+    
+    @Test
+    public void rightTeacherPutTest() throws XMLStreamException {
+        CreateResponse createResponse = createTeacher();
+        
+        Document putStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/putTeacher.xml"));
+        Put request = new Put();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(putStudentXML.getDocumentElement());
+        
+        Resource client = TestUtils.createResourceClient(createResponse.getResourceCreated());
+        client.put(request);
+    }
+    
+    @Test(expected = SOAPFaultException.class)
+    public void wrongTeacherPutTest() throws XMLStreamException {
+        createStudent();
+        CreateResponse createResponse = createTeacher();
+        
+        Document putStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/putTeacher.xml"));
+        Put request = new Put();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(putStudentXML.getDocumentElement());
+        
+        Resource client = TestUtils.createResourceClient(createResponse.getResourceCreated());
+        client.put(request);
+    }
+    
+    private CreateResponse createStudent() throws XMLStreamException {
+        Document createStudentXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createStudent.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createStudentXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        return rf.create(request);
+    }
+    
+    private CreateResponse createTeacher() throws XMLStreamException {
+        Document createTeacherXML = StaxUtils.read(
+                getClass().getResourceAsStream("/xml/createTeacher.xml"));
+        Create request = new Create();
+        request.setRepresentation(new Representation());
+        request.getRepresentation().setAny(createTeacherXML.getDocumentElement());
+        
+        ResourceFactory rf = TestUtils.createResourceFactoryClient();
+        return rf.create(request);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/TestUtils.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/TestUtils.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/TestUtils.java
new file mode 100644
index 0000000..90645d3
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/TestUtils.java
@@ -0,0 +1,174 @@
+/**
+ * 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.cxf.systest.ws.transfer;
+
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.BindingProvider;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.systest.ws.transfer.resolver.MyResourceResolver;
+import org.apache.cxf.systest.ws.transfer.validator.StudentPutResourceValidator;
+import org.apache.cxf.systest.ws.transfer.validator.TeacherResourceValidator;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.apache.cxf.ws.transfer.manager.MemoryResourceManager;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resource.Resource;
+import org.apache.cxf.ws.transfer.resource.ResourceLocal;
+import org.apache.cxf.ws.transfer.resource.ResourceRemote;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory;
+import org.apache.cxf.ws.transfer.resourcefactory.ResourceFactoryImpl;
+import org.apache.cxf.ws.transfer.shared.TransferConstants;
+import org.apache.cxf.ws.transfer.validationtransformation.XSDResourceTypeIdentifier;
+import org.apache.cxf.ws.transfer.validationtransformation.XSLTResourceTransformer;
+
+/**
+ * Parent test for all tests in WS-Transfer System Tests.
+ */
+public final class TestUtils {
+    
+    public static final String RESOURCE_STUDENTS_URL = "http://localhost:8080/ResourceStudents";
+    
+    public static final String RESOURCE_FACTORY_URL = "http://localhost:8080/ResourceFactory";
+    
+    public static final String RESOURCE_TEACHERS_URL = "http://localhost:8081/ResourceTeachers";
+    
+    private static Server resourceFactoryServer;
+    
+    private static Server studentsResourceServer;
+    
+    private static Server teachersResourceFactoryServer;
+    
+    private static Server teachersResourceServer;
+    
+    private TestUtils() {
+        
+    }
+    
+    protected static ResourceFactory createResourceFactoryClient() {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setServiceClass(org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory.class);
+        factory.setAddress(RESOURCE_FACTORY_URL);
+        return (ResourceFactory) factory.create();
+    }
+    
+    protected static Resource createResourceClient(EndpointReferenceType ref) {
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setServiceClass(Resource.class);
+        factory.setAddress(ref.getAddress().getValue());
+        Resource proxy = (Resource) factory.create();
+
+        // Add reference parameters
+        AddressingProperties addrProps = new AddressingProperties();
+        addrProps.setTo(ref);
+        ((BindingProvider) proxy).getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps);
+
+        return proxy;
+    }
+    
+    protected static void createStudentsServers() {
+        UIDManager.reset();
+        ResourceManager studentsResourceManager = new MemoryResourceManager();
+        resourceFactoryServer = createResourceFactory(studentsResourceManager);
+        studentsResourceServer = createStudentsResource(studentsResourceManager);
+    }
+    
+    protected static void createTeachersServers() {
+        ResourceManager teachersResourceManager = new MemoryResourceManager();
+        ResourceRemote resource = new ResourceRemote();
+        resource.setManager(teachersResourceManager);
+        resource.getResourceTypeIdentifiers().add(new XSDResourceTypeIdentifier(
+                new StreamSource(TestUtils.class.getResourceAsStream("/schema/teacher.xsd")),
+                new XSLTResourceTransformer(
+                        new StreamSource(TestUtils.class.getResourceAsStream("/xslt/teacherDefaultValues.xsl")),
+                        new TeacherResourceValidator())));
+        teachersResourceFactoryServer = createTeachersResourceFactoryEndpoint(resource);
+        teachersResourceServer = createTeacherResourceEndpoint(resource);
+    }
+    
+    protected static void destroyStudentsServers() {
+        resourceFactoryServer.destroy();
+        studentsResourceServer.destroy();
+    }
+    
+    protected static void destroyTeachersServers() {
+        teachersResourceFactoryServer.destroy();
+        teachersResourceServer.destroy();
+    }
+    
+    private static Server createResourceFactory(ResourceManager resourceManager) {
+        ResourceFactoryImpl resourceFactory = new ResourceFactoryImpl();
+        resourceFactory.setResourceResolver(
+                new MyResourceResolver(RESOURCE_STUDENTS_URL, resourceManager, RESOURCE_TEACHERS_URL));
+        resourceFactory.getResourceTypeIdentifiers().add(
+                new XSDResourceTypeIdentifier(
+                        new StreamSource(TestUtils.class.getResourceAsStream("/schema/studentCreate.xsd")),
+                        new XSLTResourceTransformer(
+                                new StreamSource(TestUtils.class.getResourceAsStream("/xslt/studentCreate.xsl")))));
+        resourceFactory.getResourceTypeIdentifiers().add(
+                new XSDResourceTypeIdentifier(
+                        new StreamSource(TestUtils.class.getResourceAsStream("/schema/teacherCreateBasic.xsd")),
+                        new XSLTResourceTransformer(
+                                new StreamSource(
+                                        TestUtils.class.getResourceAsStream("/xslt/teacherCreateBasic.xsl")))));
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setServiceClass(org.apache.cxf.ws.transfer.resourcefactory.ResourceFactory.class);
+        factory.setServiceBean(resourceFactory);
+        factory.setAddress(RESOURCE_FACTORY_URL);
+        
+        return factory.create();
+    }
+    
+    private static Server createStudentsResource(ResourceManager resourceManager) {
+        ResourceLocal resourceLocal = new ResourceLocal();
+        resourceLocal.setManager(resourceManager);
+        resourceLocal.getResourceTypeIdentifiers().add(
+                new XSDResourceTypeIdentifier(
+                        new StreamSource(TestUtils.class.getResourceAsStream("/schema/studentPut.xsd")),
+                        new XSLTResourceTransformer(
+                                new StreamSource(TestUtils.class.getResourceAsStream("/xslt/studentPut.xsl")),
+                                new StudentPutResourceValidator())));
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setServiceClass(Resource.class);
+        factory.setServiceBean(resourceLocal);
+        factory.setAddress(RESOURCE_STUDENTS_URL);
+        return factory.create();
+    }
+    
+    private static Server createTeachersResourceFactoryEndpoint(ResourceRemote resource) {
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setServiceClass(ResourceFactory.class);
+        factory.setServiceBean(resource);
+        factory.setAddress(RESOURCE_TEACHERS_URL + TransferConstants.RESOURCE_REMOTE_SUFFIX);
+        return factory.create();
+    }
+    
+    private static Server createTeacherResourceEndpoint(ResourceRemote resource) {
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+        factory.setServiceClass(Resource.class);
+        factory.setServiceBean(resource);
+        factory.setAddress(RESOURCE_TEACHERS_URL);
+        return factory.create();
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/UIDManager.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/UIDManager.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/UIDManager.java
new file mode 100644
index 0000000..ea06312
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/UIDManager.java
@@ -0,0 +1,40 @@
+/**
+ * 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.cxf.systest.ws.transfer;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+public final class UIDManager {
+    
+    private static final AtomicInteger UID = new AtomicInteger(1);
+    
+    private UIDManager() {
+        
+    }
+    
+    public static int getUID() {
+        return UID.getAndIncrement();
+    }
+    
+    public static void reset() {
+        UID.set(1);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/resolver/MyResourceResolver.java
----------------------------------------------------------------------
diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/resolver/MyResourceResolver.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/resolver/MyResourceResolver.java
new file mode 100644
index 0000000..54f4c16
--- /dev/null
+++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/resolver/MyResourceResolver.java
@@ -0,0 +1,55 @@
+/**
+ * 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.cxf.systest.ws.transfer.resolver;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.ws.transfer.Create;
+import org.apache.cxf.ws.transfer.manager.ResourceManager;
+import org.apache.cxf.ws.transfer.resourcefactory.resolver.ResourceReference;
+import org.apache.cxf.ws.transfer.resourcefactory.resolver.ResourceResolver;
+import org.apache.cxf.ws.transfer.shared.faults.InvalidRepresentation;
+
+public class MyResourceResolver implements ResourceResolver {
+
+    protected String studentURL;
+    
+    protected ResourceManager studentManager;
+    
+    protected String teachersURL;
+    
+    public MyResourceResolver(String studentURL, ResourceManager studentManager, String teachersURL) {
+        this.studentURL = studentURL;
+        this.studentManager = studentManager;
+        this.teachersURL = teachersURL;
+    }
+    
+    @Override
+    public ResourceReference resolve(Create body) {
+        Element representationEl = (Element) body.getRepresentation().getAny();
+        if ("student".equals(representationEl.getLocalName())) {
+            return new ResourceReference(studentURL, studentManager);
+        } else if ("teacher".equals(representationEl.getLocalName())) {
+            return new ResourceReference(teachersURL, null);
+        } else {
+            throw new InvalidRepresentation();
+        }
+    }
+    
+}