Search in sources :

Example 6 with TableSpaceActor

use of org.nustaq.reallive.impl.tablespace.TableSpaceActor in project kontraktor by RuedigerMoeller.

the class TableSpaceTest method simpleRemote.

@Test
public void simpleRemote() {
    TableSpaceActor ts = startServer();
    Assert.assertTrue(runSimpleTest(ts, () -> createTableDescription()) == EXPECT_SIMPLECOUNT);
    ts.close();
    ts.shutDown().await();
}
Also used : TableSpaceActor(org.nustaq.reallive.impl.tablespace.TableSpaceActor) Test(org.junit.Test)

Example 7 with TableSpaceActor

use of org.nustaq.reallive.impl.tablespace.TableSpaceActor in project kontraktor by RuedigerMoeller.

the class TableSpaceTest method startShardServer.

@Test
public void startShardServer() throws InterruptedException {
    startServer();
    TableSpaceActor ts = Actors.AsActor(TableSpaceActor.class);
    ts.init();
    new TCPNIOPublisher(ts, 5433).publish(actor -> System.out.println("sidconnected: " + actor));
    Thread.sleep(1000000);
}
Also used : TableSpaceActor(org.nustaq.reallive.impl.tablespace.TableSpaceActor) TCPNIOPublisher(org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher) Test(org.junit.Test)

Example 8 with TableSpaceActor

use of org.nustaq.reallive.impl.tablespace.TableSpaceActor in project kontraktor by RuedigerMoeller.

the class TableSpaceTest method simpleSharded.

@Test
public void simpleSharded() {
    TableSpaceActor[] spaces = { Actors.AsActor(TableSpaceActor.class), Actors.AsActor(TableSpaceActor.class) };
    for (int i = 0; i < spaces.length; i++) {
        TableSpaceActor space = spaces[i];
        space.init();
    }
    TableSpaceSharding ts = new TableSpaceSharding(spaces, key -> Math.abs(key.hashCode()) % spaces.length);
    Assert.assertTrue(runSimpleTest(ts, () -> createShardedTableDescription()) == EXPECT_SIMPLECOUNT);
    ts.shutDown().await();
}
Also used : TableSpaceSharding(org.nustaq.reallive.impl.tablespace.TableSpaceSharding) TableSpaceActor(org.nustaq.reallive.impl.tablespace.TableSpaceActor) Test(org.junit.Test)

Example 9 with TableSpaceActor

use of org.nustaq.reallive.impl.tablespace.TableSpaceActor in project kontraktor by RuedigerMoeller.

the class TableSpaceTest method simpleShardedNoServer.

@Test
public void simpleShardedNoServer() {
    TableSpaceActor[] spaces = { null, null };
    spaces[0] = (TableSpaceActor) new TCPConnectable(TableSpaceActor.class, "localhost", 5432).connect((disc, err) -> System.out.println("client disc " + disc + " " + err)).await();
    spaces[1] = (TableSpaceActor) new TCPConnectable(TableSpaceActor.class, "localhost", 5433).connect((disc, err) -> System.out.println("client disc " + disc + " " + err)).await();
    for (int i = 0; i < spaces.length; i++) {
        TableSpaceActor space = spaces[i];
        space.init();
    }
    TableSpaceSharding ts = new TableSpaceSharding(spaces, key -> Math.abs(key.hashCode()) % spaces.length);
    Assert.assertTrue(runSimpleTest(ts, () -> createShardedTableDescription()) == EXPECT_SIMPLECOUNT);
    ts.shutDown().await();
}
Also used : TCPConnectable(org.nustaq.kontraktor.remoting.tcp.TCPConnectable) IntStream(java.util.stream.IntStream) org.nustaq.reallive.api(org.nustaq.reallive.api) Ignore(org.junit.Ignore) TableSpaceActor(org.nustaq.reallive.impl.tablespace.TableSpaceActor) Assert(junit.framework.Assert) TableSpaceSharding(org.nustaq.reallive.impl.tablespace.TableSpaceSharding) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Actors(org.nustaq.kontraktor.Actors) TCPNIOPublisher(org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher) Test(org.junit.Test) Supplier(java.util.function.Supplier) TCPConnectable(org.nustaq.kontraktor.remoting.tcp.TCPConnectable) TableSpaceSharding(org.nustaq.reallive.impl.tablespace.TableSpaceSharding) TableSpaceActor(org.nustaq.reallive.impl.tablespace.TableSpaceActor) Test(org.junit.Test)

Example 10 with TableSpaceActor

use of org.nustaq.reallive.impl.tablespace.TableSpaceActor in project kontraktor by RuedigerMoeller.

the class TableSpaceTest method startServer.

public TableSpaceActor startServer() {
    TableSpaceActor ts = Actors.AsActor(TableSpaceActor.class);
    ts.init();
    new TCPNIOPublisher(ts, 5432).publish(actor -> System.out.println("sidconnected: " + actor));
    return ts;
}
Also used : TableSpaceActor(org.nustaq.reallive.impl.tablespace.TableSpaceActor) TCPNIOPublisher(org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher)

Aggregations

TableSpaceActor (org.nustaq.reallive.impl.tablespace.TableSpaceActor)11 Test (org.junit.Test)7 Actors (org.nustaq.kontraktor.Actors)3 IPromise (org.nustaq.kontraktor.IPromise)3 Promise (org.nustaq.kontraktor.Promise)3 TCPNIOPublisher (org.nustaq.kontraktor.remoting.tcp.TCPNIOPublisher)3 RealLiveTable (org.nustaq.reallive.api.RealLiveTable)3 TableSpaceSharding (org.nustaq.reallive.impl.tablespace.TableSpaceSharding)3 CountDownLatch (java.util.concurrent.CountDownLatch)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 IntStream (java.util.stream.IntStream)2 TCPConnectable (org.nustaq.kontraktor.remoting.tcp.TCPConnectable)2 org.nustaq.reallive.api (org.nustaq.reallive.api)2 FSTConfiguration (org.nustaq.serialization.FSTConfiguration)2 java.io (java.io)1 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 TimeUnit (java.util.concurrent.TimeUnit)1