Reorganized tests into matching subfolders.
Signed-off-by: Jonas Bonér <jonas@jonasboner.com>
This commit is contained in:
parent
a0abd5ef57
commit
15addf2b87
49 changed files with 24 additions and 706 deletions
|
|
@ -1,94 +0,0 @@
|
|||
/**
|
||||
* Copyright (C) 2009-2011 Scalable Solutions AB <http://scalablesolutions.se>
|
||||
*/
|
||||
|
||||
package sample.cluster
|
||||
|
||||
import akka.cluster._
|
||||
import akka.dispatch.Futures
|
||||
|
||||
/**
|
||||
* @author <a href="http://jonasboner.com">Jonas Bonér</a>
|
||||
*/
|
||||
object ClusteredFunctions {
|
||||
//sample.cluster.ClusteredFunctions.fun2
|
||||
|
||||
// FIXME rewrite as multi-jvm test
|
||||
|
||||
/*
|
||||
// run all
|
||||
def run {
|
||||
fun1
|
||||
fun2
|
||||
fun3
|
||||
fun4
|
||||
}
|
||||
|
||||
// Send Function0[Unit]
|
||||
def fun1 = {
|
||||
Cluster.startLocalCluster()
|
||||
val node = Cluster newNode (NodeAddress("test", "local", port = 9991)) start
|
||||
val remote1 = Cluster newNode (NodeAddress("test", "remote1", port = 9992)) start
|
||||
|
||||
Thread.sleep(100)
|
||||
val fun = () ⇒ println("=============>>> AKKA ROCKS <<<=============")
|
||||
node send (fun, 2) // send and invoke function on to two cluster nodes
|
||||
|
||||
node.stop
|
||||
remote1.stop
|
||||
Cluster.shutdownLocalCluster()
|
||||
}
|
||||
|
||||
// Send Function0[Any]
|
||||
def fun2 = {
|
||||
Cluster.startLocalCluster()
|
||||
val local = Cluster newNode (NodeAddress("test", "local", port = 9991)) start
|
||||
val remote1 = Cluster newNode (NodeAddress("test", "remote1", port = 9992)) start
|
||||
|
||||
Thread.sleep(100)
|
||||
val fun = () ⇒ "AKKA ROCKS"
|
||||
val futures = local send (fun, 2) // send and invoke function on to two cluster nodes and get result
|
||||
|
||||
val result = Futures.fold("")(futures)(_ + " - " + _).await.resultOrException
|
||||
println("===================>>> Cluster says [" + result + "]")
|
||||
|
||||
local.stop
|
||||
remote1.stop
|
||||
Cluster.shutdownLocalCluster()
|
||||
}
|
||||
|
||||
// Send Function1[Any, Unit]
|
||||
def fun3 = {
|
||||
Cluster.startLocalCluster()
|
||||
val local = Cluster newNode (NodeAddress("test", "local", port = 9991)) start
|
||||
val remote1 = Cluster newNode (NodeAddress("test", "remote1", port = 9992)) start
|
||||
|
||||
val fun = ((s: String) ⇒ println("=============>>> " + s + " <<<=============")).asInstanceOf[Function1[Any, Unit]]
|
||||
local send (fun, "AKKA ROCKS", 2) // send and invoke function on to two cluster nodes
|
||||
|
||||
local.stop
|
||||
remote1.stop
|
||||
Cluster.shutdownLocalCluster()
|
||||
}
|
||||
|
||||
// Send Function1[Any, Any]
|
||||
def fun4 = {
|
||||
Cluster.startLocalCluster()
|
||||
val local = Cluster newNode (NodeAddress("test", "local", port = 9991)) start
|
||||
val remote1 = Cluster newNode (NodeAddress("test", "remote1", port = 9992)) start
|
||||
|
||||
val fun = ((i: Int) ⇒ i * i).asInstanceOf[Function1[Any, Any]]
|
||||
|
||||
val future1 = local send (fun, 2, 1) head // send and invoke function on one cluster node and get result
|
||||
val future2 = local send (fun, 2, 1) head // send and invoke function on one cluster node and get result
|
||||
|
||||
// grab the result from the first one that returns
|
||||
val result = Futures.firstCompletedOf(List(future1, future2)).await.resultOrException
|
||||
println("===================>>> Cluster says [" + result.get + "]")
|
||||
|
||||
local.stop
|
||||
remote1.stop
|
||||
Cluster.shutdownLocalCluster()
|
||||
}
|
||||
*/
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue