mirror of https://github.com/apache/jclouds.git
issue 384: StartJettyIfNotAlreadyRunning
This commit is contained in:
parent
3a9ac55e4a
commit
fb4f8a7cb5
|
@ -70,6 +70,9 @@ public class VirtualBoxPropertiesBuilder extends PropertiesBuilder {
|
|||
|
||||
// TODO: Add more properties and use the wired properties from test code.
|
||||
properties.put(VirtualBoxConstants.VIRTUALBOX_DISTRO_ISO_NAME, "ubuntu-11.04-server-i386.iso");
|
||||
|
||||
properties.put(VirtualBoxConstants.VIRTUALBOX_JETTY_PORT, "8080");
|
||||
|
||||
return properties;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,11 +34,13 @@ import javax.inject.Inject;
|
|||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Iterables;
|
||||
import org.jclouds.compute.ComputeServiceAdapter;
|
||||
import org.jclouds.compute.domain.Image;
|
||||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.location.suppliers.JustProvider;
|
||||
import org.jclouds.virtualbox.config.VirtualBoxConstants;
|
||||
import org.jclouds.virtualbox.functions.IMachineToImage;
|
||||
import org.virtualbox_4_1.CleanupMode;
|
||||
import org.virtualbox_4_1.IMachine;
|
||||
import org.virtualbox_4_1.IProgress;
|
||||
|
@ -90,8 +92,13 @@ public class VirtualBoxComputeServiceAdapter implements ComputeServiceAdapter<IM
|
|||
return iMachine.getName().startsWith(VIRTUALBOX_IMAGE_PREFIX);
|
||||
}
|
||||
};
|
||||
IMachineToImage fn = new IMachineToImage(manager);
|
||||
|
||||
for (IMachine imachine : filter(manager.getVBox().getMachines(), imagePredicate)) {
|
||||
Image image = fn.apply(imachine);
|
||||
System.out.println(image.getVersion());
|
||||
}
|
||||
return filter(manager.getVBox().getMachines(), imagePredicate);
|
||||
// return manager.getVBox().getMachines();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -24,7 +24,7 @@ package org.jclouds.virtualbox.config;
|
|||
/**
|
||||
* Configuration properties used for interacting with VirtualBox instances.
|
||||
*
|
||||
* @author Mattias Holmqvist
|
||||
* @author Mattias Holmqvist, Andrea Turli
|
||||
*
|
||||
*/
|
||||
public interface VirtualBoxConstants {
|
||||
|
@ -54,4 +54,6 @@ public interface VirtualBoxConstants {
|
|||
public static final String VIRTUALBOX_HOST_ID = "jclouds.virtualbox.hostid";
|
||||
|
||||
public static final String VIRTUALBOX_DISTRO_ISO_NAME = "jclouds.virtualbox.distroisoname";
|
||||
|
||||
public static final String VIRTUALBOX_JETTY_PORT = "jclouds.virtualbox.jetty.port";
|
||||
}
|
||||
|
|
|
@ -21,23 +21,29 @@
|
|||
|
||||
package org.jclouds.virtualbox.functions.admin;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.io.ByteStreams.copy;
|
||||
import static com.google.common.io.Closeables.closeQuietly;
|
||||
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_WORKINGDIR;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.virtualbox.config.VirtualBoxConstants;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.io.ByteStreams.copy;
|
||||
import static com.google.common.io.Closeables.closeQuietly;
|
||||
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_WORKINGDIR;
|
||||
import com.google.common.base.Function;
|
||||
|
||||
/**
|
||||
* @author Mattias Holmqvist
|
||||
|
|
|
@ -47,6 +47,7 @@ import org.jclouds.net.IPSocket;
|
|||
import org.jclouds.predicates.InetSocketAddressConnect;
|
||||
import org.testng.annotations.AfterSuite;
|
||||
import org.testng.annotations.BeforeSuite;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
@ -120,6 +121,7 @@ public class SetupVirtualBoxForLiveTest {
|
|||
|
||||
@BeforeSuite
|
||||
public void setupClient() throws Exception {
|
||||
logger().info("\n\n\n\nSetting up Virtualbox environment");
|
||||
context = TestUtils.computeServiceForLocalhostAndGuest();
|
||||
setupCredentials();
|
||||
setupConfigurationProperties();
|
||||
|
|
Loading…
Reference in New Issue