use of joynr.tests.testBroadcastInterface.LocationUpdateSelectiveBroadcastFilterParameters in project joynr by bmwcarit.
the class AbstractBroadcastEnd2EndTest method subscribeToSelectiveBroadcast_FilterFalse.
@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void subscribeToSelectiveBroadcast_FilterFalse() throws InterruptedException {
final Semaphore broadcastReceived = new Semaphore(0);
final LocationUpdateSelectiveBroadcastFilterParameters testFilterParameters = new LocationUpdateSelectiveBroadcastFilterParameters();
testFilterParameters.setCountry("Germany");
testFilterParameters.setStartTime("4.00 pm");
testLocationUpdateSelectiveBroadcastFilter filter1 = new testLocationUpdateSelectiveBroadcastFilter() {
@Override
public boolean filter(GpsLocation location, LocationUpdateSelectiveBroadcastFilterParameters filterParameters) {
assertEquals(testFilterParameters, filterParameters);
return true;
}
};
testLocationUpdateSelectiveBroadcastFilter filter2 = new testLocationUpdateSelectiveBroadcastFilter() {
@Override
public boolean filter(GpsLocation location, LocationUpdateSelectiveBroadcastFilterParameters filterParameters) {
assertEquals(testFilterParameters, filterParameters);
return false;
}
};
getSubscriptionTestsPublisher().addBroadcastFilter(filter1);
getSubscriptionTestsPublisher().addBroadcastFilter(filter2);
OnChangeSubscriptionQos subscriptionQos = createDefaultOnChangeSubscriptionQos();
proxy.subscribeToLocationUpdateSelectiveBroadcast(new testBroadcastInterface.LocationUpdateSelectiveBroadcastAdapter() {
@Override
public void onReceive(GpsLocation location) {
assertEquals(expectedLocation, location);
broadcastReceived.release();
}
}, subscriptionQos, testFilterParameters);
Thread.sleep(300);
provider.fireLocationUpdateSelective(expectedLocation);
assertFalse(broadcastReceived.tryAcquire(500, TimeUnit.MILLISECONDS));
}
use of joynr.tests.testBroadcastInterface.LocationUpdateSelectiveBroadcastFilterParameters in project joynr by bmwcarit.
the class AbstractBroadcastEnd2EndTest method subscribeToSelectiveBroadcast_FilterTrue.
@Test(timeout = CONST_DEFAULT_TEST_TIMEOUT)
public void subscribeToSelectiveBroadcast_FilterTrue() throws InterruptedException {
final Semaphore broadcastReceived = new Semaphore(0);
final LocationUpdateSelectiveBroadcastFilterParameters testFilterParameters = new LocationUpdateSelectiveBroadcastFilterParameters();
testFilterParameters.setCountry("Germany");
testFilterParameters.setStartTime("4.00 pm");
testLocationUpdateSelectiveBroadcastFilter filter1 = new testLocationUpdateSelectiveBroadcastFilter() {
@Override
public boolean filter(GpsLocation location, LocationUpdateSelectiveBroadcastFilterParameters filterParameters) {
assertEquals(testFilterParameters, filterParameters);
return true;
}
};
testLocationUpdateSelectiveBroadcastFilter filter2 = new testLocationUpdateSelectiveBroadcastFilter() {
@Override
public boolean filter(GpsLocation location, LocationUpdateSelectiveBroadcastFilterParameters filterParameters) {
assertEquals(testFilterParameters, filterParameters);
return true;
}
};
getSubscriptionTestsPublisher().addBroadcastFilter(filter1);
getSubscriptionTestsPublisher().addBroadcastFilter(filter2);
OnChangeSubscriptionQos subscriptionQos = createDefaultOnChangeSubscriptionQos();
proxy.subscribeToLocationUpdateSelectiveBroadcast(new testBroadcastInterface.LocationUpdateSelectiveBroadcastAdapter() {
@Override
public void onReceive(GpsLocation location) {
assertEquals(expectedLocation, location);
broadcastReceived.release();
}
}, subscriptionQos, testFilterParameters);
Thread.sleep(300);
provider.fireLocationUpdateSelective(expectedLocation);
broadcastReceived.acquire();
}
Aggregations