diff options
Diffstat (limited to 'tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock')
8 files changed, 0 insertions, 404 deletions
diff --git a/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockHandler.java b/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockHandler.java deleted file mode 100644 index ec52bee002..0000000000 --- a/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - */ -package org.apache.tuscany.core.invocation.mock; - -import org.apache.tuscany.core.invocation.MessageHandler; -import org.apache.tuscany.core.message.Message; - -/** - * - */ -public class MockHandler implements MessageHandler { - - private int count =0; - - public boolean processMessage(Message message) { - //System.out.println("Invoking handler"); - count++; - return true; - } - - public int getCount(){ - return count; - } -} diff --git a/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockScopeContext.java b/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockScopeContext.java deleted file mode 100644 index ec8a95d4be..0000000000 --- a/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockScopeContext.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.mock; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.core.builder.RuntimeConfiguration; -import org.apache.tuscany.core.context.InstanceContext; -import org.apache.tuscany.core.context.EventException; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.LifecycleEventListener; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.context.ScopeRuntimeException; -import org.apache.tuscany.core.context.SimpleComponentContext; -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.model.assembly.SimpleComponent; - -public class MockScopeContext implements ScopeContext { - - Map<String, Object> components; - - public MockScopeContext() { - components = new HashMap(); - components.put("foo", new SimpleTargetImpl()); - components.put("bar", new SimpleTargetImpl()); - } - - public MockScopeContext(Map<String,Object> instances) { - components = instances; - } - - - public void start() { - } - - public void stop() { - } - - public String getName() { - return "Mock Scope Container"; - } - - public boolean isCacheable() { - return false; - } - - public int[] getEventTypes() { - return null; - } - - public SimpleComponentContext getContext(String name) { - return null; - } - - public Object getInstance(QualifiedName name) throws ScopeRuntimeException { - return components.get(name.getPartName()); - } - - public Object getInstance(QualifiedName componentName, boolean notify) throws TargetException { - return getInstance(componentName); - } - - public SimpleComponentContext getContextByKey(String name, Object key) { - return null; - } - - public void setComponent(SimpleComponent component) throws ScopeRuntimeException { - } - - public void removeContext(String name) throws ScopeRuntimeException { - } - - public void removeContextByKey(String name, Object key) throws ScopeRuntimeException { - } - - public SimpleComponent[] getComponents() { - return null; - } - - public void onEvent(int type, Object message) throws EventException { - } - - - public void registerConfigurations(List<RuntimeConfiguration<InstanceContext>> configurations) { - } - - public void registerConfiguration(RuntimeConfiguration<InstanceContext> configuration) { - } - - public int getLifecycleState(){ - return RUNNING; - } - - - public void setLifecycleState(int state) { - } - - - public void setName(String name) { - } - - - public void addContextListener(LifecycleEventListener listener) { - } - - - public void removeContextListener(LifecycleEventListener listener) { - } - - public Object getImplementationInstance() throws TargetException{ - return this; - } - - public Object getImplementationInstance(boolean notify) throws TargetException{ - return this; - } - - -} - diff --git a/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockStaticInvoker.java b/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockStaticInvoker.java deleted file mode 100644 index 27b3594ab7..0000000000 --- a/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockStaticInvoker.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.apache.tuscany.core.invocation.mock; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import org.apache.tuscany.core.invocation.Interceptor; -import org.apache.tuscany.core.invocation.InvocationRuntimeException; -import org.apache.tuscany.core.invocation.TargetInvoker; -import org.apache.tuscany.core.message.Message; - -/** - * Caches component instances that do not need to be resolved for every invocation, e.g. an invocation originating from - * a lesser scope intended for a target with a wider scope - * - * @version $Rev: 377006 $ $Date: 2006-02-11 09:41:59 -0800 (Sat, 11 Feb 2006) $ - */ -public class MockStaticInvoker implements TargetInvoker { - - private Object instance; - - private Method operation; - - public MockStaticInvoker(Method operation, Object instance) { - this.operation = operation; - this.instance = instance; - } - - public boolean isCacheable() { - return true; - } - - public Object invokeTarget(Object payload) throws InvocationTargetException { - try { - if (payload != null && !payload.getClass().isArray()) { - return operation.invoke(instance, payload); - } else { - return operation.invoke(instance, (Object[]) payload); - } - } catch (IllegalAccessException e) { - throw new InvocationRuntimeException(e); - } - } - - public Message invoke(Message msg) { - try { - Object resp = invokeTarget(msg.getBody()); - msg.setBody(resp); - } catch (InvocationTargetException e) { - msg.setBody(e.getCause()); - } catch (Throwable e) { - msg.setBody(e); - } - return msg; - } - - public void setNext(Interceptor next) { - throw new IllegalStateException("This interceptor must be the last interceptor in an interceptor chain"); - } - - public Object clone() { - try { - MockStaticInvoker invoker = (MockStaticInvoker) super.clone(); - invoker.instance = this.instance; - invoker.operation = this.operation; - return invoker; - } catch (CloneNotSupportedException e) { - return null; // will not happen - } - } -} diff --git a/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockSyncInterceptor.java b/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockSyncInterceptor.java deleted file mode 100644 index 120b7654cd..0000000000 --- a/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/MockSyncInterceptor.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.mock; - -import org.apache.tuscany.core.invocation.Interceptor; -import org.apache.tuscany.core.message.Message; - -public class MockSyncInterceptor implements Interceptor { - - private int count; - - private Interceptor next; - - public MockSyncInterceptor() { - } - - public Message invoke(Message msg) { - ++count; - //System.out.println("Invoking interceptor"); - return next.invoke(msg); - } - - public int getCount() { - return count; - } - - public void setNext(Interceptor next) { - this.next=next; - } -} - diff --git a/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleSource.java b/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleSource.java deleted file mode 100644 index 5a68024f2a..0000000000 --- a/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleSource.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.mock; - -public interface SimpleSource { - - public void invokeHello() throws Exception; - - public void invokeGoodbye() throws Exception; -} - diff --git a/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleSourceImpl.java b/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleSourceImpl.java deleted file mode 100644 index 51025ba3a0..0000000000 --- a/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleSourceImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.mock; - -public class SimpleSourceImpl implements SimpleSource { - - private SimpleTarget proxy; - - public SimpleSourceImpl(SimpleTarget proxy) { - this.proxy = proxy; - } - - public void invokeHello() throws Exception { - proxy.hello("hello"); - } - - public void invokeGoodbye() throws Exception { - proxy.goodbye("hello"); - } - -} - diff --git a/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleTarget.java b/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleTarget.java deleted file mode 100644 index e4aabd72a2..0000000000 --- a/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleTarget.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.mock; - -public interface SimpleTarget { - - public String hello(String message) throws Exception; - - public String goodbye(String message) throws Exception; - - public String echo(String message) throws Exception; - -} - diff --git a/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleTargetImpl.java b/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleTargetImpl.java deleted file mode 100644 index 16f70c020f..0000000000 --- a/tags/java-stable-20060304/sca/core/src/test/java/org/apache/tuscany/core/invocation/mock/SimpleTargetImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed 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.core.invocation.mock; - -public class SimpleTargetImpl implements SimpleTarget { - - public SimpleTargetImpl() { - super(); - } - - public String hello(String message) throws Exception { - return message; - } - - public String goodbye(String message) throws Exception { - return message; - } - - public String echo(String message) throws Exception { - return message; - } - - -} - |