diff options
Diffstat (limited to 'branches/sca-equinox/vtest/java-api/apis/componentcontext')
12 files changed, 0 insertions, 775 deletions
diff --git a/branches/sca-equinox/vtest/java-api/apis/componentcontext/pom.xml b/branches/sca-equinox/vtest/java-api/apis/componentcontext/pom.xml deleted file mode 100644 index 0b1941db0b..0000000000 --- a/branches/sca-equinox/vtest/java-api/apis/componentcontext/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ -<?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. ---> -<project> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>java-api-apis</artifactId> - <version>1.4-EQUINOX-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> - <artifactId>vtest-java-api-apis-componentcontext</artifactId> - <name>Apache Tuscany SCA Java APIs and Annotations Verification Tests - APIs - ComponentContext</name> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-embedded</artifactId> - <version>1.4-EQUINOX-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-java-runtime</artifactId> - <version>1.4-EQUINOX-SNAPSHOT</version> - <scope>runtime</scope> - </dependency> - </dependencies> -</project> diff --git a/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/AComponent.java b/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/AComponent.java deleted file mode 100644 index b2c8c07866..0000000000 --- a/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/AComponent.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BComponent.java b/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BComponent.java deleted file mode 100644 index 7e425c740f..0000000000 --- a/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BComponent.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BService.java b/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BService.java deleted file mode 100644 index eff7cc5a88..0000000000 --- a/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/BService.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.osoa.sca.annotations.Remotable; - -/** - * Simple Service B. - */ -@Remotable -public interface BService { - - String getBName(); - - String getSelfReferenceWithServiceName(); - -} diff --git a/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/CService.java b/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/CService.java deleted file mode 100644 index d0da012f6f..0000000000 --- a/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/CService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/DComponent.java b/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/DComponent.java deleted file mode 100644 index a221ba11fc..0000000000 --- a/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/DComponent.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.osoa.sca.annotations.Remotable; - -@Remotable -public interface DComponent { - - public String getName(); - -} diff --git a/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AComponentImpl.java b/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AComponentImpl.java deleted file mode 100644 index 606443a480..0000000000 --- a/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AComponentImpl.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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; - - @Reference - protected DComponent dReference; - - @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<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-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AUnannotatedComponentImpl.java b/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AUnannotatedComponentImpl.java deleted file mode 100644 index 34a71e1318..0000000000 --- a/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/AUnannotatedComponentImpl.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/BComponentImpl.java b/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/BComponentImpl.java deleted file mode 100644 index 71d2eade2b..0000000000 --- a/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/BComponentImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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<CService> cSR = componentContext.createSelfReference(CService.class, "CService"); - return cSR.getService().getCName(); - } - -} diff --git a/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/DComponentImpl.java b/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/DComponentImpl.java deleted file mode 100644 index 4b2c8c183b..0000000000 --- a/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/impl/DComponentImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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-equinox/vtest/java-api/apis/componentcontext/src/main/resources/ab.composite b/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/resources/ab.composite deleted file mode 100644 index 19f110d5dc..0000000000 --- a/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/main/resources/ab.composite +++ /dev/null @@ -1,47 +0,0 @@ -<?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" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://java-api-tests" - name="AB-Composite"> - - <component name="AComponent"> - <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.impl.AComponentImpl"/> - <reference name="bReference" target="BComponent/BService"/> - <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"/> - </component> - - <component name="DComponent"> - <implementation.java class="org.apache.tuscany.sca.vtest.javaapi.apis.componentcontext.impl.DComponentImpl"/> - </component> - -</composite> diff --git a/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java b/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java deleted file mode 100644 index 3f4150c64f..0000000000 --- a/branches/sca-equinox/vtest/java-api/apis/componentcontext/src/test/java/org/apache/tuscany/sca/vtest/javaapi/apis/componentcontext/ComponentContextTestCase.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * 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; - -import org.osoa.sca.ServiceRuntimeException; - -/** - * 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 AComponent aUnannotated; - 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"); - aUnannotated = ServiceFinder.getService(AComponent.class, "AUnannotatedComponent"); - 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 <br> - * 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()); - Assert.assertEquals("AUnannotatedComponent", aUnannotated.getContextURI()); - } - - /** - * Lines 778 <br> - * 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 <br> - * 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 <br> - * 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 <br> - * 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 <br> - * 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 <br> - * 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 <br> - * 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"; - } catch (ServiceRuntimeException sre) { - if (sre.getCause() instanceof IllegalArgumentException) { - check = "IllegalCast"; - } - } - Assert.assertEquals("IllegalCast", check); - } - - /** - * Lines 342-344 <br> - * 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 - */ - @Test - @Ignore("TUSCANY-2609") - public void testServiceLookup() throws Exception { - Assert.assertEquals("ComponentD", a.testServiceLookup()); - } - -} |