You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2006/10/25 17:00:34 UTC

svn commit: r467675 [2/2] - in /incubator/tuscany/java/sca/services/containers/container.script: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/container/...

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/ScriptInstanceFactoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/ScriptInstanceFactoryTestCase.java?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/ScriptInstanceFactoryTestCase.java (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/ScriptInstanceFactoryTestCase.java Wed Oct 25 08:00:29 2006
@@ -0,0 +1,69 @@
+package org.apache.tuscany.container.script;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.bsf.BSFManager;
+import org.apache.tuscany.container.script.mock.MockBSFEngine;
+import org.apache.tuscany.spi.ObjectCreationException;
+
+public class ScriptInstanceFactoryTestCase extends TestCase {
+
+    public void testCreateInstance() throws InvocationTargetException {
+        BSFManager.registerScriptingEngine("mock", MockBSFEngine.class.getName(), new String[] {"mock"});
+        ScriptInstanceFactory factory = new ScriptInstanceFactory("foo.mock", "bar", "baz", getClass().getClassLoader());
+        Map<String, Object> context = new HashMap<String, Object>();
+        context.put("foo", "bar");
+        ScriptInstance instance = factory.createInstance(null, context);
+        assertNotNull(instance);
+        assertNotNull(instance.bsfEngine);
+//        assertNotNull(instance.clazz);
+    }
+
+    public void testCreateInstanceNoClass() throws InvocationTargetException {
+        BSFManager.registerScriptingEngine("mock", MockBSFEngine.class.getName(), new String[] {"mock"});
+        ScriptInstanceFactory factory = new ScriptInstanceFactory("foo.mock", null, "baz", getClass().getClassLoader());
+        Map<String, Object> context = new HashMap<String, Object>();
+        context.put("foo", "bar");
+        ScriptInstance instance = factory.createInstance(null, context);
+        assertNotNull(instance);
+        assertNotNull(instance.bsfEngine);
+    }
+
+    public void testCreateInstanceRuby() throws InvocationTargetException {
+        BSFManager.registerScriptingEngine("ruby", MockBSFEngine.class.getName(), new String[] {"mock"});
+        ScriptInstanceFactory factory = new ScriptInstanceFactory("foo.mock", "bar", "baz", getClass().getClassLoader());
+        Map<String, Object> context = new HashMap<String, Object>();
+        context.put("foo", "bar");
+        ScriptInstance instance = factory.createInstance(null, context);
+        assertNotNull(instance);
+        assertNotNull(instance.bsfEngine);
+//        assertNotNull(instance.clazz);
+    }
+
+    public void testBadCreateInstance() throws InvocationTargetException {
+        ScriptInstanceFactory factory = new ScriptInstanceFactory("foo", "bar", "baz", getClass().getClassLoader());
+        Map<String, Object> context = new HashMap<String, Object>();
+        try {
+            factory.createInstance(null, context);
+            fail();
+        } catch (ObjectCreationException e) {
+            // expected
+        }
+    }
+
+    public void testGetters() throws InvocationTargetException {
+        ScriptInstanceFactory factory = new ScriptInstanceFactory("foo", "bar", "baz", getClass().getClassLoader());
+//        assertEquals("foo", factory.getScriptName());
+//        assertEquals("bar", factory.getClassName());
+//        assertEquals("baz", factory.getScriptSource());
+        assertEquals(getClass().getClassLoader(), factory.getClassLoader());
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+}

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/ScriptInstanceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/ScriptInstanceTestCase.java?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/ScriptInstanceTestCase.java (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/ScriptInstanceTestCase.java Wed Oct 25 08:00:29 2006
@@ -0,0 +1,30 @@
+package org.apache.tuscany.container.script;
+
+import java.lang.reflect.InvocationTargetException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.container.script.mock.MockBSFEngine;
+
+public class ScriptInstanceTestCase extends TestCase {
+
+    private ScriptInstance instance;
+
+    public void testInvokeTarget() throws InvocationTargetException {
+        assertEquals("hello:", instance.invokeTarget("hello", null));
+    }
+
+    public void testInvokeTargetException() throws InvocationTargetException {
+        try {
+            instance.invokeTarget("bang", null);
+            fail();
+        } catch (InvocationTargetException e) {
+            // expected
+        }
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        this.instance = new ScriptInstance(new MockBSFEngine(), null);
+    }
+}

Propchange: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Oct 25 08:00:29 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/AsyncInvokerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/AsyncInvokerTestCase.java?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/AsyncInvokerTestCase.java (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/AsyncInvokerTestCase.java Wed Oct 25 08:00:29 2006
@@ -0,0 +1,211 @@
+/*
+ * 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.container.script.helper;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.getCurrentArguments;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.container.script.helper.AsyncInvoker;
+import org.apache.tuscany.container.script.helper.AsyncMonitor;
+import org.apache.tuscany.container.script.helper.ScriptHelperComponent;
+import org.apache.tuscany.container.script.helper.ScriptHelperInstance;
+import org.apache.tuscany.container.script.helper.AsyncInvoker.ContextBinder;
+import org.apache.tuscany.container.script.helper.AsyncInvoker.ImmutableMessage;
+import org.apache.tuscany.container.script.helper.mock.AsyncTarget;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.services.work.WorkScheduler;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.easymock.IAnswer;
+import org.easymock.classextension.EasyMock;
+
+/**
+ */
+public class AsyncInvokerTestCase extends TestCase {
+    
+    @SuppressWarnings("unchecked")
+    public void testInvoke() throws Exception {
+        ScriptHelperInstance instance = createMock(ScriptHelperInstance.class);
+        expect(instance.invokeTarget("invoke", null)).andReturn(null).once();
+        replay(instance);
+        ScriptHelperComponent component = EasyMock.createMock(ScriptHelperComponent.class);
+        expect(component.getTargetInstance()).andReturn(instance);
+        EasyMock.replay(component);
+        AsyncMonitor monitor = createMock(AsyncMonitor.class);
+        replay(monitor);
+
+        WorkScheduler scheduler = createMock(WorkScheduler.class);
+        scheduler.scheduleWork(isA(Runnable.class));
+        expectLastCall().andStubAnswer(new IAnswer() {
+            public Object answer() throws Throwable {
+                Runnable runnable = (Runnable) getCurrentArguments()[0];
+                runnable.run();
+                return null;
+            }
+        });
+        replay(scheduler);
+        WorkContext context = createMock(WorkContext.class);
+        Method method = AsyncTarget.class.getMethod("invoke");
+        method.setAccessible(true);
+        InboundWire wire = createMock(InboundWire.class);
+        AsyncInvoker invoker = new AsyncInvoker("invoke", wire, component, scheduler, monitor, context);
+        Message msg = new MessageImpl();
+        invoker.invoke(msg);
+        verify(instance);
+    }
+    
+    public void testClone() {
+        AsyncInvoker invoker = new AsyncInvoker(null, null, null,null,null,null);
+        assertNotNull(invoker.clone());
+    }
+
+    public void testGetInstance() {
+        ScriptHelperComponent component = EasyMock.createMock(ScriptHelperComponent.class);
+        expect(component.getTargetInstance()).andReturn("petra");
+        EasyMock.replay(component);
+        AsyncInvoker invoker = new AsyncInvoker(null, null, component,null,null,null);
+        assertEquals("petra", invoker.getInstance());
+    }
+
+    public void testGetInstanceCacheable() {
+        ScriptHelperComponent component = EasyMock.createMock(ScriptHelperComponent.class);
+        expect(component.getTargetInstance()).andReturn("petra");
+        EasyMock.replay(component);
+        AsyncInvoker invoker = new AsyncInvoker(null, null, component,null,null,null);
+        invoker.setCacheable(true);
+        assertEquals("petra", invoker.getInstance());
+    }
+
+    public void testGetBody() {
+        ImmutableMessage message = new AsyncInvoker.ImmutableMessage();
+        assertNull(message.getBody());
+    }
+
+    public void testSetBody() {
+        ImmutableMessage message = new AsyncInvoker.ImmutableMessage();
+        try {
+            message.setBody(null);
+            fail();
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
+
+    public void testGetTargetInvoker() {
+        ImmutableMessage message = new AsyncInvoker.ImmutableMessage();
+        assertNull(message.getTargetInvoker());
+    }
+
+    public void testSetTargetInvoker() {
+        ImmutableMessage message = new AsyncInvoker.ImmutableMessage();
+        try {
+            message.setTargetInvoker(null);
+            fail();
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
+
+    public void testGetFromAddress() {
+        ImmutableMessage message = new AsyncInvoker.ImmutableMessage();
+        assertNull(message.getFromAddress());
+    }
+
+    public void testSetFromAddress() {
+        ImmutableMessage message = new AsyncInvoker.ImmutableMessage();
+        try {
+            message.setFromAddress(null);
+            fail();
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
+
+    public void testGetMessageId() {
+        ImmutableMessage message = new AsyncInvoker.ImmutableMessage();
+        assertNull(message.getMessageId());
+    }
+
+    public void testSetMessageId() {
+        ImmutableMessage message = new AsyncInvoker.ImmutableMessage();
+        try {
+            message.setMessageId(null);
+            fail();
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
+
+    public void testGetCorrelationId() {
+        ImmutableMessage message = new AsyncInvoker.ImmutableMessage();
+        assertNull(message.getCorrelationId());
+    }
+
+    public void testSetCorrelationId() {
+        ImmutableMessage message = new AsyncInvoker.ImmutableMessage();
+        try {
+            message.setCorrelationId(null);
+            fail();
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
+
+    public void testIsFault() {
+        ImmutableMessage message = new AsyncInvoker.ImmutableMessage();
+        assertFalse(message.isFault());
+    }
+
+    public void testSetBodyWithFault() {
+        ImmutableMessage message = new AsyncInvoker.ImmutableMessage();
+        try {
+            message.setBodyWithFault(null);
+            fail();
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
+
+    public void testContextBinder() {
+        ContextBinder contextBinder = new AsyncInvoker.ContextBinder();
+        contextBinder.setContext(null);
+        try {
+            contextBinder.start();
+            fail();
+        } catch (AssertionError e) {
+            // expected
+        }
+        try {
+            contextBinder.stop();
+            fail();
+        } catch (AssertionError e) {
+            // expected
+        }
+    }
+}

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperComponentBuilderTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperComponentBuilderTestCase.java?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperComponentBuilderTestCase.java (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperComponentBuilderTestCase.java Wed Oct 25 08:00:29 2006
@@ -0,0 +1,107 @@
+package org.apache.tuscany.container.script.helper;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.container.script.helper.ScriptHelperComponentBuilder;
+import org.apache.tuscany.container.script.helper.ScriptHelperComponentType;
+import org.apache.tuscany.container.script.helper.ScriptHelperImplementation;
+import org.apache.tuscany.core.component.scope.ModuleScopeObjectFactory;
+import org.apache.tuscany.core.component.scope.ScopeRegistryImpl;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.ScopeRegistry;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.model.ComponentDefinition;
+import org.apache.tuscany.spi.model.PropertyValue;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+import org.easymock.IAnswer;
+
+public class ScriptHelperComponentBuilderTestCase extends TestCase {
+
+    public void testGetImplementationType() {
+        ScriptHelperComponentBuilder builder = new ScriptHelperComponentBuilder();
+        assertEquals(ScriptHelperImplementation.class, builder.getImplementationType());
+    }
+
+    @SuppressWarnings("unchecked")
+    public void testBuild() {
+        ScriptHelperComponentBuilder builder = new ScriptHelperComponentBuilder();
+        ScopeRegistry scopeRegistry = new ScopeRegistryImpl();
+        scopeRegistry.registerFactory(Scope.COMPOSITE, new ModuleScopeObjectFactory(scopeRegistry));
+        builder.setScopeRegistry(scopeRegistry);
+        DeploymentContext deploymentContext = createMock(DeploymentContext.class);
+        final ScopeContainer scopeContainer = createMock(ScopeContainer.class);
+        expect(scopeContainer.getScope()).andStubAnswer(new IAnswer() {
+            public Object answer() throws Throwable {
+                return Scope.COMPOSITE;
+            }
+        });
+        expect(deploymentContext.getModuleScope()).andStubAnswer(new IAnswer() {
+            public Object answer() throws Throwable {
+                return scopeContainer;
+            }
+        });
+        replay(deploymentContext);
+        ComponentDefinition<ScriptHelperImplementation> impl = new ComponentDefinition<ScriptHelperImplementation>(new ScriptHelperImplementation());
+        ScriptHelperComponentType componentType = new ScriptHelperComponentType();
+        componentType.setLifecycleScope(Scope.COMPOSITE);
+        ServiceDefinition service = new ServiceDefinition();
+        ServiceContract serviceContract = new JavaServiceContract();
+        service.setServiceContract(serviceContract);
+        componentType.add(service);
+        impl.getImplementation().setComponentType(componentType);
+        
+        PropertyValue pv = new PropertyValue("foo", "", "");
+        ObjectFactory pvFactory = createMock(ObjectFactory.class);
+        expect(pvFactory.getInstance()).andStubAnswer(new IAnswer() {
+            public Object answer() throws Throwable {
+                return null;
+            }
+        });
+        replay(pvFactory);
+        pv.setValueFactory(pvFactory);
+        impl.add(pv);
+        
+        Component component = builder.build(null, impl, deploymentContext);
+        assertNotNull(component);
+    }
+
+    @SuppressWarnings("unchecked")
+    public void testBuildModuleScope() {
+        ScriptHelperComponentBuilder builder = new ScriptHelperComponentBuilder();
+        DeploymentContext deploymentContext = createMock(DeploymentContext.class);
+        final ScopeContainer scopeContainer = createMock(ScopeContainer.class);
+        expect(scopeContainer.getScope()).andStubAnswer(new IAnswer() {
+            public Object answer() throws Throwable {
+                return Scope.MODULE;
+            }
+        });
+        expect(deploymentContext.getModuleScope()).andStubAnswer(new IAnswer() {
+            public Object answer() throws Throwable {
+                return scopeContainer;
+            }
+        });
+        replay(deploymentContext);
+        ComponentDefinition<ScriptHelperImplementation> impl = new ComponentDefinition<ScriptHelperImplementation>(new ScriptHelperImplementation());
+        ScriptHelperComponentType componentType = new ScriptHelperComponentType();
+        ServiceDefinition service = new ServiceDefinition();
+        ServiceContract serviceContract = new JavaServiceContract();
+        service.setServiceContract(serviceContract);
+        componentType.add(service);
+        impl.getImplementation().setComponentType(componentType);
+        Component component = builder.build(null, impl, deploymentContext);
+        assertNotNull(component);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+}

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperComponentTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperComponentTestCase.java?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperComponentTestCase.java (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperComponentTestCase.java Wed Oct 25 08:00:29 2006
@@ -0,0 +1,145 @@
+package org.apache.tuscany.container.script.helper;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.container.script.helper.ScriptHelperComponent;
+import org.apache.tuscany.container.script.helper.ScriptHelperInstance;
+import org.apache.tuscany.container.script.helper.ScriptHelperInstanceFactory;
+import org.apache.tuscany.container.script.helper.mock.MockInstanceFactory;
+import org.apache.tuscany.core.wire.InboundWireImpl;
+import org.apache.tuscany.core.wire.OutboundWireImpl;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.component.TargetException;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.InboundWire;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.RuntimeWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.WireService;
+import org.easymock.IAnswer;
+
+public class ScriptHelperComponentTestCase extends TestCase {
+    
+    private ScopeContainer scopeContainer;
+
+    @SuppressWarnings("unchecked")
+    public void testCreateTargetInvoker() {
+        ScriptHelperComponent component = new ScriptHelperComponent(null,null, null, null, null, scopeContainer, null, null, null);
+        
+        Operation operation = new Operation("hashCode", null,null,null,false,null);
+        ServiceContract contract = new ServiceContract(List.class){};
+        operation.setServiceContract(contract);
+        TargetInvoker invoker = component.createTargetInvoker("hashCode", operation);
+        
+        assertNotNull(invoker);
+    }
+
+    @SuppressWarnings("unchecked")
+    public void testCreateInstance() throws IOException {
+        ScriptHelperComponent pc = new ScriptHelperComponent(null,createBSFEasy(), new HashMap(), null, null, scopeContainer, null, null, null);
+        Object o = pc.createInstance();
+        assertNotNull(o);
+        assertTrue(o instanceof ScriptHelperInstance);
+    }
+
+    @SuppressWarnings("unchecked")
+    public void testCreateInstanceWithRef() throws IOException {
+        WireService wireService = createMock(WireService.class);
+        expect(wireService.createProxy(isA(RuntimeWire.class))).andStubAnswer(new IAnswer() {
+            public Object answer() throws Throwable {
+                return Scope.MODULE;
+            }
+        });
+       
+        ScriptHelperComponent pc = new ScriptHelperComponent(null,createBSFEasy(), new HashMap(), null, null, scopeContainer, wireService, null, null);
+        OutboundWire wire = new OutboundWireImpl();
+        wire.setReferenceName("foo");
+        pc.addOutboundWire(wire);
+        Object o = pc.createInstance();
+        assertNotNull(o);
+        assertTrue(o instanceof ScriptHelperInstance);
+    }
+
+    @SuppressWarnings("unchecked")
+    public void testGetServiceInstance() {
+        WireService wireService = createMock(WireService.class);
+        expect(wireService.createProxy(isA(RuntimeWire.class))).andStubAnswer(new IAnswer() {
+            public Object answer() throws Throwable {
+                return "foo";
+            }
+        });
+        replay(wireService);
+        ScriptHelperComponent pc = new ScriptHelperComponent(null,null, null, null, null, scopeContainer, wireService, null, null);
+        InboundWire wire = new InboundWireImpl();
+        pc.addInboundWire(wire);
+        assertEquals("foo", pc.getServiceInstance());
+    }
+
+    @SuppressWarnings("unchecked")
+    public void testGetServiceInstanceFail() {
+        ScriptHelperComponent pc = new ScriptHelperComponent(null,null, null, null, null, scopeContainer, null, null, null);
+        try {
+            pc.getServiceInstance();
+            fail();
+        } catch (TargetException e) {
+            // expected
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    public void testGetproperties() {
+        ScriptHelperComponent pc = new ScriptHelperComponent(null,null, new HashMap(), null, null, scopeContainer, null, null, null);
+        assertNotNull(pc.getProperties());
+    }
+
+    @SuppressWarnings("unchecked")
+    public void testGetServiceInterfaces() {
+        List services = new ArrayList();
+        ScriptHelperComponent pc = new ScriptHelperComponent(null,null,null, services, null, scopeContainer, null, null, null);
+        assertEquals(services, pc.getServiceInterfaces());
+    }
+
+    @SuppressWarnings("unchecked")
+    public void testCreateAsyncTargetInvoker() {
+        ScriptHelperComponent pc = new ScriptHelperComponent(null,null,null, new ArrayList<Class<?>>(), null, scopeContainer, null, null, null);
+        assertNotNull(pc.createAsyncTargetInvoker(null, new Operation("foo", null,null,null)));
+    }
+    
+    @Override
+    @SuppressWarnings("unchecked")
+    protected void setUp() throws Exception {
+        super.setUp();
+        this.scopeContainer = createMock(ScopeContainer.class);
+        expect(scopeContainer.getScope()).andStubAnswer(new IAnswer() {
+            public Object answer() throws Throwable {
+                return Scope.MODULE;
+            }
+        });
+    }
+
+    public ScriptHelperInstanceFactory createBSFEasy() throws IOException {
+//        URL scriptURL = getClass().getResource("foo.mock");
+//        InputStream is = scriptURL.openStream();
+//        StringBuilder sb = new StringBuilder();
+//        int i = 0;
+//        while ((i = is.read()) != -1) {
+//            sb.append((char) i);
+//        }
+//        is.close();
+//        String script = sb.toString();
+        MockInstanceFactory bsfEasy = new MockInstanceFactory("foo.mock", null);
+        return bsfEasy;
+    }
+}

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperComponentTypeLoaderTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperComponentTypeLoaderTestCase.java?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperComponentTypeLoaderTestCase.java (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperComponentTypeLoaderTestCase.java Wed Oct 25 08:00:29 2006
@@ -0,0 +1,144 @@
+/*
+ * 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.container.script.helper;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.stream.XMLStreamException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.container.script.helper.ScriptHelperComponentTypeLoader;
+import org.apache.tuscany.container.script.helper.ScriptHelperImplementation;
+import org.apache.tuscany.container.script.helper.ScriptHelperInstanceFactory;
+import org.apache.tuscany.container.script.helper.mock.MockInstanceFactory;
+import org.apache.tuscany.core.loader.LoaderRegistryImpl;
+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.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.ModelObject;
+import org.apache.tuscany.spi.model.Scope;
+import org.easymock.IAnswer;
+
+/**
+ * 
+ */
+public class ScriptHelperComponentTypeLoaderTestCase extends TestCase {
+
+    public void testGetSideFileName() {
+        ScriptHelperComponentTypeLoader loader = new ScriptHelperComponentTypeLoader();
+        assertEquals("BSFEasyTestCase.componentType", loader.getSideFileName("BSFEasyTestCase.mock"));
+    }
+
+    public void testGetSideFileNameNoDot() {
+        ScriptHelperComponentTypeLoader loader = new ScriptHelperComponentTypeLoader();
+      assertEquals("BSFEasyTestCase.componentType", loader.getSideFileName("BSFEasyTestCase"));
+    }
+
+    @SuppressWarnings("unchecked")
+    public void testLoadFromSideFile() throws MalformedURLException, LoaderException, XMLStreamException {
+        ScriptHelperComponentTypeLoader loader = new ScriptHelperComponentTypeLoader();
+        LoaderRegistry loaderRegistry = new LoaderRegistryImpl() {
+            public <MO extends ModelObject> MO load(CompositeComponent parent, ModelObject mo, URL url, Class<MO> type, DeploymentContext ctx) throws LoaderException {
+                return (MO) new ComponentType();
+            }
+        };
+        loader.setLoaderRegistry(loaderRegistry);
+        loader.loadFromSidefile(null, null);
+    }
+
+    @SuppressWarnings("unchecked")
+    public void testLoad() throws LoaderException {
+        ScriptHelperInstanceFactory bsfEasy = new MockInstanceFactory("org/apache/tuscany/container/script/helper/foo.mock", getClass().getClassLoader());
+        ScriptHelperComponentTypeLoader loader = new ScriptHelperComponentTypeLoader();
+        LoaderRegistry loaderRegistry = new LoaderRegistryImpl() {
+            public <MO extends ModelObject> MO load(CompositeComponent parent,
+                    ModelObject mo,
+                    URL url,
+                    Class<MO> type,
+                    DeploymentContext ctx) throws LoaderException {
+                return (MO) new ComponentType();
+            }
+        };
+        loader.setLoaderRegistry(loaderRegistry);
+        ScriptHelperImplementation implementation = new ScriptHelperImplementation();
+        implementation.setResourceName("org/apache/tuscany/container/script/helper/foo.mock");
+        implementation.setScriptInstanceFactory(bsfEasy);
+        DeploymentContext deploymentContext = createMock(DeploymentContext.class);
+        final ScopeContainer scopeContainer = createMock(ScopeContainer.class);
+        expect(scopeContainer.getScope()).andStubAnswer(new IAnswer() {
+            public Object answer() throws Throwable {
+                return Scope.MODULE;
+            }
+        });
+        expect(deploymentContext.getModuleScope()).andStubAnswer(new IAnswer() {
+            public Object answer() throws Throwable {
+                return scopeContainer;
+            }
+        });
+        replay(deploymentContext);
+        loader.load(null, implementation, deploymentContext);
+        assertNotNull(implementation.getComponentType());
+    }
+
+    @SuppressWarnings("unchecked")
+    public void testLoadMissingSideFile() throws LoaderException {
+        ScriptHelperInstanceFactory bsfEasy = new MockInstanceFactory("org/apche/tuscany/container/script/helper/foo.mock", getClass().getClassLoader());
+        ScriptHelperComponentTypeLoader loader = new ScriptHelperComponentTypeLoader();
+        ScriptHelperImplementation implementation = new ScriptHelperImplementation();
+        implementation.setResourceName("org/apache/tuscany/container/script/helper/doesntExist");
+        implementation.setScriptInstanceFactory(bsfEasy);
+        DeploymentContext deploymentContext = createMock(DeploymentContext.class);
+        final ScopeContainer scopeContainer = createMock(ScopeContainer.class);
+        expect(scopeContainer.getScope()).andStubAnswer(new IAnswer() {
+            public Object answer() throws Throwable {
+                return Scope.MODULE;
+            }
+        });
+        expect(deploymentContext.getModuleScope()).andStubAnswer(new IAnswer() {
+            public Object answer() throws Throwable {
+                return scopeContainer;
+            }
+        });
+        replay(deploymentContext);
+        try {
+            loader.load(null, implementation, deploymentContext);
+            fail();
+        } catch (IllegalArgumentException e) {
+        }
+    }
+
+    public void testGetImplementationClass() {
+        ScriptHelperComponentTypeLoader loader = new ScriptHelperComponentTypeLoader();
+        assertEquals(ScriptHelperImplementation.class, loader.getImplementationClass());
+    }
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+    }
+}

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperComponentTypeTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperComponentTypeTestCase.java?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperComponentTypeTestCase.java (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperComponentTypeTestCase.java Wed Oct 25 08:00:29 2006
@@ -0,0 +1,37 @@
+package org.apache.tuscany.container.script.helper;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.container.script.helper.ScriptHelperComponentType;
+import org.apache.tuscany.spi.model.ComponentType;
+import org.apache.tuscany.spi.model.Property;
+import org.apache.tuscany.spi.model.ReferenceDefinition;
+import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.ServiceDefinition;
+
+public class ScriptHelperComponentTypeTestCase extends TestCase {
+    
+    public void testLifecycleScope() {
+        ScriptHelperComponentType ct = new ScriptHelperComponentType();
+        assertEquals(Scope.MODULE, ct.getLifecycleScope());
+        ct.setLifecycleScope(Scope.COMPOSITE);
+        assertEquals(Scope.COMPOSITE, ct.getLifecycleScope());
+    }
+
+    @SuppressWarnings("unchecked")
+    public void testComponentTypeConstructor() {
+        ComponentType ct = new ComponentType();
+        Property property = new Property();
+        ct.add(property);
+        ReferenceDefinition reference = new ReferenceDefinition();
+        ct.add(reference);
+        ServiceDefinition service = new ServiceDefinition();
+        ct.add(service);
+
+        ScriptHelperComponentType pct = new ScriptHelperComponentType(ct);
+        
+        assertEquals(property, pct.getProperties().values().iterator().next());
+        assertEquals(reference, pct.getReferences().values().iterator().next());
+        assertEquals(service, pct.getServices().values().iterator().next());
+    }
+}

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperImplementationLoaderTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperImplementationLoaderTestCase.java?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperImplementationLoaderTestCase.java (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperImplementationLoaderTestCase.java Wed Oct 25 08:00:29 2006
@@ -0,0 +1,78 @@
+/*
+ * 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.container.script.helper;
+
+import static org.easymock.classextension.EasyMock.createMock;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.container.script.helper.ScriptHelperImplementation;
+import org.apache.tuscany.container.script.helper.ScriptHelperImplementationLoader;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.loader.MissingResourceException;
+import org.apache.tuscany.spi.model.ModelObject;
+
+/**
+ * 
+ */
+public class ScriptHelperImplementationLoaderTestCase extends TestCase {
+
+    private LoaderRegistry registry;
+
+    private ScriptHelperImplementationLoader loader;
+
+    public void testLoadSource() throws LoaderException {
+        String script = loader.loadSource(getClass().getClassLoader(), "org/apache/tuscany/container/script/helper/foo.mock");
+        assertTrue(script.startsWith("hello"));
+    }
+
+    public void testLoadSourceMissingResource() throws LoaderException {
+        try {
+            loader.loadSource(getClass().getClassLoader(), "doesnt.exist");
+            fail();
+        } catch (MissingResourceException e) {
+            // expected
+        }
+    }
+
+    public void testGetXMLType() throws LoaderException {
+        assertEquals("http://foo", loader.getXMLType().getNamespaceURI());
+        assertEquals("bar", loader.getXMLType().getLocalPart());
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        registry = createMock(LoaderRegistry.class);
+        loader = new ScriptHelperImplementationLoader(registry){
+            public QName getXMLType() {
+                return new QName("http://foo", "bar");
+            }
+//            @Override
+            public ScriptHelperImplementation load(CompositeComponent arg0, ModelObject arg1, XMLStreamReader arg2, DeploymentContext arg3) throws XMLStreamException, LoaderException {
+                return null;
+            }};
+    }
+}

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperImplementationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperImplementationTestCase.java?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperImplementationTestCase.java (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperImplementationTestCase.java Wed Oct 25 08:00:29 2006
@@ -0,0 +1,30 @@
+package org.apache.tuscany.container.script.helper;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.container.script.helper.ScriptHelperImplementation;
+import org.apache.tuscany.container.script.helper.ScriptHelperInstanceFactory;
+import org.apache.tuscany.container.script.helper.mock.MockInstanceFactory;
+
+public class ScriptHelperImplementationTestCase extends TestCase {
+
+    private ScriptHelperInstanceFactory bsfEasy;
+
+    public void testGetBSFEasy() {
+        ScriptHelperImplementation impl = new ScriptHelperImplementation();
+        impl.setScriptInstanceFactory(bsfEasy);
+        assertEquals(bsfEasy, impl.getScriptInstanceFactory());
+    }
+
+    public void testGetResourceName() {
+        ScriptHelperImplementation impl = new ScriptHelperImplementation();
+        impl.setResourceName("foo");
+        assertEquals("foo", impl.getResourceName());
+    }
+
+    public void setUp() throws Exception {
+        super.setUp();
+        bsfEasy = new MockInstanceFactory("BSFEasyTestCase", null);
+    }
+
+}

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperInstanceFactoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperInstanceFactoryTestCase.java?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperInstanceFactoryTestCase.java (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperInstanceFactoryTestCase.java Wed Oct 25 08:00:29 2006
@@ -0,0 +1,56 @@
+package org.apache.tuscany.container.script.helper;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.container.script.helper.ScriptHelperInstance;
+import org.apache.tuscany.container.script.helper.mock.MockInstanceFactory;
+
+public class ScriptHelperInstanceFactoryTestCase extends TestCase {
+
+    public void testCreateInstance() throws InvocationTargetException {
+        MockInstanceFactory factory = new MockInstanceFactory("foo.mock", getClass().getClassLoader());
+        Map<String, Object> context = new HashMap<String, Object>();
+        context.put("foo", "bar");
+        ScriptHelperInstance instance = factory.createInstance(null, context);
+        assertNotNull(instance);
+    }
+
+    public void testCreateInstanceNoClass() throws InvocationTargetException {
+        MockInstanceFactory factory = new MockInstanceFactory("foo.mock", getClass().getClassLoader());
+        Map<String, Object> context = new HashMap<String, Object>();
+        context.put("foo", "bar");
+        ScriptHelperInstance instance = factory.createInstance(null, context);
+        assertNotNull(instance);
+    }
+
+    public void testCreateInstanceRuby() throws InvocationTargetException {
+        MockInstanceFactory factory = new MockInstanceFactory("foo.mock", getClass().getClassLoader());
+        Map<String, Object> context = new HashMap<String, Object>();
+        context.put("foo", "bar");
+        ScriptHelperInstance instance = factory.createInstance(null, context);
+        assertNotNull(instance);
+    }
+
+    public void testGetters() throws InvocationTargetException {
+        MockInstanceFactory factory = new MockInstanceFactory("foo", getClass().getClassLoader());
+        assertEquals("foo", factory.getResourceName());
+        assertEquals(getClass().getClassLoader(), factory.getClassLoader());
+    }
+
+    public void testGetResponseClasses() {
+        MockInstanceFactory factory = new MockInstanceFactory("foo", getClass().getClassLoader());
+        Map<String, Class> classes = factory.getResponseClasses(Arrays.asList( new Class[]{ Runnable.class}));
+        assertEquals(1, classes.size());
+        assertEquals("run", classes.keySet().iterator().next());
+        assertEquals(void.class, classes.get("run"));
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+}

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperInvokerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperInvokerTestCase.java?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperInvokerTestCase.java (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/ScriptHelperInvokerTestCase.java Wed Oct 25 08:00:29 2006
@@ -0,0 +1,64 @@
+package org.apache.tuscany.container.script.helper;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+
+import java.lang.reflect.InvocationTargetException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.container.script.helper.ScriptHelperComponent;
+import org.apache.tuscany.container.script.helper.ScriptHelperInstance;
+import org.apache.tuscany.container.script.helper.ScriptHelperInvoker;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.model.Scope;
+import org.easymock.IAnswer;
+
+public class ScriptHelperInvokerTestCase extends TestCase {
+
+    private ScriptHelperComponent component;
+
+    public void testInvokeTarget() throws InvocationTargetException {
+        ScriptHelperInvoker invoker = new ScriptHelperInvoker("hello", component);
+        assertEquals("hello petra", invoker.invokeTarget(null));
+    }
+
+    public void testInvokeTargetException() throws InvocationTargetException, SecurityException, NoSuchMethodException {
+         ScriptHelperInvoker badInvoker = new ScriptHelperInvoker("bang", component);
+         try {
+             badInvoker.invokeTarget(null);
+             fail();
+         } catch (InvocationTargetException e) {
+            // expected
+         }
+    }
+
+    @SuppressWarnings("unchecked")
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        ScopeContainer scopeContainer = createMock(ScopeContainer.class);
+        expect(scopeContainer.getScope()).andStubAnswer(new IAnswer() {
+            public Object answer() throws Throwable {
+                return Scope.MODULE;
+            }
+        });
+        expect(scopeContainer.getInstance(isA(AtomicComponent.class))).andStubAnswer(new IAnswer() {
+            public Object answer() throws Throwable {
+                return new ScriptHelperInstance(){
+                    public Object invokeTarget(String operationName, Object[] args) throws InvocationTargetException {
+                        if ("bang".equals(operationName)) {
+                            throw new RuntimeException("bang");
+                        }
+                        return "hello petra";
+                    }};
+            }
+        });
+        replay(scopeContainer);
+
+        this.component = new ScriptHelperComponent(null, null, null, null, null, scopeContainer, null, null, null);
+    }
+}

Propchange: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/mock/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Oct 25 08:00:29 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/mock/AsyncTarget.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/mock/AsyncTarget.java?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/mock/AsyncTarget.java (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/mock/AsyncTarget.java Wed Oct 25 08:00:29 2006
@@ -0,0 +1,26 @@
+/*
+ * 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.container.script.helper.mock;
+
+/**
+ */
+public interface AsyncTarget {
+
+    void invoke();
+}

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/mock/MockInstanceFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/mock/MockInstanceFactory.java?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/mock/MockInstanceFactory.java (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/helper/mock/MockInstanceFactory.java Wed Oct 25 08:00:29 2006
@@ -0,0 +1,30 @@
+package org.apache.tuscany.container.script.helper.mock;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.container.script.helper.ScriptHelperInstance;
+import org.apache.tuscany.container.script.helper.ScriptHelperInstanceFactory;
+
+public class MockInstanceFactory extends ScriptHelperInstanceFactory<MockInstance> {
+
+    public MockInstanceFactory(String scriptName, ClassLoader classLoader) {
+        super(scriptName, classLoader);
+    }
+
+    @Override
+    public MockInstance createInstance(List<Class> services, Map<String, Object> context) {
+        return new MockInstance();
+    }
+
+}
+
+class MockInstance implements ScriptHelperInstance {
+
+    public Object invokeTarget(String operationName, Object[] args) throws InvocationTargetException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/mock/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Oct 25 08:00:29 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/java/org/apache/tuscany/container/script/mock/MockBSFEngine.java Wed Oct 25 08:00:29 2006
@@ -0,0 +1,27 @@
+package org.apache.tuscany.container.script.mock;
+
+import org.apache.bsf.BSFException;
+import org.apache.bsf.util.BSFEngineImpl;
+
+public class MockBSFEngine extends BSFEngineImpl {
+
+    public Object call(Object object, String name, Object[] args) throws BSFException {
+        if ("bang".equals(name)) {
+            throw new RuntimeException(name);
+        }
+        
+        String resp = name + ":";
+        if (args != null) {
+            for (Object o : args) {
+                resp += " " + String.valueOf(o);
+            }
+        }
+        return resp;
+    }
+
+    public Object eval(String source, int lineNo, int columnNo, Object expr) throws BSFException {
+        // not used for the mock tests
+        return null;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Oct 25 08:00:29 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Oct 25 08:00:29 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Oct 25 08:00:29 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Oct 25 08:00:29 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Oct 25 08:00:29 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Oct 25 08:00:29 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/foo.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/foo.componentType?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/foo.componentType (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/foo.componentType Wed Oct 25 08:00:29 2006
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ASCII"?>
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+    <service name="HelloWorldService">
+        <interface.java interface="not.used"/>
+    </service>
+
+</componentType>

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/foo.mock
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/foo.mock?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/foo.mock (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/foo.mock Wed Oct 25 08:00:29 2006
@@ -0,0 +1 @@
+hello
\ No newline at end of file

Propchange: incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/helper/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Oct 25 08:00:29 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/helper/foo.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/helper/foo.componentType?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/helper/foo.componentType (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/helper/foo.componentType Wed Oct 25 08:00:29 2006
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ASCII"?>
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+    <service name="HelloWorldService">
+        <interface.java interface="not.used"/>
+    </service>
+
+</componentType>

Added: incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/helper/foo.mock
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/helper/foo.mock?view=auto&rev=467675
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/helper/foo.mock (added)
+++ incubator/tuscany/java/sca/services/containers/container.script/src/test/resources/org/apache/tuscany/container/script/helper/foo.mock Wed Oct 25 08:00:29 2006
@@ -0,0 +1 @@
+hello
\ No newline at end of file



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