diff options
Diffstat (limited to 'tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock')
36 files changed, 0 insertions, 2563 deletions
diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockConfigContext.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockConfigContext.java deleted file mode 100644 index 413f4a5a5b..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockConfigContext.java +++ /dev/null @@ -1,56 +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.container.java.mock; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.RuntimeConfigurationBuilder; -import org.apache.tuscany.core.builder.impl.AssemblyVisitor; -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.core.context.AggregateContext; -import org.apache.tuscany.core.context.ConfigurationContext; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.invocation.spi.ProxyFactory; -import org.apache.tuscany.model.assembly.Extensible; - -/** - * A mock configuration context - * - * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ - */ -public class MockConfigContext implements ConfigurationContext { - - private List<RuntimeConfigurationBuilder> builders = new ArrayList(); - - public MockConfigContext(List<RuntimeConfigurationBuilder> builders) { - this.builders=builders; - } - - public void configure(Extensible model) throws ConfigurationException { - } - - public void build(AggregateContext parent, Extensible model) throws BuilderConfigException { - AssemblyVisitor visitor = new AssemblyVisitor(parent, builders); - visitor.start(model); - } - - public void wire(ProxyFactory sourceFactory, ProxyFactory targetFactory, Class targetType, boolean downScope, ScopeContext targetScopeContext) throws BuilderConfigException { - } - - public void wire(ProxyFactory targetFactory, Class targetType, ScopeContext targetScopeContext) throws BuilderConfigException { - } - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockFactory.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockFactory.java deleted file mode 100644 index 192ce328fb..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockFactory.java +++ /dev/null @@ -1,548 +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.container.java.mock; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import junit.framework.Assert; - -import org.apache.tuscany.container.java.assembly.JavaAssemblyFactory; -import org.apache.tuscany.container.java.assembly.JavaImplementation; -import org.apache.tuscany.container.java.assembly.impl.JavaAssemblyFactoryImpl; -import org.apache.tuscany.container.java.assembly.mock.HelloWorldImpl; -import org.apache.tuscany.container.java.assembly.mock.HelloWorldService; -import org.apache.tuscany.container.java.builder.JavaComponentContextBuilder; -import org.apache.tuscany.container.java.builder.JavaTargetWireBuilder; -import org.apache.tuscany.container.java.context.JavaComponentContext; -import org.apache.tuscany.container.java.invocation.mock.MockSyncInterceptor; -import org.apache.tuscany.container.java.mock.binding.foo.FooBinding; -import org.apache.tuscany.container.java.mock.binding.foo.FooBindingBuilder; -import org.apache.tuscany.container.java.mock.binding.foo.FooBindingWireBuilder; -import org.apache.tuscany.container.java.mock.components.GenericComponent; -import org.apache.tuscany.container.java.mock.components.HelloWorldClient; -import org.apache.tuscany.container.java.mock.components.ModuleScopeComponentImpl; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.RuntimeConfiguration; -import org.apache.tuscany.core.builder.RuntimeConfigurationBuilder; -import org.apache.tuscany.core.config.ConfigurationException; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.core.context.AggregateContext; -import org.apache.tuscany.core.context.EventContext; -import org.apache.tuscany.core.context.InstanceContext; -import org.apache.tuscany.core.context.SystemAggregateContext; -import org.apache.tuscany.core.context.impl.AggregateContextImpl; -import org.apache.tuscany.core.injection.EventInvoker; -import org.apache.tuscany.core.injection.FieldInjector; -import org.apache.tuscany.core.injection.Injector; -import org.apache.tuscany.core.injection.MethodEventInvoker; -import org.apache.tuscany.core.injection.MethodInjector; -import org.apache.tuscany.core.injection.PojoObjectFactory; -import org.apache.tuscany.core.injection.SingletonObjectFactory; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.runtime.RuntimeContextImpl; -import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory; -import org.apache.tuscany.core.system.assembly.SystemBinding; -import org.apache.tuscany.core.system.assembly.SystemImplementation; -import org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl; -import org.apache.tuscany.core.system.builder.SystemComponentContextBuilder; -import org.apache.tuscany.core.system.builder.SystemEntryPointBuilder; -import org.apache.tuscany.core.system.builder.SystemExternalServiceBuilder; -import org.apache.tuscany.core.system.context.SystemAggregateContextImpl; -import org.apache.tuscany.model.assembly.AggregatePart; -import org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.Module; -import org.apache.tuscany.model.assembly.Reference; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.SimpleComponent; -import org.apache.tuscany.model.assembly.impl.AssemblyModelContextImpl; -import org.apache.tuscany.model.types.java.JavaServiceContract; -import org.osoa.sca.annotations.ComponentName; -import org.osoa.sca.annotations.Context; -import org.osoa.sca.annotations.Destroy; -import org.osoa.sca.annotations.Init; - -/** - * Generates test components, modules, and runtime artifacts - * - * @version $Rev$ $Date$ - */ -public class MockFactory { - - public static final String JAVA_BUILDER = "java.runtime.builder"; - - public static final String JAVA_WIRE_BUILDER = "java.wire.builder"; - - public static final String FOO_BUILDER = "foo.binding.builder"; - - public static final String FOO_WIRE_BUILDER = "foo.binding.wire.builder"; - - public static final String SYSTEM_CHILD = "tuscany.system.child"; - - private static JavaAssemblyFactory factory = new JavaAssemblyFactoryImpl(); - - private static SystemAssemblyFactory systemFactory = new SystemAssemblyFactoryImpl(); - - private static AssemblyModelContext assemblyContext = new AssemblyModelContextImpl(null, null); - - /** - * Creates an initialized simple component - * - * @param name the component name - * @param type the implementation type - * @param scope the component scope - */ - public static SimpleComponent createComponent(String name, Class type, Scope scope) { - SimpleComponent sc = factory.createSimpleComponent(); - JavaImplementation impl = factory.createJavaImplementation(); - impl.setComponentType(factory.createComponentType()); - impl.setImplementationClass(type); - sc.setComponentImplementation(impl); - Service s = factory.createService(); - JavaServiceContract ji = factory.createJavaServiceContract(); - s.setServiceContract(ji); - ji.setScope(scope); - impl.getComponentType().getServices().add(s); - sc.setName(name); - sc.setComponentImplementation(impl); - return sc; - } - - /** - * Creates a system component of the given type with the given name and scope - */ - public static Component createSystemComponent(String name, Class type, Scope scope) { - - Component sc = null; - if (AggregateContext.class.isAssignableFrom(type)) { - sc = systemFactory.createModuleComponent(); - } else { - sc = systemFactory.createSimpleComponent(); - } - SystemImplementation impl = systemFactory.createSystemImplementation(); - impl.setImplementationClass(type); - sc.setComponentImplementation(impl); - Service s = systemFactory.createService(); - JavaServiceContract ji = systemFactory.createJavaServiceContract(); - s.setServiceContract(ji); - ji.setScope(scope); - impl.setComponentType(systemFactory.createComponentType()); - impl.getComponentType().getServices().add(s); - sc.setName(name); - sc.setComponentImplementation(impl); - return sc; - } - - /** - * Creates an aggregate component with the given name - */ - public static Component createAggregateComponent(String name) { - Component sc = sc = systemFactory.createModuleComponent(); - SystemImplementation impl = systemFactory.createSystemImplementation(); - impl.setImplementationClass(AggregateContextImpl.class); - sc.setComponentImplementation(impl); - Service s = systemFactory.createService(); - JavaServiceContract ji = systemFactory.createJavaServiceContract(); - s.setServiceContract(ji); - ji.setScope(Scope.AGGREGATE); - impl.setComponentType(systemFactory.createComponentType()); - impl.getComponentType().getServices().add(s); - sc.setName(name); - sc.setComponentImplementation(impl); - return sc; - } - - /** - * Creates a system aggregate component with the given name - */ - public static Component createSystemAggregateComponent(String name) { - Component sc = sc = systemFactory.createModuleComponent(); - SystemImplementation impl = systemFactory.createSystemImplementation(); - impl.setImplementationClass(SystemAggregateContextImpl.class); - sc.setComponentImplementation(impl); - Service s = systemFactory.createService(); - JavaServiceContract ji = systemFactory.createJavaServiceContract(); - s.setServiceContract(ji); - ji.setScope(Scope.AGGREGATE); - impl.setComponentType(systemFactory.createComponentType()); - impl.getComponentType().getServices().add(s); - sc.setName(name); - sc.setComponentImplementation(impl); - return sc; - } - - /** - * Creates an external service configured with the 'Foo' test binding - */ - public static ExternalService createFooBindingExternalService(String name, Class interfaz) { - ExternalService es = factory.createExternalService(); - es.setName(name); - Service s = factory.createService(); - JavaServiceContract ji = factory.createJavaServiceContract(); - ji.setScope(Scope.MODULE); - ji.setInterface(interfaz); - s.setServiceContract(ji); - ConfiguredService configuredService = factory.createConfiguredService(); - es.setConfiguredService(configuredService); - - FooBinding binding = new FooBinding(); - es.getBindings().add(binding); - return es; - } - - /** - * Creates an entry point with the given name configured with the given interface and the {@link FooBinding} - */ - public static EntryPoint createFooBindingEntryPoint(String name, Class interfaz) { - EntryPoint ep = factory.createEntryPoint(); - ep.setName(name); - Service s = factory.createService(); - JavaServiceContract ji = factory.createJavaServiceContract(); - ji.setScope(Scope.MODULE); - ji.setInterface(interfaz); - s.setServiceContract(ji); - ConfiguredService configuredService = factory.createConfiguredService(); - configuredService.setService(s); - ep.setConfiguredService(configuredService); - FooBinding binding = new FooBinding(); - ep.getBindings().add(binding); - return ep; - } - - /** - * Creates an entry point wired to the given target (e.g. component, external service) using the system binding - * - * @param name the name of the entry point - * @param interfaz the inteface exposed by the entry point - * @param refName the name of the entry point reference - * @param target the target the entry point is wired to - */ - public static EntryPoint createEPSystemBinding(String name, Class interfaz, String refName, AggregatePart target) { - JavaServiceContract contract = systemFactory.createJavaServiceContract(); - contract.setInterface(interfaz); - - EntryPoint ep = systemFactory.createEntryPoint(); - ep.setName(name); - - Reference ref = systemFactory.createReference(); - ref.setName(refName); - ref.setServiceContract(contract); - ConfiguredReference configuredReference = systemFactory.createConfiguredReference(); - configuredReference.setReference(ref); - Service service = systemFactory.createService(); - service.setServiceContract(contract); - - ConfiguredService cService = systemFactory.createConfiguredService(); - cService.setService(service); - cService.initialize(MockFactory.assemblyContext); - - configuredReference.getTargetConfiguredServices().add(cService); - ep.setConfiguredReference(configuredReference); - - Service epService = systemFactory.createService(); - epService.setServiceContract(contract); - - ConfiguredService epCService = systemFactory.createConfiguredService(); - epCService.initialize(MockFactory.assemblyContext); - epCService.setService(epService); - - ep.setConfiguredService(epCService); - SystemBinding binding = systemFactory.createSystemBinding(); - ep.getBindings().add(binding); - if (target != null) { - if (target instanceof Component) { - ((Component) target).getConfiguredServices().add(cService); - } else if (target instanceof ExternalService) { - ((ExternalService) target).setConfiguredService(cService); - } - target.initialize(MockFactory.assemblyContext); - } - ep.initialize(null); - return ep; - } - - /** - * Creates an external service configured with a {@link SystemBinding} - */ - public static ExternalService createESSystemBinding(String name, String refName) { - ExternalService es = systemFactory.createExternalService(); - es.setName(name); - ConfiguredService configuredService = systemFactory.createConfiguredService(); - es.setConfiguredService(configuredService); - SystemBinding binding = systemFactory.createSystemBinding(); - binding.setTargetName(refName); - es.getBindings().add(binding); - es.initialize(null); - return es; - } - - /** - * Creates a module with a Java-based "target" module-scoped component wired to a module-scoped "source" - */ - public static Module createModule() { - return createModule(Scope.MODULE, Scope.MODULE); - } - - /** - * Creates a module with a Java-based "target" component wired to a "source" - */ - public static Module createModule(Scope sourceScope, Scope targetScope) { - Component sourceComponent = createComponent("source", ModuleScopeComponentImpl.class, sourceScope); - Component targetComponent = createComponent("target", ModuleScopeComponentImpl.class, targetScope); - - Service targetService = factory.createService(); - JavaServiceContract targetContract = factory.createJavaServiceContract(); - targetContract.setInterface(GenericComponent.class); - targetService.setServiceContract(targetContract); - targetService.setName("GenericComponent"); - ConfiguredService cTargetService = factory.createConfiguredService(); - cTargetService.setService(targetService); - cTargetService.initialize(assemblyContext); - targetComponent.getConfiguredServices().add(cTargetService); - targetComponent.initialize(assemblyContext); - - Reference ref = factory.createReference(); - ConfiguredReference cref = factory.createConfiguredReference(); - ref.setName("setGenericComponent"); - JavaServiceContract inter = factory.createJavaServiceContract(); - inter.setInterface(GenericComponent.class); - ref.setServiceContract(inter); - cref.setReference(ref); - cref.getTargetConfiguredServices().add(cTargetService); - cref.initialize(assemblyContext); - sourceComponent.getConfiguredReferences().add(cref); - sourceComponent.initialize(assemblyContext); - - Module module = factory.createModule(); - module.setName("test.module"); - module.getComponents().add(sourceComponent); - module.getComponents().add(targetComponent); - module.initialize(assemblyContext); - return module; - } - - /** - * Creates a module with a Java-based source component wired to a "target" external service configured with the - * {@link FooBinding} - */ - public static Module createModuleWithExternalService() { - Component sourceComponent = createComponent("source", HelloWorldClient.class, Scope.MODULE); - ExternalService targetES = createFooBindingExternalService("target", HelloWorldService.class); - - Service targetService = factory.createService(); - JavaServiceContract targetContract = factory.createJavaServiceContract(); - targetContract.setInterface(HelloWorldService.class); - targetService.setServiceContract(targetContract); - targetService.setName("HelloWorld"); - ConfiguredService cTargetService = factory.createConfiguredService(); - cTargetService.setService(targetService); - targetES.setConfiguredService(cTargetService); - targetES.initialize(assemblyContext); - - Reference ref = factory.createReference(); - ConfiguredReference cref = factory.createConfiguredReference(); - ref.setName("setHelloWorldService"); - JavaServiceContract inter = factory.createJavaServiceContract(); - inter.setInterface(HelloWorldService.class); - ref.setServiceContract(inter); - cref.setReference(ref); - cref.getTargetConfiguredServices().add(cTargetService); - cref.initialize(assemblyContext); - sourceComponent.getConfiguredReferences().add(cref); - sourceComponent.initialize(assemblyContext); - - Module module = factory.createModule(); - module.setName("test.module"); - module.getComponents().add(sourceComponent); - module.getExternalServices().add(targetES); - module.initialize(assemblyContext); - return module; - } - - /** - * Creates a module with an entry point named "source" configured with the {@link FooBinding} wired to a service - * offered by a Java-based component named "target" - * - * @param scope the scope of the target service - */ - public static Module createModuleWithEntryPoint(Scope scope) { - EntryPoint sourceEP = createFooBindingEntryPoint("source", HelloWorldService.class); - Component targetComponent = createComponent("target", HelloWorldImpl.class, scope); - - Service targetService = factory.createService(); - JavaServiceContract targetContract = factory.createJavaServiceContract(); - targetContract.setInterface(HelloWorldService.class); - targetService.setServiceContract(targetContract); - targetService.setName("HelloWorldService"); - ConfiguredService cTargetService = factory.createConfiguredService(); - cTargetService.setService(targetService); - targetComponent.getConfiguredServices().add(cTargetService); - targetComponent.initialize(assemblyContext); - - Reference ref = factory.createReference(); - ConfiguredReference cref = factory.createConfiguredReference(); - ref.setName("setHelloWorldService"); - JavaServiceContract inter = factory.createJavaServiceContract(); - inter.setInterface(HelloWorldService.class); - ref.setServiceContract(inter); - cref.setReference(ref); - cref.getTargetConfiguredServices().add(cTargetService); - cref.initialize(assemblyContext); - sourceEP.setConfiguredReference(cref); - sourceEP.getConfiguredService().getService().setName("HelloWorldService"); - sourceEP.initialize(assemblyContext); - - Module module = factory.createModule(); - module.setName("test.module"); - module.getEntryPoints().add(sourceEP); - module.getComponents().add(targetComponent); - module.initialize(assemblyContext); - return module; - } - - /** - * Returns a collection of bootstrap configuration builders - */ - public static List<RuntimeConfigurationBuilder> createSystemBuilders() { - List<RuntimeConfigurationBuilder> builders = new ArrayList(); - builders.add((new SystemComponentContextBuilder())); - builders.add(new SystemEntryPointBuilder()); - builders.add(new SystemExternalServiceBuilder()); - return builders; - } - - /** - * Creates an aggregate runtime configuration - * - * @param name the name of the component - * @param aggregateContext the containing aggregate context - * @throws BuilderException - * @see RuntimeConfiguration - */ - public static RuntimeConfiguration<InstanceContext> createAggregateConfiguration(String name, - AggregateContext aggregateContext) throws BuilderException { - - Component sc = createAggregateComponent(name); - SystemComponentContextBuilder builder = new SystemComponentContextBuilder(); - builder.build(sc, aggregateContext); - return (RuntimeConfiguration<InstanceContext>) sc.getComponentImplementation().getRuntimeConfiguration(); - } - - /** - * Creates a Java POJO component context - * - * @param name the name of the context - * @param implType the POJO class - * @param scope the component scope - * @param moduleComponentContext the containing aggregate context - * @throws NoSuchMethodException if the POJO does not have a default noi-args constructor - */ - public static JavaComponentContext createPojoContext(String name, Class implType, Scope scope, - AggregateContext moduleComponentContext) throws NoSuchMethodException { - SimpleComponent component = createComponent(name, implType, scope); - - Set<Field> fields = JavaIntrospectionHelper.getAllFields(implType); - Set<Method> methods = JavaIntrospectionHelper.getAllUniqueMethods(implType); - List<Injector> injectors = new ArrayList(); - EventInvoker initInvoker = null; - boolean eagerInit = false; - EventInvoker destroyInvoker = null; - for (Field field : fields) { - ComponentName compName = field.getAnnotation(ComponentName.class); - if (compName != null) { - Injector injector = new FieldInjector(field, new SingletonObjectFactory(name)); - injectors.add(injector); - } - Context context = field.getAnnotation(Context.class); - if (context != null) { - Injector injector = new FieldInjector(field, new SingletonObjectFactory(moduleComponentContext)); - injectors.add(injector); - } - } - for (Method method : methods) { - // FIXME Java5 - Init init = method.getAnnotation(Init.class); - if (init != null && initInvoker == null) { - initInvoker = new MethodEventInvoker(method); - eagerInit = init.eager(); - continue; - } - Destroy destroy = method.getAnnotation(Destroy.class); - if (destroy != null && destroyInvoker == null) { - destroyInvoker = new MethodEventInvoker(method); - continue; - } - ComponentName compName = method.getAnnotation(ComponentName.class); - if (compName != null) { - Injector injector = new MethodInjector(method, new SingletonObjectFactory(name)); - injectors.add(injector); - } - Context context = method.getAnnotation(Context.class); - if (context != null) { - Injector injector = new MethodInjector(method, new SingletonObjectFactory(moduleComponentContext)); - injectors.add(injector); - } - } - boolean stateless = (scope == Scope.INSTANCE); - JavaComponentContext context = new JavaComponentContext("foo", new PojoObjectFactory(JavaIntrospectionHelper - .getDefaultConstructor(implType), null, injectors), eagerInit, initInvoker, destroyInvoker, stateless); - return context; - } - - /** - * Creates a default {@link RuntimeContext} configured with support for Java component implementations - * - * @throws ConfigurationException - */ - public static RuntimeContext createJavaRuntime() throws ConfigurationException { - RuntimeContext runtime = new RuntimeContextImpl(null, null, MockFactory.createSystemBuilders(), null); - runtime.start(); - runtime.getSystemContext().registerModelObject(createSystemAggregateComponent(SYSTEM_CHILD)); - SystemAggregateContext ctx = (SystemAggregateContext) runtime.getSystemContext().getContext(SYSTEM_CHILD); - ctx.registerModelObject(createSystemComponent(JAVA_BUILDER, JavaComponentContextBuilder.class, Scope.MODULE)); - ctx.registerModelObject(createSystemComponent(JAVA_WIRE_BUILDER, JavaTargetWireBuilder.class, Scope.MODULE)); - ctx.fireEvent(EventContext.MODULE_START, null); - return runtime; - } - - /** - * Registers the {@link FooBinding} builders with a given runtime - * - * @throws ConfigurationException - */ - public static RuntimeContext registerFooBinding(RuntimeContext runtime) throws ConfigurationException { - AggregateContext child = (AggregateContext) runtime.getSystemContext().getContext(MockFactory.SYSTEM_CHILD); - JavaComponentContextBuilder javaBuilder = (JavaComponentContextBuilder) child.getContext(MockFactory.JAVA_BUILDER) - .getInstance(null); - MockSyncInterceptor mockInterceptor = new MockSyncInterceptor(); - child.registerModelObject(MockFactory.createSystemComponent(FOO_BUILDER, FooBindingBuilder.class, Scope.MODULE)); - child.registerModelObject(MockFactory.createSystemComponent(FOO_WIRE_BUILDER, FooBindingWireBuilder.class, Scope.MODULE)); - // since the child context is already started, we need to manually retrieve the components to init them - Assert.assertNotNull(child.getContext(FOO_BUILDER).getInstance(null)); - Assert.assertNotNull(child.getContext(FOO_WIRE_BUILDER).getInstance(null)); - return runtime; - } -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockScopeContext.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockScopeContext.java deleted file mode 100644 index a6d9c0b2c5..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/MockScopeContext.java +++ /dev/null @@ -1,137 +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.container.java.mock; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.container.java.invocation.mock.SimpleTargetImpl; -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/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBinding.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBinding.java deleted file mode 100644 index 75aabff105..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBinding.java +++ /dev/null @@ -1,59 +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.container.java.mock.binding.foo; - -import org.apache.tuscany.model.assembly.AssemblyModelContext; -import org.apache.tuscany.model.assembly.AssemblyModelVisitor; -import org.apache.tuscany.model.assembly.Binding; -import org.apache.tuscany.model.assembly.ModelInitException; - -/** - * Represents a mock binding that echoes back a single parameter - * - * @version $Rev$ $Date$ - */ -public class FooBinding implements Binding { - - public FooBinding() { - } - - public String getURI() { - return null; - } - - public void setURI(String value) { - } - - public void initialize(AssemblyModelContext modelContext) throws ModelInitException { - } - - public void freeze() { - } - - public boolean accept(AssemblyModelVisitor visitor) { - return false; - } - - private Object config; - - public void setRuntimeConfiguration(Object configuration) { - config = configuration; - } - - public Object getRuntimeConfiguration() { - System.out.println("retting"); - return config; - } - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingBuilder.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingBuilder.java deleted file mode 100644 index 248f7e54bc..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingBuilder.java +++ /dev/null @@ -1,192 +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.container.java.mock.binding.foo; - -import java.lang.reflect.Method; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.builder.RuntimeConfigurationBuilder; -import org.apache.tuscany.core.builder.impl.EntryPointRuntimeConfiguration; -import org.apache.tuscany.core.builder.impl.HierarchicalBuilder; -import org.apache.tuscany.core.config.JavaIntrospectionHelper; -import org.apache.tuscany.core.context.Context; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.injection.ObjectCreationException; -import org.apache.tuscany.core.invocation.InvocationConfiguration; -import org.apache.tuscany.core.invocation.ProxyConfiguration; -import org.apache.tuscany.core.invocation.impl.InvokerInterceptor; -import org.apache.tuscany.core.invocation.spi.ProxyFactory; -import org.apache.tuscany.core.invocation.spi.ProxyFactoryFactory; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.model.assembly.AssemblyModelObject; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.Service; -import org.apache.tuscany.model.assembly.ServiceContract; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Scope; - -/** - * Creates a <code>RuntimeConfigurationBuilder</code> for an entry point or external service configured with the - * {@link FooBinding} - * - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public class FooBindingBuilder implements RuntimeConfigurationBuilder { - - @Autowire - private RuntimeContext runtimeContext; - - private ProxyFactoryFactory proxyFactoryFactory; - - private MessageFactory messageFactory; - - /* the top-level builder responsible for evaluating policies */ - private HierarchicalBuilder policyBuilder = new HierarchicalBuilder(); - - public FooBindingBuilder() { - } - - @Init(eager = true) - public void init() { - runtimeContext.addBuilder(this); - } - - /** - * @param runtimeContext The runtimeContext to set. - */ - @Autowire - public void setRuntimeContext(RuntimeContext runtimeContext) { - this.runtimeContext = runtimeContext; - } - - /** - * Sets the factory used to construct proxies implmementing the business interface required by a reference - */ - @Autowire - public void setProxyFactoryFactory(ProxyFactoryFactory factory) { - this.proxyFactoryFactory = factory; - } - - /** - * Sets the factory used to construct invocation messages - * - * @param msgFactory - */ - @Autowire - public void setMessageFactory(MessageFactory msgFactory) { - this.messageFactory = msgFactory; - } - - /** - * Adds a builder responsible for creating source-side and target-side invocation chains for a reference. The - * reference builder may be hierarchical, containing other child reference builders that operate on specific - * metadata used to construct and invocation chain. - */ - public void addPolicyBuilder(RuntimeConfigurationBuilder builder) { - policyBuilder.addBuilder(builder); - } - - public void build(AssemblyModelObject object, Context context) throws BuilderException { - if (object instanceof EntryPoint) { - EntryPoint ep = (EntryPoint) object; - if (ep.getBindings().size() < 1 || !(ep.getBindings().get(0) instanceof FooBinding)) { - return; - } - EntryPointRuntimeConfiguration config = new FooEntryPointRuntimeConfiguration(ep.getName(), ep.getConfiguredService() - .getService().getName(), messageFactory); - - ConfiguredService configuredService = ep.getConfiguredService(); - Service service = configuredService.getService(); - ServiceContract serviceContract = service.getServiceContract(); - Map<Method, InvocationConfiguration> iConfigMap = new HashMap(); - ProxyFactory proxyFactory = proxyFactoryFactory.createProxyFactory(); - Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(serviceContract.getInterface()); - for (Method method : javaMethods) { - InvocationConfiguration iConfig = new InvocationConfiguration(method); - iConfigMap.put(method, iConfig); - } - QualifiedName qName = new QualifiedName(ep.getConfiguredReference().getTargetConfiguredServices().get(0).getAggregatePart().getName() + "/" + service.getName()); - ProxyConfiguration pConfiguration = new ProxyConfiguration(qName, iConfigMap, serviceContract.getInterface().getClassLoader(), messageFactory); - proxyFactory.setBusinessInterface(serviceContract.getInterface()); - proxyFactory.setProxyConfiguration(pConfiguration); - config.addSourceProxyFactory(service.getName(), proxyFactory); - configuredService.setProxyFactory(proxyFactory); - if (policyBuilder != null) { - // invoke the reference builder to handle additional policy metadata - policyBuilder.build(configuredService, context); - } - // add tail interceptor - for (InvocationConfiguration iConfig : (Collection<InvocationConfiguration>) iConfigMap.values()) { - iConfig.addTargetInterceptor(new InvokerInterceptor()); - } - ep.getConfiguredReference().setRuntimeConfiguration(config); - - } else if (object instanceof ExternalService) { - ExternalService es = (ExternalService) object; - if (es.getBindings().size() < 1 || !(es.getBindings().get(0) instanceof FooBinding)) { - return; - } - - FooExternalServiceRuntimeConfiguration config = new FooExternalServiceRuntimeConfiguration(es.getName(), - new FooClientFactory()); - - ConfiguredService configuredService = es.getConfiguredService(); - Service service = configuredService.getService(); - ServiceContract serviceContract = service.getServiceContract(); - Map<Method, InvocationConfiguration> iConfigMap = new HashMap(); - ProxyFactory proxyFactory = proxyFactoryFactory.createProxyFactory(); - Set<Method> javaMethods = JavaIntrospectionHelper.getAllUniqueMethods(serviceContract.getInterface()); - for (Method method : javaMethods) { - InvocationConfiguration iConfig = new InvocationConfiguration(method); - iConfigMap.put(method, iConfig); - } - QualifiedName qName = new QualifiedName(es.getName() + "/" + service.getName()); - ProxyConfiguration pConfiguration = new ProxyConfiguration(qName, iConfigMap, serviceContract.getInterface().getClassLoader(), messageFactory); - proxyFactory.setBusinessInterface(serviceContract.getInterface()); - proxyFactory.setProxyConfiguration(pConfiguration); - config.addTargetProxyFactory(service.getName(), proxyFactory); - configuredService.setProxyFactory(proxyFactory); - if (policyBuilder != null) { - // invoke the reference builder to handle additional policy metadata - policyBuilder.build(configuredService, context); - } - // add tail interceptor - for (InvocationConfiguration iConfig : (Collection<InvocationConfiguration>) iConfigMap.values()) { - iConfig.addTargetInterceptor(new InvokerInterceptor()); - } - - es.getConfiguredService().setRuntimeConfiguration(config); - } else { - return; - - } - } - - private class FooClientFactory implements ObjectFactory { - - public Object getInstance() throws ObjectCreationException { - return new FooClient(); - } - } -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingWireBuilder.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingWireBuilder.java deleted file mode 100644 index bba70e4c84..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooBindingWireBuilder.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.apache.tuscany.container.java.mock.binding.foo; - -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.WireBuilder; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.invocation.InvocationConfiguration; -import org.apache.tuscany.core.invocation.spi.ProxyFactory; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.osoa.sca.annotations.Init; - -public class FooBindingWireBuilder implements WireBuilder { - - public FooBindingWireBuilder() { - super(); - } - - private RuntimeContext runtimeContext; - - @Autowire - public void setRuntimeContext(RuntimeContext context) { - runtimeContext = context; - } - - @Init(eager=true) - public void init() { - runtimeContext.addBuilder(this); - } - - - public void connect(ProxyFactory sourceFactory, ProxyFactory targetFactory, Class targetType, boolean downScope, - ScopeContext targetScopeContext) throws BuilderConfigException { - if (!FooExternalServiceRuntimeConfiguration.class.isAssignableFrom(targetType)) { - return; - } - for (InvocationConfiguration sourceInvocationConfig : sourceFactory.getProxyConfiguration().getInvocationConfigurations() - .values()) { - FooESTargetInvoker invoker = new FooESTargetInvoker(sourceFactory.getProxyConfiguration().getTargetName() - .getPartName(), targetScopeContext); - sourceInvocationConfig.setTargetInvoker(invoker); - // if (downScope) { - // // the source scope is shorter than the target, so the invoker can cache the target instance - // invoker.setCacheable(true); - // } else { - // invoker.setCacheable(false); - // } - } - - } - - public void completeTargetChain(ProxyFactory targetFactory, Class targetType, ScopeContext targetScopeContext) - throws BuilderConfigException { - // TODO implement - } - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooClient.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooClient.java deleted file mode 100644 index 9f67eb7786..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooClient.java +++ /dev/null @@ -1,37 +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.container.java.mock.binding.foo; - -import java.lang.reflect.Array; - -import org.apache.tuscany.core.context.TargetException; - -/** - * A mock client for a transport binding - * - * @version $Rev$ $Date$ - */ -public class FooClient { - - public FooClient() { - } - - public Object invoke(Object msg) { - if (msg!=null && msg.getClass().isArray() && Array.getLength(msg) == 1){ - return Array.get(msg,0); - }else{ - throw new TargetException("This binding only understands operations with a single parameter"); - } - } -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooESTargetInvoker.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooESTargetInvoker.java deleted file mode 100644 index 6dd42ef4d6..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooESTargetInvoker.java +++ /dev/null @@ -1,97 +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.container.java.mock.binding.foo; - -import java.lang.reflect.InvocationTargetException; - -import org.apache.tuscany.core.context.ExternalServiceContext; -import org.apache.tuscany.core.context.InstanceContext; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.context.TargetException; -import org.apache.tuscany.core.invocation.Interceptor; -import org.apache.tuscany.core.invocation.TargetInvoker; -import org.apache.tuscany.core.message.Message; - -/** - * Responsible for invoking a mock transport binding client configured for an external service - * - * @version $Rev$ $Date$ - */ -public class FooESTargetInvoker implements TargetInvoker { - - private String name; - - private ScopeContext container; - - private ExternalServiceContext context; - - public FooESTargetInvoker(String esName, ScopeContext container) { - assert (esName != null) : "No external service name specified"; - assert (container != null) : "No scope container specified"; - name = esName; - this.container = container; - } - - public Object invokeTarget(Object payload) throws InvocationTargetException { - if (context == null) { - InstanceContext iContext = container.getContext(name); - if (!(iContext instanceof ExternalServiceContext)) { - TargetException te = new TargetException("Unexpected target context type"); - te.setIdentifier(iContext.getClass().getName()); - te.addContextName(iContext.getName()); - throw te; - } - context = (ExternalServiceContext) iContext; - } - FooClient client = (FooClient) context.getImplementationInstance(true); - if (payload != null) { - return client.invoke(payload); - } else { - return client.invoke(null); - } - } - - public boolean isCacheable() { - return false; - } - - 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 UnsupportedOperationException(); - } - - public Object clone() { - try { - FooESTargetInvoker invoker = (FooESTargetInvoker) super.clone(); - invoker.container = container; - invoker.context = this.context; - invoker.name = this.name; - return invoker; - } catch (CloneNotSupportedException e) { - return null; // will not happen - } - } - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooEntryPointRuntimeConfiguration.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooEntryPointRuntimeConfiguration.java deleted file mode 100644 index bee388127e..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooEntryPointRuntimeConfiguration.java +++ /dev/null @@ -1,31 +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.container.java.mock.binding.foo; - -import org.apache.tuscany.core.builder.impl.EntryPointRuntimeConfiguration; -import org.apache.tuscany.core.message.MessageFactory; - -/** - * - * - * @version $Rev$ $Date$ - */ -public class FooEntryPointRuntimeConfiguration extends EntryPointRuntimeConfiguration { - - public FooEntryPointRuntimeConfiguration(String name, String serviceName, MessageFactory msgFactory) { - super(name, serviceName, msgFactory); - } - -} - diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceRuntimeConfiguration.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceRuntimeConfiguration.java deleted file mode 100644 index e06a78d529..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/binding/foo/FooExternalServiceRuntimeConfiguration.java +++ /dev/null @@ -1,32 +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.container.java.mock.binding.foo; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.builder.impl.BaseExternalServiceRuntimeConfiguration; - -/** - * Creates instances of {@link org.apache.tuscany.core.context.ExternalServiceContext} configured with the appropriate - * invocation chains and bindings. This implementation serves as a marker for - * {@link org.apache.tuscany.container.java.mock.binding.foo.FooBindingWireBuilder} - * - * @version $Rev$ $Date$ - */ -public class FooExternalServiceRuntimeConfiguration extends BaseExternalServiceRuntimeConfiguration { - - public FooExternalServiceRuntimeConfiguration(String name, ObjectFactory objectFactory) { - super(name, objectFactory); - } - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/AbstractGenericComponent.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/AbstractGenericComponent.java deleted file mode 100644 index 0c9d8172f8..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/AbstractGenericComponent.java +++ /dev/null @@ -1,296 +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.container.java.mock.components; - -import java.util.List; -import java.util.Map; - -import org.osoa.sca.ModuleContext; -import org.osoa.sca.annotations.ComponentName; -import org.osoa.sca.annotations.Context; -import org.osoa.sca.annotations.Property; - -/** - * Base test component implementation - * - * @version $Rev$ $Date$ - */ -public class AbstractGenericComponent implements GenericComponent { - - @ComponentName - private String name; - - public String getName() { - return name; - } - - @Context - private ModuleContext context; - - public ModuleContext getModuleContext() { - return context; - } - - //---------------------------------- - // Collections - //---------------------------------- - - Map testMap; - - public Map getTestMap() { - return testMap; - } - - public void setTestMap(Map testMap) { - this.testMap = testMap; - } - - List testList; - - public List getTestList() { - return testList; - } - - public void setTestList(List testList) { - this.testList = testList; - } - - //---------------------------------- - // Arrays - //---------------------------------- - - private int[] arrayInt; - - public int[] getArrayInt() { - return arrayInt; - } - - public void setArrayInt(int[] arrayInt) { - this.arrayInt = arrayInt; - } - - private float[] arrayFloat; - - public float[] getArrayFloat() { - return arrayFloat; - } - - public void setArrayFloat(float[] pArrayFloat) { - arrayFloat = pArrayFloat; - } - - private double[] arrayDouble; - - public double[] getArrayDouble() { - return arrayDouble; - } - - public void setArrayDouble(double[] pArrayDouble) { - arrayDouble = pArrayDouble; - } - - private long[] arrayLong; - - public long[] getArrayLong() { - return arrayLong; - } - - public void setArrayLong(long[] arrayLong) { - this.arrayLong = arrayLong; - } - - private short[] arrayShort; - - public short[] getArrayShort() { - return arrayShort; - } - - public void setArrayShort(short[] arrayShort) { - this.arrayShort = arrayShort; - } - - private boolean[] arrayBoolean; - - public boolean[] getArrayBoolean() { - return arrayBoolean; - } - - public void setArrayBoolean(boolean[] arrayBoolean) { - this.arrayBoolean = arrayBoolean; - } - - private String[] arrayString; - - public String[] getArrayString() { - return arrayString; - } - - public void setArrayString(String[] arrayString) { - this.arrayString = arrayString; - } - - //---------------------------------- - // Primitives - //---------------------------------- - - private boolean mBoolean; - - public boolean getBoolean() { - return mBoolean; - } - - public void setBoolean(boolean pBoolean) { - mBoolean = pBoolean; - } - - private short mShort; - - public short getShort() { - return mShort; - } - - public void setShort(short pShort) { - mShort = pShort; - } - - private int mInt; - - public int getInt() { - return mInt; - } - - public void setInt(int pInt) { - mInt = pInt; - } - - private long mLong; - - public long getLong() { - return mLong; - } - - public void setLong(long pLong) { - mLong = pLong; - } - - private double mDouble; - - public double getDouble() { - return mDouble; - } - - public void setDouble(double pDouble) { - mDouble = pDouble; - } - - private float mFloat; - - public float getFloat() { - return mFloat; - } - - public void setFloat(float pFloat) { - mFloat = pFloat; - } - - private char mChar; - - public char getChar() { - return mChar; - } - - public void setChar(char pChar) { - mChar = pChar; - } - - //---------------------------------- - // Object types - //---------------------------------- - - private String mString; - - public String getString() { - return mString; - } - - public void setString(String pString) { - mString = pString; - } - - private Short mOShort; - - public Short getOShort() { - return mOShort; - } - - public void setOShort(Short pOShort) { - mOShort = pOShort; - } - - private Integer mOInteger; - - public Integer getOInteger() { - return mOInteger; - } - - public void setOInteger(Integer pOInteger) { - mOInteger = pOInteger; - } - - private Long mOLong; - - public Long getOLong() { - return mOLong; - } - - public void setOLong(Long pOLong) { - mOLong = pOLong; - } - - private Float mOFloat; - - public Float getOFloat() { - return mOFloat; - } - - public void setOFloat(Float pOFloat) { - mOFloat = pOFloat; - } - - private Double mODouble; - - public Double getODouble() { - return mODouble; - } - - public void setODouble(Double pODouble) { - mODouble = pODouble; - } - - @Property(name = "genericComponent") - private GenericComponent mGenericComponent; - - public GenericComponent getGenericComponent() { - return mGenericComponent; - } - - public void setGenericComponent(GenericComponent pGenericComponent) { - mGenericComponent = pGenericComponent; - } - - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadContextPojo.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadContextPojo.java deleted file mode 100644 index 7840b57dea..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadContextPojo.java +++ /dev/null @@ -1,26 +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.container.java.mock.components; - -import org.osoa.sca.annotations.Context; - -public class BadContextPojo { - - @Context - String moduleContext; - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadNamePojo.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadNamePojo.java deleted file mode 100644 index d9753fa9f0..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/BadNamePojo.java +++ /dev/null @@ -1,24 +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.container.java.mock.components; - -import org.osoa.sca.annotations.ComponentName; - -public class BadNamePojo { - @ComponentName - private int name; -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/DataObject.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/DataObject.java deleted file mode 100644 index 695cc2a5a1..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/DataObject.java +++ /dev/null @@ -1,38 +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.container.java.mock.components; - -import java.io.Serializable; - -/** - * A complex type for testing - * - * @version $Rev$ $Date$ - */ -public class DataObject implements Serializable { - - private String stringValue; - - public String getStringValue() { - return stringValue; - } - - public void setStringValue(String stringValue) { - this.stringValue = stringValue; - } - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/GenericComponent.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/GenericComponent.java deleted file mode 100644 index 44f1c02bfd..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/GenericComponent.java +++ /dev/null @@ -1,142 +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.container.java.mock.components; - -import java.util.List; -import java.util.Map; - -import org.osoa.sca.ModuleContext; - -/** - * Generic test component - * - * @version $Rev$ $Date$ - */ -public interface GenericComponent { - - public String getName(); - - public ModuleContext getModuleContext(); - - // ---------------------------------- - // Collections - // ---------------------------------- - - public Map getTestMap(); - - public void setTestMap(Map pTestMap); - - public List getTestList(); - - public void setTestList(List pTestList); - - // ---------------------------------- - // Arrays - // ---------------------------------- - - public int[] getArrayInt(); - - public void setArrayInt(int[] pArrayInt); - - public float[] getArrayFloat(); - - public void setArrayFloat(float[] pArrayFloat); - - public double[] getArrayDouble(); - - public void setArrayDouble(double[] pArrayDouble); - - public long[] getArrayLong(); - - public void setArrayLong(long[] pArrayLong); - - public short[] getArrayShort(); - - public void setArrayShort(short[] pArrayShort); - - public boolean[] getArrayBoolean(); - - public void setArrayBoolean(boolean[] pArrayBoolean); - - public String[] getArrayString(); - - public void setArrayString(String[] pArrayString); - - // ---------------------------------- - // Primitives - // ---------------------------------- - - public boolean getBoolean(); - - public void setBoolean(boolean pBoolean); - - public short getShort(); - - public void setShort(short pShort); - - public int getInt(); - - public void setInt(int pInt); - - public long getLong(); - - public void setLong(long pLong); - - public double getDouble(); - - public void setDouble(double pDouble); - - public float getFloat(); - - public void setFloat(float pFloat); - - public char getChar(); - - public void setChar(char pChar); - - // ---------------------------------- - // Object types - // ---------------------------------- - - public String getString(); - - public void setString(String pString); - - public Short getOShort(); - - public void setOShort(Short pOShort); - - public Integer getOInteger(); - - public void setOInteger(Integer pOInteger); - - public Long getOLong(); - - public void setOLong(Long pOLong); - - public Float getOFloat(); - - public void setOFloat(Float pOFloat); - - public Double getODouble(); - - public void setODouble(Double pODouble); - - public GenericComponent getGenericComponent(); - - public void setGenericComponent(GenericComponent pGenericComponent); -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/HelloWorldClient.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/HelloWorldClient.java deleted file mode 100644 index 1e7ca9f36b..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/HelloWorldClient.java +++ /dev/null @@ -1,46 +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.container.java.mock.components; - -import org.apache.tuscany.container.java.assembly.mock.HelloWorldService; - -/** - * - * - * @version $Rev$ $Date$ - */ -public class HelloWorldClient implements HelloWorldService{ - - private int count; - - public HelloWorldClient() { - } - - private HelloWorldService service; - - public void setHelloWorldService(HelloWorldService service){ - this.service = service; - } - - public String hello(String name) { - ++count; - return service.hello(name); - } - - public int count() { - return count; - } - -} - diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/LocalComponentImpl.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/LocalComponentImpl.java deleted file mode 100644 index 4b57c7f301..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/LocalComponentImpl.java +++ /dev/null @@ -1,97 +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.container.java.mock.components; - -import org.osoa.sca.ModuleContext; -import org.osoa.sca.annotations.ComponentName; -import org.osoa.sca.annotations.Context; -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; - -/** - * A test local service - * - * @version $Rev$ $Date$ - */ - -public class LocalComponentImpl { - - @ComponentName - protected String name; - - public String getName() { - return name; - } - - @Context - protected ModuleContext moduleCtx; - - public ModuleContext getModuleContext() { - return moduleCtx; - } - - @Property(name = "fieldSetter", required = true) - private String mfieldSetter; - - public String getfieldSetter() { - return mfieldSetter; - } - - public void setfieldSetter(String pfieldSetter) throws Exception { - throw new Exception("Set method instead of field"); - } - - private String mMethodSetter; - boolean mSetByMethod; - - public String getMethodSetter() throws Exception { - if (mSetByMethod) { - return mMethodSetter; - } - throw new Exception("Property method setter failed"); - - } - - @Property(required = true) - public void setMethodSetter(String pMethodSetter) { - mSetByMethod = true; - mMethodSetter = pMethodSetter; - } - - @Reference(name = "requiredDataObject", required = true) - private DataObject mRequiredDataObject; - - public DataObject getRequiredDataObject() { - return mRequiredDataObject; - } - - public void setRequiredDataObject(DataObject pRequiredDataObject) { - mRequiredDataObject = pRequiredDataObject; - } - - @Reference(name = "optionalDataObject") - private DataObject mOptionalDataObject; - - public DataObject getOptionalDataObject() { - return mOptionalDataObject; - } - - public void setOptionalDataObject(DataObject pOptionalDataObject) { - mOptionalDataObject = pOptionalDataObject; - } - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponent.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponent.java deleted file mode 100644 index 7787e8cf5b..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponent.java +++ /dev/null @@ -1,29 +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.container.java.mock.components; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("MODULE") -public interface ModuleScopeComponent extends GenericComponent { - - //public boolean isInit(); -} - diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.componentType b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.componentType deleted file mode 100644 index ca4c633e59..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.componentType +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?>
-<!--
- Copyright (c) 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.
- -->
-<!-- remove this once ImplementationImpl is fixed not to requrie this -->
-<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9">
-
- <service name="ModuleScopeComponent" scope="module">
- <interface.java interface="janus.test.component.ModuleScopeComponent"/>
- </service> - <!-- Not supported, not in the spec
- <property.java name="mInt" class="java.lang.Integer" default="default"/>
- <property.java name="foo" class="java.lang.String" default="default"/> - -->
- <reference name="mGenericComponent" multiplicity="0..1">
- <interface.java interface="test.org.apache.tuscany.container.java.components.AbstractGenericComponent"/>
- </reference>
-
-</componentType>
-
diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.java deleted file mode 100644 index ca65be4bb0..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeComponentImpl.java +++ /dev/null @@ -1,47 +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.container.java.mock.components; - - -/** - * @version $Rev$ $Date$ - */ -public class ModuleScopeComponentImpl extends AbstractGenericComponent implements - ModuleScopeComponent { - -// private boolean init; -// -// @Init(eager=false) -// public void init(){ -// init= true; -// } -// -// public boolean isInit(){ -// return init; -// } - - - private String foo; - - public void setFoo(String foo) { - this.foo = foo; - } - - public String getFoo() { - return foo; - } -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeDestroyOnlyComponent.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeDestroyOnlyComponent.java deleted file mode 100644 index 76218c2d6c..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeDestroyOnlyComponent.java +++ /dev/null @@ -1,34 +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.container.java.mock.components; - -import org.osoa.sca.annotations.Destroy; - -public class ModuleScopeDestroyOnlyComponent extends ModuleScopeComponentImpl { - - boolean destroyed = false; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitComponent.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitComponent.java deleted file mode 100644 index 56a0421f24..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitComponent.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.container.java.mock.components; - -import org.osoa.sca.annotations.Init; - -public class ModuleScopeEagerInitComponent extends ModuleScopeComponentImpl { - - boolean initialized = false; - - public boolean isInitialized() { - return initialized; - } - - // this value tests to ensure introspection can find the init() method even - // if a field is named the same. Ultimately, this should be in the - // introspection tests - private boolean init; - - @Init(eager = true) - public void init() { - initialized = true; - } - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitDestroyComponent.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitDestroyComponent.java deleted file mode 100644 index dae156737a..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeEagerInitDestroyComponent.java +++ /dev/null @@ -1,33 +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.container.java.mock.components; - -import org.osoa.sca.annotations.Destroy; - -public class ModuleScopeEagerInitDestroyComponent extends ModuleScopeEagerInitComponent { - - boolean destroyed = false; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitDestroyComponent.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitDestroyComponent.java deleted file mode 100644 index d9b1303677..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitDestroyComponent.java +++ /dev/null @@ -1,34 +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.container.java.mock.components; - -import org.osoa.sca.annotations.Destroy; - -public class ModuleScopeInitDestroyComponent extends ModuleScopeInitOnlyComponent { - - boolean destroyed = false; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitOnlyComponent.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitOnlyComponent.java deleted file mode 100644 index a9b465d79e..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/ModuleScopeInitOnlyComponent.java +++ /dev/null @@ -1,38 +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.container.java.mock.components; - -import org.osoa.sca.annotations.Init; - -public class ModuleScopeInitOnlyComponent extends ModuleScopeComponentImpl { - - boolean initialized = false; - - public boolean isInitialized() { - return initialized; - } - - // this value tests to ensure introspection can find the init() method even - // if a field is named the same. Ultimately, this should be in the introspection tests - private boolean init; - - @Init - public void init() { - initialized = true; - } - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableService.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableService.java deleted file mode 100644 index 645fd7f47c..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableService.java +++ /dev/null @@ -1,40 +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.container.java.mock.components; - -import org.osoa.sca.annotations.Remotable; - -/** - * Used for testing basic remoting operations - * - * @version $Rev$ $Date$ - */ - -@Remotable -public interface RemotableService { - - public void syncOneWay(String msg); - - public String syncTwoWay(String msg); - - public DataObject syncTwoWayCustomType(DataObject val); - - public String getString(); - - public void setString(String string); - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableServiceImpl.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableServiceImpl.java deleted file mode 100644 index 34a4273323..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RemotableServiceImpl.java +++ /dev/null @@ -1,61 +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.container.java.mock.components; - -import junit.framework.Assert; -import org.osoa.sca.annotations.Property; - - -/** - * @version $Rev$ $Date$ - */ -public class RemotableServiceImpl implements RemotableService { - - // ---------------------------------- - // Properties - // ---------------------------------- - - @Property(name = "string", required = true) - private String mString; - - public String getString() { - return mString; - } - - public void setString(String string) { - mString = string; - } - - // ---------------------------------- - // Methods - // ---------------------------------- - - public void syncOneWay(String msg) { - Assert.assertEquals("hello", msg); - } - - public String syncTwoWay(String msg) { - return "response"; - } - - public DataObject syncTwoWayCustomType(DataObject val) { - Assert.assertEquals("hello", val.getStringValue()); - DataObject dto = new DataObject(); - dto.setStringValue("return"); - return dto; - } -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponent.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponent.java deleted file mode 100644 index ac7931bd2c..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponent.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.container.java.mock.components; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("REQUEST") -public interface RequestScopeComponent extends GenericComponent { - -} - diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponentImpl.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponentImpl.java deleted file mode 100644 index 5b20519d90..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/RequestScopeComponentImpl.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.container.java.mock.components; - -/** - * @version $Rev$ $Date$ - */ -public class RequestScopeComponentImpl extends AbstractGenericComponent implements - RequestScopeComponent { - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponent.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponent.java deleted file mode 100644 index 236e083a2b..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponent.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.container.java.mock.components; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("SESSION") -public interface SessionScopeComponent extends GenericComponent { - -} - diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponentImpl.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponentImpl.java deleted file mode 100644 index 41ffeccdfc..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeComponentImpl.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.container.java.mock.components; - -/** - * @version $Rev$ $Date$ - */ -public class SessionScopeComponentImpl extends AbstractGenericComponent implements - SessionScopeComponent { - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeDestroyOnlyComponent.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeDestroyOnlyComponent.java deleted file mode 100644 index be20a23d29..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeDestroyOnlyComponent.java +++ /dev/null @@ -1,34 +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.container.java.mock.components; - -import org.osoa.sca.annotations.Destroy; - -public class SessionScopeDestroyOnlyComponent extends SessionScopeComponentImpl { - - boolean destroyed = false; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitDestroyComponent.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitDestroyComponent.java deleted file mode 100644 index 32aa0142a4..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitDestroyComponent.java +++ /dev/null @@ -1,34 +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.container.java.mock.components; - -import org.osoa.sca.annotations.Destroy; - -public class SessionScopeInitDestroyComponent extends SessionScopeInitOnlyComponent { - - boolean destroyed = false; - - public boolean isDestroyed() { - return destroyed; - } - - @Destroy - public void destroy() { - destroyed = true; - } - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitOnlyComponent.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitOnlyComponent.java deleted file mode 100644 index a518a9b244..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/SessionScopeInitOnlyComponent.java +++ /dev/null @@ -1,35 +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.container.java.mock.components; - -import org.osoa.sca.annotations.Init; - -public class SessionScopeInitOnlyComponent extends SessionScopeComponentImpl { - - boolean initialized = false; - - public boolean isInitialized() { - return initialized; - } - - @Init - public void init() { - initialized = true; - } - - -} diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponent.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponent.java deleted file mode 100644 index 3fe84dd785..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponent.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.container.java.mock.components; - -import org.osoa.sca.annotations.Scope; - -/** - * @version $Rev$ $Date$ - */ -@Scope("STATELESS") -public interface StatelessComponent extends GenericComponent { - -} - diff --git a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponentImpl.java b/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponentImpl.java deleted file mode 100644 index 8b806d6a2e..0000000000 --- a/tags/java-stable-20060304/sca/container.java/src/test/java/org/apache/tuscany/container/java/mock/components/StatelessComponentImpl.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.container.java.mock.components; - -/** - * @version $Rev$ $Date$ - */ -public class StatelessComponentImpl extends AbstractGenericComponent implements - StatelessComponent { - -} |