You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2008/03/17 19:16:59 UTC

svn commit: r637999 - in /felix/sandbox/clement/ipojo/examples/junit4osgi: ./ immediate-launcher/ immediate-launcher/src/ immediate-launcher/src/main/ immediate-launcher/src/main/java/ immediate-launcher/src/main/java/org/ immediate-launcher/src/main/j...

Author: clement
Date: Mon Mar 17 11:16:56 2008
New Revision: 637999

URL: http://svn.apache.org/viewvc?rev=637999&view=rev
Log:
Update the junit4osgi project : 
Add an immediate runner. Once started (and valid), this runner executes all found test suites.

Added:
    felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/   (with props)
    felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/metadata.xml
    felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/pom.xml
    felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/src/
    felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/src/main/
    felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/src/main/java/
    felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/src/main/java/org/
    felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/src/main/java/org/apache/
    felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/src/main/java/org/apache/felix/
    felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/src/main/java/org/apache/felix/ipojo/
    felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/src/main/java/org/apache/felix/ipojo/junit4osgi/
    felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/src/main/java/org/apache/felix/ipojo/junit4osgi/command/
    felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ImmediateRunner.java
    felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/src/main/resources/
Modified:
    felix/sandbox/clement/ipojo/examples/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/JunitExtender.java
    felix/sandbox/clement/ipojo/examples/junit4osgi/pom.xml

Propchange: felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Mar 17 11:16:56 2008
@@ -0,0 +1,5 @@
+.checkstyle
+.classpath
+.project
+bin
+target

Added: felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/metadata.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/metadata.xml?rev=637999&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/metadata.xml (added)
+++ felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/metadata.xml Mon Mar 17 11:16:56 2008
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<iPOJO>	
+	<component className="org.apache.felix.ipojo.junit4osgi.command.ImmediateRunner" factory="false" >
+		<requires field="runner"/>
+		<callback method="start" transition="validate"/>
+	</component>
+	<instance component="org.apache.felix.ipojo.junit4osgi.command.ImmediateRunner" name="immediate-runner"/>
+</iPOJO>
\ No newline at end of file

Added: felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/pom.xml?rev=637999&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/pom.xml (added)
+++ felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/pom.xml Mon Mar 17 11:16:56 2008
@@ -0,0 +1,77 @@
+<project>
+	<parent>
+		<groupId>ipojo.examples</groupId>
+		<artifactId>Junit4Osgi</artifactId>
+		<version>0.7.6-SNAPSHOT</version>
+		<relativePath>../pom.xml</relativePath>
+	</parent>
+	<modelVersion>4.0.0</modelVersion>
+	<packaging>bundle</packaging>
+	<name>Junit4Osgi-Immediate-Runner</name>
+	<artifactId>
+		org.apache.felix.ipojo.junit4osgi.immediate-runner
+	</artifactId>
+	<dependencies>
+		<dependency>
+			<groupId>${pom.groupId}</groupId>
+			<artifactId>org.apache.felix.ipojo.junit4osgi</artifactId>
+			<version>${pom.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.shell</artifactId>
+			<version>1.0.0</version>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>3.8.1</version>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.5</source>
+					<target>1.5</target>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-bundle-plugin</artifactId>
+				<version>1.2.0</version>
+				<extensions>true</extensions>
+				<configuration>
+					<instructions>
+						<Bundle-Name>
+							iPOJO OSGi Junit Runner - Immediate Runner
+						</Bundle-Name>
+						<Bundle-SymbolicName>
+							${pom.artifactId}
+						</Bundle-SymbolicName>
+						<Private-Package>
+							org.apache.felix.ipojo.junit4osgi.command
+						</Private-Package>
+					</instructions>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-ipojo-plugin</artifactId>
+				<version>${pom.version}</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>ipojo-bundle</goal>
+						</goals>
+						<configuration>
+							<ignoreAnnotations>true</ignoreAnnotations>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+</project>

Added: felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ImmediateRunner.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ImmediateRunner.java?rev=637999&view=auto
==============================================================================
--- felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ImmediateRunner.java (added)
+++ felix/sandbox/clement/ipojo/examples/junit4osgi/immediate-launcher/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ImmediateRunner.java Mon Mar 17 11:16:56 2008
@@ -0,0 +1,35 @@
+/* 
+ * 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.felix.ipojo.junit4osgi.command;
+
+import org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner;
+
+/**
+ * Felix shell command. Allow to run tests.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class ImmediateRunner {
+
+    private OSGiJunitRunner runner;
+    
+    public void start() {
+        runner.run();
+    }
+
+}

Modified: felix/sandbox/clement/ipojo/examples/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/JunitExtender.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/JunitExtender.java?rev=637999&r1=637998&r2=637999&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/examples/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/JunitExtender.java (original)
+++ felix/sandbox/clement/ipojo/examples/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/JunitExtender.java Mon Mar 17 11:16:56 2008
@@ -67,7 +67,7 @@
         }
     }
 
-    private void addTestSuite(Bundle bundle, Class<? extends Test> test) {
+    private synchronized void addTestSuite(Bundle bundle, Class<? extends Test> test) {
         List<Class> list = m_suites.get(bundle);
         if (list == null) {
             list = new ArrayList<Class>();
@@ -78,7 +78,7 @@
         }
     }
 
-    private void removeTestSuites(Bundle bundle) {
+    private synchronized void removeTestSuites(Bundle bundle) {
         m_suites.remove(bundle);
     }
 
@@ -90,7 +90,7 @@
         m_printer = new ResultPrinter(pw);
     }
 
-    public List<TestResult> run() {
+    public synchronized List<TestResult> run() {
         List<TestResult> results = new ArrayList<TestResult>(m_suites.size());
         Iterator<Entry<Bundle, List<Class>>> it = m_suites.entrySet().iterator();
         while (it.hasNext()) {
@@ -185,7 +185,7 @@
         return doRun(test);
     }
 
-    public List<Test> getTests(long bundleId) {
+    public synchronized List<Test> getTests(long bundleId) {
         Iterator<Entry<Bundle, List<Class>>> it = m_suites.entrySet().iterator();
         while (it.hasNext()) {
             Entry<Bundle, List<Class>> entry = it.next();
@@ -203,7 +203,7 @@
         return null;
     }
 
-    public List<TestResult> run(long bundleId) {
+    public synchronized List<TestResult> run(long bundleId) {
         Iterator<Entry<Bundle, List<Class>>> it = m_suites.entrySet().iterator();
         while (it.hasNext()) {
             Entry<Bundle, List<Class>> entry = it.next();
@@ -222,9 +222,9 @@
         return null;
     }
 
-    public void stopping() {
+    public synchronized void stopping() {
         System.out.println("Cleaning test suites ...");
-        m_suites = null;
+        m_suites.clear();
     }
     
     public void starting() {

Modified: felix/sandbox/clement/ipojo/examples/junit4osgi/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/examples/junit4osgi/pom.xml?rev=637999&r1=637998&r2=637999&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/examples/junit4osgi/pom.xml (original)
+++ felix/sandbox/clement/ipojo/examples/junit4osgi/pom.xml Mon Mar 17 11:16:56 2008
@@ -21,6 +21,7 @@
 			<module>junit4osgi</module>
 			<module>felix-command</module>
 			<module>swing-runner</module>
+			<module>immediate-launcher</module>
 		</modules>
 	</profile>
 	<profile>
@@ -32,6 +33,7 @@
 			<module>junit4osgi</module>
 			<module>felix-command</module>
 			<module>swing-runner</module>
+			<module>immediate-launcher</module>
 		</modules>
 	</profile>
   </profiles>