Author: jboynes
Date: Fri Mar 10 17:42:10 2006
New Revision: 384986
URL: http://svn.apache.org/viewcvs?rev=384986&view=rev
Log:
add integration test with a module with two components
Added:
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProvider.java
(with props)
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProviderImpl.java
(with props)
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java
(with props)
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java
(with props)
incubator/tuscany/java/sca/container.java/src/test/resources/helloworld/
- copied from r384958,
incubator/tuscany/java/sca/container.java/src/test/resources/app1/
incubator/tuscany/java/sca/container.java/src/test/resources/helloworldmc/
incubator/tuscany/java/sca/container.java/src/test/resources/helloworldmc/sca.module
Removed:
incubator/tuscany/java/sca/container.java/src/test/resources/app1/
Modified:
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldTestCase.java
Added:
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProvider.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProvider.java?rev=384986&view=auto
==============================================================================
---
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProvider.java
(added)
+++
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProvider.java
Fri Mar 10 17:42:10 2006
@@ -0,0 +1,24 @@
+/**
+ *
+ * Copyright 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.java.integration;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface GreetingProvider {
+ String getGreeting(String name, String locale);
+}
Propchange:
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProvider.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added:
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProviderImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProviderImpl.java?rev=384986&view=auto
==============================================================================
---
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProviderImpl.java
(added)
+++
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProviderImpl.java
Fri Mar 10 17:42:10 2006
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 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.java.integration;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
[EMAIL PROTECTED](GreetingProvider.class)
+public class GreetingProviderImpl implements GreetingProvider {
+ @Property
+ public String greeting;
+
+ public String getGreeting(String name, String locale) {
+ if ("fr".equals(locale)) {
+ return "Bonjour " + name;
+ } else {
+ return greeting + name;
+ }
+ }
+}
Propchange:
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProviderImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/GreetingProviderImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added:
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java?rev=384986&view=auto
==============================================================================
---
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java
(added)
+++
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java
Fri Mar 10 17:42:10 2006
@@ -0,0 +1,39 @@
+/**
+ *
+ * Copyright 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.java.integration;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
[EMAIL PROTECTED](HelloWorldService.class)
+public class HelloWorldMCImpl implements HelloWorldService {
+
+ @Property
+ public String locale;
+
+ @Reference
+ public GreetingProvider greetingProvider;
+
+ public String getGreetings(String name) {
+ return greetingProvider.getGreeting(name, locale);
+ }
+
+}
Propchange:
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Added:
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java?rev=384986&view=auto
==============================================================================
---
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java
(added)
+++
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java
Fri Mar 10 17:42:10 2006
@@ -0,0 +1,61 @@
+/**
+ *
+ * Copyright 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.java.integration;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import junit.framework.TestCase;
+import org.osoa.sca.CurrentModuleContext;
+import org.osoa.sca.ModuleContext;
+
+import org.apache.tuscany.core.client.TuscanyRuntime;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HelloWorldMCTestCase extends TestCase {
+ private ClassLoader oldCL;
+
+ public void testHelloWorld() throws Exception {
+ TuscanyRuntime tuscany = new TuscanyRuntime("test", null);
+ tuscany.start();
+ ModuleContext moduleContext = CurrentModuleContext.getContext();
+ assertNotNull(moduleContext);
+
+ HelloWorldService helloworldService = (HelloWorldService)
moduleContext.locateService("HelloWorld");
+ assertNotNull(helloworldService);
+
+ String value = helloworldService .getGreetings("World");
+ assertEquals("Hello World", value);
+
+ tuscany.stop();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ URL url = getClass().getResource("/helloworldmc/");
+ ClassLoader cl = new URLClassLoader(new URL[]{url},
getClass().getClassLoader());
+ oldCL = Thread.currentThread().getContextClassLoader();
+ Thread.currentThread().setContextClassLoader(cl);
+ }
+
+ protected void tearDown() throws Exception {
+ Thread.currentThread().setContextClassLoader(oldCL);
+ super.tearDown();
+ }
+}
Propchange:
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldMCTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev,Date
Modified:
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldTestCase.java
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldTestCase.java?rev=384986&r1=384985&r2=384986&view=diff
==============================================================================
---
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldTestCase.java
(original)
+++
incubator/tuscany/java/sca/container.java/src/test/java/org/apache/tuscany/container/java/integration/HelloWorldTestCase.java
Fri Mar 10 17:42:10 2006
@@ -48,7 +48,7 @@
protected void setUp() throws Exception {
super.setUp();
- URL url = getClass().getResource("/app1/");
+ URL url = getClass().getResource("/helloworld/");
ClassLoader cl = new URLClassLoader(new URL[]{url},
getClass().getClassLoader());
oldCL = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(cl);
Added:
incubator/tuscany/java/sca/container.java/src/test/resources/helloworldmc/sca.module
URL:
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/container.java/src/test/resources/helloworldmc/sca.module?rev=384986&view=auto
==============================================================================
---
incubator/tuscany/java/sca/container.java/src/test/resources/helloworldmc/sca.module
(added)
+++
incubator/tuscany/java/sca/container.java/src/test/resources/helloworldmc/sca.module
Fri Mar 10 17:42:10 2006
@@ -0,0 +1,37 @@
+<?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="HelloworldMC">
+
+ <component name="HelloWorld">
+ <implementation.java
class="org.apache.tuscany.container.java.integration.HelloWorldMCImpl"/>
+ <references>
+ <v:greetingProvider>GreetingProvider</v:greetingProvider>
+ </references>
+ <properties>
+ <v:locale>en</v:locale>
+ </properties>
+ </component>
+
+ <component name="GreetingProvider">
+ <implementation.java
class="org.apache.tuscany.container.java.integration.GreetingProviderImpl"/>
+ <properties>
+ <v:greeting>Hello </v:greeting>
+ </properties>
+ </component>
+</module>