diff options
Diffstat (limited to 'sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java')
18 files changed, 0 insertions, 988 deletions
diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBinding.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBinding.java deleted file mode 100644 index ecd4393e4d..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBinding.java +++ /dev/null @@ -1,49 +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 binding.lifecycle;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.provider.BaseBindingImpl;
-
-/**
- * Represents a binding to a Sample service.
- */
-public class LifecycleBinding extends BaseBindingImpl {
-
- public static final QName TYPE = new QName(SCA11_TUSCANY_NS, "binding.lifecycle");
-
- private String someAttr;
-
- public LifecycleBinding() {
- }
-
- public QName getType() {
- return TYPE;
- }
-
- public String getSomeAttr() {
- return someAttr;
- }
-
- public void setSomeAttr(String someAttr) {
- this.someAttr = someAttr;
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBindingFactory.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBindingFactory.java deleted file mode 100644 index 4fdf09bdf0..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBindingFactory.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 binding.lifecycle;
-
-
-/**
- * Factory implementation to create Sample Models
- */
-public class LifecycleBindingFactory {
-
- public LifecycleBinding createLifecycleBinding() {
- return new LifecycleBinding();
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBindingProviderFactory.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBindingProviderFactory.java deleted file mode 100644 index f197578e84..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleBindingProviderFactory.java +++ /dev/null @@ -1,47 +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 binding.lifecycle;
-
-import binding.lifecycle.LifecycleBinding;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
-import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
-
-public class LifecycleBindingProviderFactory implements BindingProviderFactory<LifecycleBinding> {
-
- public LifecycleBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
- }
-
- public Class<LifecycleBinding> getModelType() {
- return LifecycleBinding.class;
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeEndpointReference endpoint) {
- return new LifecycleReferenceBindingProvider(endpoint);
- }
-
- public ServiceBindingProvider createServiceBindingProvider(RuntimeEndpoint endpoint) {
- return new LifecycleServiceBindingProvider(endpoint);
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleReferenceBindingProvider.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleReferenceBindingProvider.java deleted file mode 100644 index 5c2ca0bf77..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleReferenceBindingProvider.java +++ /dev/null @@ -1,63 +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 binding.lifecycle;
-
-import helloworld.StatusImpl;
-
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.assembly.impl.EndpointImpl;
-import org.apache.tuscany.sca.assembly.impl.EndpointReferenceImpl;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-
-public class LifecycleReferenceBindingProvider implements ReferenceBindingProvider {
-
- private EndpointReference endpoint;
- private InterfaceContract contract;
-
- public LifecycleReferenceBindingProvider(EndpointReference endpoint) {
- this.endpoint = endpoint;
- }
-
- public Invoker createInvoker(Operation operation) {
- return new LifecycleReferenceInvoker(operation, endpoint);
- }
-
- public void start() {
- StatusImpl.appendStatus("Reference binding start",
- ((EndpointReferenceImpl)endpoint).toStringWithoutHash());
- }
-
- public void stop() {
- StatusImpl.appendStatus("Reference binding stop",
- ((EndpointReferenceImpl)endpoint).toStringWithoutHash());
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return contract;
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleReferenceInvoker.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleReferenceInvoker.java deleted file mode 100644 index 023be8613b..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleReferenceInvoker.java +++ /dev/null @@ -1,48 +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 binding.lifecycle;
-
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-
-public class LifecycleReferenceInvoker implements Invoker {
-
- protected Operation operation;
- protected EndpointReference endpoint;
-
- public LifecycleReferenceInvoker(Operation operation, EndpointReference endpoint) {
- this.operation = operation;
- this.endpoint = endpoint;
- }
-
- public Message invoke(Message msg) {
- try {
- Object[] body = msg.getBody();
- msg.setBody(body[0]);
- return msg;
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleServiceBindingProvider.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleServiceBindingProvider.java deleted file mode 100644 index 158aa27201..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleServiceBindingProvider.java +++ /dev/null @@ -1,56 +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 binding.lifecycle;
-
-import helloworld.StatusImpl;
-
-import org.apache.tuscany.sca.assembly.impl.EndpointImpl;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
-
-public class LifecycleServiceBindingProvider implements ServiceBindingProvider {
-
- private RuntimeEndpoint endpoint;
- private InterfaceContract contract;
-
- public LifecycleServiceBindingProvider(RuntimeEndpoint endpoint) {
- this.endpoint = endpoint;
- }
-
- public void start() {
- StatusImpl.appendStatus("Service binding start",
- ((EndpointImpl)endpoint).toStringWithoutHash());
- }
-
- public void stop() {
- StatusImpl.appendStatus("Service binding stop",
- ((EndpointImpl)endpoint).toStringWithoutHash());
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return contract;
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleServiceInvoker.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleServiceInvoker.java deleted file mode 100644 index 09ca7a051e..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/binding/lifecycle/LifecycleServiceInvoker.java +++ /dev/null @@ -1,40 +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 binding.lifecycle;
-
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
-
-public class LifecycleServiceInvoker {
-
- private RuntimeEndpoint wire;
-
- public LifecycleServiceInvoker(RuntimeEndpoint wire) {
- this.wire = wire;
- }
-
- /**
- * Send the request down the wire to invoke the service
- */
- public Message invokeService(Message msg) {
- return wire.invoke(msg);
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/Helloworld.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/Helloworld.java deleted file mode 100644 index 7b9c17cf59..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/Helloworld.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 helloworld;
-
-import org.oasisopen.sca.annotation.Remotable;
-
-@Remotable
-public interface Helloworld {
-
- String sayHello(String name) throws Exception;
-
- String throwException(String name) throws Exception;
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplC.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplC.java deleted file mode 100644 index 931e61677d..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplC.java +++ /dev/null @@ -1,78 +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 helloworld;
-
-import org.oasisopen.sca.annotation.Destroy;
-import org.oasisopen.sca.annotation.Init;
-import org.oasisopen.sca.annotation.Reference;
-import org.oasisopen.sca.annotation.Scope;
-
-/*
- * C = a composite scoped component that throws exceptions
- */
-
-@Scope("COMPOSITE")
-public class HelloworldClientImplC implements Helloworld {
-
- public static boolean throwTestExceptionOnConstruction = false;
- public static boolean throwTestExceptionOnInit = false;
- public static boolean throwTestExceptionOnDestroy = false;
-
-
- @Reference
- public Helloworld service;
-
- public HelloworldClientImplC() throws Exception {
- if(throwTestExceptionOnConstruction){
- StatusImpl.appendStatus("Exception on construction", "HelloworldClientImplC");
- throw new Exception("Exception on construction");
- }
- }
-
- @Init
- public void initialize() throws Exception{
- if (throwTestExceptionOnInit) {
- StatusImpl.appendStatus("Exception on init", "HelloworldClientImplC");
- throw new Exception("Exception on init");
- }
-
- StatusImpl.appendStatus("Init", "HelloworldClientImplC");
- System.out.println(">>>>>> " + sayHello("init"));
- }
-
- @Destroy
- public void destroy() throws Exception{
- if (throwTestExceptionOnDestroy) {
- StatusImpl.appendStatus("Exception on destroy", "HelloworldClientImplC");
- throw new Exception("Exception on destroy");
- }
-
- StatusImpl.appendStatus("Destroy", "HelloworldClientImplC");
- }
-
- public String sayHello(String name) throws Exception {
- return "Hi " + service.sayHello(name);
- }
-
- public String throwException(String name) throws Exception {
- throw new Exception("test exception");
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplCE.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplCE.java deleted file mode 100644 index af97452ee9..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplCE.java +++ /dev/null @@ -1,80 +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 helloworld;
-
-import org.oasisopen.sca.annotation.Destroy;
-import org.oasisopen.sca.annotation.EagerInit;
-import org.oasisopen.sca.annotation.Init;
-import org.oasisopen.sca.annotation.Reference;
-import org.oasisopen.sca.annotation.Scope;
-
-/*
- * CE = a composite scoped component with EagerInit that throws exceptions
- */
-
-@EagerInit
-@Scope("COMPOSITE")
-public class HelloworldClientImplCE implements Helloworld {
-
- public static boolean throwTestExceptionOnConstruction = false;
- public static boolean throwTestExceptionOnInit = false;
- public static boolean throwTestExceptionOnDestroy = false;
-
-
- @Reference
- public Helloworld service;
-
- public HelloworldClientImplCE() throws Exception {
- if(throwTestExceptionOnConstruction){
- StatusImpl.appendStatus("Exception on construction", "HelloworldClientImplCE");
- throw new Exception("Exception on construction");
- }
- }
-
- @Init
- public void initialize() throws Exception{
- if (throwTestExceptionOnInit) {
- StatusImpl.appendStatus("Exception on init", "HelloworldClientImplCE");
- throw new Exception("Exception on init");
- }
-
- StatusImpl.appendStatus("Init", "HelloworldClientImplCE");
- System.out.println(">>>>>> " + sayHello("init"));
- }
-
- @Destroy
- public void destroy() throws Exception{
- if (throwTestExceptionOnDestroy) {
- StatusImpl.appendStatus("Exception on destroy", "HelloworldClientImplCE");
- throw new Exception("Exception on destroy");
- }
-
- StatusImpl.appendStatus("Destroy", "HelloworldClientImplCE");
- }
-
- public String sayHello(String name) throws Exception {
- return "Hi " + service.sayHello(name);
- }
-
- public String throwException(String name) throws Exception {
- throw new Exception("test exception");
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplS.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplS.java deleted file mode 100644 index 493ccca972..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/HelloworldClientImplS.java +++ /dev/null @@ -1,78 +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 helloworld;
-
-import org.oasisopen.sca.annotation.Destroy;
-import org.oasisopen.sca.annotation.Init;
-import org.oasisopen.sca.annotation.Reference;
-import org.oasisopen.sca.annotation.Scope;
-
-/*
- * S = a stateless scoped component that throws exceptions
- */
-
-@Scope("STATELESS")
-public class HelloworldClientImplS implements Helloworld {
-
- public static boolean throwTestExceptionOnConstruction = false;
- public static boolean throwTestExceptionOnInit = false;
- public static boolean throwTestExceptionOnDestroy = false;
-
-
- @Reference
- public Helloworld service;
-
- public HelloworldClientImplS() throws Exception {
- if(throwTestExceptionOnConstruction){
- StatusImpl.appendStatus("Exception on construction", "HelloworldClientImplS");
- throw new Exception("Exception on construction");
- }
- }
-
- @Init
- public void initialize() throws Exception{
- if (throwTestExceptionOnInit) {
- StatusImpl.appendStatus("Exception on init", "HelloworldClientImplS");
- throw new Exception("Exception on init");
- }
-
- StatusImpl.appendStatus("Init", "HelloworldClientImplS");
- System.out.println(">>>>>> " + sayHello("init"));
- }
-
- @Destroy
- public void destroy() throws Exception{
- if (throwTestExceptionOnDestroy) {
- StatusImpl.appendStatus("Exception on destroy", "HelloworldClientImplS");
- throw new Exception("Exception on destroy");
- }
-
- StatusImpl.appendStatus("Destroy", "HelloworldClientImplS");
- }
-
- public String sayHello(String name) throws Exception {
- return "Hi " + service.sayHello(name);
- }
-
- public String throwException(String name) throws Exception {
- throw new Exception("test exception");
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/HelloworldServiceImpl.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/HelloworldServiceImpl.java deleted file mode 100644 index 2d27ec8f58..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/HelloworldServiceImpl.java +++ /dev/null @@ -1,35 +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 helloworld;
-
-public class HelloworldServiceImpl implements Helloworld {
-
- public String sayHello(String name) {
- String response = "Hello " + name;
- System.out.println("At service - " + response);
- return response;
- }
-
- public String throwException(String name) throws Exception {
- // not used
- return null;
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/StatusImpl.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/StatusImpl.java deleted file mode 100644 index 644853d6c2..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/helloworld/StatusImpl.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 helloworld;
-
-public class StatusImpl {
-
- public static String statusString = "";
-
- public static void appendStatus(String event, String location){
- // remove any addresses from the strings
- location = location.replaceAll("\\(@.*Endpoint", "Endpoint");
- statusString += event + " - " + location + "\n";
- }
-
-}
diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleImplementation.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleImplementation.java deleted file mode 100644 index ebed204b87..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleImplementation.java +++ /dev/null @@ -1,41 +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 implementation.lifecycle; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.impl.ImplementationImpl; - -/** - * Model representing a Sample implementation in an SCA assembly. - * - * @version $Rev$ $Date$ - */ -public class LifecycleImplementation extends ImplementationImpl { - static final QName QN = new QName(SCA11_TUSCANY_NS, "implementation.lifecycle"); - - final String name; - Class<?> clazz; - - LifecycleImplementation(final String name) { - super(QN); - this.name = name; - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleImplementationProcessor.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleImplementationProcessor.java deleted file mode 100644 index c7989b291c..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleImplementationProcessor.java +++ /dev/null @@ -1,105 +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 implementation.lifecycle; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; - -import javax.wsdl.PortType; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.ContributionReadException; -import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; -import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; -import org.apache.tuscany.sca.contribution.processor.ProcessorContext; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ClassReference; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.databinding.xml.DOMDataBinding; -import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface; -import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject; - -/** - * StAX artifact processor for Sample implementations. - * - * @version $Rev$ $Date$ - */ -public class LifecycleImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<LifecycleImplementation> { - final AssemblyFactory af; - final JavaInterfaceFactory jif; - final WSDLFactory wf; - - public LifecycleImplementationProcessor(final ExtensionPointRegistry ep) { - final FactoryExtensionPoint fep = ep.getExtensionPoint(FactoryExtensionPoint.class); - this.af = fep.getFactory(AssemblyFactory.class); - this.jif = fep.getFactory(JavaInterfaceFactory.class); - this.wf = fep.getFactory(WSDLFactory.class); - } - - public QName getArtifactType() { - return LifecycleImplementation.QN; - } - - public Class<LifecycleImplementation> getModelType() { - return LifecycleImplementation.class; - } - - public LifecycleImplementation read(final XMLStreamReader r, final ProcessorContext ctx) throws ContributionReadException, XMLStreamException { - // not actually going to read any config for this test - // so just create a model - LifecycleImplementation impl = new LifecycleImplementation("helloworld.Helloworld"); - impl.setUnresolved(true); - return impl; - } - - public void resolve(final LifecycleImplementation impl, final ModelResolver res, final ProcessorContext ctx) throws ContributionResolveException { - try { - Class c = Class.forName("helloworld.Helloworld"); - Service s = af.createService(); - s.setName("Helloworld"); - JavaInterfaceContract ic = jif.createJavaInterfaceContract(); - ic.setInterface(jif.createJavaInterface(c)); - s.setInterfaceContract(ic); - impl.getServices().add(s); - impl.setUnresolved(false); - } catch (Exception ex){ - throw new ContributionResolveException(ex); - } - } - - public void write(final LifecycleImplementation impl, final XMLStreamWriter w, final ProcessorContext ctx) throws ContributionWriteException, XMLStreamException { - // not required for this test - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleJavaInvoker.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleJavaInvoker.java deleted file mode 100644 index ac750fe040..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleJavaInvoker.java +++ /dev/null @@ -1,46 +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 implementation.lifecycle; - -import java.lang.reflect.Method; - -import org.apache.tuscany.sca.interfacedef.java.JavaOperation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; - -/** - * Invoker for Sample components that implement a Java interface. - * - * @version $Rev$ $Date$ - */ -class SampleJavaInvoker implements Invoker { - final Object instance; - final Method method; - - SampleJavaInvoker(final JavaOperation op, final Class<?> clazz, final Object instance) throws SecurityException, NoSuchMethodException { - this.instance = instance; - this.method = clazz.getMethod(op.getJavaMethod().getName(), op.getJavaMethod().getParameterTypes()); - } - - public Message invoke(final Message msg) { - // we don't actually do anything here - return msg; - } -} diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleProvider.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleProvider.java deleted file mode 100644 index f1e303882f..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleProvider.java +++ /dev/null @@ -1,77 +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 implementation.lifecycle; - -import helloworld.StatusImpl; - -import java.util.HashMap; -import java.util.Map; - -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.invocation.ProxyFactory; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.java.JavaOperation; -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; - -/** - * Implementation provider for Sample component implementations. - * - * @version $Rev$ $Date$ - */ -class LifecycleProvider implements ImplementationProvider { - final RuntimeComponent comp; - final LifecycleImplementation impl; - final ProxyFactory pxf; - final ExtensionPointRegistry ep; - Object instance; - - // make this static rather than worrying about persistence on the reference side - static Map<String, Object> asyncMessageMap = new HashMap<String, Object>(); - - LifecycleProvider(final RuntimeComponent comp, final LifecycleImplementation impl, ProxyFactory pf, ExtensionPointRegistry ep) { - this.comp = comp; - this.impl = impl; - this.pxf = pf; - this.ep = ep; - } - - public void start() { - StatusImpl.appendStatus("Implementation start", comp.getName()); - } - - public void stop() { - StatusImpl.appendStatus("Implementation stop", comp.getName()); - } - - public boolean supportsOneWayInvocation() { - return false; - } - - public Invoker createInvoker(final RuntimeComponentService s, final Operation op) { - try { - return new SampleJavaInvoker((JavaOperation)op, impl.clazz, instance); - } catch(Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleProviderFactory.java b/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleProviderFactory.java deleted file mode 100644 index dfd39716fd..0000000000 --- a/sca-java-2.x/tags/2.0-Beta3-RC2/testing/itest/lifecycle/src/main/java/implementation/lifecycle/LifecycleProviderFactory.java +++ /dev/null @@ -1,50 +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 implementation.lifecycle; - -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory; -import org.apache.tuscany.sca.core.invocation.ProxyFactory; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.provider.ImplementationProviderFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -/** - * Factory for Sample implementation providers. - * - * @version $Rev$ $Date$ - */ -public class LifecycleProviderFactory implements ImplementationProviderFactory<LifecycleImplementation> { - final ProxyFactory pxf; - final ExtensionPointRegistry ep; - - public LifecycleProviderFactory(final ExtensionPointRegistry ep) { - this.ep = ep; - pxf = ExtensibleProxyFactory.getInstance(ep); - } - - public ImplementationProvider createImplementationProvider(final RuntimeComponent comp, final LifecycleImplementation impl) { - return new LifecycleProvider(comp, impl, pxf, ep); - } - - public Class<LifecycleImplementation> getModelType() { - return LifecycleImplementation.class; - } -} |