use of io.joynr.dispatching.rpc.ReplyCallerDirectory in project joynr by bmwcarit.
the class RequestReplyManagerTest method setUp.
@Before
public void setUp() throws NoSuchMethodException, SecurityException, JsonGenerationException, IOException {
requestCallerFactory = new RequestCallerFactory();
testOneWayRecipientParticipantId = "testOneWayRecipientParticipantId";
testOneWayRecipientDiscoveryEntry = new DiscoveryEntryWithMetaInfo();
testOneWayRecipientDiscoveryEntry.setParticipantId(testOneWayRecipientParticipantId);
testOneWayRecipientDiscoveryEntries = Sets.newHashSet(testOneWayRecipientDiscoveryEntry);
testMessageResponderParticipantId = "testMessageResponderParticipantId";
testMessageResponderDiscoveryEntry = new DiscoveryEntryWithMetaInfo();
testMessageResponderDiscoveryEntry.setParticipantId(testMessageResponderParticipantId);
testSenderParticipantId = "testSenderParticipantId";
testResponderUnregisteredParticipantId = "testResponderUnregisteredParticipantId";
Injector injector = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
install(new JoynrMessageScopeModule());
bind(MessageSender.class).toInstance(messageSenderMock);
bind(MessageRouter.class).toInstance(messageRouterMock);
bind(RequestReplyManager.class).to(RequestReplyManagerImpl.class);
requestStaticInjection(RpcUtils.class, Request.class, JoynrMessagingConnectorFactory.class);
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("joynr.Cleanup-%d").build();
ScheduledExecutorService cleanupExecutor = Executors.newSingleThreadScheduledExecutor(namedThreadFactory);
bind(ScheduledExecutorService.class).annotatedWith(Names.named(JOYNR_SCHEDULER_CLEANUP)).toInstance(cleanupExecutor);
Multibinder.newSetBinder(binder(), new TypeLiteral<JoynrMessageProcessor>() {
});
}
});
objectMapper = injector.getInstance(ObjectMapper.class);
objectMapper.registerSubtypes(Request.class, OneWayRequest.class);
requestReplyManager = injector.getInstance(RequestReplyManager.class);
providerDirectory = injector.getInstance(ProviderDirectory.class);
replyCallerDirectory = injector.getInstance(ReplyCallerDirectory.class);
requestReplyManager = injector.getInstance(RequestReplyManager.class);
// dispatcher.addListener(testOneWayRecipientParticipantId, testListener);
// jsonRequestString1 = "{\"_typeName\":\"Request\", \"methodName\":\"respond\",\"params\":{\"payload\": \""
// + payload1 + "\"}}";
// jsonRequestString2 = "{\"_typeName\":\"Request\", \"methodName\":\"respond\",\"params\":{\"payload\": \""
// + payload2 + "\"}}";
Object[] params1 = new Object[] { payload1 };
Object[] params2 = new Object[] { payload2 };
// MethodMetaInformation methodMetaInformation = new
// MethodMetaInformation(TestRequestCaller.class.getMethod("respond", new Class[]{ Object.class }));
Method method = TestProvider.class.getMethod("methodWithStrings", new Class[] { String.class });
request1 = new Request(method.getName(), params1, method.getParameterTypes());
request2 = new Request(method.getName(), params2, method.getParameterTypes());
request3 = new Request("unknownMethodName", params2, method.getParameterTypes());
Method fireAndForgetMethod = TestOneWayRecipient.class.getMethod("fireAndForgetMethod", new Class[] { String.class });
oneWay1 = new OneWayRequest(fireAndForgetMethod.getName(), new Object[] { payload1 }, fireAndForgetMethod.getParameterTypes());
}
Aggregations