summaryrefslogtreecommitdiffstats
path: root/sandbox/samples/temp/helloworld-spring-contribution/src
diff options
context:
space:
mode:
authorfmoga <fmoga@13f79535-47bb-0310-9956-ffa450edef68>2010-09-20 12:57:14 +0000
committerfmoga <fmoga@13f79535-47bb-0310-9956-ffa450edef68>2010-09-20 12:57:14 +0000
commitc0d4cfc26bf82aedb533b7c8b5d353f84da3814e (patch)
tree08cc9eaa17b4028edf36d0a15c9d47ebcf5f5eff /sandbox/samples/temp/helloworld-spring-contribution/src
parent1d655d7009bf4fd1a11bc8aff6b14b67842335e5 (diff)
Move samples in temp folder.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@998912 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/samples/temp/helloworld-spring-contribution/src')
-rw-r--r--sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/DateService.java29
-rw-r--r--sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/DateServiceImpl.java37
-rw-r--r--sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/Helloworld.java28
-rw-r--r--sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/HelloworldClientImpl.java48
-rw-r--r--sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/HelloworldImpl.java34
-rw-r--r--sandbox/samples/temp/helloworld-spring-contribution/src/main/resources/META-INF/sca-contribution.xml23
-rw-r--r--sandbox/samples/temp/helloworld-spring-contribution/src/main/resources/helloworld-client-context.xml37
-rw-r--r--sandbox/samples/temp/helloworld-spring-contribution/src/main/resources/helloworld-context.xml30
-rw-r--r--sandbox/samples/temp/helloworld-spring-contribution/src/main/resources/helloworld.composite36
-rw-r--r--sandbox/samples/temp/helloworld-spring-contribution/src/test/java/sample/HelloworldTestCase.java33
10 files changed, 335 insertions, 0 deletions
diff --git a/sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/DateService.java b/sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/DateService.java
new file mode 100644
index 0000000000..7c50d66a9c
--- /dev/null
+++ b/sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/DateService.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample;
+
+import java.util.Date;
+
+/**
+ *
+ */
+public interface DateService {
+ Date getDate();
+}
diff --git a/sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/DateServiceImpl.java b/sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/DateServiceImpl.java
new file mode 100644
index 0000000000..64bdd86f7c
--- /dev/null
+++ b/sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/DateServiceImpl.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package sample;
+
+import java.util.Date;
+
+import org.oasisopen.sca.annotation.Service;
+
+/**
+ *
+ */
+@Service(DateService.class)
+public class DateServiceImpl implements DateService {
+
+ public Date getDate() {
+ System.out.println("DateServiceImpl.getDate()");
+ return new Date();
+ }
+
+}
diff --git a/sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/Helloworld.java b/sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/Helloworld.java
new file mode 100644
index 0000000000..f4e8c50448
--- /dev/null
+++ b/sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/Helloworld.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package sample;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface Helloworld {
+
+ String sayHello(String name);
+
+}
diff --git a/sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/HelloworldClientImpl.java b/sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/HelloworldClientImpl.java
new file mode 100644
index 0000000000..ddcb1d9bc3
--- /dev/null
+++ b/sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/HelloworldClientImpl.java
@@ -0,0 +1,48 @@
+/*
+ * 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 sample;
+
+import org.oasisopen.sca.annotation.Reference;
+
+public class HelloworldClientImpl implements Helloworld {
+ private Helloworld helloworld;
+
+ // SCA reference
+ @Reference(required = false)
+ private DateService dateService;
+
+ public HelloworldClientImpl() {
+ System.out.println("HelloworldClientImpl()");
+ }
+
+ public String sayHello(String name) {
+ System.out.println("HelloworldClientImpl.sayHello(" + name + ")");
+ if (dateService == null) {
+ return "Hello " + name;
+ }
+ return "[" + dateService.getDate() + "] " + helloworld.sayHello(name);
+ }
+
+ // Setter for spring injection
+ public void setHelloworld(Helloworld helloworld) {
+ System.out.println("Injected with " + helloworld);
+ this.helloworld = helloworld;
+ }
+
+}
diff --git a/sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/HelloworldImpl.java b/sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/HelloworldImpl.java
new file mode 100644
index 0000000000..125c333ddc
--- /dev/null
+++ b/sandbox/samples/temp/helloworld-spring-contribution/src/main/java/sample/HelloworldImpl.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package sample;
+
+
+public class HelloworldImpl implements Helloworld {
+
+ public HelloworldImpl() {
+ super();
+ System.out.println("HelloworldImpl()");
+ }
+
+ public String sayHello(String name) {
+ System.out.println("HelloworldImpl.sayHello(" + name + ")");
+ return "Hello " + name;
+ }
+
+}
diff --git a/sandbox/samples/temp/helloworld-spring-contribution/src/main/resources/META-INF/sca-contribution.xml b/sandbox/samples/temp/helloworld-spring-contribution/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..552d100638
--- /dev/null
+++ b/sandbox/samples/temp/helloworld-spring-contribution/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:helloworld"/>
+</contribution> \ No newline at end of file
diff --git a/sandbox/samples/temp/helloworld-spring-contribution/src/main/resources/helloworld-client-context.xml b/sandbox/samples/temp/helloworld-spring-contribution/src/main/resources/helloworld-client-context.xml
new file mode 100644
index 0000000000..15e9647bb0
--- /dev/null
+++ b/sandbox/samples/temp/helloworld-spring-contribution/src/main/resources/helloworld-client-context.xml
@@ -0,0 +1,37 @@
+<?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.
+-->
+<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.osoa.org/xmlns/sca/1.0/spring-sca.xsd">
+
+ <bean id="HelloworldClientBean" class="sample.HelloworldClientImpl">
+ <property name="helloworld">
+ <ref bean="HelloworldBean"/>
+ </property>
+ </bean>
+
+ <!--
+ <sca:reference name="dateService" type="sample.DateService"/>
+ -->
+
+</beans> \ No newline at end of file
diff --git a/sandbox/samples/temp/helloworld-spring-contribution/src/main/resources/helloworld-context.xml b/sandbox/samples/temp/helloworld-spring-contribution/src/main/resources/helloworld-context.xml
new file mode 100644
index 0000000000..9ecd09974e
--- /dev/null
+++ b/sandbox/samples/temp/helloworld-spring-contribution/src/main/resources/helloworld-context.xml
@@ -0,0 +1,30 @@
+<?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.
+-->
+<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.osoa.org/xmlns/sca/1.0/spring-sca.xsd">
+
+ <bean id="HelloworldBean" class="sample.HelloworldImpl">
+ </bean>
+
+</beans> \ No newline at end of file
diff --git a/sandbox/samples/temp/helloworld-spring-contribution/src/main/resources/helloworld.composite b/sandbox/samples/temp/helloworld-spring-contribution/src/main/resources/helloworld.composite
new file mode 100644
index 0000000000..6d356758ae
--- /dev/null
+++ b/sandbox/samples/temp/helloworld-spring-contribution/src/main/resources/helloworld.composite
@@ -0,0 +1,36 @@
+<?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://docs.oasis-open.org/ns/opencsa/sca/200912"
+ targetNamespace="http://sample"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ name="helloworld">
+
+ <component name="HelloworldClientComponent">
+ <implementation.spring location="helloworld-client-context.xml"/>
+ <service name="HelloworldClientBean">
+ <tuscany:binding.jsonrpc/>
+ </service>
+ <reference name="dateService" target="DateServiceComponent"/>
+ </component>
+
+ <component name="DateServiceComponent">
+ <implementation.java class="sample.DateServiceImpl"/>
+ </component>
+</composite>
diff --git a/sandbox/samples/temp/helloworld-spring-contribution/src/test/java/sample/HelloworldTestCase.java b/sandbox/samples/temp/helloworld-spring-contribution/src/test/java/sample/HelloworldTestCase.java
new file mode 100644
index 0000000000..7e679ec0e9
--- /dev/null
+++ b/sandbox/samples/temp/helloworld-spring-contribution/src/test/java/sample/HelloworldTestCase.java
@@ -0,0 +1,33 @@
+/*
+ * 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 sample;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class HelloworldTestCase {
+
+ @Test
+ public void testSayHello() {
+ HelloworldImpl helloworld = new HelloworldImpl();
+ assertEquals("Hello Petra", helloworld.sayHello("Petra"));
+ }
+
+}