TUSCANY-2484 - Changes and tests for the case where a promoted reference has a multiplicity greater than 1. Not complete yet as this has thrown up a problem in that the promoting interface contract is not available to the promoted component. I was going to commit a fix with this change but backed it out to think a little more about it.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@678875 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5a774754e3
commit
bf3384faf9
18 changed files with 837 additions and 25 deletions
|
@ -18,6 +18,8 @@
|
|||
*/
|
||||
package org.apache.tuscany.sca.itest.builder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.osoa.sca.annotations.Reference;
|
||||
import org.osoa.sca.annotations.Service;
|
||||
|
||||
|
|
|
@ -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.osoa.sca.annotations.Reference;
|
||||
import org.osoa.sca.annotations.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<Service3> reference3a;
|
||||
|
||||
public String getGreetings(String name) {
|
||||
return "Hello, " + name + "!";
|
||||
}
|
||||
|
||||
public String getGreetings2(String name) {
|
||||
return "Goodbye, " + name + "!";
|
||||
}
|
||||
|
||||
}
|
|
@ -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.osoa.sca.annotations.Reference;
|
||||
import org.osoa.sca.annotations.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";
|
||||
}
|
||||
}
|
|
@ -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.osoa.sca.annotations.Reference;
|
||||
import org.osoa.sca.annotations.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";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
-->
|
||||
<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
|
||||
targetNamespace="http://scenario10"
|
||||
xmlns:ns10="http://scenario10">
|
||||
<deployable composite="ns10:CompositeA" />
|
||||
</contribution>
|
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
-->
|
||||
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
|
||||
targetNamespace="http://scenario10"
|
||||
xmlns:tns="http://scenario10"
|
||||
name="CompositeA">
|
||||
|
||||
<service name="Service1" promote="ComponentB/Service2">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<reference name="reference1" promote="ComponentB/reference2">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
<reference name="reference1a" promote="ComponentB/reference2a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
|
||||
<component name="ComponentB">
|
||||
<implementation.composite name="tns:CompositeC" />
|
||||
<service name="Service2">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<service name="Service2a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<reference name="reference2">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
<reference name="reference2a" target="ComponentF">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
</component>
|
||||
|
||||
<component name="ComponentF">
|
||||
<implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
|
||||
<service name="Service3">
|
||||
<binding.sca />
|
||||
<binding.ws />
|
||||
</service>
|
||||
</component>
|
||||
</composite>
|
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
-->
|
||||
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
|
||||
targetNamespace="http://scenario10"
|
||||
xmlns:tns="http://scenario10"
|
||||
name="CompositeC">
|
||||
|
||||
<service name="Service2" promote="ComponentD/Service3">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<service name="Service2a" promote="ComponentD/Service3a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<reference name="reference2" promote="ComponentD/reference3">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
<reference name="reference2a" promote="ComponentD/reference3a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
<binding.ws />
|
||||
</reference>
|
||||
|
||||
<component name="ComponentD">
|
||||
<implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDReferenceMultiplicityImpl"/>
|
||||
<service name="Service3">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<service name="Service3a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
<binding.ws uri="http://foo.com/bar" />
|
||||
</service>
|
||||
<reference name="reference3" target="ComponentD/Service3a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
<binding.ws/>
|
||||
</reference>
|
||||
<reference name="reference3a" target="ComponentE">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
</component>
|
||||
|
||||
<component name="ComponentE">
|
||||
<implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
|
||||
<service name="Service3">
|
||||
<binding.sca />
|
||||
<binding.ws />
|
||||
</service>
|
||||
</component>
|
||||
</composite>
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
-->
|
||||
<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
|
||||
targetNamespace="http://scenario11"
|
||||
xmlns:ns11="http://scenario11">
|
||||
<deployable composite="ns11:CompositeA" />
|
||||
</contribution>
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
-->
|
||||
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
|
||||
targetNamespace="http://scenario11"
|
||||
xmlns:tns="http://scenario11"
|
||||
name="CompositeA">
|
||||
|
||||
<service name="Service1" promote="ComponentB/Service2">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<reference name="reference1" promote="ComponentB/reference2">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
<reference name="reference1a" promote="ComponentB/reference2a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
|
||||
<component name="ComponentB">
|
||||
<implementation.composite name="tns:CompositeC" />
|
||||
<service name="Service2">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<service name="Service2a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<reference name="reference2">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
<reference name="reference2a" target="ComponentF">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
<binding.ws />
|
||||
</reference>
|
||||
</component>
|
||||
|
||||
<component name="ComponentF">
|
||||
<implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
|
||||
<service name="Service3">
|
||||
<binding.sca />
|
||||
<binding.ws />
|
||||
</service>
|
||||
</component>
|
||||
</composite>
|
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
-->
|
||||
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
|
||||
targetNamespace="http://scenario11"
|
||||
xmlns:tns="http://scenario11"
|
||||
name="CompositeC">
|
||||
|
||||
<service name="Service2" promote="ComponentD/Service3">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<service name="Service2a" promote="ComponentD/Service3a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<reference name="reference2" promote="ComponentD/reference3">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
<reference name="reference2a" promote="ComponentD/reference3a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
|
||||
<component name="ComponentD">
|
||||
<implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDReferenceMultiplicityImpl"/>
|
||||
<service name="Service3">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<service name="Service3a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
<binding.ws uri="http://foo.com/bar" />
|
||||
</service>
|
||||
<reference name="reference3" target="ComponentD/Service3a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
<binding.ws/>
|
||||
</reference>
|
||||
<reference name="reference3a" target="ComponentE">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
</component>
|
||||
|
||||
<component name="ComponentE">
|
||||
<implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
|
||||
<service name="Service3">
|
||||
<binding.sca />
|
||||
<binding.ws />
|
||||
</service>
|
||||
</component>
|
||||
</composite>
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
-->
|
||||
<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
|
||||
targetNamespace="http://scenario12"
|
||||
xmlns:ns12="http://scenario12">
|
||||
<deployable composite="ns12:CompositeA" />
|
||||
</contribution>
|
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
-->
|
||||
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
|
||||
targetNamespace="http://scenario12"
|
||||
xmlns:tns="http://scenario12"
|
||||
name="CompositeA">
|
||||
|
||||
<service name="Service1" promote="ComponentB/Service2">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<reference name="reference1" promote="ComponentB/reference2">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
<reference name="reference1a" promote="ComponentB/reference2a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
|
||||
<component name="ComponentB">
|
||||
<implementation.composite name="tns:CompositeC" />
|
||||
<service name="Service2">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<service name="Service2a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<reference name="reference2">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
<reference name="reference2a" target="ComponentF">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
</component>
|
||||
|
||||
<component name="ComponentF">
|
||||
<implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
|
||||
<service name="Service3">
|
||||
<binding.sca />
|
||||
<binding.ws />
|
||||
</service>
|
||||
</component>
|
||||
</composite>
|
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
-->
|
||||
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
|
||||
targetNamespace="http://scenario12"
|
||||
xmlns:tns="http://scenario12"
|
||||
name="CompositeC">
|
||||
|
||||
<service name="Service2" promote="ComponentD/Service3">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<service name="Service2a" promote="ComponentD/Service3a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<reference name="reference2" promote="ComponentD/reference3">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
<reference name="reference2a" promote="ComponentD/reference3a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
|
||||
<component name="ComponentD">
|
||||
<implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDReferenceMultiplicityImpl"/>
|
||||
<service name="Service3">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<service name="Service3a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
<binding.ws uri="http://foo.com/bar" />
|
||||
</service>
|
||||
<reference name="reference3" target="ComponentD/Service3a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
<binding.ws/>
|
||||
</reference>
|
||||
<reference name="reference3a" target="ComponentE">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
</component>
|
||||
|
||||
<component name="ComponentE">
|
||||
<implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
|
||||
<service name="Service3">
|
||||
<binding.sca />
|
||||
<binding.ws />
|
||||
</service>
|
||||
</component>
|
||||
</composite>
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
-->
|
||||
<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
|
||||
targetNamespace="http://scenario9"
|
||||
xmlns:ns9="http://scenario9">
|
||||
<deployable composite="ns9:CompositeA" />
|
||||
</contribution>
|
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
-->
|
||||
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
|
||||
targetNamespace="http://scenario9"
|
||||
xmlns:tns="http://scenario9"
|
||||
name="CompositeA">
|
||||
|
||||
<service name="Service1" promote="ComponentB/Service2">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<reference name="reference1" promote="ComponentB/reference2">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
<reference name="reference1a" promote="ComponentB/reference2a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
|
||||
<component name="ComponentB">
|
||||
<implementation.composite name="tns:CompositeC" />
|
||||
<service name="Service2">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<service name="Service2a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<reference name="reference2">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
<reference name="reference2a" target="ComponentF">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
</component>
|
||||
|
||||
<component name="ComponentF">
|
||||
<implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
|
||||
<service name="Service3">
|
||||
<binding.sca />
|
||||
<binding.ws />
|
||||
</service>
|
||||
</component>
|
||||
</composite>
|
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
-->
|
||||
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
|
||||
targetNamespace="http://scenario9"
|
||||
xmlns:tns="http://scenario9"
|
||||
name="CompositeC">
|
||||
|
||||
<service name="Service2" promote="ComponentD/Service3">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<service name="Service2a" promote="ComponentD/Service3a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<reference name="reference2" promote="ComponentD/reference3">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
<reference name="reference2a" promote="ComponentD/reference3a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</reference>
|
||||
|
||||
<component name="ComponentD">
|
||||
<implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentDReferenceMultiplicityImpl"/>
|
||||
<service name="Service3">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
</service>
|
||||
<service name="Service3a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
<binding.ws uri="http://foo.com/bar" />
|
||||
</service>
|
||||
<reference name="reference3" target="ComponentD/Service3a">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
<binding.ws/>
|
||||
</reference>
|
||||
<reference name="reference3a" target="ComponentE">
|
||||
<!-- bindings and/or interfaces may or may not be specified explicitly here -->
|
||||
<binding.ws />
|
||||
</reference>
|
||||
</component>
|
||||
|
||||
<component name="ComponentE">
|
||||
<implementation.java class="org.apache.tuscany.sca.itest.builder.ComponentEImpl"/>
|
||||
<service name="Service3">
|
||||
<binding.sca />
|
||||
<binding.ws />
|
||||
</service>
|
||||
</component>
|
||||
</composite>
|
|
@ -28,6 +28,7 @@ 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.SCABinding;
|
||||
import org.apache.tuscany.sca.assembly.Service;
|
||||
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
|
||||
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
|
||||
|
@ -49,6 +50,7 @@ public class BuilderTestCase extends TestCase {
|
|||
protected void tearDown() throws Exception {
|
||||
}
|
||||
|
||||
|
||||
// Scenario 1: <binding.ws> on outer composite service CompositeA/Service1
|
||||
public void testScenario1() throws Exception {
|
||||
System.out.println("====>Running testScenario1");
|
||||
|
@ -690,4 +692,88 @@ public class BuilderTestCase extends TestCase {
|
|||
assert wsBinding.getWSDLDocument() == null;
|
||||
}
|
||||
|
||||
// Scenario 9: targets in references CDR1A and CBR2A and binding.ws at CDR3A
|
||||
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");
|
||||
WebServiceBinding wsBinding = null;
|
||||
for (ComponentReference reference : componentD.getReferences()) {
|
||||
if ("reference3a".equals(reference.getName())) {
|
||||
assertTrue(reference.getBindings().size() == 2);
|
||||
assertTrue(reference.getBindings().get(0) instanceof WebServiceBinding);
|
||||
assertTrue(reference.getBindings().get(1) instanceof WebServiceBinding);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Scenario 10: targets in references CDR1A and CBR2A and binding.ws at CCR2A
|
||||
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 CDR1A and CBR2A and binding.ws at CBR2A
|
||||
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");
|
||||
WebServiceBinding wsBinding = null;
|
||||
for (ComponentReference reference : componentD.getReferences()) {
|
||||
if ("reference3a".equals(reference.getName())) {
|
||||
assertTrue(reference.getBindings().size() == 2);
|
||||
assertTrue(reference.getBindings().get(0) instanceof SCABinding);
|
||||
assertTrue(reference.getBindings().get(1) instanceof WebServiceBinding);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Scenario 12: targets in references CDR1A and CBR2A and binding.ws at CAR1A
|
||||
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");
|
||||
WebServiceBinding wsBinding = null;
|
||||
for (ComponentReference reference : componentD.getReferences()) {
|
||||
if ("reference3a".equals(reference.getName())) {
|
||||
assertTrue(reference.getBindings().size() == 2);
|
||||
assertTrue(reference.getBindings().get(0) instanceof SCABinding);
|
||||
assertTrue(reference.getBindings().get(1) instanceof SCABinding);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.tuscany.sca.assembly.AssemblyFactory;
|
|||
import org.apache.tuscany.sca.assembly.Binding;
|
||||
import org.apache.tuscany.sca.assembly.ComponentReference;
|
||||
import org.apache.tuscany.sca.assembly.CompositeReference;
|
||||
import org.apache.tuscany.sca.assembly.Endpoint;
|
||||
import org.apache.tuscany.sca.assembly.Multiplicity;
|
||||
import org.apache.tuscany.sca.assembly.OptimizableBinding;
|
||||
import org.apache.tuscany.sca.assembly.Reference;
|
||||
|
@ -167,37 +168,57 @@ abstract class ReferenceConfigurationUtil {
|
|||
ComponentReference promotedReference,
|
||||
AssemblyFactory assemblyFactory,
|
||||
Monitor monitor) {
|
||||
List<Binding> bindings = new ArrayList<Binding>();
|
||||
|
||||
// collect the top level bindings first
|
||||
for (Binding binding : reference.getBindings()) {
|
||||
if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
|
||||
bindings.add(binding);
|
||||
}
|
||||
}
|
||||
|
||||
// if there are not top level bindings to override the promoted bindings
|
||||
// then collect the promoted bindings
|
||||
if (bindings.size() == 0){
|
||||
for (Binding binding : promotedReference.getBindings()) {
|
||||
if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
|
||||
bindings.add(binding);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// TUSCANY-2324: if bindings are being replaced, use the matching interface contract
|
||||
promotedReference.setInterfaceContract(reference.getInterfaceContract());
|
||||
}
|
||||
|
||||
promotedReference.getBindings().clear();
|
||||
promotedReference.getBindings().addAll(bindings);
|
||||
|
||||
|
||||
if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE ||
|
||||
promotedReference.getMultiplicity() == Multiplicity.ZERO_ONE) {
|
||||
|
||||
// if necessary override the promoted endpoints (and bindings) with the top level bindings
|
||||
if (reference.getBindings().size() > 0 ){
|
||||
|
||||
if (reference instanceof ComponentReference){
|
||||
promotedReference.getEndpoints().clear();
|
||||
promotedReference.getEndpoints().addAll(((ComponentReference)reference).getEndpoints());
|
||||
}
|
||||
|
||||
promotedReference.getBindings().clear();
|
||||
|
||||
for (Binding binding : reference.getBindings()) {
|
||||
if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
|
||||
promotedReference.getBindings().add(binding);
|
||||
|
||||
// TUSCANY-2324: ensure that the promoted reference can identify the
|
||||
// correct interface contract for this binding
|
||||
promotedReference.setInterfaceContract(reference.getInterfaceContract());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (promotedReference.getBindings().size() > 1) {
|
||||
warning(monitor, "ComponentReferenceMoreWire", promotedReference, promotedReference.getName());
|
||||
}
|
||||
} else {
|
||||
// if necessary merge the promoted endpoints (and bindings) with the top level bindings
|
||||
if (reference.getBindings().size() > 0 ){
|
||||
|
||||
if (reference instanceof ComponentReference){
|
||||
promotedReference.getEndpoints().addAll(((ComponentReference)reference).getEndpoints());
|
||||
}
|
||||
|
||||
for (Binding binding : reference.getBindings()) {
|
||||
if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
|
||||
promotedReference.getBindings().add(binding);
|
||||
|
||||
// TUSCANY-2324: ensure that the promoted reference can identify the
|
||||
// correct interface contract for this binding
|
||||
// TODO: no such interface exists yet!
|
||||
//promotedReference.setInterfaceContract(binding, reference.getInterfaceContract());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Set<Binding> callbackBindings = new HashSet<Binding>();
|
||||
if (promotedReference.getCallback() != null) {
|
||||
callbackBindings.addAll(promotedReference.getCallback().getBindings());
|
||||
|
|
Loading…
Add table
Reference in a new issue