Package org.jclouds.openstack.trove.v1.features

Examples of org.jclouds.openstack.trove.v1.features.FlavorApiLiveTest


      super.setup();
      TroveUtils utils = new TroveUtils(api);
      for (String zone : api.getConfiguredZones()) {
         // create instances
         List<Instance> instanceList = Lists.newArrayList();
         Instance first = utils.getWorkingInstance(zone, "first_database_testing_" + zone, "1", 1);
         Instance second = utils.getWorkingInstance(zone, "second_database_testing_" + zone, "1", 1);
         instanceList.add(first);
         instanceList.add(second);
         instancesToDelete.put(zone, instanceList);

         DatabaseApi databaseApiFirst = api.getDatabaseApiForZoneAndInstance(zone, first.getId());
         DatabaseApi databaseApiSecond = api.getDatabaseApiForZoneAndInstance(zone, second.getId());
         databaseApiFirst.create("livetest_db1");
         databaseApiFirst.create("livetest_db2");
         databaseApiSecond.create("livetest_db3");
      }
   }
View Full Code Here


      super.setup();
      TroveUtils utils = new TroveUtils(api);
      for (String zone : api.getConfiguredZones()) {
         // create instances
         List<Instance> instanceList = Lists.newArrayList();
         Instance first = utils.getWorkingInstance(zone, "first_user_trove_live_testing_" + zone, "1", 1);
         Instance second = utils.getWorkingInstance(zone, "second_user_trove_live_testing_" + zone, "1", 1);
         instanceList.add(first);
         instanceList.add(second);
         instancesToDelete.put(zone, instanceList);
         // create users
         User user1 = User.builder()
               .name("user1")
               .password(UUID.randomUUID().toString())
               .databases(ImmutableSet.of(
                     "u1db1",
                     "u1db2")).build();
         User user2 = User.builder()
               .name("user2")
               .password(UUID.randomUUID().toString())
               .databases(ImmutableSet.of(
                     "u2db1",
                     "u2db2")).build();
         User user3 = User.builder()
               .name("user3")
               .password(UUID.randomUUID().toString())
               .host("173.203.44.122")
               .databases(ImmutableSet.of(
                     "u3db1",
                     "u3db2")).build();
         UserApi userApiFirst = api.getUserApiForZoneAndInstance(zone, first.getId());
         UserApi userApiSecond = api.getUserApiForZoneAndInstance(zone, second.getId());
         userApiFirst.create(ImmutableSet.of(user1, user2));
         userApiSecond.create(ImmutableSet.of(user3));
      }
   }
View Full Code Here

        List<HttpResponse> responses = ImmutableList.of(responseWithKeystoneAccess,                       createInstanceFail, createInstanceFail, createInstanceSuccess, badStatus,   deleteInstanceResponse, deletedStatus, createInstanceFail, createInstanceSuccess, goodStatus);

        TroveApi api = orderedRequestsSendResponses(requests, responses);

        TroveUtils utils = new TroveUtils(api);
        Instance instance = utils.getWorkingInstance("RegionOne", "json_rack_instance", "1", 2);
        assertEquals(instance.getSize(), 2);
        assertEquals(instance.getName(), "json_rack_instance")
    }
View Full Code Here

        TroveUtils utils = new TroveUtils(api);
        for (String region : api.getConfiguredRegions()) {
            List<Instance> regionList = Lists.newArrayList();
            InstanceApi instanceApi = api.getInstanceApi(region);
            regionList.add(utils.getWorkingInstance(region, "first_instance_testing_" + region, "1", 1));
            Instance second = utils.getWorkingInstance(region, "second_instance_testing_" + region, "1", 1);
            instanceApi.enableRoot(second.getId());
            regionList.add(second);
            created.put(region, regionList);
        }
    }
View Full Code Here

    @Test
    public void testGetInstance() {
        for (String region : api.getConfiguredRegions()) {
            InstanceApi instanceApi = api.getInstanceApi(region);
            for (Instance instance : instanceApi.list()) {
                Instance instanceFromGet = instanceApi.get(instance.getId());
                assertNotNull(instanceFromGet.getHostname());
                assertNull(instance.getHostname());
                assertEquals(instanceFromGet.getId(), instance.getId());
                assertEquals(instanceFromGet.getName(), instance.getName());
                assertEquals(instanceFromGet.getStatus(), instance.getStatus());
                assertEquals(instanceFromGet.getFlavor(), instance.getFlavor());
                assertEquals(instanceFromGet.getSize(), instance.getSize());
                assertEquals(instanceFromGet.getLinks(), instance.getLinks());
            }
        }
    }
View Full Code Here

    @Test
    public void testGetRootStatus() {
        for (String region : api.getConfiguredRegions()) {
            InstanceApi instanceApi = api.getInstanceApi(region);
            Iterator<Instance> iterator = instanceApi.list().iterator();
            Instance first;
            Instance second;
            do {
               first = iterator.next();
            } while(!first.getName().contains("instance_testing"));
            do {
               second = iterator.next();
            } while(!second.getName().contains("instance_testing"));
            assertTrue(instanceApi.isRooted(first.getId()) || instanceApi.isRooted(second.getId()));
        }
    }
View Full Code Here

                .payload(payloadFromResourceWithContentType("/instance_create_request.json", MediaType.APPLICATION_JSON))
                .build(),
                HttpResponse.builder().statusCode(200).payload(payloadFromResource("/instance_create.json")).build() // response
                ).getInstanceApi("RegionOne");

        Instance instance = api.create("1", 2, "json_rack_instance");
        assertEquals(instance.getSize(), 2);
        assertEquals(instance.getName(), "json_rack_instance")
    }
View Full Code Here

            responseWithKeystoneAccess,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/instance_get.json")).build()
      ).getInstanceApi("RegionOne");

      Instance instance = api.get("44b277eb-39be-4921-be31-3d61b43651d7");
      assertEquals(instance.getName(), "json_rack_instance");
      assertEquals(instance.getId(), "44b277eb-39be-4921-be31-3d61b43651d7");
      assertEquals(instance.getLinks().size(), 2);
      assertEquals(instance.getHostname(), "e09ad9a3f73309469cf1f43d11e79549caf9acf2.rackspaceclouddb.com");
   }
View Full Code Here

         Instance second = utils.getWorkingInstance(zone, "second_user_trove_live_testing_" + zone, "1", 1);
         instanceList.add(first);
         instanceList.add(second);
         instancesToDelete.put(zone, instanceList);
         // create users
         User user1 = User.builder()
               .name("user1")
               .password(UUID.randomUUID().toString())
               .databases(ImmutableSet.of(
                     "u1db1",
                     "u1db2")).build();
         User user2 = User.builder()
               .name("user2")
               .password(UUID.randomUUID().toString())
               .databases(ImmutableSet.of(
                     "u2db1",
                     "u2db2")).build();
         User user3 = User.builder()
               .name("user3")
               .password(UUID.randomUUID().toString())
               .host("173.203.44.122")
               .databases(ImmutableSet.of(
                     "u3db1",
View Full Code Here

         for(Instance instance : instancesToDelete.get(zone)) {
            UserApi userApi = api.getUserApiForInstanceInZone(instance.getId(), zone);
            if(!instance.getName().contains("user_trove_live_testing"))continue;
            assertTrue(userApi.list().size() >=1);
            for(User user : userApi.list()){
               User userFromGet = userApi.get(user.getIdentifier());
               assertEquals(userFromGet.getName(), user.getName());
               assertEquals(userFromGet.getHost(), user.getHost());
               assertEquals(userFromGet.getIdentifier(), user.getIdentifier());
               assertEquals(userFromGet.getDatabases(), user.getDatabases());
               assertEquals(userFromGet, user);
            }
         } 
      }
   }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.trove.v1.features.FlavorApiLiveTest

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.