use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class FakeMuleServer method assertUndeploymentSuccess.
public void assertUndeploymentSuccess(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)).onUndeploymentSuccess(appName);
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 FakeMuleServer method assertDeploymentSuccess.
private void assertDeploymentSuccess(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)).onDeploymentSuccess(appName);
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 LifecycleAwareConfigurationInstanceTestCase method disposeMetadataCacheWhenConfigIsDisposed.
@Test
public void disposeMetadataCacheWhenConfigIsDisposed() throws Exception {
MuleMetadataService muleMetadataManager = ((MuleContextWithRegistries) muleContext).getRegistry().lookupObject(MuleMetadataService.class);
muleMetadataManager.getMetadataCache(NAME);
interceptable.initialise();
interceptable.start();
interceptable.stop();
new PollingProber(1000, 100).check(new JUnitLambdaProbe(() -> muleMetadataManager.getMetadataCaches().entrySet().isEmpty()));
}
use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class TypedValueParameterOperationExecutionTestCase method typedValueForStringOnSourceOnSuccess.
@Test
public void typedValueForStringOnSourceOnSuccess() throws Exception {
Flow flow = (Flow) getFlowConstruct("typedValueForStringOnSourceOnSuccess");
flow.start();
new PollingProber(100000, 100).check(new JUnitLambdaProbe(() -> TypedValueSource.onSuccessValue != null));
assertTypedValue(TypedValueSource.onSuccessValue, STRING_VALUE, WILDCARD, null);
}
use of org.mule.tck.probe.PollingProber in project mule by mulesoft.
the class PetStoreConnectionPoolingTestCase method exhaustion.
@Test
public void exhaustion() throws Exception {
if (NO_POOLING.equals(name)) {
// test does not apply
return;
}
executorService = Executors.newFixedThreadPool(poolSize);
List<Future<PetStoreClient>> clients = new ArrayList<>(poolSize);
for (int i = 0; i < poolSize; i++) {
clients.add(getClientOnLatch());
}
testLatch.await();
try {
getClient();
fail("was expecting pool to be exhausted when using config: " + name);
} catch (Exception e) {
assertThat(e.getCause(), is(instanceOf(ConnectionException.class)));
}
connectionLatch.release();
for (Future<PetStoreClient> future : clients) {
PollingProber prober = new PollingProber(1000, 100);
prober.check(new JUnitProbe() {
@Override
protected boolean test() throws Exception {
PetStoreClient client = future.get(100, MILLISECONDS);
assertValidClient(client);
return true;
}
@Override
public String describeFailure() {
return "Could not obtain valid client";
}
});
}
// now test that the pool is usable again
assertValidClient(getClient());
}
Aggregations