diff --git a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/live/nonmaven/SimpleCreateServerCheck.java b/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/live/ComputeSericeCheck.java similarity index 79% rename from sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/live/nonmaven/SimpleCreateServerCheck.java rename to sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/live/ComputeSericeCheck.java index afbb03ff11..d99854eb36 100644 --- a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/live/nonmaven/SimpleCreateServerCheck.java +++ b/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/live/ComputeSericeCheck.java @@ -1,4 +1,4 @@ -package org.jclouds.openstack.nova.live.nonmaven; +package org.jclouds.openstack.nova.live; import com.google.common.collect.ImmutableSet; import org.jclouds.compute.ComputeService; @@ -21,7 +21,11 @@ import java.util.Set; import static org.jclouds.openstack.nova.live.PropertyHelper.setupOverrides; import static org.jclouds.openstack.nova.live.PropertyHelper.setupProperties; -public class SimpleCreateServerCheck { +/** + * Not intended to be run with maven and does not performs a cleanup after tests + * @author Dmitri Babaev + */ +public class ComputeSericeCheck { private ComputeServiceContextFactory contextFactory; private ComputeServiceContext context; @@ -32,6 +36,16 @@ public class SimpleCreateServerCheck { context = contextFactory.createContext("nova", ImmutableSet.of(new JschSshClientModule(), new SLF4JLoggingModule()), properties); } + + @Test + public void testLists() { + ComputeService cs = context.getComputeService(); + + System.out.println(cs.listImages()); + System.out.println(cs.listHardwareProfiles()); + System.out.println(cs.listAssignableLocations()); + System.out.println(cs.listNodes()); + } @Test public void testCreateServer() throws RunNodesException { diff --git a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/live/PropertyHelper.java b/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/live/PropertyHelper.java index 45e23ac013..b12950470f 100644 --- a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/live/PropertyHelper.java +++ b/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/live/PropertyHelper.java @@ -8,13 +8,13 @@ import org.jclouds.Constants; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.InputStream; import java.util.Map; import java.util.Properties; /** * @author Victor Galkin */ - public class PropertyHelper { public static String provider = "nova"; @@ -30,10 +30,12 @@ public class PropertyHelper { "public", Files.toString(new File(properties.getProperty("test.ssh.keyfile.public")), Charsets.UTF_8)); } - public static Properties setupProperties(Class clazz) throws IOException { + public static Properties setupProperties(Class clazz) throws IOException { Properties properties = new Properties(); - properties.load(clazz.getResourceAsStream("/test.properties")); + InputStream propertiesStream = clazz.getResourceAsStream("/test.properties"); + if (propertiesStream != null) + properties.load(propertiesStream); overridePropertyFromSystemProperty(properties, "test." + provider + ".endpoint"); overridePropertyFromSystemProperty(properties, "test." + provider + ".apiversion"); overridePropertyFromSystemProperty(properties, "test." + provider + ".identity"); diff --git a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/live/nonmaven/SimpleListCheck.java b/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/live/nonmaven/SimpleListCheck.java deleted file mode 100644 index c868a90c06..0000000000 --- a/sandbox-apis/nova/src/test/java/org/jclouds/openstack/nova/live/nonmaven/SimpleListCheck.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jclouds.openstack.nova.live.nonmaven; - -import com.google.common.collect.ImmutableSet; -import org.jclouds.compute.ComputeService; -import org.jclouds.compute.ComputeServiceContext; -import org.jclouds.compute.ComputeServiceContextFactory; -import org.jclouds.logging.slf4j.config.SLF4JLoggingModule; -import org.jclouds.ssh.jsch.config.JschSshClientModule; -import org.testng.annotations.AfterTest; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - -import java.io.IOException; -import java.util.Properties; - -import static org.jclouds.openstack.nova.live.PropertyHelper.setupOverrides; -import static org.jclouds.openstack.nova.live.PropertyHelper.setupProperties; - -public class SimpleListCheck { - private ComputeServiceContextFactory contextFactory; - private ComputeServiceContext context; - - @BeforeTest - public void setupClient() throws IOException { - contextFactory = new ComputeServiceContextFactory(); - Properties properties = setupOverrides(setupProperties(this.getClass())); - context = contextFactory.createContext("nova", - ImmutableSet.of(new JschSshClientModule(), new SLF4JLoggingModule()), properties); - } - - @Test - public void testLists() { - ComputeService cs = context.getComputeService(); - - System.out.println(cs.listImages()); - System.out.println(cs.listHardwareProfiles()); - System.out.println(cs.listAssignableLocations()); - System.out.println(cs.listNodes()); - } - - @AfterTest - public void after() { - context.close(); - } - - //curl -v -H "X-Auth-User:admin" -H "X-Auth-Key: d744752f-20d3-4d75-979f-f62f16033b07" http://dragon004.hw.griddynamics.net:8774/v1.0/ - //curl -v -H "X-Auth-Token: c97b10659008d5a9ce91462f8c6a5c2c80439762" http://dragon004.hw.griddynamics.net:8774/v1.0/images/detail?format=json - -} diff --git a/sandbox-apis/nova/src/test/resources/.gitignore b/sandbox-apis/nova/src/test/resources/.gitignore new file mode 100644 index 0000000000..c6e479480a --- /dev/null +++ b/sandbox-apis/nova/src/test/resources/.gitignore @@ -0,0 +1 @@ +/test.properties