diff options
Diffstat (limited to 'tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock')
8 files changed, 0 insertions, 428 deletions
diff --git a/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockHandler.java b/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockHandler.java deleted file mode 100644 index 9def6b5b0e..0000000000 --- a/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockHandler.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * 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.wire.mock; - -import org.apache.tuscany.core.wire.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-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockScopeContext.java b/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockScopeContext.java deleted file mode 100644 index 915885549a..0000000000 --- a/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockScopeContext.java +++ /dev/null @@ -1,131 +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.wire.mock; - -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.context.RuntimeEventListener; -import org.apache.tuscany.core.context.ContextRuntimeException; -import org.apache.tuscany.core.context.AtomicContext; -import org.apache.tuscany.core.context.ScopeRuntimeException; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.EventFilter; -import org.apache.tuscany.core.context.event.Event; -import org.apache.tuscany.model.assembly.AtomicComponent; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class MockScopeContext implements ScopeContext { - - Map<String, Object> components; - - public MockScopeContext() { - components = new HashMap<String, Object>(); - 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 void publish(Event object) { - //To change body of implemented methods use File | Settings | File Templates. - } - - public void addListener(RuntimeEventListener listener) throws ContextRuntimeException { - } - - public void addListener(EventFilter filter, RuntimeEventListener listener) { - //To change body of implemented methods use File | Settings | File Templates. - } - - public void removeListener(RuntimeEventListener listener) throws ContextRuntimeException { - } - - public String getName() { - return "Mock Scope Container"; - } - - public boolean isCacheable() { - return false; - } - - public int[] getEventTypes() { - return null; - } - - public AtomicContext getContext(String name) { - return null; - } - - public Object getInstance(QualifiedName name) throws ScopeRuntimeException { - return components.get(name.getPartName()); - } - - public AtomicContext getContextByKey(String name, Object key) { - return null; - } - - public void setComponent(AtomicComponent component) throws ScopeRuntimeException { - } - - public void removeContext(String name) throws ScopeRuntimeException { - } - - public void removeContextByKey(String name, Object key) throws ScopeRuntimeException { - } - - public AtomicComponent[] getComponents() { - return null; - } - - - public void registerFactories(List<ContextFactory<Context>> configurations) { - } - - public void registerFactory(ContextFactory<Context> configuration) { - } - - public int getLifecycleState(){ - return RUNNING; - } - - - public void setLifecycleState(int state) { - } - - - public void setName(String name) { - } - - - public void onEvent(Event event) { - //To change body of implemented methods use File | Settings | File Templates. - } -} - diff --git a/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockStaticInvoker.java b/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockStaticInvoker.java deleted file mode 100644 index 66e8579cb4..0000000000 --- a/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockStaticInvoker.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation - * - * 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.wire.mock; - -import org.apache.tuscany.core.wire.Interceptor; -import org.apache.tuscany.core.wire.InvocationRuntimeException; -import org.apache.tuscany.core.wire.TargetInvoker; -import org.apache.tuscany.core.message.Message; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -/** - * Caches component instances that do not need to be resolved for every wire, e.g. an wire 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() throws CloneNotSupportedException { - 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-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockSyncInterceptor.java b/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/MockSyncInterceptor.java deleted file mode 100644 index a64caed8eb..0000000000 --- a/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/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.wire.mock; - -import org.apache.tuscany.core.wire.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-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSource.java b/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSource.java deleted file mode 100644 index 8e8af9ec18..0000000000 --- a/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/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.wire.mock; - -public interface SimpleSource { - - public void invokeHello() throws Exception; - - public void invokeGoodbye() throws Exception; -} - diff --git a/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSourceImpl.java b/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleSourceImpl.java deleted file mode 100644 index 900fa9c324..0000000000 --- a/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/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.wire.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-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTarget.java b/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTarget.java deleted file mode 100644 index d63d3a0565..0000000000 --- a/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/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.wire.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-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTargetImpl.java b/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/mock/SimpleTargetImpl.java deleted file mode 100644 index 1b6fe93ac8..0000000000 --- a/tags/java-M1-20060522/java/sca/core/src/test/java/org/apache/tuscany/core/wire/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.wire.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; - } - - -} - |