mirror of https://github.com/apache/jclouds.git
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
e22206ae43
|
@ -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;
|
package org.jclouds.openstack.nova.v1_1.features;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMultimap;
|
import com.google.common.collect.ImmutableMultimap;
|
||||||
|
|
|
@ -96,7 +96,7 @@ public class FloatingIPClientLiveTest extends BaseNovaClientLiveTest {
|
||||||
for (String regionId : context.getApi().getConfiguredRegions()) {
|
for (String regionId : context.getApi().getConfiguredRegions()) {
|
||||||
FloatingIPClient client = context.getApi().getFloatingIPClientForRegion(regionId);
|
FloatingIPClient client = context.getApi().getFloatingIPClientForRegion(regionId);
|
||||||
ServerClient serverClient = context.getApi().getServerClientForRegion(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);
|
blockUntilServerActive(server.getId(), serverClient);
|
||||||
FloatingIP floatingIP = client.allocate();
|
FloatingIP floatingIP = client.allocate();
|
||||||
assertNotNull(floatingIP);
|
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 {
|
private void blockUntilServerActive(String serverId, ServerClient client) throws InterruptedException {
|
||||||
Server currentDetails = null;
|
Server currentDetails = null;
|
||||||
for (currentDetails = client.getServer(serverId); currentDetails.getStatus() != ServerStatus.ACTIVE; currentDetails = client
|
for (currentDetails = client.getServer(serverId); currentDetails.getStatus() != ServerStatus.ACTIVE; currentDetails = client
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
/**
|
||||||
|
* 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 org.jclouds.openstack.nova.v1_1.domain.KeyPair;
|
||||||
|
import org.jclouds.openstack.nova.v1_1.internal.BaseNovaClientLiveTest;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests behavior of {@code KeyPairClient}
|
||||||
|
*
|
||||||
|
* @author Michael Arnold
|
||||||
|
*/
|
||||||
|
@Test(groups = "live", testName = "KeyPairClientLiveTest")
|
||||||
|
public class KeyPairClientLiveTest extends BaseNovaClientLiveTest {
|
||||||
|
|
||||||
|
public void testListKeyPairs() throws Exception {
|
||||||
|
for (String regionId : context.getApi().getConfiguredRegions()) {
|
||||||
|
KeyPairClient client = context.getApi().getKeyPairClientForRegion(regionId);
|
||||||
|
Set<Map<String, KeyPair>> keyPairsList = client.listKeyPairs();
|
||||||
|
assertNotNull(keyPairsList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCreateAndDeleteKeyPair() throws Exception {
|
||||||
|
final String KEYPAIR_NAME = "testkp";
|
||||||
|
for(String regionId : context.getApi().getConfiguredRegions()) {
|
||||||
|
KeyPairClient client = context.getApi().getKeyPairClientForRegion(regionId);
|
||||||
|
KeyPair keyPair = null;
|
||||||
|
try {
|
||||||
|
keyPair = client.createKeyPair(KEYPAIR_NAME);
|
||||||
|
assertNotNull(keyPair);
|
||||||
|
} finally {
|
||||||
|
if (keyPair != null) {
|
||||||
|
client.deleteKeyPair(KEYPAIR_NAME);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCreateAndDeleteKeyPairWithPublicKey() throws Exception {
|
||||||
|
final String KEYPAIR_NAME = "testkp";
|
||||||
|
final String PUBLIC_KEY = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCrrBREFxz3002l1HuXz0+UOdJQ/mOYD5DiJwwB/TOybwIKQJPOxJWA9gBoo4k9dthTKBTaEYbzrll7iZcp59E80S6mNiAr3mUgi+x5Y8uyXeJ2Ws+h6peVyFVUu9epkwpcTd1GVfdcVWsTajwDz9+lxCDhl0RZKDFoT0scTxbj/w== nova@nv-aw2az2-api0002";
|
||||||
|
|
||||||
|
for(String regionId : context.getApi().getConfiguredRegions()) {
|
||||||
|
KeyPairClient client = context.getApi().getKeyPairClientForRegion(regionId);
|
||||||
|
KeyPair keyPair = null;
|
||||||
|
try {
|
||||||
|
keyPair = client.createKeyPairWithPublicKey(KEYPAIR_NAME, PUBLIC_KEY);
|
||||||
|
assertNotNull(keyPair);
|
||||||
|
} finally {
|
||||||
|
if (keyPair != null) {
|
||||||
|
client.deleteKeyPair(KEYPAIR_NAME);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,9 +23,6 @@ import com.google.inject.Guice;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import org.jclouds.json.BaseSetParserTest;
|
import org.jclouds.json.BaseSetParserTest;
|
||||||
import org.jclouds.json.config.GsonModule;
|
import org.jclouds.json.config.GsonModule;
|
||||||
import org.jclouds.openstack.domain.Link;
|
|
||||||
import org.jclouds.openstack.domain.Link.Relation;
|
|
||||||
import org.jclouds.openstack.domain.Resource;
|
|
||||||
import org.jclouds.openstack.nova.v1_1.config.NovaParserModule;
|
import org.jclouds.openstack.nova.v1_1.config.NovaParserModule;
|
||||||
import org.jclouds.openstack.nova.v1_1.domain.FloatingIP;
|
import org.jclouds.openstack.nova.v1_1.domain.FloatingIP;
|
||||||
import org.jclouds.rest.annotations.SelectJson;
|
import org.jclouds.rest.annotations.SelectJson;
|
||||||
|
@ -33,7 +30,6 @@ import org.testng.annotations.Test;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import java.net.URI;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,25 +18,20 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.openstack.nova.v1_1.parse;
|
package org.jclouds.openstack.nova.v1_1.parse;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import org.jclouds.json.BaseItemParserTest;
|
import org.jclouds.json.BaseItemParserTest;
|
||||||
import org.jclouds.json.config.GsonModule;
|
import org.jclouds.json.config.GsonModule;
|
||||||
import org.jclouds.openstack.domain.Link;
|
|
||||||
import org.jclouds.openstack.domain.Link.Relation;
|
|
||||||
import org.jclouds.openstack.nova.v1_1.config.NovaParserModule;
|
import org.jclouds.openstack.nova.v1_1.config.NovaParserModule;
|
||||||
import org.jclouds.openstack.nova.v1_1.domain.Flavor;
|
|
||||||
import org.jclouds.openstack.nova.v1_1.domain.FloatingIP;
|
import org.jclouds.openstack.nova.v1_1.domain.FloatingIP;
|
||||||
import org.jclouds.rest.annotations.SelectJson;
|
import org.jclouds.rest.annotations.SelectJson;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import java.net.URI;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jeremy Daggett
|
* @author Michael Arnold
|
||||||
*/
|
*/
|
||||||
@Test(groups = "unit", testName = "ParseFloatingIPTest")
|
@Test(groups = "unit", testName = "ParseFloatingIPTest")
|
||||||
public class ParseFloatingIPTest extends BaseItemParserTest<FloatingIP> {
|
public class ParseFloatingIPTest extends BaseItemParserTest<FloatingIP> {
|
||||||
|
|
Loading…
Reference in New Issue