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/03/11 02:42:12 UTC
svn commit: r384986 - in /incubator/tuscany/java/sca/container.java/src/test:
java/org/apache/tuscany/container/java/integration/ resources/app1/
resources/helloworld/ resources/helloworldmc/
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$
+ */
+@Service(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$
+ */
+@Service(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>
Re: Build fails
Posted by Raymond Feng <rf...@us.ibm.com>.
"mvn clean" helped. Thanks.
"Jeremy Boynes" <jb...@apache.org> wrote in
message news:441270F5.3070404@apache.org...
>
> Raymond Feng wrote:
>
> --------------------------------------------------------------------------
--
> > ---
> > Battery:
org.apache.tuscany.model.assembly.tests.SCDLAssemblyLoaderTestCase
>
> --------------------------------------------------------------------------
--
> > ---
> > Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.731 sec
> >
> >
testLoader(org.apache.tuscany.model.assembly.tests.SCDLAssemblyLoaderTestCas
> > e) Time elapsed: 0.721 sec <<< ERROR!
> >
>
> Not for me as of rev 385026 - are you current? Try clean and then build.
> --
> Jeremy
>
Re: Build fails
Posted by Jeremy Boynes <jb...@apache.org>.
Raymond Feng wrote:
> ----------------------------------------------------------------------------
> ---
> Battery: org.apache.tuscany.model.assembly.tests.SCDLAssemblyLoaderTestCase
> ----------------------------------------------------------------------------
> ---
> Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.731 sec
>
> testLoader(org.apache.tuscany.model.assembly.tests.SCDLAssemblyLoaderTestCas
> e) Time elapsed: 0.721 sec <<< ERROR!
>
Not for me as of rev 385026 - are you current? Try clean and then build.
--
Jeremy
Build fails
Posted by Raymond Feng <en...@gmail.com>.
----------------------------------------------------------------------------
---
Battery: org.apache.tuscany.model.assembly.tests.SCDLAssemblyLoaderTestCase
----------------------------------------------------------------------------
---
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.731 sec
testLoader(org.apache.tuscany.model.assembly.tests.SCDLAssemblyLoaderTestCas
e) Time elapsed: 0.721 sec <<< ERROR!
[ stdout ] ---------------------------------------------------------------
[ stderr ] ---------------------------------------------------------------
[ stacktrace ] -----------------------------------------------------------
java.lang.IllegalStateException: No implementation for component
[AccountServiceComponent]
at
org.apache.tuscany.model.assembly.impl.ComponentImpl.initialize(ComponentImp
l.java:118)
at
org.apache.tuscany.model.scdl.loader.impl.SCDLModelContentHandlerImpl$9.run(
SCDLModelContentHandlerImpl.java:410)
at
org.apache.tuscany.model.util.ModelTransformerImpl.transformPass2(ModelTrans
formerImpl.java:120)
at
org.apache.tuscany.model.util.ModelTransformerImpl.transform(ModelTransforme
rImpl.java:44)
at
org.apache.tuscany.model.scdl.loader.impl.SCDLAssemblyModelLoaderImpl.transf
orm(SCDLAssemblyModelLoaderImpl.java:194)
at
org.apache.tuscany.model.scdl.loader.impl.SCDLAssemblyModelLoaderImpl.loadMo
dule(SCDLAssemblyModelLoaderImpl.java:104)
at
org.apache.tuscany.model.assembly.tests.SCDLAssemblyLoaderTestCase.testLoade
r(SCDLAssemblyLoaderTestCase.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.codehaus.surefire.battery.JUnitBattery.executeJUnit(JUnitBattery.java:24
6)
at
org.codehaus.surefire.battery.JUnitBattery.execute(JUnitBattery.java:220)
at org.codehaus.surefire.Surefire.executeBattery(Surefire.java:204)
at org.codehaus.surefire.Surefire.run(Surefire.java:153)
at org.codehaus.surefire.Surefire.run(Surefire.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.surefire.SurefireBooter.run(SurefireBooter.java:104)
at org.apache.maven.test.SurefirePlugin.execute(SurefirePlugin.java:303)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManage
r.java:415)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLife
cycleExecutor.java:531)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
(DefaultLifecycleExecutor.java:472)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifec
ycleExecutor.java:451)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFail
ures(DefaultLifecycleExecutor.java:303)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(Defa
ultLifecycleExecutor.java:270)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycle
Executor.java:139)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)