Search in sources :

Example 1 with CapabilitiesProvisioning

use of io.joynr.capabilities.CapabilitiesProvisioning 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));
}
Also used : DiscoveryEntry(joynr.types.DiscoveryEntry) CapabilityCallback(io.joynr.capabilities.CapabilityCallback) ArrayList(java.util.ArrayList) CapabilitiesProvisioning(io.joynr.capabilities.CapabilitiesProvisioning) DiscoveryQos(io.joynr.arbitration.DiscoveryQos) Version(joynr.types.Version) InvocationOnMock(org.mockito.invocation.InvocationOnMock) DiscoveryEntryWithMetaInfo(joynr.types.DiscoveryEntryWithMetaInfo) ProviderQos(joynr.types.ProviderQos) Before(org.junit.Before)

Aggregations

DiscoveryQos (io.joynr.arbitration.DiscoveryQos)1 CapabilitiesProvisioning (io.joynr.capabilities.CapabilitiesProvisioning)1 CapabilityCallback (io.joynr.capabilities.CapabilityCallback)1 ArrayList (java.util.ArrayList)1 DiscoveryEntry (joynr.types.DiscoveryEntry)1 DiscoveryEntryWithMetaInfo (joynr.types.DiscoveryEntryWithMetaInfo)1 ProviderQos (joynr.types.ProviderQos)1 Version (joynr.types.Version)1 Before (org.junit.Before)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1