Author: kwilliams
Date: Thu Feb 14 15:31:51 2008
New Revision: 627910

URL: http://svn.apache.org/viewvc?rev=627910&view=rev
Log:
Adding HelloWorld test case

Added:
    incubator/tuscany/java/sca/itest/spring/src/main/resources/META-INF/
    incubator/tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/
    
incubator/tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml
   (with props)
    incubator/tuscany/java/sca/itest/spring/src/main/resources/org/
    incubator/tuscany/java/sca/itest/spring/src/main/resources/org/apache/
    
incubator/tuscany/java/sca/itest/spring/src/main/resources/org/apache/tuscany/
    
incubator/tuscany/java/sca/itest/spring/src/main/resources/org/apache/tuscany/sca/
    
incubator/tuscany/java/sca/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/
    
incubator/tuscany/java/sca/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/
    
incubator/tuscany/java/sca/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite
   (with props)
    
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java
   (with props)
    
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java
   (with props)
    
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java
   (with props)
    
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java
   (with props)
    
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java
   (with props)
    
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java
   (with props)
Modified:
    incubator/tuscany/java/sca/itest/spring/pom.xml

Modified: incubator/tuscany/java/sca/itest/spring/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/spring/pom.xml?rev=627910&r1=627909&r2=627910&view=diff
==============================================================================
--- incubator/tuscany/java/sca/itest/spring/pom.xml (original)
+++ incubator/tuscany/java/sca/itest/spring/pom.xml Thu Feb 14 15:31:51 2008
@@ -49,6 +49,12 @@
             <scope>runtime</scope>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-spring</artifactId>
+            <version>1.2-incubating-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
 
         <!-- Spring dependencies... -->    
         <dependency>

Added: 
incubator/tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml?rev=627910&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml
 (added)
+++ 
incubator/tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml
 Thu Feb 14 15:31:51 2008
@@ -0,0 +1,31 @@
+<?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.    
+-->
+<!-- Application context for the SpringHelloWorld testcase -->
+<beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:sca="http://www.springframework.org/schema/sca";
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca 
http://www.springframework.org/schema/sca/spring-sca.xsd";>
+
+    <bean id="testBean" 
class="org.apache.tuscany.sca.itest.spring.TestHelloWorldBean" lazy-init="true">
+    </bean>
+
+</beans>
\ No newline at end of file

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/main/resources/META-INF/sca/SpringHelloWorld-context.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
incubator/tuscany/java/sca/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite?rev=627910&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite
 (added)
+++ 
incubator/tuscany/java/sca/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite
 Thu Feb 14 15:31:51 2008
@@ -0,0 +1,32 @@
+<?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="SpringHelloWorld">
+
+    <component name="ClientComponent">
+        <implementation.java 
class="org.apache.tuscany.sca.itest.spring.HelloWorldProxy"/>
+        <reference name="delegate" target="HelloWorldComponent"/>
+    </component>
+
+    <component name="HelloWorldComponent">
+        <implementation.spring 
location="META-INF/sca/SpringHelloWorld-context.xml"/>
+    </component>
+
+</composite>

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/main/resources/org/apache/tuscany/sca/itest/spring/SpringHelloWorld.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java?rev=627910&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java
 (added)
+++ 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java
 Thu Feb 14 15:31:51 2008
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.spring;
+
+
+/**
+ * Basic "hello world" style test case for testing Spring component 
implementation
+ *
+ */
+public abstract class AbstractHelloWorldTestCase extends 
AbstractSCATestCase<HelloWorld> {
+
+    /**
+     * Calls the hello world service and checks that it gives the right 
response...
+     */
+    public void testHello() throws Exception {
+        assertEquals("Hello petra", service.sayHello("petra"));
+    }
+
+    @Override
+    protected Class<HelloWorld> getServiceClass() {
+        return HelloWorld.class;
+    }
+}

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractHelloWorldTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java?rev=627910&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java
 (added)
+++ 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java
 Thu Feb 14 15:31:51 2008
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.itest.spring;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public abstract class AbstractSCATestCase<T> extends TestCase {
+
+    protected SCADomain domain;
+    protected T service;
+
+    @Override
+    protected void setUp() throws Exception {
+        domain = SCADomain.newInstance(getCompositeName());
+        service = (T)domain.getService(getServiceClass(), "ClientComponent");
+    }
+
+    abstract protected Class getServiceClass();
+
+    @Override
+    protected void tearDown() throws Exception {
+        domain.close();
+    }
+
+    protected String getCompositeName() {
+        String className = this.getClass().getName();
+        String compositeName = className.substring(0, className.length() - 
8).replace('.', '/') + ".composite";
+        System.out.println("Using composite: " + compositeName);
+        return compositeName;
+    }
+
+}

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/AbstractSCATestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java?rev=627910&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java
 (added)
+++ 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java
 Thu Feb 14 15:31:51 2008
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.spring;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Interface for the "hello world" service - predictably simple with a single 
operation
+ * "sayHello"
+ *
+ */
[EMAIL PROTECTED]
+public interface HelloWorld {
+
+    public String sayHello(String s);
+
+}

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorld.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java?rev=627910&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java
 (added)
+++ 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java
 Thu Feb 14 15:31:51 2008
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.spring;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * A simple proxy Java class which implements the HelloWorld interface but 
which uses
+ * a reference "delegate" to actually provide the HelloWorld service
+ *
+ */
+public class HelloWorldProxy implements HelloWorld {
+
+    // Here is the reference "delegate" - it implements the HelloWorld 
interface...
+    @Reference
+    public HelloWorld delegate;
+
+    public String sayHello(String s) {
+        // Simply call the reference to satisfy the service request...
+        System.out.println("HelloWorldProxy - calling sayHello");
+        return delegate.sayHello(s);
+    }
+
+}

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/HelloWorldProxy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java?rev=627910&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java
 (added)
+++ 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java
 Thu Feb 14 15:31:51 2008
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest.spring;
+
+/**
+ * A basic test case of:
+ * 1) A composite containing a component with a Spring implementation
+ * 2) The composite has a component with a Java POJO implementation which uses 
the
+ * Spring implementation to satisfy a reference
+ *
+ */
+public class SpringHelloWorldTestCase extends AbstractHelloWorldTestCase {
+    // super class does it all getting composite based on this class name
+}

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/SpringHelloWorldTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java?rev=627910&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java
 (added)
+++ 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java
 Thu Feb 14 15:31:51 2008
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.itest.spring;
+
+/**
+ * A simple test Spring bean which provides the HelloWorld service
+ *
+ */
+
+public class TestHelloWorldBean implements HelloWorld {
+
+    static String hello = "Hello ";
+
+    // Classic "Hello xxx" response to any input message
+    public String sayHello(String message) {
+        System.out.println("TestHelloWorldBean - sayHello called");
+        return (hello + message);
+    }
+
+} // end class TestHelloWorldBean

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/itest/spring/src/test/java/org/apache/tuscany/sca/itest/spring/TestHelloWorldBean.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to