use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class ExpiryMonitorTestCase method testExpiry.
@Test
public void testExpiry() throws InterruptedException {
Expirable e = () -> expire();
monitor.addExpirable(EXPIRE_TIME, MILLISECONDS, e);
new PollingProber(EXPIRE_TIMEOUT, 50).check(new JUnitLambdaProbe(() -> {
assertThat(monitor.isRegistered(e), is(false));
assertThat(expired, is(true));
return true;
}, ae -> {
ae.printStackTrace();
return "" + currentTimeMillis() + " - " + monitor.toString();
}));
}
use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class DefaultMuleApplicationStatusTestCase method assertStatus.
private void assertStatus(final ApplicationStatus status) {
PollingProber prober = new PollingProber(PROBER_TIMEOUT, PROBER_INTERVAL);
prober.check(new JUnitProbe() {
@Override
protected boolean test() throws Exception {
assertThat(application.getStatus(), is(status));
return true;
}
@Override
public String describeFailure() {
return String.format("Application remained at status %s instead of moving to %s", application.getStatus().name(), status.name());
}
});
}
use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class AbstractDeploymentTestCase method assertStatus.
protected void assertStatus(final Application application, final ApplicationStatus status) {
Prober prober = new PollingProber(DEPLOYMENT_TIMEOUT, 100);
prober.check(new JUnitProbe() {
@Override
protected boolean test() throws Exception {
assertThat(application.getStatus(), is(status));
return true;
}
@Override
public String describeFailure() {
return String.format("Application %s was expected to be in status %s but was %s instead", application.getArtifactName(), status.name(), application.getStatus().name());
}
});
}
use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class AbstractDeploymentTestCase method assertConditionOnRegistry.
protected void assertConditionOnRegistry(TestDeploymentListener listener, Function<DefaultRegistry, Boolean> verifier) {
Prober prober = new PollingProber(DEPLOYMENT_TIMEOUT, 100);
prober.check(new JUnitProbe() {
@Override
public boolean test() {
DefaultRegistry registry = (DefaultRegistry) listener.getRegistry();
if (registry == null) {
return false;
}
return verifier.apply(registry);
}
@Override
public String describeFailure() {
return "Properties were not overriden by the deployment properties";
}
});
}
use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class AbstractDeploymentTestCase method assertAtLeastOneUndeploymentSuccess.
protected void assertAtLeastOneUndeploymentSuccess(final DeploymentListener listener, final String appName) {
Prober prober = new PollingProber(DEPLOYMENT_TIMEOUT, 100);
prober.check(new JUnitProbe() {
@Override
public boolean test() {
verify(listener, atLeastOnce()).onUndeploymentSuccess(appName);
return true;
}
@Override
public String describeFailure() {
return "Failed to undeploy artifact: " + appName + System.lineSeparator() + super.describeFailure();
}
});
}
Aggregations