You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2010/05/30 23:58:50 UTC

svn commit: r949596 - in /incubator/clerezza/trunk/scala-scripting/tests: ./ src/main/ src/main/resources/ src/test/java/ src/test/scala/ src/test/scala/org/apache/clerezza/platform/dashboard/blackbox/osgi/ src/test/scala/org/apache/clerezza/scala/ src...

Author: reto
Date: Sun May 30 21:58:50 2010
New Revision: 949596

URL: http://svn.apache.org/viewvc?rev=949596&view=rev
Log:
CLEREZZA-221: started pax-exam tests, reorganized project

Added:
    incubator/clerezza/trunk/scala-scripting/tests/
      - copied from r943100, incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.dashboard/org.apache.clerezza.platform.dashboard.tests/
    incubator/clerezza/trunk/scala-scripting/tests/src/main/
    incubator/clerezza/trunk/scala-scripting/tests/src/main/resources/
    incubator/clerezza/trunk/scala-scripting/tests/src/test/scala/
      - copied from r943100, incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.dashboard/org.apache.clerezza.platform.dashboard.tests/src/test/java/
    incubator/clerezza/trunk/scala-scripting/tests/src/test/scala/org/apache/clerezza/scala/
    incubator/clerezza/trunk/scala-scripting/tests/src/test/scala/org/apache/clerezza/scala/tests/
    incubator/clerezza/trunk/scala-scripting/tests/src/test/scala/org/apache/clerezza/scala/tests/ScriptEngineFactoryTest.scala
Removed:
    incubator/clerezza/trunk/scala-scripting/tests/src/test/java/
    incubator/clerezza/trunk/scala-scripting/tests/src/test/scala/org/apache/clerezza/platform/dashboard/blackbox/osgi/FelixContextualMenuGeneratorTest.java
    incubator/clerezza/trunk/scala-scripting/tests/src/test/scala/org/apache/clerezza/platform/dashboard/blackbox/osgi/GlobalMenuItemsProviderA.java
Modified:
    incubator/clerezza/trunk/scala-scripting/tests/pom.xml

Modified: incubator/clerezza/trunk/scala-scripting/tests/pom.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/scala-scripting/tests/pom.xml?rev=949596&r1=943100&r2=949596&view=diff
==============================================================================
--- incubator/clerezza/trunk/scala-scripting/tests/pom.xml (original)
+++ incubator/clerezza/trunk/scala-scripting/tests/pom.xml Sun May 30 21:58:50 2010
@@ -1,168 +1,51 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 	<parent>
-		<artifactId>org.apache.clerezza.platform.dashboard</artifactId>
-		<groupId>org.apache.clerezza</groupId>
-		<version>0.4-incubating-SNAPSHOT</version>
+		<groupId>org.apache.clerezza.scala</groupId>
+		<artifactId>scala</artifactId>
+		<version>0.1-incubating-SNAPSHOT</version>
 	</parent>
 	<modelVersion>4.0.0</modelVersion>
-	<groupId>org.apache.clerezza</groupId>
-	<artifactId>org.apache.clerezza.platform.dashboard.tests</artifactId>
-	<version>0.2-incubating-SNAPSHOT</version>
+	<groupId>org.apache.clerezza.scala</groupId>
+	<artifactId>tests</artifactId>
 	<packaging>jar</packaging>
-	<name>Clerezza - Platform Dashboard Tests</name>
-	<description>Tests for Dashboard in an OSGi container.</description>
+	<name>Scala OSGi Services - Tests</name>
+	<description>Tests for Scala OSGi Services.</description>
 	<dependencies>
-		<dependency>
-			<groupId>org.apache.clerezza</groupId>
-			<artifactId>org.apache.clerezza.triaxrs</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza</groupId>
-			<artifactId>org.apache.clerezza.rdf.core</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza</groupId>
-			<artifactId>org.apache.clerezza.jaxrs.utils</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza</groupId>
-			<artifactId>org.apache.clerezza.platform.typerendering.core</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza</groupId>
-			<artifactId>org.apache.clerezza.platform.typerendering.ontologies</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza</groupId>
-			<artifactId>org.apache.clerezza.platform.typerendering.scalaserverpages</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza</groupId>
-			<artifactId>org.apache.clerezza.platform.graphprovider.content</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza</groupId>
-			<artifactId>org.apache.clerezza.rdf.utils</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza.ext</groupId>
-			<artifactId>org.json.simple</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza</groupId>
-			<artifactId>org.apache.clerezza.platform.dashboard.core</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza</groupId>
-			<artifactId>org.apache.clerezza.platform.dashboard.ontologies</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza</groupId>
-			<artifactId>org.apache.clerezza.rdf.ontologies</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza</groupId>
-			<artifactId>org.apache.clerezza.templating</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza</groupId>
-			<artifactId>org.apache.clerezza.templating.seedsnipe</artifactId>
-			<scope>provided</scope>
-		</dependency>
+		
 		<dependency>
 			<groupId>org.osgi</groupId>
 			<artifactId>org.osgi.compendium</artifactId>
 			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>javax.ws.rs</groupId>
-			<artifactId>jsr311-api</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza</groupId>
-			<artifactId>org.apache.clerezza.jaxrs.extensions</artifactId>
-			<scope>provided</scope>
+			<version>4.2.0</version>
 		</dependency>
 		<dependency>
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
 			<scope>test</scope>
+			<version>4.8.1</version>
 		</dependency>
-		<dependency>
-			<groupId>org.wymiwyg</groupId>
-			<artifactId>wrhapi</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.wymiwyg</groupId>
-			<artifactId>wymiwyg-commons-core</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza</groupId>
-			<artifactId>org.apache.clerezza.utils</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.httpcomponents</groupId>
-			<artifactId>httpcore-osgi</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.easymock</groupId>
-			<artifactId>easymock</artifactId>
-			<scope>test</scope>
-		</dependency>
+		
 <!-- pax exam related stuff -->
 		<dependency>
 			<groupId>org.ops4j.pax.exam</groupId>
 			<artifactId>pax-exam</artifactId>
 			<scope>test</scope>
+			<version>1.2.1-SNAPSHOT</version>
 		</dependency>
 		<dependency>
 			<groupId>org.ops4j.pax.exam</groupId>
 			<artifactId>pax-exam-junit</artifactId>
 			<scope>test</scope>
+			<version>1.2.1-SNAPSHOT</version>
 		</dependency>
 		<dependency>
 			<groupId>org.ops4j.pax.exam</groupId>
 			<artifactId>pax-exam-container-default</artifactId>
 			<scope>test</scope>
+			<version>1.2.1-SNAPSHOT</version>
 		</dependency>
-		<dependency>
-			<groupId>org.wymiwyg</groupId>
-			<artifactId>wrhapi-osgi</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza.ext</groupId>
-			<artifactId>com.ibm.icu</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.clerezza</groupId>
-			<artifactId>org.apache.clerezza.scala</artifactId>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>asm</groupId>
-			<artifactId>asm-all</artifactId>
-			<scope>provided</scope>
-		</dependency>
+
 		<dependency>
 			<groupId>org.apache.httpcomponents</groupId>
 			<artifactId>httpclient-osgi</artifactId>
@@ -170,15 +53,18 @@
 			<scope>provided</scope>
 		</dependency>
 		<dependency>
-			<groupId>org.scala-lang-osgi</groupId>
-			<artifactId>scala-library</artifactId>
-			<version>2.7.5</version>
+			<groupId>org.apache.clerezza.scala</groupId>
+			<artifactId>scala-library-osgi</artifactId>
 			<scope>provided</scope>
 		</dependency>
 		<dependency>
-			<groupId>org.scala-lang-osgi</groupId>
-			<artifactId>scala-compiler</artifactId>
-			<version>2.7.5</version>
+			<groupId>org.apache.clerezza.scala</groupId>
+			<artifactId>scala-compiler-osgi</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.clerezza.scala</groupId>
+			<artifactId>script-engine</artifactId>
 			<scope>provided</scope>
 		</dependency>
 	</dependencies>
@@ -197,6 +83,21 @@
 			<plugin>
 				<groupId>org.ops4j.pax.exam</groupId>
 				<artifactId>maven-paxexam-plugin</artifactId>
+				<version>1.2.1-SNAPSHOT</version>
+				<executions>
+					<execution>
+						<id>generate-depends-file</id>
+						<goals>
+							<goal>generate-depends-file</goal>
+						</goals>
+					</execution>
+					<execution>
+						<id>generate-config</id>
+						<goals>
+							<goal>generate-config</goal>
+						</goals>
+					</execution>
+				</executions>
 			</plugin>
 		</plugins>
 	</build>

Added: incubator/clerezza/trunk/scala-scripting/tests/src/test/scala/org/apache/clerezza/scala/tests/ScriptEngineFactoryTest.scala
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/scala-scripting/tests/src/test/scala/org/apache/clerezza/scala/tests/ScriptEngineFactoryTest.scala?rev=949596&view=auto
==============================================================================
--- incubator/clerezza/trunk/scala-scripting/tests/src/test/scala/org/apache/clerezza/scala/tests/ScriptEngineFactoryTest.scala (added)
+++ incubator/clerezza/trunk/scala-scripting/tests/src/test/scala/org/apache/clerezza/scala/tests/ScriptEngineFactoryTest.scala Sun May 30 21:58:50 2010
@@ -0,0 +1,96 @@
+/*
+ * 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.clerezza.scala.tests;
+
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.junit.JUnit4TestRunner;
+
+import org.ops4j.pax.exam.CoreOptions._;
+import org.ops4j.pax.exam.container.`def`.PaxRunnerOptions._;
+import org.ops4j.pax.exam.junit.JUnitOptions._;
+
+import org.junit.Assert
+import org.junit.Before;
+import org.junit.Test;
+import org.ops4j.pax.exam.Inject;
+import org.osgi.framework.BundleContext;
+import javax.script.ScriptEngineFactory
+import org.osgi.util.tracker.ServiceTracker;
+
+
+/**
+ *
+ * @author reto
+ */
+@RunWith(classOf[JUnit4TestRunner])
+class ScriptEngineFactoryTest {
+	
+
+	
+	@Inject
+	private var bundleContext: BundleContext = null;
+	
+	private var webServerExist = false;
+
+	private var scriptEngineFactory: ScriptEngineFactory = null;
+
+	@Before
+	def getService() : Unit = {
+		/*webServerExist = waitForWebserver();*/
+		scriptEngineFactory = waitFor(classOf[ScriptEngineFactory], 300000);
+		println("Got: "+scriptEngineFactory)
+	}
+
+	private def waitFor[T](aClass: Class[T], timeout: Long): T = {
+		System.out.println("waiting for a " + aClass);
+		val tracker = new ServiceTracker(bundleContext,
+				aClass.getName(), null);
+		tracker.open();
+		val service = tracker.waitForService(timeout);
+		return service.asInstanceOf[T];
+	}
+
+	@Test
+	def checkEngine(): Unit =  {
+		Assert.assertNotNull(scriptEngineFactory)
+	}
+
+}
+
+object ScriptEngineFactoryTest {
+
+	protected val testHttpPort = 8976;
+
+	@Configuration
+	def configuration() : Array[Option] = {
+		return options(
+				mavenConfiguration(),
+				//using old ds because of issues with 1.0.8
+				dsProfile(),
+				configProfile(),
+				webProfile(),
+				junitBundles(),
+				frameworks(
+				felix()),
+				systemProperty("org.osgi.service.http.port").value(
+				Integer.toString(testHttpPort)));
+	}
+}
\ No newline at end of file