Expose the Jetty state in the S3Proxy interface.

The commit adds a getState() method, which exposes the Jetty state
to the caller. This is useful to check whether the server is running
or is in some other state.
pull/42/head
Timur Alperovich 2015-02-18 15:38:44 -08:00 zatwierdzone przez Andrew Gaul
rodzic b85ab17316
commit 51e7f3c22a
2 zmienionych plików z 9 dodań i 0 usunięć

Wyświetl plik

@ -94,6 +94,10 @@ public final class S3Proxy {
return ((ServerConnector) server.getConnectors()[0]).getLocalPort();
}
public String getState() {
return server.getState();
}
public static void main(String[] args) throws Exception {
if (args.length == 1 && args[0].equals("--version")) {
System.err.println(

Wyświetl plik

@ -34,6 +34,7 @@ import com.google.common.io.ByteSource;
import com.google.common.io.Resources;
import com.google.inject.Module;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.jclouds.Constants;
import org.jclouds.ContextBuilder;
import org.jclouds.blobstore.BlobRequestSigner;
@ -117,6 +118,10 @@ public final class S3ProxyTest {
keyStorePassword,
"true".equalsIgnoreCase(forceMultiPartUpload), virtualHost);
s3Proxy.start();
while (!s3Proxy.getState().equals(AbstractLifeCycle.STARTED)) {
Thread.sleep(1);
}
// reset endpoint to handle zero port
s3Endpoint = new URI(s3Endpoint.getScheme(), s3Endpoint.getUserInfo(),
s3Endpoint.getHost(), s3Proxy.getPort(), s3Endpoint.getPath(),