You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2009/04/16 11:44:32 UTC
svn commit: r765542 - in
/tuscany/branches/sca-java-1.x/itest/java-init-exceptions: ./ src/
src/main/ src/main/java/ src/main/java/itest/ src/main/resources/ src/test/
src/test/java/ src/test/java/itest/
Author: antelder
Date: Thu Apr 16 09:44:31 2009
New Revision: 765542
URL: http://svn.apache.org/viewvc?rev=765542&view=rev
Log:
TUSCANY-2851, start of an itest for exceptions in Java component initilization
Added:
tuscany/branches/sca-java-1.x/itest/java-init-exceptions/ (with props)
tuscany/branches/sca-java-1.x/itest/java-init-exceptions/pom.xml
tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/
tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/
tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/
tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/
tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/ConstructorException.java
tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/InitException.java
tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/OkImpl.java
tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/Service.java
tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/resources/
tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/resources/test.composite
tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/test/
tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/test/java/
tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/test/java/itest/
tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/test/java/itest/InitTestCase.java
Propchange: tuscany/branches/sca-java-1.x/itest/java-init-exceptions/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Apr 16 09:44:31 2009
@@ -0,0 +1,20 @@
+target
+work
+dojo
+*.iws
+*.ipr
+*.iml
+derby.log
+maven.log
+maven-eclipse.xml
+build.xml
+build-dependency.xml
+velocity.log*
+junit*.properties
+surefire*.properties
+.project
+.classpath
+.settings
+.deployables
+.wtpmodules
+.externalToolBuilders
Added: tuscany/branches/sca-java-1.x/itest/java-init-exceptions/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/java-init-exceptions/pom.xml?rev=765542&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/java-init-exceptions/pom.xml (added)
+++ tuscany/branches/sca-java-1.x/itest/java-init-exceptions/pom.xml Thu Apr 16 09:44:31 2009
@@ -0,0 +1,72 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>itest-java-init-exceptions</artifactId>
+ <name>Apache Tuscany SCA iTest Java Init Exceptions</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca-api</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-impl</artifactId>
+ <version>1.5-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
Added: tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/ConstructorException.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/ConstructorException.java?rev=765542&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/ConstructorException.java (added)
+++ tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/ConstructorException.java Thu Apr 16 09:44:31 2009
@@ -0,0 +1,47 @@
+/*
+ * 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 itest;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+
+public class ConstructorException implements Service {
+
+ public static boolean initRun;
+ public static boolean destroyRun;
+
+ public ConstructorException() {
+ throw new RuntimeException();
+ }
+
+ public void doit() {
+ }
+
+ @Init
+ public void init() {
+ initRun = true;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyRun = true;
+ }
+
+}
Added: tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/InitException.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/InitException.java?rev=765542&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/InitException.java (added)
+++ tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/InitException.java Thu Apr 16 09:44:31 2009
@@ -0,0 +1,43 @@
+/*
+ * 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 itest;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+
+public class InitException implements Service {
+
+ public static boolean initRun;
+ public static boolean destroyRun;
+
+ public void doit() {
+ }
+
+ @Init
+ public void init() {
+ throw new RuntimeException();
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyRun = true;
+ }
+
+}
Added: tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/OkImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/OkImpl.java?rev=765542&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/OkImpl.java (added)
+++ tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/OkImpl.java Thu Apr 16 09:44:31 2009
@@ -0,0 +1,46 @@
+/*
+ * 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 itest;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+
+public class OkImpl implements Service {
+
+ public static boolean initRun;
+ public static boolean destroyRun;
+
+ public OkImpl() {
+ }
+
+ public void doit() {
+ }
+
+ @Init
+ public void init() {
+ initRun = true;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyRun = true;
+ }
+
+}
Added: tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/Service.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/Service.java?rev=765542&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/Service.java (added)
+++ tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/java/itest/Service.java Thu Apr 16 09:44:31 2009
@@ -0,0 +1,26 @@
+/*
+ * 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 itest;
+
+public interface Service {
+
+ void doit();
+
+}
Added: tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/resources/test.composite
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/resources/test.composite?rev=765542&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/resources/test.composite (added)
+++ tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/main/resources/test.composite Thu Apr 16 09:44:31 2009
@@ -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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://itest"
+ xmlns:itest="http://itest"
+ name="Test">
+
+ <component name="OkService">
+ <implementation.java class="itest.OkImpl"/>
+ </component>
+
+ <component name="ConstructorException">
+ <implementation.java class="itest.ConstructorException"/>
+ </component>
+
+ <component name="InitException">
+ <implementation.java class="itest.InitException"/>
+ </component>
+
+</composite>
Added: tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/test/java/itest/InitTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/test/java/itest/InitTestCase.java?rev=765542&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/test/java/itest/InitTestCase.java (added)
+++ tuscany/branches/sca-java-1.x/itest/java-init-exceptions/src/test/java/itest/InitTestCase.java Thu Apr 16 09:44:31 2009
@@ -0,0 +1,66 @@
+/*
+ * 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 itest;
+
+import static org.junit.Assert.assertTrue;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ */
+public class InitTestCase {
+
+ private static SCADomain scaDomain;
+
+ @Before
+ public void init() {
+ scaDomain = SCADomain.newInstance("http://localhost", "/", "test.composite");
+ }
+
+ @Test
+ public void testOk() throws Exception {
+ Service client1 = scaDomain.getService(Service.class, "OkService");
+ client1.doit();
+ assertTrue(OkImpl.initRun);
+ }
+
+ //@Test
+ public void testConstructorException() throws Exception {
+ Service client1 = scaDomain.getService(Service.class, "ConstructorException");
+ client1.doit();
+ assertTrue(OkImpl.initRun);
+ }
+
+ //@Test
+ public void testInitException() throws Exception {
+ Service client1 = scaDomain.getService(Service.class, "InitException");
+ client1.doit();
+ assertTrue(OkImpl.initRun);
+ }
+
+ @After
+ public void end() {
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+}