diff options
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src')
14 files changed, 613 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/com/example/ExampleClient.java b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/com/example/ExampleClient.java new file mode 100644 index 0000000000..ecf1ac27e1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/com/example/ExampleClient.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 com.example;
+
+public interface ExampleClient {
+
+ void runTest();
+
+ void sayHello(String name);
+}
diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/com/example/ExampleClientImpl.java b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/com/example/ExampleClientImpl.java new file mode 100644 index 0000000000..c46087d865 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/com/example/ExampleClientImpl.java @@ -0,0 +1,59 @@ +/*
+ * 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 com.example;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(ExampleClient.class)
+@Scope("COMPOSITE")
+public class ExampleClientImpl implements ExampleClient {
+
+ private ExampleService myService;
+
+ @Context
+ protected ComponentContext context;
+
+ @Reference
+ public void setMyService(ExampleService myService) {
+ this.myService = myService;
+ }
+
+ public void runTest() {
+ ServiceReference<ExampleClient> ref = context.createSelfReference(ExampleClient.class);
+ ref.getService().sayHello("Jack");
+ CallableReference result = myService.hello("Jill", ref);
+ if (result != null) {
+ ((CallableReference<ExampleClient>)result).getService().sayHello("John");
+ }
+ result = myService.hello("Jane", null);
+ if (result != null) {
+ ((CallableReference<ExampleClient>)result).getService().sayHello("Jim");
+ }
+ }
+
+ public void sayHello(String name) {
+ System.out.println("Hello, client " + name + "!");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/com/example/ExampleService.java b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/com/example/ExampleService.java new file mode 100644 index 0000000000..670c145cc3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/com/example/ExampleService.java @@ -0,0 +1,30 @@ +/*
+ * 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 com.example;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface ExampleService {
+
+ CallableReference hello(String name, ServiceReference ref);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/com/example/ExampleServiceImpl.java b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/com/example/ExampleServiceImpl.java new file mode 100644 index 0000000000..eb4d647a22 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/com/example/ExampleServiceImpl.java @@ -0,0 +1,33 @@ +/*
+ * 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 com.example;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+public class ExampleServiceImpl implements ExampleService {
+
+ public CallableReference hello(String name, ServiceReference ref) {
+ if (ref != null) {
+ ((ServiceReference<ExampleClient>)ref).getService().sayHello(name);
+ }
+ return (CallableReference)ref;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Alpha.java b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Alpha.java new file mode 100644 index 0000000000..bb5e57397d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Alpha.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.itest.callablerefwsreturn; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface Alpha { + boolean run(); +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/AlphaImpl.java b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/AlphaImpl.java new file mode 100644 index 0000000000..6e5f1cedf9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/AlphaImpl.java @@ -0,0 +1,96 @@ +/* + * 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.itest.callablerefwsreturn; + +import org.osoa.sca.CallableReference; +import org.osoa.sca.ComponentContext; +import org.osoa.sca.Conversation; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(Alpha.class) +@Scope("COMPOSITE") +public class AlphaImpl implements Alpha { + @Reference + public Beta beta; + + @Context + protected ComponentContext componentContext; + + Object conversationId0 = null; + + public boolean run() { + CallableReference<Gamma> gammaRef = null; + try { + Object conversationId1 = null; + Object conversationId2 = null; + + // it is expected that this call returns a reference to Gamma that + // reuses the established Conversation + gammaRef = beta.getRef(); + + // no Conversation exists + Conversation con = gammaRef.getConversation(); + if (con == null) { + System.out.println("Alpha1: Conversation to gamma is null"); + } else { + System.out + .println("Alpha1: Conversation to gamma exists. conversationId=" + + con.getConversationID()); + conversationId1 = con.getConversationID(); + } + + // this call should reuse a Conversation, but as none exists it + // creates a new conversation + gammaRef.getService().doSomething(); + gammaRef.getService().doSomething(); + gammaRef.getService().doSomething(); + + con = gammaRef.getConversation(); + if (con == null) { + System.out.println("Alpha2: Conversation to gamma is null"); + } else { + System.out + .println("Alpha2: Conversation to gamma exists. conversationId=" + + con.getConversationID()); + conversationId2 = con.getConversationID(); + } + + boolean testPassed = conversationId1.equals(conversationId2); + + if (conversationId0 == null){ + conversationId0 = conversationId1; + return testPassed; + } else { + return testPassed && (!conversationId0.equals(conversationId1)); + } + + } catch (Exception e) { + e.printStackTrace(); + return false; + } finally { + if (gammaRef != null) { + gammaRef.getService().stop(); + } + } + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Beta.java b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Beta.java new file mode 100644 index 0000000000..995e4fcf39 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Beta.java @@ -0,0 +1,27 @@ +/* + * 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.itest.callablerefwsreturn; + +import org.osoa.sca.CallableReference; +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface Beta { + CallableReference<Gamma> getRef(); +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/BetaImpl.java b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/BetaImpl.java new file mode 100644 index 0000000000..be72fd779e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/BetaImpl.java @@ -0,0 +1,46 @@ +/* + * 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.itest.callablerefwsreturn; + +import org.osoa.sca.CallableReference; +import org.osoa.sca.ComponentContext; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(Beta.class) +@Scope("COMPOSITE") +public class BetaImpl implements Beta { + @Context + protected ComponentContext componentContext; + + @Reference + public Gamma gamma; + + public CallableReference<Gamma> getRef() { + ServiceReference<Gamma> gammaRef = componentContext + .getServiceReference(Gamma.class, "gamma"); + Gamma g = gammaRef.getService(); + g.start(); + return gammaRef; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Gamma.java b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Gamma.java new file mode 100644 index 0000000000..b73f26b573 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/Gamma.java @@ -0,0 +1,34 @@ +/* + * 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.itest.callablerefwsreturn; + +import org.osoa.sca.annotations.Conversational; +import org.osoa.sca.annotations.EndsConversation; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@Conversational +public interface Gamma { + int start(); + + void doSomething(); + + @EndsConversation + void stop(); +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/GammaImpl.java b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/GammaImpl.java new file mode 100644 index 0000000000..c3abc4c65d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/java/org/apache/tuscany/sca/itest/callablerefwsreturn/GammaImpl.java @@ -0,0 +1,49 @@ +/* + * 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.itest.callablerefwsreturn; + +import org.osoa.sca.annotations.ConversationID; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +@Service(Gamma.class) +@Scope("CONVERSATION") +public class GammaImpl implements Gamma { + @ConversationID + protected String conversationId; + + public GammaImpl() { + System.out.println("GammaImpl:GammaImpl(), conversationId=" + + conversationId); + } + + public int start() { + System.out.println("Gamma:start(), conversationId=" + conversationId); + return 1; + } + + public void doSomething() { + System.out.println("Gamma:doSomething(), conversationId=" + + conversationId); + } + + public void stop() { + System.out.println("Gamma:stop(), conversationId=" + conversationId); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/resources/CallableReferenceWsReturnTest.composite b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/resources/CallableReferenceWsReturnTest.composite new file mode 100644 index 0000000000..3d782a0b84 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/resources/CallableReferenceWsReturnTest.composite @@ -0,0 +1,54 @@ +<?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 + * 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:t="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:s="http://test" + name="test"> + + <component name="Alpha"> + <implementation.java + class="org.apache.tuscany.sca.itest.callablerefwsreturn.AlphaImpl" /> + <service name="Alpha"> + <binding.sca /> + </service> + <reference name="beta"> + <binding.ws uri="http://localhost:8085/Beta" /> + </reference> + </component> + + <component name="Beta"> + <implementation.java + class="org.apache.tuscany.sca.itest.callablerefwsreturn.BetaImpl" /> + <service name="Beta"> + <binding.ws uri="http://localhost:8085/Beta" /> + </service> + <reference name="gamma"> + <binding.ws uri="http://localhost:8085/Gamma" /> + </reference> + </component> + + <component name="Gamma"> + <implementation.java + class="org.apache.tuscany.sca.itest.callablerefwsreturn.GammaImpl" /> + <service name="Gamma"> + <binding.ws uri="http://localhost:8085/Gamma" /> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/resources/example.composite b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/resources/example.composite new file mode 100644 index 0000000000..ea0819a32e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/main/resources/example.composite @@ -0,0 +1,40 @@ +<?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"
+ targetNamespace="http://www.example.com"
+ xmlns:hw="http://www.example.com"
+ name="example">
+
+ <component name="ExampleClientComponent">
+ <implementation.java class="com.example.ExampleClientImpl" />
+ <reference name="myService">
+ <interface.java interface="com.example.ExampleService" />
+ <binding.ws uri="http://localhost:8085/axis2/services/ExampleService" />
+ </reference>
+ </component>
+
+ <component name="ExampleComponent">
+ <implementation.java class="com.example.ExampleServiceImpl"/>
+ <service name="ExampleService">
+ <interface.java interface="com.example.ExampleService" />
+ <binding.ws uri="http://localhost:8085/axis2/services/ExampleService" />
+ </service>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/test/java/com/example/ExampleTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/test/java/com/example/ExampleTestCase.java new file mode 100644 index 0000000000..310e31fb02 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/test/java/com/example/ExampleTestCase.java @@ -0,0 +1,44 @@ +/*
+ * 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 com.example;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ExampleTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private ExampleClient client;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("example.composite");
+ client = scaDomain.getService(ExampleClient.class, "ExampleClientComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ client.runTest();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/test/java/org/apache/tuscany/sca/itest/callablerefws/CallableReferenceReturnTestCase.java b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/test/java/org/apache/tuscany/sca/itest/callablerefws/CallableReferenceReturnTestCase.java new file mode 100644 index 0000000000..66fb2ef96c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.5/itest/callablereferences-ws/src/test/java/org/apache/tuscany/sca/itest/callablerefws/CallableReferenceReturnTestCase.java @@ -0,0 +1,49 @@ +/* + * 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.itest.callablerefws; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.itest.callablerefwsreturn.Alpha; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class CallableReferenceReturnTestCase { + private static SCADomain domain; + private static Alpha alpha; + + @BeforeClass + public static void init() throws Exception { + domain = SCADomain.newInstance("CallableReferenceWsReturnTest.composite"); + alpha = domain.getService(Alpha.class, "Alpha"); + } + + @AfterClass + public static void destroy() throws Exception { + domain.close(); + } + + @Test + public void testCallableReferenceReturn() { + Assert.assertTrue(alpha.run()); + Assert.assertTrue(alpha.run()); + } + +} |