summaryrefslogtreecommitdiff
path: root/test/osgi
diff options
context:
space:
mode:
authorJosh Suereth <joshua.suereth@gmail.com>2012-09-17 13:51:35 -0400
committerJosh Suereth <joshua.suereth@gmail.com>2012-09-18 15:36:13 -0400
commitd7acf92be65b6005aaab33e071b4bff1d7aa9911 (patch)
treefe260eeac509f5f8209a3badf9797d37ca491750 /test/osgi
parentc6dde6a1e884b71ae8bf8e0136287e434594e92b (diff)
downloadscala-d7acf92be65b6005aaab33e071b4bff1d7aa9911.tar.gz
scala-d7acf92be65b6005aaab33e071b4bff1d7aa9911.tar.bz2
scala-d7acf92be65b6005aaab33e071b4bff1d7aa9911.zip
Adds OSGi support / tests to Scala. Fixes SI-5822.
* Adds BND manifest generation to the build. * Adds OSGi pax-exam testing infrastructure * Adds simple OSGi verification test for bundle resolution. * Modifies distribution to use bundles.
Diffstat (limited to 'test/osgi')
-rw-r--r--test/osgi/src/BasicTest.scala33
-rw-r--r--test/osgi/src/ScalaOsgiHelper.scala18
2 files changed, 51 insertions, 0 deletions
diff --git a/test/osgi/src/BasicTest.scala b/test/osgi/src/BasicTest.scala
new file mode 100644
index 0000000000..5ca8cc1265
--- /dev/null
+++ b/test/osgi/src/BasicTest.scala
@@ -0,0 +1,33 @@
+package tools.test.osgi
+
+import org.junit.Assert._
+import org.ops4j.pax.exam.CoreOptions._
+
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.ops4j.pax.exam
+import org.ops4j.pax.exam.junit.{
+ Configuration,
+ ExamReactorStrategy,
+ JUnit4TestRunner
+}
+import org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactorFactory
+import org.ops4j.pax.swissbox.framework.ServiceLookup
+import org.osgi.framework.BundleContext
+
+
+
+
+
+@RunWith(classOf[JUnit4TestRunner])
+@ExamReactorStrategy(Array(classOf[AllConfinedStagedReactorFactory]))
+class BasicTest extends ScalaOsgiHelper {
+ @Configuration
+ def config(): Array[exam.Option] = {
+ // TODO - Find scala bundles.
+ scalaBundles
+ }
+
+ @Test
+ def everythingLoads(): Unit = ()
+}
diff --git a/test/osgi/src/ScalaOsgiHelper.scala b/test/osgi/src/ScalaOsgiHelper.scala
new file mode 100644
index 0000000000..b4c643ef60
--- /dev/null
+++ b/test/osgi/src/ScalaOsgiHelper.scala
@@ -0,0 +1,18 @@
+package tools.test.osgi
+
+import org.ops4j.pax.exam.CoreOptions._
+import org.ops4j.pax.exam
+import java.io.File
+
+trait ScalaOsgiHelper {
+ def scalaBundles: Array[exam.Option] = {
+ def bundleLocation = new File(sys.props.getOrElse("scala.bundle.dir", "build/osgi"))
+ def bundleFiles = bundleLocation.listFiles filter (_.getName endsWith ".jar")
+ def makeBundle(file: File): exam.Option =
+ bundle(file.toURI.toASCIIString)
+ val bundles = (bundleFiles map makeBundle)
+ System.out.println(bundles)
+ bundles ++ Array[exam.Option](felix(), equinox(), junitBundles())
+ }
+
+}