diff options
Diffstat (limited to '')
8 files changed, 45 insertions, 107 deletions
diff --git a/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/account/CustomerImpl.java b/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/account/CustomerImpl.java index 3d3f785a50..ed2b403f2d 100644 --- a/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/account/CustomerImpl.java +++ b/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/account/CustomerImpl.java @@ -6,15 +6,15 @@ * 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. + * under the License. */ package account; @@ -22,32 +22,32 @@ import org.osoa.sca.ServiceRuntimeException; import org.osoa.sca.annotations.Reference; import org.osoa.sca.annotations.Service; -import calculator.AddService; +import calculator.AddServiceRemote; @Service(Customer.class) public class CustomerImpl implements Customer { - private AddService extEJBService = null; + private AddServiceRemote extEJBService = null; - public AddService getExtEJBService() { + public AddServiceRemote getExtEJBService() { return extEJBService; } @Reference - public void setExtEJBService(AddService extEJBService) { + public void setExtEJBService(AddServiceRemote extEJBService) { this.extEJBService = extEJBService; } // this method invokes external EJB through EJB reference binding public Double depositAmount(java.lang.String accountNo, Double amount) { - + Double total = null; System.out.println("In component implementation. Invoking external EJB through EJB reference binding "); try { - Double balance = extEJBService.add(amount.doubleValue(), 1000); //invoke external ejb through ejb reference binding - total = balance + amount; + Double balance = extEJBService.add(amount.doubleValue(), 1000); //invoke external ejb through ejb reference binding + total = balance + amount; } catch (Exception e) { throw new ServiceRuntimeException(e); } diff --git a/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/calculator/AddService.java b/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/calculator/AddService.java deleted file mode 100644 index 7cefba530a..0000000000 --- a/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/calculator/AddService.java +++ /dev/null @@ -1,27 +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 calculator; - -/** - * @version $Rev$ $Date$ - */ -public interface AddService { - double add(double n1, double n2); -} diff --git a/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/calculator/AddServiceHome.java b/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/calculator/AddServiceHome.java deleted file mode 100644 index 799bcaa672..0000000000 --- a/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/calculator/AddServiceHome.java +++ /dev/null @@ -1,31 +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 calculator; - -import java.rmi.RemoteException; - -import javax.ejb.CreateException; -import javax.ejb.EJBHome; - -public interface AddServiceHome extends EJBHome { - - AddService create() throws CreateException, RemoteException; - -} diff --git a/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/calculator/AddServiceRemote.java b/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/calculator/AddServiceRemote.java new file mode 100644 index 0000000000..10321ff751 --- /dev/null +++ b/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/calculator/AddServiceRemote.java @@ -0,0 +1,8 @@ +package calculator;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface AddServiceRemote {
+ double add(double n1, double n2);
+}
diff --git a/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/EJBReferenceTestCase.java b/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/EJBReferenceTestCase.java index 16c772ee53..83bf9c8673 100644 --- a/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/EJBReferenceTestCase.java +++ b/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/EJBReferenceTestCase.java @@ -22,7 +22,6 @@ import org.apache.tuscany.sca.host.embedded.SCADomain; import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import account.Customer; @@ -44,11 +43,12 @@ public class EJBReferenceTestCase { scaDomain = SCADomain.newInstance("account/account.composite"); - // To capture the network traffic for the MockServer, uncomment the next line - // new Thread(new SocketTracer(MOCK_PORT, OPENEJB_PORT)).start(); + // To capture the network traffic for the MockServer, uncomment the next two lines (A) and comment out B + // int OPENEJB_PORT = 4201; // A + // new Thread(new SocketTracer(MOCK_PORT, OPENEJB_PORT)).start(); // A // Start the mock server to simulate the remote EJB - new Thread(new MockServer(MOCK_PORT)).start(); + new Thread(new MockServer(MOCK_PORT)).start(); // B // Wait enough for the server to be started Thread.sleep(500); @@ -59,7 +59,6 @@ public class EJBReferenceTestCase { scaDomain.close(); } - @Ignore("TUSCANY-2957") @Test public void testCalculator() throws Exception { Customer customer = scaDomain.getService(Customer.class, "CustomerComponent"); diff --git a/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/MockServer.java b/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/MockServer.java index 48e87fb6d1..e0cce4bae6 100644 --- a/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/MockServer.java +++ b/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/MockServer.java @@ -6,15 +6,15 @@ * 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. + * under the License. */ package org.apache.tuscany.sca.binding.ejb.tests; @@ -30,35 +30,24 @@ public class MockServer implements Runnable { private int listen; byte[][] seq = { - {79, 69, 74, 80, 47, 51, 46, 48, 1, -84, -19, 0, 5, 119, 58, 1, 27, 0, 54, 47, 104, 101, 108, 108, 111, 45, - 97, 100, 100, 115, 101, 114, 118, 105, 99, 101, 47, 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, 66, 101, - 97, 110, 47, 99, 97, 108, 99, 117, 108, 97, 116, 111, 114, 46, 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, - 112}, - - {79, 69, 74, 80, 47, 50, 46, 48, -84, -19, 0, 5, 119, 3, 1, 13, 1, 118, 114, 0, 25, 99, 97, 108, 99, 117, 108, - 97, 116, 111, 114, 46, 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, 72, 111, 109, 101, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 120, 112, 118, 114, 0, 21, 99, 97, 108, 99, 117, 108, 97, 116, 111, 114, 46, 65, 100, 100, 83, - 101, 114, 118, 105, 99, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 112, 112, 112, 119, 38, 7, 0, 31, 104, - 101, 108, 108, 111, 45, 97, 100, 100, 115, 101, 114, 118, 105, 99, 101, 47, 65, 100, 100, 83, 101, 114, 118, - 105, 99, 101, 66, 101, 97, 110, -1, -1, 0, 0}, - - {79, 69, 74, 80, 47, 51, 46, 48, 0, -84, -19, 0, 5, 119, 1, 10, 116, 0, 31, 104, 101, 108, 108, 111, 45, 97, - 100, 100, 115, 101, 114, 118, 105, 99, 101, 47, 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, 66, 101, 97, - 110, 119, 2, -1, -1, 112, 119, 1, 1, 112, 118, 114, 0, 25, 99, 97, 108, 99, 117, 108, 97, 116, 111, 114, 46, - 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, 72, 111, 109, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 112, - 119, 9, 0, 6, 99, 114, 101, 97, 116, 101, 0}, - {79, 69, 74, 80, 47, 50, 46, 48, -84, -19, 0, 5, 119, 2, 1, 4, 112}, - - {79, 69, 74, 80, 47, 51, 46, 48, 0, -84, -19, 0, 5, 119, 1, 23, 116, 0, 31, 104, 101, 108, 108, 111, 45, 97, - 100, 100, 115, 101, 114, 118, 105, 99, 101, 47, 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, 66, 101, 97, - 110, 119, 2, -1, -1, 112, 119, 1, 1, 112, 118, 114, 0, 21, 99, 97, 108, 99, 117, 108, 97, 116, 111, 114, 46, - 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 112, 119, 24, 0, 3, 97, + {79, 69, 74, 80, 47, 51, 46, 48, 1, -84, -19, 0, 5, 119, 21, 1, 27, 0, 17, 47, 65, 100, 100, 83, 101, 114, + 118, 105, 99, 101, 82, 101, 109, 111, 116, 101, 112, 119, 4, -63, -5, 13, 59}, + {79, 69, 74, 80, 47, 51, 46, 48, -84, -19, 0, 5, 119, 3, 1, 0, 21, 115, 114, 0, 41, 111, 114, 103, 46, 97, + 112, 97, 99, 104, 101, 46, 111, 112, 101, 110, 101, 106, 98, 46, 99, 108, 105, 101, 110, 116, 46, 69, 74, 66, + 77, 101, 116, 97, 68, 97, 116, 97, 73, 109, 112, 108, 29, -120, -127, 52, 16, -56, 15, 77, 12, 0, 0, 120, + 112, 119, 1, 1, 112, 112, 112, 112, 119, 28, 7, 0, 21, 67, 97, 108, 99, 117, 108, 97, 116, 111, 114, 47, 65, + 100, 100, 83, 101, 114, 118, 105, 99, 101, -1, -1, 0, 1, 118, 114, 0, 27, 99, 97, 108, 99, 117, 108, 97, 116, + 111, 114, 46, 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, 82, 101, 109, 111, 116, 101, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 120, 112, 112, 120}, + {79, 69, 74, 80, 47, 51, 46, 48, 0, -84, -19, 0, 5, 119, 1, 23, 116, 0, 21, 67, 97, 108, 99, 117, 108, 97, + 116, 111, 114, 47, 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, 119, 2, -1, -1, 112, 119, 5, -63, -5, 13, + 59, 1, 112, 118, 114, 0, 27, 99, 97, 108, 99, 117, 108, 97, 116, 111, 114, 46, 65, 100, 100, 83, 101, 114, + 118, 105, 99, 101, 82, 101, 109, 111, 116, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 112, 119, 24, 0, 3, 97, 100, 100, 2, 4, 64, 89, 0, 0, 0, 0, 0, 0, 4, 64, -113, 64, 0, 0, 0, 0, 0}, - {79, 69, 74, 80, 47, 50, 46, 48, -84, -19, 0, 5, 119, 2, 1, 4, 115, 114, 0, 16, 106, 97, 118, 97, 46, 108, 97, - 110, 103, 46, 68, 111, 117, 98, 108, 101, -128, -77, -62, 74, 41, 107, -5, 4, 2, 0, 1, 68, 0, 5, 118, 97, + {79, 69, 74, 80, 47, 51, 46, 48, -84, -19, 0, 5, 119, 3, 1, 0, 4, 115, 114, 0, 16, 106, 97, 118, 97, 46, 108, + 97, 110, 103, 46, 68, 111, 117, 98, 108, 101, -128, -77, -62, 74, 41, 107, -5, 4, 2, 0, 1, 68, 0, 5, 118, 97, 108, 117, 101, 120, 114, 0, 16, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 78, 117, 109, 98, 101, 114, -122, -84, -107, 29, 11, -108, -32, -117, 2, 0, 0, 120, 112, 64, -111, 48, 0, 0, 0, 0, 0} - }; public MockServer(int listen) { diff --git a/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/resources/account/account.composite b/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/resources/account/account.composite index 14f77eed08..701b989659 100644 --- a/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/resources/account/account.composite +++ b/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/resources/account/account.composite @@ -7,15 +7,15 @@ * 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.
+ * under the License.
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="account">
@@ -25,10 +25,10 @@ <implementation.java class="account.CustomerImpl" />
<reference name="extEJBService">
<!-- To use the CosNaming, use the following URI -->
- <!--
+ <!--
<binding.ejb uri="corbaname:iiop:1.2@localhost:1050#AddServiceBean" />
-->
- <binding.ejb uri="hello-addservice/AddServiceBean/calculator.AddService" />
+ <binding.ejb uri="AddServiceRemote" />
</reference>
</component>
diff --git a/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/resources/calculator-ejb/calculator-ejb.jar b/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/resources/calculator-ejb/calculator-ejb.jar Binary files differnew file mode 100644 index 0000000000..d9afb9027f --- /dev/null +++ b/branches/sca-java-1.x/modules/binding-ejb-runtime/src/test/resources/calculator-ejb/calculator-ejb.jar |