use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class EventCorrelatorTestCase method doExpiredGroupMonitoringTest.
private void doExpiredGroupMonitoringTest(boolean primaryNode) throws Exception {
when(mockMuleContext.isPrimaryPollingInstance()).thenReturn(primaryNode);
EventCorrelator eventCorrelator = createEventCorrelator();
when(mockEventCorrelatorCallback.createEventGroup(mockMuleEvent, TEST_GROUP_ID)).thenReturn(mockEventGroup);
eventCorrelator.start();
try {
Prober prober = new PollingProber(1000, 50);
prober.check(new Probe() {
@Override
public boolean isSatisfied() {
try {
return !memoryObjectStore.contains(TEST_GROUP_ID, "prefix.eventGroups");
} catch (ObjectStoreException e) {
LOGGER.debug("Could not access object store.");
return false;
}
}
@Override
public String describeFailure() {
return "Event group not expired.";
}
});
} finally {
eventCorrelator.stop();
}
}
use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class AsyncRequestReplyRequesterTestCase method testMultiple.
@Test
@Ignore("See MULE-8830")
public void testMultiple() throws Exception {
asyncReplyMP = new TestAsyncRequestReplyRequester(muleContext);
SensingNullMessageProcessor target = getSensingNullMessageProcessor();
target.setWaitTime(50);
AsyncDelegateMessageProcessor asyncMP = createAsyncMessageProcessor(target);
asyncMP.initialise();
asyncReplyMP.setListener(asyncMP);
asyncReplyMP.setReplySource(target.getMessageSource());
final AtomicInteger count = new AtomicInteger();
for (int i = 0; i < 500; i++) {
scheduler.execute(() -> {
try {
CoreEvent resultEvent = asyncReplyMP.process(testEvent());
// Can't assert same because we copy event for async currently
assertEquals(((PrivilegedEvent) testEvent()).getMessageAsString(muleContext), ((PrivilegedEvent) resultEvent).getMessageAsString(muleContext));
count.incrementAndGet();
LOGGER.debug("Finished " + count.get());
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}
new PollingProber().check(new JUnitLambdaProbe(() -> {
assertThat(count.get(), greaterThanOrEqualTo(500));
return true;
}));
}
use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class AbstractDeploymentTestCase method assertDeploymentSuccess.
protected void assertDeploymentSuccess(final DeploymentListener listener, final String artifactName) {
Prober prober = new PollingProber(DEPLOYMENT_TIMEOUT, 100);
prober.check(new JUnitProbe() {
@Override
protected boolean test() throws Exception {
verify(listener, times(1)).onDeploymentSuccess(artifactName);
return true;
}
@Override
public String describeFailure() {
return "Failed to deploy application: " + artifactName + System.lineSeparator() + super.describeFailure();
}
});
}
use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class AbstractDeploymentTestCase method assertMuleContextInitialized.
protected void assertMuleContextInitialized(final DeploymentListener listener, final String appName) {
Prober prober = new PollingProber(DEPLOYMENT_TIMEOUT, 100);
prober.check(new JUnitProbe() {
@Override
public boolean test() {
verify(listener, times(1)).onArtifactInitialised(eq(appName), any(Registry.class));
return true;
}
@Override
public String describeFailure() {
return String.format("Did not received notification '%s' for app '%s'", "onArtifactInitialised", appName) + System.lineSeparator() + super.describeFailure();
}
});
}
use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class AbstractDeploymentTestCase method assertAppFolderIsDeleted.
protected void assertAppFolderIsDeleted(String appName) {
Prober prober = new PollingProber(DEPLOYMENT_TIMEOUT, 100);
File appFolder = new File(appsDir, appName);
prober.check(new FileDoesNotExists(appFolder));
}
Aggregations