use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class ArtifactAwareContextSelectorTestCase method assertReaperThreadNotRunning.
private void assertReaperThreadNotRunning() {
PollingProber prober = new PollingProber(PROBER_TIMEOUT, PROBER_FREQ);
prober.check(new Probe() {
@Override
public boolean isSatisfied() {
return getReaperThread() == null;
}
@Override
public String describeFailure() {
return "Reaper thread exists from previous test and did not died";
}
});
}
use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class ArtifactAwareContextSelectorTestCase method assertStopped.
private void assertStopped(final MuleLoggerContext context) {
final Reference<Boolean> contextWasAccessibleDuringShutdown = new Reference<>(true);
PollingProber pollingProber = new PollingProber(1000, 10);
pollingProber.check(new JUnitProbe() {
@Override
protected boolean test() throws Exception {
if (context.getState().equals(LifeCycle.State.STOPPED)) {
return true;
} else {
LoggerContext currentContext = getContext();
if (currentContext != null && currentContext != context) {
contextWasAccessibleDuringShutdown.set(false);
}
return false;
}
}
@Override
public String describeFailure() {
return "context was not stopped";
}
});
assertThat(context, not(getContext()));
assertThat(contextWasAccessibleDuringShutdown.get(), is(true));
}
use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class FakeMuleServer method assertDeploymentFailure.
private void assertDeploymentFailure(final DeploymentListener listener, final String appName) {
Prober prober = new PollingProber(DEPLOYMENT_TIMEOUT, 100);
prober.check(new Probe() {
@Override
public boolean isSatisfied() {
try {
verify(listener, times(1)).onDeploymentFailure(eq(appName), any(Throwable.class));
return true;
} catch (AssertionError e) {
return false;
}
}
@Override
public String describeFailure() {
return "Failed to deploy application: " + appName;
}
});
}
use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class MuleDeployment method before.
protected void before() throws Throwable {
super.before();
prober = new PollingProber(deploymentTimeout, POLL_DELAY_MILLIS);
mule = new MuleProcessController(getMuleHome());
addShutdownHooks();
try {
doBefore();
} catch (Error e) {
logServerError(e);
}
}
use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class DefaultEventContextTestCase method childSuccessWithResultFreesChild.
@Test
@Description("Once a child context is completed, its event is not kept in memory.")
public void childSuccessWithResultFreesChild() throws Exception {
child = addChild(parent);
CoreEvent eventChild = getEventBuilder().message(Message.of(TEST_PAYLOAD)).build();
CoreEvent eventParent = getEventBuilder().message(Message.of(TEST_PAYLOAD)).build();
PhantomReference<CoreEvent> childRef = new PhantomReference<>(eventChild, new ReferenceQueue<>());
child.success(eventChild);
eventChild = null;
childResultValue.set(null);
new PollingProber(GC_POLLING_TIMEOUT, DEFAULT_POLLING_INTERVAL).check(new JUnitLambdaProbe(() -> {
System.gc();
assertThat(childRef.isEnqueued(), is(true));
return true;
}, "A hard reference is being mantained to the child event."));
parent.success(eventParent);
}
Aggregations