use of akka.actor.ActorSystem in project webofneeds by researchstudio-sat.
the class SolrTest method main.
public static void main(String[] args) throws IOException, InterruptedException {
// init basic Akka
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(MatcherSolrAppConfiguration.class);
ActorSystem system = ctx.getBean(ActorSystem.class);
ActorRef solrMatcherActor = system.actorOf(SpringExtension.SpringExtProvider.get(system).props(SolrMatcherActor.class), "SolrMatcherActor");
NeedEvent ne1 = createNeedEvent("/needmodel/need1.trig");
NeedEvent ne2 = createNeedEvent("/needmodel/need2.trig");
solrMatcherActor.tell(ne1, null);
Thread.sleep(5000);
solrMatcherActor.tell(ne2, null);
}
use of akka.actor.ActorSystem in project chuidiang-ejemplos by chuidiang.
the class Server1Main method main.
public static void main(String[] args) throws InterruptedException {
// Override the configuration of the port
// when specified as program argument
System.setProperty("akka.remote.netty.tcp.port", "5557");
// Create an Akka system
ActorSystem system = ActorSystem.create("ClusterSystem");
// Create an actor that handles cluster domain events
ActorRef subscriber = system.actorOf(Props.create(Subscriber.class), "subscriptor");
}
use of akka.actor.ActorSystem in project controller by opendaylight.
the class DataChangeListenerRegistrationProxyTest method testFailedRegistration.
@Test
public void testFailedRegistration() {
new TestKit(getSystem()) {
{
ActorSystem mockActorSystem = mock(ActorSystem.class);
ActorRef mockActor = getSystem().actorOf(Props.create(DoNothingActor.class), "testFailedRegistration");
doReturn(mockActor).when(mockActorSystem).actorOf(any(Props.class));
ExecutionContextExecutor executor = ExecutionContexts.fromExecutor(MoreExecutors.directExecutor());
ActorContext actorContext = mock(ActorContext.class);
doReturn(executor).when(actorContext).getClientDispatcher();
String shardName = "shard-1";
final DataChangeListenerRegistrationProxy proxy = new DataChangeListenerRegistrationProxy(shardName, actorContext, mockListener);
doReturn(mockActorSystem).when(actorContext).getActorSystem();
doReturn(duration("5 seconds")).when(actorContext).getOperationDuration();
doReturn(Futures.successful(getRef())).when(actorContext).findLocalShardAsync(eq(shardName));
doReturn(Futures.failed(new RuntimeException("mock"))).when(actorContext).executeOperationAsync(any(ActorRef.class), any(Object.class), any(Timeout.class));
doReturn(mock(DatastoreContext.class)).when(actorContext).getDatastoreContext();
proxy.init(YangInstanceIdentifier.of(TestModel.TEST_QNAME), AsyncDataBroker.DataChangeScope.ONE);
Assert.assertEquals("getListenerRegistrationActor", null, proxy.getListenerRegistrationActor());
proxy.close();
}
};
}
use of akka.actor.ActorSystem in project controller by opendaylight.
the class DataTreeChangeListenerProxyTest method testFailedRegistration.
@Test
public void testFailedRegistration() {
new TestKit(getSystem()) {
{
ActorSystem mockActorSystem = mock(ActorSystem.class);
ActorRef mockActor = getSystem().actorOf(Props.create(DoNothingActor.class), "testFailedRegistration");
doReturn(mockActor).when(mockActorSystem).actorOf(any(Props.class));
ExecutionContextExecutor executor = ExecutionContexts.fromExecutor(MoreExecutors.directExecutor());
ActorContext actorContext = mock(ActorContext.class);
final YangInstanceIdentifier path = YangInstanceIdentifier.of(TestModel.TEST_QNAME);
doReturn(executor).when(actorContext).getClientDispatcher();
doReturn(DatastoreContext.newBuilder().build()).when(actorContext).getDatastoreContext();
doReturn(mockActorSystem).when(actorContext).getActorSystem();
String shardName = "shard-1";
final DataTreeChangeListenerProxy<DOMDataTreeChangeListener> proxy = new DataTreeChangeListenerProxy<>(actorContext, mockListener, path);
doReturn(duration("5 seconds")).when(actorContext).getOperationDuration();
doReturn(Futures.successful(getRef())).when(actorContext).findLocalShardAsync(eq(shardName));
doReturn(Futures.failed(new RuntimeException("mock"))).when(actorContext).executeOperationAsync(any(ActorRef.class), any(Object.class), any(Timeout.class));
doReturn(mock(DatastoreContext.class)).when(actorContext).getDatastoreContext();
proxy.init("shard-1");
Assert.assertEquals("getListenerRegistrationActor", null, proxy.getListenerRegistrationActor());
proxy.close();
}
};
}
use of akka.actor.ActorSystem in project controller by opendaylight.
the class AbstractTest method newActorSystem.
protected ActorSystem newActorSystem(final String name, final String config) {
ActorSystem system = ActorSystem.create(name, ConfigFactory.load().getConfig(config));
actorSystems.add(system);
return system;
}
Aggregations