You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2008/03/07 11:55:33 UTC
svn commit: r634608 - in /incubator/tuscany/java/sca:
itest/recursive/src/main/resources/test1/
itest/recursive/src/test/java/test1/composite/
modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/
Author: slaws
Date: Fri Mar 7 02:55:32 2008
New Revision: 634608
URL: http://svn.apache.org/viewvc?rev=634608&view=rev
Log:
TUSCANY-2010. Don't over re-process bindings that belong to services promoted from composite implementations. This gets rid of a problem where repeated component names appear in the calculated binding URI.
Modified:
incubator/tuscany/java/sca/itest/recursive/src/main/resources/test1/OuterComposite.composite
incubator/tuscany/java/sca/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
Modified: incubator/tuscany/java/sca/itest/recursive/src/main/resources/test1/OuterComposite.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/main/resources/test1/OuterComposite.composite?rev=634608&r1=634607&r2=634608&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/main/resources/test1/OuterComposite.composite (original)
+++ incubator/tuscany/java/sca/itest/recursive/src/main/resources/test1/OuterComposite.composite Fri Mar 7 02:55:32 2008
@@ -21,7 +21,7 @@
targetNamespace="http://sample1"
xmlns:sample1="http://sample1"
name="OuterComposite">
- <component name="TargetComponent">
+ <component name="Test1TargetComponent">
<implementation.composite name="sample1:InnerComposite"/>
</component>
</composite>
Modified: incubator/tuscany/java/sca/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java?rev=634608&r1=634607&r2=634608&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java (original)
+++ incubator/tuscany/java/sca/itest/recursive/src/test/java/test1/composite/CompositeClientTestCase.java Fri Mar 7 02:55:32 2008
@@ -23,16 +23,42 @@
import org.apache.tuscany.sca.host.embedded.SCADomain;
+import test.Aggregator;
+
/**
* Simple client program that invokes the components that we wired together.
*/
public class CompositeClientTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private Target target;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("test1/OuterComposite.composite");
+ target = scaDomain.getService(Target.class, "Test1TargetComponent/Service_Two");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
public void testComposite() throws Exception {
- SCADomain scaDomain = SCADomain.newInstance("test1/OuterComposite.composite");
- Target target = scaDomain.getService(Target.class, "TargetComponent/Service_Two");
String res = target.hello("Wang Feng");
assertEquals("TargetTwo: Hello Wang Feng!", res);
- scaDomain.close();
+ }
+
+ // Test for problem in TUSCANY-2010
+ public void testURLs() throws Exception {
+ try {
+ System.out.println("Component URI: " + scaDomain.getComponentManager().getComponent("Test1TargetComponent").getURI());
+ System.out.println(" Service Name: " + scaDomain.getComponentManager().getComponent("Test1TargetComponent").getServices().get(0).getName());
+ System.out.println(" Binding Name: " + scaDomain.getComponentManager().getComponent("Test1TargetComponent").getServices().get(0).getBindings().get(0).getName());
+ System.out.println(" Binding URI: " + scaDomain.getComponentManager().getComponent("Test1TargetComponent").getServices().get(0).getBindings().get(0).getURI());
+ assertEquals("Test1TargetComponent/Service_One", scaDomain.getComponentManager().getComponent("Test1TargetComponent").getServices().get(0).getBindings().get(0).getURI());
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
}
}
Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java?rev=634608&r1=634607&r2=634608&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java (original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeConfigurationBuilderImpl.java Fri Mar 7 02:55:32 2008
@@ -295,7 +295,14 @@
} else {
// Combine the specified binding URI with the component URI
bindingURI = binding.getURI();
- bindingURI = URI.create(component.getURI() + '/').resolve(bindingURI).toString();
+
+ // if this binding comes from a composite service then the URI will already be set
+ // otherwise we need to set it relative to the component URI. We can tell by looking
+ // if this binding is the same as the one on the component type service
+ if ((componentService.getService() != null)&&
+ (!componentService.getService().getBindings().contains(binding))){
+ bindingURI = URI.create(component.getURI() + '/').resolve(bindingURI).toString();
+ }
}
binding.setURI(bindingURI);
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org