use of org.mule.test.heisenberg.extension.HeisenbergExtension in project mule by mulesoft.
the class StatefulOperationTestCase method assertRemainingMoney.
private void assertRemainingMoney(String configName, String name, long expectedAmount) throws Exception {
CoreEvent event = CoreEvent.builder(testEvent()).message(of("")).addVariable("myName", name).build();
HeisenbergExtension heisenbergExtension = ExtensionsTestUtils.getConfigurationFromRegistry(configName, event, muleContext);
assertThat(heisenbergExtension.getMoney(), equalTo(BigDecimal.valueOf(expectedAmount)));
}
use of org.mule.test.heisenberg.extension.HeisenbergExtension in project mule by mulesoft.
the class ParameterizedConfigParserTestCase method config.
@Test
public void config() throws Exception {
HeisenbergExtension heisenberg = lookupHeisenberg(testConfig);
assertHeisenbergConfig(heisenberg);
}
use of org.mule.test.heisenberg.extension.HeisenbergExtension in project mule by mulesoft.
the class ParameterizedConfigParserTestCase method lifecycle.
@Test
public void lifecycle() throws Exception {
HeisenbergExtension heisenberg = lookupHeisenberg(testConfig);
assertThat(heisenberg.getInitialise(), is(1));
assertThat(heisenberg.getStart(), is(1));
muleContext.stop();
muleContext.dispose();
assertThat(heisenberg.getStop(), is(1));
assertThat(heisenberg.getDispose(), is(1));
}
use of org.mule.test.heisenberg.extension.HeisenbergExtension in project mule by mulesoft.
the class SingleConfigParserTestCase method configWithExpressionFunctionIsSameInstanceForDifferentEvents.
@Test
public void configWithExpressionFunctionIsSameInstanceForDifferentEvents() throws Exception {
CoreEvent event = null;
try {
event = getHeisenbergEvent();
CoreEvent anotherEvent = testEvent();
HeisenbergExtension config = lookupHeisenberg(HEISENBERG_BYNAME, event);
HeisenbergExtension anotherConfig = lookupHeisenberg(HEISENBERG_BYNAME, anotherEvent);
assertThat(config, is(sameInstance(anotherConfig)));
} finally {
if (event != null) {
((BaseEventContext) event.getContext()).success();
}
}
}
use of org.mule.test.heisenberg.extension.HeisenbergExtension in project mule by mulesoft.
the class DynamicConfigurationProviderTestCase method getExpired.
@Test
public void getExpired() throws Exception {
HeisenbergExtension instance1 = (HeisenbergExtension) provider.get(event).getValue();
HeisenbergExtension instance2 = makeAlternateInstance();
DynamicConfigurationProvider provider = (DynamicConfigurationProvider) this.provider;
timeSupplier.move(1, MINUTES);
List<ConfigurationInstance> expired = provider.getExpired();
assertThat(expired.isEmpty(), is(true));
timeSupplier.move(10, MINUTES);
expired = provider.getExpired();
assertThat(expired.isEmpty(), is(false));
List<Object> configs = expired.stream().map(config -> config.getValue()).collect(toImmutableList());
assertThat(configs, containsInAnyOrder(instance1, instance2));
}
Aggregations