use of joynr.tests.DefaulttestProvider in project joynr by bmwcarit.
the class RoutingTableOverwriteEnd2EndTest method testProviderAddressCanBeOverwrittenAfterDiscovery.
@Test
public void testProviderAddressCanBeOverwrittenAfterDiscovery() throws Exception {
// Tests that if a provider's address is changed in the discovery directory and a new proxy is
// created for the provider, the routing table of the proxy's runtime will also be updated as long as
// a new arbitration (cache max age = 0) is performed.
final String providerDomain = "testDomain";
final Properties fixedParticipantIdProperty = createFixedParticipantIdProperties(providerDomain, DefaulttestProvider.class, "fixedParticipantId");
DiscoveryQos discoveryQos = new DiscoveryQos();
discoveryQos.setArbitrationStrategy(ArbitrationStrategy.HighestPriority);
discoveryQos.setCacheMaxAgeMs(0);
JoynrRuntime runtimeProxy = createRuntime("proxy", null);
JoynrRuntime runtimeProvider1 = createRuntime("provider_initial", fixedParticipantIdProperty);
DefaulttestProvider provider1 = Mockito.spy(DefaulttestProvider.class);
runtimeProvider1.registerProvider(providerDomain, provider1, createProviderQos()).get();
testProxy proxy1 = runtimeProxy.getProxyBuilder(providerDomain, testProxy.class).setMessagingQos(new MessagingQos(2000)).setDiscoveryQos(discoveryQos).build();
proxy1.addNumbers(1, 2, 3);
verify(provider1).addNumbers(1, 2, 3);
reset(provider1);
JoynrRuntime runtimeProvider2 = createRuntime("provider_override", fixedParticipantIdProperty);
DefaulttestProvider provider2 = Mockito.spy(DefaulttestProvider.class);
runtimeProvider2.registerProvider(providerDomain, provider2, createProviderQos()).get();
testProxy proxy2 = runtimeProxy.getProxyBuilder(providerDomain, testProxy.class).setMessagingQos(new MessagingQos(2000)).setDiscoveryQos(discoveryQos).build();
proxy2.addNumbers(1, 2, 3);
verify(provider1, never()).addNumbers(1, 2, 3);
verify(provider2).addNumbers(1, 2, 3);
}
use of joynr.tests.DefaulttestProvider in project joynr by bmwcarit.
the class SubscriptionPublisherFactoryTest method testCreateWithCorrectProvider.
@Test
public void testCreateWithCorrectProvider() throws Exception {
DefaulttestProvider providerSpy = Mockito.spy(new DefaulttestProvider());
subscriptionPublisherFactory.create(providerSpy);
verify(providerSpy, times(1)).setSubscriptionPublisher(any(testSubscriptionPublisherImpl.class));
}
use of joynr.tests.DefaulttestProvider in project joynr by bmwcarit.
the class ShutdownTest method setup.
@Before
public void setup() {
Properties factoryPropertiesProvider = new Properties();
factoryPropertiesProvider.put(AbstractJoynrApplication.PROPERTY_JOYNR_DOMAIN_LOCAL, "localdomain");
factoryPropertiesProvider.put(MessagingPropertyKeys.CHANNELID, "ShutdownTestChannelId");
MockitoAnnotations.initMocks(this);
Module runtimeModule = Modules.override(new CCInProcessRuntimeModule()).with(new TestGlobalAddressModule());
dummyApplication = (DummyJoynrApplication) new JoynrInjectorFactory(factoryPropertiesProvider, runtimeModule).createApplication(DummyJoynrApplication.class);
provider = new DefaulttestProvider();
providerQos = new ProviderQos();
providerQos.setScope(ProviderScope.LOCAL);
providerQos.setPriority(System.currentTimeMillis());
}
use of joynr.tests.DefaulttestProvider in project joynr by bmwcarit.
the class ShutdownTest method unregisterMultibleProvidersBeforeShutdown.
@Test
public void unregisterMultibleProvidersBeforeShutdown() throws JoynrWaitExpiredException, JoynrRuntimeException, InterruptedException, ApplicationException {
int providercount = 10;
JoynrProvider[] providers = new JoynrProvider[providercount];
for (int i = 0; i < providers.length; i++) {
providerQos = new ProviderQos();
providerQos.setScope(ProviderScope.LOCAL);
providerQos.setPriority(System.currentTimeMillis());
providers[i] = new DefaulttestProvider();
Future<Void> registerFinished = dummyApplication.getRuntime().registerProvider("ShutdownTestdomain" + i, providers[i], providerQos);
registerFinished.get();
}
for (int i = 0; i < providers.length; i++) {
dummyApplication.getRuntime().unregisterProvider("ShutdownTestdomain" + i, providers[i]);
}
dummyApplication.shutdown();
}
use of joynr.tests.DefaulttestProvider 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");
}
Aggregations