Search in sources :

Example 1 with Deployment

use of io.vertx.core.impl.Deployment in project vert.x by eclipse.

the class ComplexHATest method checkHasDeployments.

protected int checkHasDeployments(int pos, int prevPos) {
    Set<Deployment> prevSet = deploymentSnapshots[prevPos];
    Set<Deployment> currSet = takeDeploymentSnapshot(pos);
    for (Deployment prev : prevSet) {
        boolean contains = false;
        for (Deployment curr : currSet) {
            if (curr.verticleIdentifier().equals(prev.verticleIdentifier()) && curr.deploymentOptions().equals(prev.deploymentOptions())) {
                contains = true;
                break;
            }
        }
        assertTrue(contains);
    }
    return currSet.size();
}
Also used : Deployment(io.vertx.core.impl.Deployment)

Example 2 with Deployment

use of io.vertx.core.impl.Deployment in project vert.x by eclipse.

the class ComplexHATest method takeDeploymentSnapshot.

protected Set<Deployment> takeDeploymentSnapshot(int pos) {
    Set<Deployment> snapshot = new ConcurrentHashSet<>();
    VertxInternal v = (VertxInternal) vertices[pos];
    for (String depID : v.deploymentIDs()) {
        snapshot.add(v.getDeployment(depID));
    }
    return snapshot;
}
Also used : VertxInternal(io.vertx.core.impl.VertxInternal) ConcurrentHashSet(io.vertx.core.impl.ConcurrentHashSet) Deployment(io.vertx.core.impl.Deployment)

Example 3 with Deployment

use of io.vertx.core.impl.Deployment in project vert.x by eclipse.

the class VerticleFactoryTest method testResolve.

@Test
public void testResolve() {
    TestVerticle verticle = new TestVerticle();
    TestVerticleFactory fact = new TestVerticleFactory("actual", verticle);
    vertx.registerVerticleFactory(fact);
    TestVerticleFactory factResolve = new TestVerticleFactory("resolve", "actual:myverticle");
    vertx.registerVerticleFactory(factResolve);
    JsonObject config = new JsonObject().put("foo", "bar");
    DeploymentOptions original = new DeploymentOptions().setWorker(false).setConfig(config).setIsolationGroup("somegroup");
    DeploymentOptions options = new DeploymentOptions(original);
    vertx.deployVerticle("resolve:someid", options, res -> {
        assertTrue(res.succeeded());
        assertEquals("resolve:someid", factResolve.identifierToResolve);
        assertEquals(options, factResolve.deploymentOptionsToResolve);
        assertEquals("actual:myverticle", fact.identifier);
        assertTrue(verticle.startCalled);
        assertTrue(verticle.startCalled);
        assertEquals(1, vertx.deploymentIDs().size());
        Deployment dep = ((VertxInternal) vertx).getDeployment(res.result());
        assertNotNull(dep);
        assertFalse(original.equals(dep.deploymentOptions()));
        assertFalse(dep.deploymentOptions().getConfig().containsKey("foo"));
        assertEquals("quux", dep.deploymentOptions().getConfig().getString("wibble"));
        assertTrue(dep.deploymentOptions().isWorker());
        assertEquals("othergroup", dep.deploymentOptions().getIsolationGroup());
        testComplete();
    });
    await();
}
Also used : VertxInternal(io.vertx.core.impl.VertxInternal) JsonObject(io.vertx.core.json.JsonObject) Deployment(io.vertx.core.impl.Deployment) Test(org.junit.Test)

Example 4 with Deployment

use of io.vertx.core.impl.Deployment in project vert.x by eclipse.

the class HATest method checkDeploymentExists.

protected void checkDeploymentExists(int pos, String verticleName, DeploymentOptions options) {
    VertxInternal vi = (VertxInternal) vertices[pos];
    for (String deploymentID : vi.deploymentIDs()) {
        Deployment dep = vi.getDeployment(deploymentID);
        if (verticleName.equals(dep.verticleIdentifier()) && options.equals(dep.deploymentOptions())) {
            return;
        }
    }
    fail("Can't find deployment for verticleName: " + verticleName + " on node " + pos);
}
Also used : VertxInternal(io.vertx.core.impl.VertxInternal) Deployment(io.vertx.core.impl.Deployment)

Aggregations

Deployment (io.vertx.core.impl.Deployment)4 VertxInternal (io.vertx.core.impl.VertxInternal)3 ConcurrentHashSet (io.vertx.core.impl.ConcurrentHashSet)1 JsonObject (io.vertx.core.json.JsonObject)1 Test (org.junit.Test)1