Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AF916DE27 for ; Wed, 14 Nov 2012 08:23:09 +0000 (UTC) Received: (qmail 67006 invoked by uid 500); 14 Nov 2012 08:23:09 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 66929 invoked by uid 500); 14 Nov 2012 08:23:08 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 66898 invoked by uid 99); 14 Nov 2012 08:23:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Nov 2012 08:23:07 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Nov 2012 08:23:04 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4A4D92388AB9; Wed, 14 Nov 2012 08:22:43 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1409113 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java Date: Wed, 14 Nov 2012 08:22:43 -0000 To: derby-commits@db.apache.org From: kahatlen@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121114082243.4A4D92388AB9@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kahatlen Date: Wed Nov 14 08:22:42 2012 New Revision: 1409113 URL: http://svn.apache.org/viewvc?rev=1409113&view=rev Log: DERBY-5992: Use BaseTestCase.execJavaCmd() to start process from NetworkServerTestSetup Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java?rev=1409113&r1=1409112&r2=1409113&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/NetworkServerTestSetup.java Wed Nov 14 08:22:42 2012 @@ -33,6 +33,7 @@ import java.security.PrivilegedActionExc import java.security.PrivilegedExceptionAction; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Arrays; import junit.framework.Test; import org.apache.derby.drda.NetworkServerControl; @@ -301,8 +302,6 @@ final public class NetworkServerTestSetu private void startWithCommand() throws Exception { - final TestConfiguration config = TestConfiguration.getCurrent(); - // start the server through the command line // arguments using a new thread to do so. new Thread( @@ -320,14 +319,8 @@ final public class NetworkServerTestSetu private SpawnedProcess startSeparateProcess() throws Exception { ArrayList al = new ArrayList(); - String classpath = BaseTestCase.getSystemProperty( "java.class.path" ); boolean skipHostName = false; - al.add( BaseTestCase.getJavaExecutableName() ); - al.add( "-Demma.verbosity.level=silent" ); - al.add( "-classpath" ); - al.add( classpath ); - // Loading from classes need to work-around the limitation of the // default policy file doesn't work with classes. Similarly, if we are // running with Emma we don't run with the security manager, as the @@ -377,48 +370,13 @@ final public class NetworkServerTestSetu if ( HOST_OPTION.equals( startupArgs[ i ] ) ) { skipHostName = true; } } - String[] defaultArgs = getDefaultStartupArgs( skipHostName ); - - count = defaultArgs.length; - for ( int i = 0; i < count; i++ ) - { - al.add( defaultArgs[ i ] ); - } - - count = startupArgs.length; - for ( int i = 0; i < count; i++ ) - { - al.add( startupArgs[ i ] ); - } + al.addAll(Arrays.asList(getDefaultStartupArgs(skipHostName))); + al.addAll(Arrays.asList(startupArgs)); final String[] command = new String[ al.size() ]; al.toArray(command); - String startcommand =""; - for (int i = 0 ; i < command.length ; i++) { - startcommand += command[i] + " "; - } - - BaseTestCase.println("XXX server startup command = " + - startcommand + "\n"); - - Process serverProcess; - - try { - serverProcess = (Process) - AccessController.doPrivileged - ( - new PrivilegedExceptionAction() - { - public Object run() throws IOException - { - return Runtime.getRuntime().exec(command); - } - } - ); - } catch (PrivilegedActionException e) { - throw e.getException(); - } + Process serverProcess = BaseTestCase.execJavaCmd(command); return new SpawnedProcess(serverProcess, "SpawnedNetworkServer"); }