Search in sources :

Example 1 with JUnitProbe

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();
        }
    });
}
Also used : JUnitProbe(org.mule.tck.probe.JUnitProbe) PollingProber(org.mule.tck.probe.PollingProber) PollingProber(org.mule.tck.probe.PollingProber) Prober(org.mule.tck.probe.Prober) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) MuleException(org.mule.runtime.api.exception.MuleException) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException)

Example 2 with JUnitProbe

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();
        }
    });
}
Also used : JUnitProbe(org.mule.tck.probe.JUnitProbe) PollingProber(org.mule.tck.probe.PollingProber) PollingProber(org.mule.tck.probe.PollingProber) Prober(org.mule.tck.probe.Prober)

Example 3 with JUnitProbe

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();
        }
    });
}
Also used : JUnitProbe(org.mule.tck.probe.JUnitProbe) PollingProber(org.mule.tck.probe.PollingProber) PollingProber(org.mule.tck.probe.PollingProber) Prober(org.mule.tck.probe.Prober) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) MuleException(org.mule.runtime.api.exception.MuleException) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException)

Example 4 with JUnitProbe

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";
        }
    });
}
Also used : JUnitProbe(org.mule.tck.probe.JUnitProbe) ObjectStore(org.mule.runtime.api.store.ObjectStore) PollingProber(org.mule.tck.probe.PollingProber) ObjectStoreNotAvailableException(org.mule.runtime.api.store.ObjectStoreNotAvailableException) Test(org.junit.Test)

Example 5 with JUnitProbe

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";
        }
    });
}
Also used : JUnitProbe(org.mule.tck.probe.JUnitProbe) ObjectStore(org.mule.runtime.api.store.ObjectStore) PollingProber(org.mule.tck.probe.PollingProber) ObjectStoreNotAvailableException(org.mule.runtime.api.store.ObjectStoreNotAvailableException) Test(org.junit.Test)

Aggregations

JUnitProbe (org.mule.tck.probe.JUnitProbe)20 PollingProber (org.mule.tck.probe.PollingProber)20 Prober (org.mule.tck.probe.Prober)11 Test (org.junit.Test)6 URISyntaxException (java.net.URISyntaxException)5 IOException (java.io.IOException)4 MuleException (org.mule.runtime.api.exception.MuleException)4 InitialisationException (org.mule.runtime.api.lifecycle.InitialisationException)4 ArrayList (java.util.ArrayList)2 MuleRuntimeException (org.mule.runtime.api.exception.MuleRuntimeException)2 ObjectStore (org.mule.runtime.api.store.ObjectStore)2 ObjectStoreNotAvailableException (org.mule.runtime.api.store.ObjectStoreNotAvailableException)2 Description (io.qameta.allure.Description)1 File (java.io.File)1 InputStream (java.io.InputStream)1 MalformedURLException (java.net.MalformedURLException)1 Arrays.asList (java.util.Arrays.asList)1 Collections.emptyList (java.util.Collections.emptyList)1 Collections.emptyMap (java.util.Collections.emptyMap)1 Collections.singletonList (java.util.Collections.singletonList)1