< prev index next >
tests/system/src/test/java/test/shutdowntest/ShutdownHookTest.java
Print this page
rev 9568 : 8147427: refactor test launchers to support jake
Reviewed-by: kcr
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -26,10 +26,11 @@
package test.shutdowntest;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
+import java.util.ArrayList;
import org.junit.Test;
import static org.junit.Assert.*;
import static test.shutdowntest.Constants.*;
@@ -48,14 +49,20 @@
// Initilaize the socket
final ServerSocket service = new ServerSocket(0);
final int port = service.getLocalPort();
// Launch the test app
- final String classpath = System.getProperty("java.class.path");
+ final ArrayList<String> cmd
+ = test.util.Util.createApplicationLaunchCommand(
+ testAppName,
+ null,
+ null
+ );
+ // and add our argument
+ cmd.add(String.valueOf(port));
ProcessBuilder builder;
- builder = new ProcessBuilder("java", "-cp", classpath, testAppName,
- String.valueOf(port));
+ builder = new ProcessBuilder(cmd);
builder.redirectError(ProcessBuilder.Redirect.INHERIT);
builder.redirectOutput(ProcessBuilder.Redirect.INHERIT);
Process process = builder.start();
// Accept a connection from the test app
< prev index next >