You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2007/02/14 07:52:17 UTC
svn commit: r507423 - in
/incubator/tuscany/java/sca/integration-test/specTest/src:
main/java/org/apache/tuscany/sca/test/spec/
test/java/org/apache/tuscany/sca/test/spec/
Author: jboynes
Date: Tue Feb 13 22:52:16 2007
New Revision: 507423
URL: http://svn.apache.org/viewvc?view=rev&rev=507423
Log:
add integration test for ComponentContext#getServiceReference
Modified:
incubator/tuscany/java/sca/integration-test/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTester.java
incubator/tuscany/java/sca/integration-test/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTesterImpl.java
incubator/tuscany/java/sca/integration-test/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestComponent.java
Modified: incubator/tuscany/java/sca/integration-test/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTester.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/integration-test/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTester.java?view=diff&rev=507423&r1=507422&r2=507423
==============================================================================
--- incubator/tuscany/java/sca/integration-test/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTester.java (original)
+++ incubator/tuscany/java/sca/integration-test/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTester.java Tue Feb 13 22:52:16 2007
@@ -34,4 +34,12 @@
* @return the identity of the referenced component
*/
String getServiceIdentity(String name);
+
+ /**
+ * Looks up a reference with the supplied name using a ServiceReference
+ * and returns the identity of the referenced component.
+ * @param name the name of a reference
+ * @return the identity of the referenced component
+ */
+ String getServiceReferenceIdentity(String name);
}
Modified: incubator/tuscany/java/sca/integration-test/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTesterImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/integration-test/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTesterImpl.java?view=diff&rev=507423&r1=507422&r2=507423
==============================================================================
--- incubator/tuscany/java/sca/integration-test/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTesterImpl.java (original)
+++ incubator/tuscany/java/sca/integration-test/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTesterImpl.java Tue Feb 13 22:52:16 2007
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca.test.spec;
import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
import org.osoa.sca.annotations.Context;
import org.osoa.sca.annotations.Reference;
@@ -44,6 +45,12 @@
public String getServiceIdentity(String name) {
IdentityService service = context.getService(IdentityService.class, name);
+ return service.getURI();
+ }
+
+ public String getServiceReferenceIdentity(String name) {
+ ServiceReference<IdentityService> ref = context.getServiceReference(IdentityService.class, name);
+ IdentityService service = ref.getService();
return service.getURI();
}
}
Modified: incubator/tuscany/java/sca/integration-test/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/integration-test/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestComponent.java?view=diff&rev=507423&r1=507422&r2=507423
==============================================================================
--- incubator/tuscany/java/sca/integration-test/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestComponent.java (original)
+++ incubator/tuscany/java/sca/integration-test/specTest/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestComponent.java Tue Feb 13 22:52:16 2007
@@ -39,4 +39,9 @@
public void testGetService() {
assertEquals("itest://localhost/testDomain/ReferencedService", tester.getServiceIdentity("getServiceTest"));
}
+
+ public void testGetServiceReference() {
+ assertEquals("itest://localhost/testDomain/ReferencedService",
+ tester.getServiceReferenceIdentity("getServiceTest"));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org