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

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


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

      Flavor flavor = api.get(1);
      assertEquals(flavor.getName(), "512MB Instance");
      assertEquals(flavor.getId(), 1);
      assertEquals(flavor.getRam(), 512);
      assertEquals(flavor.getLinks().size(), 2);
   }
View Full Code Here


               authenticatedGET().endpoint(endpoint).build(),
               HttpResponse.builder().statusCode(200).payload(payloadFromResource("/flavor_list.json")).build() );
        FlavorApi api = redDwarfApi.getFlavorApiForZone("RegionOne");

        Set<? extends Flavor> flavors = api.list( redDwarfApi.getCurrentTenantId().get().getId() ).toSet();
        Flavor flavor = flavors.iterator().next();
        assertEquals(flavor.getName(), "512MB Instance");
        assertEquals(flavor.getId(), 1);
        assertEquals(flavor.getRam(), 512);
        assertEquals(flavor.getLinks().size(), 2);
     }
View Full Code Here

    */
   public static void main(String[] args) throws IOException {
      CreateInstance createInstance = new CreateInstance(args[0], args[1]);

      try {
         Flavor flavor = createInstance.getFlavor();
         createInstance.createInstance(flavor);
      }
      catch (Exception e) {
         e.printStackTrace();
      }
View Full Code Here

    @Test
    public void testGetFlavor() {
        for (String zone : api.getConfiguredZones()) {
            FlavorApi flavorApi = api.getFlavorApiForZone(zone);          
            for (Flavor flavor : flavorApi.list()) {
                Flavor flavorFromGet = flavorApi.get(flavor.getId());
                assertEquals(flavorFromGet.getId(), flavor.getId());
                assertEquals(flavorFromGet.getRam(), flavor.getRam());
                assertEquals(flavorFromGet.getName(), flavor.getName());
                assertEquals(flavorFromGet.getLinks(), flavor.getLinks());
            }
        }
    }
View Full Code Here

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

      Flavor flavor = api.get(1);
      assertEquals(flavor.getName(), "512MB Instance");
      assertEquals(flavor.getId(), 1);
      assertEquals(flavor.getRam(), 512);
      assertEquals(flavor.getLinks().size(), 2);
   }
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.getUserApiForInstanceInZone(first.getId(), zone);
         UserApi userApiSecond = api.getUserApiForInstanceInZone(second.getId(), zone);
         userApiFirst.create(ImmutableSet.of(user1, user2));
         userApiSecond.create(ImmutableSet.of(user3));
      }
   }
View Full Code Here

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

    @Test
    public void testGetInstance() {
        for (String zone : api.getConfiguredZones()) {
            InstanceApi instanceApi = api.getInstanceApiForZone(zone);          
            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 zone : api.getConfiguredZones()) {
            InstanceApi instanceApi = api.getInstanceApiForZone(zone);
            Iterator<Instance> iterator = instanceApi.list().iterator();
            Instance first, 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

      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.getDatabaseApiForInstanceInZone(first.getId(), zone);
         DatabaseApi databaseApiSecond = api.getDatabaseApiForInstanceInZone(second.getId(), zone);        
         databaseApiFirst.create("livetest_db1");
         databaseApiFirst.create("livetest_db2");
         databaseApiSecond.create("livetest_db3");
      }
   }
View Full Code Here

TOP

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

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.