use of io.qameta.allure.Description in project mule by mulesoft.
the class CollectMapForkJoinStrategyTestCase method collectMap.
@Test
@Description("This strategy waits for all routes to return and then collects results into a map where the key of each entry is the string representation of the index of the routing pair.")
public void collectMap() throws Throwable {
Message route1Result = of(1);
Message route2Result = of(2);
Message route3Result = of(3);
RoutingPair pair1 = createRoutingPair(route1Result);
RoutingPair pair2 = createRoutingPair(route2Result);
RoutingPair pair3 = createRoutingPair(route3Result);
CoreEvent result = invokeStrategyBlocking(strategy, testEvent(), asList(pair1, pair2, pair3));
assertThat(result.getMessage().getPayload().getValue(), instanceOf(Map.class));
Map<String, Message> resultMap = (Map<String, Message>) result.getMessage().getPayload().getValue();
assertThat(resultMap.entrySet(), hasSize(3));
assertThat(resultMap.get("0"), is(route1Result));
assertThat(resultMap.get("1"), is(route2Result));
assertThat(resultMap.get("2"), is(route3Result));
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class JoinOnlyForkJoinStrategyTestCase method joinOnly.
@Test
@Description("This strategy waits for all routes to return and then returns the original event.")
public void joinOnly() throws Throwable {
CoreEvent original = testEvent();
Processor processor1 = createProcessorSpy(of(1));
Processor processor2 = createProcessorSpy(of(2));
Processor processor3 = createProcessorSpy(of(3));
RoutingPair pair1 = createRoutingPair(processor1);
RoutingPair pair2 = createRoutingPair(processor2);
RoutingPair pair3 = createRoutingPair(processor3);
CoreEvent result = invokeStrategyBlocking(strategy, original, asList(pair1, pair2, pair3));
assertThat(result, is(original));
verify(processor1, times(1)).process(any(CoreEvent.class));
verify(processor2, times(1)).process(any(CoreEvent.class));
verify(processor2, times(1)).process(any(CoreEvent.class));
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class WorkQueueProcessingStrategyTestCase method blockingRejectedExecution.
@Test
@Description("If IO pool is busy OVERLOAD error is thrown")
public void blockingRejectedExecution() throws Exception {
Scheduler blockingSchedulerSpy = spy(blocking);
Scheduler rejectingSchedulerSpy = spy(new RejectingScheduler(blockingSchedulerSpy));
flow = flowBuilder.get().processors(blockingProcessor).processingStrategyFactory((context, prefix) -> new WorkQueueProcessingStrategy(() -> rejectingSchedulerSpy)).build();
flow.initialise();
flow.start();
expectRejected();
processFlow(testEvent());
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class CompositeProcessorChainRouterTestCase method simpleChain.
@Test
@Description("Ensure that with simple chains both chains are executed consecutively with the result of the first chain being used for the second chain.")
public void simpleChain() throws Exception {
Message chain1Out = of(1);
Message chain2Out = of(2);
AtomicReference<Message> chain1In = new AtomicReference<>();
AtomicReference<Message> chain2In = new AtomicReference<>();
MessageProcessorChain chain1 = newChain(empty(), event -> {
chain1In.set(event.getMessage());
return builder(event).message(chain1Out).build();
});
MessageProcessorChain chain2 = newChain(empty(), event -> {
chain2In.set(event.getMessage());
return builder(event).message(chain2Out).build();
});
chainRouter = createCompositeProcessorChainRouter(chain1, chain2);
Message result = chainRouter.execute(testEvent()).get().getMessage();
assertThat(chain1In.get(), equalTo(testEvent().getMessage()));
assertThat(chain2In.get(), equalTo(chain1Out));
assertThat(result, equalTo(chain2Out));
}
use of io.qameta.allure.Description in project mule by mulesoft.
the class ApplicationDeploymentTestCase method deploysAppWithNotExportedPackageAndPlugin.
@Test
@Issue("MULE-13756")
@Description("Tests that code called form plugin's Processor cannot access internal resources/packages of the application")
public void deploysAppWithNotExportedPackageAndPlugin() throws Exception {
ArtifactPluginFileBuilder loadsAppResourcePlugin = new ArtifactPluginFileBuilder("loadsAppResourcePlugin").configuredWith(EXPORTED_CLASS_PACKAGES_PROPERTY, "org.foo").containingClass(loadsAppResourceCallbackClassFile, "org/foo/LoadsAppResourceCallback.class");
ApplicationFileBuilder nonExposingAppFileBuilder = new ApplicationFileBuilder("non-exposing-app").configuredWith(EXPORTED_PACKAGES, "org.bar1").configuredWith(EXPORTED_RESOURCES, "test-resource.txt").definedBy("app-with-loads-app-resource-plugin-config.xml").containingClass(barUtils1ClassFile, "org/bar1/BarUtils.class").containingClass(barUtils2ClassFile, "org/bar2/BarUtils.class").containingResource("test-resource.txt", "test-resource.txt").containingResource("test-resource.txt", "test-resource-not-exported.txt").dependingOn(loadsAppResourcePlugin);
addPackedAppFromBuilder(nonExposingAppFileBuilder);
startDeployment();
assertApplicationDeploymentSuccess(applicationDeploymentListener, nonExposingAppFileBuilder.getId());
executeApplicationFlow("main");
}
Aggregations