From bad1f71da1978610806427e2e2a2f96a2fb5b88e Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 12 Apr 2012 09:14:28 +0000 Subject: Tag 2.0 RC1 git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1325166 13f79535-47bb-0310-9956-ffa450edef68 --- .../provider/ScriptImplementationProvider.java | 174 ++++++++++++++++ .../ScriptImplementationProviderFactory.java | 55 +++++ .../script/provider/ScriptInvoker.java | 84 ++++++++ .../script/provider/ScriptPropertyFactory.java | 225 +++++++++++++++++++++ ...cany.sca.provider.ImplementationProviderFactory | 19 ++ .../script/itests/AbstractSCATestCase.java | 59 ++++++ .../helloworld/AbstractHelloWorldTestCase.java | 38 ++++ .../helloworld/GroovyHelloWorldTestCase.java | 29 +++ .../script/itests/helloworld/HelloWorld.java | 30 +++ .../script/itests/helloworld/HelloWorldProxy.java | 37 ++++ .../itests/helloworld/JRubyHelloWorldTestCase.java | 29 +++ .../helloworld/JavaScriptHelloWorldTestCase.java | 29 +++ .../helloworld/JythonHelloWorldTestCase.java | 29 +++ .../properties/AbstractHelloWorldTestCase.java | 38 ++++ .../properties/GroovyHelloWorldTestCase.java | 29 +++ .../script/itests/properties/HelloWorld.java | 30 +++ .../script/itests/properties/HelloWorldProxy.java | 37 ++++ .../itests/properties/JRubyHelloWorldTestCase.java | 28 +++ .../properties/JavaScriptHelloWorldTestCase.java | 29 +++ .../properties/JythonHelloWorldTestCase.java | 29 +++ .../itests/references/GroovyReferenceTestCase.java | 29 +++ .../script/itests/references/HelloWorldTarget.java | 34 ++++ .../itests/references/JRubyReferenceTestCase.java | 29 +++ .../references/JavaScriptReferenceTestCase.java | 29 +++ .../itests/references/JythonReferenceTestCase.java | 29 +++ .../itests/helloworld/GroovyHelloWorld.composite | 33 +++ .../itests/helloworld/JRubyHelloWorld.composite | 33 +++ .../helloworld/JavaScriptHelloWorld.composite | 33 +++ .../itests/helloworld/JythonHelloWorld.composite | 33 +++ .../itests/helloworld/helloworld.componentType | 30 +++ .../script/itests/helloworld/helloworld.groovy | 22 ++ .../script/itests/helloworld/helloworld.js | 23 +++ .../script/itests/helloworld/helloworld.py | 20 ++ .../script/itests/helloworld/helloworld.rb | 21 ++ .../itests/properties/GroovyHelloWorld.composite | 33 +++ .../itests/properties/JRubyHelloWorld.composite | 33 +++ .../properties/JavaScriptHelloWorld.composite | 33 +++ .../itests/properties/JythonHelloWorld.composite | 33 +++ .../itests/properties/helloworld.componentType | 32 +++ .../script/itests/properties/helloworld.groovy | 22 ++ .../script/itests/properties/helloworld.js | 23 +++ .../script/itests/properties/helloworld.py | 20 ++ .../script/itests/properties/helloworld.rb | 21 ++ .../itests/references/GroovyReference.composite | 38 ++++ .../itests/references/JRubyReference.composite | 38 ++++ .../references/JavaScriptReference.composite | 38 ++++ .../itests/references/JythonReference.composite | 38 ++++ .../itests/references/reference.componentType | 31 +++ .../script/itests/references/reference.groovy | 22 ++ .../script/itests/references/reference.js | 22 ++ .../script/itests/references/reference.py | 20 ++ .../script/itests/references/reference.rb | 21 ++ 52 files changed, 1973 insertions(+) create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/java/org/apache/tuscany/sca/implementation/script/provider/ScriptImplementationProvider.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/java/org/apache/tuscany/sca/implementation/script/provider/ScriptImplementationProviderFactory.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/java/org/apache/tuscany/sca/implementation/script/provider/ScriptInvoker.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/java/org/apache/tuscany/sca/implementation/script/provider/ScriptPropertyFactory.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/AbstractSCATestCase.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorld.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorldProxy.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/AbstractHelloWorldTestCase.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorldTestCase.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorld.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorldProxy.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorldTestCase.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorldTestCase.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReferenceTestCase.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/HelloWorldTarget.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReferenceTestCase.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReferenceTestCase.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JythonReferenceTestCase.java create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorld.composite create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorld.composite create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorld.composite create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.componentType create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorld.composite create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorld.composite create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorld.composite create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorld.composite create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.componentType create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReference.composite create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReference.composite create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReference.composite create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JythonReference.composite create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.componentType create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.js create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.py create mode 100644 sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.rb (limited to 'sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src') diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/java/org/apache/tuscany/sca/implementation/script/provider/ScriptImplementationProvider.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/java/org/apache/tuscany/sca/implementation/script/provider/ScriptImplementationProvider.java new file mode 100644 index 0000000000..0938462c49 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/java/org/apache/tuscany/sca/implementation/script/provider/ScriptImplementationProvider.java @@ -0,0 +1,174 @@ +/* + * 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.sca.implementation.script.provider; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; + +import javax.script.Invocable; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +import javax.script.ScriptException; + +import org.apache.axiom.om.OMElement; +import org.apache.bsf.xml.XMLHelper; +import org.apache.tuscany.sca.assembly.ComponentReference; +import org.apache.tuscany.sca.assembly.Property; +import org.apache.tuscany.sca.assembly.Reference; +import org.apache.tuscany.sca.assembly.Service; +import org.apache.tuscany.sca.core.factory.ObjectCreationException; +import org.apache.tuscany.sca.core.factory.ObjectFactory; +import org.apache.tuscany.sca.implementation.script.ScriptImplementation; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.interfacedef.java.JavaInterface; +import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.provider.ImplementationProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + +/** + * An ImplementationProvider for Script implementations. + * + * @version $Rev$ $Date$ + */ +public class ScriptImplementationProvider implements ImplementationProvider { + + private RuntimeComponent component; + private ScriptImplementation implementation; + private ScriptPropertyFactory propertyFactory; + private ScriptEngine scriptEngine; + private XMLHelper xmlHelper; + + public ScriptImplementationProvider(RuntimeComponent component, ScriptImplementation implementation, ScriptPropertyFactory propertyFactory) { + this.component = component; + this.implementation = implementation; + this.propertyFactory = propertyFactory; + + // Set the databinding and XMLHelper for WSDL interfaces + for (Service service : component.getServices()) { + InterfaceContract ic = service.getInterfaceContract(); + if (ic instanceof WSDLInterfaceContract) { + ic.getInterface().resetDataBinding(OMElement.class.getName()); + xmlHelper = XMLHelper.getArgHelper(scriptEngine); + } + } + } + + public void start() { + try { + String language = implementation.getLanguage(); + if (language == null) { + language = implementation.getScript(); + language = language.substring(language.lastIndexOf('.') +1); + } + scriptEngine = scriptEngine(language); + if (scriptEngine == null) { + throw new ObjectCreationException("no script engine found for language: " + implementation.getLanguage()); + } + if (!(scriptEngine instanceof Invocable)) { + throw new ObjectCreationException("script engine does not support Invocable: " + scriptEngine); + } + + for (Reference reference : implementation.getReferences()) { + scriptEngine.put(reference.getName(), getProxy(reference.getName())); + } + + for (Property property : implementation.getProperties()) { + ObjectFactory valueFactory = propertyFactory.createValueFactory(property); + if (valueFactory != null) { + scriptEngine.put(property.getName(), valueFactory.getInstance()); + } + } + + URL url = new URL(implementation.getLocation()); + InputStreamReader reader = new InputStreamReader(url.openStream()); + scriptEngine.eval(reader); + reader.close(); + + } catch (IOException e) { + throw new IllegalArgumentException(e); + } catch (ScriptException e) { + throw new IllegalArgumentException(e); + } + } + + public void stop() { + } + + public boolean supportsOneWayInvocation() { + return false; + } + + public Invoker createInvoker(RuntimeComponentService service, Operation operation) { + return new ScriptInvoker(scriptEngine, xmlHelper, operation); + } + + private Object getProxy(String name) { + for (ComponentReference reference : component.getReferences()) { + if (reference.getName().equals(name)) { + Class iface = ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass(); + return component.getComponentContext().getService(iface, name); + } + } + throw new IllegalArgumentException("reference " + name + " not found on component: " + component); + } + + /** + * Returns the script engine for the given language. + * + * @param language + * @return + */ + private ScriptEngine scriptEngine(String language) { + if ("rb".equals(language)) { + + // Hack for now to work around a problem with the JRuby script engine + // return new TuscanyJRubyScriptEngine(); + } else { + if ("py".equals(language)) { + pythonCachedir(); + } + } + // Allow privileged access to run access classes. Requires RuntimePermission + // for accessClassInPackage.sun.misc. + ScriptEngineManager scriptEngineManager = + AccessController.doPrivileged(new PrivilegedAction() { + public ScriptEngineManager run() { + return new ScriptEngineManager(); + } + }); + return scriptEngineManager.getEngineByExtension(language); + } + + /** + * If the Python home isn't set then let Tuscany suppress messages other than errors + * See TUSCANY-1950 + */ + private static void pythonCachedir() { + if (System.getProperty("python.home") == null) { + System.setProperty("python.verbose", "error"); + } + } +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/java/org/apache/tuscany/sca/implementation/script/provider/ScriptImplementationProviderFactory.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/java/org/apache/tuscany/sca/implementation/script/provider/ScriptImplementationProviderFactory.java new file mode 100644 index 0000000000..67d4a5493c --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/java/org/apache/tuscany/sca/implementation/script/provider/ScriptImplementationProviderFactory.java @@ -0,0 +1,55 @@ +/* + * 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.sca.implementation.script.provider; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.databinding.Mediator; +import org.apache.tuscany.sca.databinding.SimpleTypeMapper; +import org.apache.tuscany.sca.implementation.script.ScriptImplementation; +import org.apache.tuscany.sca.provider.ImplementationProvider; +import org.apache.tuscany.sca.provider.ImplementationProviderFactory; +import org.apache.tuscany.sca.runtime.RuntimeComponent; + +/** + * An ImplementationProviderFactory for Script implementations. + * + * @version $Rev$ $Date$ + */ +public class ScriptImplementationProviderFactory implements ImplementationProviderFactory { + + private ScriptPropertyFactory propertyFactory; + + public ScriptImplementationProviderFactory(ExtensionPointRegistry extensionPoints) { + UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); + Mediator mediator = utilities.getUtility(Mediator.class); + SimpleTypeMapper simpleTypeMapper = utilities.getUtility(SimpleTypeMapper.class); + propertyFactory = new ScriptPropertyFactory(mediator, simpleTypeMapper); + } + + public ImplementationProvider createImplementationProvider(RuntimeComponent component, ScriptImplementation Implementation) { + return new ScriptImplementationProvider(component, Implementation, propertyFactory); + } + + public Class getModelType() { + return ScriptImplementation.class; + } + +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/java/org/apache/tuscany/sca/implementation/script/provider/ScriptInvoker.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/java/org/apache/tuscany/sca/implementation/script/provider/ScriptInvoker.java new file mode 100644 index 0000000000..976eb2c0dd --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/java/org/apache/tuscany/sca/implementation/script/provider/ScriptInvoker.java @@ -0,0 +1,84 @@ +/* + * 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.sca.implementation.script.provider; + +import javax.script.Invocable; +import javax.script.ScriptEngine; +import javax.script.ScriptException; + +import org.apache.axiom.om.OMElement; +import org.apache.bsf.xml.XMLHelper; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; + +/** + * Perform the actual script invocation + * + * @version $Rev$ $Date$ + */ +public class ScriptInvoker implements Invoker { + + private ScriptEngine scriptEngine; + private XMLHelper xmlHelper; + private Operation operation; + + public ScriptInvoker(ScriptEngine scriptEngine, XMLHelper xmlHelper, Operation operation) { + this.scriptEngine = scriptEngine; + this.xmlHelper = xmlHelper; + this.operation = operation; + } + + private Object doInvoke(Object[] objects, Operation op) throws ScriptException { + if (xmlHelper != null) { + objects[0] = xmlHelper.toScriptXML((OMElement)objects[0]); + } + + Operation oper = operation; // static setting + if (oper.getName() == null) { // if no static setting + oper = op; // use dynamic setting + } + Object response; + try { + response = ((Invocable)scriptEngine).invokeFunction(oper.getName(), objects); + } catch (ScriptException e) { + throw e; + } catch (Exception e) { + throw new ScriptException(e); + } + + if (xmlHelper != null) { + response = xmlHelper.toOMElement(response); + } + + return response; + } + + public Message invoke(Message msg) { + try { + Object resp = doInvoke((Object[])msg.getBody(), msg.getOperation()); + msg.setBody(resp); + } catch (ScriptException e) { + msg.setFaultBody(e.getCause()); + } + return msg; + } + +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/java/org/apache/tuscany/sca/implementation/script/provider/ScriptPropertyFactory.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/java/org/apache/tuscany/sca/implementation/script/provider/ScriptPropertyFactory.java new file mode 100644 index 0000000000..b56af79b0b --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/java/org/apache/tuscany/sca/implementation/script/provider/ScriptPropertyFactory.java @@ -0,0 +1,225 @@ +/* + * 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.sca.implementation.script.provider; + +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; + +import org.apache.tuscany.sca.assembly.Property; +import org.apache.tuscany.sca.core.factory.ObjectCreationException; +import org.apache.tuscany.sca.core.factory.ObjectFactory; +import org.apache.tuscany.sca.databinding.Mediator; +import org.apache.tuscany.sca.databinding.SimpleTypeMapper; +import org.apache.tuscany.sca.interfacedef.DataType; +import org.apache.tuscany.sca.interfacedef.util.XMLType; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * A property factory for script properties. + * + * @version $Rev$ $Date$ + */ +public class ScriptPropertyFactory { + private Mediator mediator = null; + private SimpleTypeMapper simpleTypeMapper; + boolean isSimpleType; + + public ScriptPropertyFactory(Mediator mediator, SimpleTypeMapper simpleTypeMapper) { + this.mediator = mediator; + this.simpleTypeMapper = simpleTypeMapper; + } + + public ObjectFactory createValueFactory(Property property) { + isSimpleType = isSimpleType(property); + Document doc = (Document)property.getValue(); + Element rootElement = doc.getDocumentElement(); + + //FIXME : since scripts use dynamic types we need to generate a dynamic java type using the + //XML structure of the property value. Should this be done in the JavaBeansDataBinding... + Class javaType = null; + + if (property.isMany()) { + if (isSimpleType) { + String value = ""; + if (rootElement.getChildNodes().getLength() > 0) { + value = rootElement.getChildNodes().item(0).getTextContent(); + } + List values = + getSimplePropertyValues(value, javaType); + return new ListObjectFactoryImpl(property, + values, + isSimpleType, + javaType); + } else { + return new ListObjectFactoryImpl(property, + getComplexPropertyValues(doc), + isSimpleType, + javaType); + } + } else { + if (isSimpleType) { + String value = ""; + if (rootElement.getChildNodes().getLength() > 0) { + value = rootElement.getChildNodes().item(0).getTextContent(); + } + return new ObjectFactoryImpl(property, + value, + isSimpleType, + javaType); + } else { + Object value = getComplexPropertyValues(doc).get(0); + return new ObjectFactoryImpl(property, + value, + isSimpleType, + javaType); + } + + } + } + + private boolean isSimpleType(Property property) { + if (property.getXSDType() != null) { + return simpleTypeMapper.isSimpleXSDType(property.getXSDType()); + } else { + if (property instanceof Document) { + Document doc = (Document)property; + Element element = doc.getDocumentElement(); + if (element.getChildNodes().getLength() == 1 && + element.getChildNodes().item(0).getNodeType() == Node.TEXT_NODE) { + return true; + } + } + } + return false; + } + + private List getSimplePropertyValues(String concatenatedValue, Class javaType) { + List propValues = new ArrayList(); + StringTokenizer st = null; + if ( javaType.getName().equals("java.lang.String")) { + st = new StringTokenizer(concatenatedValue, "\""); + } else { + st = new StringTokenizer(concatenatedValue); + } + String aToken = null; + while (st.hasMoreTokens()) { + aToken = st.nextToken(); + if (aToken.trim().length() > 0) { + propValues.add(aToken); + } + } + return propValues; + } + + private List getComplexPropertyValues(Document document) { + Element rootElement = document.getDocumentElement(); + List propValues = new ArrayList(); + for (int count = 0 ; count < rootElement.getChildNodes().getLength() ; ++count) { + if (rootElement.getChildNodes().item(count).getNodeType() == Node.ELEMENT_NODE) { + propValues.add(rootElement.getChildNodes().item(count)); + } + } + return propValues; + } + + public abstract class ObjectFactoryImplBase implements ObjectFactory { + protected Property property; + protected Object propertyValue; + protected Class javaType; + protected DataType sourceDataType; + protected DataType targetDataType; + boolean isSimpleType; + + public ObjectFactoryImplBase(Property property, Object propertyValue, boolean isSimpleType, Class javaType) { + + this.isSimpleType = isSimpleType; + this.property = property; + this.propertyValue = propertyValue; + this.javaType = javaType; + + //FIXME : fix this when we have managed to generate dynamic java types + + /*sourceDataType = + new DataTypeImpl(DOMDataBinding.NAME, Node.class, + new XMLType(null, this.property.getXSDType())); + TypeInfo typeInfo = null; + if (this.property.getXSDType() != null) { + if (SimpleTypeMapperExtension.isSimpleXSDType(this.property.getXSDType())) { + typeInfo = new TypeInfo(property.getXSDType(), true, null); + } else { + typeInfo = new TypeInfo(property.getXSDType(), false, null); + } + } else { + typeInfo = new TypeInfo(property.getXSDType(), false, null); + } + + XMLType xmlType = new XMLType(typeInfo); + String dataBinding = null; //(String)property.getExtensions().get(DataBinding.class.getName()); + if (dataBinding != null) { + targetDataType = new DataTypeImpl(dataBinding, javaType, xmlType); + } else { + targetDataType = new DataTypeImpl(dataBinding, javaType, xmlType); + mediator.getDataBindingRegistry().introspectType(targetDataType, null); + }*/ + } + } + + public class ObjectFactoryImpl extends ObjectFactoryImplBase { + public ObjectFactoryImpl(Property property, Object propertyValue, boolean isSimpleType, Class javaType) { + super(property, propertyValue, isSimpleType, javaType); + } + + public Object getInstance() throws ObjectCreationException { + if (isSimpleType) { + return simpleTypeMapper.toJavaObject(property.getXSDType(), (String)propertyValue, null); + } else { + return mediator.mediate(propertyValue, sourceDataType, targetDataType, null); + } + } + } + + public class ListObjectFactoryImpl extends ObjectFactoryImplBase { + public ListObjectFactoryImpl(Property property, ListpropertyValues, boolean isSimpleType, Class javaType) { + super(property, propertyValues, isSimpleType, javaType); + } + + public List getInstance() throws ObjectCreationException { + if (isSimpleType) { + List values = new ArrayList(); + for (String aValue : (List)propertyValue) { + values.add(simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null)); + } + return values; + } else { + List instances = new ArrayList(); + for (Node aValue : (List)propertyValue) { + instances.add(mediator.mediate(aValue, + sourceDataType, + targetDataType, + null)); + } + return instances; + } + } + } +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory new file mode 100644 index 0000000000..941cfd7fd5 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory @@ -0,0 +1,19 @@ +# 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. + +# Implementation class for the implementation extension +org.apache.tuscany.sca.implementation.script.provider.ScriptImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.script.ScriptImplementation diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/AbstractSCATestCase.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/AbstractSCATestCase.java new file mode 100644 index 0000000000..d9277c3ae1 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/AbstractSCATestCase.java @@ -0,0 +1,59 @@ +/* + * 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.sca.implementation.script.itests; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; + +/** + * + * @version $Rev$ $Date$ + */ +public abstract class AbstractSCATestCase extends TestCase { + + protected Node node; + protected T service; + + @Override + @SuppressWarnings("unchecked") + protected void setUp() throws Exception { + String contribution = ContributionLocationHelper.getContributionLocation(getClass()); + node = NodeFactory.getInstance().createNode(getCompositeName(), new Contribution("test", contribution)); + node.start(); + service = (T) node.getService(getServiceClass(), "ClientComponent"); + } + + protected abstract Class getServiceClass(); + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + protected String getCompositeName() { + String className = this.getClass().getName(); + return className.substring(0, className.length() - 8).replace('.', '/') + ".composite"; + } + +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java new file mode 100644 index 0000000000..1af3a295a4 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java @@ -0,0 +1,38 @@ +/* + * 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.sca.implementation.script.itests.helloworld; + +import org.apache.tuscany.sca.implementation.script.itests.AbstractSCATestCase; + +/** + * + * @version $Rev$ $Date$ + */ +public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase { + + public void testCalculator() throws Exception { + assertEquals("Hello petra", service.sayHello("petra")); + } + + @Override + protected Class getServiceClass() { + return HelloWorld.class; + } +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java new file mode 100644 index 0000000000..6a4f10dbbb --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java @@ -0,0 +1,29 @@ +/* + * 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.sca.implementation.script.itests.helloworld; + + +/** + * + * @version $Rev$ $Date$ + */ +public class GroovyHelloWorldTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorld.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorld.java new file mode 100644 index 0000000000..f87cf104f3 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorld.java @@ -0,0 +1,30 @@ +/* + * 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.sca.implementation.script.itests.helloworld; + +/** + * + * @version $Rev$ $Date$ + */ +public interface HelloWorld { + + String sayHello(String s); + +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorldProxy.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorldProxy.java new file mode 100644 index 0000000000..cffe65c27a --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorldProxy.java @@ -0,0 +1,37 @@ +/* + * 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.sca.implementation.script.itests.helloworld; + +import org.oasisopen.sca.annotation.Reference; + +/** + * + * @version $Rev$ $Date$ + */ +public class HelloWorldProxy implements HelloWorld { + + @Reference + public HelloWorld delegate; + + public String sayHello(String s) { + return delegate.sayHello(s); + } + +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java new file mode 100644 index 0000000000..ca4bd5ae6a --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java @@ -0,0 +1,29 @@ +/* + * 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.sca.implementation.script.itests.helloworld; + + +/** + * + * @version $Rev$ $Date$ + */ +public class JRubyHelloWorldTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java new file mode 100644 index 0000000000..46ed9abce6 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java @@ -0,0 +1,29 @@ +/* + * 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.sca.implementation.script.itests.helloworld; + + +/** + * + * @version $Rev$ $Date$ + */ +public class JavaScriptHelloWorldTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java new file mode 100644 index 0000000000..d694515829 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java @@ -0,0 +1,29 @@ +/* + * 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.sca.implementation.script.itests.helloworld; + + +/** + * + * @version $Rev$ $Date$ + */ +public class JythonHelloWorldTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/AbstractHelloWorldTestCase.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/AbstractHelloWorldTestCase.java new file mode 100644 index 0000000000..e7375253a3 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/AbstractHelloWorldTestCase.java @@ -0,0 +1,38 @@ +/* + * 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.sca.implementation.script.itests.properties; + +import org.apache.tuscany.sca.implementation.script.itests.AbstractSCATestCase; + +/** + * + * @version $Rev$ $Date$ + */ +public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase { + + public void testCalculator() throws Exception { + // assertEquals("Hello petra from Tuscany", service.sayHello("petra")); + } + + @Override + protected Class getServiceClass() { + return HelloWorld.class; + } +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorldTestCase.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorldTestCase.java new file mode 100644 index 0000000000..f93edc76d1 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorldTestCase.java @@ -0,0 +1,29 @@ +/* + * 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.sca.implementation.script.itests.properties; + + +/** + * + * @version $Rev$ $Date$ + */ +public class GroovyHelloWorldTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorld.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorld.java new file mode 100644 index 0000000000..910d22ec83 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorld.java @@ -0,0 +1,30 @@ +/* + * 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.sca.implementation.script.itests.properties; + +/** + * + * @version $Rev$ $Date$ + */ +public interface HelloWorld { + + String sayHello(String s); + +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorldProxy.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorldProxy.java new file mode 100644 index 0000000000..719212e831 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorldProxy.java @@ -0,0 +1,37 @@ +/* + * 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.sca.implementation.script.itests.properties; + +import org.oasisopen.sca.annotation.Reference; + +/** + * + * @version $Rev$ $Date$ + */ +public class HelloWorldProxy implements HelloWorld { + + @Reference + public HelloWorld delegate; + + public String sayHello(String s) { + return delegate.sayHello(s); + } + +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorldTestCase.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorldTestCase.java new file mode 100644 index 0000000000..60c73359c0 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorldTestCase.java @@ -0,0 +1,28 @@ +/* + * 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.sca.implementation.script.itests.properties; + +/** + * + * @version $Rev$ $Date$ + */ +public class JRubyHelloWorldTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java new file mode 100644 index 0000000000..cde96b4b9b --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java @@ -0,0 +1,29 @@ +/* + * 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.sca.implementation.script.itests.properties; + + +/** + * + * @version $Rev$ $Date$ + */ +public class JavaScriptHelloWorldTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorldTestCase.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorldTestCase.java new file mode 100644 index 0000000000..0e6be74e09 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorldTestCase.java @@ -0,0 +1,29 @@ +/* + * 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.sca.implementation.script.itests.properties; + + +/** + * + * @version $Rev$ $Date$ + */ +public class JythonHelloWorldTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReferenceTestCase.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReferenceTestCase.java new file mode 100644 index 0000000000..6116581356 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReferenceTestCase.java @@ -0,0 +1,29 @@ +/* + * 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.sca.implementation.script.itests.references; + +import org.apache.tuscany.sca.implementation.script.itests.helloworld.AbstractHelloWorldTestCase; + +/** + * + * @version $Rev$ $Date$ + */ +public class GroovyReferenceTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/HelloWorldTarget.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/HelloWorldTarget.java new file mode 100644 index 0000000000..dfcd37c46c --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/HelloWorldTarget.java @@ -0,0 +1,34 @@ +/* + * 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.sca.implementation.script.itests.references; + +import org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorld; + +/** + * + * @version $Rev$ $Date$ + */ +public class HelloWorldTarget implements HelloWorld { + + public String sayHello(String s) { + return "Hello " + s; + } + +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReferenceTestCase.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReferenceTestCase.java new file mode 100644 index 0000000000..83c2e99469 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReferenceTestCase.java @@ -0,0 +1,29 @@ +/* + * 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.sca.implementation.script.itests.references; + +import org.apache.tuscany.sca.implementation.script.itests.helloworld.AbstractHelloWorldTestCase; + +/** + * + * @version $Rev$ $Date$ + */ +public class JRubyReferenceTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReferenceTestCase.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReferenceTestCase.java new file mode 100644 index 0000000000..392e16411c --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReferenceTestCase.java @@ -0,0 +1,29 @@ +/* + * 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.sca.implementation.script.itests.references; + +import org.apache.tuscany.sca.implementation.script.itests.helloworld.AbstractHelloWorldTestCase; + +/** + * + * @version $Rev$ $Date$ + */ +public class JavaScriptReferenceTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JythonReferenceTestCase.java b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JythonReferenceTestCase.java new file mode 100644 index 0000000000..8866ae6b70 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JythonReferenceTestCase.java @@ -0,0 +1,29 @@ +/* + * 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.sca.implementation.script.itests.references; + +import org.apache.tuscany.sca.implementation.script.itests.helloworld.AbstractHelloWorldTestCase; + +/** + * + * @version $Rev$ $Date$ + */ +public class JythonReferenceTestCase extends AbstractHelloWorldTestCase { + // super class does it all getting composite based on this class name +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorld.composite b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorld.composite new file mode 100644 index 0000000000..056fb5b4ce --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorld.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorld.composite b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorld.composite new file mode 100644 index 0000000000..05dd2bab22 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorld.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite new file mode 100644 index 0000000000..fc9c7d1055 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorld.composite b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorld.composite new file mode 100644 index 0000000000..3cc28fc531 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorld.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.componentType b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.componentType new file mode 100644 index 0000000000..f190d5ef35 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.componentType @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy new file mode 100644 index 0000000000..9f89bd373e --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy @@ -0,0 +1,22 @@ +/* + * 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. + */ + +def sayHello(s) { + return "Hello " + s +} \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js new file mode 100644 index 0000000000..eac2ab283f --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js @@ -0,0 +1,23 @@ +/* + * 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. + */ + +function sayHello(s) { + + return "Hello " + s; +} \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py new file mode 100644 index 0000000000..f5dd0f8fcf --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py @@ -0,0 +1,20 @@ +# 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. +# + +def sayHello(s): + return 'Hello ' + s \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb new file mode 100644 index 0000000000..cd2d3bcaea --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb @@ -0,0 +1,21 @@ +# 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. +# + +def sayHello(s) + return "Hello " + s +end \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorld.composite b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorld.composite new file mode 100644 index 0000000000..dd8279049d --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorld.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorld.composite b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorld.composite new file mode 100644 index 0000000000..40e8d18a31 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorld.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorld.composite b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorld.composite new file mode 100644 index 0000000000..b258d69229 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorld.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorld.composite b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorld.composite new file mode 100644 index 0000000000..a3e15e53b0 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorld.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.componentType b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.componentType new file mode 100644 index 0000000000..4cf7172ebc --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.componentType @@ -0,0 +1,32 @@ + + + + + + + + + Tuscany + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy new file mode 100644 index 0000000000..a7eb446d37 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy @@ -0,0 +1,22 @@ +/* + * 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. + */ + +def sayHello(s) { + return "Hello " + s + " from " + greeter +} \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js new file mode 100644 index 0000000000..64df3ebbef --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js @@ -0,0 +1,23 @@ +/* + * 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. + */ + +function sayHello(s) { + + return "Hello " + s + " from " + greeter; +} \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py new file mode 100644 index 0000000000..868cfa9eeb --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py @@ -0,0 +1,20 @@ +# 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. +# + +def sayHello(s): + return 'Hello ' + s + ' from ' + greeter \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb new file mode 100644 index 0000000000..2844f8b8d9 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb @@ -0,0 +1,21 @@ +# 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. +# + +def sayHello(s) + return "Hello " + s + " from " + $greeter +end \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReference.composite b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReference.composite new file mode 100644 index 0000000000..4cfcec2f4e --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReference.composite @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReference.composite b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReference.composite new file mode 100644 index 0000000000..710772c394 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReference.composite @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReference.composite b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReference.composite new file mode 100644 index 0000000000..d741cc1c89 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReference.composite @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JythonReference.composite b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JythonReference.composite new file mode 100644 index 0000000000..23f78ec342 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JythonReference.composite @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.componentType b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.componentType new file mode 100644 index 0000000000..347e9b1c40 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.componentType @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy new file mode 100644 index 0000000000..5d2216d583 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy @@ -0,0 +1,22 @@ +/* + * 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. + */ + +def sayHello(s) { + return ref.sayHello(s) +} diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.js b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.js new file mode 100644 index 0000000000..ad0a932d26 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.js @@ -0,0 +1,22 @@ +/* + * 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. + */ + +function sayHello(s) { + return ref.sayHello(s); +} \ No newline at end of file diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.py b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.py new file mode 100644 index 0000000000..aee8bf991d --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.py @@ -0,0 +1,20 @@ +# 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. +# + +def sayHello(s): + return ref.sayHello(s) diff --git a/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.rb b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.rb new file mode 100644 index 0000000000..87f0f56082 --- /dev/null +++ b/sca-java-2.x/tags/2.0-RC1/modules/implementation-script-runtime/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.rb @@ -0,0 +1,21 @@ +# 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. +# + +def sayHello(s) + return $ref.sayHello(s) +end \ No newline at end of file -- cgit v1.2.3