From 9797e00f0cfd7c3b389c998bc6ce805ea3e6cdb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Antonsson?= Date: Wed, 29 May 2013 16:47:20 +0200 Subject: [PATCH] OSGi Make the integration test work again. See #3292 OSGi Adding ScalaBuff and removing experimental from cluster. See #3292 OSGi create bundle for ScalaBuff. See #3292 OSGi Make the integration test work again. See #3292 --- .../src/main/resources/features.xml | 8 +++- .../core/pom.xml | 6 ++- .../sample/osgi/test/HakkerStatusTest.scala | 19 +++++---- .../akka-sample-osgi-dining-hakkers/pom.xml | 9 +++- .../scalabuff/pom.xml | 41 +++++++++++++++++++ project/AkkaBuild.scala | 32 +++++++++++---- 6 files changed, 97 insertions(+), 18 deletions(-) create mode 100644 akka-samples/akka-sample-osgi-dining-hakkers/scalabuff/pom.xml diff --git a/akka-samples/akka-sample-osgi-dining-hakkers/assembly-features/src/main/resources/features.xml b/akka-samples/akka-sample-osgi-dining-hakkers/assembly-features/src/main/resources/features.xml index 18056fa180..4e8ce5bd5b 100644 --- a/akka-samples/akka-sample-osgi-dining-hakkers/assembly-features/src/main/resources/features.xml +++ b/akka-samples/akka-sample-osgi-dining-hakkers/assembly-features/src/main/resources/features.xml @@ -18,6 +18,11 @@ mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.protobuf-java/${protobuf.version}_1 + + + mvn:com.typesafe.akka.akka-sample-osgi-dining-hakkers/scalabuff/${scalabuff.version} + + mvn:io.netty/netty/${netty.version} @@ -32,8 +37,9 @@ netty uncommons-maths protobuf + scalabuff typesafe-config - mvn:com.typesafe.akka/akka-cluster-experimental_${scala.dep.version}/${akka.version} + mvn:com.typesafe.akka/akka-cluster_${scala.dep.version}/${akka.version} mvn:com.typesafe.akka/akka-remote_${scala.dep.version}/${akka.version} mvn:com.typesafe.akka/akka-osgi_${scala.dep.version}/${akka.version} diff --git a/akka-samples/akka-sample-osgi-dining-hakkers/core/pom.xml b/akka-samples/akka-sample-osgi-dining-hakkers/core/pom.xml index 978507b7a7..9dad72a90d 100644 --- a/akka-samples/akka-sample-osgi-dining-hakkers/core/pom.xml +++ b/akka-samples/akka-sample-osgi-dining-hakkers/core/pom.xml @@ -56,9 +56,13 @@ com.google.protobuf protobuf-java + + net.sandrogrzicic + scalabuff-runtime_${scala.dep.version} + com.typesafe.akka - akka-cluster-experimental_${scala.dep.version} + akka-cluster_${scala.dep.version} org.fusesource diff --git a/akka-samples/akka-sample-osgi-dining-hakkers/integration-test/src/test/scala/akka/sample/osgi/test/HakkerStatusTest.scala b/akka-samples/akka-sample-osgi-dining-hakkers/integration-test/src/test/scala/akka/sample/osgi/test/HakkerStatusTest.scala index 70f761c08a..6694c1cbbf 100644 --- a/akka-samples/akka-sample-osgi-dining-hakkers/integration-test/src/test/scala/akka/sample/osgi/test/HakkerStatusTest.scala +++ b/akka-samples/akka-sample-osgi-dining-hakkers/integration-test/src/test/scala/akka/sample/osgi/test/HakkerStatusTest.scala @@ -85,15 +85,8 @@ java.io.EOFException // create an "Interrogator" actor that receives a Hakker's identification // this is to work around the TestProbe Exception above val response = new SynchronousQueue[(String, String)]() - class Interrogator extends Actor { - def receive = { - case msg: Identification ⇒ { - response.put((msg.name, msg.busyWith)) - } - } - } - hakker.tell(Identify, actorSystem.actorOf(Props[Interrogator], "Interrogator")) + hakker.tell(Identify, actorSystem.actorOf(Props(classOf[HakkerStatusTest.Interrogator], response), "Interrogator")) val (fromHakker, busyWith) = response.poll(5, TimeUnit.SECONDS) println("---------------> %s is busy with %s.".format(fromHakker, busyWith)) @@ -103,3 +96,13 @@ java.io.EOFException } } + +object HakkerStatusTest { + class Interrogator(queue: SynchronousQueue[(String, String)]) extends Actor { + def receive = { + case msg: Identification ⇒ { + queue.put((msg.name, msg.busyWith)) + } + } + } +} diff --git a/akka-samples/akka-sample-osgi-dining-hakkers/pom.xml b/akka-samples/akka-sample-osgi-dining-hakkers/pom.xml index a032d6e796..66d884cc68 100644 --- a/akka-samples/akka-sample-osgi-dining-hakkers/pom.xml +++ b/akka-samples/akka-sample-osgi-dining-hakkers/pom.xml @@ -21,12 +21,14 @@ 2.10 1.9.1 1.0.0 + 1.2.0 api command uncommons + scalabuff core assembly-features @@ -78,7 +80,7 @@ com.typesafe.akka - akka-cluster-experimental_${scala.dep.version} + akka-cluster_${scala.dep.version} ${akka.version} @@ -96,6 +98,11 @@ protobuf-java ${protobuf.version} + + net.sandrogrzicic + scalabuff-runtime_${scala.dep.version} + ${scalabuff.version} + io.netty netty diff --git a/akka-samples/akka-sample-osgi-dining-hakkers/scalabuff/pom.xml b/akka-samples/akka-sample-osgi-dining-hakkers/scalabuff/pom.xml new file mode 100644 index 0000000000..90d015f8d8 --- /dev/null +++ b/akka-samples/akka-sample-osgi-dining-hakkers/scalabuff/pom.xml @@ -0,0 +1,41 @@ + + + + com.typesafe.akka.akka-sample-osgi-dining-hakkers + project + 2.2.0-SNAPSHOT + + 4.0.0 + + scalabuff + net.sandrogrzicic.scalabuff + ${scalabuff.version} + bundle + + + + net.sandrogrzicic + scalabuff-runtime_${scala.dep.version} + ${scalabuff.version} + + + + + + + org.apache.felix + maven-bundle-plugin + + + ${project.name} + ${project.artifactId} + net.sandrogrzicic.scalabuff + !sun.misc, * +\ + + + + + diff --git a/project/AkkaBuild.scala b/project/AkkaBuild.scala index 6f92e9b5c4..78b0a4d2fb 100644 --- a/project/AkkaBuild.scala +++ b/project/AkkaBuild.scala @@ -184,6 +184,7 @@ object AkkaBuild extends Build { dependencies = Seq(remote, remoteTests % "test->test" , testkit % "test->test"), settings = defaultSettings ++ scaladocSettings ++ javadocSettings ++ multiJvmSettings ++ OSGi.cluster ++ experimentalSettings ++ scalabuffSettings ++ Seq( + // this version needs to be reflected in the OSGi.scalabuffImport and dining hackers pom.xml scalabuffVersion in ScalaBuff := "1.2.0", libraryDependencies ++= Dependencies.cluster, // disable parallel tests @@ -423,7 +424,7 @@ object AkkaBuild extends Build { base = file("akka-samples/akka-sample-osgi-dining-hakkers"), settings = parentSettings ) aggregate(osgiDiningHakkersSampleApi, osgiDiningHakkersSampleCommand, osgiDiningHakkersSampleCore, - osgiDiningHakkersSampleIntegrationTest, uncommons) + osgiDiningHakkersSampleIntegrationTest, uncommons, scalaBuff) lazy val osgiDiningHakkersSampleApi = Project(id = "akka-sample-osgi-dining-hakkers-api", base = file("akka-samples/akka-sample-osgi-dining-hakkers/api"), @@ -446,15 +447,24 @@ object AkkaBuild extends Build { //TODO to remove it as soon as the uncommons gets OSGified, see ticket #2990 lazy val uncommons = Project(id = "akka-sample-osgi-dining-hakkers-uncommons", - base = file("akka-samples/akka-sample-osgi-dining-hakkers//uncommons"), + base = file("akka-samples/akka-sample-osgi-dining-hakkers/uncommons"), settings = sampleSettings ++ OSGi.osgiDiningHakkersSampleUncommons ++ Seq( libraryDependencies ++= Dependencies.uncommons, - version := "1.2.2" + version := "1.2.0" + ) + ) + + //TODO to remove it as soon as the scalabuff gets OSGified, see ticket #3416 + lazy val scalaBuff = Project(id = "akka-sample-osgi-dining-hakkers-scalaBuff", + base = file("akka-samples/akka-sample-osgi-dining-hakkers/scalabuff"), + settings = sampleSettings ++ OSGi.osgiDiningHakkersSampleScalaBuff ++ Seq( + libraryDependencies ++= Dependencies.scalaBuff, + version := "1.2.0" ) ) def executeMvnCommands(failureMessage: String, commands: String*) = { - if ({List("sh", "-c", commands.mkString("cd akka-samples/akka-sample-osgi-dining-hakkers; mvn ", " ", "")) !} != 0) + if ({List("sh", "-c", commands.mkString("cd akka-samples/akka-sample-osgi-dining-hakkers; mvn -U ", " ", "")) !} != 0) throw new Exception(failureMessage) } @@ -467,7 +477,7 @@ object AkkaBuild extends Build { }}) else Seq.empty ) - ) dependsOn(osgiDiningHakkersSampleApi, osgiDiningHakkersSampleCommand, osgiDiningHakkersSampleCore, uncommons) + ) dependsOn(osgiDiningHakkersSampleApi, osgiDiningHakkersSampleCommand, osgiDiningHakkersSampleCore, uncommons, scalaBuff) @@ -849,7 +859,7 @@ object AkkaBuild extends Build { val camel = exports(Seq("akka.camel.*")) - val cluster = exports(Seq("akka.cluster.*")) + val cluster = exports(Seq("akka.cluster.*"), imports = Seq(scalabuffImport(), protobufImport())) val fileMailbox = exports(Seq("akka.actor.mailbox.filebased.*")) @@ -870,6 +880,8 @@ object AkkaBuild extends Build { val osgiDiningHakkersSampleUncommons = exports(Seq("org.uncommons.maths.random")) ++ Seq(OsgiKeys.privatePackage := Seq("org.uncommons.maths.binary", "org.uncommons.maths", "org.uncommons.maths.number")) + val osgiDiningHakkersSampleScalaBuff = exports(Seq("net.sandrogrzicic.scalabuff")) + val osgiAries = exports() ++ Seq(OsgiKeys.privatePackage := Seq("akka.osgi.aries.*")) val remote = exports(Seq("akka.remote.*"), imports = Seq(protobufImport())) @@ -893,6 +905,7 @@ object AkkaBuild extends Build { "akka.remote.serialization", "akka.cluster", "akka.cluster.routing", + "akka.cluster.protobuf", "akka.transactor", "akka.agent", "akka.dataflow", @@ -902,7 +915,8 @@ object AkkaBuild extends Build { "akka.camel", "akka.camel.internal.component", "akka.zeromq", - "com.google.protobuf") + "com.google.protobuf", + "net.sandrogrzicic.scalabuff") def exports(packages: Seq[String] = Seq(), imports: Seq[String] = Nil) = osgiSettings ++ Seq( OsgiKeys.importPackage := imports ++ defaultImports, @@ -912,6 +926,7 @@ object AkkaBuild extends Build { def akkaImport(packageName: String = "akka.*") = "%s;version=\"[2.2,2.3)\"".format(packageName) def configImport(packageName: String = "com.typesafe.config.*") = "%s;version=\"[0.4.1,1.1.0)\"".format(packageName) def protobufImport(packageName: String = "com.google.protobuf.*") = "%s;version=\"[2.4.0,2.5.0)\"".format(packageName) + def scalabuffImport(packageName: String = "net.sandrogrzicic.scalabuff.*") = "%s;version=\"[1.2.0,1.3.0)\"".format(packageName) def scalaImport(packageName: String = "scala.*") = "%s;version=\"[2.10,2.11)\"".format(packageName) def optionalResolution(packageName: String) = "%s;resolution:=optional".format(packageName) } @@ -929,6 +944,7 @@ object Dependencies { val netty = "io.netty" % "netty" % "3.6.6.Final" // ApacheV2 val protobuf = "com.google.protobuf" % "protobuf-java" % "2.4.1" // New BSD val scalaStm = "org.scala-stm" %% "scala-stm" % "0.7" // Modified BSD (Scala) + val scalaBuffRuntime = "net.sandrogrzicic" %% "scalabuff-runtime" % "1.2.0" // ApacheV2 val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.2" // MIT val zeroMQClient = "org.zeromq" %% "zeromq-scala-binding" % "0.0.7" // ApacheV2 @@ -1004,6 +1020,8 @@ object Dependencies { val uncommons = Seq(uncommonsMath) + val scalaBuff = Seq(scalaBuffRuntime) + val osgiAries = Seq(osgiCore, osgiCompendium, ariesBlueprint, Test.ariesProxy) val docs = Seq(Test.scalatest, Test.junit, Test.junitIntf)