use of org.mule.tck.probe.JUnitProbe 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.JUnitProbe 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.JUnitProbe in project mule by mulesoft.
the class AbstractDeploymentTestCase method assertRedeploymentSuccess.
private void assertRedeploymentSuccess(DeploymentListener listener, String artifactName) {
Prober prober = new PollingProber(DEPLOYMENT_TIMEOUT, 100);
prober.check(new JUnitProbe() {
@Override
protected boolean test() throws Exception {
verify(listener, times(1)).onRedeploymentSuccess(artifactName);
return true;
}
@Override
public String describeFailure() {
return "Failed to redeploy artifact: " + artifactName + System.lineSeparator() + super.describeFailure();
}
});
}
use of org.mule.tck.probe.JUnitProbe in project mule by mulesoft.
the class MuleObjectStoreManagerIntegrationTestCase method expirationIntervalWithLowTTL.
@Test
public void expirationIntervalWithLowTTL() throws Exception {
int maxEntries = 5;
int entryTTL = 10;
int expirationInterval = 100;
final ObjectStore os = objectStoreFactory.createObjectStore("myOs", maxEntries, entryTTL, expirationInterval);
for (int i = 0; i < maxEntries; i++) {
os.store(valueOf(i), i);
}
PollingProber prober = new PollingProber(1000, expirationInterval);
prober.check(new JUnitProbe() {
@Override
public boolean test() throws Exception {
return os.allKeys().isEmpty();
}
@Override
public String describeFailure() {
return "not all entries were evicted";
}
});
}
use of org.mule.tck.probe.JUnitProbe in project mule by mulesoft.
the class MuleObjectStoreManagerIntegrationTestCase method maxEntriesIsHonored.
@Test
public void maxEntriesIsHonored() throws Exception {
final int expirationInterval = 1000;
final int maxEntries = 5;
final ObjectStore os = objectStoreFactory.createObjectStore("myOs", 5, 0, expirationInterval);
os.store("0", 0);
ensureMilisecondChanged();
for (int i = 1; i < maxEntries + 1; i++) {
os.store(valueOf(i), i);
}
PollingProber prober = new PollingProber(expirationInterval * 5, expirationInterval);
prober.check(new JUnitProbe() {
@Override
public boolean test() throws Exception {
assertThat(os.contains("0"), is(false));
for (int i = 1; i < maxEntries + 1; i++) {
assertThat(os.contains(valueOf(i)), is(true));
}
return true;
}
@Override
public String describeFailure() {
return "max entries were not honoured";
}
});
}
Aggregations