You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2006/02/14 22:11:27 UTC
svn commit: r377833 [3/4] - in /incubator/tuscany/java:
samples/helloworld/helloworld/ samples/helloworld/helloworldmc/ sca/
sca/container.java/src/main/java/org/apache/tuscany/container/java/injection/
sca/container.js/ sca/container.js/src/ sca/conta...
Added: incubator/tuscany/java/sca/container.js/src/main/resources/model/sca-core.xsd
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/main/resources/model/sca-core.xsd?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/main/resources/model/sca-core.xsd (added)
+++ incubator/tuscany/java/sca/container.js/src/main/resources/model/sca-core.xsd Tue Feb 14 13:11:19 2006
@@ -0,0 +1,230 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed 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.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"
+ elementFormDefault="qualified">
+
+ <element name="componentType" type="sca:ComponentType"/>
+ <complexType name="ComponentType">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="service" type="sca:Service"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="reference" type="sca:Reference"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="property" type="sca:Property"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Service">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="interface" type="sca:Interface"/>
+ <complexType name="Interface"/>
+
+ <complexType name="Reference">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="multiplicity" type="sca:Multiplicity" use="optional" default="1..1"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Property" abstract="true">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="type" type="QName" use="required"/>
+ <attribute name="many" type="boolean" default="false" use="optional"/>
+ <attribute name="required" type="boolean" default="false" use="optional"/>
+ <attribute name="default" type="string" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <element name="moduleFragment" type="sca:ModuleFragment"/>
+ <complexType name="ModuleFragment">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="sca:EntryPoint"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="component" type="sca:Component"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="sca:ExternalService"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="wire" type="sca:ModuleWire"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="module" type="sca:Module"/>
+ <complexType name="Module">
+ <complexContent>
+ <extension base="sca:ModuleFragment"/>
+ </complexContent>
+ </complexType>
+
+ <complexType name="EntryPoint">
+ <sequence>
+ <element minOccurs="0" maxOccurs="1" ref="sca:interface"/>
+ <element minOccurs="1" maxOccurs="unbounded" ref="sca:binding"/>
+ <element minOccurs="1" maxOccurs="unbounded" name="reference" type="anyURI"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="multiplicity" type="sca:Multiplicity" use="optional" default="1..1"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+ <!-- a multiplicity 1..1 or 0..n sample
+ <reference>StockQuoteComponent</reference> - type must be URI
+ a multiplicity 1..n or 0..n sample
+ <reference>StockQuoteComponent1</reference> - type must be URI
+ <reference>StockQuoteComponent2</reference>
+ -->
+
+ <element name="binding" type="sca:Binding"/>
+ <complexType name="Binding">
+ <attribute name="uri" type="anyURI" use="optional"/>
+ </complexType>
+
+ <complexType name="Component">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:implementation"/>
+ <element minOccurs="0" maxOccurs="1" name="properties" type="sca:PropertyValues"/>
+ <element minOccurs="0" maxOccurs="1" name="references" type="sca:ReferenceValues"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+ <!-- a multiplicity 1..1 or 0..1 sample
+ <references>
+ <v:stockQuote>StockQuoteComponent</v:stockquote> - type must be URI
+ </references>
+ a multiplicity 1..n or 0..n sample
+ <references>
+ <v:stockQuote>StockQuoteComponent1</v:stockQuote> - type must be URI
+ <v:stockQuote>StockQuoteComponent2</v:stockQuote>
+ </references>
+ -->
+
+ <element name="implementation" type="sca:Implementation"/>
+ <complexType name="Implementation"/>
+
+ <complexType name="PropertyValues">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ReferenceValues">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <complexType name="ExternalService">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <element minOccurs="0" maxOccurs="unbounded" ref="sca:binding"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="overridable" type="sca:OverrideOptions" default="may" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <complexType name="ModuleWire">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:source.uri"/>
+ <element minOccurs="1" maxOccurs="1" ref="sca:target.uri"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="source" type="anyType"/>
+ <element name="target" type="anyType"/>
+
+ <element name="source.uri" type="anyURI" substitutionGroup="sca:source"/>
+ <element name="target.uri" type="anyURI" substitutionGroup="sca:target"/>
+
+ <element name="subsystem" type="sca:Subsystem"/>
+ <complexType name="Subsystem">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="sca:EntryPoint"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="moduleComponent" type="sca:ModuleComponent"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="sca:ExternalService"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="wire" type="sca:SystemWire"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="uri" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ModuleComponent">
+ <sequence>
+ <element minOccurs="0" maxOccurs="1" name="properties" type="sca:PropertyValues"/>
+ <element minOccurs="0" maxOccurs="1" name="references" type="sca:ReferenceValues"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="module" type="NCName" use="required"/>
+ <attribute name="uri" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="SystemWire">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:source"/>
+ <element minOccurs="1" maxOccurs="1" ref="sca:target"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="source.epr" type="anyType" substitutionGroup="sca:source"/>
+ <element name="target.epr" type="anyType" substitutionGroup="sca:target"/>
+
+ <simpleType name="Multiplicity">
+ <restriction base="string">
+ <enumeration value="0..1"/>
+ <enumeration value="1..1"/>
+ <enumeration value="0..n"/>
+ <enumeration value="1..n"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="OverrideOptions">
+ <restriction base="string">
+ <enumeration value="no"/>
+ <enumeration value="may"/>
+ <enumeration value="must"/>
+ </restriction>
+ </simpleType>
+
+</schema>
\ No newline at end of file
Propchange: incubator/tuscany/java/sca/container.js/src/main/resources/model/sca-core.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/main/resources/model/sca-core.xsd
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/main/resources/model/sca-implementation-js.xsd
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/main/resources/model/sca-implementation-js.xsd?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/main/resources/model/sca-implementation-js.xsd (added)
+++ incubator/tuscany/java/sca/container.js/src/main/resources/model/sca-implementation-js.xsd Tue Feb 14 13:11:19 2006
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed 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.
+ -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:codegen="http://www.eclipse.org/emf/2002/Ecore" xmlns:js="http://org.apache.tuscany/xmlns/js/0.9" xmlns:sca="http://www.osoa.org/xmlns/sca/0.9" codegen:nsPrefix="js" codegen:package="org.apache.tuscany.container.js.assembly" elementFormDefault="qualified" targetNamespace="http://org.apache.tuscany/xmlns/js/0.9">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/0.9" schemaLocation="sca-core.xsd"/>
+
+ <element name="implementation.js" substitutionGroup="sca:implementation" type="js:JavaScriptImplementation"/>
+
+ <complexType name="JavaScriptImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any maxOccurs="unbounded" minOccurs="0" namespace="##other" processContents="lax"/>
+ </sequence>
+ <attribute name="scriptFile" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </extension>
+ </complexContent>
+ </complexType>
+
+</schema>
Propchange: incubator/tuscany/java/sca/container.js/src/main/resources/model/sca-implementation-js.xsd
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/main/resources/model/sca-implementation-js.xsd
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/main/resources/org/apache/tuscany/container/js/handler/JavaScriptComponentConfigurationHandler.componentType
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/main/resources/org/apache/tuscany/container/js/handler/JavaScriptComponentConfigurationHandler.componentType?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/main/resources/org/apache/tuscany/container/js/handler/JavaScriptComponentConfigurationHandler.componentType (added)
+++ incubator/tuscany/java/sca/container.js/src/main/resources/org/apache/tuscany/container/js/handler/JavaScriptComponentConfigurationHandler.componentType Tue Feb 14 13:11:19 2006
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed 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.
+ -->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9">
+
+ <service name="handler">
+ <interface.js interface="org.apache.tuscany.core.message.handler.MessageHandler"/>
+ </service>
+
+</componentType>
Added: incubator/tuscany/java/sca/container.js/src/main/resources/sca.fragment
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/main/resources/sca.fragment?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/main/resources/sca.fragment (added)
+++ incubator/tuscany/java/sca/container.js/src/main/resources/sca.fragment Tue Feb 14 13:11:19 2006
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed 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.
+ -->
+<moduleFragment xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+ name="org.apache.tuscany.container.js">
+
+ <component name="org.apache.tuscany.container.js.handler.JavaScriptComponentConfigurationHandler">
+ <implementation.system class="org.apache.tuscany.container.js.handler.JavaScriptComponentConfigurationHandler"/>
+ </component>
+
+ <wire>
+ <source.uri>org.apache.tuscany.core.pipeline.ImplementationExtensionPoint/extensions</source.uri>
+ <target.uri>org.apache.tuscany.container.js.handler.JavaScriptComponentConfigurationHandler</target.uri>
+ </wire>
+
+</moduleFragment>
Added: incubator/tuscany/java/sca/container.js/src/main/resources/tuscany-model.config
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/main/resources/tuscany-model.config?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/main/resources/tuscany-model.config (added)
+++ incubator/tuscany/java/sca/container.js/src/main/resources/tuscany-model.config Tue Feb 14 13:11:19 2006
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed 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.
+ -->
+<config:modelConfiguration xmlns:config="http://org.apache.tuscany/xmlns/model/config/0.9">
+
+ <generatedPackage packageClassName="org.apache.tuscany.container.js.assembly.sdo.JavaScriptAssemblyPackage" uri="http://org.apache.tuscany/xmlns/js/0.9" preLoad="true"/>
+
+</config:modelConfiguration>
Added: incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorld.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorld.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorld.java (added)
+++ incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorld.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,7 @@
+package org.apache.tuscany.container.js.sample.helloworld;
+
+public interface HelloWorld {
+
+ public String getGreeting(String s);
+
+}
Propchange: incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorld.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorld.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorldImpl.componentType
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorldImpl.componentType?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorldImpl.componentType (added)
+++ incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorldImpl.componentType Tue Feb 14 13:11:19 2006
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ASCII"?>
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldService">
+ <interface.java interface="org.apache.tuscany.container.js.sample.helloworld.HelloWorld"/>
+ </service>
+
+</componentType>
\ No newline at end of file
Added: incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorldImpl.js
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorldImpl.js?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorldImpl.js (added)
+++ incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/HelloWorldImpl.js Tue Feb 14 13:11:19 2006
@@ -0,0 +1,4 @@
+
+function getGreeting(s) {
+ return "jsHello " + s;
+}
\ No newline at end of file
Added: incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/Main.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/Main.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/Main.java (added)
+++ incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/Main.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,25 @@
+package org.apache.tuscany.container.js.sample.helloworld;
+
+import org.apache.tuscany.core.client.TuscanyRuntime;
+import org.osoa.sca.CurrentModuleContext;
+import org.osoa.sca.ModuleContext;
+
+public class Main {
+
+ public static final void main(String[] args) throws Exception {
+
+ TuscanyRuntime tuscany = new TuscanyRuntime("jsHello", null);
+ tuscany.start();
+ ModuleContext moduleContext = CurrentModuleContext.getContext();
+
+ HelloWorld s =
+ (HelloWorld) moduleContext.locateService("HelloWorldJSComponent");
+
+ String value = s.getGreeting("Petra");
+
+ System.out.println(value);
+
+ tuscany.stop();
+ }
+
+}
Propchange: incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/Main.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/samples/java/org/apache/tuscany/container/js/sample/helloworld/Main.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/samples/java/sca.module
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/samples/java/sca.module?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/samples/java/sca.module (added)
+++ incubator/tuscany/java/sca/container.js/src/samples/java/sca.module Tue Feb 14 13:11:19 2006
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 BEA Sytems Inc.
+ Copyright (c) 2005 International Business Machines
+
+ Licensed 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.
+ -->
+<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
+ name="sampleHelloworld">
+
+ <component name="HelloWorldJSComponent">
+ <implementation.js scriptFile="org/apache/tuscany/container/js/sample/helloworld/HelloWorldImpl.js"/>
+ </component>
+
+</module>
Added: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/impl/JavaScriptImplementationTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/impl/JavaScriptImplementationTestCase.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/impl/JavaScriptImplementationTestCase.java (added)
+++ incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/impl/JavaScriptImplementationTestCase.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,78 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.js.assembly.impl;
+
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.model.assembly.ComponentType;
+import org.apache.tuscany.model.assembly.Property;
+import org.apache.tuscany.model.assembly.Service;
+import org.apache.tuscany.model.assembly.impl.AssemblyModelContextImpl;
+import org.apache.tuscany.model.assembly.sdo.AssemblyPackage;
+
+/**
+ * @version $Rev: 368822 $ $Date: 2006-01-13 18:54:38 +0000 (Fri, 13 Jan 2006) $
+ */
+public class JavaScriptImplementationTestCase extends TestCase {
+
+ private JavaScriptImplementationImpl impl = (JavaScriptImplementationImpl) new JavaScriptAssemblyFactoryImpl().createJavaScriptImplementation();
+
+ public void testNoImplementationClass() {
+ impl.setScriptFile("no.such.script.js");
+ try {
+ impl.initialize(new AssemblyModelContextImpl());
+ impl.getComponentType();
+ fail("Expected IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ // ok
+ }
+ }
+
+ public void testHelloWorldWithSidefile() {
+ impl.setScriptFile("org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.js");
+ impl.initialize(new AssemblyModelContextImpl());
+ ComponentType type = impl.getComponentType();
+ Assert.assertNotNull(type);
+ List<Property> props = type.getProperties();
+ Assert.assertEquals(1, props.size());
+ Assert.assertTrue(props.get(0).getName().equals("text"));
+
+ Assert.assertTrue(type.getReferences().isEmpty());
+
+ List<Service> services = type.getServices();
+ Assert.assertEquals(1, services.size());
+ Assert.assertTrue(services.get(0).getName().equals("HelloWorldService"));
+ }
+
+ static {
+ // bootstrap this somehow
+ AssemblyPackage.eINSTANCE.getClass();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ Thread.currentThread().setContextClassLoader(JavaScriptImplementationTestCase.class.getClassLoader());
+ }
+
+ protected void tearDown() throws Exception {
+ Thread.currentThread().setContextClassLoader(null);
+ super.tearDown();
+ }
+}
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/impl/JavaScriptImplementationTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/impl/JavaScriptImplementationTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/mock/HelloWorldService.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/mock/HelloWorldService.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/mock/HelloWorldService.java (added)
+++ incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/mock/HelloWorldService.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,24 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.js.assembly.mock;
+
+/**
+ * @version $Rev: 368822 $ $Date: 2006-01-13 18:54:38 +0000 (Fri, 13 Jan 2006) $
+ */
+public interface HelloWorldService {
+ String hello(String name);
+}
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/mock/HelloWorldService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/mock/HelloWorldService.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/JavaScriptAssemblyLoaderTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/JavaScriptAssemblyLoaderTestCase.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/JavaScriptAssemblyLoaderTestCase.java (added)
+++ incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/JavaScriptAssemblyLoaderTestCase.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,84 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.js.assembly.tests;
+
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.model.assembly.AssemblyLoader;
+import org.apache.tuscany.model.assembly.AssemblyModelContext;
+import org.apache.tuscany.model.assembly.Component;
+import org.apache.tuscany.model.assembly.ConfiguredService;
+import org.apache.tuscany.model.assembly.EntryPoint;
+import org.apache.tuscany.model.assembly.Module;
+import org.apache.tuscany.model.assembly.impl.AssemblyModelContextImpl;
+import org.apache.tuscany.model.types.InterfaceType;
+import org.apache.tuscany.model.types.OperationType;
+
+/**
+ */
+public class JavaScriptAssemblyLoaderTestCase extends TestCase {
+
+ private AssemblyModelContext modelContext;
+
+ /**
+ *
+ */
+ public JavaScriptAssemblyLoaderTestCase() {
+ super();
+ }
+
+ public void testLoader() {
+/*
+
+ AssemblyLoader loader = modelContext.getAssemblyLoader();
+ Module module = loader.getModule(getClass().getResource("sca.module").toString());
+ module.initialize(modelContext);
+
+ Assert.assertTrue(module.getName().equals("tuscany.container.js.assembly.tests.bigbank.account"));
+
+ Component component = module.getComponent("AccountServiceComponent");
+ Assert.assertTrue(component != null);
+
+ EntryPoint entryPoint = module.getEntryPoint("AccountService");
+ Assert.assertTrue(entryPoint != null);
+
+ Object value = component.getConfiguredProperty("currency").getValue();
+ Assert.assertTrue(value.equals("EURO"));
+
+ ConfiguredService configuredService = component.getConfiguredReference("accountDataService").getConfiguredServices().get(0);
+ Assert.assertTrue(configuredService.getPart().getName().equals("AccountDataServiceComponent"));
+
+ InterfaceType interfaceType = configuredService.getService().getInterfaceContract().getInterfaceType();
+ OperationType operationType = interfaceType.getOperationType("getCheckingAccount");
+ Type type = operationType.getInputType();
+ Property arg = (Property) type.getProperties().get(0);
+ Assert.assertTrue(arg.getType().getInstanceClass() == String.class);
+*/
+
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+ modelContext = new AssemblyModelContextImpl();
+ }
+
+}
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/JavaScriptAssemblyLoaderTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/JavaScriptAssemblyLoaderTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountReport.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountReport.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountReport.java (added)
+++ incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountReport.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,32 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.account;
+
+import java.util.List;
+
+/**
+ * @model
+ */
+
+public interface AccountReport {
+
+ /**
+ * @model type="services.account.AccountSummary"
+ */
+
+ List getAccountSummaries();
+}
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountReport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountReport.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountService.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountService.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountService.java (added)
+++ incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountService.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,25 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.account;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface AccountService {
+
+ public AccountReport getAccountReport(String customerID);
+}
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountService.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountSummary.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountSummary.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountSummary.java (added)
+++ incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountSummary.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,46 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.account;
+
+/**
+ * @model
+ */
+
+public interface AccountSummary {
+
+ /**
+ * @model
+ */
+ String getAccountNumber();
+
+ void setAccountNumber(String accountNumber);
+
+ /**
+ * @model
+ */
+ String getAccountType();
+
+ void setAccountType(String accountType);
+
+ /**
+ * @model
+ */
+ float getBalance();
+
+ void setBalance(float balance);
+}
+
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountSummary.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountSummary.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java (added)
+++ incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,26 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.accountdata;
+
+public interface AccountDataService {
+
+ CheckingAccount getCheckingAccount(String customerID);
+
+ SavingsAccount getSavingsAccount(String customerID);
+
+ StockAccount getStockAccount(String customerID);
+}
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataService.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java (added)
+++ incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,48 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.accountdata;
+
+public class AccountDataServiceImpl implements AccountDataService {
+
+ public CheckingAccount getCheckingAccount(String customerID) {
+
+ CheckingAccount checkingAccount = new CheckingAccount();
+ checkingAccount.setAccountNumber(customerID + "_" + "CHA12345");
+ checkingAccount.setBalance(1500.0f);
+
+ return checkingAccount;
+ }
+
+ public SavingsAccount getSavingsAccount(String customerID) {
+
+ SavingsAccount savingsAccount = new SavingsAccount();
+ savingsAccount.setAccountNumber(customerID + "_" + "SAA12345");
+ savingsAccount.setBalance(1500.0f);
+
+ return savingsAccount;
+ }
+
+ public StockAccount getStockAccount(String customerID) {
+
+ StockAccount stockAccount = new StockAccount();
+ stockAccount.setAccountNumber(customerID + "_" + "STA12345");
+ stockAccount.setSymbol("IBM");
+ stockAccount.setQuantity(100);
+
+ return stockAccount;
+ }
+}
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/AccountDataServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java (added)
+++ incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,39 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.accountdata;
+
+public class CheckingAccount {
+
+ private String accountNumber;
+ private float balance;
+
+ public String getAccountNumber() {
+ return accountNumber;
+ }
+
+ public void setAccountNumber(String accountNumber) {
+ this.accountNumber = accountNumber;
+ }
+
+ public float getBalance() {
+ return balance;
+ }
+
+ public void setBalance(float balance) {
+ this.balance = balance;
+ }
+}
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/CheckingAccount.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java (added)
+++ incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,39 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.accountdata;
+
+public class SavingsAccount {
+
+ private String accountNumber;
+ private float balance;
+
+ public String getAccountNumber() {
+ return accountNumber;
+ }
+
+ public void setAccountNumber(String accountNumber) {
+ this.accountNumber = accountNumber;
+ }
+
+ public float getBalance() {
+ return balance;
+ }
+
+ public void setBalance(float balance) {
+ this.balance = balance;
+ }
+}
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/SavingsAccount.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/StockAccount.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/StockAccount.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/StockAccount.java (added)
+++ incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/StockAccount.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,48 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.accountdata;
+
+public class StockAccount {
+
+ private String accountNumber;
+ private String symbol;
+ private int quantity;
+
+ public String getAccountNumber() {
+ return accountNumber;
+ }
+
+ public void setAccountNumber(String accountNumber) {
+ this.accountNumber = accountNumber;
+ }
+
+ public int getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+}
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/StockAccount.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/accountdata/StockAccount.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java (added)
+++ incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,24 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.stockquote;
+
+public interface StockQuoteService {
+
+ public float getQuote(String symbol);
+}
+
+
\ No newline at end of file
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteService.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java (added)
+++ incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,28 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.stockquote;
+
+/* Dummy'd up StockQuoteService, override webservice for now */
+
+public class StockQuoteServiceImpl implements StockQuoteService {
+
+ public float getQuote(String symbol) {
+ // Just hardcode for now
+ return 83.00f;
+ }
+
+}
\ No newline at end of file
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteServiceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl (added)
+++ incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/stockquote/StockQuoteWebService.wsdl Tue Feb 14 13:11:19 2006
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed 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.
+ -->
+<wsdl:definitions targetNamespace="http://webservice.stockquote" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://webservice.stockquote" xmlns:intf="http://webservice.stockquote" xmlns:tns1="http://stockquote" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="">
+ <!--WSDL created by Apache Axis version: 1.2.1
+Built on Jun 14, 2005 (09:15:57 EDT)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://stockquote" xmlns="http://www.w3.org/2001/XMLSchema">
+ <complexType name="GetQuoteRequest">
+ <sequence>
+ <element name="symbol" nillable="true" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ <complexType name="GetQuoteResponse">
+ <sequence>
+ <element name="price" type="xsd:float"/>
+ </sequence>
+ </complexType>
+ </schema>
+ <schema elementFormDefault="qualified" targetNamespace="http://webservice.stockquote" xmlns="http://www.w3.org/2001/XMLSchema">
+ <import namespace="http://stockquote"/>
+ <element name="request" type="tns1:GetQuoteRequest"/>
+ <element name="getQuoteReturn" type="tns1:GetQuoteResponse"/>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getQuoteResponse">
+
+ <wsdl:part element="impl:getQuoteReturn" name="getQuoteReturn"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getQuoteRequest">
+
+ <wsdl:part element="impl:request" name="request"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="StockQuoteWebService">
+
+ <wsdl:operation name="getQuote" parameterOrder="request">
+
+ <wsdl:input message="impl:getQuoteRequest" name="getQuoteRequest"/>
+
+ <wsdl:output message="impl:getQuoteResponse" name="getQuoteResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="StockQuoteWebServiceSoapBinding" type="impl:StockQuoteWebService">
+
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="getQuote">
+
+ <wsdlsoap:operation soapAction=""/>
+
+ <wsdl:input name="getQuoteRequest">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:input>
+
+ <wsdl:output name="getQuoteResponse">
+
+ <wsdlsoap:body use="literal"/>
+
+ </wsdl:output>
+
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:service name="StockQuoteWebServiceService">
+
+ <wsdl:port binding="impl:StockQuoteWebServiceSoapBinding" name="StockQuoteWebService">
+
+ <wsdlsoap:address location="http://localhost:8123/StockQuoteWebService/services/StockQuoteWebService"/>
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
Added: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/config/EMFConfigurationLoaderTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/config/EMFConfigurationLoaderTestCase.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/config/EMFConfigurationLoaderTestCase.java (added)
+++ incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/config/EMFConfigurationLoaderTestCase.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,64 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.js.config;
+
+import java.net.URL;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.container.js.assembly.sdo.impl.JavaScriptImplementationImpl;
+import org.apache.tuscany.core.config.ConfigurationException;
+import org.apache.tuscany.core.config.impl.EMFConfigurationLoader;
+import org.apache.tuscany.model.assembly.Component;
+import org.apache.tuscany.model.assembly.ComponentImplementation;
+import org.apache.tuscany.model.assembly.Module;
+import org.apache.tuscany.model.assembly.ModuleComponent;
+import org.apache.tuscany.model.assembly.impl.AssemblyModelContextImpl;
+
+/**
+ * @version $Rev: 368822 $ $Date: 2006-01-13 18:54:38 +0000 (Fri, 13 Jan 2006) $
+ */
+public class EMFConfigurationLoaderTestCase extends TestCase {
+ private EMFConfigurationLoader loader;
+
+ public void testFoo() throws ConfigurationException {
+ URL xml = EMFConfigurationLoaderTestCase.class.getResource("EMFLoaderTest1.module");
+ ModuleComponent moduleComponent = loader.loadModule("test", "test", xml);
+ Assert.assertEquals("test", moduleComponent.getName());
+ Module module = moduleComponent.getModuleImplementation();
+ Assert.assertEquals("EMFLoaderTest1", module.getName());
+ List<Component> components = module.getComponents();
+ Assert.assertEquals(1, components.size());
+ Component component = components.get(0);
+ Assert.assertEquals("HelloWorldServiceComponent", component.getName());
+
+// todo this should work
+// component = module.getComponent("HelloWorldServiceComponent");
+// Assert.assertEquals("HelloWorldServiceComponent", component.getName());
+
+ ComponentImplementation implementation = component.getComponentImplementation();
+ Assert.assertTrue(implementation instanceof JavaScriptImplementationImpl);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+ loader = new EMFConfigurationLoader(new AssemblyModelContextImpl());
+ }
+}
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/config/EMFConfigurationLoaderTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/config/EMFConfigurationLoaderTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/rhino/RhinoInvokerTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/rhino/RhinoInvokerTestCase.java?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/rhino/RhinoInvokerTestCase.java (added)
+++ incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/rhino/RhinoInvokerTestCase.java Tue Feb 14 13:11:19 2006
@@ -0,0 +1,184 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.container.js.rhino;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.mozilla.javascript.EcmaError;
+
+/**
+ * Tests for the RhinoInvoker
+ */
+public class RhinoInvokerTestCase extends TestCase {
+
+ private static final String scriptName = "RhinoInvokerTestCase.js";
+ private String script;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.script = readResource(scriptName);
+ }
+
+ public void testSimpleInvocation() {
+ RhinoInvoker ri = new RhinoInvoker(scriptName, script);
+ Object x = ri.invoke("echo", "petra", null);
+ assertEquals("petra", x);
+ }
+
+ public void testCopy() {
+ RhinoInvoker ri = new RhinoInvoker(scriptName, script);
+ Object x = ri.invoke("echo", "petra", null);
+ assertEquals("petra", x);
+
+ ri = ri.copy();
+ x = ri.invoke("echo", "sue", null);
+ assertEquals("sue", x);
+
+ }
+
+ public void testContexts1() {
+ RhinoInvoker ri = new RhinoInvoker(scriptName, script);
+ Map<String, Object> contexts = new HashMap<String, Object>();
+ contexts.put("a", "petra");
+ Object x = ri.invoke("getA", null, contexts);
+ assertEquals("petra", x);
+ }
+
+ /**
+ * Tests context not accessable across invocations
+ */
+ public void testContexts2() {
+ RhinoInvoker ri = new RhinoInvoker(scriptName, script);
+ Map<String, Object> contexts = new HashMap<String, Object>();
+ contexts.put("a", "petra");
+ Object x = ri.invoke("getA", null, contexts);
+ assertEquals("petra", x);
+
+ try {
+ x = ri.invoke("getA", null, null);
+ assertTrue("expected ReferenceError", false);
+ } catch (EcmaError e) {
+ assertEquals("ReferenceError", e.getName());
+ }
+ }
+
+ /**
+ * Tests shared scope is accessable across invocations
+ */
+ public void testScopes1() {
+ RhinoInvoker ri = new RhinoInvoker(scriptName, script);
+ ri.invoke("setGlobalVarY", "petra", null);
+
+ Object x = ri.invoke("getGlobalVarY", null, null);
+ assertEquals("petra", x);
+ }
+
+ /**
+ * Tests local vars are NOT accessable across invocations
+ */
+ public void testScopes2() {
+ RhinoInvoker ri = new RhinoInvoker(scriptName, script);
+ ri.invoke("setLocalVarY", "petra", null);
+
+ try {
+ ri.invoke("getGlobalVarY", null, null);
+ assertTrue("expected ReferenceError", false);
+ } catch (EcmaError e) {
+ assertEquals("ReferenceError", e.getName());
+ }
+ }
+
+ /**
+ * Tests shared scope is accessable when using contexts (ie an invocation scope)
+ */
+ public void testScopes3() {
+ RhinoInvoker ri = new RhinoInvoker(scriptName, script);
+ ri.invoke("setGlobalVarY", "petra", null);
+
+ Map<String, Object> contexts = new HashMap<String, Object>();
+ contexts.put("a", "sue");
+ Object x = ri.invoke("getGlobalVarY", null, contexts);
+ assertEquals("petra", x);
+
+ x = ri.invoke("getA", null, contexts);
+ assertEquals("sue", x);
+
+ }
+
+ /**
+ * Tests a copy only retains the script scope not the shared scope
+ */
+ public void testScopes4() {
+ RhinoInvoker ri = new RhinoInvoker(scriptName, script);
+ ri.invoke("setGlobalVarY", "petra", null);
+
+ ri = ri.copy();
+ try {
+ ri.invoke("getGlobalVarY", null, null);
+ assertTrue("expected ReferenceError", false);
+ } catch (EcmaError e) {
+ assertEquals("ReferenceError", e.getName());
+ }
+ try {
+ ri.invoke("getA", null, null);
+ assertTrue("expected ReferenceError", false);
+ } catch (EcmaError e) {
+ assertEquals("ReferenceError", e.getName());
+ }
+
+ }
+
+ public void testGetInt() {
+ RhinoInvoker ri = new RhinoInvoker(scriptName, script);
+ Object x = ri.invoke("getInt", null, Integer.TYPE, null);
+ assertEquals(Integer.class, x.getClass());
+ }
+
+ /**
+ * Read a resource into a String
+ */
+ private String readResource(String name) {
+ try {
+ URL url = getClass().getResource(name);
+ if (url == null) {
+ throw new RuntimeException("resource not found: " + name);
+ }
+ InputStream inputStream = url.openStream();
+
+ StringBuffer resource = new StringBuffer();
+ int n = 0;
+
+ while ((n = inputStream.read()) != -1) {
+ resource.append((char) n);
+ }
+
+ inputStream.close();
+
+ String s = resource.toString();
+ return s;
+
+ } catch (IOException e) {
+ throw new RuntimeException("IOException reading resource " + name, e);
+ }
+ }
+
+}
\ No newline at end of file
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/rhino/RhinoInvokerTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/container.js/src/test/java/org/apache/tuscany/container/js/rhino/RhinoInvokerTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added: incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.componentType
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.componentType?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.componentType (added)
+++ incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.componentType Tue Feb 14 13:11:19 2006
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed 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.
+ -->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9">
+ <service name="HelloWorldService">
+ <interface.java interface="org.apache.tuscany.container.js.assembly.mock.HelloWorldService" remoteable="true"/>
+ </service>
+ <property name="text"/>
+</componentType>
\ No newline at end of file
Added: incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.js
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.js?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.js (added)
+++ incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/mock/HelloWorldImpl.js Tue Feb 14 13:11:19 2006
@@ -0,0 +1,4 @@
+
+function hello(name) {
+ return "Hello " + name;
+}
Added: incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/AccountService.wsdl
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/AccountService.wsdl?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/AccountService.wsdl (added)
+++ incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/AccountService.wsdl Tue Feb 14 13:11:19 2006
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed 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.
+ -->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.bigbank.com/AccountService/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.bigbank.com/AccountService/"
+
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/AccountService/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="customerID" type="xsd:string"/>
+ <xsd:element name="getAccountReportResponse" type="tns:AccountReport"/>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummary" type="tns:AccountSummary" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:sequence>
+ <xsd:element name="accountNumber" type="xsd:string"/>
+ <xsd:element name="accountType" type="xsd:string"/>
+ <xsd:element name="balance" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="tns:customerID" name="getAccountReportRequest"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="tns:getAccountReportResponse" name="getAccountReportResponse"/>
+ </wsdl:message>
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="tns:getAccountReportRequest"/>
+ <wsdl:output message="tns:getAccountReportResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="AccountServiceSOAP" type="tns:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/AccountService/getAccountReport"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="tns:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address location=""/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Added: incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/AccountServiceImpl.componentType
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/AccountServiceImpl.componentType?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/AccountServiceImpl.componentType (added)
+++ incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/AccountServiceImpl.componentType Tue Feb 14 13:11:19 2006
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="ASCII"?>
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="test1MediatorService">
+ <interface.java interface="org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.account.AccountService"/>
+ </service>
+
+ <reference name="accountDataService">
+ <interface.java interface="org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.accountdata.AccountDataService"/>
+ </reference>
+
+ <reference name="stockQuoteService">
+ <interface.java interface="org.apache.tuscany.container.js.assembly.tests.bigbank.account.services.stockquote.StockQuoteService"/>
+ </reference>
+
+ <property name="currency" type="xsd:string" default="USD"/>
+
+</componentType>
\ No newline at end of file
Added: incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountService.wsdl
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountService.wsdl?rev=377833&view=auto
==============================================================================
--- incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountService.wsdl (added)
+++ incubator/tuscany/java/sca/container.js/src/test/resources/org/apache/tuscany/container/js/assembly/tests/bigbank/account/services/account/AccountService.wsdl Tue Feb 14 13:11:19 2006
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed 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.
+ -->
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.bigbank.com/AccountService/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.bigbank.com/AccountService/"
+
+ name="AccountService">
+
+ <wsdl:types>
+ <xsd:schema targetNamespace="http://www.bigbank.com/AccountService/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <xsd:element name="customerID" type="xsd:string"/>
+ <xsd:element name="getAccountReportResponse" type="tns:AccountReport"/>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummary" type="tns:AccountSummary" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AccountSummary">
+ <xsd:sequence>
+ <xsd:element name="accountNumber" type="xsd:string"/>
+ <xsd:element name="accountType" type="xsd:string"/>
+ <xsd:element name="balance" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="tns:customerID" name="getAccountReportRequest"/>
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="tns:getAccountReportResponse" name="getAccountReportResponse"/>
+ </wsdl:message>
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="tns:getAccountReportRequest"/>
+ <wsdl:output message="tns:getAccountReportResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="AccountServiceSOAP" type="tns:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/AccountService/getAccountReport"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="tns:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address location=""/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>