From 1022fb5b709e9b237d48ae5acb759fbc58399cba Mon Sep 17 00:00:00 2001 From: nash Date: Wed, 23 Jul 2008 21:46:39 +0000 Subject: Extend TUSCANY-2324 fix for multiplicity > 1 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@679205 13f79535-47bb-0310-9956-ffa450edef68 --- .../resources/scenario10/scenario10a.composite | 3 +- .../src/main/resources/scenario10/service3.wsdl | 63 +++++++++++++++++++++ .../main/resources/scenario11/scenario11.composite | 1 + .../src/main/resources/scenario11/service3.wsdl | 63 +++++++++++++++++++++ .../scenario13/META-INF/sca-contribution.xml | 24 ++++++++ .../main/resources/scenario13/scenario13.composite | 58 ++++++++++++++++++++ .../resources/scenario13/scenario13a.composite | 64 ++++++++++++++++++++++ .../tuscany/sca/itest/builder/BuilderTestCase.java | 62 ++++++++++++++++----- 8 files changed, 323 insertions(+), 15 deletions(-) create mode 100644 branches/sca-java-1.3/itest/builder/src/main/resources/scenario10/service3.wsdl create mode 100644 branches/sca-java-1.3/itest/builder/src/main/resources/scenario11/service3.wsdl create mode 100644 branches/sca-java-1.3/itest/builder/src/main/resources/scenario13/META-INF/sca-contribution.xml create mode 100644 branches/sca-java-1.3/itest/builder/src/main/resources/scenario13/scenario13.composite create mode 100644 branches/sca-java-1.3/itest/builder/src/main/resources/scenario13/scenario13a.composite (limited to 'branches/sca-java-1.3/itest/builder') 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 @@ - + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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); + } + } -- cgit v1.2.3