Search in sources :

Example 6 with HeisenbergExtension

use of org.mule.test.heisenberg.extension.HeisenbergExtension in project mule by mulesoft.

the class ParameterizedConfigParserTestCase 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();
        }
    }
}
Also used : BaseEventContext(org.mule.runtime.core.privileged.event.BaseEventContext) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) HeisenbergExtension(org.mule.test.heisenberg.extension.HeisenbergExtension) Test(org.junit.Test)

Example 7 with HeisenbergExtension

use of org.mule.test.heisenberg.extension.HeisenbergExtension in project mule by mulesoft.

the class ParameterizedConfigParserTestCase method injectedConfigName.

@Test
public void injectedConfigName() throws Exception {
    HeisenbergExtension heisenberg = lookupHeisenberg(testConfig);
    assertThat(heisenberg.getConfigName(), equalTo(testConfig));
}
Also used : HeisenbergExtension(org.mule.test.heisenberg.extension.HeisenbergExtension) Test(org.junit.Test)

Example 8 with HeisenbergExtension

use of org.mule.test.heisenberg.extension.HeisenbergExtension in project mule by mulesoft.

the class ParameterizedConfigParserTestCase method sameInstanceForEquivalentEvent.

@Test
public void sameInstanceForEquivalentEvent() throws Exception {
    CoreEvent event = null;
    try {
        event = getHeisenbergEvent();
        HeisenbergExtension heisenberg = lookupHeisenberg(testConfig, event);
        assertThat(heisenberg, is(sameInstance(lookupHeisenberg(testConfig, event))));
    } finally {
        if (event != null) {
            ((BaseEventContext) event.getContext()).success();
        }
    }
}
Also used : BaseEventContext(org.mule.runtime.core.privileged.event.BaseEventContext) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) HeisenbergExtension(org.mule.test.heisenberg.extension.HeisenbergExtension) Test(org.junit.Test)

Example 9 with HeisenbergExtension

use of org.mule.test.heisenberg.extension.HeisenbergExtension in project mule by mulesoft.

the class ParameterizedConfigParserTestCase method dependenciesInjected.

@Test
public void dependenciesInjected() throws Exception {
    HeisenbergExtension heisenberg = lookupHeisenberg(testConfig);
    assertThat(heisenberg.getExtensionManager(), is(sameInstance(muleContext.getExtensionManager())));
}
Also used : HeisenbergExtension(org.mule.test.heisenberg.extension.HeisenbergExtension) Test(org.junit.Test)

Example 10 with HeisenbergExtension

use of org.mule.test.heisenberg.extension.HeisenbergExtension in project mule by mulesoft.

the class SingleConfigParserTestCase method getHealthProgression.

@Test
public void getHealthProgression() throws Exception {
    CoreEvent event = null;
    try {
        event = getHeisenbergEvent();
        HeisenbergExtension config = lookupHeisenberg(HEISENBERG_BYNAME, event);
        assertThat(config.getHealthProgression(), is(not(nullValue())));
        assertThat(config.getHealthProgression().size(), is(3));
        assertThat(config.getHealthProgression(), contains(HEALTHY, CANCER, DEAD));
    } finally {
        if (event != null) {
            ((BaseEventContext) event.getContext()).success();
        }
    }
}
Also used : BaseEventContext(org.mule.runtime.core.privileged.event.BaseEventContext) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) HeisenbergExtension(org.mule.test.heisenberg.extension.HeisenbergExtension) Test(org.junit.Test)

Aggregations

HeisenbergExtension (org.mule.test.heisenberg.extension.HeisenbergExtension)28 Test (org.junit.Test)24 CoreEvent (org.mule.runtime.core.api.event.CoreEvent)10 BaseEventContext (org.mule.runtime.core.privileged.event.BaseEventContext)6 SmallTest (org.mule.tck.size.SmallTest)6 List (java.util.List)3 ResolverSetResult (org.mule.runtime.module.extension.internal.runtime.resolver.ResolverSetResult)3 ArrayList (java.util.ArrayList)2 ResolverSet (org.mule.runtime.module.extension.internal.runtime.resolver.ResolverSet)2 ImmutableList (com.google.common.collect.ImmutableList)1 Arrays.asList (java.util.Arrays.asList)1 HashMap (java.util.HashMap)1 Optional.empty (java.util.Optional.empty)1 Optional.of (java.util.Optional.of)1 MINUTES (java.util.concurrent.TimeUnit.MINUTES)1 CoreMatchers.is (org.hamcrest.CoreMatchers.is)1 CoreMatchers.not (org.hamcrest.CoreMatchers.not)1 CoreMatchers.sameInstance (org.hamcrest.CoreMatchers.sameInstance)1 Matchers.containsInAnyOrder (org.hamcrest.Matchers.containsInAnyOrder)1 After (org.junit.After)1