You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Jim Marino <jm...@myroma.net> on 2006/03/11 01:07:20 UTC

Fwd: svn commit: r384939 - in /incubator/tuscany/java/sca: container.java/src/test/java/org/apache/tuscany/container/java/mock/ container.js/src/test/java/org/apache/tuscany/container/js/mock/ core/src/main/java/org/apache/tuscany/core/system/assembly/ core...

Jeremy,

I'm in the process of trying to check in changes for multiplicity but  
some of the changes you just did impacted me. I need to create  
references between components and set the multiplicity value.  Can  
you explain how this works for the two MockFactory classes in .core  
and .java?

Thanks,
Jim



Begin forwarded message:

> From: jboynes@apache.org
> Date: March 10, 2006 2:25:20 PM PST
> To: tuscany-commits@ws.apache.org
> Subject: svn commit: r384939 - in /incubator/tuscany/java/sca:  
> container.java/src/test/java/org/apache/tuscany/container/java/ 
> mock/ container.js/src/test/java/org/apache/tuscany/container/js/ 
> mock/ core/src/main/java/org/apache/tuscany/core/system/assembly/  
> core...
> Reply-To: tuscany-dev@ws.apache.org
>
>
> Author: jboynes
> Date: Fri Mar 10 14:25:18 2006
> New Revision: 384939
>
> URL: http://svn.apache.org/viewcvs?rev=384939&view=rev
> Log:
> add helper methods to the model factories
> refactor test cases to use them (making them simpler)
>
> Modified:
>     incubator/tuscany/java/sca/container.java/src/test/java/org/ 
> apache/tuscany/container/java/mock/MockFactory.java
>     incubator/tuscany/java/sca/container.js/src/test/java/org/ 
> apache/tuscany/container/js/mock/MockAssemblyFactory.java
>     incubator/tuscany/java/sca/core/src/main/java/org/apache/ 
> tuscany/core/system/assembly/SystemAssemblyFactory.java
>     incubator/tuscany/java/sca/core/src/main/java/org/apache/ 
> tuscany/core/system/assembly/impl/SystemAssemblyFactoryImpl.java
>     incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/context/AbstractAggregateHierarchyTests.java
>     incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/context/AggregateComponentContextRegisterTestCase.java
>     incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/context/AggregateHierarchyTestCase.java
>     incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/integration/IntraAggregateWireIntegrationTestCase.java
>     incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/mock/MockFactory.java
>     incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/runtime/RuntimeContextImplTestCase.java
>     incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/system/builder/SystemComponentContextBuilderTestCase.java
>     incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/system/context/ 
> SystemAggregateComponentContextTestCase.java
>     incubator/tuscany/java/sca/model/src/main/java/org/apache/ 
> tuscany/model/assembly/AssemblyFactory.java
>     incubator/tuscany/java/sca/model/src/main/java/org/apache/ 
> tuscany/model/assembly/impl/AssemblyFactoryImpl.java
>
> Modified: incubator/tuscany/java/sca/container.java/src/test/java/ 
> org/apache/tuscany/container/java/mock/MockFactory.java
> URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/ 
> container.java/src/test/java/org/apache/tuscany/container/java/mock/ 
> MockFactory.java?rev=384939&r1=384938&r2=384939&view=diff
> ====================================================================== 
> ========
> --- incubator/tuscany/java/sca/container.java/src/test/java/org/ 
> apache/tuscany/container/java/mock/MockFactory.java (original)
> +++ incubator/tuscany/java/sca/container.java/src/test/java/org/ 
> apache/tuscany/container/java/mock/MockFactory.java Fri Mar 10  
> 14:25:18 2006
> @@ -36,7 +36,6 @@
>  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.FooBindingWireBuild 
> er;
> @@ -50,6 +49,7 @@
>  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.builder.WireBuilder;
>  import org.apache.tuscany.core.config.ConfigurationException;
>  import org.apache.tuscany.core.config.JavaIntrospectionHelper;
>  import org.apache.tuscany.core.context.AggregateContext;
> @@ -138,31 +138,6 @@
>      }
>
>      /**
> -     * 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) {
> @@ -627,8 +602,8 @@
>          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.registerModelObject(systemFactory.createSystemComponent 
> (JAVA_BUILDER, RuntimeConfigurationBuilder.class,  
> JavaComponentContextBuilder.class, Scope.MODULE));
> +        ctx.registerModelObject(systemFactory.createSystemComponent 
> (JAVA_WIRE_BUILDER, WireBuilder.class, JavaTargetWireBuilder.class,  
> Scope.MODULE));
>          ctx.fireEvent(EventContext.MODULE_START, null);
>          return runtime;
>      }
> @@ -642,9 +617,8 @@
>          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));
> +        child.registerModelObject 
> (systemFactory.createSystemComponent(FOO_BUILDER,  
> RuntimeConfigurationBuilder.class, FooBindingBuilder.class,  
> Scope.MODULE));
> +        child.registerModelObject 
> (systemFactory.createSystemComponent(FOO_WIRE_BUILDER,  
> WireBuilder.class, 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));
>
> Modified: incubator/tuscany/java/sca/container.js/src/test/java/org/ 
> apache/tuscany/container/js/mock/MockAssemblyFactory.java
> URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/ 
> container.js/src/test/java/org/apache/tuscany/container/js/mock/ 
> MockAssemblyFactory.java?rev=384939&r1=384938&r2=384939&view=diff
> ====================================================================== 
> ========
> --- incubator/tuscany/java/sca/container.js/src/test/java/org/ 
> apache/tuscany/container/js/mock/MockAssemblyFactory.java (original)
> +++ incubator/tuscany/java/sca/container.js/src/test/java/org/ 
> apache/tuscany/container/js/mock/MockAssemblyFactory.java Fri Mar  
> 10 14:25:18 2006
> @@ -89,68 +89,4 @@
>          sc.setComponentImplementation(impl);
>          return sc;
>      }
> -
> -    // public static SimpleComponent createComponent(String name,  
> String scriptFile, String serviceName, ScopeEnum
> -    // scope)
> -    // throws NoSuchMethodException, ClassNotFoundException {
> -    // SimpleComponent sc = new PojoSimpleComponent();
> -    // PojoJavaScriptImplementation impl = new  
> PojoJavaScriptImplementation();
> -    // impl.setScriptFile(scriptFile);
> -    // impl.initialize(new AssemblyModelContextImpl());
> -    //
> -    // sc.setComponentImplementation(impl);
> -    // Service s = new PojoService();
> -    // s.setName(serviceName.substring(serviceName.lastIndexOf 
> ('.') + 1));
> -    // PojoJavaInterface ji = new PojoJavaInterface();
> -    // ji.setInterface(serviceName);
> -    // Class claz = JavaIntrospectionHelper.loadClass(serviceName);
> -    // PojoInterfaceType iType = new PojoInterfaceType();
> -    // iType.setInstanceClass(claz);
> -    // for (Method m : claz.getMethods()) {
> -    // // assume no method overloading
> -    // PojoOperationType type = new PojoOperationType();
> -    // type.setName(m.getName());
> -    // for (Class inputType : m.getParameterTypes()) {
> -    // type.setOutputType(new SDOType 
> (null,null,inputType,Collections.EMPTY_LIST));
> -    // }
> -    // iType.addOperationType(type);
> -    // }
> -    // ji.setInterfaceType(iType);
> -    //
> -    //
> -    // s.setInterfaceContract(ji);
> -    // ji.setScope(scope);
> -    // impl.getServices().add(s);
> -    // sc.setName(name);
> -    // sc.setComponentImplementation(impl);
> -    // PojoConfiguredService cService = new PojoConfiguredService();
> -    // cService.setService(s);
> -    // sc.getConfiguredServices().add(cService);
> -    // return sc;
> -    // }
> -    //
> -    // public static Component createSystemComponent(String name,  
> String type, ScopeEnum scope) throws
> -    // NoSuchMethodException,
> -    // ClassNotFoundException {
> -    //
> -    // Class claz = JavaIntrospectionHelper.loadClass(type);
> -    // PojoComponent sc = null;
> -    // if (AggregateContext.class.isAssignableFrom(claz)) {
> -    // sc = new PojoAggregateComponent();
> -    // } else {
> -    // sc = new PojoSimpleComponent();
> -    // }
> -    // SystemImplementation impl = new PojoSystemImplementation();
> -    // impl.setClass(type);
> -    // sc.setComponentImplementation(impl);
> -    // Service s = new PojoService();
> -    // JavaInterface ji = new PojoJavaInterface();
> -    // s.setInterfaceContract(ji);
> -    // ji.setScope(scope);
> -    // impl.getServices().add(s);
> -    // sc.setName(name);
> -    // sc.setComponentImplementation(impl);
> -    // return sc;
> -    // }
> -
>  }
>
> Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/ 
> tuscany/core/system/assembly/SystemAssemblyFactory.java
> URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/ 
> src/main/java/org/apache/tuscany/core/system/assembly/ 
> SystemAssemblyFactory.java?rev=384939&r1=384938&r2=384939&view=diff
> ====================================================================== 
> ========
> --- incubator/tuscany/java/sca/core/src/main/java/org/apache/ 
> tuscany/core/system/assembly/SystemAssemblyFactory.java (original)
> +++ incubator/tuscany/java/sca/core/src/main/java/org/apache/ 
> tuscany/core/system/assembly/SystemAssemblyFactory.java Fri Mar 10  
> 14:25:18 2006
> @@ -17,6 +17,8 @@
>  package org.apache.tuscany.core.system.assembly;
>
>  import org.apache.tuscany.model.assembly.AssemblyFactory;
> +import org.apache.tuscany.model.assembly.Component;
> +import org.apache.tuscany.model.assembly.Scope;
>
>  /**
>   * A factory for building system assembly model artifacts
> @@ -28,11 +30,21 @@
>      /**
>       * Returns an assembly model artifact representing a system  
> component implementation
>       */
> -    SystemImplementation createSystemImplementation();
> +    SystemImplementation createSystemImplementation();
>
>      /**
>       * Returns an assembly model artifact representing a system  
> binding
>       */
>      SystemBinding createSystemBinding();
>
> +    /**
> +     * Helper method for creating a typical system component.
> +     *
> +     * @param name the name of the component
> +     * @param service the service that the component provides
> +     * @param impl the component implementation
> +     * @param scope the component's scope
> +     * @return a Component model object with the appropriate  
> system implementation
> +     */
> +    <T> Component createSystemComponent(String name, Class<T>  
> service, Class<? extends T> impl, Scope scope);
>  }
>
> Modified: incubator/tuscany/java/sca/core/src/main/java/org/apache/ 
> tuscany/core/system/assembly/impl/SystemAssemblyFactoryImpl.java
> URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/ 
> src/main/java/org/apache/tuscany/core/system/assembly/impl/ 
> SystemAssemblyFactoryImpl.java? 
> rev=384939&r1=384938&r2=384939&view=diff
> ====================================================================== 
> ========
> --- incubator/tuscany/java/sca/core/src/main/java/org/apache/ 
> tuscany/core/system/assembly/impl/SystemAssemblyFactoryImpl.java  
> (original)
> +++ incubator/tuscany/java/sca/core/src/main/java/org/apache/ 
> tuscany/core/system/assembly/impl/SystemAssemblyFactoryImpl.java  
> Fri Mar 10 14:25:18 2006
> @@ -20,6 +20,11 @@
>  import org.apache.tuscany.core.system.assembly.SystemBinding;
>  import org.apache.tuscany.core.system.assembly.SystemImplementation;
>  import org.apache.tuscany.model.assembly.impl.AssemblyFactoryImpl;
> +import org.apache.tuscany.model.assembly.Component;
> +import org.apache.tuscany.model.assembly.Scope;
> +import org.apache.tuscany.model.assembly.Service;
> +import org.apache.tuscany.model.assembly.ComponentType;
> +import org.apache.tuscany.model.types.java.JavaServiceContract;
>
>  /**
>   * The default implementation of the system assembly factory
> @@ -37,5 +42,25 @@
>
>      public SystemBinding createSystemBinding() {
>          return new SystemBindingImpl();
> +    }
> +
> +    public <T> Component createSystemComponent(String name,  
> Class<T> service, Class<? extends T> impl, Scope scope) {
> +        JavaServiceContract jsc = createJavaServiceContract();
> +        jsc.setInterface(service);
> +        jsc.setScope(scope);
> +        Service s = createService();
> +        s.setServiceContract(jsc);
> +
> +        ComponentType componentType = createComponentType();
> +        componentType.getServices().add(s);
> +
> +        SystemImplementation sysImpl = createSystemImplementation();
> +        sysImpl.setImplementationClass(impl);
> +        sysImpl.setComponentType(componentType);
> +
> +        Component sc = createSimpleComponent();
> +        sc.setName(name);
> +        sc.setComponentImplementation(sysImpl);
> +        return sc;
>      }
>  }
>
> Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/context/AbstractAggregateHierarchyTests.java
> URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/ 
> src/test/java/org/apache/tuscany/core/context/ 
> AbstractAggregateHierarchyTests.java? 
> rev=384939&r1=384938&r2=384939&view=diff
> ====================================================================== 
> ========
> --- incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/context/AbstractAggregateHierarchyTests.java (original)
> +++ incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/context/AbstractAggregateHierarchyTests.java Fri Mar  
> 10 14:25:18 2006
> @@ -27,6 +27,8 @@
>  import org.apache.tuscany.core.mock.MockFactory;
>  import  
> org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent;
>  import  
> org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl;
> +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory;
> +import  
> org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl 
> ;
>  import org.apache.tuscany.model.assembly.Component;
>  import org.apache.tuscany.model.assembly.EntryPoint;
>  import org.apache.tuscany.model.assembly.Scope;
> @@ -39,15 +41,14 @@
>   */
>  public abstract class AbstractAggregateHierarchyTests extends  
> TestCase {
>      protected List<RuntimeConfigurationBuilder> builders;
> +    protected SystemAssemblyFactory factory;
>
>      public void testParentContextIsolation() throws Exception {
>          AggregateContext parent = createContextHierachy();
>          AggregateContext child = (AggregateContext)  
> parent.getContext("test.child");
> -        Component component = MockFactory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponentImpl.class,
> -                Scope.MODULE);
> +        Component component = factory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponent.class,  
> ModuleScopeSystemComponentImpl.class, Scope.MODULE);
>          parent.registerModelObject(component);
> -        EntryPoint ep = MockFactory.createEPSystemBinding 
> ("TestService1EP", ModuleScopeSystemComponent.class, "TestService1",
> -                component);
> +        EntryPoint ep = MockFactory.createEPSystemBinding 
> ("TestService1EP", ModuleScopeSystemComponent.class,  
> "TestService1", component);
>          parent.registerModelObject(ep);
>          parent.fireEvent(EventContext.MODULE_START, null);
>          child.fireEvent(EventContext.MODULE_START, null);
> @@ -102,6 +103,7 @@
>
>      protected void setUp() throws Exception {
>          super.setUp();
> +        factory = new SystemAssemblyFactoryImpl();
>          builders = MockFactory.createSystemBuilders();
>      }
>  }
>
> Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/context/AggregateComponentContextRegisterTestCase.java
> URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/ 
> src/test/java/org/apache/tuscany/core/context/ 
> AggregateComponentContextRegisterTestCase.java? 
> rev=384939&r1=384938&r2=384939&view=diff
> ====================================================================== 
> ========
> --- incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/context/AggregateComponentContextRegisterTestCase.java  
> (original)
> +++ incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/context/AggregateComponentContextRegisterTestCase.java  
> Fri Mar 10 14:25:18 2006
> @@ -28,6 +28,8 @@
>  import org.apache.tuscany.core.mock.component.GenericSystemComponent;
>  import  
> org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent;
>  import  
> org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl;
> +import  
> org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl 
> ;
> +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory;
>  import org.apache.tuscany.model.assembly.Component;
>  import org.apache.tuscany.model.assembly.EntryPoint;
>  import org.apache.tuscany.model.assembly.Module;
> @@ -39,6 +41,7 @@
>   * @version $Rev$ $Date$
>   */
>  public class AggregateComponentContextRegisterTestCase extends  
> TestCase {
> +    private SystemAssemblyFactory factory;
>
>      public void testModuleRegistration() throws Exception {
>          AggregateContext moduleContext = createContext();
> @@ -70,11 +73,9 @@
>
>      public void testRegistration() throws Exception {
>          AggregateContext moduleContext = createContext();
> -        Component component = MockFactory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponentImpl.class,
> -                Scope.MODULE);
> +        Component component = factory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponent.class,  
> ModuleScopeSystemComponentImpl.class, Scope.MODULE);
>          moduleContext.registerModelObject(component);
> -        EntryPoint ep = MockFactory.createEPSystemBinding 
> ("TestService1EP", ModuleScopeSystemComponent.class, "TestService1",
> -                component);
> +        EntryPoint ep = MockFactory.createEPSystemBinding 
> ("TestService1EP", ModuleScopeSystemComponent.class,  
> "TestService1", component);
>          moduleContext.registerModelObject(ep);
>          moduleContext.start();
>          moduleContext.fireEvent(EventContext.MODULE_START, null);
> @@ -88,12 +89,10 @@
>
>      public void testRegistrationAfterStart() throws Exception {
>          AggregateContext moduleContext = createContext();
> -        Component component = MockFactory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponentImpl.class,
> -                Scope.MODULE);
> +        Component component = factory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponent.class,  
> ModuleScopeSystemComponentImpl.class, Scope.MODULE);
>          moduleContext.start();
>          moduleContext.registerModelObject(component);
> -        EntryPoint ep = MockFactory.createEPSystemBinding 
> ("TestService1EP", ModuleScopeSystemComponent.class, "TestService1",
> -                component);
> +        EntryPoint ep = MockFactory.createEPSystemBinding 
> ("TestService1EP", ModuleScopeSystemComponent.class,  
> "TestService1", component);
>          moduleContext.registerModelObject(ep);
>          moduleContext.fireEvent(EventContext.MODULE_START, null);
>          GenericSystemComponent test = (GenericSystemComponent)  
> moduleContext.locateInstance("TestService1");
> @@ -106,15 +105,13 @@
>
>      public void testEPRegistrationAfterModuleStart() throws  
> Exception {
>          AggregateContext moduleContext = createContext();
> -        Component component = MockFactory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponentImpl.class,
> -                Scope.MODULE);
> +        Component component = factory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponent.class,  
> ModuleScopeSystemComponentImpl.class, Scope.MODULE);
>          moduleContext.start();
>          moduleContext.registerModelObject(component);
>          moduleContext.fireEvent(EventContext.MODULE_START, null);
>          GenericSystemComponent test = (GenericSystemComponent)  
> moduleContext.locateInstance("TestService1");
>          Assert.assertNotNull(test);
> -        EntryPoint ep = MockFactory.createEPSystemBinding 
> ("TestService1EP", ModuleScopeSystemComponent.class, "TestService1",
> -                component);
> +        EntryPoint ep = MockFactory.createEPSystemBinding 
> ("TestService1EP", ModuleScopeSystemComponent.class,  
> "TestService1", component);
>          moduleContext.registerModelObject(ep);
>          GenericSystemComponent testEP = (GenericSystemComponent)  
> moduleContext.locateInstance("TestService1EP");
>          Assert.assertNotNull(testEP);
> @@ -126,5 +123,10 @@
>          List<RuntimeConfigurationBuilder> builders =  
> MockFactory.createSystemBuilders();
>          return new AggregateContextImpl("test.context", null, new  
> DefaultScopeStrategy(), new EventContextImpl(),
>                  new MockConfigContext(builders), new  
> NullMonitorFactory());
> +    }
> +
> +    protected void setUp() throws Exception {
> +        factory = new SystemAssemblyFactoryImpl();
> +        super.setUp();
>      }
>  }
>
> Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/context/AggregateHierarchyTestCase.java
> URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/ 
> src/test/java/org/apache/tuscany/core/context/ 
> AggregateHierarchyTestCase.java? 
> rev=384939&r1=384938&r2=384939&view=diff
> ====================================================================== 
> ========
> --- incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/context/AggregateHierarchyTestCase.java (original)
> +++ incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/context/AggregateHierarchyTestCase.java Fri Mar 10  
> 14:25:18 2006
> @@ -29,6 +29,8 @@
>  import org.apache.tuscany.model.assembly.Component;
>  import org.apache.tuscany.model.assembly.EntryPoint;
>  import org.apache.tuscany.model.assembly.Scope;
> +import  
> org.apache.tuscany.model.assembly.impl.AssemblyModelContextImpl;
> +
>  import org.osoa.sca.ModuleContext;
>  import org.osoa.sca.ServiceUnavailableException;
>
> @@ -47,8 +49,8 @@
>      public void testChildContextIsolation() throws Exception {
>          AggregateContext parent = createContextHierachy();
>          AggregateContext child = (AggregateContext)  
> parent.getContext("test.child");
> -        Component component =  
> MockFactory.createSystemInitializedComponent("TestService1",  
> ModuleScopeSystemComponentImpl.class,
> -                Scope.MODULE);
> +        Component component = factory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponent.class,  
> ModuleScopeSystemComponentImpl.class, Scope.MODULE);
> +        component.initialize(new AssemblyModelContextImpl(factory,  
> null, null));
>          child.registerModelObject(component);
>          parent.fireEvent(EventContext.MODULE_START, null);
>          child.fireEvent(EventContext.MODULE_START, null);
> @@ -63,7 +65,7 @@
>
>          // now expose the service as an entry point
>          // FIXME hack to get around initialization of component -  
> just create another one ;-)
> -        component = MockFactory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponentImpl.class, Scope.MODULE);
> +        component = factory.createSystemComponent("TestService1",  
> ModuleScopeSystemComponent.class,  
> ModuleScopeSystemComponentImpl.class, Scope.MODULE);
>          EntryPoint ep = MockFactory.createEPSystemBinding 
> ("TestService1EP", ModuleScopeSystemComponent.class, "TestService1",
>                  component);
>          child.registerModelObject(ep);
>
> Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/integration/IntraAggregateWireIntegrationTestCase.java
> URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/ 
> src/test/java/org/apache/tuscany/core/integration/ 
> IntraAggregateWireIntegrationTestCase.java? 
> rev=384939&r1=384938&r2=384939&view=diff
> ====================================================================== 
> ========
> --- incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/integration/IntraAggregateWireIntegrationTestCase.java  
> (original)
> +++ incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/integration/IntraAggregateWireIntegrationTestCase.java  
> Fri Mar 10 14:25:18 2006
> @@ -22,6 +22,7 @@
>  import org.apache.tuscany.core.mock.component.Source;
>  import org.apache.tuscany.core.mock.component.Target;
>  import org.apache.tuscany.core.runtime.RuntimeContext;
> +import org.apache.tuscany.core.config.ConfigurationException;
>  import org.apache.tuscany.model.assembly.Scope;
>
>  /**
> @@ -31,11 +32,11 @@
>   */
>  public class IntraAggregateWireIntegrationTestCase extends TestCase {
>
> -    public void testWireConstruction() throws Exception {
> +    public void testWireConstruction() throws  
> ConfigurationException {
>          RuntimeContext runtime = MockFactory.createCoreRuntime();
>          runtime.getSystemContext().registerModelObject 
> (MockFactory.createSystemAggregateComponent("test.system"));
>          AggregateContext context = (AggregateContext)  
> runtime.getSystemContext().getContext 
> ("test.system").getImplementationInstance();
> -
> +
>          context.fireEvent(EventContext.MODULE_START, null);
>          context.registerModelObject 
> (MockFactory.createSystemModuleWithWiredComponents 
> (Scope.MODULE,Scope.MODULE));
>          Source source = (Source) context.getContext 
> ("source").getImplementationInstance();
> @@ -45,7 +46,7 @@
>          Target target = (Target) context.getContext 
> ("target").getImplementationInstance();
>          Assert.assertSame(target, targetRef);
>          Source source2 = (Source) context.getContext 
> ("source").getImplementationInstance();
> -        Assert.assertSame(target, source.getTarget());
> +        Assert.assertSame(target, source2.getTarget());
>          context.fireEvent(EventContext.MODULE_STOP, null);
>          context.stop();
>      }
>
> Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/mock/MockFactory.java
> URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/ 
> src/test/java/org/apache/tuscany/core/mock/MockFactory.java? 
> rev=384939&r1=384938&r2=384939&view=diff
> ====================================================================== 
> ========
> --- incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/mock/MockFactory.java (original)
> +++ incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/mock/MockFactory.java Fri Mar 10 14:25:18 2006
> @@ -18,7 +18,6 @@
>
>  import org.apache.tuscany.core.builder.RuntimeConfigurationBuilder;
>  import org.apache.tuscany.core.config.ConfigurationException;
> -import org.apache.tuscany.core.context.AggregateContext;
>  import org.apache.tuscany.core.context.impl.AggregateContextImpl;
>  import  
> org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent;
>  import  
> org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl;
> @@ -48,7 +47,6 @@
>  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;
>
> @@ -67,35 +65,10 @@
>      }
>
>      /**
> -     * 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();
> +        Component sc = systemFactory.createModuleComponent();
>          SystemImplementation impl =  
> systemFactory.createSystemImplementation();
>          impl.setImplementationClass(AggregateContextImpl.class);
>          sc.setComponentImplementation(impl);
> @@ -114,7 +87,7 @@
>       * Creates an aggregate component with the given name
>       */
>      public static Component createSystemAggregateComponent(String  
> name) {
> -        Component sc = sc = systemFactory.createModuleComponent();
> +        Component sc = systemFactory.createModuleComponent();
>          SystemImplementation impl =  
> systemFactory.createSystemImplementation();
>          impl.setImplementationClass 
> (SystemAggregateContextImpl.class);
>          sc.setComponentImplementation(impl);
> @@ -130,15 +103,6 @@
>      }
>
>      /**
> -     * Creates and initializes a system component of the given  
> type with the given name and scope
> -     */
> -    public static Component createSystemInitializedComponent 
> (String name, Class type, Scope scope) {
> -        Component sc = createSystemComponent(name, type, scope);
> -        sc.initialize(assemblyContext);
> -        return sc;
> -    }
> -
> -    /**
>       * Creates a basic entry point with no configured reference  
> using the system binding
>       *
>       * @param name     the name of the entry point
> @@ -273,24 +237,13 @@
>          module.setName("system.module");
>
>          // create test component
> -        SimpleComponent component =  
> systemFactory.createSimpleComponent();
> -        component.setName("TestService1");
> -        SystemImplementation impl =  
> systemFactory.createSystemImplementation();
> -        impl.setComponentType(systemFactory.createComponentType());
> -        impl.setImplementationClass 
> (ModuleScopeSystemComponentImpl.class);
> -        component.setComponentImplementation(impl);
> -        Service s = systemFactory.createService();
> -        JavaServiceContract contract =  
> systemFactory.createJavaServiceContract();
> -        s.setServiceContract(contract);
> -        contract.setScope(Scope.MODULE);
> -        impl.getComponentType().getServices().add(s);
> -        component.setComponentImplementation(impl);
> +        Component component = systemFactory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponent.class,  
> ModuleScopeSystemComponentImpl.class, Scope.MODULE);
> +        module.getComponents().add(component);
>
>          // create the entry point
>          EntryPoint ep = createEPSystemBinding("TestService1EP",  
> ModuleScopeSystemComponent.class, "target", component);
> -
>          module.getEntryPoints().add(ep);
> -        module.getComponents().add(component);
> +
>          module.initialize(assemblyContext);
>          return module;
>      }
> @@ -304,93 +257,31 @@
>      public static Module createSystemModuleWithWiredComponents 
> (Scope sourceScope, Scope targetScope) {
>
>          // create the target component
> -        SimpleComponent target =  
> systemFactory.createSimpleComponent();
> -        target.setName("target");
> -        SystemImplementation targetImpl =  
> systemFactory.createSystemImplementation();
> -        targetImpl.setComponentType 
> (systemFactory.createComponentType());
> -        targetImpl.setImplementationClass(TargetImpl.class);
> -        target.setComponentImplementation(targetImpl);
> -        Service targetService = systemFactory.createService();
> -        JavaServiceContract targetContract =  
> systemFactory.createJavaServiceContract();
> -        targetContract.setInterface(Target.class);
> -        targetService.setServiceContract(targetContract);
> -        targetService.setName("Target");
> -        targetImpl.getComponentType().getServices().add 
> (targetService);
> -        targetContract.setScope(targetScope);
> -        ConfiguredService cTargetService =  
> systemFactory.createConfiguredService();
> -        cTargetService.setService(targetService);
> -        cTargetService.initialize(assemblyContext);
> -        target.getConfiguredServices().add(cTargetService);
> +        Component target = systemFactory.createSystemComponent 
> ("target", Target.class, TargetImpl.class, targetScope);
>          target.initialize(assemblyContext);
>
>          // create the source componentType
> -        ComponentType sourceComponentType =  
> systemFactory.createComponentType();
> -        Service s = systemFactory.createService();
> -        JavaServiceContract contract =  
> systemFactory.createJavaServiceContract();
> -        contract.setInterface(Source.class);
> -        s.setServiceContract(contract);
> -        contract.setScope(sourceScope);
> -        sourceComponentType.getServices().add(s);
> -
> -        JavaServiceContract refContract =  
> systemFactory.createJavaServiceContract();
> -        refContract.setInterface(Target.class);
> -        Reference reference = systemFactory.createReference();
> -        reference.setName("setTarget");
> -        reference.setServiceContract(refContract);
> -        sourceComponentType.getReferences().add(reference);
> -
> -        JavaServiceContract refContract2 =  
> systemFactory.createJavaServiceContract();
> -        refContract2.setInterface(List.class);
> -        Reference reference2 = systemFactory.createReference();
> -        reference2.setName("setTargets");
> -        reference2.setServiceContract(refContract2);
> -        sourceComponentType.getReferences().add(reference2);
> -
> -        JavaServiceContract refContract3 =  
> systemFactory.createJavaServiceContract();
> -        refContract3.setInterface(List.class);
> -        Reference reference3 = systemFactory.createReference();
> -        reference3.setName("targetsThroughField");
> -        reference3.setServiceContract(refContract3);
> -        sourceComponentType.getReferences().add(reference3);
> -        sourceComponentType.initialize(assemblyContext);
> -
> -        // create the source component
> -        SimpleComponent source =  
> systemFactory.createSimpleComponent();
> -        source.setName("source");
> -        SystemImplementation impl =  
> systemFactory.createSystemImplementation();
> -        impl.setComponentType(sourceComponentType);
> -        impl.setImplementationClass(SourceImpl.class);
> -        source.setComponentImplementation(impl);
> +        Component source = systemFactory.createSystemComponent 
> ("source", Source.class, SourceImpl.class, sourceScope);
> +        ComponentType sourceComponentType =  
> source.getComponentImplementation().getComponentType();
> +        List<Reference> references =  
> sourceComponentType.getReferences();
> +        List<ConfiguredReference> configuredReferences =  
> source.getConfiguredReferences();
>
>          // wire source to target
> -        ConfiguredReference cReference =  
> systemFactory.createConfiguredReference();
> -        cReference.setName("setTarget");
> -        cReference.setTarget("target");
> -        cReference.getTargetConfiguredServices().add(cTargetService);
> -        cReference.initialize(assemblyContext);
> -        source.getConfiguredReferences().add(cReference);
> +        references.add(systemFactory.createReference("setTarget",  
> Target.class));
> +        configuredReferences.add 
> (systemFactory.createConfiguredReference("setTarget", "target"));
>
>          // wire multiplicity using a setter
> -        ConfiguredReference cReference2 =  
> systemFactory.createConfiguredReference();
> -        cReference2.setName("setTargets");
> -        cReference2.setTarget("target");
> -        cReference2.getTargetConfiguredServices().add 
> (cTargetService);
> -        cReference2.initialize(assemblyContext);
> -        source.getConfiguredReferences().add(cReference2);
> +        references.add(systemFactory.createReference("setTargets",  
> List.class));
> +        configuredReferences.add 
> (systemFactory.createConfiguredReference("setTargets", "target"));
>
>          // wire multiplicity using a field
> -        ConfiguredReference cReference3 =  
> systemFactory.createConfiguredReference();
> -        cReference3.setName("targetsThroughField");
> -        cReference3.setTarget("target");
> -        cReference3.getTargetConfiguredServices().add 
> (cTargetService);
> -        cReference3.initialize(assemblyContext);
> -        source.getConfiguredReferences().add(cReference3);
> -        source.initialize(assemblyContext);
> +        references.add(systemFactory.createReference 
> ("targetsThroughField", List.class));
> +        configuredReferences.add 
> (systemFactory.createConfiguredReference("targetsThroughField",  
> "target"));
>
> +        source.initialize(assemblyContext);
>
>          Module module = systemFactory.createModule();
>          module.setName("system.module");
> -
>          module.getComponents().add(source);
>          module.getComponents().add(target);
>          module.initialize(assemblyContext);
> @@ -405,24 +296,13 @@
>          module.setName("system.test.module");
>
>          // create test component
> -        SimpleComponent component =  
> systemFactory.createSimpleComponent();
> -        component.setName("TestService2");
> -        SystemImplementation impl =  
> systemFactory.createSystemImplementation();
> -        impl.setImplementationClass 
> (ModuleScopeSystemComponentImpl.class);
> -        component.setComponentImplementation(impl);
> -        Service s = systemFactory.createService();
> -        JavaServiceContract ji =  
> systemFactory.createJavaServiceContract();
> -        s.setServiceContract(ji);
> -        ji.setScope(Scope.MODULE);
> -        impl.setComponentType(systemFactory.createComponentType());
> -        impl.getComponentType().getServices().add(s);
> -        component.setComponentImplementation(impl);
> +        Component component = systemFactory.createSystemComponent 
> ("TestService2", ModuleScopeSystemComponent.class,  
> ModuleScopeSystemComponentImpl.class, Scope.MODULE);
> +        module.getComponents().add(component);
>
>          // create the entry point
>          EntryPoint ep = createEPSystemBinding("TestService2EP",  
> ModuleScopeSystemComponent.class, "target", component);
> -
>          module.getEntryPoints().add(ep);
> -        module.getComponents().add(component);
> +
>          module.initialize(assemblyContext);
>          return module;
>      }
> @@ -440,10 +320,8 @@
>
>      /**
>       * Creates a default {@link RuntimeContext} configured with  
> support for Java component implementations
> -     *
> -     * @throws ConfigurationException
>       */
> -    public static RuntimeContext createCoreRuntime() throws  
> ConfigurationException {
> +    public static RuntimeContext createCoreRuntime() {
>          RuntimeContext runtime = new RuntimeContextImpl(null,  
> null, createSystemBuilders(), null);
>          runtime.start();
>          return runtime;
>
> Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/runtime/RuntimeContextImplTestCase.java
> URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/ 
> src/test/java/org/apache/tuscany/core/runtime/ 
> RuntimeContextImplTestCase.java? 
> rev=384939&r1=384938&r2=384939&view=diff
> ====================================================================== 
> ========
> --- incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/runtime/RuntimeContextImplTestCase.java (original)
> +++ incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/runtime/RuntimeContextImplTestCase.java Fri Mar 10  
> 14:25:18 2006
> @@ -50,6 +50,7 @@
>      private SystemAssemblyFactory systemFactory = new  
> SystemAssemblyFactoryImpl();
>
>      private List<RuntimeConfigurationBuilder> builders;
> +    private SystemAssemblyFactory factory;
>
>      /**
>       * Tests explicit wiring of an external service to a system  
> entry point that is wired to a child system module entry
> @@ -187,12 +188,12 @@
>          Component moduleComponent =  
> MockFactory.createAggregateComponent("module");
>          runtime.registerModelObject(moduleComponent);
>
> -        Component component = MockFactory.createSystemComponent 
> ("NoService", ModuleScopeSystemComponentImpl.class, Scope.MODULE);
> +        Component component = factory.createSystemComponent 
> ("NoService", ModuleScopeSystemComponent.class,  
> ModuleScopeSystemComponentImpl.class, Scope.MODULE);
>          // do not register the above component!
>
>          AggregateContextImpl moduleContext =  
> (AggregateContextImpl) runtime.getContext("module");
> -        moduleContext.registerModelObject 
> (MockFactory.createEPSystemBinding("TestServiceEP",  
> ModuleScopeSystemComponent.class,
> -                "NoReference", component));
> +        EntryPoint epSystemBinding =  
> MockFactory.createEPSystemBinding("TestServiceEP",  
> ModuleScopeSystemComponent.class, "NoReference", component);
> +        moduleContext.registerModelObject(epSystemBinding);
>
>          moduleContext.fireEvent(EventContext.MODULE_START, null);
>          try {
> @@ -221,19 +222,15 @@
>          AggregateContextImpl moduleContext1 =  
> (AggregateContextImpl) runtime.getContext("module1");
>          AggregateContextImpl moduleContext2 =  
> (AggregateContextImpl) runtime.getContext("module2");
>
> -        Component component1 = MockFactory.createSystemComponent 
> ("Component1", ModuleScopeSystemComponentImpl.class,
> -                Scope.MODULE);
> -        EntryPoint entryPoint1 = MockFactory.createEPSystemBinding 
> ("EntryPoint1", ModuleScopeSystemComponent.class, "Component1",
> -                component1);
> +        Component component1 = factory.createSystemComponent 
> ("Component1", ModuleScopeSystemComponent.class,  
> ModuleScopeSystemComponentImpl.class, Scope.MODULE);
> +        EntryPoint entryPoint1 = MockFactory.createEPSystemBinding 
> ("EntryPoint1", ModuleScopeSystemComponent.class, "Component1",  
> component1);
>          ExternalService externalService1 =  
> MockFactory.createESSystemBinding("ExternalService1", "module2/ 
> EntryPoint2");
>          moduleContext1.registerModelObject(component1);
>          moduleContext1.registerModelObject(entryPoint1);
>          moduleContext1.registerModelObject(externalService1);
>
> -        Component component2 = MockFactory.createSystemComponent 
> ("Component2", ModuleScopeSystemComponentImpl.class,
> -                Scope.MODULE);
> -        EntryPoint entryPoint2 = MockFactory.createEPSystemBinding 
> ("EntryPoint2", ModuleScopeSystemComponent.class, "Component2",
> -                component2);
> +        Component component2 = factory.createSystemComponent 
> ("Component2", ModuleScopeSystemComponent.class,  
> ModuleScopeSystemComponentImpl.class, Scope.MODULE);
> +        EntryPoint entryPoint2 = MockFactory.createEPSystemBinding 
> ("EntryPoint2", ModuleScopeSystemComponent.class, "Component2",  
> component2);
>          ExternalService externalService2 =  
> MockFactory.createESSystemBinding("ExternalService2", "module1/ 
> EntryPoint1");
>          moduleContext2.registerModelObject(component2);
>          moduleContext2.registerModelObject(entryPoint2);
> @@ -286,7 +283,7 @@
>          runtime.start();
>
>          AggregateContext system = runtime.getSystemContext();
> -        Component builder = MockFactory.createSystemComponent 
> ("TestBuilder", TestBuilder.class, Scope.MODULE);
> +        Component builder = factory.createSystemComponent 
> ("TestBuilder", RuntimeConfigurationBuilder.class,  
> TestBuilder.class, Scope.MODULE);
>          system.registerModelObject(builder);
>          system.fireEvent(EventContext.MODULE_START, null);
>          Component module1 = MockFactory.createAggregateComponent 
> ("module1");
> @@ -301,5 +298,6 @@
>      protected void setUp() throws Exception {
>          super.setUp();
>          builders = MockFactory.createSystemBuilders();
> +        factory = new SystemAssemblyFactoryImpl();
>      }
>  }
>
> Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/system/builder/SystemComponentContextBuilderTestCase.java
> URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/ 
> src/test/java/org/apache/tuscany/core/system/builder/ 
> SystemComponentContextBuilderTestCase.java? 
> rev=384939&r1=384938&r2=384939&view=diff
> ====================================================================== 
> ========
> --- incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/system/builder/ 
> SystemComponentContextBuilderTestCase.java (original)
> +++ incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/system/builder/ 
> SystemComponentContextBuilderTestCase.java Fri Mar 10 14:25:18 2006
> @@ -43,8 +43,7 @@
>
>      public void testComponentContextBuilder() throws Exception {
>          SystemComponentContextBuilder builder = new  
> SystemComponentContextBuilder();
> -        Component component = MockFactory.createSystemComponent 
> ("test", SystemComponentImpl.class,
> -                Scope.AGGREGATE);
> +        Component component = factory.createSystemComponent 
> ("test", null, SystemComponentImpl.class, Scope.AGGREGATE);
>
>          ConfiguredProperty cProp = factory.createConfiguredProperty 
> ();
>          Property prop = factory.createProperty();
>
> Modified: incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/system/context/ 
> SystemAggregateComponentContextTestCase.java
> URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/ 
> src/test/java/org/apache/tuscany/core/system/context/ 
> SystemAggregateComponentContextTestCase.java? 
> rev=384939&r1=384938&r2=384939&view=diff
> ====================================================================== 
> ========
> --- incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/system/context/ 
> SystemAggregateComponentContextTestCase.java (original)
> +++ incubator/tuscany/java/sca/core/src/test/java/org/apache/ 
> tuscany/core/system/context/ 
> SystemAggregateComponentContextTestCase.java Fri Mar 10 14:25:18 2006
> @@ -27,6 +27,8 @@
>  import org.apache.tuscany.core.mock.MockFactory;
>  import  
> org.apache.tuscany.core.mock.component.ModuleScopeSystemComponent;
>  import  
> org.apache.tuscany.core.mock.component.ModuleScopeSystemComponentImpl;
> +import org.apache.tuscany.core.system.assembly.SystemAssemblyFactory;
> +import  
> org.apache.tuscany.core.system.assembly.impl.SystemAssemblyFactoryImpl 
> ;
>  import org.apache.tuscany.model.assembly.Component;
>  import org.apache.tuscany.model.assembly.EntryPoint;
>  import org.apache.tuscany.model.assembly.Scope;
> @@ -37,91 +39,72 @@
>   * @version $Rev$ $Date$
>   */
>  public class SystemAggregateComponentContextTestCase extends  
> TestCase {
> +    private SystemAssemblyFactory factory;
> +    private List<RuntimeConfigurationBuilder> builders;
> +    private SystemAggregateContextImpl system;
>
>      public void testChildLocate() throws Exception {
> -        List<RuntimeConfigurationBuilder> builders =  
> MockFactory.createSystemBuilders();
> -
> -        SystemAggregateContextImpl system = new  
> SystemAggregateContextImpl("system", null, null, new  
> SystemScopeStrategy(),
> -                new EventContextImpl(), new MockConfigContext 
> (builders), new NullMonitorFactory(), null, null);
>          system.start();
> -
>          Component aggregateComponent =  
> MockFactory.createAggregateComponent("system.child");
>          system.registerModelObject(aggregateComponent);
>          AggregateContext childContext = (AggregateContext)  
> system.getContext("system.child");
>          Assert.assertNotNull(childContext);
>
> -        Component component = MockFactory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponentImpl.class,
> -                Scope.MODULE);
> -        EntryPoint ep = MockFactory.createEPSystemBinding 
> ("TestService1EP", ModuleScopeSystemComponent.class, "TestService1",
> -                component);
> +        Component component = factory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponent.class,  
> ModuleScopeSystemComponentImpl.class, Scope.MODULE);
> +        EntryPoint ep = MockFactory.createEPSystemBinding 
> ("TestService1EP", ModuleScopeSystemComponent.class,  
> "TestService1", component);
>          childContext.registerModelObject(component);
>          childContext.registerModelObject(ep);
>          childContext.fireEvent(EventContext.MODULE_START, null);
>          Assert.assertNotNull(system.locateInstance("system.child/ 
> TestService1EP"));
>          childContext.fireEvent(EventContext.MODULE_STOP, null);
> -        system.stop();
>      }
>
> -    public void testAutowire() throws Exception {
> -        List<RuntimeConfigurationBuilder> builders =  
> MockFactory.createSystemBuilders();
> -        SystemAggregateContextImpl system = new  
> SystemAggregateContextImpl("system", null, null, new  
> SystemScopeStrategy(),
> -                new EventContextImpl(), new MockConfigContext 
> (builders), new NullMonitorFactory(), null, null);
> -
> -        Component component = MockFactory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponentImpl.class,
> -                Scope.MODULE);
> -        EntryPoint ep = MockFactory.createEPSystemBinding 
> ("TestService1EP", ModuleScopeSystemComponent.class, "TestService1",
> -                component);
> +    public void testAutowireRegisterBeforeStart() throws Exception {
> +        Component component = factory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponent.class,  
> ModuleScopeSystemComponentImpl.class, Scope.MODULE);
> +        EntryPoint ep = MockFactory.createEPSystemBinding 
> ("TestService1EP", ModuleScopeSystemComponent.class,  
> "TestService1", component);
>          system.registerModelObject(component);
>          system.registerModelObject(ep);
>          system.start();
>          system.fireEvent(EventContext.MODULE_START, null);
>          Assert.assertSame(system.locateInstance("TestService1EP"),  
> system.resolveInstance(ModuleScopeSystemComponent.class));
> -        system.fireEvent(EventContext.MODULE_STOP, null);
> -        system.stop();
>      }
>
>      public void testAutowireRegisterAfterStart() throws Exception {
> -        List<RuntimeConfigurationBuilder> builders =  
> MockFactory.createSystemBuilders();
> -
> -        SystemAggregateContextImpl system = new  
> SystemAggregateContextImpl("system", null, null, new  
> SystemScopeStrategy(),
> -                new EventContextImpl(), new MockConfigContext 
> (builders), new NullMonitorFactory(), null, null);
> -
> -        Component component = MockFactory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponentImpl.class,
> -                Scope.MODULE);
> +        Component component = factory.createSystemComponent 
> ("TestService1", ModuleScopeSystemComponent.class,  
> ModuleScopeSystemComponentImpl.class, Scope.MODULE);
>          system.registerModelObject(component);
>          system.start();
>          system.fireEvent(EventContext.MODULE_START, null);
> -        EntryPoint ep = MockFactory.createEPSystemBinding 
> ("TestService1EP", ModuleScopeSystemComponent.class, "TestService1",
> -                component);
> +        EntryPoint ep = MockFactory.createEPSystemBinding 
> ("TestService1EP", ModuleScopeSystemComponent.class,  
> "TestService1", component);
>          system.registerModelObject(ep);
>          Assert.assertSame(system.locateInstance("TestService1EP"),  
> system.resolveInstance(ModuleScopeSystemComponent.class));
> -        system.fireEvent(EventContext.MODULE_STOP, null);
> -        system.stop();
>      }
>
> -    public void testAutowireModuleRegister() throws Exception {
> -        List<RuntimeConfigurationBuilder> builders =  
> MockFactory.createSystemBuilders();
> -
> -        SystemAggregateContextImpl system = new  
> SystemAggregateContextImpl("system", null, null, new  
> SystemScopeStrategy(),
> -                new EventContextImpl(), new MockConfigContext 
> (builders), new NullMonitorFactory(), null, null);
> +    public void testAutowireModuleRegisterBeforeStart() throws  
> Exception {
>          system.registerModelObject(MockFactory.createSystemModule());
>          system.start();
>          system.fireEvent(EventContext.MODULE_START, null);
>          Assert.assertSame(system.locateInstance("TestService1EP"),  
> system.resolveInstance(ModuleScopeSystemComponent.class));
> -        system.fireEvent(EventContext.MODULE_STOP, null);
> -        system.stop();
>      }
>
>      public void testAutowireModuleRegisterAfterStart() throws  
> Exception {
> -        List<RuntimeConfigurationBuilder> builders =  
> MockFactory.createSystemBuilders();
> -        SystemAggregateContextImpl system = new  
> SystemAggregateContextImpl("system", null, null, new  
> SystemScopeStrategy(),
> -                new EventContextImpl(), new MockConfigContext 
> (builders), new NullMonitorFactory(), null, null);
>          system.start();
>          system.fireEvent(EventContext.MODULE_START, null);
>          system.registerModelObject(MockFactory.createSystemModule());
>          Assert.assertSame(system.locateInstance("TestService1EP"),  
> system.resolveInstance(ModuleScopeSystemComponent.class));
> +    }
> +
> +    protected void setUp() throws Exception {
> +        super.setUp();
> +        factory = new SystemAssemblyFactoryImpl();
> +        builders = MockFactory.createSystemBuilders();
> +
> +        system = new SystemAggregateContextImpl("system", null,  
> null, new SystemScopeStrategy(),
> +                new EventContextImpl(), new MockConfigContext 
> (builders), new NullMonitorFactory(), null, null);
> +    }
> +
> +    protected void tearDown() throws Exception {
>          system.fireEvent(EventContext.MODULE_STOP, null);
>          system.stop();
> +        super.tearDown();
>      }
> -
>  }
>
> Modified: incubator/tuscany/java/sca/model/src/main/java/org/apache/ 
> tuscany/model/assembly/AssemblyFactory.java
> URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/ 
> src/main/java/org/apache/tuscany/model/assembly/ 
> AssemblyFactory.java?rev=384939&r1=384938&r2=384939&view=diff
> ====================================================================== 
> ========
> --- incubator/tuscany/java/sca/model/src/main/java/org/apache/ 
> tuscany/model/assembly/AssemblyFactory.java (original)
> +++ incubator/tuscany/java/sca/model/src/main/java/org/apache/ 
> tuscany/model/assembly/AssemblyFactory.java Fri Mar 10 14:25:18 2006
> @@ -159,4 +159,22 @@
>       * @return
>       */
>      Wire createWire();
> +
> +    /**
> +     * Helper method for creating a reference.
> +     *
> +     * @param name the name of the reference
> +     * @param service the Java type of the service
> +     * @return a Reference
> +     */
> +    Reference createReference(String name, Class<?> service);
> +
> +    /**
> +     * Helper method for creating a configured reference.
> +     *
> +     * @param name the name of the reference
> +     * @param target the target for the reference
> +     * @return a ConfiguredReference
> +     */
> +    ConfiguredReference createConfiguredReference(String name,  
> String target);
>  }
>
> Modified: incubator/tuscany/java/sca/model/src/main/java/org/apache/ 
> tuscany/model/assembly/impl/AssemblyFactoryImpl.java
> URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/model/ 
> src/main/java/org/apache/tuscany/model/assembly/impl/ 
> AssemblyFactoryImpl.java?rev=384939&r1=384938&r2=384939&view=diff
> ====================================================================== 
> ========
> --- incubator/tuscany/java/sca/model/src/main/java/org/apache/ 
> tuscany/model/assembly/impl/AssemblyFactoryImpl.java (original)
> +++ incubator/tuscany/java/sca/model/src/main/java/org/apache/ 
> tuscany/model/assembly/impl/AssemblyFactoryImpl.java Fri Mar 10  
> 14:25:18 2006
> @@ -201,4 +201,20 @@
>      public Wire createWire() {
>          return new WireImpl();
>      }
> +
> +    public Reference createReference(String name, Class<?> service) {
> +        JavaServiceContract refContract = createJavaServiceContract 
> ();
> +        refContract.setInterface(service);
> +        Reference reference = createReference();
> +        reference.setName(name);
> +        reference.setServiceContract(refContract);
> +        return reference;
> +    }
> +
> +    public ConfiguredReference createConfiguredReference(String  
> name, String target) {
> +        ConfiguredReference ref = createConfiguredReference();
> +        ref.setName(name);
> +        ref.setTarget(target);
> +        return ref;
> +    }
>  }
>
>


Re: svn commit: r384939 - in /incubator/tuscany/java/sca: container.java/src/test/java/org/apache/tuscany/container/java/mock/ container.js/src/test/java/org/apache/tuscany/container/js/mock/ core/src/main/java/org/apache/tuscany/core/system/assembly/ core...

Posted by Jim Marino <jm...@myroma.net>.
On Mar 10, 2006, at 5:08 PM, Jeremy Boynes wrote:

> Jim Marino wrote:
>
>> Jeremy,
>>
>> I'm in the process of trying to check in changes for multiplicity but
>> some of the changes you just did impacted me. I need to create
>> references between components and set the multiplicity value.   
>> Can  you
>> explain how this works for the two MockFactory classes in .core   
>> and .java?
>>
>>
>
> I was going to ask about that as things seemed odd to me too :-)
>
> I started on this as I was making some changes to the model and that
> impacted a lot of duplicate code in the MockFactorys - to make life
> easier, I moved some of the duplicate stuff into the helpers. The  
> actual
> construction being done in the factories should be unchanged.
>
> I was surprised that the interface class in the reference was being  
> set
> to List - I would have expected it to be set to the actual service  
> class
> and the multiplicity set to '..N'
>
Yes that was what I was changing.

> I think the way I am handling "target" is wrong. I was assuming there
> was one ConfiguredReference object for each <reference> element in the
> SCDL but on further reflection I think we are munging them all  
> together
> into one ConfiguredReference with multiple targets on it. If that  
> is the
>
I believe it is one configured reference with multiple target  
configured services on it

> case then we need to change target into some form of Collection.
>
> However, I don't think we can lose the association with the namespace
> associated with the <v:reference-name> element. The spec allows  
> this to
> be any element outside the sca core namespace and so we need to be  
> able
> to hand that over to a pluggable data binding mechanism.
>
> There problem here is that when we are reading these elements we don't
> know the interface type from the reference so need to sit on things
> until the implementation has initialized. Currently we just store a
> String value but I don't think that will work long term.
>
Yes, also we need to do some conversion.  For example "foo" -->  
"setFoo" setter in the case of Java. I believe we are doing that in  
the model but we need a better way moving forward
> Anyway, to quit rambling, if you are OK with just String values, we  
> can
> simply convert target to a List<String> and tweak the matching code in
> ModuleImpl.
>
I'm not sure I follow. Right now in the changes I'm doing, I have the  
interface on the reference set to the business interface and  
multiplicity to 1..n. In the builder, when there is multiplicity, I  
look for a field or method with a type of List or Array and build the  
collection of reference from that.  I don't actually need the  
interface set to List.  Does that make sense?


> Does that sound ok?
> --
> Jeremy
>


Re: svn commit: r384939 - in /incubator/tuscany/java/sca: container.java/src/test/java/org/apache/tuscany/container/java/mock/ container.js/src/test/java/org/apache/tuscany/container/js/mock/ core/src/main/java/org/apache/tuscany/core/system/assembly/ core...

Posted by Jim Marino <jm...@myroma.net>.
Do you want to switch back the mock factories so we can get the unit  
tests working again?

On Mar 10, 2006, at 10:59 PM, Jeremy Boynes wrote:

> Jim Marino wrote:
>
>> O.K. My stuff is completely broke because I'm assuming there is one
>> configured reference with multiple target configured services and
>> that's how I originally had the mock factories.  I think this is
>> correct. Jeremy is that not what you were thinking? We'll need to   
>> solve
>> this fairly quickly since I can't commit any of the changes  that fix
>> the broken HelloWorld.
>>
>>
>
> I agree - the mock factories worked that way but the model loader
> created a separate ConfiguredReference for each <v:reference> found  
> and
> I kept that the same. It makes no difference when the multiplicity is
> one ...
>
> We need to fix the handling of <references> to create one
> ConfiguredReference and have the loader add into that as it finds
> duplicate values. I will get onto that in the morning.
>
> --
> Jeremy
>


Re: svn commit: r384939 - in /incubator/tuscany/java/sca: container.java/src/test/java/org/apache/tuscany/container/java/mock/ container.js/src/test/java/org/apache/tuscany/container/js/mock/ core/src/main/java/org/apache/tuscany/core/system/assembly/ core...

Posted by Jim Marino <jm...@myroma.net>.
Just be clear, my understanding is that there is one Configured  
Reference per <v:reference>, but that configured reference may have  
multiple targets that are called through getTargetConfiguredServices 
() which always returns a list, even if there is only one target.


On Mar 10, 2006, at 10:59 PM, Jeremy Boynes wrote:

> Jim Marino wrote:
>
>> O.K. My stuff is completely broke because I'm assuming there is one
>> configured reference with multiple target configured services and
>> that's how I originally had the mock factories.  I think this is
>> correct. Jeremy is that not what you were thinking? We'll need to   
>> solve
>> this fairly quickly since I can't commit any of the changes  that fix
>> the broken HelloWorld.
>>
>>
>
> I agree - the mock factories worked that way but the model loader
> created a separate ConfiguredReference for each <v:reference> found  
> and
> I kept that the same. It makes no difference when the multiplicity is
> one ...
>
> We need to fix the handling of <references> to create one
> ConfiguredReference and have the loader add into that as it finds
> duplicate values. I will get onto that in the morning.
>
> --
> Jeremy
>


Re: svn commit: r384939 - in /incubator/tuscany/java/sca: container.java/src/test/java/org/apache/tuscany/container/java/mock/ container.js/src/test/java/org/apache/tuscany/container/js/mock/ core/src/main/java/org/apache/tuscany/core/system/assembly/ core...

Posted by Jeremy Boynes <jb...@apache.org>.
Jim Marino wrote:
> O.K. My stuff is completely broke because I'm assuming there is one 
> configured reference with multiple target configured services and 
> that's how I originally had the mock factories.  I think this is 
> correct. Jeremy is that not what you were thinking? We'll need to  solve
> this fairly quickly since I can't commit any of the changes  that fix
> the broken HelloWorld.
> 

I agree - the mock factories worked that way but the model loader
created a separate ConfiguredReference for each <v:reference> found and
I kept that the same. It makes no difference when the multiplicity is
one ...

We need to fix the handling of <references> to create one
ConfiguredReference and have the loader add into that as it finds
duplicate values. I will get onto that in the morning.

--
Jeremy

Re: svn commit: r384939 - in /incubator/tuscany/java/sca: container.java/src/test/java/org/apache/tuscany/container/java/mock/ container.js/src/test/java/org/apache/tuscany/container/js/mock/ core/src/main/java/org/apache/tuscany/core/system/assembly/ core...

Posted by Jim Marino <jm...@myroma.net>.
O.K. My stuff is completely broke because I'm assuming there is one  
configured reference with multiple target configured services and  
that's how I originally had the mock factories.  I think this is  
correct. Jeremy is that not what you were thinking? We'll need to  
solve this fairly quickly since I can't commit any of the changes  
that fix the broken HelloWorld.

Jim



On Mar 10, 2006, at 6:43 PM, Jean-Sebastien Delfino wrote:

> Jeremy Boynes wrote:
>
>> Jim Marino wrote:
>>
>>
>>> Jeremy,
>>>
>>> I'm in the process of trying to check in changes for multiplicity  
>>> but some of the changes you just did impacted me. I need to  
>>> create references between components and set the multiplicity  
>>> value.  Can  you
>>> explain how this works for the two MockFactory classes in .core   
>>> and .java?
>>>
>>>
>>>
>>
>> I was going to ask about that as things seemed odd to me too :-)
>>
>> I started on this as I was making some changes to the model and that
>> impacted a lot of duplicate code in the MockFactorys - to make life
>> easier, I moved some of the duplicate stuff into the helpers. The  
>> actual
>> construction being done in the factories should be unchanged.
>>
>> I was surprised that the interface class in the reference was  
>> being set
>> to List - I would have expected it to be set to the actual service  
>> class
>> and the multiplicity set to '..N'
>>
>>
> I agree, the interface class should be the actual business  
> interface declared on the reference, with multiplicity set to ..N.
>
>
>> I think the way I am handling "target" is wrong. I was assuming there
>> was one ConfiguredReference object for each <reference> element in  
>> the
>> SCDL but on further reflection I think we are munging them all  
>> together
>> into one ConfiguredReference with multiple targets on it. If that  
>> is the
>> case then we need to change target into some form of Collection.
>>
>>
> Currently a <reference> maps to a ConfiguredReference.  
> ConfiguredReference.getTargetConfiguredServices() returns a  
> List<ConfiguredService>. This models a reference wired to multiple  
> targets. targetConfiguredServices is already a collection. Or are  
> you talking about another target?
>
>
>> However, I don't think we can lose the association with the namespace
>> associated with the <v:reference-name> element. The spec allows  
>> this to
>> be any element outside the sca core namespace and so we need to be  
>> able
>> to hand that over to a pluggable data binding mechanism.
>>
>> There problem here is that when we are reading these elements we  
>> don't
>> know the interface type from the reference so need to sit on things
>> until the implementation has initialized. Currently we just store a
>> String value but I don't think that will work long term.
>>
>> Anyway, to quit rambling, if you are OK with just String values,  
>> we can
>> simply convert target to a List<String> and tweak the matching  
>> code in
>> ModuleImpl.
>>
>>
>>
> I don't understand why we would need to change target to a  
> List<String>. The assembly model is a logical model, so I think we  
> should preserve typed Object-Object relationships in this model  
> (from ConfiguredReference to ConfiguredService) instead of Strings.  
> Could you explain why you would want to change target to a  
> List<String>? What do you mean by tweak the code in ModuleImpl?
>
>
>> Does that sound ok?
>> --
>> Jeremy
>>
>>
>>
>
> -- 
> Jean-Sebastien
>


Re: Fwd: svn commit: r384939 - in /incubator/tuscany/java/sca: container.java/src/test/java/org/apache/tuscany/container/java/mock/ container.js/src/test/java/org/apache/tuscany/container/js/mock/ core/src/main/java/org/apache/tuscany/core/system/assembly/ core...

Posted by Jean-Sebastien Delfino <js...@apache.org>.
Jeremy Boynes wrote:
> Jim Marino wrote:
>   
>> Jeremy,
>>
>> I'm in the process of trying to check in changes for multiplicity but 
>> some of the changes you just did impacted me. I need to create 
>> references between components and set the multiplicity value.  Can  you
>> explain how this works for the two MockFactory classes in .core  and .java?
>>
>>     
>
> I was going to ask about that as things seemed odd to me too :-)
>
> I started on this as I was making some changes to the model and that
> impacted a lot of duplicate code in the MockFactorys - to make life
> easier, I moved some of the duplicate stuff into the helpers. The actual
> construction being done in the factories should be unchanged.
>
> I was surprised that the interface class in the reference was being set
> to List - I would have expected it to be set to the actual service class
> and the multiplicity set to '..N'
>   
I agree, the interface class should be the actual business interface 
declared on the reference, with multiplicity set to ..N.

> I think the way I am handling "target" is wrong. I was assuming there
> was one ConfiguredReference object for each <reference> element in the
> SCDL but on further reflection I think we are munging them all together
> into one ConfiguredReference with multiple targets on it. If that is the
> case then we need to change target into some form of Collection.
>   
Currently a <reference> maps to a ConfiguredReference. 
ConfiguredReference.getTargetConfiguredServices() returns a 
List<ConfiguredService>. This models a reference wired to multiple 
targets. targetConfiguredServices is already a collection. Or are you 
talking about another target?

> However, I don't think we can lose the association with the namespace
> associated with the <v:reference-name> element. The spec allows this to
> be any element outside the sca core namespace and so we need to be able
> to hand that over to a pluggable data binding mechanism.
>
> There problem here is that when we are reading these elements we don't
> know the interface type from the reference so need to sit on things
> until the implementation has initialized. Currently we just store a
> String value but I don't think that will work long term.
>
> Anyway, to quit rambling, if you are OK with just String values, we can
> simply convert target to a List<String> and tweak the matching code in
> ModuleImpl.
>
>   
I don't understand why we would need to change target to a List<String>. 
The assembly model is a logical model, so I think we should preserve 
typed Object-Object relationships in this model (from 
ConfiguredReference to ConfiguredService) instead of Strings. Could you 
explain why you would want to change target to a List<String>? What do 
you mean by tweak the code in ModuleImpl?

> Does that sound ok?
> --
> Jeremy
>
>   

-- 
Jean-Sebastien


Re: Fwd: svn commit: r384939 - in /incubator/tuscany/java/sca: container.java/src/test/java/org/apache/tuscany/container/java/mock/ container.js/src/test/java/org/apache/tuscany/container/js/mock/ core/src/main/java/org/apache/tuscany/core/system/assembly/ core...

Posted by Jeremy Boynes <jb...@apache.org>.
Jim Marino wrote:
> Jeremy,
> 
> I'm in the process of trying to check in changes for multiplicity but 
> some of the changes you just did impacted me. I need to create 
> references between components and set the multiplicity value.  Can  you
> explain how this works for the two MockFactory classes in .core  and .java?
> 

I was going to ask about that as things seemed odd to me too :-)

I started on this as I was making some changes to the model and that
impacted a lot of duplicate code in the MockFactorys - to make life
easier, I moved some of the duplicate stuff into the helpers. The actual
construction being done in the factories should be unchanged.

I was surprised that the interface class in the reference was being set
to List - I would have expected it to be set to the actual service class
and the multiplicity set to '..N'

I think the way I am handling "target" is wrong. I was assuming there
was one ConfiguredReference object for each <reference> element in the
SCDL but on further reflection I think we are munging them all together
into one ConfiguredReference with multiple targets on it. If that is the
case then we need to change target into some form of Collection.

However, I don't think we can lose the association with the namespace
associated with the <v:reference-name> element. The spec allows this to
be any element outside the sca core namespace and so we need to be able
to hand that over to a pluggable data binding mechanism.

There problem here is that when we are reading these elements we don't
know the interface type from the reference so need to sit on things
until the implementation has initialized. Currently we just store a
String value but I don't think that will work long term.

Anyway, to quit rambling, if you are OK with just String values, we can
simply convert target to a List<String> and tweak the matching code in
ModuleImpl.

Does that sound ok?
--
Jeremy