tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmar...@apache.org
Subject svn commit: r440210 - in /incubator/tuscany/java/sca: containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/ kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/ kernel/core/src/main/java/org/apache/tuscany/core/bui...
Date Tue, 05 Sep 2006 00:41:22 GMT
Author: jmarino
Date: Mon Sep  4 17:41:21 2006
New Revision: 440210

URL: http://svn.apache.org/viewvc?view=rev&rev=440210
Log:
move connection down to composites from deployer

Added:
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessorRegistry.java   (with props)
Modified:
    incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/AutowireComponent.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilder.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemCompositeBuilder.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemImplementation.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/InboundtoOutboundConnectTestCase.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/OutboundToInboundConnectTestCase.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/deployer/BootstrapDeployerTestCase.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeBuilderTestCase.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/AutowireResolutionTestCase.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/CompositePropagationTestCase.java
    incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/system/builder/SystemBuilderWireTestCase.java
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java
    incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/PojoComponentType.java
    incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java

Modified: incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java (original)
+++ incubator/tuscany/java/sca/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/impl/SpringCompositeComponent.java Mon Sep  4 17:41:21 2006
@@ -25,6 +25,7 @@
 
 import org.w3c.dom.Document;
 
+import org.apache.tuscany.spi.builder.Connector;
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.component.Reference;
 import org.apache.tuscany.spi.component.SCAObject;
@@ -35,7 +36,6 @@
 import org.apache.tuscany.spi.model.Operation;
 import org.apache.tuscany.spi.model.ServiceContract;
 import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.builder.Connector;
 
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.BeanFactory;
@@ -79,8 +79,6 @@
         // REVIEW we need to refresh to pick up the parent but this is not optimal
         springContext.refresh();
         this.springContext = springContext;
-        // Spring wires itself
-        this.selfWiring = true;
     }
 
     public TargetInvoker createTargetInvoker(String targetName, Operation operation) {
@@ -98,6 +96,10 @@
 
     public ConfigurableApplicationContext getApplicationContext() {
         return springContext;
+    }
+
+    public void prepare() {
+        // TODO handle only references with a composite binding
     }
 
     public void start() {

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/bootstrap/DefaultBootstrapper.java Mon Sep  4 17:41:21 2006
@@ -137,8 +137,7 @@
         JavaInterfaceProcessorRegistry interfaceIntrospector = new JavaInterfaceProcessorRegistryImpl();
         Introspector introspector = createIntrospector(interfaceIntrospector);
         LoaderRegistry loader = createLoader(new StringParserPropertyFactory(), introspector);
-        Connector connector = createConnector();
-        return new DeployerImpl(xmlFactory, loader, builder, connector);
+        return new DeployerImpl(xmlFactory, loader, builder);
     }
 
     /**
@@ -241,7 +240,8 @@
      */
     private Builder createBuilder(ScopeRegistry scopeRegistry) {
         BuilderRegistry builderRegistry = new BuilderRegistryImpl(scopeRegistry);
-        builderRegistry.register(SystemCompositeImplementation.class, new SystemCompositeBuilder(builderRegistry));
+        SystemCompositeBuilder builder = new SystemCompositeBuilder(builderRegistry, createConnector());
+        builderRegistry.register(SystemCompositeImplementation.class, builder);
         builderRegistry.register(SystemImplementation.class, new SystemComponentBuilder());
         builderRegistry.register(SystemBinding.class, new SystemBindingBuilder());
         return builderRegistry;

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java Mon Sep  4 17:41:21 2006
@@ -83,13 +83,6 @@
                     chain.prepare();
                 }
             }
-        } else if (source instanceof CompositeComponent) {
-            CompositeComponent<?> composite = (CompositeComponent) source;
-            if (!composite.isSelfWiring()) {
-                for (SCAObject<?> child : composite.getChildren()) {
-                    connect(child);
-                }
-            }
         } else if (source instanceof Reference) {
             Reference<?> reference = (Reference) source;
             InboundWire<?> wire = reference.getInboundWire();
@@ -110,11 +103,6 @@
             // services have inbound and outbound wires
             // NB: this connect must be done after the outbound service chain is connected to its target above
             connect(inboundWire, outboundWire, true);
-        } else {
-            BuilderConfigException e = new BuilderConfigException("Invalid source type");
-            e.setIdentifier(source.getName());
-            e.addContextName(parent.getName());
-            throw e;
         }
     }
 
@@ -274,7 +262,14 @@
     }
 
 
+    /**
+     * Connects an inbound source chain to an outbound target chain
+     *
+     * @param sourceChain
+     * @param targetChain
+     */
     public void connect(InboundInvocationChain sourceChain, OutboundInvocationChain targetChain) {
+        // the are always interceptors so the connection algorithm is simple
         sourceChain.addInterceptor(new BridgingInterceptor(targetChain.getHeadInterceptor()));
     }
 

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/AutowireComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/AutowireComponent.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/AutowireComponent.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/AutowireComponent.java Mon Sep  4 17:41:21 2006
@@ -51,4 +51,5 @@
      */
     <T> T resolveExternalInstance(Class<T> instanceInterface) throws AutowireResolutionException;
 
+
 }

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java Mon Sep  4 17:41:21 2006
@@ -23,7 +23,6 @@
 import org.apache.tuscany.spi.annotation.Autowire;
 import org.apache.tuscany.spi.builder.Builder;
 import org.apache.tuscany.spi.builder.BuilderRegistry;
-import org.apache.tuscany.spi.builder.Connector;
 import org.apache.tuscany.spi.component.Component;
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.component.SCAObject;
@@ -47,43 +46,27 @@
     private XMLInputFactory xmlFactory;
     private Loader loader;
     private Builder builder;
-    private Connector connector;
 
-    public DeployerImpl(XMLInputFactory xmlFactory, Loader loader, Builder builder, Connector connector) {
+    public DeployerImpl(XMLInputFactory xmlFactory, Loader loader, Builder builder) {
         this.xmlFactory = xmlFactory;
         this.loader = loader;
         this.builder = builder;
-        this.connector = connector;
     }
 
     public DeployerImpl() {
         xmlFactory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", getClass().getClassLoader());
     }
 
-/*
-    @Autowire
-    public void setXmlFactory(XMLInputFactory xmlFactory) {
-        this.xmlFactory = xmlFactory;
-    }
-*/
-
-    //FIXME allow autowire to register multiple service types
     @Autowire
     public void setLoader(LoaderRegistry loader) {
         this.loader = loader;
     }
 
-    //FIXME allow autowire to register multiple service types
     @Autowire
     public void setBuilder(BuilderRegistry builder) {
         this.builder = builder;
     }
 
-    @Autowire
-    public void setConnector(Connector connector) {
-        this.connector = connector;
-    }
-
     public <I extends Implementation<?>> Component<?> deploy(CompositeComponent<?> parent,
                                                              ComponentDefinition<I> componentDefinition)
         throws LoaderException {
@@ -100,7 +83,7 @@
             CompositeComponent composite = (CompositeComponent) component;
             composite.setScopeContainer(moduleScope);
         }
-        connect(component);
+        component.prepare();
         parent.register(component);
         return component;
     }
@@ -132,12 +115,4 @@
         return builder.build(parent, componentDefinition, deploymentContext);
     }
 
-    /**
-     * Connect the context's source wires to other target wires within the scope of the parent.
-     *
-     * @param object the SCA artifact to connect
-     */
-    protected void connect(SCAObject<?> object) {
-        connector.connect(object);
-    }
 }

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/AbstractCompositeComponent.java Mon Sep  4 17:41:21 2006
@@ -28,7 +28,6 @@
 
 import org.apache.tuscany.spi.CoreRuntimeException;
 import org.apache.tuscany.spi.builder.Connector;
-import org.apache.tuscany.spi.model.Operation;
 import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.component.DuplicateNameException;
@@ -39,6 +38,7 @@
 import org.apache.tuscany.spi.component.Service;
 import org.apache.tuscany.spi.event.Event;
 import org.apache.tuscany.spi.extension.CompositeComponentExtension;
+import org.apache.tuscany.spi.model.Operation;
 import org.apache.tuscany.spi.wire.OutboundWire;
 import org.apache.tuscany.spi.wire.TargetInvoker;
 
@@ -142,7 +142,7 @@
         lifecycleState = STOPPED;
     }
 
-    public void register(SCAObject child) {
+    public void register(SCAObject<?> child) {
         if (children.get(child.getName()) != null) {
             DuplicateNameException e = new DuplicateNameException("A context is already registered with name");
             e.setIdentifier(child.getName());
@@ -237,6 +237,12 @@
         return null;
     }
 
+    public void prepare() {
+        for (SCAObject<?> child : children.values()) {
+            connector.connect(child);
+            child.prepare();
+        }
+    }
 
     protected void registerAutowireExternal(Class<?> interfaze, SystemService context) {
         assert interfaze != null;

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java Mon Sep  4 17:41:21 2006
@@ -97,23 +97,23 @@
         }
 
         String name = componentDefinition.getName();
-        CompositeComponentImpl<?> context = new CompositeComponentImpl(name, parent, null, connector, null);
+        CompositeComponentImpl<?> component = new CompositeComponentImpl(name, parent, null, connector, null);
         for (BoundReferenceDefinition<? extends Binding> referenceDefinition : allBoundReferences) {
-            context.register(builderRegistry.build(context, referenceDefinition, deploymentContext));
+            component.register(builderRegistry.build(component, referenceDefinition, deploymentContext));
         }
         for (BindlessServiceDefinition bindlessServiceDef : allBindlessServices) {
-            context.register(builderRegistry.build(context, bindlessServiceDef, deploymentContext));
+            component.register(builderRegistry.build(component, bindlessServiceDef, deploymentContext));
         }
         for (ComponentDefinition<? extends Implementation<?>> child : allComponents) {
-            context.register(builderRegistry.build(context, child, deploymentContext));
+            component.register(builderRegistry.build(component, child, deploymentContext));
         }
         for (BoundServiceDefinition<? extends Binding> serviceDefinition : allBoundServices) {
-            context.register(builderRegistry.build(context, serviceDefinition, deploymentContext));
+            component.register(builderRegistry.build(component, serviceDefinition, deploymentContext));
         }
         for (ReferenceDefinition targetlessReferenceDef : allTargetlessReferences) {
-            context.register(builderRegistry.build(context, targetlessReferenceDef, deploymentContext));
+            component.register(builderRegistry.build(component, targetlessReferenceDef, deploymentContext));
         }
-        return context;
+        return component;
     }
 
     protected Class<CompositeImplementation> getImplementationType() {

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImpl.java Mon Sep  4 17:41:21 2006
@@ -22,9 +22,10 @@
 
 import org.w3c.dom.Document;
 
-import org.apache.tuscany.core.component.AutowireComponent;
-import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.builder.Connector;
+import org.apache.tuscany.spi.component.CompositeComponent;
+
+import org.apache.tuscany.core.component.AutowireComponent;
 
 /**
  * The standard implementation of a composite component. Autowiring is performed by delegating to the parent composite.
@@ -46,19 +47,11 @@
      * Constructor specifying name and URI.
      *
      * @param name              the name of this Component
-
-
-     @param uri               the unique identifier for this component
-
-
-      * @param parent            this component's parent
-
-     @param autowireComponent the component that should be used to resolve autowired references
-
-
-      * @param connector
+     * @param uri               the unique identifier for this component
+     * @param parent            this component's parent
+     * @param autowireComponent the component that should be used to resolve autowired references
+     * @param connector
      * @param propertyValues    this composite's Property values
-
      */
     public CompositeComponentImpl(String name,
                                   String uri,

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilder.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilder.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilder.java Mon Sep  4 17:41:21 2006
@@ -21,6 +21,7 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Member;
 import java.lang.reflect.Method;
+import java.util.Collection;
 import java.util.Map;
 
 import org.apache.tuscany.spi.ObjectFactory;
@@ -111,33 +112,41 @@
         SystemAtomicComponentImpl component = new SystemAtomicComponentImpl(definition.getName(), configuration);
         // handle properties
         Map<String, PropertyValue<?>> propertyValues = definition.getPropertyValues();
-        for (JavaMappedProperty<?> property : componentType.getProperties().values()) {
-            PropertyValue value = propertyValues.get(property.getName());
-            ObjectFactory<?> factory;
-            if (value != null) {
-                factory = value.getValueFactory();
-            } else {
-                factory = property.getDefaultValueFactory();
-            }
-            if (factory != null) {
-                component.addPropertyFactory(property.getName(), factory);
-            }
-        }
+        processProperties(propertyValues, componentType.getProperties().values(), component);
         // handle inbound wires
         for (ServiceDefinition serviceDefinition : componentType.getServices().values()) {
-            Class interfaze = serviceDefinition.getServiceContract().getInterfaceClass();
-            SystemInboundWire<?> wire = new SystemInboundWireImpl(serviceDefinition.getName(), interfaze, component);
+            Class<?> interfaze = serviceDefinition.getServiceContract().getInterfaceClass();
+            String name = serviceDefinition.getName();
+            SystemInboundWire<Object> wire = new SystemInboundWireImpl(name, interfaze, component);
             component.addInboundWire(wire);
         }
-        // handle references directly with no proxies
+        // handle references
+        processReferences(definition, componentType.getReferences(), autowireContext, component);
+        // FIXME we need a way to build configuration references from autowires in the loader to eliminate this eval
+        for (ReferenceDefinition reference : componentType.getReferences().values()) {
+            if (reference.isAutowire()) {
+                Class interfaze = reference.getServiceContract().getInterfaceClass();
+                OutboundWire<?> wire =
+                    new SystemOutboundAutowire(reference.getName(), interfaze, autowireContext, reference.isRequired());
+                component.addOutboundWire(wire);
+            }
+        }
+        return component;
+    }
+
+    private void processReferences(ComponentDefinition<SystemImplementation> definition,
+                                   Map<String, JavaMappedReference> references,
+                                   AutowireComponent autowireContext,
+                                   SystemAtomicComponentImpl component) {
+        // no proxies needed for system components
         for (ReferenceTarget target : definition.getReferenceTargets().values()) {
             String referenceName = target.getReferenceName();
-            JavaMappedReference referenceDefiniton = componentType.getReferences().get(referenceName);
+            JavaMappedReference referenceDefiniton = references.get(referenceName);
             Class interfaze = referenceDefiniton.getServiceContract().getInterfaceClass();
             OutboundWire<?> wire;
             if (referenceDefiniton.isAutowire()) {
-                wire = new SystemOutboundAutowire(referenceName, interfaze, autowireContext,
-                    referenceDefiniton.isRequired());     
+                boolean required = referenceDefiniton.isRequired();
+                wire = new SystemOutboundAutowire(referenceName, interfaze, autowireContext, required);
             } else {
                 //FIXME support multiplicity!
                 assert target.getTargets().size() == 1 : "Multiplicity not yet implemented";
@@ -146,15 +155,22 @@
             }
             component.addOutboundWire(wire);
         }
-        // FIXME we need a way to build configuration references from autowires in the loader to eliminate this eval
-        for (ReferenceDefinition reference : componentType.getReferences().values()) {
-            if (reference.isAutowire()) {
-                Class interfaze = reference.getServiceContract().getInterfaceClass();
-                OutboundWire<?> wire =
-                    new SystemOutboundAutowire(reference.getName(), interfaze, autowireContext, reference.isRequired());
-                component.addOutboundWire(wire);
+    }
+
+    private void processProperties(Map<String, PropertyValue<?>> propertyValues,
+                                   Collection<JavaMappedProperty<?>> properties,
+                                   SystemAtomicComponentImpl component) {
+        for (JavaMappedProperty<?> property : properties) {
+            PropertyValue value = propertyValues.get(property.getName());
+            ObjectFactory<?> factory;
+            if (value != null) {
+                factory = value.getValueFactory();
+            } else {
+                factory = property.getDefaultValueFactory();
+            }
+            if (factory != null) {
+                component.addPropertyFactory(property.getName(), factory);
             }
         }
-        return component;
     }
 }

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemCompositeBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemCompositeBuilder.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemCompositeBuilder.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemCompositeBuilder.java Mon Sep  4 17:41:21 2006
@@ -23,6 +23,7 @@
 
 import org.apache.tuscany.spi.builder.BuilderConfigException;
 import org.apache.tuscany.spi.builder.BuilderRegistry;
+import org.apache.tuscany.spi.builder.Connector;
 import org.apache.tuscany.spi.component.Component;
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.deployer.DeploymentContext;
@@ -49,8 +50,9 @@
     public SystemCompositeBuilder() {
     }
 
-    public SystemCompositeBuilder(BuilderRegistry builderRegistry) {
+    public SystemCompositeBuilder(BuilderRegistry builderRegistry, Connector connector) {
         this.builderRegistry = builderRegistry;
+        this.connector = connector;
     }
 
     protected Class<SystemCompositeImplementation> getImplementationType() {
@@ -93,26 +95,26 @@
 
         // create the composite component
         String name = componentDefinition.getName();
-        AutowireComponent autowireContext = getAutowireContext(parent);
-        SystemCompositeComponent<?> context =
+        AutowireComponent autowireContext = getAutowireComponent(parent);
+        SystemCompositeComponent<?> component =
             new SystemCompositeComponentImpl(name, parent, autowireContext, connector, null);
         for (ComponentDefinition<? extends Implementation> childComponentDefinition : allComponents) {
-            context.register(builderRegistry.build(context, childComponentDefinition, deploymentContext));
+            component.register(builderRegistry.build(component, childComponentDefinition, deploymentContext));
         }
 
         for (BoundServiceDefinition<? extends Binding> serviceDefinition : allBoundServices) {
-            context.register(builderRegistry.build(context, serviceDefinition, deploymentContext));
+            component.register(builderRegistry.build(component, serviceDefinition, deploymentContext));
         }
-        return context;
+        return component;
     }
 
     /**
-     * Return the autowire context for the supplied parent
+     * Return the autowire component for the supplied parent
      *
      * @param parent the parent for a new context
      * @return the autowire context for the parent or null if it does not support autowire
      */
-    protected AutowireComponent getAutowireContext(CompositeComponent<?> parent) {
+    protected AutowireComponent getAutowireComponent(CompositeComponent<?> parent) {
         if (parent instanceof AutowireComponent) {
             return (AutowireComponent) parent;
         } else {

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemImplementation.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemImplementation.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/model/SystemImplementation.java Mon Sep  4 17:41:21 2006
@@ -18,8 +18,8 @@
  */
 package org.apache.tuscany.core.implementation.system.model;
 
-import org.apache.tuscany.spi.model.AtomicImplementation;
 import org.apache.tuscany.spi.implementation.java.PojoComponentType;
+import org.apache.tuscany.spi.model.AtomicImplementation;
 
 /**
  * Represents the system composite implementation

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/InboundtoOutboundConnectTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/InboundtoOutboundConnectTestCase.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/InboundtoOutboundConnectTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/InboundtoOutboundConnectTestCase.java Mon Sep  4 17:41:21 2006
@@ -33,14 +33,18 @@
 import org.apache.tuscany.spi.wire.OutboundInvocationChain;
 import org.apache.tuscany.spi.wire.TargetInvoker;
 
+import junit.framework.TestCase;
 import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
 import org.apache.tuscany.core.mock.component.SimpleTarget;
 import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
 import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
 import org.apache.tuscany.core.wire.InvokerInterceptor;
 import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
-import org.jmock.Mock;
-import org.jmock.MockObjectTestCase;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
 
 /**
  * Verifies connection strategies between {@link org.apache.tuscany.spi.wire.OutboundInvocationChain}s and {@link
@@ -48,7 +52,7 @@
  *
  * @version $$Rev$$ $$Date$$
  */
-public class InboundtoOutboundConnectTestCase extends MockObjectTestCase {
+public class InboundtoOutboundConnectTestCase extends TestCase {
     private Operation operation;
 
     @SuppressWarnings("unchecked")
@@ -57,13 +61,14 @@
         InboundInvocationChain inboundChain = setupInbound(null, null, null);
         OutboundInvocationChain outboundChain = setupOutbound(null, null, null);
         String[] val = new String[]{"foo"};
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invokeTarget").with(eq(val)).will(returnValue(val));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invokeTarget(EasyMock.eq(val))).andReturn(val);
+        replay(invoker);
         connector.connect(inboundChain, outboundChain);
         inboundChain.setTargetInvoker(invoker);
         inboundChain.prepare();
-        assertEquals(val, inboundChain.getTargetInvoker().invokeTarget(val));
+        inboundChain.getTargetInvoker().invokeTarget(val);
+        verify(invoker);
     }
 
 
@@ -80,9 +85,9 @@
         InboundInvocationChain inboundChain = setupInbound(interceptors, null, null);
         OutboundInvocationChain outboundChain = setupOutbound(null, null, null);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, interceptor.getCount());
         connector.connect(inboundChain, outboundChain);
         inboundChain.setTargetInvoker(invoker);
@@ -90,6 +95,7 @@
         msg.setTargetInvoker(inboundChain.getTargetInvoker());
         assertEquals(msg, inboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(1, interceptor.getCount());
+        verify(invoker);
     }
 
     /**
@@ -105,9 +111,9 @@
         InboundInvocationChain inboundChain = setupInbound(interceptors, null, null);
         OutboundInvocationChain outboundChain = setupOutbound(null, null, null);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, interceptor.getCount());
         connector.connect(inboundChain, outboundChain);
         inboundChain.setTargetInvoker(invoker);
@@ -115,6 +121,7 @@
         msg.setTargetInvoker(inboundChain.getTargetInvoker());
         assertEquals(msg, inboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(1, interceptor.getCount());
+        verify(invoker);
     }
 
     /**
@@ -133,9 +140,9 @@
         OutboundInvocationChain outboundChain = setupOutbound(sourceInterceptors, null, null);
         InboundInvocationChain inboundChain = setupInbound(targetInterceptors, null, null);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, sourceInterceptor.getCount());
         assertEquals(0, targetInterceptor.getCount());
         connector.connect(inboundChain, outboundChain);
@@ -145,6 +152,7 @@
         assertEquals(msg, inboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(1, sourceInterceptor.getCount());
         assertEquals(1, targetInterceptor.getCount());
+        verify(invoker);
     }
 
     public InboundInvocationChain setupInbound(List<Interceptor> interceptors,

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/OutboundToInboundConnectTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/OutboundToInboundConnectTestCase.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/OutboundToInboundConnectTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/builder/OutboundToInboundConnectTestCase.java Mon Sep  4 17:41:21 2006
@@ -33,6 +33,7 @@
 import org.apache.tuscany.spi.wire.OutboundInvocationChain;
 import org.apache.tuscany.spi.wire.TargetInvoker;
 
+import junit.framework.TestCase;
 import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
 import org.apache.tuscany.core.mock.component.SimpleTarget;
 import org.apache.tuscany.core.mock.wire.MockHandler;
@@ -40,8 +41,11 @@
 import org.apache.tuscany.core.wire.InboundInvocationChainImpl;
 import org.apache.tuscany.core.wire.InvokerInterceptor;
 import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
-import org.jmock.Mock;
-import org.jmock.MockObjectTestCase;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
 
 /**
  * Verifies connection strategies between {@link org.apache.tuscany.spi.wire.OutboundInvocationChain}s and {@link
@@ -49,7 +53,7 @@
  *
  * @version $$Rev$$ $$Date$$
  */
-public class OutboundToInboundConnectTestCase extends MockObjectTestCase {
+public class OutboundToInboundConnectTestCase extends TestCase {
 
     @SuppressWarnings("unchecked")
     public void testNoInterceptorsNoHandlers() throws Exception {
@@ -57,12 +61,13 @@
         InboundInvocationChain inboundChain = setupTarget(null, null, null);
         OutboundInvocationChain outboundChain = setupSource(null, null, null);
         String[] val = new String[]{"foo"};
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invokeTarget").with(eq(val)).will(returnValue(val));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invokeTarget(EasyMock.eq(val))).andReturn(val);
+        replay(invoker);
         connector.connect(outboundChain, inboundChain, invoker);
         inboundChain.prepare();
         assertEquals(val, outboundChain.getTargetInvoker().invokeTarget(val));
+        verify(invoker);
     }
 
 
@@ -79,15 +84,16 @@
         OutboundInvocationChain outboundChain = setupSource(interceptors, null, null);
         InboundInvocationChain inboundChain = setupTarget(null, null, null);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, interceptor.getCount());
         connector.connect(outboundChain, inboundChain, invoker);
         inboundChain.prepare();
         msg.setTargetInvoker(outboundChain.getTargetInvoker());
         assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(1, interceptor.getCount());
+        verify(invoker);
     }
 
     /**
@@ -103,15 +109,16 @@
         OutboundInvocationChain outboundChain = setupSource(null, null, null);
         InboundInvocationChain inboundChain = setupTarget(interceptors, null, null);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, interceptor.getCount());
         connector.connect(outboundChain, inboundChain, invoker);
         inboundChain.prepare();
         msg.setTargetInvoker(outboundChain.getTargetInvoker());
         assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(1, interceptor.getCount());
+        verify(invoker);
     }
 
     /**
@@ -130,9 +137,9 @@
         OutboundInvocationChain outboundChain = setupSource(sourceInterceptors, null, null);
         InboundInvocationChain inboundChain = setupTarget(targetInterceptors, null, null);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, sourceInterceptor.getCount());
         assertEquals(0, targetInterceptor.getCount());
         connector.connect(outboundChain, inboundChain, invoker);
@@ -141,6 +148,7 @@
         assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(1, sourceInterceptor.getCount());
         assertEquals(1, targetInterceptor.getCount());
+        verify(invoker);
     }
 
     /**
@@ -159,9 +167,9 @@
         OutboundInvocationChain outboundChain = setupSource(interceptors, handlers, null);
         InboundInvocationChain inboundChain = setupTarget(null, null, null);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, interceptor.getCount());
         assertEquals(0, handler.getCount());
         connector.connect(outboundChain, inboundChain, invoker);
@@ -170,6 +178,7 @@
         assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(1, interceptor.getCount());
         assertEquals(1, handler.getCount());
+        verify(invoker);
     }
 
     /**
@@ -188,9 +197,9 @@
         OutboundInvocationChain outboundChain = setupSource(null, null, null);
         InboundInvocationChain inboundChain = setupTarget(interceptors, handlers, null);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, interceptor.getCount());
         assertEquals(0, handler.getCount());
         connector.connect(outboundChain, inboundChain, invoker);
@@ -199,6 +208,7 @@
         assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(1, interceptor.getCount());
         assertEquals(1, handler.getCount());
+        verify(invoker);
     }
 
 
@@ -218,9 +228,9 @@
         OutboundInvocationChain outboundChain = setupSource(interceptors, null, handlers);
         InboundInvocationChain inboundChain = setupTarget(null, null, null);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, interceptor.getCount());
         assertEquals(0, handler.getCount());
         connector.connect(outboundChain, inboundChain, invoker);
@@ -229,6 +239,7 @@
         assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(1, interceptor.getCount());
         assertEquals(1, handler.getCount());
+        verify(invoker);
     }
 
     /**
@@ -247,9 +258,9 @@
         OutboundInvocationChain outboundChain = setupSource(null, null, null);
         InboundInvocationChain inboundChain = setupTarget(interceptors, null, handlers);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, interceptor.getCount());
         assertEquals(0, handler.getCount());
         connector.connect(outboundChain, inboundChain, invoker);
@@ -258,6 +269,7 @@
         assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(1, interceptor.getCount());
         assertEquals(1, handler.getCount());
+        verify(invoker);
     }
 
     /**
@@ -276,9 +288,9 @@
         OutboundInvocationChain outboundChain = setupSource(interceptors, handlers, handlers);
         InboundInvocationChain inboundChain = setupTarget(null, null, null);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, interceptor.getCount());
         assertEquals(0, handler.getCount());
         connector.connect(outboundChain, inboundChain, invoker);
@@ -287,6 +299,7 @@
         assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(1, interceptor.getCount());
         assertEquals(2, handler.getCount());
+        verify(invoker);
     }
 
     /**
@@ -305,9 +318,9 @@
         OutboundInvocationChain outboundChain = setupSource(null, null, handlers);
         InboundInvocationChain inboundChain = setupTarget(interceptors, handlers, null);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, interceptor.getCount());
         assertEquals(0, handler.getCount());
         connector.connect(outboundChain, inboundChain, invoker);
@@ -316,6 +329,7 @@
         assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(1, interceptor.getCount());
         assertEquals(2, handler.getCount());
+        verify(invoker);
     }
 
     /**
@@ -331,15 +345,16 @@
         OutboundInvocationChain outboundChain = setupSource(null, handlers, handlers);
         InboundInvocationChain inboundChain = setupTarget(null, null, null);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, handler.getCount());
         connector.connect(outboundChain, inboundChain, invoker);
         inboundChain.prepare();
         msg.setTargetInvoker(outboundChain.getTargetInvoker());
         assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(2, handler.getCount());
+        verify(invoker);
     }
 
     /**
@@ -355,15 +370,16 @@
         OutboundInvocationChain outboundChain = setupSource(null, null, null);
         InboundInvocationChain inboundChain = setupTarget(null, handlers, handlers);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, handler.getCount());
         connector.connect(outboundChain, inboundChain, invoker);
         inboundChain.prepare();
         msg.setTargetInvoker(outboundChain.getTargetInvoker());
         assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(2, handler.getCount());
+        verify(invoker);
     }
 
     /**
@@ -379,15 +395,16 @@
         OutboundInvocationChain outboundChain = setupSource(null, handlers, null);
         InboundInvocationChain inboundChain = setupTarget(null, null, null);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, handler.getCount());
         connector.connect(outboundChain, inboundChain, invoker);
         inboundChain.prepare();
         msg.setTargetInvoker(outboundChain.getTargetInvoker());
         assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(1, handler.getCount());
+        verify(invoker);
     }
 
     /**
@@ -403,15 +420,16 @@
         OutboundInvocationChain outboundChain = setupSource(null, null, null);
         InboundInvocationChain inboundChain = setupTarget(null, handlers, null);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, handler.getCount());
         connector.connect(outboundChain, inboundChain, invoker);
         inboundChain.prepare();
         msg.setTargetInvoker(outboundChain.getTargetInvoker());
         assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(1, handler.getCount());
+        verify(invoker);
     }
 
     /**
@@ -427,15 +445,16 @@
         OutboundInvocationChain outboundChain = setupSource(null, null, handlers);
         InboundInvocationChain inboundChain = setupTarget(null, null, null);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, handler.getCount());
         connector.connect(outboundChain, inboundChain, invoker);
         inboundChain.prepare();
         msg.setTargetInvoker(outboundChain.getTargetInvoker());
         assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(1, handler.getCount());
+        verify(invoker);
     }
 
     /**
@@ -451,15 +470,16 @@
         OutboundInvocationChain outboundChain = setupSource(null, null, null);
         InboundInvocationChain inboundChain = setupTarget(null, null, handlers);
         Message msg = new MessageImpl();
-        Mock mock = mock(TargetInvoker.class);
-        mock.expects(once()).method("invoke").with(eq(msg)).will(returnValue(msg));
-        TargetInvoker invoker = (TargetInvoker) mock.proxy();
+        TargetInvoker invoker = createNiceMock(TargetInvoker.class);
+        expect(invoker.invoke(EasyMock.eq(msg))).andReturn(msg);
+        replay(invoker);
         assertEquals(0, handler.getCount());
         connector.connect(outboundChain, inboundChain, invoker);
         inboundChain.prepare();
         msg.setTargetInvoker(outboundChain.getTargetInvoker());
         assertEquals(msg, outboundChain.getHeadInterceptor().invoke(msg));
         assertEquals(1, handler.getCount());
+        verify(invoker);
     }
 
 

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/deployer/BootstrapDeployerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/deployer/BootstrapDeployerTestCase.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/deployer/BootstrapDeployerTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/deployer/BootstrapDeployerTestCase.java Mon Sep  4 17:41:21 2006
@@ -24,6 +24,7 @@
 
 import org.apache.tuscany.spi.component.Component;
 import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.SCAObject;
 import org.apache.tuscany.spi.deployer.Deployer;
 import org.apache.tuscany.spi.deployer.DeploymentContext;
 import org.apache.tuscany.spi.loader.LoaderException;
@@ -33,37 +34,41 @@
 import org.apache.tuscany.spi.model.CompositeComponentType;
 import org.apache.tuscany.spi.model.Implementation;
 import org.apache.tuscany.spi.model.Include;
+import org.apache.tuscany.spi.model.Property;
 import org.apache.tuscany.spi.model.PropertyValue;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
 import org.apache.tuscany.spi.model.ServiceDefinition;
 
+import junit.framework.TestCase;
 import org.apache.tuscany.core.bootstrap.Bootstrapper;
 import org.apache.tuscany.core.bootstrap.DefaultBootstrapper;
 import org.apache.tuscany.core.implementation.system.model.SystemBinding;
 import org.apache.tuscany.core.implementation.system.model.SystemCompositeImplementation;
 import org.apache.tuscany.core.mock.component.BasicInterface;
 import org.apache.tuscany.core.monitor.NullMonitorFactory;
-import org.jmock.Mock;
-import org.jmock.MockObjectTestCase;
+import static org.easymock.EasyMock.createNiceMock;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
 
 /**
  * Verifies the default boostrap deployer
  *
  * @version $Rev$ $Date$
  */
-public class BootstrapDeployerTestCase extends MockObjectTestCase {
+public class BootstrapDeployerTestCase extends TestCase {
     private DeployerImpl deployer;
     private DeploymentContext deploymentContext;
     private ComponentDefinition<SystemCompositeImplementation> componentDefinition;
     private SystemCompositeImplementation implementation;
-    private Mock parent;
 
     public void testBoot1Load() throws LoaderException {
-        Mock mock = mock(CompositeComponent.class);
-        CompositeComponent parent = (CompositeComponent) mock.proxy();
+        CompositeComponent parent = createNiceMock(CompositeComponent.class);
         URL scdl = BootstrapDeployerTestCase.class.getResource("boot1.scdl");
         implementation.setScdlLocation(scdl);
         deployer.load(parent, componentDefinition, deploymentContext);
-        CompositeComponentType<ServiceDefinition, ?, ?> composite = implementation.getComponentType();
+        CompositeComponentType<ServiceDefinition, ReferenceDefinition, Property<?>> composite =
+            implementation.getComponentType();
         assertNotNull(composite);
         assertEquals("boot1", composite.getName());
 
@@ -101,25 +106,28 @@
     public void testBoot1Deployment() throws LoaderException {
         URL scdl = BootstrapDeployerTestCase.class.getResource("boot1.scdl");
         implementation.setScdlLocation(scdl);
-        parent.expects(once()).method("register").withAnyArguments();
-
+        CompositeComponent<?> parent = createNiceMock(CompositeComponent.class);
+        parent.register(isA(SCAObject.class));
+        replay(parent);
         // load the boot1 file using the bootstrap deployer
         componentDefinition.setName("simple");
-        Component<?> component = deployer.deploy((CompositeComponent<?>) parent.proxy(), componentDefinition);
+        Component<?> component = deployer.deploy(parent, componentDefinition);
         assertNotNull(component);
-        parent.verify();
+        verify(parent);
     }
 
     public void testBoot2Deployment() throws LoaderException {
         URL scdl = BootstrapDeployerTestCase.class.getResource("boot2.scdl");
         implementation.setScdlLocation(scdl);
-        parent.expects(once()).method("register").withAnyArguments();
+        CompositeComponent<?> parent = createNiceMock(CompositeComponent.class);
+        parent.register(isA(SCAObject.class));
+        replay(parent);
 
         // load the boot2 file using the bootstrap deployer
         componentDefinition.setName("newDeployer");
-        Component<?> component = deployer.deploy((CompositeComponent<?>) parent.proxy(), componentDefinition);
+        Component<?> component = deployer.deploy(parent, componentDefinition);
         assertNotNull(component);
-        parent.verify();
+        verify(parent);
         component.start();
         Deployer newDeployer = (Deployer) component.getServiceInstance("deployer");
         assertNotNull(newDeployer);
@@ -147,6 +155,5 @@
         implementation = new SystemCompositeImplementation();
         implementation.setClassLoader(getClass().getClassLoader());
         componentDefinition = new ComponentDefinition<SystemCompositeImplementation>(implementation);
-        parent = mock(CompositeComponent.class);
     }
 }

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeBuilderTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeBuilderTestCase.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeBuilderTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeBuilderTestCase.java Mon Sep  4 17:41:21 2006
@@ -20,11 +20,14 @@
 
 import java.net.URI;
 
+import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.CompositeComponent;
 import org.apache.tuscany.spi.component.ScopeContainer;
 import org.apache.tuscany.spi.deployer.DeploymentContext;
 import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
 import org.apache.tuscany.spi.implementation.java.ConstructorDefinition;
+import org.apache.tuscany.spi.implementation.java.JavaMappedProperty;
 import org.apache.tuscany.spi.implementation.java.JavaMappedReference;
 import org.apache.tuscany.spi.implementation.java.JavaMappedService;
 import org.apache.tuscany.spi.implementation.java.PojoComponentType;
@@ -39,6 +42,7 @@
 import org.apache.tuscany.spi.model.ServiceDefinition;
 import org.apache.tuscany.spi.wire.WireService;
 
+import junit.framework.TestCase;
 import org.apache.tuscany.core.builder.BuilderRegistryImpl;
 import org.apache.tuscany.core.deployer.RootDeploymentContext;
 import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
@@ -49,13 +53,15 @@
 import org.apache.tuscany.core.implementation.java.mock.components.Target;
 import org.apache.tuscany.core.implementation.java.mock.components.TargetImpl;
 import org.apache.tuscany.core.wire.jdk.JDKWireService;
-import org.jmock.Mock;
-import org.jmock.MockObjectTestCase;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.isA;
 
 /**
  * @version $$Rev$$ $$Date$$
  */
-public class CompositeBuilderTestCase extends MockObjectTestCase {
+public class CompositeBuilderTestCase extends TestCase {
     private DeploymentContext deploymentContext;
 
     protected void setUp() throws Exception {
@@ -91,32 +97,31 @@
 
     private ComponentDefinition createTopComponentDef() throws Exception {
 
-        CompositeComponentType outerType = new CompositeComponentType();
+        CompositeComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> outerType =
+            new CompositeComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         outerType.add(createSourceComponentDef());
         outerType.add(createTargetComponentDef());
 
         CompositeImplementation outerImpl = new CompositeImplementation();
         outerImpl.setComponentType(outerType);
 
-        ComponentDefinition<CompositeImplementation> topComponentDefinition =
-            new ComponentDefinition<CompositeImplementation>(outerImpl);
-
-        return topComponentDefinition;
+        return new ComponentDefinition<CompositeImplementation>(outerImpl);
     }
 
-    private ComponentDefinition createSourceComponentDef() throws Exception {
+    private ComponentDefinition<CompositeImplementation> createSourceComponentDef() throws Exception {
 
-        CompositeComponentType innerType = new CompositeComponentType();
+        CompositeComponentType<ServiceDefinition, ReferenceDefinition, JavaMappedProperty<?>> innerType =
+            new CompositeComponentType<ServiceDefinition, ReferenceDefinition, JavaMappedProperty<?>>();
         innerType.add(createInnerSourceComponentDef());
         ReferenceDefinition reference = new ReferenceDefinition();
         reference.setName("targetComponentRef");
         JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
-        ServiceContract<?> targetContract = registry.introspect(Target.class);
+        JavaServiceContract targetContract = registry.introspect(Target.class);
         reference.setServiceContract(targetContract);
         innerType.add(reference);
         BindlessServiceDefinition service = new BindlessServiceDefinition();
         service.setName("InnerSourceService");
-        ServiceContract<?> sourceContract = registry.introspect(Source.class);
+        JavaServiceContract sourceContract = registry.introspect(Source.class);
         service.setServiceContract(sourceContract);
         service.setTarget(new URI("InnerSourceComponent"));
         innerType.add(service);
@@ -134,9 +139,10 @@
         return sourceComponentDefinition;
     }
 
-    private ComponentDefinition createInnerSourceComponentDef() throws Exception {
+    private ComponentDefinition<JavaImplementation> createInnerSourceComponentDef() throws Exception {
 
-        PojoComponentType sourceType = new PojoComponentType();
+        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> sourceType =
+            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         sourceType.setImplementationScope(Scope.MODULE);
         JavaMappedReference reference = new JavaMappedReference();
         reference.setName("targetReference");
@@ -148,12 +154,12 @@
 
         ServiceContract<?> sourceContract = registry.introspect(Source.class);
 
-        ServiceDefinition sourceServiceDefinition = new JavaMappedService();
+        JavaMappedService sourceServiceDefinition = new JavaMappedService();
         sourceServiceDefinition.setName("Source");
         sourceServiceDefinition.setServiceContract(sourceContract);
 
         sourceType.add(sourceServiceDefinition);
-        sourceType.setConstructorDefinition(new ConstructorDefinition(SourceImpl.class.getConstructor((Class[]) null)));
+        sourceType.setConstructorDefinition(new ConstructorDefinition<SourceImpl>(SourceImpl.class.getConstructor()));
         JavaImplementation sourceImpl = new JavaImplementation();
         sourceImpl.setComponentType(sourceType);
         sourceImpl.setImplementationClass(SourceImpl.class);
@@ -167,34 +173,34 @@
         return innerSourceComponentDefinition;
     }
 
-    private ComponentDefinition createTargetComponentDef() throws Exception {
+    private ComponentDefinition<JavaImplementation> createTargetComponentDef() throws Exception {
 
-        PojoComponentType targetType = new PojoComponentType();
+        PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>> targetType =
+            new PojoComponentType<JavaMappedService, JavaMappedReference, JavaMappedProperty<?>>();
         targetType.setImplementationScope(Scope.MODULE);
 
         JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
         ServiceContract<?> targetContract = registry.introspect(Target.class);
 
-        ServiceDefinition targetServiceDefinition = new JavaMappedService();
-        targetServiceDefinition.setName("Target");
-        targetServiceDefinition.setServiceContract(targetContract);
+        JavaMappedService serviceDefinition = new JavaMappedService();
+        serviceDefinition.setName("Target");
+        serviceDefinition.setServiceContract(targetContract);
 
-        targetType.add(targetServiceDefinition);
-        targetType.setConstructorDefinition(new ConstructorDefinition(TargetImpl.class.getConstructor((Class[]) null)));
+        targetType.add(serviceDefinition);
+        targetType.setConstructorDefinition(new ConstructorDefinition<TargetImpl>(TargetImpl.class.getConstructor()));
         JavaImplementation targetImpl = new JavaImplementation();
         targetImpl.setComponentType(targetType);
         targetImpl.setImplementationClass(TargetImpl.class);
-        ComponentDefinition<JavaImplementation> targetComponentDefinition =
-            new ComponentDefinition<JavaImplementation>("TargetComponent", targetImpl);
-
-        return targetComponentDefinition;
+        return new ComponentDefinition<JavaImplementation>("TargetComponent", targetImpl);
     }
 
     private ScopeContainer createMock() {
-        Mock mock = mock(ScopeContainer.class);
-        mock.expects(once()).method("start");
-        mock.expects(atLeastOnce()).method("register");
-        mock.expects(atLeastOnce()).method("getScope").will(returnValue(Scope.MODULE));
-        return (ScopeContainer) mock.proxy();
+        ScopeContainer container = EasyMock.createMock(ScopeContainer.class);
+        container.start();
+        container.register(isA(AtomicComponent.class));
+        expectLastCall().atLeastOnce();
+        expect(container.getScope()).andReturn(Scope.MODULE).atLeastOnce();
+        EasyMock.replay(container);
+        return container;
     }
 }

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/AutowireResolutionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/AutowireResolutionTestCase.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/AutowireResolutionTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/AutowireResolutionTestCase.java Mon Sep  4 17:41:21 2006
@@ -20,44 +20,61 @@
 
 import org.apache.tuscany.spi.component.CompositeComponent;
 
+import junit.framework.TestCase;
 import org.apache.tuscany.core.component.AutowireComponent;
-import org.jmock.Mock;
-import org.jmock.MockObjectTestCase;
+import org.easymock.EasyMock;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
 
 /**
  * Verfies specific autowire resolution scenarios
  *
  * @version $Rev$ $Date$
  */
-public class AutowireResolutionTestCase extends MockObjectTestCase {
-    private SystemCompositeComponentImpl<?> context;
-    private Mock parent;
-    private Mock autowire;
+public class AutowireResolutionTestCase extends TestCase {
 
     public void testConstruction() {
-        assertEquals("test", context.getName());
-        assertSame(parent.proxy(), context.getParent());
+        CompositeComponent<?> parent = createMock(CompositeComponent.class);
+        AutowireComponent<?> autowire = createMock(AutowireComponent.class);
+        replay(parent);
+        replay(autowire);
+        SystemCompositeComponent<?> component = new SystemCompositeComponentImpl("test", parent, autowire, null, null);
+        assertEquals("test", component.getName());
+        assertSame(parent, component.getParent());
+        verify(parent);
+        verify(autowire);
     }
 
     public void testResolveToSelf() {
-        assertSame(context, context.resolveInstance(CompositeComponent.class));
-        assertSame(context, context.resolveInstance(SystemCompositeComponent.class));
+        CompositeComponent<?> parent = createMock(CompositeComponent.class);
+        AutowireComponent<?> autowire = createMock(AutowireComponent.class);
+        replay(parent);
+        replay(autowire);
+        SystemCompositeComponent<?> component = new SystemCompositeComponentImpl("test", parent, autowire, null, null);
+        assertSame(component, component.resolveInstance(CompositeComponent.class));
+        assertSame(component, component.resolveInstance(SystemCompositeComponent.class));
+        verify(parent);
+        verify(autowire);
     }
 
     public void testResolvedByAutowire() {
         Foo foo = new Foo() {
         };
-        autowire.expects(once()).method("resolveInstance").with(eq(Foo.class)).will(returnValue(foo));
-        assertSame(foo, context.resolveInstance(Foo.class));
+        CompositeComponent<?> parent = createMock(CompositeComponent.class);
+        AutowireComponent<?> autowire = createMock(AutowireComponent.class);
+        EasyMock.expect(autowire.resolveInstance(eq(Foo.class))).andReturn(foo);
+        replay(parent);
+        replay(autowire);
+        SystemCompositeComponent<?> component = new SystemCompositeComponentImpl("test", parent, autowire, null, null);
+        assertSame(foo, component.resolveInstance(Foo.class));
+        verify(parent);
+        verify(autowire);
     }
 
     protected void setUp() throws Exception {
         super.setUp();
-        parent = mock(CompositeComponent.class);
-        autowire = mock(AutowireComponent.class);
-        context = new SystemCompositeComponentImpl("test",
-            (CompositeComponent) parent.proxy(),
-            (AutowireComponent) autowire.proxy(), null, null);
     }
 
     public static interface Foo {

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/CompositePropagationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/CompositePropagationTestCase.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/CompositePropagationTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/CompositePropagationTestCase.java Mon Sep  4 17:41:21 2006
@@ -21,39 +21,42 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import junit.framework.TestCase;
 import org.apache.tuscany.core.mock.component.Source;
-import org.jmock.Mock;
-import org.jmock.MockObjectTestCase;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
 
 /**
- * Tests registering arbirarily deep child composite contexts
+ * Tests registering arbitrarily deep child composite contexts
  *
  * @version $Rev$ $Date$
  */
-public class CompositePropagationTestCase extends MockObjectTestCase {
+public class CompositePropagationTestCase extends TestCase {
 
     private SystemCompositeComponent parent;
-    private SystemCompositeComponent child1;
     private SystemCompositeComponent child2;
 
     public void testLifecyclePropagation() throws NoSuchMethodException {
         parent.start();
         List<Class<?>> interfaces = new ArrayList<Class<?>>();
         interfaces.add(Source.class);
-        Mock mock = mock(SystemAtomicComponent.class);
-        mock.stubs().method("getName").will(returnValue("source"));
-        mock.expects(once()).method("stop");
-        mock.stubs().method("getServiceInterfaces").will(returnValue(interfaces));
-        SystemAtomicComponent context = (SystemAtomicComponent) mock.proxy();
-        child2.register(context);
+        SystemAtomicComponent component = createMock(SystemAtomicComponent.class);
+        expect(component.getName()).andReturn("source").anyTimes();
+        component.stop();
+        expect(component.getServiceInterfaces()).andReturn(interfaces);
+        replay(component);
+        child2.register(component);
         parent.stop();
+        verify(component);
     }
 
 
     protected void setUp() throws Exception {
         super.setUp();
         parent = new SystemCompositeComponentImpl("parent", null, null, null, null);
-        child1 = new SystemCompositeComponentImpl("child1", parent, null, null, null);
+        SystemCompositeComponent child1 = new SystemCompositeComponentImpl("child1", parent, null, null, null);
         child2 = new SystemCompositeComponentImpl("child2", child1, null, null, null);
         child1.register(child2);
         parent.register(child1);

Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/system/builder/SystemBuilderWireTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/system/builder/SystemBuilderWireTestCase.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/system/builder/SystemBuilderWireTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/implementation/system/builder/SystemBuilderWireTestCase.java Mon Sep  4 17:41:21 2006
@@ -65,7 +65,7 @@
         Connector connector = new ConnectorImpl();
         SystemComponentBuilder builder = new SystemComponentBuilder();
 
-        SystemCompositeComponent parent = new SystemCompositeComponentImpl(null, null, null, null, null);
+        SystemCompositeComponent parent = new SystemCompositeComponentImpl(null, null, null, connector, null);
 
         ComponentDefinition<SystemImplementation> targetComponentDefinition = MockComponentFactory.createTarget();
         ComponentDefinition<SystemImplementation> sourceComponentDefinition =
@@ -76,9 +76,7 @@
 
         parent.register(sourceComponent);
         parent.register(targetComponent);
-
-        connector.connect(sourceComponent);
-        connector.connect(targetComponent);
+        parent.prepare();
         parent.start();
         scope.onEvent(new CompositeStart(this, parent));
         Source source = (Source) parent.getChild("source").getServiceInstance();

Added: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessorRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessorRegistry.java?view=auto&rev=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessorRegistry.java (added)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessorRegistry.java Mon Sep  4 17:41:21 2006
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.spi.builder;
+
+/**
+ * Acts as a delegating <code>WirePostProcessor</code>, delegating post-processing of wires after policies have been
+ * applied and source an targets have been matched but before they are connected.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WirePostProcessorRegistry extends WirePostProcessor {
+
+
+    /**
+     * Registers a post-processor in the runtime
+     *
+     * @param processor the processor to register
+     */
+    void register(WirePostProcessor processor);
+
+    /**
+     * De-registers a post-processor in the runtime
+     *
+     * @param processor the processor to de-register
+     */
+    void unregister(WirePostProcessor processor);
+
+}

Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessorRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/builder/WirePostProcessorRegistry.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/CompositeComponent.java Mon Sep  4 17:41:21 2006
@@ -37,12 +37,7 @@
      * @param context the context to add as a child
      * @throws InvalidComponentTypeException
      */
-    void register(SCAObject context) throws InvalidComponentTypeException;
-
-    /**
-     * Returns true if the composite wires its own children
-     */
-    boolean isSelfWiring();
+    void register(SCAObject<?> context) throws InvalidComponentTypeException;
 
     /**
      * Returns the child associated with a given name

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/SCAObject.java Mon Sep  4 17:41:21 2006
@@ -52,8 +52,8 @@
     T getServiceInstance() throws TargetException;
 
     /**
-     * Called to signal that the parent composite has been activated and that the artifact should perform any required
-     * initialization steps
+     * Called to signal that the composite should perform and required steps prior to registration with its parent such
+     * as wiring of its children
      */
     void prepare();
 

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/CompositeComponentExtension.java Mon Sep  4 17:41:21 2006
@@ -53,12 +53,11 @@
  */
 public abstract class CompositeComponentExtension<T> extends AbstractSCAObject<T> implements CompositeComponent<T> {
 
-    protected final Map<String, SCAObject> children = new ConcurrentHashMap<String, SCAObject>();
+    protected final Map<String, SCAObject<?>> children = new ConcurrentHashMap<String, SCAObject<?>>();
     protected final List<Service> services = new ArrayList<Service>();
     protected final List<Reference> references = new ArrayList<Reference>();
     protected final Map<String, Document> propertyValues;
     protected final Connector connector;
-    protected boolean selfWiring;
 
     protected CompositeComponentExtension(String name,
                                           CompositeComponent<?> parent,
@@ -69,10 +68,6 @@
         this.connector = connector;
     }
 
-    public boolean isSelfWiring() {
-        return selfWiring;
-    }
-
     public Scope getScope() {
         return Scope.COMPOSITE;
     }
@@ -81,7 +76,7 @@
         publish(event);
     }
 
-    public void register(SCAObject child) {
+    public void register(SCAObject<?> child) {
         assert child != null : "child was null";
         if (children.get(child.getName()) != null) {
             DuplicateNameException e = new DuplicateNameException("A context is already registered with name");
@@ -213,7 +208,6 @@
             return map;
         }
     }
-
 
     public void prepare() {
         for (SCAObject object : children.values()) {

Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/PojoComponentType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/PojoComponentType.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/PojoComponentType.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/implementation/java/PojoComponentType.java Mon Sep  4 17:41:21 2006
@@ -35,7 +35,7 @@
     extends ComponentType<S, R, P> {
 
     private Scope implementationScope = Scope.UNDEFINED;
-    private ConstructorDefinition constructorDefinition;
+    private ConstructorDefinition<?> constructorDefinition;
     private Method initMethod;
     private Method destroyMethod;
 
@@ -63,7 +63,7 @@
     /**
      * Sets the constructor used to instantiate implementation instances
      */
-    public void setConstructorDefinition(ConstructorDefinition definition) {
+    public void setConstructorDefinition(ConstructorDefinition<?> definition) {
         this.constructorDefinition = definition;
     }
 

Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java?view=diff&rev=440210&r1=440209&r2=440210
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/CompositeComponentExtensionTestCase.java Mon Sep  4 17:41:21 2006
@@ -20,6 +20,7 @@
 
 import java.util.List;
 
+import org.apache.tuscany.spi.builder.Connector;
 import org.apache.tuscany.spi.component.AtomicComponent;
 import org.apache.tuscany.spi.component.ComponentNotFoundException;
 import org.apache.tuscany.spi.component.DuplicateNameException;
@@ -37,6 +38,7 @@
 
 import junit.framework.TestCase;
 import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.createNiceMock;
 import static org.easymock.EasyMock.eq;
 import static org.easymock.EasyMock.expectLastCall;
 import static org.easymock.EasyMock.replay;
@@ -211,7 +213,7 @@
 
     private class Composite<T> extends CompositeComponentExtension<T> {
         public Composite() {
-            super(null, null, null, null);
+            super(null, null, createNiceMock(Connector.class), null);
         }
 
         public void setScopeContainer(ScopeContainer scopeContainer) {



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message