use of joynr.types.Localisation.GpsPosition in project joynr by bmwcarit.
the class ConnectorTest method subscriptionMethodCallWithNoExpiryDate.
@Test
public void subscriptionMethodCallWithNoExpiryDate() throws JoynrIllegalStateException {
ConnectorInvocationHandler connector = createConnector();
assertNotNull(connector);
try {
Future<String> future = new Future<String>();
String subscriptionId = "subscriptionId";
PeriodicSubscriptionQos subscriptionQos = new PeriodicSubscriptionQos();
subscriptionQos.setPeriodMs(1000).setExpiryDateMs(0).setAlertAfterIntervalMs(1000);
AttributeSubscriptionListener<GpsPosition> listener = new AttributeSubscriptionAdapter<GpsPosition>();
Object[] args = new Object[] { listener, subscriptionQos, subscriptionId };
Method method = LocalisationSubscriptionInterface.class.getDeclaredMethod("subscribeToGPSPosition", String.class, AttributeSubscriptionListener.class, SubscriptionQos.class);
AttributeSubscribeInvocation attributeSubscription = new AttributeSubscribeInvocation(method, args, future);
connector.executeSubscriptionMethod(attributeSubscription);
verify(subscriptionManager, times(1)).registerAttributeSubscription(eq(fromParticipantId), eq(Sets.newHashSet(toDiscoveryEntry)), eq(attributeSubscription));
} catch (Exception e) {
// This is what is supposed to happen -> no error handling
fail("Calling a subscription method with no expiry date throws an exception.");
}
}
use of joynr.types.Localisation.GpsPosition in project joynr by bmwcarit.
the class SerializationTest method serializePublication.
@Test
public void serializePublication() throws JsonGenerationException, JsonMappingException, IOException {
Object response = new GpsPosition(49.0065, 11.65);
String subscriptionId = "1234";
SubscriptionPublication publication = new SubscriptionPublication(Arrays.asList(response), subscriptionId);
String writeValueAsString = objectMapper.writeValueAsString(publication);
SubscriptionPublication receivedPublication = objectMapper.readValue(writeValueAsString, SubscriptionPublication.class);
Assert.assertEquals(publication, receivedPublication);
}
use of joynr.types.Localisation.GpsPosition in project joynr by bmwcarit.
the class SerializationTest method serializeMulticast.
@Test
public void serializeMulticast() throws JsonGenerationException, JsonMappingException, IOException {
Object response = new GpsPosition(49.0065, 11.65);
String multicastId = "1234";
MulticastPublication publication = new MulticastPublication(Arrays.asList(response), multicastId);
String writeValueAsString = objectMapper.writeValueAsString(publication);
MulticastPublication receivedPublication = objectMapper.readValue(writeValueAsString, MulticastPublication.class);
Assert.assertEquals(publication, receivedPublication);
}
use of joynr.types.Localisation.GpsPosition in project joynr by bmwcarit.
the class SerializationTest method serializeRequest.
@Test
public void serializeRequest() throws JsonGenerationException, JsonMappingException, IOException {
GpsPosition[] parameter = { new GpsPosition(49.0065, 11.65) };
Object[] parameters = { parameter };
Class<?>[] parameterTypes = { GpsPosition[].class };
Request request = new Request("updateRoute", parameters, parameterTypes);
String writeValueAsString = objectMapper.writeValueAsString(request);
Request receivedRequest = objectMapper.readValue(writeValueAsString, Request.class);
Assert.assertEquals(request, receivedRequest);
}
use of joynr.types.Localisation.GpsPosition in project joynr by bmwcarit.
the class SerializationTest method serializeReply.
@Test
public void serializeReply() throws JsonGenerationException, JsonMappingException, IOException {
Object response = new GpsPosition(49.0065, 11.65);
Reply reply = new Reply(UUID.randomUUID().toString(), response);
String writeValueAsString = objectMapper.writeValueAsString(reply);
System.out.println(writeValueAsString);
Reply receivedReply = objectMapper.readValue(writeValueAsString, Reply.class);
Assert.assertEquals(reply, receivedReply);
}
Aggregations