use of io.joynr.arbitration.DiscoveryQos in project joynr by bmwcarit.
the class AbstractSSLEnd2EndTest method setup.
@Before
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);
String methodName = name.getMethodName();
logger.info("{} setup beginning...", methodName);
domain = "SSLEnd2EndTest." + methodName + System.currentTimeMillis();
provisionPermissiveAccessControlEntry(domain, ProviderAnnotations.getInterfaceName(DefaulttestProvider.class));
// use channelNames = test name
String channelIdProvider = "JavaTest-" + methodName + UUID.randomUUID().getLeastSignificantBits() + "-end2endTestProvider";
String channelIdConsumer = "JavaTest-" + methodName + UUID.randomUUID().getLeastSignificantBits() + "-end2endConsumer";
Properties joynrConfigProvider = PropertyLoader.loadProperties("testMessaging.properties");
joynrConfigProvider.put(AbstractJoynrApplication.PROPERTY_JOYNR_DOMAIN_LOCAL, "localdomain." + UUID.randomUUID().toString());
joynrConfigProvider.put(MessagingPropertyKeys.CHANNELID, channelIdProvider);
joynrConfigProvider.put(MessagingPropertyKeys.RECEIVERID, UUID.randomUUID().toString());
providerRuntime = getRuntime(joynrConfigProvider, new StaticDomainAccessControlProvisioningModule());
Properties joynrConfigConsumer = PropertyLoader.loadProperties("testMessaging.properties");
joynrConfigConsumer.put(AbstractJoynrApplication.PROPERTY_JOYNR_DOMAIN_LOCAL, "localdomain." + UUID.randomUUID().toString());
joynrConfigConsumer.put(MessagingPropertyKeys.CHANNELID, channelIdConsumer);
joynrConfigConsumer.put(MessagingPropertyKeys.RECEIVERID, UUID.randomUUID().toString());
consumerRuntime = getRuntime(joynrConfigConsumer);
provider = new DefaulttestProvider();
ProviderQos providerQos = new ProviderQos();
providerRuntime.registerProvider(domain, provider, providerQos);
messagingQos = new MessagingQos(5000);
discoveryQos = new DiscoveryQos(5000, ArbitrationStrategy.HighestPriority, Long.MAX_VALUE);
// Make sure the channel is created before the first messages sent.
Thread.sleep(200);
logger.info("setup finished");
}
use of io.joynr.arbitration.DiscoveryQos in project joynr by bmwcarit.
the class AbstractSubscriptionEnd2EndTest method testSubscribeToNonExistentDomain.
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "NP_NULL_ON_SOME_PATH_EXCEPTION", justification = "NPE in test would fail test")
@SuppressWarnings("unchecked")
@Ignore
@Test
public void testSubscribeToNonExistentDomain() throws InterruptedException {
AttributeSubscriptionListener<Integer> integerListener = mock(AttributeSubscriptionListener.class);
testProxy proxyToNonexistentDomain = null;
try {
ProxyBuilder<testProxy> proxyBuilder;
String nonExistentDomain = UUID.randomUUID().toString() + "-domaindoesnotexist-end2end";
MessagingQos messagingQos = new MessagingQos(20000);
DiscoveryQos discoveryQos = new DiscoveryQos(50000, ArbitrationStrategy.HighestPriority, Long.MAX_VALUE);
proxyBuilder = consumerRuntime.getProxyBuilder(nonExistentDomain, testProxy.class);
proxyToNonexistentDomain = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
} catch (DiscoveryException e) {
logger.error(e.getMessage(), e);
} catch (JoynrIllegalStateException e) {
logger.error(e.getMessage(), e);
}
// This should not cause an exception
PeriodicSubscriptionQos subscriptionQos = new PeriodicSubscriptionQos();
subscriptionQos.setPeriodMs(PERIOD_MS);
subscriptionQos.setValidityMs(30000);
subscriptionQos.setAlertAfterIntervalMs(0);
subscriptionQos.setPublicationTtlMs(0);
Future<String> subscriptionId = proxyToNonexistentDomain.subscribeToTestAttribute(integerListener, subscriptionQos);
Thread.sleep(4000);
try {
proxyToNonexistentDomain.unsubscribeFromTestAttribute(subscriptionId.get(FUTURE_SUBSCRIPTION_ID_TIMEOUTMS));
} catch (JoynrRuntimeException | ApplicationException e) {
assertTrue(e.getMessage(), e != null);
}
getSubscriptionTestsPublisher().waitForAttributeUnsubscription("testAttribute");
}
use of io.joynr.arbitration.DiscoveryQos in project joynr by bmwcarit.
the class AccessControllerEnd2EndTest method sendProvisionedEntriesToGDAC.
private void sendProvisionedEntriesToGDAC(List<DomainRoleEntry> domainRoleEntries, List<MasterAccessControlEntry> masterAccessControlEntries, List<MasterAccessControlEntry> mediatorAccessControlEntries, List<OwnerAccessControlEntry> ownerAccessControlEntries) {
DiscoveryQos discoveryQos = new DiscoveryQos();
discoveryQos.setDiscoveryScope(DiscoveryScope.GLOBAL_ONLY);
discoveryQos.setArbitrationStrategy(ArbitrationStrategy.HighestPriority);
discoveryQos.setDiscoveryTimeoutMs(DISCOVERY_TIMEOUT);
MessagingQos messagingQos = new MessagingQos();
messagingQos.setTtl_ms(MESSAGING_TTL);
GlobalDomainAccessControlListEditorProxy gdacListEditorProxy = runtime.getProxyBuilder(GDAC_DOMAIN, GlobalDomainAccessControlListEditorProxy.class).setDiscoveryQos(discoveryQos).setMessagingQos(messagingQos).build();
GlobalDomainRoleControllerProxy gdrcProxy = runtime.getProxyBuilder(GDAC_DOMAIN, GlobalDomainRoleControllerProxy.class).setDiscoveryQos(discoveryQos).setMessagingQos(messagingQos).build();
for (DomainRoleEntry entry : domainRoleEntries) {
assertTrue(gdrcProxy.updateDomainRole(entry));
}
for (MasterAccessControlEntry entry : masterAccessControlEntries) {
assertTrue(gdacListEditorProxy.updateMasterAccessControlEntry(entry));
}
for (MasterAccessControlEntry entry : mediatorAccessControlEntries) {
assertTrue(gdacListEditorProxy.updateMediatorAccessControlEntry(entry));
}
for (OwnerAccessControlEntry entry : ownerAccessControlEntries) {
assertTrue(gdacListEditorProxy.updateOwnerAccessControlEntry(entry));
}
}
use of io.joynr.arbitration.DiscoveryQos in project joynr by bmwcarit.
the class AccessControllerEnd2EndTest method createProxy.
private testProxy createProxy(JoynrRuntime runtime) {
DiscoveryQos discoveryQos = new DiscoveryQos();
discoveryQos.setDiscoveryScope(DiscoveryScope.LOCAL_ONLY);
discoveryQos.setArbitrationStrategy(ArbitrationStrategy.HighestPriority);
discoveryQos.setDiscoveryTimeoutMs(DISCOVERY_TIMEOUT);
MessagingQos messagingQos = new MessagingQos();
messagingQos.setTtl_ms(MESSAGING_TTL);
final Future<Void> future = new Future<Void>();
testProxy testProxy;
testProxy = runtime.getProxyBuilder(TEST_DOMAIN, testProxy.class).setDiscoveryQos(discoveryQos).setMessagingQos(messagingQos).build(new ProxyCreatedCallback<testProxy>() {
@Override
public void onProxyCreationFinished(testProxy result) {
future.onSuccess(null);
}
@Override
public void onProxyCreationError(JoynrRuntimeException error) {
future.onFailure(error);
}
});
try {
future.get(5000);
} catch (Exception e) {
Assert.fail("Unexpected exception from ProxyCreatedCallback: " + e);
}
return testProxy;
}
use of io.joynr.arbitration.DiscoveryQos in project joynr by bmwcarit.
the class AbstractLocalCommunicationTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
logger.info("setup beginning...");
String channelId = UUID.randomUUID().toString() + "-end2endA";
Properties customProperties = new Properties();
customProperties.put(MessagingPropertyKeys.CHANNELID, channelId);
runtimeA = getRuntime(customProperties);
provider = new SubscriptionTestsProviderImpl();
domain = "TestDomain" + System.currentTimeMillis();
ProviderQos providerQos = new ProviderQos();
runtimeA.registerProvider(domain, provider, providerQos);
ProxyBuilder<testProxy> proxyBuilder;
MessagingQos messagingQos = new MessagingQos(20000);
DiscoveryQos discoveryQos = new DiscoveryQos(50000, ArbitrationStrategy.HighestPriority, Long.MAX_VALUE);
proxyBuilder = runtimeA.getProxyBuilder(domain, testProxy.class);
proxy = proxyBuilder.setMessagingQos(messagingQos).setDiscoveryQos(discoveryQos).build();
}
Aggregations