You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2007/02/24 15:38:14 UTC
svn commit: r511279 - in
/incubator/tuscany/branches/sca-java-integration/sca/extensions/script:
container.bsf/src/main/java/org/apache/tuscany/container/script/
itests/src/main/resources/META-INF/sca/
itests/src/main/resources/references/ itests/src/t...
Author: antelder
Date: Sat Feb 24 06:38:13 2007
New Revision: 511279
URL: http://svn.apache.org/viewvc?view=rev&rev=511279
Log:
Get references in script components working and testcases for ruby python and javascript
Added:
incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/references.composite
incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/
incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType (with props)
incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.js (with props)
incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.py (with props)
incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.rb
incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/ReferencesTestCase.java (with props)
Modified:
incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java
Modified: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java?view=diff&rev=511279&r1=511278&r2=511279
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/container.bsf/src/main/java/org/apache/tuscany/container/script/ScriptInstanceFactory.java Sat Feb 24 06:38:13 2007
@@ -71,14 +71,9 @@
// TODO: hack to get Ruby working with the standalone launcher
Thread.currentThread().setContextClassLoader(BSFManager.class.getClassLoader());
-// // register any context objects (SCA properties and references)
-// for (String beanName : context.keySet()) {
-// bsfManager.registerBean(beanName, context.get(beanName));
-// }
-
// register any context objects (SCA properties and references)
for (Map.Entry<String, ObjectFactory> entry : contextObjects.entrySet()) {
- bsfManager.registerBean(entry.getKey(), entry.getValue().getInstance());
+ bsfManager.declareBean(entry.getKey(), entry.getValue().getInstance(), Object.class);
}
String scriptLanguage = BSFManager.getLangFromFilename(resourceName);
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/references.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/references.composite?view=auto&rev=511279
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/references.composite (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/META-INF/sca/references.composite Sat Feb 24 06:38:13 2007
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+
+ name="ScriptItests">
+
+ <component name="HelloWorldJSProxyComponent">
+ <implementation.script script="references/helloworldProxy.js"/>
+ <reference name="ref">HelloWorldJSComponent</reference>
+ </component>
+
+ <component name="HelloWorldRubyProxyComponent">
+ <implementation.script script="references/helloworldProxy.rb"/>
+ <reference name="ref">HelloWorldJSComponent</reference>
+ </component>
+
+ <component name="HelloWorldPythonProxyComponent">
+ <implementation.script script="references/helloworldProxy.py"/>
+ <reference name="ref">HelloWorldJSComponent</reference>
+ </component>
+
+ <component name="HelloWorldJSComponent">
+ <implementation.script script="helloworld/helloworld.js"/>
+ </component>
+
+</composite>
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType?view=auto&rev=511279
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType Sat Feb 24 06:38:13 2007
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ASCII"?>
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+
+ <service name="HelloWorldService">
+ <interface.java class="helloworld.HelloWorldService" />
+ </service>
+
+ <reference name="ref">
+ <interface.java class="helloworld.HelloWorldService" />
+ </reference>
+
+</componentType>
+
\ No newline at end of file
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.componentType
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.js
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.js?view=auto&rev=511279
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.js (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.js Sat Feb 24 06:38:13 2007
@@ -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 getGreetings(s) {
+ return "jsproxy" + ref.getGreetings(s);
+}
\ No newline at end of file
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.py
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.py?view=auto&rev=511279
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.py (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.py Sat Feb 24 06:38:13 2007
@@ -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.
+
+def getGreetings(s):
+ return "pyproxy" + ref.getGreetings(s)
\ No newline at end of file
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.py
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.rb
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.rb?view=auto&rev=511279
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.rb (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/main/resources/references/helloworldProxy.rb Sat Feb 24 06:38:13 2007
@@ -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 getGreetings(s)
+ return "rbproxy" + $ref.getGreetings(s)
+end
+
Added: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/ReferencesTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/ReferencesTestCase.java?view=auto&rev=511279
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/ReferencesTestCase.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/ReferencesTestCase.java Sat Feb 24 06:38:13 2007
@@ -0,0 +1,68 @@
+/*
+ * 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 helloworld;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.test.SCATestCase;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * Test case for using references in script components
+ */
+public class ReferencesTestCase extends SCATestCase {
+
+ private CompositeContext compositeContext;
+
+ public void testHelloWorldJavaScript() throws Exception {
+ HelloWorldService helloWorldService =
+ compositeContext.locateService(HelloWorldService.class, "HelloWorldJSProxyComponent");
+ String msg = helloWorldService.getGreetings("Petra");
+ Assert.assertEquals("jsproxyjsHello Petra", msg);
+ }
+
+ public void testHelloWorldPython() throws Exception {
+ HelloWorldService helloWorldService =
+ compositeContext.locateService(HelloWorldService.class, "HelloWorldPythonProxyComponent");
+ String msg = helloWorldService.getGreetings("Petra");
+ Assert.assertEquals("pyproxyjsHello Petra", msg);
+ }
+
+ public void testHelloWorldRuby() throws Exception {
+ HelloWorldService helloWorldService =
+ compositeContext.locateService(HelloWorldService.class, "HelloWorldRubyProxyComponent");
+ String msg = helloWorldService.getGreetings("Petra");
+ Assert.assertEquals("rbproxyjsHello Petra", msg);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ setApplicationSCDL(getClass().getResource("/META-INF/sca/references.composite"));
+ super.setUp();
+ this.compositeContext = CurrentCompositeContext.getContext();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/ReferencesTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/extensions/script/itests/src/test/java/helloworld/ReferencesTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org