From 699d2df521ee26e343c53505a2ac1d546ba1965e Mon Sep 17 00:00:00 2001 From: antelder Date: Sat, 28 Mar 2009 09:46:58 +0000 Subject: Create M2 relese branch git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@759448 13f79535-47bb-0310-9956-ffa450edef68 --- branches/sca-java-2.0-M2/itest/builder/pom.xml | 119 +++ .../tuscany/sca/itest/builder/ComponentDImpl.java | 43 + .../ComponentDReferenceMultiplicityImpl.java | 48 ++ .../tuscany/sca/itest/builder/ComponentEImpl.java | 36 + .../tuscany/sca/itest/builder/ComponentFImpl.java | 36 + .../apache/tuscany/sca/itest/builder/Service3.java | 34 + .../tuscany/sca/itest/builder/Service3a.java | 34 + .../scenario1/META-INF/sca-contribution.xml | 23 + .../main/resources/scenario1/scenario1.composite | 45 ++ .../main/resources/scenario1/scenario1a.composite | 47 ++ .../scenario10/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario10/scenario10.composite | 62 ++ .../resources/scenario10/scenario10a.composite | 61 ++ .../src/main/resources/scenario10/service3.wsdl | 63 ++ .../scenario11/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario11/scenario11.composite | 59 ++ .../resources/scenario11/scenario11a.composite | 64 ++ .../src/main/resources/scenario11/service3.wsdl | 63 ++ .../scenario12/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario12/scenario12.composite | 58 ++ .../resources/scenario12/scenario12a.composite | 64 ++ .../scenario13/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario13/scenario13.composite | 58 ++ .../resources/scenario13/scenario13a.composite | 64 ++ .../scenario2/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario2/scenario2.composite | 45 ++ .../main/resources/scenario2/scenario2a.composite | 47 ++ .../scenario3/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario3/scenario3.composite | 44 ++ .../main/resources/scenario3/scenario3a.composite | 48 ++ .../scenario4/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario4/scenario4.composite | 44 ++ .../main/resources/scenario4/scenario4a.composite | 48 ++ .../scenario5/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario5/scenario5.composite | 46 ++ .../main/resources/scenario5/scenario5a.composite | 47 ++ .../src/main/resources/scenario5/scenarios.wsdl | 63 ++ .../scenario6/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario6/scenario6.composite | 47 ++ .../main/resources/scenario6/scenario6a.composite | 47 ++ .../src/main/resources/scenario6/scenarios.wsdl | 63 ++ .../scenario7/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario7/scenario7.composite | 45 ++ .../main/resources/scenario7/scenario7a.composite | 49 ++ .../src/main/resources/scenario7/scenarios.wsdl | 63 ++ .../scenario8/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario8/scenario8.composite | 44 ++ .../main/resources/scenario8/scenario8a.composite | 50 ++ .../src/main/resources/scenario8/scenarios.wsdl | 63 ++ .../scenario9/META-INF/sca-contribution.xml | 24 + .../main/resources/scenario9/scenario9.composite | 60 ++ .../main/resources/scenario9/scenario9a.composite | 61 ++ .../tuscany/sca/itest/builder/BuilderTestCase.java | 875 +++++++++++++++++++++ .../sca/itest/builder/CustomCompositeBuilder.java | 101 +++ .../tuscany/sca/itest/builder/TestUtils.java | 276 +++++++ 55 files changed, 3645 insertions(+) create mode 100644 branches/sca-java-2.0-M2/itest/builder/pom.xml create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDImpl.java create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDReferenceMultiplicityImpl.java create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentEImpl.java create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentFImpl.java create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3.java create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3a.java create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario1/META-INF/sca-contribution.xml create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario1/scenario1.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario1/scenario1a.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario10/META-INF/sca-contribution.xml create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario10/scenario10.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario10/scenario10a.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario10/service3.wsdl create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario11/META-INF/sca-contribution.xml create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario11/scenario11.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario11/scenario11a.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario11/service3.wsdl create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario12/META-INF/sca-contribution.xml create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario12/scenario12.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario12/scenario12a.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario13/META-INF/sca-contribution.xml create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario13/scenario13.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario13/scenario13a.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario2/META-INF/sca-contribution.xml create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario2/scenario2.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario2/scenario2a.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario3/META-INF/sca-contribution.xml create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario3/scenario3.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario3/scenario3a.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario4/META-INF/sca-contribution.xml create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario4/scenario4.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario4/scenario4a.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario5/META-INF/sca-contribution.xml create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario5/scenario5.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario5/scenario5a.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario5/scenarios.wsdl create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario6/META-INF/sca-contribution.xml create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario6/scenario6.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario6/scenario6a.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario6/scenarios.wsdl create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario7/META-INF/sca-contribution.xml create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario7/scenario7.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario7/scenario7a.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario7/scenarios.wsdl create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario8/META-INF/sca-contribution.xml create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario8/scenario8.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario8/scenario8a.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario8/scenarios.wsdl create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario9/META-INF/sca-contribution.xml create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario9/scenario9.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario9/scenario9a.composite create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java create mode 100644 branches/sca-java-2.0-M2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java (limited to 'branches/sca-java-2.0-M2/itest/builder') diff --git a/branches/sca-java-2.0-M2/itest/builder/pom.xml b/branches/sca-java-2.0-M2/itest/builder/pom.xml new file mode 100644 index 0000000000..6aa0b06fa4 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/pom.xml @@ -0,0 +1,119 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-itest + 2.0-M2-SNAPSHOT + ../pom.xml + + itest-builder + Apache Tuscany SCA iTest Builder + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-M2-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-M2-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-monitor + 2.0-M2-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-workspace-impl + 2.0-M2-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-M2-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-binding-sca-xml + 2.0-M2-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-assembly + 2.0-M2-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-core-databinding + 2.0-M2-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-M2-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-M2-SNAPSHOT + test + + + + xerces + xercesImpl + 2.8.1 + test + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDImpl.java b/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDImpl.java new file mode 100644 index 0000000000..a4c6e08844 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDImpl.java @@ -0,0 +1,43 @@ +/* + * 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 org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * Implementation class for ComponentD. + * + * @version $Rev$ $Date$ + */ +@Service(interfaces={Service3.class, Service3a.class}) +public class ComponentDImpl implements Service3, Service3a { + + @Reference + protected Service3a reference3; + + public String getGreetings(String name) { + return "Hello, " + name + "!"; + } + + public String getGreetings2(String name) { + return "Goodbye, " + name + "!"; + } + +} diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDReferenceMultiplicityImpl.java b/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDReferenceMultiplicityImpl.java new file mode 100644 index 0000000000..bfc4e34644 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentDReferenceMultiplicityImpl.java @@ -0,0 +1,48 @@ +/* + * 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.util.List; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * Implementation class for ComponentD. + * + * @version $Rev$ $Date$ + */ +@Service(interfaces={Service3.class, Service3a.class}) +public class ComponentDReferenceMultiplicityImpl implements Service3, Service3a { + + @Reference + protected Service3a reference3; + + @Reference + protected List reference3a; + + public String getGreetings(String name) { + return "Hello, " + name + "!"; + } + + public String getGreetings2(String name) { + return "Goodbye, " + name + "!"; + } + +} diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentEImpl.java b/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentEImpl.java new file mode 100644 index 0000000000..eb5b5dd5c0 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentEImpl.java @@ -0,0 +1,36 @@ +/* + * 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 org.oasisopen.sca.annotation.Service; + + +/** + * Implementation class for ComponentD. + * + * @version $Rev$ $Date$ + */ +@Service(interfaces={Service3.class}) +public class ComponentEImpl implements Service3 { + + + public String getGreetings(String name) { + return "Hello, " + name + " from ComponentE"; + } +} diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentFImpl.java b/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentFImpl.java new file mode 100644 index 0000000000..db1eac6787 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/ComponentFImpl.java @@ -0,0 +1,36 @@ +/* + * 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 org.oasisopen.sca.annotation.Service; + + +/** + * Implementation class for ComponentD. + * + * @version $Rev$ $Date$ + */ +@Service(interfaces={Service3.class}) +public class ComponentFImpl implements Service3 { + + + public String getGreetings(String name) { + return "Hello, " + name + " from ComponentF"; + } +} diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3.java b/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3.java new file mode 100644 index 0000000000..f4b8d2cf39 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3.java @@ -0,0 +1,34 @@ +/* + * 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 org.oasisopen.sca.annotation.Remotable; + + +/** + * Interface for Service3 in ComponentD. + * + * @version $Rev$ $Date$ + */ +@Remotable +public interface Service3 { + + String getGreetings(String name); + +} diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3a.java b/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3a.java new file mode 100644 index 0000000000..299f7606e3 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/java/org/apache/tuscany/sca/itest/builder/Service3a.java @@ -0,0 +1,34 @@ +/* + * 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 org.oasisopen.sca.annotation.Remotable; + + +/** + * Interface for Service3a in ComponentD. + * + * @version $Rev$ $Date$ + */ +@Remotable +public interface Service3a { + + String getGreetings2(String name); + +} diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario1/META-INF/sca-contribution.xml b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario1/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..d8cb23bbd3 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario1/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario1/scenario1.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario1/scenario1.composite new file mode 100644 index 0000000000..4e58cdfa16 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario1/scenario1.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario1/scenario1a.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario1/scenario1a.composite new file mode 100644 index 0000000000..06b273c7a7 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario1/scenario1a.composite @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario10/META-INF/sca-contribution.xml b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario10/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ac01b3c687 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario10/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario10/scenario10.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario10/scenario10.composite new file mode 100644 index 0000000000..2d127a7bec --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario10/scenario10.composite @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario10/scenario10a.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario10/scenario10a.composite new file mode 100644 index 0000000000..98103e360e --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario10/scenario10a.composite @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario10/service3.wsdl b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario10/service3.wsdl new file mode 100644 index 0000000000..2477e23dc6 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario10/service3.wsdl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario11/META-INF/sca-contribution.xml b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario11/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..8b82b43c68 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario11/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario11/scenario11.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario11/scenario11.composite new file mode 100644 index 0000000000..2f5ca96d07 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario11/scenario11.composite @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario11/scenario11a.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario11/scenario11a.composite new file mode 100644 index 0000000000..381ccddcc3 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario11/scenario11a.composite @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario11/service3.wsdl b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario11/service3.wsdl new file mode 100644 index 0000000000..2477e23dc6 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario11/service3.wsdl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario12/META-INF/sca-contribution.xml b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario12/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..4028098023 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario12/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario12/scenario12.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario12/scenario12.composite new file mode 100644 index 0000000000..23799f8487 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario12/scenario12.composite @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario12/scenario12a.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario12/scenario12a.composite new file mode 100644 index 0000000000..a2b4f88dc3 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario12/scenario12a.composite @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario13/META-INF/sca-contribution.xml b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario13/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..1da59d5f04 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario13/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario13/scenario13.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario13/scenario13.composite new file mode 100644 index 0000000000..631e38855f --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario13/scenario13.composite @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario13/scenario13a.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario13/scenario13a.composite new file mode 100644 index 0000000000..98976dc4e8 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario13/scenario13a.composite @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario2/META-INF/sca-contribution.xml b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario2/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..6f174a4504 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario2/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario2/scenario2.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario2/scenario2.composite new file mode 100644 index 0000000000..7c4eeda4bd --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario2/scenario2.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario2/scenario2a.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario2/scenario2a.composite new file mode 100644 index 0000000000..5e97d7eea0 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario2/scenario2a.composite @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario3/META-INF/sca-contribution.xml b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario3/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..22950dfe03 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario3/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario3/scenario3.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario3/scenario3.composite new file mode 100644 index 0000000000..84f42c60fc --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario3/scenario3.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario3/scenario3a.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario3/scenario3a.composite new file mode 100644 index 0000000000..18ed91142c --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario3/scenario3a.composite @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario4/META-INF/sca-contribution.xml b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario4/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..a17e27c9d8 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario4/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario4/scenario4.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario4/scenario4.composite new file mode 100644 index 0000000000..a0bdb0197d --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario4/scenario4.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario4/scenario4a.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario4/scenario4a.composite new file mode 100644 index 0000000000..1b4cf27c76 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario4/scenario4a.composite @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario5/META-INF/sca-contribution.xml b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario5/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..83a232db6e --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario5/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario5/scenario5.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario5/scenario5.composite new file mode 100644 index 0000000000..2326afd2f2 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario5/scenario5.composite @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario5/scenario5a.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario5/scenario5a.composite new file mode 100644 index 0000000000..fdf1423b66 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario5/scenario5a.composite @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario5/scenarios.wsdl b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario5/scenarios.wsdl new file mode 100644 index 0000000000..5cda7327dd --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario5/scenarios.wsdl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario6/META-INF/sca-contribution.xml b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario6/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..776dfe4d97 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario6/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario6/scenario6.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario6/scenario6.composite new file mode 100644 index 0000000000..9575612d51 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario6/scenario6.composite @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario6/scenario6a.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario6/scenario6a.composite new file mode 100644 index 0000000000..9c7b58e2cb --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario6/scenario6a.composite @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario6/scenarios.wsdl b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario6/scenarios.wsdl new file mode 100644 index 0000000000..5cda7327dd --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario6/scenarios.wsdl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario7/META-INF/sca-contribution.xml b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario7/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ede31d6bee --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario7/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario7/scenario7.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario7/scenario7.composite new file mode 100644 index 0000000000..e1d2e0cefe --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario7/scenario7.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario7/scenario7a.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario7/scenario7a.composite new file mode 100644 index 0000000000..ef16dc0785 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario7/scenario7a.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario7/scenarios.wsdl b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario7/scenarios.wsdl new file mode 100644 index 0000000000..5cda7327dd --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario7/scenarios.wsdl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario8/META-INF/sca-contribution.xml b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario8/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..7bb9e694a3 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario8/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario8/scenario8.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario8/scenario8.composite new file mode 100644 index 0000000000..467b7f57fa --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario8/scenario8.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario8/scenario8a.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario8/scenario8a.composite new file mode 100644 index 0000000000..9d9b5ba945 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario8/scenario8a.composite @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario8/scenarios.wsdl b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario8/scenarios.wsdl new file mode 100644 index 0000000000..5cda7327dd --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario8/scenarios.wsdl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario9/META-INF/sca-contribution.xml b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario9/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b6ec160506 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario9/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario9/scenario9.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario9/scenario9.composite new file mode 100644 index 0000000000..83584ed482 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario9/scenario9.composite @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario9/scenario9a.composite b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario9/scenario9a.composite new file mode 100644 index 0000000000..0021ec242b --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/main/resources/scenario9/scenario9a.composite @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/branches/sca-java-2.0-M2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java b/branches/sca-java-2.0-M2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java new file mode 100644 index 0000000000..cdeb355f8b --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/BuilderTestCase.java @@ -0,0 +1,875 @@ +/* + * 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.ComponentReference; +import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.Reference; +import org.apache.tuscany.sca.assembly.Service; +import org.apache.tuscany.sca.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract; +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +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 { + } + + // Scenario 1: 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 and uri="/Service1" + // No other services on ComponentD should have + 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 + for (ComponentService service : componentD.getServices()) { + assert !"$promoted$Service1".equals(service.getName()); + assert service.getBinding(WebServiceBinding.class) == null; + } + } + + // No services on ComponentB should have + Component componentB = TestUtils.getComponent(domainComposite, "ComponentB"); + for (ComponentService service : componentB.getServices()) { + assert service.getBinding(WebServiceBinding.class) == null; + } + + // No services on CompositeC should have + 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: on outer component service ComponentB/Service2 + 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(); + + // Should create WSDL document for ComponentB/Service2 with endpoint uri="/ComponentB/Service2" + // No other services on ComponentB should have + 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(); + javax.wsdl.Service svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service")); + Port port = svc.getPort("Service3Port"); + assert "/ComponentB/Service2".equals(TestUtils.getPortAddress(port)); + + Component componentD = TestUtils.getComponent(domainComposite, "ComponentD"); + if (!nonWiring) { + // Should create component service $promoted$ComponentB$slash$Service2 on innermost component + // ComponentD, with 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 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 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 , except for $promoted$Service1 + // and $promoted$ComponentB$slash$Service2 + for (ComponentService service : componentD.getServices()) { + if (!"$promoted$Service1".equals(service.getName()) && + !"$promoted$ComponentB$slash$Service2".equals(service.getName())) { + assert service.getBinding(WebServiceBinding.class) == null; + } + } + + // No services on CompositeC should have , except for Service2 in Scenario 3 + Composite compositeC = TestUtils.getComposite(domainComposite, new QName(namespace, "CompositeC")); + for (Service service : compositeC.getServices()) { + if ("http://scenario3".equals(namespace) && "Service2".equals(service.getName())) { + assert service.getBinding(WebServiceBinding.class) != null; + } else { + assert service.getBinding(WebServiceBinding.class) == null; + } + } + } + + // Scenario 3: 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: 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 to inner composite service CompositeC/Service2 + // No other services on CompositeC should have + 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 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 + 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 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 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 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 , 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: and 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 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 to inner component reference ComponentD/reference3 with uri="http://foo.com/bar" + // Should set 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 to any inner component references + for (ComponentReference reference : componentD.getReferences()) { + assert reference.getBinding(WebServiceBinding.class) == null; + } + } + + // Should not add or 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: and on outer component reference ComponentB/reference2 + @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 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 to inner component reference ComponentD/reference3 with uri="http://foo.com/bar" + // Should set 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 to any inner component references + for (ComponentReference reference : componentD.getReferences()) { + assert reference.getBinding(WebServiceBinding.class) == null; + } + } + + // No references on CompositeC should have or , 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 and 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: and 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: and 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 + // 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 and 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 and 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 and 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/branches/sca-java-2.0-M2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java b/branches/sca-java-2.0-M2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java new file mode 100644 index 0000000000..da8a46067a --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/CustomCompositeBuilder.java @@ -0,0 +1,101 @@ +/* + * 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.core.assembly.CompositeActivator; +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.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; +import org.apache.tuscany.sca.node.impl.NodeImpl; + + +public class CustomCompositeBuilder { + + private boolean nonWiring; + private Node node; + private ExtensionPointRegistry extensionPoints; + private Monitor monitor; + private StAXArtifactProcessor compositeProcessor; + private Composite domainComposite; + + public CustomCompositeBuilder(boolean nonWiring) { + this.nonWiring = nonWiring; + } + + public void loadContribution(String compositeURL, String sourceURI, String sourceURL) throws Exception { + node = NodeFactory.newInstance().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); + domainComposite = compositeActivator.getDomainComposite(); + } + + /** + * Returns the delegating model processor. + * @return the delegating model processor + */ + public StAXArtifactProcessor 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) domainComposite.getIncludes().get(0); + } + + /** + * Returns the monitor. + * @return the monitor instance + */ + public Monitor getMonitor() { + return monitor; + } + +} diff --git a/branches/sca-java-2.0-M2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java b/branches/sca-java-2.0-M2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java new file mode 100644 index 0000000000..fc18012a61 --- /dev/null +++ b/branches/sca-java-2.0-M2/itest/builder/src/test/java/org/apache/tuscany/sca/itest/builder/TestUtils.java @@ -0,0 +1,276 @@ +/* + * 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 junit.framework.TestCase; +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.assembly.ComponentReference; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.Contract; +import org.apache.tuscany.sca.assembly.Endpoint2; +import org.apache.tuscany.sca.assembly.EndpointReference2; +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.binding.ws.WebServiceBinding; +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.monitor.Monitor; +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(); + } + problems = true; + } + assert !problems; + } + + protected static String getPortAddress(Port port) { + Object ext = port.getExtensibilityElements().get(0); + if (ext instanceof SOAPAddress) { + return ((SOAPAddress)ext).getLocationURI(); + } + if (ext instanceof SOAP12Address) { + return ((SOAP12Address)ext).getLocationURI(); + } + return null; + } + + 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); + + // 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 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 (Endpoint2 endpoint : componentService.getEndpoints()) { + if (endpoint.getBinding() != null){ + buffer += printEndpoint(endpoint, indent); + } + } + } + + for (ComponentReference componentReference : component.getReferences()) { + buffer += indent + "Reference - " + componentReference.getName() + "\n"; + for (EndpointReference2 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(Endpoint2 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(EndpointReference2 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; + } + +} -- cgit v1.2.3