use of io.joynr.capabilities.CapabilityCallback in project joynr by bmwcarit.
the class AccessControllerTest method setup.
@Before
public void setup() {
String discoveryProviderParticipantId = "";
String routingProviderParticipantId = "";
accessController = new AccessControllerImpl(localCapabilitiesDirectory, localDomainAccessController, new CapabilitiesProvisioning() {
@Override
public Collection<DiscoveryEntry> getDiscoveryEntries() {
return new ArrayList<DiscoveryEntry>();
}
}, discoveryProviderParticipantId, routingProviderParticipantId);
when(messageMock.getType()).thenReturn(Message.VALUE_MESSAGE_TYPE_REQUEST);
when(messageMock.getRecipient()).thenReturn(toParticipantId);
when(messageMock.getSender()).thenReturn(fromParticipantId);
when(messageMock.getCreatorUserId()).thenReturn(DUMMY_USERID);
when(messageMock.getId()).thenReturn("someId");
final DiscoveryEntryWithMetaInfo discoveryEntry = new DiscoveryEntryWithMetaInfo(new Version(47, 11), testDomain, testInterface, toParticipantId, new ProviderQos(), System.currentTimeMillis(), System.currentTimeMillis() + ONE_MINUTE_IN_MS, testPublicKeyId, false);
doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
CapabilityCallback callback = (CapabilityCallback) invocation.getArguments()[2];
callback.processCapabilityReceived(discoveryEntry);
return null;
}
}).when(localCapabilitiesDirectory).lookup(eq(toParticipantId), any(DiscoveryQos.class), any(CapabilityCallback.class));
}
Aggregations