From 1dffd32ebad2d6c390be7a74530f9f86880139cc Mon Sep 17 00:00:00 2001 From: antelder Date: Wed, 1 Aug 2012 15:18:03 +0000 Subject: Fix to set the type of the binding so now the test works git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1368050 13f79535-47bb-0310-9956-ffa450edef68 --- .../dynamic/src/test/java/test/WSServiceTestCase.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sca-java-2.x/trunk/testing/itest/dynamic/src/test/java/test/WSServiceTestCase.java b/sca-java-2.x/trunk/testing/itest/dynamic/src/test/java/test/WSServiceTestCase.java index b18be05475..7fa85ee458 100644 --- a/sca-java-2.x/trunk/testing/itest/dynamic/src/test/java/test/WSServiceTestCase.java +++ b/sca-java-2.x/trunk/testing/itest/dynamic/src/test/java/test/WSServiceTestCase.java @@ -46,6 +46,9 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.FactoryExtensionPoint; import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory; +import org.apache.tuscany.sca.policy.ExtensionType; +import org.apache.tuscany.sca.policy.PolicyFactory; +import org.apache.tuscany.sca.policy.PolicySubject; import org.junit.Test; import sample.Helloworld; @@ -98,19 +101,21 @@ public class WSServiceTestCase extends TestCase { javaImplementation.setJavaClass(HelloworldImpl.class); component.setImplementation(javaImplementation); + // create a WS service ComponentService cs = assemblyFactory.createComponentService(); cs.setName("Helloworld"); WebServiceBindingFactory webServiceBindingFactory = modelFactories.getFactory(WebServiceBindingFactory.class); WebServiceBinding wsBinding = webServiceBindingFactory.createWebServiceBinding(); -// PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class); -// Intent intent = policyFactory.createIntent(); -// intent.setName(new QName("http://docs.oasis-open.org/ns/opencsa/sca/200912", "SOAP.v1_1")); -// DefaultIntent di = policyFactory.createDefaultIntent(); -// di.setIntent(intent); -// ((DefaultingPolicySubject)b).getDefaultIntents().add(di); cs.getBindings().add(wsBinding); cs.setInterfaceContract(component.getImplementation().getService("Helloworld").getInterfaceContract()); + // Not totally sure why this is necessary or why the type isn't set in WebServiceBinding by default? + PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class); + ExtensionType type = policyFactory.createExtensionType(); + type.setType(new QName("http://docs.oasis-open.org/ns/opencsa/sca/200912", "binding.ws")); + ((PolicySubject)wsBinding).setExtensionType(type); + + // Add the WS service to the component component.getServices().add(cs); // add the component to the composite -- cgit v1.2.3