Merged branch 'jetty-9.3.x' into 'master'.

This commit is contained in:
Simone Bordet 2015-10-19 12:35:26 +02:00
commit 964afc3020
32 changed files with 238 additions and 276 deletions

View File

@ -1,5 +1,12 @@
jetty-9.4.0-SNAPSHOT
jetty-9.3.5.v20151012 - 12 October 2015
+ 479343 calls to MetaData#orderFragments() with relative ordering adds
duplicate jars
+ 479537 Server preface sent after client preface reply.
+ 479584 WS Session does not contain UpgradeRequest information in
WebSocketAdapter.onWebSocketConnect callback
jetty-9.3.4.v20151007 - 07 October 2015
+ 428474 Expose batch mode in the Jetty WebSocket API
+ 472082 isOpen returns true on CLOSING Connection

View File

@ -4,27 +4,18 @@
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- ============================================================================================== -->
<!-- GCloud configuration from property file -->
<!-- Note: passwords stored in the property file can use jetty obfuscation (see -->
<!-- GCloud configuration. -->
<!-- Note: passwords can use jetty obfuscation. See -->
<!-- https://www.eclipse.org/jetty/documentation/current/configuring-security-secure-passwords.html -->
<!-- ============================================================================================== -->
<Call id="gconf" class="org.eclipse.jetty.gcloud.session.GCloudConfiguration" name="fromFile">
<Arg><Property name="jetty.base" default="."/>/<Property name="jetty.gcloudSession.configFile" default="etc/gcloud.props"/></Arg>
</Call>
<!-- ============================================================================================== -->
<!-- Alternate GCloud configuration from properties -->
<!-- Note: passwords can use jetty obfuscation (see -->
<!-- https://www.eclipse.org/jetty/documentation/current/configuring-security-secure-passwords.html -->
<!-- ============================================================================================== -->
<!--
<New id="gconf" class="org.eclipse.jetty.gcloud.session.GCloudConfiguration">
<!-- To contact remote gclouddatastore set the following properties in start.ini -->
<!-- Either set jetty.gcloudSession.projectId or use system property/env var DATASTORE_DATASET-->
<Set name="projectId"><Property name="jetty.gcloudSession.projectId"/></Set>
<Set name="p12File"><Property name="jetty.gcloudSession.p12File"/></Set>
<Set name="serviceAccount"><Property name="jetty.gcloudSession.serviceAccount"/></Set>
<Set name="password"><Property name="jetty.gcloudSession.password"/></Set>
</New>
-->
<!-- ===================================================================== -->

View File

@ -53,23 +53,39 @@ https://github.com/GoogleCloudPlatform/gcloud-java
http://www.apache.org/licenses/LICENSE-2.0.html
[ini-template]
## GCloudDatastore Session config
## Unique identifier for this node in the cluster
# jetty.gcloudSession.workerName=node1
## Name of properties files containing gcloud config
#jetty.gcloudSession.configFilet=etc/gcloud.props
##Alternative to properties file, individual properties
## the gcloud projectId
## GCloudDatastore Session config
## If running inside Google cloud all configuration is provided by
## environment variables and you do not need to set anything in this file.
##
## If running externally to Google:
## To contact the remote gcloud datastore:
## 1. set the DATASTORE_DATASET System property/environment variable to the name of your project
## or alternatively set the jetty.gcloudSession.projectId property below.
## 2. set the jetty.gcloudSession.p12File, jetty.gcloudSession.serviceAccount and
## jetty.gcloudSession.password (supports obfuscation) below.
##
## To contact a local dev gcloud datastore server:
## 1. set the DATASTORE_DATASET System property/environment variable to the name of your project.
## 2. set the DATASTORE_HOST System property/environment variable to the url of the dev server
## as described at https://cloud.google.com/datastore/docs/tools/devserver#setting_environment_variables
## The gcloud projectId
## Set this property to connect to remote gcloud datastore.
## Or, set the DATASTORE_DATASET System property/env variable instead.
#jetty.gcloudSession.projectId=
## the p12 file associated with the project
## The p12 file associated with the project.
## Set this property to connect to remote gcloud datastore
#jetty.gcloudSession.p12File=
## the serviceAccount for the Datastore
## The serviceAccount for the Datastore.
## Set this property to connect to to remote gcloud datastore
#jetty.gcloudSession.serviceAccount=
## the password (can be obfuscated)
## The password (can be obfuscated).
## Set this property to connect to remote gcloud datastore
#jetty.gcloudSession.password=

View File

@ -46,8 +46,10 @@ public class GCloudConfiguration
public static final String SERVICE_ACCOUNT = "serviceAccount";
private String _projectId;
private String _p12Filename;
private File _p12File;
private String _serviceAccount;
private String _passwordSet;
private String _password;
private AuthCredentials _authCredentials;
private DatastoreOptions _options;
@ -109,7 +111,8 @@ public class GCloudConfiguration
public void setP12File (String file)
{
checkForModification();
_p12File = new File(file);
_p12Filename = file;
}
@ -119,12 +122,12 @@ public class GCloudConfiguration
_serviceAccount = serviceAccount;
}
public void setPassword (String pwd)
{
checkForModification();
Password p = new Password(pwd);
_password = p.toString();
_passwordSet = pwd;
}
@ -133,10 +136,29 @@ public class GCloudConfiguration
{
if (_options == null)
{
_options = DatastoreOptions.builder()
.projectId(_projectId)
.authCredentials(getAuthCredentials())
.build();
if (_passwordSet == null && _p12Filename == null && _serviceAccount == null)
{
//When no values are explicitly presented for auth info, we are either running
//1. inside GCE environment, in which case all auth info is derived from the environment
//2. outside the GCE environment, but using a local gce dev server, in which case you
// need to set the following 2 environment/system properties
// DATASTORE_HOST: eg http://localhost:9999 - this is the host and port of a local development server
// DATASTORE_DATASET: eg myProj - this is the name of your project
_options = DatastoreOptions.defaultInstance();
}
else
{
//When running externally to GCE, you need to provide
//explicit auth info. You can either set the projectId explicitly, or you can set the
//DATASTORE_DATASET env/system property
_p12File = new File(_p12Filename);
Password p = new Password(_passwordSet);
_password = p.toString();
_options = DatastoreOptions.builder()
.projectId(_projectId)
.authCredentials(getAuthCredentials())
.build();
}
}
return _options;
}
@ -152,11 +174,6 @@ public class GCloudConfiguration
{
if (_password == null)
throw new IllegalStateException("No password");
if (_projectId == null)
throw new IllegalStateException("No project id");
if (_projectId == null)
throw new IllegalStateException("No project id");
if (_p12File == null || !_p12File.exists())
throw new IllegalStateException("No p12 file: "+(_p12File==null?"null":_p12File.getAbsolutePath()));

View File

@ -26,13 +26,9 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor;
import org.eclipse.jetty.alpn.client.ALPNClientConnectionFactory;
import org.eclipse.jetty.http2.ErrorCode;
import org.eclipse.jetty.http2.ISession;
import org.eclipse.jetty.http2.api.Session;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.ClientConnectionFactory;
@ -43,7 +39,6 @@ import org.eclipse.jetty.io.MappedByteBufferPool;
import org.eclipse.jetty.io.SelectChannelEndPoint;
import org.eclipse.jetty.io.SelectorManager;
import org.eclipse.jetty.io.ssl.SslClientConnectionFactory;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.Promise;
import org.eclipse.jetty.util.component.ContainerLifeCycle;
import org.eclipse.jetty.util.ssl.SslContextFactory;
@ -117,7 +112,6 @@ public class HTTP2Client extends ContainerLifeCycle
private Scheduler scheduler;
private ByteBufferPool bufferPool;
private ClientConnectionFactory connectionFactory;
private Queue<ISession> sessions;
private SelectorManager selector;
private int selectors = 1;
private long idleTimeout = 30000;
@ -150,12 +144,6 @@ public class HTTP2Client extends ContainerLifeCycle
});
}
if (sessions == null)
{
sessions = new ConcurrentLinkedQueue<>();
addBean(sessions);
}
if (selector == null)
{
selector = newSelectorManager();
@ -171,13 +159,6 @@ public class HTTP2Client extends ContainerLifeCycle
return new ClientSelectorManager(getExecutor(), getScheduler(), getSelectors());
}
@Override
protected void doStop() throws Exception
{
closeConnections();
super.doStop();
}
public Executor getExecutor()
{
return executor;
@ -329,23 +310,6 @@ public class HTTP2Client extends ContainerLifeCycle
channel.socket().setTcpNoDelay(true);
}
private void closeConnections()
{
for (ISession session : sessions)
session.close(ErrorCode.NO_ERROR.code, null, Callback.NOOP);
sessions.clear();
}
public boolean addSession(ISession session)
{
return sessions.offer(session);
}
public boolean removeSession(ISession session)
{
return sessions.remove(session);
}
private class ClientSelectorManager extends SelectorManager
{
private ClientSelectorManager(Executor executor, Scheduler scheduler, int selectors)

View File

@ -125,17 +125,9 @@ public class HTTP2ClientConnectionFactory implements ClientConnectionFactory
super.onOpen();
}
@Override
public void onClose()
{
super.onClose();
client.removeSession(getSession());
}
@Override
public void succeeded()
{
client.addSession(getSession());
promise.succeeded(getSession());
}

View File

@ -37,7 +37,9 @@ import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.http.MetaData;
import org.eclipse.jetty.http2.api.Session;
import org.eclipse.jetty.http2.api.Stream;
import org.eclipse.jetty.http2.api.server.ServerSessionListener;
import org.eclipse.jetty.http2.frames.DataFrame;
import org.eclipse.jetty.http2.frames.GoAwayFrame;
import org.eclipse.jetty.http2.frames.HeadersFrame;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.Jetty;
@ -239,4 +241,48 @@ public class HTTP2Test extends AbstractTest
Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));
}
@Test
public void testServerSendsGoAwayOnStop() throws Exception
{
start(new ServerSessionListener.Adapter());
CountDownLatch closeLatch = new CountDownLatch(1);
newClient(new Session.Listener.Adapter()
{
@Override
public void onClose(Session session, GoAwayFrame frame)
{
closeLatch.countDown();
}
});
Thread.sleep(1000);
server.stop();
Assert.assertTrue(closeLatch.await(5, TimeUnit.SECONDS));
}
@Test
public void testClientSendsGoAwayOnStop() throws Exception
{
CountDownLatch closeLatch = new CountDownLatch(1);
start(new ServerSessionListener.Adapter()
{
@Override
public void onClose(Session session, GoAwayFrame frame)
{
closeLatch.countDown();
}
});
newClient(new Session.Listener.Adapter());
Thread.sleep(1000);
client.stop();
Assert.assertTrue(closeLatch.await(5, TimeUnit.SECONDS));
}
}

View File

@ -28,6 +28,7 @@ import org.eclipse.jetty.io.AbstractConnection;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.ConcurrentArrayQueue;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -129,6 +130,14 @@ public class HTTP2Connection extends AbstractConnection
executionStrategy.execute();
}
@Override
public void close()
{
// We don't call super from here, otherwise we close the
// endPoint and we're not able to read or write anymore.
session.close(ErrorCode.NO_ERROR.code, "close", Callback.NOOP);
}
protected class HTTP2Producer implements ExecutionStrategy.Producer
{
private ByteBuffer buffer;

View File

@ -537,8 +537,6 @@ public abstract class HTTP2Session implements ISession, Parser.Listener
{
byte[] payload = reason == null ? null : reason.getBytes(StandardCharsets.UTF_8);
GoAwayFrame frame = new GoAwayFrame(lastStreamId.get(), error, payload);
if (LOG.isDebugEnabled())
LOG.debug("Sending {}", frame);
control(null, callback, frame);
return true;
}

View File

@ -37,33 +37,33 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<instructions>
<Main-Class>org.eclipse.jetty.runner.Runner</Main-Class>
<Import-Package>!*</Import-Package>
<Export-Package></Export-Package>
</instructions>
</configuration>
</plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<instructions>
<Main-Class>org.eclipse.jetty.runner.Runner</Main-Class>
<Import-Package>!*</Import-Package>
<Export-Package></Export-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</archive>
</configuration>
</plugin>
</plugins>

View File

@ -212,7 +212,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
public void onFillable()
{
if (LOG.isDebugEnabled())
LOG.debug("{} onFillable enter {}", this, _channel.getState());
LOG.debug("{} onFillable enter {} {}", this, _channel.getState(),BufferUtil.toDetailString(_requestBuffer));
HttpConnection last=setCurrentConnection(this);
try
@ -259,7 +259,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
{
setCurrentConnection(last);
if (LOG.isDebugEnabled())
LOG.debug("{} onFillable exit {}", this, _channel.getState());
LOG.debug("{} onFillable exit {} {}", this, _channel.getState(),BufferUtil.toDetailString(_requestBuffer));
}
}
@ -272,8 +272,6 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
boolean handled=false;
while (_parser.inContentState())
{
if (LOG.isDebugEnabled())
LOG.debug("{} parseContent",this);
int filled = fillRequestBuffer();
boolean handle = parseRequestBuffer();
handled|=handle;
@ -300,7 +298,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
// No pretend we read -1
_parser.atEOF();
if (LOG.isDebugEnabled())
LOG.debug("{} filled -1",this);
LOG.debug("{} filled -1 {}",this,BufferUtil.toDetailString(_requestBuffer));
return -1;
}
@ -321,7 +319,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
_parser.atEOF();
if (LOG.isDebugEnabled())
LOG.debug("{} filled {}",this,filled);
LOG.debug("{} filled {} {}",this,filled,BufferUtil.toDetailString(_requestBuffer));
return filled;
}
@ -559,8 +557,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
super.toString(),
_parser,
_generator,
_channel,
BufferUtil.toDetailString(_requestBuffer));
_channel);
}
private class Content extends HttpInput.Content

View File

@ -32,6 +32,7 @@ import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.resource.Resource;
@ -1027,38 +1028,46 @@ public class BufferUtil
private static void appendDebugString(StringBuilder buf,ByteBuffer buffer)
{
for (int i = 0; i < buffer.position(); i++)
try
{
appendContentChar(buf,buffer.get(i));
if (i == 16 && buffer.position() > 32)
for (int i = 0; i < buffer.position(); i++)
{
buf.append("...");
i = buffer.position() - 16;
appendContentChar(buf,buffer.get(i));
if (i == 16 && buffer.position() > 32)
{
buf.append("...");
i = buffer.position() - 16;
}
}
buf.append("<<<");
for (int i = buffer.position(); i < buffer.limit(); i++)
{
appendContentChar(buf,buffer.get(i));
if (i == buffer.position() + 16 && buffer.limit() > buffer.position() + 32)
{
buf.append("...");
i = buffer.limit() - 16;
}
}
buf.append(">>>");
int limit = buffer.limit();
buffer.limit(buffer.capacity());
for (int i = limit; i < buffer.capacity(); i++)
{
appendContentChar(buf,buffer.get(i));
if (i == limit + 16 && buffer.capacity() > limit + 32)
{
buf.append("...");
i = buffer.capacity() - 16;
}
}
buffer.limit(limit);
}
buf.append("<<<");
for (int i = buffer.position(); i < buffer.limit(); i++)
catch(Throwable x)
{
appendContentChar(buf,buffer.get(i));
if (i == buffer.position() + 16 && buffer.limit() > buffer.position() + 32)
{
buf.append("...");
i = buffer.limit() - 16;
}
Log.getRootLogger().ignore(x);
buf.append("!!concurrent mod!!");
}
buf.append(">>>");
int limit = buffer.limit();
buffer.limit(buffer.capacity());
for (int i = limit; i < buffer.capacity(); i++)
{
appendContentChar(buf,buffer.get(i));
if (i == limit + 16 && buffer.capacity() > limit + 32)
{
buf.append("...");
i = buffer.capacity() - 16;
}
}
buffer.limit(limit);
}
private static void appendContentChar(StringBuilder buf, byte b)

View File

@ -21,7 +21,7 @@
<parent>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>test-sessions-parent</artifactId>
<version>9.3.4-SNAPSHOT</version>
<version>9.3.6-SNAPSHOT</version>
</parent>
<artifactId>test-gcloud-sessions</artifactId>
<name>Jetty Tests :: Sessions :: GCloud</name>
@ -97,8 +97,8 @@
<configuration>
<skipTests>false</skipTests>
<systemPropertyVariables>
<test.projectId>jetty9-work</test.projectId>
<test.port>8088</test.port>
<DATASTORE_DATASET>jetty9-work</DATASTORE_DATASET>
<DATASTORE_HOST>http://localhost:8088</DATASTORE_HOST>
</systemPropertyVariables>
</configuration>
</plugin>

View File

@ -37,11 +37,7 @@ public class ClientCrossContextSessionTest extends AbstractClientCrossContextSes
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -36,11 +36,7 @@ public class ForwardedSessionTest extends AbstractForwardedSessionTest
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -38,18 +38,16 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.resource.JarResource;
import org.eclipse.jetty.util.resource.Resource;
import com.google.api.client.util.Strings;
import com.google.gcloud.datastore.Key;
import com.google.gcloud.datastore.Datastore;
import com.google.gcloud.datastore.DatastoreFactory;
import com.google.gcloud.datastore.DatastoreOptions;
import com.google.gcloud.datastore.Entity;
import com.google.gcloud.datastore.GqlQuery;
import com.google.gcloud.datastore.Key;
import com.google.gcloud.datastore.ProjectionEntity;
import com.google.gcloud.datastore.Query;
import com.google.gcloud.datastore.Query.ResultType;
@ -65,34 +63,6 @@ import com.google.gcloud.datastore.StructuredQuery.Projection;
public class GCloudSessionTestSupport
{
/**
* GCloudTestConfiguration
*
* Specialization of GCloudConfiguration for gcd test environment
*
*/
public class GCloudTestConfiguration extends GCloudConfiguration
{
int _port;
public GCloudTestConfiguration(String projectId, int port)
{
setProjectId(projectId);
_port = port;
}
@Override
public DatastoreOptions getDatastoreOptions() throws Exception
{
return DatastoreOptions.builder()
.projectId(_projectId)
.host("http://localhost:" + _port)
.build();
}
}
private static class ProcessOutputReader implements Runnable
{
private InputStream _is;
@ -138,40 +108,55 @@ public class GCloudSessionTestSupport
public static String DEFAULT_PROJECTID = "jetty9-work";
public static int DEFAULT_PORT = 8088;
public static String DEFAULT_PORT = "8088";
public static String DEFAULT_HOST = "http://localhost:"+DEFAULT_PORT;
public static String DEFAULT_GCD_ZIP = "gcd-v1beta2-rev1-2.1.2b.zip";
public static String DEFAULT_GCD_UNPACKED = "gcd-v1beta2-rev1-2.1.2b";
public static String DEFAULT_DOWNLOAD_URL = "http://storage.googleapis.com/gcd/tools/";
String _projectId;
int _port;
String _testServerUrl;
String _testPort;
File _datastoreDir;
File _gcdInstallDir;
File _gcdUnpackedDir;
Datastore _ds;
public GCloudSessionTestSupport (String projectId, int port, File gcdInstallDir)
public GCloudSessionTestSupport (File gcdInstallDir)
{
_projectId = projectId;
if (_projectId == null)
_projectId = DEFAULT_PROJECTID;
_port = port;
if (_port <= 0)
_port = DEFAULT_PORT;
_gcdInstallDir = gcdInstallDir;
if (_gcdInstallDir == null)
_gcdInstallDir = new File (System.getProperty("java.io.tmpdir"));
_projectId = System.getProperty("DATASTORE_DATASET", System.getenv("DATASTORE_DATASET"));
if (_projectId == null)
{
_projectId = DEFAULT_PROJECTID;
System.setProperty("DATASTORE_DATASET", _projectId);
}
_testServerUrl = System.getProperty("DATASTORE_HOST", System.getenv("DATASTORE_HOST"));
if (_testServerUrl == null)
{
_testServerUrl = DEFAULT_HOST;
_testPort = DEFAULT_PORT;
System.setProperty("DATASTORE_HOST", _testServerUrl);
}
else
{
int i = _testServerUrl.lastIndexOf(':');
_testPort = _testServerUrl.substring(i+1);
}
}
public GCloudSessionTestSupport ()
{
this(null,0, null);
this(null);
}
public GCloudConfiguration getConfiguration ()
{
return new GCloudTestConfiguration(_projectId, _port);
return new GCloudConfiguration();
}
@ -251,11 +236,11 @@ public class GCloudSessionTestSupport
processBuilder.redirectErrorStream(true);
if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows"))
{
processBuilder.command("cmd", "/C", new File(_gcdUnpackedDir, "gcd.cmd").getAbsolutePath(), "start", "--testing", "--allow_remote_shutdown","--port="+String.valueOf(_port), _projectId);
processBuilder.command("cmd", "/C", new File(_gcdUnpackedDir, "gcd.cmd").getAbsolutePath(), "start", "--testing", "--allow_remote_shutdown","--port="+_testPort, _projectId);
}
else
{
processBuilder.command("bash", new File(_gcdUnpackedDir, "gcd.sh").getAbsolutePath(), "start", "--testing", "--allow_remote_shutdown", "--port="+String.valueOf(_port), _projectId);
processBuilder.command("bash", new File(_gcdUnpackedDir, "gcd.sh").getAbsolutePath(), "start", "--testing", "--allow_remote_shutdown", "--port="+_testPort, _projectId);
}
System.err.println("Starting datastore");
@ -270,7 +255,7 @@ public class GCloudSessionTestSupport
throws Exception
{
//Send request to terminate test datastore
URL url = new URL("http", "localhost", _port, "/_ah/admin/quit");
URL url = new URL("http", "localhost", Integer.parseInt(_testPort.trim()), "/_ah/admin/quit");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setDoOutput(true);

View File

@ -34,14 +34,13 @@ public class ImmortalSessionTest extends AbstractImmortalSessionTest
{
static GCloudSessionTestSupport _testSupport;
/**
* @throws Exception
*/
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -36,11 +36,7 @@ public class InvalidationSessionTest extends AbstractInvalidationSessionTest
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -37,11 +37,7 @@ public class LastAccessTimeTest extends AbstractLastAccessTimeTest
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -37,11 +37,7 @@ public class LocalSessionScavengingTest extends AbstractLocalSessionScavengingTe
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -42,11 +42,7 @@ public class NewSessionTest extends AbstractNewSessionTest
@Before
public void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -37,11 +37,7 @@ public class OrphanedSessionTest extends AbstractOrphanedSessionTest
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -37,11 +37,7 @@ public class ReentrantRequestSessionTest extends AbstractReentrantRequestSession
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -39,11 +39,7 @@ public class RemoveSessionTest extends AbstractRemoveSessionTest
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -37,11 +37,7 @@ public class SameNodeLoadTest extends AbstractSameNodeLoadTest
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -38,11 +38,7 @@ public class ServerCrossContextSessionTest extends AbstractServerCrossContextSes
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -40,11 +40,7 @@ public class SessionExpiryTest extends AbstractSessionExpiryTest
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -38,11 +38,7 @@ public class SessionInvalidateAndCreateTest extends AbstractSessionInvalidateAnd
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -37,11 +37,7 @@ public class SessionMigrationTest extends AbstractSessionMigrationTest
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -37,11 +37,7 @@ public class SessionRenewTest extends AbstractSessionRenewTest
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -38,11 +38,7 @@ public class SessionValueSavingTest extends AbstractSessionValueSavingTest
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}

View File

@ -39,11 +39,7 @@ public class StopSessionManagerPreserveSessionTest extends AbstractStopSessionMa
@BeforeClass
public static void setup () throws Exception
{
String projectId = System.getProperty("test.projectId", null);
String port = System.getProperty("test.port","0");
_testSupport = new GCloudSessionTestSupport(projectId,
Integer.parseInt(port),
null);
_testSupport = new GCloudSessionTestSupport();
_testSupport.setUp();
}