From ec2a83197d6e9cd623a978ccf1302ac07e9c4e84 Mon Sep 17 00:00:00 2001 From: Mike Arnold Date: Fri, 9 Mar 2012 14:19:01 -0600 Subject: [PATCH] updating live test to work with other nova installations --- .../features/FloatingIPClientExpectTest.java | 18 ++++++++++++++++++ .../features/FloatingIPClientLiveTest.java | 12 +++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/labs/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/features/FloatingIPClientExpectTest.java b/labs/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/features/FloatingIPClientExpectTest.java index e1d95586ad..8f1a3ec534 100644 --- a/labs/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/features/FloatingIPClientExpectTest.java +++ b/labs/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/features/FloatingIPClientExpectTest.java @@ -1,3 +1,21 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ package org.jclouds.openstack.nova.v1_1.features; import com.google.common.collect.ImmutableMultimap; diff --git a/labs/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/features/FloatingIPClientLiveTest.java b/labs/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/features/FloatingIPClientLiveTest.java index cc1847457f..f2157e23b7 100644 --- a/labs/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/features/FloatingIPClientLiveTest.java +++ b/labs/openstack-nova/src/test/java/org/jclouds/openstack/nova/v1_1/features/FloatingIPClientLiveTest.java @@ -96,7 +96,7 @@ public class FloatingIPClientLiveTest extends BaseNovaClientLiveTest { for (String regionId : context.getApi().getConfiguredRegions()) { FloatingIPClient client = context.getApi().getFloatingIPClientForRegion(regionId); ServerClient serverClient = context.getApi().getServerClientForRegion(regionId); - Server server = serverClient.createServer("test", "121", "100"); + Server server = serverClient.createServer("test", imageIdForRegion(regionId), flavorRefForRegion(regionId)); blockUntilServerActive(server.getId(), serverClient); FloatingIP floatingIP = client.allocate(); assertNotNull(floatingIP); @@ -111,6 +111,16 @@ public class FloatingIPClientLiveTest extends BaseNovaClientLiveTest { } } + private String imageIdForRegion(String regionId) { + ImageClient imageClient = context.getApi().getImageClientForRegion(regionId); + return Iterables.getLast(imageClient.listImages()).getId(); + } + + private String flavorRefForRegion(String regionId) { + FlavorClient flavorClient = context.getApi().getFlavorClientForRegion(regionId); + return Iterables.getLast(flavorClient.listFlavors()).getId(); + } + private void blockUntilServerActive(String serverId, ServerClient client) throws InterruptedException { Server currentDetails = null; for (currentDetails = client.getServer(serverId); currentDetails.getStatus() != ServerStatus.ACTIVE; currentDetails = client