summaryrefslogtreecommitdiffstats
path: root/branches
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-08-31 13:09:18 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2008-08-31 13:09:18 +0000
commitbb3e993e62950b7907566d97bdc63c55d0fff38b (patch)
tree16b7e2106675f615330b7a104b3dbce7aa2f418e /branches
parentbcbd8cb0b78cf576d73a0140476b2996a36e5245 (diff)
TUSCANY-2501 - raise an error if the user tries to mix annotated and unannotated references in a component. Change the vtests and validation tests to take account of this change.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@690691 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches')
-rw-r--r--branches/sca-java-1.3.2/itest/validation/src/test/java/calculator/warning/ReferenceNotFoundTestCase.java30
-rw-r--r--branches/sca-java-1.3.2/itest/validation/src/test/java/domain/CustomCompositeBuilder.java14
-rw-r--r--branches/sca-java-1.3.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java2
-rw-r--r--branches/sca-java-1.3.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationIntrospector.java6
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java4
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java11
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AUnannotatedServiceImpl.java (renamed from branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AnotherAServiceImpl.java)16
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/resources/ab.composite7
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java20
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BService.java3
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/DComponent.java3
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AComponentImpl.java3
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AUnannotatedComponentImpl.java121
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/resources/ab.composite7
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java3
-rw-r--r--branches/sca-java-1.3.2/vtest/java-api/conversation/lifetime/src/main/resources/lifetime.composite1
16 files changed, 224 insertions, 27 deletions
diff --git a/branches/sca-java-1.3.2/itest/validation/src/test/java/calculator/warning/ReferenceNotFoundTestCase.java b/branches/sca-java-1.3.2/itest/validation/src/test/java/calculator/warning/ReferenceNotFoundTestCase.java
index 4856ba507f..ed70839dcf 100644
--- a/branches/sca-java-1.3.2/itest/validation/src/test/java/calculator/warning/ReferenceNotFoundTestCase.java
+++ b/branches/sca-java-1.3.2/itest/validation/src/test/java/calculator/warning/ReferenceNotFoundTestCase.java
@@ -30,38 +30,38 @@ import org.apache.tuscany.sca.monitor.Problem;
import org.apache.tuscany.sca.monitor.logging.impl.DefaultLoggingMonitorImpl;
import org.apache.tuscany.sca.node.SCAClient;
import org.apache.tuscany.sca.node.SCAContribution;
-import org.apache.tuscany.sca.node.SCANode2;
-import org.apache.tuscany.sca.node.SCANode2Factory;
import org.apache.tuscany.sca.node.impl.NodeImpl;
+import domain.CustomCompositeBuilder;
+
/**
* This shows how to test the Calculator service component.
*/
public class ReferenceNotFoundTestCase extends TestCase {
- private CalculatorService calculatorService;
- private SCANode2 node;
+ private CustomCompositeBuilder customDomain;
@Override
protected void setUp() throws Exception {
- SCANode2Factory nodeFactory = SCANode2Factory.newInstance();
- node = nodeFactory.createSCANode(new File("src/main/resources/ReferenceNotFound/Calculator.composite").toURL().toString(),
- new SCAContribution("TestContribution",
- new File("src/main/resources/ReferenceNotFound").toURL().toString()));
- node.start();
- calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent");
+ customDomain = CustomCompositeBuilder.getInstance();
+ try {
+ customDomain.loadContribution("src/main/resources/ReferenceNotFound/Calculator.composite",
+ "TestContribution",
+ "src/main/resources/ReferenceNotFound/");
+ customDomain.buildContribution();
+ } catch (Exception ex){
+ throw ex;
+ }
+
}
@Override
protected void tearDown() throws Exception {
- node.stop();
+ //node.stop();
}
public void testCalculator() throws Exception {
- ExtensionPointRegistry registry = ((NodeImpl)node).getExtensionPointRegistry();
- UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- Monitor monitor = monitorFactory.createMonitor();
+ Monitor monitor = customDomain.getMonitorInstance();
Problem problem = ((DefaultLoggingMonitorImpl)monitor).getLastLoggedProblem();
assertNotNull(problem);
diff --git a/branches/sca-java-1.3.2/itest/validation/src/test/java/domain/CustomCompositeBuilder.java b/branches/sca-java-1.3.2/itest/validation/src/test/java/domain/CustomCompositeBuilder.java
index 9ad5407ed6..dc82e55cd0 100644
--- a/branches/sca-java-1.3.2/itest/validation/src/test/java/domain/CustomCompositeBuilder.java
+++ b/branches/sca-java-1.3.2/itest/validation/src/test/java/domain/CustomCompositeBuilder.java
@@ -27,10 +27,12 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.SCABindingFactory;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
@@ -189,6 +191,18 @@ public class CustomCompositeBuilder {
return monitor;
}
+ public void buildContribution() throws Exception {
+ // Create a composite model for the domain
+ Composite domainComposite = assemblyFactory.createComposite();
+ domainComposite.setName(new QName("http://customdomain", "domain"));
+
+ // Add all deployables to it, normally the domain administrator would select
+ // the deployables to include
+ domainComposite.getIncludes().addAll(workspace.getDeployables());
+
+ // Build the domain composite and wire the components included in it
+ domainCompositeBuilder.build(domainComposite);
+ }
public void readContribution(String compositeURL, String sourceURI, String sourceURL) throws Exception {
init();
diff --git a/branches/sca-java-1.3.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java b/branches/sca-java-1.3.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
index 648977792a..b6e404a2a5 100644
--- a/branches/sca-java-1.3.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
+++ b/branches/sca-java-1.3.2/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
@@ -446,7 +446,7 @@ public abstract class BaseConfigurationBuilderImpl {
componentReference.setReference(reference);
} else {
if (!componentReference.getName().startsWith("$self$.")) {
- warning("ReferenceNotFound", component, component.getName(), componentReference.getName());
+ error("ReferenceNotFound", component, component.getName(), componentReference.getName());
}
}
}
diff --git a/branches/sca-java-1.3.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationIntrospector.java b/branches/sca-java-1.3.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationIntrospector.java
index eed0d6871b..abe00bac5b 100644
--- a/branches/sca-java-1.3.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationIntrospector.java
+++ b/branches/sca-java-1.3.2/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationIntrospector.java
@@ -130,8 +130,10 @@ class WidgetImplementationIntrospector {
String referenceName = null;
String tokens[] = scriptContent.split("=");
- tokens = tokens[0].split(" ");
- referenceName = tokens[tokens.length -1];
+
+ // find the string between the quotes
+ tokens = tokens[1].split("\"");
+ referenceName = tokens[1];
if(referenceName != null) {
reference = assemblyFactory.createReference();
diff --git a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java
index 3322b542a9..b28704a3b4 100644
--- a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java
+++ b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/AService.java
@@ -48,4 +48,8 @@ public interface AService {
public boolean isB7SetterCalled();
public boolean isB16Null();
public boolean isB17Null();
+
+ public boolean isB4Null();
+ public boolean isB5Null();
+ public boolean isB6Null();
}
diff --git a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java
index 916ee25d7a..67299d322d 100644
--- a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java
+++ b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AServiceImpl.java
@@ -201,4 +201,15 @@ public class AServiceImpl implements AService {
return b17 == null;
}
+ public boolean isB4Null() {
+ return b4 == null;
+ }
+
+ public boolean isB5Null() {
+ return b5 == null;
+ }
+
+ public boolean isB6Null() {
+ return b6 == null;
+ }
}
diff --git a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AnotherAServiceImpl.java b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AUnannotatedServiceImpl.java
index 82cd8014cd..a819dfd87d 100644
--- a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AnotherAServiceImpl.java
+++ b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/impl/AUnannotatedServiceImpl.java
@@ -24,7 +24,7 @@ import org.apache.tuscany.sca.vtest.javaapi.annotations.reference.BService;
import org.osoa.sca.annotations.Service;
@Service(AService.class)
-public class AnotherAServiceImpl implements AService {
+public class AUnannotatedServiceImpl implements AService {
public BService b4; // field injection (public, un-annotated)
@@ -32,7 +32,7 @@ public class AnotherAServiceImpl implements AService {
public BService b6; // setter injection (public, un-annotated)
- public AnotherAServiceImpl() {
+ public AUnannotatedServiceImpl() {
}
public String getName() {
@@ -126,4 +126,16 @@ public class AnotherAServiceImpl implements AService {
public boolean isB17Null() {
return true;
}
+
+ public boolean isB4Null() {
+ return b4 == null;
+ }
+
+ public boolean isB5Null() {
+ return b5 == null;
+ }
+
+ public boolean isB6Null() {
+ return b6 == null;
+ }
}
diff --git a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/resources/ab.composite b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/resources/ab.composite
index 9937173894..b4ad1e77d5 100644
--- a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/resources/ab.composite
+++ b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/main/resources/ab.composite
@@ -26,9 +26,6 @@
<reference name="b1" target="BComponent"/>
<reference name="b2" target="BComponent"/>
<reference name="b3" target="BComponent"/>
- <reference name="b4" target="BComponent"/>
- <reference name="b5" target="BComponent"/>
- <reference name="b6" target="BComponent"/>
<reference name="b7" target="BComponent"/>
<reference name="b8" target="BComponent"/>
<reference name="b9" target="BComponent"/>
@@ -40,8 +37,8 @@
<reference name="b15" multiplicity="1..n" target="BComponent BComponent"/>
</component>
- <component name="AnotherAComponent">
- <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl.AnotherAServiceImpl"/>
+ <component name="AUnannotatedComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.annotations.reference.impl.AUnannotatedServiceImpl"/>
<reference name="b4" target="BComponent"/>
<reference name="b5" target="BComponent"/>
<reference name="b6" target="BComponent"/>
diff --git a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java
index a399d892cb..1fe50b4ea7 100644
--- a/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java
+++ b/branches/sca-java-1.3.2/vtest/java-api/annotations/reference/src/test/java/org/apache/tuscany/sca/vtest/javaapi/annotations/reference/ReferenceAnnotationTestCase.java
@@ -110,7 +110,12 @@ public class ReferenceAnnotationTestCase {
*/
@Test
public void atReference2() throws Exception {
- AService anotherA = ServiceFinder.getService(AService.class, "AnotherAComponent");
+ AService anotherA = ServiceFinder.getService(AService.class, "AUnannotatedComponent");
+
+ Assert.assertFalse(anotherA.isB4Null());
+ Assert.assertTrue(anotherA.isB5Null());
+ Assert.assertFalse(anotherA.isB6Null());
+
Assert.assertEquals("BService", anotherA.getB4Name());
try {
anotherA.getB5Name();
@@ -208,4 +213,17 @@ public class ReferenceAnnotationTestCase {
Assert.assertTrue(a.isB16Null());
Assert.assertTrue(a.isB17Null());
}
+
+ /**
+ * Java Component Implementation Spec
+ * Section 1.2.7
+ * Line 361 when @Property and @Reference annotations are present
+ * then unannotated fields are ignored
+ */
+ @Test
+ public void atReference8() throws Exception {
+ Assert.assertTrue(a.isB4Null());
+ Assert.assertTrue(a.isB5Null());
+ Assert.assertTrue(a.isB6Null());
+ }
}
diff --git a/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BService.java b/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BService.java
index 255d91e168..eff7cc5a88 100644
--- a/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BService.java
+++ b/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BService.java
@@ -19,9 +19,12 @@
package org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext;
+import org.osoa.sca.annotations.Remotable;
+
/**
* Simple Service B.
*/
+@Remotable
public interface BService {
String getBName();
diff --git a/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/DComponent.java b/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/DComponent.java
index 597dca0ea5..a221ba11fc 100644
--- a/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/DComponent.java
+++ b/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/DComponent.java
@@ -19,6 +19,9 @@
package org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
public interface DComponent {
public String getName();
diff --git a/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AComponentImpl.java b/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AComponentImpl.java
index 318b6ae0dd..606443a480 100644
--- a/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AComponentImpl.java
+++ b/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AComponentImpl.java
@@ -45,6 +45,9 @@ public class AComponentImpl implements AComponent {
@Reference
protected BService bReference;
+
+ @Reference
+ protected DComponent dReference;
@Property(name="aProperty", required=true)
protected String aProperty;
diff --git a/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AUnannotatedComponentImpl.java b/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AUnannotatedComponentImpl.java
new file mode 100644
index 0000000000..34a71e1318
--- /dev/null
+++ b/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AUnannotatedComponentImpl.java
@@ -0,0 +1,121 @@
+/*
+ * 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.vtest.javaapi.apis.componentcontext.impl;
+
+import org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.AComponent;
+import org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.BService;
+import org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.DComponent;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(AComponent.class)
+@Scope("COMPOSITE")
+@EagerInit
+public class AUnannotatedComponentImpl implements AComponent {
+
+ public static String rcContent = null;
+
+ protected ComponentContext componentContext;
+
+ protected BService bReference;
+
+ protected DComponent dReference;
+
+ protected String aProperty;
+
+ public String getName() {
+ return "ComponentA";
+ }
+
+ @Context
+ public void setComponentContext(ComponentContext context) {
+ this.componentContext = context;
+ }
+
+ @Init
+ public void init() {
+ RequestContext rc = componentContext.getRequestContext();
+ if (rc != null) {
+ rcContent = "NotNull";
+ } else {
+ rcContent = "Null";
+ }
+ }
+
+ public String getContextURI() {
+ return componentContext.getURI();
+ }
+
+ public String getServiceBName() {
+ return componentContext.getService(BService.class, "bReference").getBName();
+ }
+
+ public String getServiceReferenceBName() {
+ ServiceReference<BService> bSR = componentContext.getServiceReference(BService.class, "bReference");
+ return bSR.getService().getBName();
+ }
+
+ public String getSelfReferenceName() {
+ ServiceReference<AComponent> aSR = componentContext.createSelfReference(AComponent.class);
+ return aSR.getService().getName();
+ }
+
+ public String getProperty() {
+ return componentContext.getProperty(String.class, "aProperty");
+ }
+
+ public String getRequestContextServiceName() {
+ return componentContext.getRequestContext().getServiceName();
+ }
+
+ public String getCastCallableReferenceServiceName() {
+ BService b = componentContext.getService(BService.class, "bReference");
+ CallableReference<BService> bCR = componentContext.cast(b);
+ return bCR.getService().getBName();
+ }
+
+ public String getCastServiceReferenceServiceName() {
+ BService b = componentContext.getService(BService.class, "bReference");
+ ServiceReference<BService> bSR = componentContext.cast(b);
+ return bSR.getService().getBName();
+ }
+
+ public void illegalCast() {
+ componentContext.cast("");
+ }
+
+ public String testServiceLookup() {
+ return componentContext.getService(DComponent.class, "dReference").getName();
+ }
+
+ public String getRequestContextContent() {
+ return rcContent;
+ }
+
+}
diff --git a/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/resources/ab.composite b/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/resources/ab.composite
index 695922e9ec..19f110d5dc 100644
--- a/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/resources/ab.composite
+++ b/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/resources/ab.composite
@@ -28,6 +28,13 @@
<reference name="dReference" target="DComponent"/>
<property name="aProperty" type="xsd:string">PropertyA</property>
</component>
+
+ <component name="AUnannotatedComponent">
+ <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.impl.AUnannotatedComponentImpl"/>
+ <reference name="bReference" target="BComponent/BService"/>
+ <reference name="dReference" target="DComponent"/>
+ <property name="aProperty" type="xsd:string">PropertyA</property>
+ </component>
<component name="BComponent">
<implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.impl.BComponentImpl"/>
diff --git a/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java b/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java
index 5f39638e5c..9bfe0c06e7 100644
--- a/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java
+++ b/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java
@@ -35,6 +35,7 @@ public class ComponentContextTestCase {
protected static String compositeName = "ab.composite";
protected static AComponent a;
+ protected static AComponent aUnannotated;
protected static BService b;
@BeforeClass
@@ -43,6 +44,7 @@ public class ComponentContextTestCase {
System.out.println("Setting up");
ServiceFinder.init(compositeName);
a = ServiceFinder.getService(AComponent.class, "AComponent");
+ aUnannotated = ServiceFinder.getService(AComponent.class, "AUnannotatedComponent");
b = ServiceFinder.getService(BService.class, "BComponent/BService");
} catch (Exception e) {
e.printStackTrace();
@@ -65,6 +67,7 @@ public class ComponentContextTestCase {
@Test
public void testGetURI() throws Exception {
Assert.assertEquals("AComponent", a.getContextURI());
+ Assert.assertEquals("AUnannotatedComponent", aUnannotated.getContextURI());
}
/**
diff --git a/branches/sca-java-1.3.2/vtest/java-api/conversation/lifetime/src/main/resources/lifetime.composite b/branches/sca-java-1.3.2/vtest/java-api/conversation/lifetime/src/main/resources/lifetime.composite
index 6e6c08c185..21ee8acac1 100644
--- a/branches/sca-java-1.3.2/vtest/java-api/conversation/lifetime/src/main/resources/lifetime.composite
+++ b/branches/sca-java-1.3.2/vtest/java-api/conversation/lifetime/src/main/resources/lifetime.composite
@@ -24,7 +24,6 @@
<implementation.java
class="org.apache.tuscany.sca.vtest.javaapi.conversation.lifetime.impl.AServiceImpl" />
<reference name="b" target="BComponent" />
- <reference name="c" target="CComponent" />
<reference name="d" target="DComponent" />
</component>