Package org.nimbustools.api.repr

Examples of org.nimbustools.api.repr.Caller


    @Test
    @DirtiesContext
    public void multipleRequests() throws Exception {
        logger.debug("multipleRequests");
       
        Caller caller1 = this.populator().getCaller("CALLER1");
        Caller caller2 = this.populator().getCaller("CALLER2");
        Manager rm = this.locator.getManager();
       
        Double previousPrice = rm.getSpotPrice();
       
        final Double bid1 = previousPrice + 3;
View Full Code Here


    @Test
    @DirtiesContext
    public void memoryFreed() throws Exception {
        final Manager rm = this.locator.getManager();
        final Caller caller = this.populator().getCaller();
        final CreateRequest request =
                this.populator().getCreateRequest("memoryFreed", 240, 63, 1);
        final CreateResult result = rm.create(request, caller);
        final VM[] vms = result.getVMs();
View Full Code Here

    @Test
    @DirtiesContext
    public void badNetworkMemoryFreed() throws Exception {
        final Manager rm = this.locator.getManager();
        final Caller caller = this.populator().getCaller();
        final CreateRequest request =
                this.populator().getCreateRequest("badNetworkMemoryFreed", 240, 63, 1, null, "notarealnetwork");
        boolean gotError = false;
        try {
            rm.create(request, caller);
View Full Code Here

    @Test
    public void leaseOnePublicOnePrivate() throws Exception {
        logger.debug("leaseOnePublicOnePrivate");
        final Manager rm = this.locator.getManager();

        final Caller caller = this.populator().getCaller();

        /* One */
        final CreateRequest req =
                this.populator().getCreateRequestCustomNetwork(
                        "suite:issue37:leaseOnePublicOnePrivate",
View Full Code Here

    @Test
    public void leaseTwoPrivate() throws Exception {
        logger.debug("leaseTwoPrivate");
        final Manager rm = this.locator.getManager();

        final Caller caller = this.populator().getCaller();

        /* One */
        final CreateRequest req =
                this.populator().getCreateRequestCustomNetwork(
                        "suite:issue37:leaseTwoPrivate",
View Full Code Here

     */
    @Test(dependsOnGroups="prereqs")
    public void persistOne() throws Exception {
        logger.debug("persistOne");
        final Manager rm = this.locator.getManager();
        final Caller caller = this.populator().getCaller();

        PersistenceAdapter persistence = (PersistenceAdapter) applicationContext.getBean("nimbus-rm.persistence.PersistenceAdapter");
        AsyncRequestMap asyncRequestMap = new AsyncRequestMap(persistence);


        // Validate that we have a working AsyncRequestMap. It should be empty
        Collection<AsyncRequest> allRequests = asyncRequestMap.getAll();
        logger.debug("You have " + allRequests.size() + " requests.");
        assert(allRequests.size() == 0);

        // Test putting and getting from persistence
        String testID = "fake-id";
        Double testMaxBid = 42.0;
        boolean testSpotinstances = false;
        String testGroupID = "fake-group-id";
        boolean testIsPersistent = true;
        Caller testCaller = this.populator().getSuperuserCaller();
        Context context = null;
        String testSshKeyName = "fake-ssh-key";
        Calendar testCreationTime = Calendar.getInstance();
        testCreationTime.setTimeInMillis(424242424242l);
        String testNIC = "FakeName;FakeAssociation;FAKEMAC;NetMode;IPmethod;192.168.1.42;192.168.1.1;192.168.1.2;subnetmask;dns;hostname;null;null;null;null";
View Full Code Here


        logger.debug("leaseOne");
        final Manager rm = this.locator.getManager();

        final Caller caller = this.populator().getCaller();

        final CreateRequest req =
                this.populator().getCreateRequest(
                        "suite:availabilityZone:leaseOne");
View Full Code Here

    @Test
    public void leaseOneZone1OneZone2() throws Exception {
        logger.debug("leaseOneZone1OneZone2");
        final Manager rm = this.locator.getManager();

        final Caller caller = this.populator().getCaller();

        /* One */
        final CreateRequest req =
                this.populator().getCreateRequestCustomZone(
                        "suite:availabilityZone:leaseOneZone1OneZone2",
View Full Code Here

    @Test(groups="dirtyTest")
    public void dirtyTest() throws Exception {
        logger.debug("dirtyTest");
        final Manager rm = this.locator.getManager();

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

        final VM[] vms = result.getVMs();
View Full Code Here

            if(vms == null || vms.length == 0)
                return errorMsg;

            for(int i = 0; i < vms.length; i++) {
                String id = vms[i].getID();
                Caller caller = vms[i].getCreator();
                try {
                    manager.shutdown(id, manager.INSTANCE, null, caller);
                } catch (OperationDisabledException e) {
                    logger.warn("Shutdown is currently disabled for instance " + id);
                    if (returnMsg == null) {
                        returnMsg = "Shutdown is currently disabled for instance " + id;
                    } else {
                        returnMsg += "\nShutdown is currently disabled for instance " + id;
                    }
                }
            }

            //checks every 3 seconds to see if one of the vms has entered propagation mode
            //up to a max of 30 seconds before trashing all vms
            //I decided against checking every single vm for entering propagation mode since they mostly enter at
            //about the same speed
            if(seconds == null) {
                for(int i = 0; i <= 10; i++) {
                    Thread.sleep(3000);
                    vms = typeSet(type, typeID);
                    if(vms[0].getState().getState().equals("Propagated"))
                        break;
                }
            }
            //same as above, but max time is the amount of seconds entered by the user
            else {
                int mill = (Integer.parseInt(seconds)) * 1000;
                for(int i = 0; i <= mill; i += 3000) {
                    Thread.sleep(3000);
                    vms = typeSet(type, typeID);
                    if(vms[0].getState().getState().equals("Propagated"))
                        break;
                }
            }

            //eventually trashes all vms regardless of whether or not they enter propagation mode
            vms = typeSet(type, typeID);

            for(int i = 0; i < vms.length; i++) {
                String id = vms[i].getID();
                Caller caller = vms[i].getCreator();
                if (force || vms[i].getState().getState().equals("Propagated")) {
                    manager.trash(id, manager.INSTANCE, caller);
                } else {
                    if (returnMsg == null) {
                        returnMsg = "Instance " + id + " not trashed because it is was not shut down correctly and --force is off";
View Full Code Here

TOP

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

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.