diff options
Diffstat (limited to '')
9 files changed, 326 insertions, 17 deletions
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario10/scenario10a.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario10/scenario10a.composite index 0cfff9fdae..b4e9c61ef5 100644 --- a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario10/scenario10a.composite +++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario10/scenario10a.composite @@ -33,7 +33,8 @@ </reference> <reference name="reference2a" promote="ComponentD/reference3a"> <!-- bindings and/or interfaces may or may not be specified explicitly here --> - <binding.ws /> + <interface.wsdl interface="http://scenarios#wsdl.interface(Service3)" /> + <binding.ws /> </reference> <component name="ComponentD"> diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario10/service3.wsdl b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario10/service3.wsdl new file mode 100644 index 0000000000..14edcc00e6 --- /dev/null +++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario10/service3.wsdl @@ -0,0 +1,63 @@ +<?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.
+-->
+<wsdl:definitions name="Service3Service"
+ targetNamespace="http://scenarios"
+ xmlns:tns="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetings">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetings">
+ <wsdl:part name="getGreetings" element="tns:getGreetings" />
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part name="getGreetingsResponse" element="tns:getGreetingsResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="Service3">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetings" />
+ <wsdl:output message="tns:getGreetingsResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario11/scenario11.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario11/scenario11.composite index 44751a7eed..776345062b 100644 --- a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario11/scenario11.composite +++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario11/scenario11.composite @@ -45,6 +45,7 @@ </reference> <reference name="reference2a" target="ComponentF"> <!-- bindings and/or interfaces may or may not be specified explicitly here --> + <interface.wsdl interface="http://scenarios#wsdl.interface(Service3)" /> <binding.ws /> </reference> </component> diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario11/service3.wsdl b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario11/service3.wsdl new file mode 100644 index 0000000000..14edcc00e6 --- /dev/null +++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario11/service3.wsdl @@ -0,0 +1,63 @@ +<?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.
+-->
+<wsdl:definitions name="Service3Service"
+ targetNamespace="http://scenarios"
+ xmlns:tns="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
+ elementFormDefault="unqualified"
+ targetNamespace="http://scenarios"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="getGreetings">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getGreetingsResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name="getGreetings">
+ <wsdl:part name="getGreetings" element="tns:getGreetings" />
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+ <wsdl:part name="getGreetingsResponse" element="tns:getGreetingsResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="Service3">
+ <wsdl:operation name="getGreetings">
+ <wsdl:input message="tns:getGreetings" />
+ <wsdl:output message="tns:getGreetingsResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+</wsdl:definitions>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario13/META-INF/sca-contribution.xml b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario13/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..c906c6c5b0 --- /dev/null +++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario13/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario13"
+ xmlns:ns13="http://scenario13">
+ <deployable composite="ns13:CompositeA" />
+</contribution>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario13/scenario13.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario13/scenario13.composite new file mode 100644 index 0000000000..ed59cd2adf --- /dev/null +++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario13/scenario13.composite @@ -0,0 +1,58 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario13"
+ xmlns:tns="http://scenario13"
+ name="CompositeA">
+
+ <service name="Service1" promote="ComponentB/Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference1" promote="ComponentB/reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference1a" promote="ComponentB/reference2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentB">
+ <implementation.composite name="tns:CompositeC" />
+ <service name="Service2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference2a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ </component>
+
+ <component name="ComponentF">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
+ <service name="Service3">
+ <binding.sca />
+ <binding.ws />
+ </service>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/main/resources/scenario13/scenario13a.composite b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario13/scenario13a.composite new file mode 100644 index 0000000000..41150f78fd --- /dev/null +++ b/branches/sca-java-1.3/itest/builder/src/main/resources/scenario13/scenario13a.composite @@ -0,0 +1,64 @@ +<?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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://scenario13"
+ xmlns:tns="http://scenario13"
+ name="CompositeC">
+
+ <service name="Service2" promote="ComponentD/Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service2a" promote="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <reference name="reference2" promote="ComponentD/reference3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+ <reference name="reference2a" promote="ComponentD/reference3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </reference>
+
+ <component name="ComponentD">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDReferenceMultiplicityImpl"/>
+ <service name="Service3">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ </service>
+ <service name="Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws uri="http://foo.com/bar" />
+ </service>
+ <reference name="reference3" target="ComponentD/Service3a">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws/>
+ </reference>
+ <reference name="reference3a" target="ComponentE">
+ <!-- bindings and/or interfaces may or may not be specified explicitly here -->
+ <binding.ws />
+ </reference>
+ </component>
+
+ <component name="ComponentE">
+ <implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
+ <service name="Service3">
+ <binding.sca />
+ <binding.ws />
+ </service>
+ </component>
+</composite>
diff --git a/branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java b/branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java index 3f36bd9236..e19ed92b42 100644 --- a/branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java +++ b/branches/sca-java-1.3/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java @@ -451,7 +451,7 @@ public class BuilderTestCase extends TestCase { for (ComponentReference reference : componentD.getReferences()) {
if ("reference3".equals(reference.getName())) {
wsBinding = reference.getBinding(WebServiceBinding.class);
- assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
+ assert reference.getInterfaceContract(wsBinding) instanceof WSDLInterfaceContract;
}
}
assert "http://foo.com/bar".equals(wsBinding.getURI());
@@ -540,7 +540,8 @@ public class BuilderTestCase extends TestCase { for (ComponentReference reference : componentD.getReferences()) {
if ("reference3".equals(reference.getName())) {
wsBinding = reference.getBinding(WebServiceBinding.class);
- assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
+ assert reference.getBindings().size() == 1;
+ assert reference.getInterfaceContract(wsBinding) instanceof WSDLInterfaceContract;
}
}
assert "http://foo.com/bar".equals(wsBinding.getURI());
@@ -692,7 +693,7 @@ public class BuilderTestCase extends TestCase { assert wsBinding.getWSDLDocument() == null;
}
- // Scenario 9: targets in references CDR1A and CBR2A and binding.ws at CDR3A
+ // Scenario 9: targets in references CBR2A and CDR3A and binding.ws at CDR3A
public void testScenario9() throws Exception {
System.out.println("====>Running testScenario9");
customBuilder = new CustomCompositeBuilder(false);
@@ -706,18 +707,19 @@ public class BuilderTestCase extends TestCase { Composite domainComposite = customBuilder.getDomainComposite();
Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
- WebServiceBinding wsBinding = null;
+ ComponentReference componentRef = null;
for (ComponentReference reference : componentD.getReferences()) {
if ("reference3a".equals(reference.getName())) {
+ componentRef = reference;
assertTrue(reference.getBindings().size() == 2);
assertTrue(reference.getBindings().get(0) instanceof WebServiceBinding);
assertTrue(reference.getBindings().get(1) instanceof WebServiceBinding);
}
}
-
+ assertTrue(componentRef != null);
}
- // Scenario 10: targets in references CDR1A and CBR2A and binding.ws at CCR2A
+ // Scenario 10: targets in references CBR2A and CDR3A and binding.ws at CCR2A
public void testScenario10() throws Exception {
System.out.println("====>Running testScenario10");
customBuilder = new CustomCompositeBuilder(false);
@@ -727,7 +729,7 @@ public class BuilderTestCase extends TestCase { checkScenario10And11Results();
}
- // Scenario 11: targets in references CDR1A and CBR2A and binding.ws at CBR2A
+ // Scenario 11: targets in references CBR2A and CDR3A and binding.ws at CBR2A
public void testScenario11() throws Exception {
System.out.println("====>Running testScenario11");
customBuilder = new CustomCompositeBuilder(false);
@@ -741,18 +743,23 @@ public class BuilderTestCase extends TestCase { Composite domainComposite = customBuilder.getDomainComposite();
Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
- WebServiceBinding wsBinding = null;
+ ComponentReference componentRef = null;
for (ComponentReference reference : componentD.getReferences()) {
if ("reference3a".equals(reference.getName())) {
+ componentRef = reference;
assertTrue(reference.getBindings().size() == 2);
- assertTrue(reference.getBindings().get(0) instanceof SCABinding);
- assertTrue(reference.getBindings().get(1) instanceof WebServiceBinding);
+ Binding binding1 = reference.getBindings().get(0);
+ assertTrue(binding1 instanceof SCABinding);
+ assertTrue(reference.getInterfaceContract(binding1) instanceof JavaInterfaceContract);
+ Binding binding2 = reference.getBindings().get(1);
+ assertTrue(binding2 instanceof WebServiceBinding);
+ assertTrue(reference.getInterfaceContract(binding2) instanceof WSDLInterfaceContract);
}
}
-
+ assertTrue(componentRef != null);
}
- // Scenario 12: targets in references CDR1A and CBR2A and binding.ws at CAR1A
+ // Scenario 12: target in reference CDR3A and binding.ws uri= at CAR1A
public void testScenario12() throws Exception {
System.out.println("====>Running testScenario12");
customBuilder = new CustomCompositeBuilder(false);
@@ -766,14 +773,41 @@ public class BuilderTestCase extends TestCase { Composite domainComposite = customBuilder.getDomainComposite();
Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
- WebServiceBinding wsBinding = null;
+ ComponentReference componentRef = null;
for (ComponentReference reference : componentD.getReferences()) {
if ("reference3a".equals(reference.getName())) {
+ componentRef = reference;
assertTrue(reference.getBindings().size() == 2);
assertTrue(reference.getBindings().get(0) instanceof SCABinding);
assertTrue(reference.getBindings().get(1) instanceof SCABinding);
}
}
-
+ assertTrue(componentRef != null);
}
+
+ // Scenario 13: target in reference CDR3A
+ public void testScenario13() throws Exception {
+ System.out.println("====>Running testScenario13");
+ customBuilder = new CustomCompositeBuilder(false);
+ customBuilder.loadContribution("scenario13.composite", "TestContribution", "src/main/resources/scenario13/");
+ //TestUtils.printResults(customBuilder);
+ TestUtils.checkProblems(customBuilder);
+ checkScenario13Results();
+ }
+
+ private void checkScenario13Results() {
+ Composite domainComposite = customBuilder.getDomainComposite();
+
+ Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
+ ComponentReference componentRef = null;
+ for (ComponentReference reference : componentD.getReferences()) {
+ if ("reference3a".equals(reference.getName())) {
+ componentRef = reference;
+ assertTrue(reference.getBindings().size() == 1);
+ assertTrue(reference.getBindings().get(0) instanceof WebServiceBinding);
+ }
+ }
+ assertTrue(componentRef != null);
+ }
+
}
diff --git a/branches/sca-java-1.3/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java b/branches/sca-java-1.3/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java index b8ddb9f51a..d94ed30c34 100644 --- a/branches/sca-java-1.3/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java +++ b/branches/sca-java-1.3/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java @@ -30,6 +30,7 @@ import javax.xml.namespace.QName; import org.apache.tuscany.sca.assembly.AbstractContract; import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.Contract; import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension; import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl; import org.apache.tuscany.sca.binding.ws.WebServiceBinding; @@ -190,14 +191,14 @@ public class BindingWSDLGenerator { WSDLFactory wsdlFactory = modelFactories.getFactory(WSDLFactory.class); XSDFactory xsdFactory = modelFactories.getFactory(XSDFactory.class); - if (contract.getInterfaceContract() == null) { + if (((Contract)contract).getInterfaceContract(wsBinding) == null) { // can happen if incorrect component service name fatal(monitor, "MissingInterfaceContract", wsBinding, component.getName(), contract.getName()); } InterfaceContract icontract = wsBinding.getBindingInterfaceContract(); if (icontract == null) { - icontract = contract.getInterfaceContract().makeUnidirectional(false); + icontract = ((Contract)contract).getInterfaceContract(wsBinding).makeUnidirectional(false); if (icontract instanceof JavaInterfaceContract) { ModelResolver resolver = component instanceof ResolverExtension ? ((ResolverExtension)component).getModelResolver() : null; |