summaryrefslogtreecommitdiffstats
path: root/java/sca/itest/builder/src/test/java/org/apache/tuscany
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/itest/builder/src/test/java/org/apache/tuscany')
-rw-r--r--java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java814
-rw-r--r--java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java99
-rw-r--r--java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java319
3 files changed, 0 insertions, 1232 deletions
diff --git a/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java b/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java
deleted file mode 100644
index 6d41581371..0000000000
--- a/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java
+++ /dev/null
@@ -1,814 +0,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.
- */
-package org.apache.tuscany.sca.itest.builder;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.xml.namespace.QName;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Load and build some composites and inspect the results.
- *
- * @version $Rev$ $Date$
- */
-public class BuilderTestCase {
- private CustomCompositeBuilder customBuilder;
-
- @Before
- public void setUp() throws Exception {
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- /* OASIS doesn't take notice of top level composite services
- *
- // Scenario 1: <binding.ws> on outer composite service CompositeA/Service1
- @Ignore
- @Test
- public void testScenario1() throws Exception {
- System.out.println("====>Running testScenario1");
- customBuilder = new CustomCompositeBuilder(false);
- customBuilder.loadContribution("scenario1.composite", "TestContribution", "src/main/resources/scenario1/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario1Results(false);
- }
-
- @Ignore
- @Test
- public void testScenario1NonWiring() throws Exception {
- System.out.println("====>Running testScenario1NonWiring");
- customBuilder = new CustomCompositeBuilder(true);
- customBuilder.loadContribution("scenario1.composite", "TestContribution", "src/main/resources/scenario1/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario1Results(true);
- }
-
- private void checkScenario1Results(boolean nonWiring) {
- Composite domainComposite = customBuilder.getDomainComposite();
-
- Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
- if (!nonWiring) {
- // Should create component service $promoted$Service1 on innermost component
- // ComponentD, with <binding.ws> and uri="/Service1"
- // No other services on ComponentD should have <binding.ws>
- WebServiceBinding wsBinding = null;
- for (ComponentService service : componentD.getServices()) {
- WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
- if ("$promoted$Service1".equals(service.getName())) {
- wsBinding = wsb;
- } else {
- assert wsb == null;
- }
- }
- assert "/Service1".equals(wsBinding.getURI());
-
- // Should create WSDL document for ComponentD/$promoted$Service1 with endpoint uri="/Service1"
- Definition def = wsBinding.getWSDLDocument();
- javax.wsdl.Service svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
- Port port = svc.getPort("Service3Port");
- assert "/Service1".equals(TestUtils.getPortAddress(port));
- } else {
- // Should not create component service $promoted$Service1 on innermost component ComponentD
- // No component services on ComponentD should have <binding.ws>
- for (ComponentService service : componentD.getServices()) {
- assert !"$promoted$Service1".equals(service.getName());
- assert service.getBinding(WebServiceBinding.class) == null;
- }
- }
-
- // No services on ComponentB should have <binding.ws>
- Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
- for (ComponentService service : componentB.getServices()) {
- assert service.getBinding(WebServiceBinding.class) == null;
- }
-
- // No services on CompositeC should have <binding.ws>
- Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario1", "CompositeC"));
- for (Service service : compositeC.getServices()) {
- assert service.getBinding(WebServiceBinding.class) == null;
- }
-
- if (nonWiring) {
- // Should not add a WSDL document to domain composite service Service1
- WebServiceBinding wsBinding = null;
- for (Service service : domainComposite.getServices()) {
- if ("Service1".equals(service.getName())) {
- wsBinding = service.getBinding(WebServiceBinding.class);
- }
- }
- assert wsBinding.getWSDLDocument() == null;
- }
-
- String expectedEndpoints = "Component - ComponentB\n" +
- "Service - Service2\n" +
- "Endpoint - Service2\n" +
- "Service - Service2a\n" +
- "Endpoint - Service2a\n" +
- "Reference - reference2\n" +
- "Component - ComponentB has composite impl\n" +
- " Component - ComponentD\n" +
- " Service - Service3\n" +
- " Endpoint - Service3\n" +
- " Service - Service3a\n" +
- " Endpoint - Service3a\n" +
- " Reference - reference3";
-
- String actualEndpoints = TestUtils.printEndpoints(domainComposite);
- System.out.println(actualEndpoints);
-
- Assert.assertEquals(expectedEndpoints, actualEndpoints);
- }
-*/
-
- // Scenario 2: <binding.ws> on outer component service ComponentB/Service2
- @Test
- public void testScenario2() throws Exception {
- System.out.println("====>Running testScenario2");
- customBuilder = new CustomCompositeBuilder(false);
- customBuilder.loadContribution("scenario2.composite", "TestContribution", "src/main/resources/scenario2/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario2and3Results("http://scenario2", false);
- }
-
- public void testScenario2NonWiring() throws Exception {
- System.out.println("====>Running testScenario2NonWiring");
- customBuilder = new CustomCompositeBuilder(true);
- customBuilder.loadContribution("scenario2.composite", "TestContribution", "src/main/resources/scenario2/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario2and3Results("http://scenario2", true);
- }
-
- private void checkScenario2and3Results(String namespace, boolean nonWiring) {
- Composite domainComposite = customBuilder.getDomainComposite();
-
- // Test that endpoint structure matches expected
- String structure = TestUtils.printStructure(domainComposite, "");
- System.out.println(structure);
-
- String expectedStructure = "Component URI - ComponentB\n" +
- " Component URI - ComponentB/ComponentD\n" +
- " Endpoint: URI = ComponentB/ComponentD#service-binding(Service3/Service3) org.apache.tuscany.sca.assembly.impl.SCABindingImpl\n" +
- " Endpoint: URI = ComponentB/ComponentD#service-binding(Service3a/Service3a) org.apache.tuscany.sca.assembly.impl.SCABindingImpl\n" +
- "Endpoint: URI = ComponentB#service-binding(Service2/Service2) org.apache.tuscany.sca.binding.ws.impl.WebServiceBindingImpl\n" +
- "Endpoint: URI = ComponentB#service-binding(Service2a/Service3a) org.apache.tuscany.sca.assembly.impl.SCABindingImpl\n";
-
- Assert.assertEquals(expectedStructure, structure);
-
- // Test that generated WSDL matches expected
- // Should create WSDL document for ComponentB/Service2 with endpoint uri="/ComponentB/Service2"
- // No other services on ComponentB should have <binding.ws>
- Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
- WebServiceBinding wsBinding = null;
-
- for (ComponentService service : componentB.getServices()) {
- WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
- if ("Service2".equals(service.getName())) {
- wsBinding = wsb;
- } else {
- assert wsb == null;
- }
- }
-
- Definition def = wsBinding.getWSDLDocument();
- TestUtils.writeWSDL(def);
-
- javax.wsdl.Service svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
- Port port = svc.getPort("Service3Port");
- Assert.assertEquals("/ComponentB/Service2",TestUtils.getPortAddress(port));
-
- }
-/*
- // Scenario 3: <binding.ws> on inner composite service CompositeC/Service2
- public void testScenario3() throws Exception {
- System.out.println("====>Running testScenario3");
- customBuilder = new CustomCompositeBuilder(false);
- customBuilder.loadContribution("scenario3.composite", "TestContribution", "src/main/resources/scenario3/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario2and3Results("http://scenario3", false);
- }
-
- public void testScenario3NonWiring() throws Exception {
- System.out.println("====>Running testScenario3NonWiring");
- customBuilder = new CustomCompositeBuilder(true);
- customBuilder.loadContribution("scenario3.composite", "TestContribution", "src/main/resources/scenario3/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario2and3Results("http://scenario3", true);
- }
-
- // Scenario 4: <binding.ws> on inner component service ComponentD/Service3
- public void testScenario4() throws Exception {
- System.out.println("====>Running testScenario4");
- customBuilder = new CustomCompositeBuilder(false);
- customBuilder.loadContribution("scenario4.composite", "TestContribution", "src/main/resources/scenario4/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario4Results(false);
- }
-
- public void testScenario4NonWiring() throws Exception {
- System.out.println("====>Running testScenario4NonWiring");
- customBuilder = new CustomCompositeBuilder(true);
- customBuilder.loadContribution("scenario4.composite", "TestContribution", "src/main/resources/scenario4/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario4Results(true);
- }
-
- private void checkScenario4Results(boolean nonWiring) {
- Composite domainComposite = customBuilder.getDomainComposite();
-
- // Should create WSDL document for ComponentD/Service3 with endpoint uri="/ComponentD/Service3"
- Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
- WebServiceBinding wsBinding = null;
- for (ComponentService service : componentD.getServices()) {
- if ("Service3".equals(service.getName())) {
- wsBinding = service.getBinding(WebServiceBinding.class);
- }
- }
- Definition def = wsBinding.getWSDLDocument();
- javax.wsdl.Service svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
- Port port = svc.getPort("Service3Port");
- assert "/ComponentB/ComponentD/Service3".equals(TestUtils.getPortAddress(port));
-
- // Should add <binding.ws> to inner composite service CompositeC/Service2
- // No other services on CompositeC should have <binding.ws>
- Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario4", "CompositeC"));
- wsBinding = null;
- for (Service service : compositeC.getServices()) {
- WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
- if ("Service2".equals(service.getName())) {
- wsBinding = wsb;
- } else {
- assert wsb == null;
- }
- }
- assert "/ComponentB/Service2".equals(wsBinding.getURI());
-
- // Should add <binding.ws> to outer component service ComponentB/Service2
- // Should create WSDL document for ComponentB/Service2 with endpoint uri="/ComponentB/Service2"
- // No other services on ComponentB should have <binding.ws>
- Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
- wsBinding = null;
- for (ComponentService service : componentB.getServices()) {
- WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
- if ("Service2".equals(service.getName())) {
- wsBinding = wsb;
- } else {
- assert wsb == null;
- }
- }
- assert "/ComponentB/Service2".equals(wsBinding.getURI());
- def = wsBinding.getWSDLDocument();
- svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
- port = svc.getPort("Service3Port");
- assert "/ComponentB/Service2".equals(TestUtils.getPortAddress(port));
-
- if (!nonWiring) {
- // Should create component service $promoted$ComponentB$slash$Service2 on innermost component
- // ComponentD, with <binding.ws> and uri="/ComponentB/Service2"
- wsBinding = null;
- for (ComponentService service : componentD.getServices()) {
- if ("$promoted$ComponentB$slash$Service2".equals(service.getName())) {
- wsBinding = service.getBinding(WebServiceBinding.class);
- }
- }
- assert "/ComponentB/Service2".equals(wsBinding.getURI());
-
- // Should create WSDL document for ComponentD/$promoted$ComponentB$slash$Service2 with endpoint uri="/ComponentB/Service2"
- def = wsBinding.getWSDLDocument();
- svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
- port = svc.getPort("Service3Port");
- assert "/ComponentB/Service2".equals(TestUtils.getPortAddress(port));
- } else {
- // Should not create component service $promoted$ComponentB$slash$Service2 on innermost component ComponentD
- for (ComponentService service : componentD.getServices()) {
- assert !"$promoted$ComponentB$slash$Service2".equals(service.getName());
- }
- }
-
- // Should add <binding.ws> to outer composite service CompositeA/Service1
- wsBinding = null;
- for (Service service : domainComposite.getServices()) {
- if ("Service1".equals(service.getName())) {
- wsBinding = service.getBinding(WebServiceBinding.class);
- }
- }
- assert wsBinding != null;
- if (nonWiring) {
- // Should not add a WSDL document to domain composite service Service1
- assert wsBinding.getWSDLDocument() == null;
- }
-
- if (!nonWiring) {
- // Should create component service $promoted$Service1 on innermost component
- // ComponentD, with <binding.ws> and uri="/Service1"
- wsBinding = null;
- for (ComponentService service : componentD.getServices()) {
- if ("$promoted$Service1".equals(service.getName())) {
- wsBinding = service.getBinding(WebServiceBinding.class);
- }
- }
- assert "/Service1".equals(wsBinding.getURI());
-
- // Should create WSDL document for ComponentD/$promoted$Service1 with endpoint uri="/Service1"
- def = wsBinding.getWSDLDocument();
- svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
- port = svc.getPort("Service3Port");
- assert "/Service1".equals(TestUtils.getPortAddress(port));
- } else {
- // Should not create component service $promoted$.Service1 on innermost component ComponentD
- for (ComponentService service : componentD.getServices()) {
- assert !"$promoted$Service1".equals(service.getName());
- }
- }
-
- // No services on ComponentD should have <binding.ws>, except for Service3,
- // $promoted$.Service1 and $promoted$.ComponentB.Service2
- for (ComponentService service : componentD.getServices()) {
- if (!"Service3".equals(service.getName()) &&
- !"$promoted$Service1".equals(service.getName()) &&
- !"$promoted$ComponentB$slash$Service2".equals(service.getName())) {
- assert service.getBinding(WebServiceBinding.class) == null;
- }
- }
- }
-
- // Scenario 5: <binding.ws> and <interface.wsdl> on outer composite reference CompositeA/reference1
- @Test
- public void testScenario5() throws Exception {
- System.out.println("====>Running testScenario5");
- customBuilder = new CustomCompositeBuilder(false);
- customBuilder.loadContribution("scenario5.composite", "TestContribution", "src/main/resources/scenario5/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario5Results(false);
- }
-
- @Test
- public void testScenario5NonWiring() throws Exception {
- System.out.println("====>Running testScenario5NonWiring");
- customBuilder = new CustomCompositeBuilder(true);
- customBuilder.loadContribution("scenario5.composite", "TestContribution", "src/main/resources/scenario5/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario5Results(true);
- }
-
- private void checkScenario5Results(boolean nonWiring) {
- Composite domainComposite = customBuilder.getDomainComposite();
-
- // Should not add <binding.ws> to any outer component references
- Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
- for (ComponentReference reference : componentB.getReferences()) {
- assert reference.getBinding(WebServiceBinding.class) == null;
- }
-
- Definition def;
- javax.wsdl.Service svc;
- Port port;
- WebServiceBinding wsBinding;
- Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
- if (!nonWiring) {
- // Should add <binding.ws> to inner component reference ComponentD/reference3 with uri="http://foo.com/bar"
- // Should set <interface.wsdl> on inner component reference ComponentD/reference3
- wsBinding = null;
- for (ComponentReference reference : componentD.getReferences()) {
- if ("reference3".equals(reference.getName())) {
- wsBinding = reference.getBinding(WebServiceBinding.class);
- assert reference.getInterfaceContract(wsBinding) instanceof WSDLInterfaceContract;
- }
- }
- assert "http://foo.com/bar".equals(wsBinding.getURI());
-
- // Should create WSDL document for ComponentD/reference3 with endpoint uri="http://foo.com/bar"
- def = wsBinding.getWSDLDocument();
- svc = def.getService(new QName("http://scenarios/ComponentD/reference3", "Service3aService"));
- port = svc.getPort("Service3aPort");
- assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port));
- } else {
- // Should not add <binding.ws> to any inner component references
- for (ComponentReference reference : componentD.getReferences()) {
- assert reference.getBinding(WebServiceBinding.class) == null;
- }
- }
-
- // Should not add <binding.ws> or <interface.wsdl> to inner composite reference CompositeC/reference2
- Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario5", "CompositeC"));
- for (Reference reference : compositeC.getReferences()) {
- assert reference.getBinding(WebServiceBinding.class) == null;
- assert reference.getInterfaceContract() instanceof JavaInterfaceContract;
- }
-
- String expectedEndpoints = "Component - ComponentB\n" +
- "Service - Service2\n" +
- "Endpoint - Service2\n" +
- "Service - Service2a\n" +
- "Endpoint - Service2a\n" +
- "Reference - reference2\n" +
- "Component - ComponentB has composite impl\n" +
- " Component - ComponentD\n" +
- " Service - Service3\n" +
- " Endpoint - Service3\n" +
- " Service - Service3a\n" +
- " Endpoint - Service3a\n" +
- " Reference - reference3";
-
- String actualEndpoints = TestUtils.printEndpoints(domainComposite);
- System.out.println(actualEndpoints);
-
- Assert.assertEquals(expectedEndpoints, actualEndpoints);
- }
-
-
- // Scenario 6: <binding.ws> and <interface.wsdl> on outer component reference ComponentB/reference2
- @Ignore
- @Test
- public void testScenario6() throws Exception {
- System.out.println("====>Running testScenario6");
- customBuilder = new CustomCompositeBuilder(false);
- customBuilder.loadContribution("scenario6.composite", "TestContribution", "src/main/resources/scenario6/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario6and7Results("http://scenario6", false);
- }
-
- @Ignore
- @Test
- public void testScenario6NonWiring() throws Exception {
- System.out.println("====>Running testScenario6NonWiring");
- customBuilder = new CustomCompositeBuilder(true);
- customBuilder.loadContribution("scenario6.composite", "TestContribution", "src/main/resources/scenario6/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario6and7Results("http://scenario6", true);
- }
-
- private void checkScenario6and7Results(String namespace, boolean nonWiring) {
- Composite domainComposite = customBuilder.getDomainComposite();
-
- // Should remove target= on ComponentB/reference2 (for Scenario 6) or
- // CompositeC/reference2 (for Scenario 7), and add uri="http://foo.com/bar"
- // to the <binding.ws> element on ComponentB/reference2
- // For nonWiring, ComponentB/reference2 should have target=
- // and no uri= should be added
- Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
- WebServiceBinding wsBinding = null;
- for (ComponentReference reference : componentB.getReferences()) {
- if ("reference2".equals(reference.getName())) {
- if (!nonWiring) {
- assert reference.getTargets().size() == 0;
- } else {
- assert reference.getTargets().size() == 1;
- }
- wsBinding = reference.getBinding(WebServiceBinding.class);
- }
- }
- if (!nonWiring) {
- assert "http://foo.com/bar".equals(wsBinding.getURI());
- } else {
- assert wsBinding.getURI() == null;
- }
-
- Definition def;
- javax.wsdl.Service svc;
- Port port;
- if (!nonWiring) {
- // Should create WSDL document for ComponentB/reference2 with endpoint uri="http://foo.com/bar"
- def = wsBinding.getWSDLDocument();
- svc = def.getService(new QName("http://scenarios/ComponentB/reference2", "Service3aService"));
- port = svc.getPort("Service3aPort");
- assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port));
- }
-
- Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
- if (!nonWiring) {
- // Should add <binding.ws> to inner component reference ComponentD/reference3 with uri="http://foo.com/bar"
- // Should set <interface.wsdl> on inner component reference ComponentD/reference3
- wsBinding = null;
- for (ComponentReference reference : componentD.getReferences()) {
- if ("reference3".equals(reference.getName())) {
- wsBinding = reference.getBinding(WebServiceBinding.class);
- assert reference.getBindings().size() == 1;
- assert reference.getInterfaceContract(wsBinding) instanceof WSDLInterfaceContract;
- }
- }
- assert "http://foo.com/bar".equals(wsBinding.getURI());
-
- // Should create WSDL document for ComponentD/reference3 with endpoint uri="http://foo.com/bar"
- def = wsBinding.getWSDLDocument();
- svc = def.getService(new QName("http://scenarios/ComponentB/reference2", "Service3aService"));
- port = svc.getPort("Service3aPort");
- assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port));
- } else {
- // Should not add <binding.ws> to any inner component references
- for (ComponentReference reference : componentD.getReferences()) {
- assert reference.getBinding(WebServiceBinding.class) == null;
- }
- }
-
- // No references on CompositeC should have <binding.ws> or <interface.wsdl>, except for
- // reference2 in Scenario 7
- Composite compositeC = TestUtils.getComposite(domainComposite, new QName(namespace, "CompositeC"));
- for (Reference reference : compositeC.getReferences()) {
- if ("http://scenario7".equals(namespace) && "reference2".equals(reference.getName())) {
- assert reference.getBinding(WebServiceBinding.class)!= null;
- assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
- } else {
- assert reference.getBinding(WebServiceBinding.class) == null;
- assert reference.getInterfaceContract() instanceof JavaInterfaceContract;
- }
- }
-
- // Should add <binding.ws> and <interface.wsdl> to outer composite reference CompositeA/reference1
- wsBinding = null;
- for (Reference reference : domainComposite.getReferences()) {
- if ("reference1".equals(reference.getName())) {
- wsBinding = reference.getBinding(WebServiceBinding.class);
- assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
- }
- }
- assert wsBinding.getURI() == null;
-
- // Should not add a WSDL document to domain composite reference reference1
- assert wsBinding.getWSDLDocument() == null;
-
- String expectedEndpoints = "Component - ComponentB\n" +
- "Service - Service2\n" +
- "Endpoint - Service2\n" +
- "Service - Service2a\n" +
- "Endpoint - Service2a\n" +
- "Reference - reference2\n" +
- "Component - ComponentB has composite impl\n" +
- " Component - ComponentD\n" +
- " Service - Service3\n" +
- " Endpoint - Service3\n" +
- " Service - Service3a\n" +
- " Endpoint - Service3a\n" +
- " Reference - reference3";
-
- String actualEndpoints = TestUtils.printEndpoints(domainComposite);
- System.out.println(actualEndpoints);
-
- Assert.assertEquals(expectedEndpoints, actualEndpoints);
- }
-
- // Scenario 7: <binding.ws> and <interface.wsdl> on inner composite reference CompositeC/reference2
- public void testScenario7() throws Exception {
- System.out.println("====>Running testScenario7");
- customBuilder = new CustomCompositeBuilder(false);
- customBuilder.loadContribution("scenario7.composite", "TestContribution", "src/main/resources/scenario7/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario6and7Results("http://scenario7", false);
- }
-
- public void testScenario7NonWiring() throws Exception {
- System.out.println("====>Running testScenario7NonWiring");
- customBuilder = new CustomCompositeBuilder(true);
- customBuilder.loadContribution("scenario7.composite", "TestContribution", "src/main/resources/scenario7/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario6and7Results("http://scenario7", true);
- }
-
- // Scenario 8: <binding.ws> and <interface.wsdl> on inner component reference ComponentD/reference3
- public void testScenario8() throws Exception {
- System.out.println("====>Running testScenario8");
- customBuilder = new CustomCompositeBuilder(false);
- customBuilder.loadContribution("scenario8.composite", "TestContribution", "src/main/resources/scenario8/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario8Results(false);
- }
-
- public void testScenario8NonWiring() throws Exception {
- System.out.println("====>Running testScenario8NonWiring");
- customBuilder = new CustomCompositeBuilder(true);
- customBuilder.loadContribution("scenario8.composite", "TestContribution", "src/main/resources/scenario8/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario8Results(true);
- }
-
- private void checkScenario8Results(boolean nonWiring) {
- Composite domainComposite = customBuilder.getDomainComposite();
-
- // Should replace target= on ComponentD/reference3 by uri="http://foo.com/bar" on <binding.ws>
- // For nonWiring, the original target= is preserved and there is no uri=
- Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
- WebServiceBinding wsBinding = null;
- for (ComponentReference reference : componentD.getReferences()) {
- if ("reference3".equals(reference.getName())) {
- if (!nonWiring) {
- assert reference.getTargets().size() == 0;
- } else {
- assert reference.getTargets().size() == 1;
- }
- wsBinding = reference.getBinding(WebServiceBinding.class);
- }
- }
- if (!nonWiring) {
- assert "http://foo.com/bar".equals(wsBinding.getURI());
- } else {
- assert wsBinding.getURI() == null;
- }
-
- Definition def;
- javax.wsdl.Service svc;
- Port port;
- if (!nonWiring) {
- // Should create WSDL document for ComponentD/reference3 with endpoint uri="http://foo.com/bar"
- def = wsBinding.getWSDLDocument();
- svc = def.getService(new QName("http://scenarios/ComponentD/reference3", "Service3aService"));
- port = svc.getPort("Service3aPort");
- assert "http://foo.com/bar".equals(TestUtils.getPortAddress(port));
- }
-
- // Should add <binding.ws> and <interface.wsdl> to inner composite reference CompositeC/reference2
- Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario8", "CompositeC"));
- wsBinding = null;
- for (Reference reference : compositeC.getReferences()) {
- if ("reference2".equals(reference.getName())) {
- wsBinding = reference.getBinding(WebServiceBinding.class);
- assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
- }
- }
- assert wsBinding.getURI() == null;
-
- // Should add <binding.ws> and <interface.wsdl> to outer component reference ComponentB/reference2
- Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
- wsBinding = null;
- for (ComponentReference reference : componentB.getReferences()) {
- if ("reference2".equals(reference.getName())) {
- wsBinding = reference.getBinding(WebServiceBinding.class);
- assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
- }
- }
- assert wsBinding.getURI() == null;
-
- // Should add <binding.ws> and <interface.wsdl> to outer composite reference CompositeA/reference1
- wsBinding = null;
- for (Reference reference : domainComposite.getReferences()) {
- if ("reference1".equals(reference.getName())) {
- wsBinding = reference.getBinding(WebServiceBinding.class);
- assert reference.getInterfaceContract() instanceof WSDLInterfaceContract;
- }
- }
- assert wsBinding.getURI() == null;
-
- // Should not add a WSDL document to domain composite reference reference1
- assert wsBinding.getWSDLDocument() == null;
- }
-
- // Scenario 9: target in reference CDR3A and binding.ws uri= at CAR1A
- public void testScenario9() throws Exception {
- System.out.println("====>Running testScenario9");
- customBuilder = new CustomCompositeBuilder(false);
- customBuilder.loadContribution("scenario9.composite", "TestContribution", "src/main/resources/scenario9/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario9Results();
- }
-
- private void checkScenario9Results() {
- 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() == 2);
- assertTrue(reference.getBindings().get(0) instanceof SCABinding);
- assertTrue(reference.getBindings().get(1) instanceof WebServiceBinding);
- }
- }
- assertTrue(componentRef != null);
- }
-
- // Scenario 10: targets in references CBR2A and CDR3A and binding.ws at CBR2A
- public void testScenario10() throws Exception {
- System.out.println("====>Running testScenario10");
- customBuilder = new CustomCompositeBuilder(false);
- customBuilder.loadContribution("scenario10.composite", "TestContribution", "src/main/resources/scenario10/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario10And11Results();
- }
-
- // Scenario 11: targets in references CBR2A and CDR3A and binding.ws at CCR2A
- public void testScenario11() throws Exception {
- System.out.println("====>Running testScenario11");
- customBuilder = new CustomCompositeBuilder(false);
- customBuilder.loadContribution("scenario11.composite", "TestContribution", "src/main/resources/scenario11/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario10And11Results();
- }
-
- private void checkScenario10And11Results() {
- 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() == 2);
- 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 CBR2A and CDR3A and binding.ws at CDR3A
- public void testScenario12() throws Exception {
- System.out.println("====>Running testScenario12");
- customBuilder = new CustomCompositeBuilder(false);
- customBuilder.loadContribution("scenario12.composite", "TestContribution", "src/main/resources/scenario12/");
- //TestUtils.printResults(customBuilder);
- TestUtils.checkProblems(customBuilder);
- checkScenario12Results();
- }
-
- private void checkScenario12Results() {
- 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() == 2);
- assertTrue(reference.getBindings().get(0) instanceof WebServiceBinding);
- assertTrue(reference.getBindings().get(1) instanceof WebServiceBinding);
- }
- }
- 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/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java b/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java
deleted file mode 100644
index 27768f3799..0000000000
--- a/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java
+++ /dev/null
@@ -1,99 +0,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.
- */
-package org.apache.tuscany.sca.itest.builder;
-
-import javax.xml.stream.XMLOutputFactory;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.node.Contribution;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-import org.apache.tuscany.sca.node.impl.NodeImpl;
-import org.apache.tuscany.sca.runtime.CompositeActivator;
-
-
-public class CustomCompositeBuilder {
-
- private boolean nonWiring;
- private Node node;
- private ExtensionPointRegistry extensionPoints;
- private Monitor monitor;
- private StAXArtifactProcessor<Composite> compositeProcessor;
-
- public CustomCompositeBuilder(boolean nonWiring) {
- this.nonWiring = nonWiring;
- }
-
- public void loadContribution(String compositeURL, String sourceURI, String sourceURL) throws Exception {
- NodeFactory nodeFactory = NodeFactory.newInstance();
- node = nodeFactory.createNode(compositeURL, new Contribution(sourceURI, sourceURL));
- node.start();
-
- // get some things out of the extension registry
- extensionPoints = ((NodeImpl)node).getExtensionPoints();
-
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- monitor = monitorFactory.createMonitor();
-
- StAXArtifactProcessorExtensionPoint xmlProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- compositeProcessor = xmlProcessors.getProcessor(Composite.class);
-
- CompositeActivator compositeActivator = utilities.getUtility(CompositeActivator.class);
- }
-
- /**
- * Returns the delegating model processor.
- * @return the delegating model processor
- */
- public StAXArtifactProcessor<Object> getModelProcessor() {
- return null;//compositeProcessor;
- }
-
- /**
- * Returns the XML output factory.
- * @return the XML output factory
- */
- public XMLOutputFactory getOutputFactory() {
- return null; //outputFactory;
- }
-
- /**
- * Returns the domain composite.
- * @return the domain composite model object
- */
- public Composite getDomainComposite() {
- return (Composite) ((NodeImpl)node).getDomainComposite();
- }
-
- /**
- * Returns the monitor.
- * @return the monitor instance
- */
- public Monitor getMonitor() {
- return monitor;
- }
-
-}
diff --git a/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java b/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java
deleted file mode 100644
index c5eb7a70ea..0000000000
--- a/java/sca/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java
+++ /dev/null
@@ -1,319 +0,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.
- */
-package org.apache.tuscany.sca.itest.builder;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.soap12.SOAP12Address;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLWriter;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.impl.EndpointImpl;
-import org.apache.tuscany.sca.assembly.impl.EndpointReferenceImpl;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
-import org.w3c.dom.Document;
-
-/**
- * Static utility methods for use by test cases.
- *
- * @version $Rev$ $Date$
- */
-public class TestUtils {
-
- protected static void checkProblems(CustomCompositeBuilder customBuilder) throws Exception {
- boolean problems = false;
- for (Problem problem : customBuilder.getMonitor().getProblems()) {
- if (problem.getCause() != null) {
- problem.getCause().printStackTrace();
- }
- if (problem.getSeverity() == Problem.Severity.ERROR){
- problems = true;
- }
- }
- assert !problems;
- }
-
- protected static String getPortAddress(Port port) {
- Object ext = port.getExtensibilityElements().get(0);
- String returnAddress = null;
- if (ext instanceof SOAPAddress) {
- returnAddress = ((SOAPAddress)ext).getLocationURI();
- }
- if (ext instanceof SOAP12Address) {
- returnAddress = ((SOAP12Address)ext).getLocationURI();
- }
-
- returnAddress = returnAddress.substring(returnAddress.indexOf("//") + 2);
- returnAddress = returnAddress.substring(returnAddress.indexOf("/"));
-
- return returnAddress;
- }
-
- protected static Component getComponent(Composite composite, String name) {
- for (Component component : composite.getComponents()) {
- if (name.equals(component.getName())) {
- return component;
- }
- // process implementation composites recursively
- Implementation impl = component.getImplementation();
- if (impl instanceof Composite) {
- Component comp = getComponent((Composite)impl, name);
- if (comp != null) {
- return comp;
- }
- }
- }
- return null;
- }
-
- protected static Composite getComposite(Composite composite, QName name) {
- if (name.equals(composite.getName())) {
- return composite;
- }
- for (Component component : composite.getComponents()) {
- // process implementation composites recursively
- Implementation impl = component.getImplementation();
- if (impl instanceof Composite) {
- Composite comp = getComposite((Composite)impl, name);
- if (comp != null) {
- return comp;
- }
- }
- }
- return null;
- }
-
- protected static void printResults(CustomCompositeBuilder customBuilder) throws Exception {
- for (Problem problem : customBuilder.getMonitor().getProblems()) {
- if (problem.getCause() != null) {
- problem.getCause().printStackTrace();
- }
- }
- Composite domainComposite = customBuilder.getDomainComposite();
- printComposite(domainComposite, customBuilder);
- }
-
- private static void printComposite(Composite composite, CustomCompositeBuilder customBuilder) throws Exception {
- // process implementation composites recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- printComposite((Composite)implementation, customBuilder);
- }
- }
-
- // write out the SCDL
- writeSCDL(composite, customBuilder);
-
- // find all the component service and reference bindings
- for (Component component : composite.getComponents()) {
- for (ComponentService componentService : component.getServices()) {
- for (Binding binding : componentService.getBindings()) {
- if (binding instanceof WebServiceBinding) {
- writeWSDL(component, componentService, ((WebServiceBinding)binding).getWSDLDocument());
- }
- }
- }
- for (ComponentReference componentReference : component.getReferences()) {
- for (Binding binding : componentReference.getBindings()) {
- if (binding instanceof WebServiceBinding) {
- writeWSDL(component, componentReference, ((WebServiceBinding)binding).getWSDLDocument());
- }
- }
- }
- }
-
- // find all the composite service and reference bindings
- for (Service service : composite.getServices()) {
- for (Binding binding : service.getBindings()) {
- if (binding instanceof WebServiceBinding) {
- writeWSDL(null, service, ((WebServiceBinding)binding).getWSDLDocument());
- }
- }
- }
- for (Reference reference : composite.getReferences()) {
- for (Binding binding : reference.getBindings()) {
- if (binding instanceof WebServiceBinding) {
- writeWSDL(null, reference, ((WebServiceBinding)binding).getWSDLDocument());
- }
- }
- }
- }
-
- private static void writeSCDL(Composite composite, CustomCompositeBuilder customBuilder) throws Exception {
- // Print out a composite
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLStreamWriter writer = customBuilder.getOutputFactory().createXMLStreamWriter(bos);
- customBuilder.getModelProcessor().write(composite, writer, new ProcessorContext());
-
- // Parse and write again to pretty format it
- DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document document = documentBuilder.parse(new ByteArrayInputStream(bos.toByteArray()));
- OutputFormat format = new OutputFormat();
- format.setIndenting(true);
- format.setIndent(2);
- XMLSerializer serializer = new XMLSerializer(System.out, format);
- System.out.println("-->Runtime SCDL model for composite " + composite.getName());
- serializer.serialize(document);
- }
-
- private static void writeWSDL(Component component, Contract contract, Definition definition) {
- if (definition == null) {
- System.out.println("-->No generated WSDL for " + (component != null ? component.getName() : "") + "/" + contract.getName());
- } else {
- try {
- System.out.println("-->Generated WSDL for " + (component != null ? component.getName() : "") + "/" + contract.getName());
- WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
- writer.writeWSDL(definition, System.out);
- } catch (WSDLException e) {
- // ignore
- }
- }
- }
-
- protected static void writeWSDL(Definition definition) {
- try {
- WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
- writer.writeWSDL(definition, System.out);
- } catch (WSDLException e) {
- // ignore
- }
- }
-
- protected static String printStructure(Composite composite, String indent){
- String structure = "";
- for (Component component : composite.getComponents()){
- structure += indent + "Component URI - " + component.getURI() + "\n";
-
- // recurse for composite implementations
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- structure += printStructure((Composite)implementation, indent + " ");
- }
-
- for (Service service : component.getServices()){
- for (Endpoint endpoint : service.getEndpoints()){
- structure += indent + ((EndpointImpl)endpoint).toStringWithoutHash() + " " + endpoint.getBinding().getClass().getName() + "\n";
- }
- }
- for (Reference reference : component.getReferences()){
- for (EndpointReference endpointReference : reference.getEndpointReferences()){
- structure += indent + ((EndpointReferenceImpl)endpointReference).toStringWithoutHash() + " " + endpointReference.getBinding().getClass().getName() + "\n";
- }
- }
- }
- return structure;
- }
-/*
- protected static String printEndpoints(Composite composite){
- return printEndpoints(composite, "");
- }
-
- protected static String printEndpoints(Composite composite, String indent){
-
- String buffer = "";
-
- for (Component component : composite.getComponents()) {
- buffer += indent + "Component - " + component.getName() + "\n";
-
- // print component service endpoints
- for (ComponentService componentService : component.getServices()) {
- buffer += indent + "Service - " + componentService.getName() + "\n";
- for (Endpoint endpoint : componentService.getEndpoints()) {
- if (endpoint.getBinding() != null){
- buffer += printEndpoint(endpoint, indent);
- }
- }
- }
-
- for (ComponentReference componentReference : component.getReferences()) {
- buffer += indent + "Reference - " + componentReference.getName() + "\n";
- for (EndpointReference endpointReference : componentReference.getEndpointReferences()) {
- buffer += printEndpointReference(endpointReference, indent);
- }
- }
-
- // process implementation composites recursively
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- buffer += indent + "Component - " + component.getName() + " has composite impl" + "\n";
- buffer += printEndpoints((Composite)implementation, indent + " ");
- }
- }
-
- return buffer;
- }
-
- protected static String printEndpoint(Endpoint endpoint, String indent){
- String buffer = "";
-
- buffer += indent + " Endpoint - Component: " + endpoint.getComponent().getName() +"\n";
- buffer += indent + " Service: " + endpoint.getService().getName() +"\n";
- buffer += indent + " Binding: " + endpoint.getBinding().getName() +"\n";
-
- return buffer;
- }
-
- protected static String printEndpointReference(EndpointReference endpointReference, String indent){
- String buffer = "";
-
- buffer += indent + " EndpointReference - Component: " + endpointReference.getComponent().getName() +"\n";
- buffer += indent + " Reference: " + endpointReference.getReference().getName() +"\n";
- if (endpointReference.getTargetEndpoint() != null){
- buffer += indent + " Wired: " +"\n";
- buffer += indent + " Target: " + endpointReference.getTargetEndpoint().getComponent().getName()+"\n";
- if (endpointReference.getTargetEndpoint() != null &&
- endpointReference.getTargetEndpoint().isUnresolved() == false){
- buffer += indent + " Binding: " + endpointReference.getBinding().getName() +"\n";
- buffer += indent + " TargetEndpoint: " + endpointReference.getTargetEndpoint().getBinding().getName()+"\n";
- } else {
- buffer += indent + " Unresolved: " +"\n";
- }
- } else {
- buffer += indent + " NonWired: " +"\n";
- }
-
- return buffer;
- }
-*/
-}