From 7d34713fecd6b842bb4abd78f3bbc5bac6dad3bf Mon Sep 17 00:00:00 2001 From: slaws Date: Fri, 29 Aug 2008 08:31:14 +0000 Subject: Branch for 1.3.2 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@690149 13f79535-47bb-0310-9956-ffa450edef68 --- .../javaapi/apis/componentcontext/AComponent.java | 42 +++++ .../javaapi/apis/componentcontext/BComponent.java | 29 ++++ .../javaapi/apis/componentcontext/BService.java | 31 ++++ .../javaapi/apis/componentcontext/CService.java | 29 ++++ .../javaapi/apis/componentcontext/DComponent.java | 26 +++ .../apis/componentcontext/impl/AComponentImpl.java | 121 ++++++++++++++ .../apis/componentcontext/impl/BComponentImpl.java | 52 ++++++ .../apis/componentcontext/impl/DComponentImpl.java | 32 ++++ .../src/main/resources/ab.composite | 40 +++++ .../componentcontext/ComponentContextTestCase.java | 181 +++++++++++++++++++++ 10 files changed, 583 insertions(+) create mode 100644 branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/AComponent.java create mode 100644 branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BComponent.java create mode 100644 branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BService.java create mode 100644 branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/CService.java create mode 100644 branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/DComponent.java create mode 100644 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 create mode 100644 branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/BComponentImpl.java create mode 100644 branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/DComponentImpl.java create mode 100644 branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/resources/ab.composite create mode 100644 branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java (limited to 'branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src') 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/AComponent.java b/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/AComponent.java new file mode 100644 index 0000000000..b2c8c07866 --- /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/AComponent.java @@ -0,0 +1,42 @@ +/* + * 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; + +/** + * Simple Service A. + */ +public interface AComponent { + + public String getName(); + + public String getContextURI(); + public String getServiceBName(); + public String getServiceReferenceBName(); + public String getSelfReferenceName(); + public String getProperty(); + public String getRequestContextServiceName(); + public String getCastCallableReferenceServiceName(); + public String getCastServiceReferenceServiceName(); + public void illegalCast(); + + public String testServiceLookup(); + public String getRequestContextContent(); + +} 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/BComponent.java b/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BComponent.java new file mode 100644 index 0000000000..7e425c740f --- /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/BComponent.java @@ -0,0 +1,29 @@ +/* + * 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; + +/** + * Simple Service B. + */ +public interface BComponent { + + 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/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 new file mode 100644 index 0000000000..255d91e168 --- /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/BService.java @@ -0,0 +1,31 @@ +/* + * 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; + +/** + * Simple Service B. + */ +public interface BService { + + String getBName(); + + String getSelfReferenceWithServiceName(); + +} 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/CService.java b/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/CService.java new file mode 100644 index 0000000000..d0da012f6f --- /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/CService.java @@ -0,0 +1,29 @@ +/* + * 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; + +/** + * Simple Service C. + */ +public interface CService { + + String getCName(); + +} 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 new file mode 100644 index 0000000000..597dca0ea5 --- /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/DComponent.java @@ -0,0 +1,26 @@ +/* + * 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; + +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 new file mode 100644 index 0000000000..318b6ae0dd --- /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/AComponentImpl.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 AComponentImpl implements AComponent { + + public static String rcContent = null; + + protected ComponentContext componentContext; + + @Reference + protected BService bReference; + + @Property(name="aProperty", required=true) + 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 bSR = componentContext.getServiceReference(BService.class, "bReference"); + return bSR.getService().getBName(); + } + + public String getSelfReferenceName() { + ServiceReference 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 bCR = componentContext.cast(b); + return bCR.getService().getBName(); + } + + public String getCastServiceReferenceServiceName() { + BService b = componentContext.getService(BService.class, "bReference"); + ServiceReference 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/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/BComponentImpl.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/BComponentImpl.java new file mode 100644 index 0000000000..71d2eade2b --- /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/BComponentImpl.java @@ -0,0 +1,52 @@ +/* + * 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.BService; +import org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.CService; +import org.osoa.sca.ComponentContext; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Service; + +@Service(interfaces={BService.class, CService.class}) +public class BComponentImpl implements BService, CService { + + protected ComponentContext componentContext; + + @Context + public void setComponentContext(ComponentContext context) { + this.componentContext = context; + } + + public String getBName() { + return "ServiceB"; + } + + public String getCName() { + return "ServiceC"; + } + + public String getSelfReferenceWithServiceName() { + ServiceReference cSR = componentContext.createSelfReference(CService.class, "CService"); + return cSR.getService().getCName(); + } + +} 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/DComponentImpl.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/DComponentImpl.java new file mode 100644 index 0000000000..4b2c8c183b --- /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/DComponentImpl.java @@ -0,0 +1,32 @@ +/* + * 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.DComponent; +import org.osoa.sca.annotations.Service; + +@Service(DComponent.class) +public class DComponentImpl implements DComponent { + + public String getName() { + return "ComponentD"; + } + +} 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 new file mode 100644 index 0000000000..695922e9ec --- /dev/null +++ b/branches/sca-java-1.3.2/vtest/java-api/apis/componentcontext/src/main/resources/ab.composite @@ -0,0 +1,40 @@ + + + + + + + + + PropertyA + + + + + + + + + + + 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 new file mode 100644 index 0000000000..5f39638e5c --- /dev/null +++ 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 @@ -0,0 +1,181 @@ +/* + * 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; + +import org.apache.tuscany.sca.vtest.utilities.ServiceFinder; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +/** + * This test class tests the ComponentContext interface described in 1.7.1 of + * the SCA Java Annotations & APIs Specification 1.0. Relevant sections of 1.4 + * will also be covered here. + */ +public class ComponentContextTestCase { + + protected static String compositeName = "ab.composite"; + protected static AComponent a; + protected static BService b; + + @BeforeClass + public static void init() throws Exception { + try { + System.out.println("Setting up"); + ServiceFinder.init(compositeName); + a = ServiceFinder.getService(AComponent.class, "AComponent"); + b = ServiceFinder.getService(BService.class, "BComponent/BService"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @AfterClass + public static void destroy() throws Exception { + System.out.println("Cleaning up"); + ServiceFinder.cleanup(); + } + + /** + * Lines 776
+ * getURI() - Returns the absolute URI of the component within the SCA + * domain. + * + * @throws Exception + */ + @Test + public void testGetURI() throws Exception { + Assert.assertEquals("AComponent", a.getContextURI()); + } + + /** + * Lines 778
+ * getService(Class<B> businessInterface, String referenceName) ? + * Returns a proxy for the reference defined by the current component. + * + * @throws Exception + */ + @Test + public void testGetService() throws Exception { + Assert.assertEquals(a.getServiceBName(), "ServiceB"); + } + + /** + * Lines 780
+ * getServiceReference(Class<B> businessInterface, String + * referenceName) ? Returns a ServiceReference defined by the current + * component. + * + * @throws Exception + */ + @Test + public void testGetServiceReference() throws Exception { + Assert.assertEquals(a.getServiceReferenceBName(), "ServiceB"); + } + + /** + * Lines 783
+ * createSelfReference(Class<B> businessInterface) ? Returns a + * ServiceReference that can be used to invoke this component over the + * designated service. + * + * @throws Exception + */ + @Test + public void testCreateSelfReference() throws Exception { + Assert.assertEquals(a.getSelfReferenceName(), "ComponentA"); + } + + /** + * Lines 785
+ * getSelfReference(Class<B> businessInterface, String serviceName) - + * Returns a ServiceReference that can be used to invoke this component over + * the designated service. Service name explicitly declares the service name + * to invoke. + * + * @throws Exception + */ + @Test + public void testCreateSelfReferenceWithServiceName() throws Exception { + Assert.assertEquals("ServiceC", b.getSelfReferenceWithServiceName()); + } + + /** + * Lines 788
+ * getProperty (Class<B> type, String propertyName) - Returns the + * value of an SCA property defined by this component. + * + * @throws Exception + */ + @Test + public void testGetProperty() throws Exception { + Assert.assertEquals("PropertyA", a.getProperty()); + } + + /** + * Lines 793
+ * getRequestContext() - Returns the context for the current SCA service + * request, or null if there is no current request or if the context is + * unavailable. + * + * @throws Exception + */ + @Test + public void testGetRequestContext() throws Exception { + Assert.assertEquals("AComponent", a.getRequestContextServiceName()); + Assert.assertEquals("NotNull", a.getRequestContextContent()); + } + + /** + * Lines 790,794
+ * cast(B target) - Casts a type-safe reference to a CallableReference. + * + * @throws Exception + */ + @Test + public void testCast() throws Exception { + Assert.assertEquals("ServiceB", a.getCastCallableReferenceServiceName()); + Assert.assertEquals("ServiceB", a.getCastServiceReferenceServiceName()); + + String check = ""; + try { + a.illegalCast(); + } catch (IllegalArgumentException iae) { + check = "IllegalCast"; + } + Assert.assertEquals("IllegalCast", check); + } + + /** + * Lines 342-344
+ * When a component implementation needs access to a service where the + * reference to the service is not known at compile time, the reference can + * be located using the component?s ComponentContext. + * + * @throws Exception + */ + @Ignore + public void testServiceLookup() throws Exception { + Assert.assertEquals("ComponentD", a.testServiceLookup()); + } + +} -- cgit v1.2.3