diff options
Diffstat (limited to 'branches/sca-java-1.x/itest/contribution-jee')
5 files changed, 131 insertions, 5 deletions
diff --git a/branches/sca-java-1.x/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProvider.java b/branches/sca-java-1.x/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProvider.java new file mode 100644 index 0000000000..e7e1d90797 --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProvider.java @@ -0,0 +1,48 @@ +/* + * 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.test.contribution.jee; + +import org.apache.tuscany.sca.implementation.ejb.EJBImplementation; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.provider.ImplementationProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + + +class TestEJBImplementationProvider implements ImplementationProvider { + + TestEJBImplementationProvider(RuntimeComponent component, EJBImplementation ejbImplementation) { + } + + public Invoker createInvoker(RuntimeComponentService service, Operation operation) { + return null; + } + + public boolean supportsOneWayInvocation() { + return false; + } + + public void start() { + } + + public void stop() { + } + +} diff --git a/branches/sca-java-1.x/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProviderFactory.java b/branches/sca-java-1.x/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProviderFactory.java new file mode 100644 index 0000000000..4660fee7fd --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee/src/main/java/org/apache/tuscany/sca/test/contribution/jee/TestEJBImplementationProviderFactory.java @@ -0,0 +1,47 @@ +/* + * 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.test.contribution.jee; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.implementation.ejb.EJBImplementation; +import org.apache.tuscany.sca.provider.ImplementationProvider; +import org.apache.tuscany.sca.provider.ImplementationProviderFactory; +import org.apache.tuscany.sca.runtime.RuntimeComponent; + +/** + * A factory for resource implementation providers. + * + * @version $Rev$ $Date$ + */ +public class TestEJBImplementationProviderFactory implements ImplementationProviderFactory<EJBImplementation> { + + /** + * Constructs a resource implementation. + */ + public TestEJBImplementationProviderFactory(ExtensionPointRegistry extensionPoints) { + } + + public ImplementationProvider createImplementationProvider(RuntimeComponent component, EJBImplementation implementation) { + return new TestEJBImplementationProvider(component, implementation); + } + + public Class<EJBImplementation> getModelType() { + return EJBImplementation.class; + } +} diff --git a/branches/sca-java-1.x/itest/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/branches/sca-java-1.x/itest/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory new file mode 100644 index 0000000000..adc93d9015 --- /dev/null +++ b/branches/sca-java-1.x/itest/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory @@ -0,0 +1,19 @@ +# 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.
+
+# Implementation class for the implementation extension
+org.apache.tuscany.sca.test.contribution.jee.TestEJBImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.ejb.EJBImplementation
diff --git a/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarAppcompTestCase.java b/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarAppcompTestCase.java index d9c0e857b7..4d704162ef 100644 --- a/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarAppcompTestCase.java +++ b/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarAppcompTestCase.java @@ -52,6 +52,8 @@ import org.junit.Before; import org.junit.Ignore; import org.junit.Test; +import sample.pojo.HelloworldClient2; + public class SCAJarEarAppcompTestCase { @@ -82,7 +84,7 @@ public class SCAJarEarAppcompTestCase { * */ @Test - public void testSCAJarEarNonenhanced() throws Exception { + public void testSCAJarEarAppcomp() throws Exception { URL contributionLocation = new File("../contribution-jee-samples/scajar-ear-appcomp/target/itest-contribution-jee-samples-41-scajar-ear-appcomp.jar").toURL(); Contribution contribution = contributionService.contribute(CONTRIBUTION_001_ID, contributionLocation, false); @@ -98,14 +100,24 @@ public class SCAJarEarAppcompTestCase { Assert.assertNotNull(composite); - Assert.assertEquals(2, composite.getComponents().size()); - Assert.assertEquals(1, composite.getComponents().get(1).getImplementation().getServices().size()); + domain.getDomainComposite().getIncludes().add(composite); + + Assert.assertEquals(3, composite.getComponents().size()); + Assert.assertEquals(2, composite.getComponents().get(1).getImplementation().getServices().size()); Assert.assertEquals("TheService", composite.getComponents().get(1).getImplementation().getServices().get(0).getName()); domain.buildComposite(composite); // assert that the build process has worked Assert.assertNotNull(composite); + + domain.getCompositeActivator().activate(composite); + domain.getCompositeActivator().start(composite); + + HelloworldClient2 client = domain.getService(HelloworldClient2.class, "HelloworldClientComponent"); + Assert.assertEquals("Hello Fred", client.getGreetings("Fred")); + + domain.stop(); } diff --git a/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarNonenhancedTestCase.java b/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarNonenhancedTestCase.java index 0a527b6bda..334f5eca1b 100644 --- a/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarNonenhancedTestCase.java +++ b/branches/sca-java-1.x/itest/contribution-jee/src/test/java/org/apache/tuscany/sca/test/contribution/jee/SCAJarEarNonenhancedTestCase.java @@ -127,8 +127,8 @@ public class SCAJarEarNonenhancedTestCase { Assert.assertNotNull(composite); Assert.assertEquals(2, composite.getComponents().size()); - Assert.assertEquals(1, composite.getComponents().get(1).getImplementation().getServices().size()); - Assert.assertEquals("HelloworldServiceBean_HelloworldService", composite.getComponents().get(1).getImplementation().getServices().get(0).getName()); + Assert.assertEquals(2, composite.getComponents().get(1).getImplementation().getServices().size()); + Assert.assertEquals("HelloworldService7Bean_HelloworldService7", composite.getComponents().get(1).getImplementation().getServices().get(0).getName()); domain.buildComposite(composite); |