use of org.mule.test.heisenberg.extension.HeisenbergExtension in project mule by mulesoft.
the class DynamicConfigurationProviderTestCase method resolveCachedWithProviderParams.
@Test
public void resolveCachedWithProviderParams() throws Exception {
ResolverSet providerResolverSet = mock(ResolverSet.class);
when(connectionProviderResolver.getResolverSet()).thenReturn(of(providerResolverSet));
when(connectionProviderResolver.getObjectBuilder()).thenReturn(empty());
when(providerResolverSet.resolve(from(event))).thenReturn(resolverSetResult);
final int count = 10;
HeisenbergExtension config = (HeisenbergExtension) provider.get(event).getValue();
for (int i = 1; i < count; i++) {
assertThat(provider.get(event).getValue(), is(sameInstance(config)));
}
verify(providerResolverSet, times(count)).resolve(from(event));
verify(resolverSet, times(count)).resolve(from(event));
}
use of org.mule.test.heisenberg.extension.HeisenbergExtension in project mule by mulesoft.
the class DynamicConfigurationProviderTestCase method resolveDifferentInstances.
@Test
public void resolveDifferentInstances() throws Exception {
HeisenbergExtension instance1 = (HeisenbergExtension) provider.get(event).getValue();
HeisenbergExtension instance2 = makeAlternateInstance();
assertThat(instance2, is(not(sameInstance(instance1))));
}
use of org.mule.test.heisenberg.extension.HeisenbergExtension in project mule by mulesoft.
the class OperationExecutionTestCase method randomAccessOnOperationWhichReturnsListOfMessages.
@Test
public void randomAccessOnOperationWhichReturnsListOfMessages() throws Exception {
List<Message> enemies = (List<Message>) runFlow("getAllEnemies").getMessage().getPayload().getValue();
HeisenbergExtension heisenberg = getConfig(HEISENBERG);
assertThat(enemies, hasSize(heisenberg.getEnemies().size()));
int index = enemies.size() - 1;
assertEnemyMessage(heisenberg, index, enemies.get(index));
index = 0;
assertEnemyMessage(heisenberg, index, enemies.get(index));
}
use of org.mule.test.heisenberg.extension.HeisenbergExtension in project mule by mulesoft.
the class DynamicConfigExpirationTestCase method expireDynamicConfigWithCustomExpiration.
@Test
public void expireDynamicConfigWithCustomExpiration() throws Exception {
HeisenbergExtension config = invokeDynamicConfig("dynamicWithCustomExpiration", "heisenbergWithCustomExpiration", "Walter Jr.");
try {
assertExpired(config, 1500, 100);
fail("Config should not have been expired");
} catch (AssertionError e) {
// all good
}
assertExpired(config, 5000, 1000);
assertInitialised(config);
}
use of org.mule.test.heisenberg.extension.HeisenbergExtension in project mule by mulesoft.
the class ExtensionAsInjectedDependenciesTestCase method dynamicHeisenbergWasInjected.
@Test
public void dynamicHeisenbergWasInjected() throws Exception {
assertCorrectProviderInjected(DYNAMIC_AGE_HEISENBERG, dependent.getDynamicAgeHeisenberg());
final int age = 52;
CoreEvent event = CoreEvent.builder(testEvent()).message(of("")).addVariable("age", age).build();
HeisenbergExtension heisenberg = ExtensionsTestUtils.getConfigurationFromRegistry(DYNAMIC_AGE_HEISENBERG, event, muleContext);
assertThat(heisenberg.getPersonalInfo().getAge(), is(age));
}
Aggregations