akka-sample-osgi : fix on sript running maven integration test
This commit is contained in:
parent
c02c071170
commit
39cd23977b
21 changed files with 123 additions and 202 deletions
12
README.md
12
README.md
|
|
@ -1,12 +1,12 @@
|
|||
akka-osgi-sample : Clustered DiningHakker
|
||||
akka-osgi-sample : Clustered DiningHakkers
|
||||
================
|
||||
This project may be used to test akka bundles in OSGi Frameworks. The build tool (sbt for the moment) provide scripts to run in an OSGi Framework (Karaf only for the moment) a version of the DiningHakkers that runs on several nodes unsing the akka-cluster module.
|
||||
This project may be used to test akka bundles in OSGi Frameworks. The build tool (sbt for the moment) provide scripts to run in an OSGi Framework (Karaf only for the moment) a version of the DiningHakkers that runs on several nodes using the akka-cluster module.
|
||||
|
||||
## Bundle overview
|
||||
|
||||
This project provides three Osgi Bundles
|
||||
- api providing an API for the Service exposed by the core and used by the command
|
||||
- core implementing the whole logic: clustered connections, Hakkers, ChopSticks. It finally provide an ActorRef of one created Hakker
|
||||
- core implementing the whole logic: clustered connections, Hakkers, ChopSticks. Finally it provides an ActorRef of one created Hakker
|
||||
- command use a service to get a Hakker (ActorRef) with its position around the table
|
||||
|
||||
An integration testing module is provided to verify OSGi functionality:
|
||||
|
|
@ -25,7 +25,7 @@ sbt clean
|
|||
sbt package
|
||||
sbt osgi-bundle
|
||||
```
|
||||
sbt will creates the bundles in each subproject (api, command, core)/target/scala-2.10 directories. To have integration tests and OSGi environment loaded, please use the Maven build (at least for the moment)
|
||||
sbt will creates the bundles in each subproject akka-sample/akka-sample-osgi-dining-hakkers/(api, command, core)/target directories. To have integration tests and OSGi environment loaded, please use the Maven build (at least for the moment)
|
||||
### Setup with Maven
|
||||
```bash
|
||||
mvn clean install
|
||||
|
|
@ -38,7 +38,7 @@ This can be extracted to any location, and bin/karaf executed. The provided kara
|
|||
Extract the OSGi Framework from the tar.gz described above into any location, or run:
|
||||
``./karaf.sh``
|
||||
|
||||
Execute the framework by running bin ``/karaf`` from inside the extracted directory.
|
||||
Execute the framework by running ``bin/karaf`` from inside the extracted directory.
|
||||
|
||||
Then try to restart some bundles, to test the stability of the bundles:
|
||||
|
||||
|
|
@ -46,4 +46,4 @@ Then try to restart some bundles, to test the stability of the bundles:
|
|||
``restart #bundle_number`` to restart the bundle using its ID
|
||||
``exit`` or CTRL-D to exit the Karaf console
|
||||
|
||||
Depending on the akka version you're using, you may need to modify the core bundle when deploying on a second machine, to set it's akka.remote.netty.hostname in the application.conf.
|
||||
Depending on the akka version you're using, you may need to modify the core bundle when deploying on a second machine, to set its akka.remote.netty.hostname in the application.conf.
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ abstract class ActorSystemActivator extends BundleActivator {
|
|||
val logServiceListner = new ServiceListener {
|
||||
def serviceChanged(event: ServiceEvent) {
|
||||
event.getType match {
|
||||
case ServiceEvent.REGISTERED ⇒ system.eventStream.publish(serviceForReference[LogService](context, event.getServiceReference))
|
||||
case ServiceEvent.REGISTERED ⇒
|
||||
system.eventStream.publish(serviceForReference[LogService](context, event.getServiceReference))
|
||||
case ServiceEvent.UNREGISTERING ⇒ system.eventStream.publish(UnregisteringLogService)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>osgi-sample</artifactId>
|
||||
<groupId>com.typesafe.akka</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<groupId>com.typesafe.akka.akka-sample.akka-sample-osgi-dining-hakkers</groupId>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,7 @@
|
|||
package akka.osgi.sample.api
|
||||
/**
|
||||
* Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>.
|
||||
*/
|
||||
package akka.sample.osgi.api
|
||||
|
||||
import akka.actor.ActorRef
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,11 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.typesafe.akka</groupId>
|
||||
<artifactId>osgi-sample</artifactId>
|
||||
<groupId>com.typesafe.akka.akka-sample.akka-sample-osgi-dining-hakkers</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.typesafe.akka</groupId>
|
||||
<artifactId>assembly-dist</artifactId>
|
||||
<name>Dining Hakkers :: Distribution</name>
|
||||
|
||||
|
|
@ -55,7 +54,7 @@
|
|||
<descriptors>
|
||||
<descriptor>mvn:org.apache.karaf.assemblies.features/standard/${karaf.version}/xml/features</descriptor>
|
||||
<descriptor>mvn:org.apache.karaf.assemblies.features/enterprise/${karaf.version}/xml/features</descriptor>
|
||||
<descriptor>mvn:com.typesafe.akka/assembly-features/${project.version}/xml/features</descriptor>
|
||||
<descriptor>mvn:com.typesafe.akka.akka-sample.akka-sample-osgi-dining-hakkers/assembly-features/${project.version}/xml/features</descriptor>
|
||||
</descriptors>
|
||||
<repository>target/generated-features-repo</repository>
|
||||
</configuration>
|
||||
|
|
@ -79,20 +78,6 @@
|
|||
<outputDirectory>target/generated-features-repo</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
<!--
|
||||
<execution>
|
||||
<id>copy</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<!– Define here the artifacts which should be manually added to the assembly e.g. branding jar –>
|
||||
<artifactItems>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
-->
|
||||
<execution>
|
||||
<!-- Uncompress the standard Karaf distribution -->
|
||||
<id>unpack</id>
|
||||
|
|
|
|||
|
|
@ -77,16 +77,9 @@
|
|||
<includes>
|
||||
<include>bin/**</include>
|
||||
</includes>
|
||||
<lineEnding>unix</lineEnding>
|
||||
<fileMode>0755</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
<!--
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<useTransitiveDependencies>false</useTransitiveDependencies>
|
||||
<unpack>true</unpack>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
-->
|
||||
</assembly>
|
||||
|
|
|
|||
|
|
@ -5,12 +5,11 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.typesafe.akka</groupId>
|
||||
<artifactId>osgi-sample</artifactId>
|
||||
<groupId>com.typesafe.akka.akka-sample.akka-sample-osgi-dining-hakkers</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.typesafe.akka</groupId>
|
||||
<artifactId>assembly-features</artifactId>
|
||||
<name>Dining Hakkers :: Features</name>
|
||||
<packaging>pom</packaging>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<feature name='uncommons-maths' description='Uncommons Maths' version='1.2.2' resolver='(obr)'>
|
||||
<!-- TODO replace this with upstream uncommons maths 1.2.3 which is OSGi enabled -->
|
||||
<bundle start-level="20">mvn:com.typesafe.akka/uncommons/1.2.2</bundle>
|
||||
<bundle start-level="20">mvn:com.typesafe.akka.akka-sample.akka-sample-osgi-dining-hakkers/uncommons/1.2.2</bundle>
|
||||
</feature>
|
||||
|
||||
<feature name='protobuf' description='Protobuf feature' version='${protobuf.version}' resolver='(obr)'>
|
||||
|
|
@ -40,8 +40,8 @@
|
|||
|
||||
<feature name='dining-hakker' description='Akka Dining Hakker Sample' version='${project.version}' resolver='(obr)'>
|
||||
<feature version="[${akka.version},3.0.0)">akka</feature>
|
||||
<bundle start-level="50">mvn:com.typesafe.akka/api/${project.version}</bundle>
|
||||
<bundle start-level="50">mvn:com.typesafe.akka/core/${project.version}</bundle>
|
||||
<bundle start-level="50">mvn:com.typesafe.akka/command/${project.version}</bundle>
|
||||
<bundle start-level="50">mvn:com.typesafe.akka.akka-sample.akka-sample-osgi-dining-hakkers/api/${project.version}</bundle>
|
||||
<bundle start-level="50">mvn:com.typesafe.akka.akka-sample.akka-sample-osgi-dining-hakkers/core/${project.version}</bundle>
|
||||
<bundle start-level="50">mvn:com.typesafe.akka.akka-sample.akka-sample-osgi-dining-hakkers/command/${project.version}</bundle>
|
||||
</feature>
|
||||
</features>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>osgi-sample</artifactId>
|
||||
<groupId>com.typesafe.akka</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<groupId>com.typesafe.akka.akka-sample.akka-sample-osgi</groupId>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
@ -38,7 +38,8 @@
|
|||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Bundle-Activator>akka.osgi.sample.command.Activator</Bundle-Activator>
|
||||
<Bundle-Activator>akka.sample.osgi.command.Activator</Bundle-Activator>
|
||||
<Import-Package>*</Import-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>osgi-sample</artifactId>
|
||||
<groupId>com.typesafe.akka</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<groupId>com.typesafe.akka.akka-sample.akka-sample-osgi-dining-hakkers</groupId>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
|
|||
|
|
@ -5,16 +5,14 @@ akka {
|
|||
}
|
||||
|
||||
remote {
|
||||
transport = "akka.remote.netty.NettyRemoteTransport"
|
||||
log-remote-lifecycle-events = off
|
||||
netty {
|
||||
netty.tcp {
|
||||
hostname = "localhost"
|
||||
port = 2552
|
||||
port = 4242
|
||||
}
|
||||
}
|
||||
|
||||
cluster {
|
||||
seed-nodes = ["akka://akka-osgi-sample@localhost:2552"]
|
||||
seed-nodes = ["akka.tcp://akka-osgi-sample@localhost:4242"]
|
||||
auto-down = on
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,22 +28,28 @@ class Activator extends ActorSystemActivator {
|
|||
|
||||
import Activator._
|
||||
|
||||
val services: ListBuffer[ServiceRegistration[_]] = ListBuffer()
|
||||
var diningHakkerService: Option[ServiceRegistration[_]] = None
|
||||
|
||||
def configure(context: BundleContext, system: ActorSystem) {
|
||||
val log = Logging(system, this)
|
||||
log.info("Core bundle configured")
|
||||
system.actorOf(Props[Table], "table")
|
||||
registerService(context, system)
|
||||
registerHakkersService(context, system)
|
||||
log.info("Hakker service registred")
|
||||
log.info("Hakker service registered")
|
||||
}
|
||||
|
||||
/**
|
||||
* registers the DinningHakkerService as a Service to be tracked and find by other OSGi bundles.
|
||||
* in other words, this instance may be used in other bundles which listen or track the OSGi Service
|
||||
* @param context OSGi BundleContext
|
||||
* @param system ActorSystem
|
||||
*/
|
||||
def registerHakkersService(context: BundleContext, system: ActorSystem) {
|
||||
|
||||
val hakkersService = new DiningHakkersServiceImpl(system)
|
||||
|
||||
services += context.registerService(classOf[DiningHakkersService], hakkersService, null)
|
||||
services += context.registerService(classOf[ActorSystem], system, null)
|
||||
diningHakkerService = Some(context.registerService(classOf[DiningHakkersService], hakkersService, null))
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +60,7 @@ class Activator extends ActorSystemActivator {
|
|||
}
|
||||
|
||||
def unregisterServices(context: BundleContext) {
|
||||
services foreach (_.unregister())
|
||||
diningHakkerService foreach (_.unregister())
|
||||
}
|
||||
|
||||
override def getActorSystemName(context: BundleContext): String = "akka-osgi-sample"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (C) 2009-2010 Typesafe Inc. <http://www.typesafe.com>.
|
||||
* Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>.
|
||||
*/
|
||||
package akka.osgi.sample.internal
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>osgi-sample</artifactId>
|
||||
<groupId>com.typesafe.akka</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<groupId>com.typesafe.akka.akka-sample.akka-sample-osgi-dining-hakkers</groupId>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
|
|||
|
|
@ -48,12 +48,12 @@ class HakkerStatusTest extends JUnitSuite with ShouldMatchersForJUnit {
|
|||
)
|
||||
|
||||
// Junit @Before and @After can be used as well
|
||||
/*
|
||||
@Before
|
||||
|
||||
/* @Before
|
||||
def setupAkkaTestkit() {
|
||||
testProbe = new TestProbe(actorSystem)
|
||||
}
|
||||
*/
|
||||
}*/
|
||||
|
||||
|
||||
@Test
|
||||
def verifyObtainingAHakkerViaTheTheDiningHakkersService() {
|
||||
|
|
@ -65,17 +65,22 @@ class HakkerStatusTest extends JUnitSuite with ShouldMatchersForJUnit {
|
|||
hakker should not be (null)
|
||||
|
||||
/* TODO Getting some weird config error with TestProbe, is it a TestProbe inside OSGi issue?
|
||||
Exception in thread "RMI TCP Connection(idle)" java.lang.NullPointerException
|
||||
at com.typesafe.config.impl.SerializedConfigValue.writeOrigin(SerializedConfigValue.java:202)
|
||||
at com.typesafe.config.impl.ConfigImplUtil.writeOrigin(ConfigImplUtil.java:224)
|
||||
at com.typesafe.config.ConfigException.writeObject(ConfigException.java:58)
|
||||
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
|
||||
java.io.EOFException
|
||||
at java.io.ObjectInputStream$BlockDataInputStream.readUnsignedByte(ObjectInputStream.java:2747)
|
||||
at java.io.ObjectInputStream.readUnsignedByte(ObjectInputStream.java:924)
|
||||
at com.typesafe.config.impl.SerializedConfigValue.readCode(SerializedConfigValue.java:412)
|
||||
at com.typesafe.config.impl.SerializedConfigValue.readOrigin(SerializedConfigValue.java:218)
|
||||
...
|
||||
|
||||
testProbe.send(hakker, Identify)
|
||||
val identification = testProbe.expectMsgClass(classOf[Identification])
|
||||
val (fromHakker, busyWith) = (identification.name, identification.busyWith)
|
||||
*/
|
||||
*/
|
||||
|
||||
// create an "Interrogator" actor that receives a Hakker's identification
|
||||
// this is to work around the TestProbe Exception above
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ object TestOptions {
|
|||
}
|
||||
|
||||
def akkaFeature(feature: String): PaxOption = {
|
||||
scanFeatures(maven.groupId("com.typesafe.akka").artifactId("assembly-features").`type`("xml").classifier("features")
|
||||
scanFeatures(maven.groupId("com.typesafe.akka.akka-sample.akka-sample-osgi-dining-hakkers").artifactId("assembly-features").`type`("xml").classifier("features")
|
||||
.version(System.getProperty("project.version")), feature)
|
||||
}
|
||||
|
||||
|
|
|
|||
6
pom.xml
6
pom.xml
|
|
@ -3,8 +3,8 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.typesafe.akka</groupId>
|
||||
<artifactId>osgi-sample</artifactId>
|
||||
<groupId>com.typesafe.akka.akka-sample.akka-sample-osgi-dining-hakkers</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
<module>integration-test</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
<name>com.typesafe.akka.akka-osgi.sample</name>
|
||||
<name>com.typesafe.akka.akka-sample.akka-sample-osgi-dining-hakkers.sample</name>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -357,7 +357,7 @@ object AkkaBuild extends Build {
|
|||
id = "akka-samples",
|
||||
base = file("akka-samples"),
|
||||
settings = parentSettings,
|
||||
aggregate = Seq(camelSample, fsmSample, helloSample, helloKernelSample, remoteSample, clusterSample, multiNodeSample)
|
||||
aggregate = Seq(camelSample, fsmSample, helloSample, helloKernelSample, remoteSample, clusterSample, multiNodeSample, osgiDiningHakkersSample)
|
||||
)
|
||||
|
||||
lazy val camelSample = Project(
|
||||
|
|
@ -427,6 +427,45 @@ object AkkaBuild extends Build {
|
|||
)
|
||||
) configs (MultiJvm)
|
||||
|
||||
lazy val osgiDiningHakkersSample = Project(id = "akka-sample-osgi-dining-hakkers",
|
||||
base = file("akka-samples/akka-sample-osgi-dining-hakkers"),
|
||||
settings = sampleSettings ++ Seq(
|
||||
test in Test ~= { x => {
|
||||
if({List("sh", "-c", "which mvn") !} != 0 ) {throw new Exception("Maven is not installed or not in the $PATH")}
|
||||
if({List("sh", "-c", "cd akka-samples/akka-sample-osgi-dining-hakkers; mvn clean install") !} != 0 ) {throw new Exception("Osgi sample Dining hakkers failed")}
|
||||
} }
|
||||
)
|
||||
) aggregate(osgiDiningHakkersSampleApi, osgiDiningHakkersSampleCommand, osgiDiningHakkersSampleCore, uncommons)
|
||||
|
||||
lazy val osgiDiningHakkersSampleApi = Project(id = "akka-sample-osgi-dining-hakkers-api",
|
||||
base = file("akka-samples/akka-sample-osgi-dining-hakkers/api"),
|
||||
settings = sampleSettings ++ OSGi.osgiDiningHakkersSampleApi
|
||||
)dependsOn(actor)
|
||||
|
||||
lazy val osgiDiningHakkersSampleCommand = Project(id = "akka-sample-osgi-dining-hakkers-command",
|
||||
base = file("akka-samples/akka-sample-osgi-dining-hakkers/command"),
|
||||
settings = sampleSettings ++ OSGi.osgiDiningHakkersSampleCommand ++ Seq(
|
||||
libraryDependencies ++= Dependencies.osgiDiningHakkerSampleCommand
|
||||
)
|
||||
) dependsOn (osgiDiningHakkersSampleApi, actor)
|
||||
|
||||
|
||||
lazy val osgiDiningHakkersSampleCore = Project(id = "akka-sample-osgi-dining-hakkers-core",
|
||||
base = file("akka-samples/akka-sample-osgi-dining-hakkers/core"),
|
||||
settings = sampleSettings ++ OSGi.osgiDiningHakkersSampleCore ++ Seq(
|
||||
libraryDependencies ++= Dependencies.osgiDiningHakkerSampleCore
|
||||
)
|
||||
) dependsOn (osgiDiningHakkersSampleApi, actor, remote, cluster, osgi)
|
||||
|
||||
//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"),
|
||||
settings = sampleSettings ++ OSGi.osgiDiningHakkersSampleUncommons ++ Seq(
|
||||
libraryDependencies ++= Dependencies.uncommons,
|
||||
version := "1.2.2"
|
||||
)
|
||||
)
|
||||
|
||||
lazy val docs = Project(
|
||||
id = "akka-docs",
|
||||
base = file("akka-docs"),
|
||||
|
|
@ -800,6 +839,14 @@ object AkkaBuild extends Build {
|
|||
OsgiKeys.importPackage := (osgiOptionalImports map optionalResolution) ++ Seq("!sun.misc", scalaImport(),configImport(), "*")
|
||||
)
|
||||
|
||||
val osgiDiningHakkersSampleApi = exports(Seq("akka.sample.osgi.api"))
|
||||
|
||||
val osgiDiningHakkersSampleCommand = osgiSettings ++ Seq(OsgiKeys.bundleActivator := Option("akka.sample.osgi.command.Activator"), OsgiKeys.privatePackage := Seq("akka.sample.osgi.command"))
|
||||
|
||||
val osgiDiningHakkersSampleCore = exports(Seq("")) ++ Seq(OsgiKeys.bundleActivator := Option("akka.sample.osgi.activation.Activator"), OsgiKeys.privatePackage := Seq("akka.sample.osgi.internal", "akka.sample.osgi.activation", "akka.sample.osgi.service"))
|
||||
|
||||
val osgiDiningHakkersSampleUncommons = exports(Seq("org.uncommons.maths.random")) ++ Seq(OsgiKeys.privatePackage := Seq("org.uncommons.maths.binary", "org.uncommons.maths", "org.uncommons.maths.number"))
|
||||
|
||||
val osgiAries = exports() ++ Seq(OsgiKeys.privatePackage := Seq("akka.osgi.aries.*"))
|
||||
|
||||
val remote = exports(Seq("akka.remote.*"), imports = Seq(protobufImport()))
|
||||
|
|
@ -870,8 +917,8 @@ object Dependencies {
|
|||
// Camel Sample
|
||||
val camelJetty = "org.apache.camel" % "camel-jetty" % camelCore.revision // ApacheV2
|
||||
|
||||
// Cluster Sample
|
||||
val sigar = "org.fusesource" % "sigar" % "1.6.4" // ApacheV2
|
||||
// Cluster Sample //TODO check for fusesource
|
||||
val sigar = "org.hyperic" % "sigar" % "1.6.4" // ApacheV2
|
||||
|
||||
// Test
|
||||
|
||||
|
|
@ -925,7 +972,13 @@ object Dependencies {
|
|||
|
||||
val osgi = Seq(osgiCore, osgiCompendium, Test.logback, Test.commonsIo, Test.pojosr, Test.tinybundles, Test.scalatest, Test.junit)
|
||||
|
||||
val osgiAries = Seq(osgiCore, ariesBlueprint, Test.ariesProxy)
|
||||
val osgiDiningHakkerSampleCore = Seq(config, osgiCore, osgiCompendium)
|
||||
|
||||
val osgiDiningHakkerSampleCommand = Seq(osgiCore, osgiCompendium)
|
||||
|
||||
val uncommons = Seq(uncommonsMath)
|
||||
|
||||
val osgiAries = Seq(osgiCore, osgiCompendium, ariesBlueprint, Test.ariesProxy)
|
||||
|
||||
val docs = Seq(Test.scalatest, Test.junit, Test.junitIntf)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,124 +0,0 @@
|
|||
/*
|
||||
Copyright 2013 Crossing-Tech
|
||||
|
||||
Licensed 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.
|
||||
*/
|
||||
import sbt._
|
||||
import Keys._
|
||||
import com.typesafe.sbt.osgi.SbtOsgi.{OsgiKeys, osgiSettings}
|
||||
|
||||
|
||||
object OsgiSampleBuild extends Build {
|
||||
|
||||
override lazy val settings =
|
||||
super.settings ++
|
||||
buildSettings ++
|
||||
Seq(
|
||||
shellPrompt := {
|
||||
s => Project.extract(s).currentProject.id + " > "
|
||||
}
|
||||
)
|
||||
|
||||
lazy val buildSettings = Seq(
|
||||
scalaVersion := "2.10.0",
|
||||
resolvers ++= Seq("oss-sonatype-releases" at "https://oss.sonatype.org/content/repositories/releases",
|
||||
"JBoss Repo" at "http://repository.jboss.org/nexus/content/groups/public/",
|
||||
"Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/"),
|
||||
version := "2.2.0-SNAPSHOT"
|
||||
)
|
||||
|
||||
|
||||
lazy val root = Project(id = "osgi-sample",
|
||||
base = file("."),
|
||||
settings = Project.defaultSettings ++ Seq(
|
||||
libraryDependencies ++= Seq()
|
||||
)
|
||||
) aggregate(api, command, core, uncommons)
|
||||
|
||||
lazy val api = Project(id = "api",
|
||||
base = file("./api"),
|
||||
settings = Project.defaultSettings ++ exports(Seq("akka.osgi.sample.api")) ++ Seq(libraryDependencies ++= Seq(Dependencies.akka_actor))
|
||||
)
|
||||
|
||||
lazy val command = Project(id = "command",
|
||||
base = file("./command"),
|
||||
settings = Project.defaultSettings ++ exports(Seq("akka.osgi.sample.command"), Seq("akka.osgi.sample.api", "org.osgi.framework")) ++ Seq(
|
||||
libraryDependencies ++= Dependencies.command,
|
||||
OsgiKeys.bundleActivator := Option("akka.osgi.sample.command.Activator")
|
||||
)
|
||||
) dependsOn (api)
|
||||
|
||||
|
||||
lazy val core = Project(id = "core",
|
||||
base = file("./core"),
|
||||
settings = Project.defaultSettings ++ exports(Seq("akka.osgi.sample.service", "akka.osgi.sample.activation"), defaultImports, Seq("akka.osgi.sample.internal")) ++ Seq(
|
||||
libraryDependencies ++= Dependencies.core,
|
||||
OsgiKeys.bundleActivator := Option("akka.osgi.sample.activation.Activator")
|
||||
)
|
||||
) dependsOn (api)
|
||||
|
||||
lazy val uncommons = Project(id = "uncommons",
|
||||
base = file("./uncommons"),
|
||||
settings = Project.defaultSettings ++ exports(Seq("org.uncommons.maths.random"), privates = Seq("org.uncommons.maths.binary", "org.uncommons.maths", "org.uncommons.maths.number")) ++ Seq(
|
||||
libraryDependencies ++= Dependencies.uncommons,
|
||||
version := "1.2.2"
|
||||
)
|
||||
)
|
||||
|
||||
def exports(packages: Seq[String] = Seq(), imports: Seq[String] = Nil, privates: Seq[String] = Nil) = osgiSettings ++ Seq(
|
||||
OsgiKeys.importPackage := imports ++ Seq("*"),
|
||||
OsgiKeys.privatePackage := privates,
|
||||
OsgiKeys.exportPackage := packages
|
||||
)
|
||||
|
||||
def copyFile(source: String, sink: String){
|
||||
val src = new java.io.File(source)
|
||||
val dest = new java.io.File(sink)
|
||||
new java.io.FileOutputStream(dest) getChannel() transferFrom(
|
||||
new java.io.FileInputStream(src) getChannel, 0, Long.MaxValue )
|
||||
}
|
||||
|
||||
|
||||
def defaultImports = Seq("!sun.misc", akkaImport(), configImport(), scalaImport())
|
||||
|
||||
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 scalaImport(packageName: String = "scala.*") = "%s;version=\"[2.10,2.11)\"".format(packageName)
|
||||
|
||||
}
|
||||
|
||||
object Dependencies {
|
||||
val akka_actor = "com.typesafe.akka" % "akka-actor_2.10" % "2.2-SNAPSHOT"
|
||||
val akka_osgi = "com.typesafe.akka" % "akka-osgi_2.10" % "2.2-SNAPSHOT" exclude("org.osgi.core", "org.osgi.compendium")
|
||||
val akka_remote = "com.typesafe.akka" % "akka-remote_2.10" % "2.2-SNAPSHOT"
|
||||
val akka_cluster = "com.typesafe.akka" % "akka-cluster-experimental_2.10" % "2.2-SNAPSHOT"
|
||||
val config = "com.typesafe" % "config" % "1.0.0"
|
||||
|
||||
val osgiCore = "org.osgi" % "org.osgi.core" % "4.3.0"
|
||||
val osgiCompendium = "org.osgi" % "org.osgi.compendium" % "4.3.0"
|
||||
val core = Seq(akka_actor, akka_osgi, akka_remote, akka_cluster, config, osgiCore, osgiCompendium)
|
||||
val command = Seq(akka_actor, osgiCore, osgiCompendium)
|
||||
|
||||
val uncommons_math = "org.uncommons.maths" % "uncommons-maths" % "1.2.2"
|
||||
val jcommon = "jfree" % "jcommon" % "1.0.16"
|
||||
val jfreechart = "jfree" % "jfreechart" % "1.0.13"
|
||||
val uncommons = Seq(uncommons_math, jcommon, jfreechart)
|
||||
|
||||
val protobuf = "com.google.protobuf" % "protobuf-java" % "2.4.1"
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -8,7 +8,7 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-multi-jvm" % "0.3.5")
|
|||
|
||||
addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.0.0")
|
||||
|
||||
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.7.0-M1")
|
||||
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.6.2")
|
||||
|
||||
addSbtPlugin("com.typesafe.sbtosgi" % "sbtosgi" % "0.3.0")
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>osgi-sample</artifactId>
|
||||
<groupId>com.typesafe.akka</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<groupId>com.typesafe.akka.akka-sample.akka-sample-osgi-dining-hakkers</groupId>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
<!--
|
||||
Note that 1.2.3 of uncommons-maths has OSGi meta-data, see https://www.assembla.com/spaces/akka/tickets/2990
|
||||
Once that is available, this module can be removed.
|
||||
@see ticket #2990
|
||||
-->
|
||||
|
||||
<artifactId>uncommons</artifactId>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue