Search in sources :

Example 26 with ControlledBounceProxyInformation

use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.

the class RemoteBounceProxyFacadeTest method testBounceProxyReturnsUnexpectedBounceProxyId.

@Test
public void testBounceProxyReturnsUnexpectedBounceProxyId() throws Exception {
    setMockedHttpRequestHandlerResponse(HttpStatus.SC_CREATED, "http://www.joynX.de/channels", "A.B");
    ControlledBounceProxyInformation bpInfo = new ControlledBounceProxyInformation("X.Y", URI.create(serverUrl));
    try {
        bpFacade.createChannel(bpInfo, "channel-123", "trackingId-123");
        Assert.fail();
    } catch (JoynrProtocolException e) {
    }
    Mockito.verify(handler).handle(Mockito.argThat(new IsCreateChannelHttpRequest("channel-123", "trackingId-123")), Mockito.any(HttpResponse.class), Mockito.any(HttpContext.class));
}
Also used : JoynrProtocolException(io.joynr.messaging.bounceproxy.controller.exception.JoynrProtocolException) HttpContext(org.apache.http.protocol.HttpContext) ControlledBounceProxyInformation(io.joynr.messaging.info.ControlledBounceProxyInformation) IsCreateChannelHttpRequest(io.joynr.messaging.bounceproxy.IsCreateChannelHttpRequest) HttpResponse(org.apache.http.HttpResponse) Test(org.junit.Test)

Example 27 with ControlledBounceProxyInformation

use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.

the class RemoteBounceProxyFacadeTest method testSuccessfulChannelCreation.

@Test
public void testSuccessfulChannelCreation() throws Exception {
    setMockedHttpRequestHandlerResponse(HttpStatus.SC_CREATED, "http://www.joynX.de/channels", "X.Y");
    ControlledBounceProxyInformation bpInfo = new ControlledBounceProxyInformation("X.Y", URI.create(serverUrl));
    URI channelUri = bpFacade.createChannel(bpInfo, "channel-123", "trackingId-123");
    Mockito.verify(handler).handle(Mockito.argThat(new IsCreateChannelHttpRequest("channel-123", "trackingId-123")), Mockito.any(HttpResponse.class), Mockito.any(HttpContext.class));
    Assert.assertEquals("http://www.joynX.de/channels", channelUri.toString());
}
Also used : HttpContext(org.apache.http.protocol.HttpContext) ControlledBounceProxyInformation(io.joynr.messaging.info.ControlledBounceProxyInformation) IsCreateChannelHttpRequest(io.joynr.messaging.bounceproxy.IsCreateChannelHttpRequest) HttpResponse(org.apache.http.HttpResponse) URI(java.net.URI) Test(org.junit.Test)

Example 28 with ControlledBounceProxyInformation

use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.

the class RoundRobinAssignmentTest method createBounceProxyRecord.

private BounceProxyRecord createBounceProxyRecord(String bpId) {
    ControlledBounceProxyInformation bpInfo = new ControlledBounceProxyInformation(bpId, null);
    BounceProxyRecord record = new BounceProxyRecord(bpInfo);
    return record;
}
Also used : BounceProxyRecord(io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord) ControlledBounceProxyInformation(io.joynr.messaging.info.ControlledBounceProxyInformation)

Example 29 with ControlledBounceProxyInformation

use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.

the class MonitoringServiceImplTest method testResetBounceProxy.

@Test
public void testResetBounceProxy() {
    Mockito.when(bpDirectoryMock.containsBounceProxy("X.Y")).thenReturn(true);
    Mockito.when(bpDirectoryMock.getBounceProxy("X.Y")).thenReturn(new BounceProxyRecord(new ControlledBounceProxyInformation("X.Y", null)));
    monitoringService.update("X.Y", "http://www.joynX.de/bp", "http://joyn.some-internal-server.de/bpX");
    ArgumentCaptor<BounceProxyRecord> argument = ArgumentCaptor.forClass(BounceProxyRecord.class);
    Mockito.verify(bpDirectoryMock).updateBounceProxy(argument.capture());
    Assert.assertEquals("X.Y", argument.getValue().getBounceProxyId());
    Assert.assertEquals("http://www.joynX.de/bp", argument.getValue().getInfo().getLocation().toString());
    Assert.assertEquals("http://joyn.some-internal-server.de/bpX", argument.getValue().getInfo().getLocationForBpc().toString());
    Assert.assertEquals(BounceProxyStatus.ALIVE, argument.getValue().getStatus());
}
Also used : BounceProxyRecord(io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord) ControlledBounceProxyInformation(io.joynr.messaging.info.ControlledBounceProxyInformation) Test(org.junit.Test)

Example 30 with ControlledBounceProxyInformation

use of io.joynr.messaging.info.ControlledBounceProxyInformation in project joynr by bmwcarit.

the class ControlledBounceProxyInformationTest method testNotEqualsForNull.

@Test
public void testNotEqualsForNull() {
    ControlledBounceProxyInformation bpInfo1 = new ControlledBounceProxyInformation("X", "Y", URI.create("http://www.joynX.de"), URI.create("http://joynX.bmwgroup.net"));
    Assert.assertFalse(bpInfo1.equals(null));
}
Also used : ControlledBounceProxyInformation(io.joynr.messaging.info.ControlledBounceProxyInformation) Test(org.junit.Test)

Aggregations

ControlledBounceProxyInformation (io.joynr.messaging.info.ControlledBounceProxyInformation)47 Test (org.junit.Test)44 BounceProxyRecord (io.joynr.messaging.bounceproxy.controller.directory.BounceProxyRecord)13 IsCreateChannelHttpRequest (io.joynr.messaging.bounceproxy.IsCreateChannelHttpRequest)5 JoynrProtocolException (io.joynr.messaging.bounceproxy.controller.exception.JoynrProtocolException)5 BounceProxyStatusInformation (io.joynr.messaging.info.BounceProxyStatusInformation)5 Channel (io.joynr.messaging.info.Channel)5 HttpResponse (org.apache.http.HttpResponse)5 HttpContext (org.apache.http.protocol.HttpContext)5 URI (java.net.URI)4 BounceProxyInformation (io.joynr.messaging.info.BounceProxyInformation)2 BounceProxyStatus (io.joynr.messaging.info.BounceProxyStatus)2 PerformanceMeasures (io.joynr.messaging.info.PerformanceMeasures)2 JoynrCommunicationException (io.joynr.exceptions.JoynrCommunicationException)1 JoynrRuntimeException (io.joynr.exceptions.JoynrRuntimeException)1 IOException (java.io.IOException)1 EntityManager (javax.persistence.EntityManager)1 EntityTransaction (javax.persistence.EntityTransaction)1 Query (javax.persistence.Query)1 HttpException (org.apache.http.HttpException)1