Package org.nimbustools.api.repr

Examples of org.nimbustools.api.repr.CreateResult


        final CreateRequest request = this.populator().
                getIdempotentCreateRequest("suite:basic:idempotency", token);

        // this should fail with an expected CreationException
        final CreateResult result = rm.create(request, caller);
    }
View Full Code Here



        // 1. first start a basic single VM with a clientToken

        final CreateRequest request1 = this.populator().getIdempotentCreateRequest("suite:basic:idempotency", token);
        final CreateResult result1 = rm.create(request1, caller);

        logger.info("Leased vm '" + result1.getVMs()[0].getID() + '\'');
        assertEquals(token, result1.getVMs()[0].getClientToken());


        // 2. now re-launch with the same clientToken, should get back the same instance
        //    (and no new instance should have been started)

        final CreateRequest request2 = this.populator().getIdempotentCreateRequest("suite:basic:idempotency", token);
        final CreateResult result2 = rm.create(request2, caller);

        assertEquals(result1.getVMs()[0].getID(), result2.getVMs()[0].getID());
        assertEquals(token, result2.getVMs()[0].getClientToken());
        logger.info("Leased same vm '" + result2.getVMs()[0].getID() + '\'');

        assertEquals(1, rm.getAllByCaller(caller).length);


        // 3. Now launch a VM with the same parameters but different clientToken --
        //    should get a new VM

        String anotherToken = UUID.randomUUID().toString();
        final CreateRequest request3 = this.populator().getIdempotentCreateRequest("suite:basic:idempotency", anotherToken);
        final CreateResult result3 = rm.create(request3, caller);
        logger.info("Leased vm '" + result3.getVMs()[0].getID() + '\'');
        assertNotSame(result1.getVMs()[0].getID(), result3.getVMs()[0].getID());
        assertEquals(2, rm.getAllByCaller(caller).length);


        // 4. Kill the first VM and then attempt to re-launch with its same clientToken.
        //    We should get back a terminated state response with the original ID

        rm.trash(result1.getVMs()[0].getID(), Manager.INSTANCE, caller);
        assertEquals(1, rm.getAllByCaller(caller).length);

        final CreateRequest request4 = this.populator().getIdempotentCreateRequest("suite:basic:idempotency", token);
        final CreateResult result4 = rm.create(request4, caller);
        logger.info("Leased same vm (terminated) '" + result4.getVMs()[0].getID() + '\'');
        assertEquals(result1.getVMs()[0].getID(), result2.getVMs()[0].getID());
        assertEquals(State.STATE_Cancelled, result4.getVMs()[0].getState().getState());
        assertEquals(token, result4.getVMs()[0].getClientToken());


        // 5. Now attempt to launch requests with the same clientTokens but
        //    different other parameters. Should get IdempotentCreationMismatchException
        //    errors
View Full Code Here

        // 1. first start a group of 3 VMs with a clientToken

        final CreateRequest request1 = this.populator().
                getCreateRequest("suite:basic:idempotency", 240, 64, 3, token);
        final CreateResult result1 = rm.create(request1, caller);

        assertEquals(3, result1.getVMs().length);
        for (VM vm : result1.getVMs()) {
            assertEquals(token, vm.getClientToken());
        }


        // 2. now re-launch with the same clientToken, should get back the same instances
        //    (and no new instances should have been started)

        final CreateRequest request2 = this.populator().
                getCreateRequest("suite:basic:idempotency", 240, 64, 3, token);
        final CreateResult result2 = rm.create(request2, caller);


        assertEquals(3, result2.getVMs().length);
        for (int i=0; i<result1.getVMs().length; i++) {
            final VM vm1 = result1.getVMs()[i];
            final VM vm2 = result2.getVMs()[i];

            assertEquals(vm1.getID(), vm2.getID());
            assertEquals(vm1.getClientToken(), vm2.getClientToken());
        }

        assertEquals(3, rm.getAllByCaller(caller).length);


        // 3. Kill one of the VMs and attempt to re-launch. Should get back the same
        //    3 but with one of them terminated

        final String terminatedId = result1.getVMs()[0].getID();
        rm.trash(terminatedId, Manager.INSTANCE, caller);
        assertEquals(2, rm.getAllByCaller(caller).length);

        final CreateRequest request3 = this.populator().
                getCreateRequest("suite:basic:idempotency", 240, 64, 3, token);
        final CreateResult result3 = rm.create(request3, caller);
        assertEquals(3, result3.getVMs().length);

        boolean foundTerminated = false;
        for (VM vm : result3.getVMs()) {
            if (vm.getID().equals(terminatedId)) {
                assertFalse(foundTerminated);
                foundTerminated = true;
                assertEquals(State.STATE_Cancelled, vm.getState().getState());
            }
View Full Code Here


        // 2. now make the same request but with a normal memory value, should make it through
        final CreateRequest request2 = this.populator().
                getIdempotentCreateRequest("suite:basic:idempotency", token);
        final CreateResult result2 = rm.create(request2, caller);
        assertNotNull(result2);
    }
View Full Code Here

        final Caller caller = this.populator().getCaller();
        final CreateRequest request1 =
                this.populator().getIdempotentCreateRequest("suite:basic:idempotency",
                        parallelIdempotencyTestToken);
        final CreateResult result1 = rm.create(request1, caller);

        logger.info("Leased vm '" + result1.getVMs()[0].getID() + '\'');
        assertEquals(parallelIdempotencyTestToken, result1.getVMs()[0].getClientToken());
        assertEquals("1", result1.getVMs()[0].getID());
    }
View Full Code Here

        VM[] allvms = rm.getGlobalAll();
        assertEquals(0, allvms.length);

        final Caller caller = this.populator().getCaller();
        final CreateResult result =
                rm.create(this.populator().getCreateRequest("suite:failure:leaseOne"),
                          caller);

        final VM[] vms = result.getVMs();
        assertEquals(1, vms.length);
        assertNotNull(vms[0]);
        logger.info("Leased vm '" + vms[0].getID() + '\'');

        assertTrue(rm.exists(vms[0].getID(), Manager.INSTANCE));
View Full Code Here

        final int numNodes = 5;
        final CreateRequest creq =
                this.populator().getCreateRequest("suite:failure:leaseMany",
                                                  durationSecs, memory, numNodes);
        final Caller caller = this.populator().getCaller();
        final CreateResult result = rm.create(creq, caller);

        final VM[] vms = result.getVMs();
        assertEquals(5, vms.length);
        for (int i = 0; i < vms.length; i++) {
            assertNotNull(vms[i]);
            logger.info("Leased vm '" + vms[i].getID() + '\'');
            assertTrue(rm.exists(vms[i].getID(), Manager.INSTANCE));
View Full Code Here

        final int numNodes = 1;
        final CreateRequest creq =
                this.populator().getCreateRequest("suite:failure:leaseOneWait",
                                                  durationSecs, memory, numNodes);
        final Caller caller = this.populator().getCaller();
        final CreateResult result = rm.create(creq, caller);

        final VM[] vms = result.getVMs();
        assertEquals(1, vms.length);
        assertNotNull(vms[0]);
        logger.info("Leased vm '" + vms[0].getID() + '\'');
        assertTrue(rm.exists(vms[0].getID(), Manager.INSTANCE));
View Full Code Here

        final int numNodes = 1;
        final CreateRequest creq =
                this.populator().getCreateRequest("suite:failure:unpropOneWait",
                                                  durationSecs, memory, numNodes);
        final Caller caller = this.populator().getCaller();
        final CreateResult result = rm.create(creq, caller);

        final VM[] vms = result.getVMs();
        assertEquals(1, vms.length);
        assertNotNull(vms[0]);
        logger.info("Leased vm '" + vms[0].getID() + '\'');
        assertTrue(rm.exists(vms[0].getID(), Manager.INSTANCE));
View Full Code Here

        assertEquals(0, allvms.length);
       
        MockShutdownTrash.resetFailCount();

        final Caller caller = this.populator().getCaller();
        final CreateResult result =
                rm.create(this.populator().getCreateRequest("suite:failure:basicFail"),
                          caller);

        final VM[] vms = result.getVMs();
        assertEquals(1, vms.length);
        assertNotNull(vms[0]);
        logger.info("Leased vm '" + vms[0].getID() + '\'');

        assertTrue(rm.exists(vms[0].getID(), Manager.INSTANCE));
View Full Code Here

TOP

Related Classes of org.nimbustools.api.repr.CreateResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.