8210112: remove jdk.testlibrary.ProcessTools
Reviewed-by: alanb, sspitsyn, jcbeyler
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddModules.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddModules.java Fri Sep 07 14:01:52 2018 -0700
@@ -25,7 +25,7 @@
/**
* @test
* @requires vm.cds
- * @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/appcds
+ * @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules jdk.compiler
* jdk.jartool/sun.tools.jar
* jdk.jlink
@@ -39,7 +39,6 @@
import java.nio.file.Paths;
import jdk.test.lib.process.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
public class AddModules {
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddOpens.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddOpens.java Fri Sep 07 14:01:52 2018 -0700
@@ -25,7 +25,7 @@
/**
* @test
* @requires vm.cds
- * @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/appcds
+ * @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules jdk.compiler
* jdk.jartool/sun.tools.jar
* jdk.jlink
@@ -39,7 +39,6 @@
import java.nio.file.Paths;
import jdk.test.lib.process.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
public class AddOpens {
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddReads.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/AddReads.java Fri Sep 07 14:01:52 2018 -0700
@@ -39,7 +39,6 @@
import java.nio.file.Paths;
import jdk.test.lib.process.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
import jdk.testlibrary.Asserts;
public class AddReads {
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ExportModule.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ExportModule.java Fri Sep 07 14:01:52 2018 -0700
@@ -40,7 +40,6 @@
import jdk.test.lib.compiler.CompilerUtils;
import jdk.test.lib.process.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
import jdk.testlibrary.Asserts;
public class ExportModule {
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/MainModuleOnly.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/MainModuleOnly.java Fri Sep 07 14:01:52 2018 -0700
@@ -25,7 +25,7 @@
/**
* @test
* @requires vm.cds
- * @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/appcds
+ * @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules jdk.compiler
* jdk.jartool/sun.tools.jar
* jdk.jlink
@@ -41,7 +41,6 @@
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Platform;
-import jdk.testlibrary.ProcessTools;
public class MainModuleOnly {
--- a/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ModulePathAndCP.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/jigsaw/modulepath/ModulePathAndCP.java Fri Sep 07 14:01:52 2018 -0700
@@ -25,7 +25,7 @@
/**
* @test
* @requires vm.cds
- * @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/appcds
+ * @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules jdk.compiler
* jdk.jartool/sun.tools.jar
* jdk.jlink
@@ -40,7 +40,6 @@
import java.nio.file.Paths;
import jdk.test.lib.process.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
public class ModulePathAndCP {
--- a/test/jdk/com/sun/jdi/BadAgentPath.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/jdi/BadAgentPath.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -21,18 +21,16 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
/* @test
* @bug 8147456
* @summary Check that providing a non-existing -agentpath gives a proper error.
* @author Sharath Ballal
*
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules java.management
- * @build jdk.testlibrary.*
* @build BadAgentPath
* @run driver BadAgentPath
*/
--- a/test/jdk/com/sun/jdi/BadHandshakeTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/jdi/BadHandshakeTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -37,12 +37,13 @@
import java.util.concurrent.atomic.AtomicBoolean;
import jdk.testlibrary.Utils;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
/* @test
* @bug 6306165 6432567
* @summary Check that a bad handshake doesn't cause a debuggee to abort
* @library /lib/testlibrary
+ * @library /test/lib
*
* @modules java.management
* jdk.jdi
--- a/test/jdk/com/sun/jdi/DoubleAgentTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/jdi/DoubleAgentTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -21,8 +21,8 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils;
/* @test
@@ -30,6 +30,7 @@
* @summary Check that multiple -agentlib statements in command line fails
*
* @library /lib/testlibrary
+ * @library /test/lib
* @modules java.management
* @build jdk.testlibrary.*
* @build DoubleAgentTest Exit0
--- a/test/jdk/com/sun/jdi/ExclusiveBind.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/jdi/ExclusiveBind.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -26,6 +26,7 @@
* @summary Test that more than one debuggee cannot bind to same port
* at the same time.
* @library /lib/testlibrary
+ * @library /test/lib
*
* @modules java.management
* jdk.jdi
@@ -44,7 +45,7 @@
import java.util.Iterator;
import java.util.concurrent.TimeUnit;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils;
public class ExclusiveBind {
--- a/test/jdk/com/sun/jdi/NoLaunchOptionTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/jdi/NoLaunchOptionTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, 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
@@ -22,8 +22,8 @@
*/
import static jdk.testlibrary.Asserts.assertFalse;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
/*
* @test NoLaunchOptionTest.java
@@ -32,6 +32,7 @@
* @author Tim Bell
*
* @library /lib/testlibrary
+ * @library /test/lib
*
* @run compile -g NoLaunchOptionTest.java
* @build jdk.testlibrary.* VMConnection
--- a/test/jdk/com/sun/jdi/ProcessAttachTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/jdi/ProcessAttachTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -25,7 +25,7 @@
import java.io.InputStream;
import java.util.Map;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import com.sun.jdi.Bootstrap;
import com.sun.jdi.VirtualMachine;
@@ -39,6 +39,7 @@
* @summary Unit test for ProcessAttachingConnector
*
* @library /lib/testlibrary
+ * @library /test/lib
* @modules java.management
* jdk.jdi
* @build jdk.testlibrary.* ProcessAttachTest
--- a/test/jdk/com/sun/jdi/RunToExit.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/jdi/RunToExit.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2018, 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
@@ -24,10 +24,10 @@
/* @test
* @bug 4997445
* @summary Test that with server=y, when VM runs to System.exit() no error happens
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules java.management
* jdk.jdi
- * @build jdk.testlibrary.* VMConnection RunToExit Exit0
+ * @build VMConnection RunToExit Exit0
* @run driver RunToExit
*/
import java.net.ServerSocket;
@@ -42,7 +42,7 @@
import java.util.Iterator;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
public class RunToExit {
--- a/test/jdk/com/sun/jdi/SuspendNoFlagTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/jdi/SuspendNoFlagTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -21,15 +21,14 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
/* @test
* @bug 4914611
* @summary Test for JDWP: -agentlib:jdwp=suspend=n hanging
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules java.management
- * @build jdk.testlibrary.*
* @compile -g HelloWorld.java
* @run driver SuspendNoFlagTest
*/
--- a/test/jdk/com/sun/jdi/cds/CDSBreakpointTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/jdi/cds/CDSBreakpointTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -29,9 +29,8 @@
* @modules jdk.jdi
* java.management
* jdk.jartool/sun.tools.jar
- * @library /lib/testlibrary
+ * @library /test/lib
* @library ..
- * @build jdk.testlibrary.*
* @build TestScaffold VMConnection TargetListener TargetAdapter
* @build CDSJDITest
* @run compile -g ../BreakpointTest.java
--- a/test/jdk/com/sun/jdi/cds/CDSDeleteAllBkptsTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/jdi/cds/CDSDeleteAllBkptsTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -29,9 +29,8 @@
* @modules jdk.jdi
* java.management
* jdk.jartool/sun.tools.jar
- * @library /lib/testlibrary
+ * @library /test/lib
* @library ..
- * @build jdk.testlibrary.*
* @build TestScaffold VMConnection TargetListener TargetAdapter
* @build CDSJDITest
* @run compile -g ../DeleteAllBkptsTest.java
--- a/test/jdk/com/sun/jdi/cds/CDSFieldWatchpoints.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/jdi/cds/CDSFieldWatchpoints.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -29,9 +29,8 @@
* @modules jdk.jdi
* java.management
* jdk.jartool/sun.tools.jar
- * @library /lib/testlibrary
+ * @library /test/lib
* @library ..
- * @build jdk.testlibrary.*
* @build TestScaffold VMConnection TargetListener TargetAdapter
* @build CDSJDITest
* @run compile -g ../FieldWatchpoints.java
--- a/test/jdk/com/sun/jdi/cds/CDSJDITest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/jdi/cds/CDSJDITest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -25,8 +25,8 @@
* Helper superclass for launching JDI tests out of the CDS archive.
*/
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import java.io.*;
import java.util.ArrayList;
--- a/test/jdk/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java Fri Sep 07 14:01:52 2018 -0700
@@ -27,10 +27,9 @@
* @author Staffan Larsen
* @comment Graal does not support CMS
* @requires !vm.graal.enabled
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules jdk.attach/sun.tools.attach
* jdk.management
- * @build jdk.testlibrary.*
* @run main CheckOrigin
*/
@@ -44,7 +43,7 @@
import java.io.PrintWriter;
import java.lang.management.ManagementFactory;
import java.util.Map;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import sun.tools.attach.HotSpotVirtualMachine;
public class CheckOrigin {
--- a/test/jdk/com/sun/management/HotSpotDiagnosticMXBean/DumpHeap.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/management/HotSpotDiagnosticMXBean/DumpHeap.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, 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
@@ -29,7 +29,7 @@
import java.util.List;
import jdk.test.lib.hprof.HprofParser;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import com.sun.management.HotSpotDiagnosticMXBean;
--- a/test/jdk/com/sun/management/OperatingSystemMXBean/TestTotalSwap.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/management/OperatingSystemMXBean/TestTotalSwap.java Fri Sep 07 14:01:52 2018 -0700
@@ -28,10 +28,8 @@
* @author Steve Bohne
* @author Jaroslav Bachorik
*
- * @library /lib/testlibrary
* @library /test/lib
*
- * @build TestTotalSwap jdk.testlibrary.*
* @run main TestTotalSwap
*/
@@ -57,8 +55,8 @@
import java.lang.management.*;
import jdk.test.lib.Platform;
-import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
public class TestTotalSwap {
--- a/test/jdk/com/sun/tools/attach/BasicTests.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/tools/attach/BasicTests.java Fri Sep 07 14:01:52 2018 -0700
@@ -29,8 +29,8 @@
import java.util.Properties;
import jdk.test.lib.thread.ProcessThread;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import com.sun.tools.attach.AgentInitializationException;
import com.sun.tools.attach.AgentLoadException;
--- a/test/jdk/com/sun/tools/attach/PermissionTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/tools/attach/PermissionTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -25,8 +25,8 @@
import com.sun.tools.attach.AttachNotSupportedException;
import java.io.File;
import jdk.test.lib.thread.ProcessThread;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
/*
* @test
--- a/test/jdk/com/sun/tools/attach/ProviderTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/tools/attach/ProviderTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -22,9 +22,8 @@
*/
import java.io.File;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.spi.AttachProvider;
--- a/test/jdk/com/sun/tools/attach/RunnerUtil.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/tools/attach/RunnerUtil.java Fri Sep 07 14:01:52 2018 -0700
@@ -27,7 +27,7 @@
import java.util.Arrays;
import jdk.test.lib.thread.ProcessThread;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils;
/*
--- a/test/jdk/com/sun/tools/attach/StartManagementAgent.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/tools/attach/StartManagementAgent.java Fri Sep 07 14:01:52 2018 -0700
@@ -46,7 +46,7 @@
* jdk.attach
* jdk.jartool/sun.tools.jar
*
- * @run build Application SimpleProvider jdk.testlibrary.*
+ * @run build jdk.testlibrary.* Application SimpleProvider jdk.testlibrary.*
* @run main/timeout=300 StartManagementAgent
*/
--- a/test/jdk/com/sun/tools/attach/TempDirTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/com/sun/tools/attach/TempDirTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -30,8 +30,8 @@
import java.io.File;
import jdk.test.lib.thread.ProcessThread;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
/*
* @test
--- a/test/jdk/java/io/BufferedInputStream/LargeCopyWithMark.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/io/BufferedInputStream/LargeCopyWithMark.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -25,8 +25,7 @@
* @bug 7129312
* @summary BufferedInputStream calculates negative array size with large
* streams and mark
- * @library /lib/testlibrary
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main/othervm LargeCopyWithMark
*/
@@ -34,7 +33,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
public class LargeCopyWithMark {
--- a/test/jdk/java/lang/Class/forName/modules/TestDriver.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/Class/forName/modules/TestDriver.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -31,7 +31,7 @@
import jdk.test.lib.util.FileUtils;
import jdk.test.lib.compiler.CompilerUtils;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -41,12 +41,12 @@
* @test
* @bug 8087335
* @summary Tests for Class.forName(Module,String)
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
* @build jdk.test.lib.Platform
* jdk.test.lib.util.FileUtils
* jdk.test.lib.compiler.CompilerUtils
- * jdk.testlibrary.ProcessTools
+ * jdk.test.lib.process.ProcessTools
* TestDriver TestMain TestLayer
* @run testng TestDriver
*/
--- a/test/jdk/java/lang/Class/getResource/ResourcesTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/Class/getResource/ResourcesTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -24,7 +24,7 @@
import java.nio.file.Path;
import java.nio.file.Paths;
-import static jdk.testlibrary.ProcessTools.executeTestJava;
+import static jdk.test.lib.process.ProcessTools.executeTestJava;
import jdk.test.lib.compiler.CompilerUtils;
import org.testng.annotations.BeforeTest;
@@ -33,9 +33,9 @@
/**
* @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
- * @build ResourcesTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @build ResourcesTest jdk.test.lib.compiler.CompilerUtils
* @run testng ResourcesTest
* @summary Driver for basic test of Class getResource and getResourceAsStream
*/
--- a/test/jdk/java/lang/ClassLoader/EndorsedDirs.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/ClassLoader/EndorsedDirs.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -24,11 +24,11 @@
/*
* @test
* @bug 8060206 8067366
- * @library /lib/testlibrary
+ * @library /test/lib
* @summary Endorsed standards and override mechanism is removed
*/
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import java.util.stream.Stream;
--- a/test/jdk/java/lang/ClassLoader/ExtDirs.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/ClassLoader/ExtDirs.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -24,11 +24,11 @@
/*
* @test
* @bug 8060206 8067366
- * @library /lib/testlibrary
+ * @library /test/lib
* @summary Extension mechanism is removed
*/
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import java.lang.Integer;
import java.util.stream.Stream;
--- a/test/jdk/java/lang/ClassLoader/GetDotResource.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/ClassLoader/GetDotResource.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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
@@ -26,8 +26,7 @@
* @bug 4273031
* @summary ClassLoader.getResouce() should be able to
* find resources with leading "." in their names
- * @library /lib/testlibrary
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @run main GetDotResource
*/
@@ -37,7 +36,7 @@
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
public class GetDotResource {
--- a/test/jdk/java/lang/ClassLoader/GetSystemPackage.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/ClassLoader/GetSystemPackage.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -24,8 +24,8 @@
/*
* @test
* @bug 8060130
- * @library /lib/testlibrary
- * @build package2.Class2 GetSystemPackage jdk.testlibrary.*
+ * @library /test/lib
+ * @build package2.Class2 GetSystemPackage
* @summary Test if getSystemPackage() return consistent values for cases
* where a manifest is provided or not and ensure only jars on
* bootclasspath gets resolved via Package.getSystemPackage
@@ -41,7 +41,7 @@
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
public class GetSystemPackage {
--- a/test/jdk/java/lang/ClassLoader/getResource/GetResource.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/ClassLoader/getResource/GetResource.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -25,7 +25,8 @@
* @test
* @bug 6760902
* @library /lib/testlibrary
- * @build jdk.testlibrary.ProcessTools
+ * @library /test/lib
+ * @build jdk.test.lib.process.ProcessTools
* @run testng GetResource
* @summary Empty path on bootclasspath is not default to current working
* directory for both class lookup and resource lookup whereas
@@ -45,7 +46,7 @@
import java.util.stream.Stream;
import jdk.testlibrary.JDKToolFinder;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/java/lang/ClassLoader/getResource/automaticmodules/Driver.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/ClassLoader/getResource/automaticmodules/Driver.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -23,8 +23,8 @@
/**
* @test
- * @library /lib/testlibrary
- * @build Driver Main JarUtils jdk.testlibrary.ProcessTools
+ * @library /lib/testlibrary /test/lib
+ * @build Driver Main JarUtils
* @run main Driver
* @summary Test ClassLoader.getResourceXXX to locate resources in an automatic
* module
@@ -38,7 +38,7 @@
import java.util.jar.Attributes;
import java.util.jar.Manifest;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
/**
* The driver creates a JAR file containing p/Foo.class, p/foo.properties,
--- a/test/jdk/java/lang/ClassLoader/getResource/modules/ResourcesTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/ClassLoader/getResource/modules/ResourcesTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -24,7 +24,7 @@
import java.nio.file.Path;
import java.nio.file.Paths;
-import static jdk.testlibrary.ProcessTools.executeTestJava;
+import static jdk.test.lib.process.ProcessTools.executeTestJava;
import jdk.test.lib.compiler.CompilerUtils;
import org.testng.annotations.BeforeTest;
@@ -34,9 +34,9 @@
/**
* @test
* @bug 8087335
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
- * @build ResourcesTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @build ResourcesTest jdk.test.lib.compiler.CompilerUtils
* @run testng ResourcesTest
* @summary Driver for basic test of ClassLoader getResource and getResourceAsStream
*/
--- a/test/jdk/java/lang/ClassLoader/securityManager/ClassLoaderTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/ClassLoader/securityManager/ClassLoaderTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -27,6 +27,7 @@
* @summary Different types of ClassLoader running with(out) SecurityManager and
* (in)valid security policy file.
* @library /lib/testlibrary
+ * @library /test/lib
* @modules java.base/jdk.internal.module
* @build JarUtils
* @build TestClassLoader TestClient
@@ -49,7 +50,7 @@
import java.util.LinkedList;
import java.util.List;
import jdk.internal.module.ModuleInfoWriter;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
public class ClassLoaderTest {
--- a/test/jdk/java/lang/ModuleTests/access/AccessTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/ModuleTests/access/AccessTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -27,7 +27,7 @@
import java.util.List;
import jdk.test.lib.compiler.CompilerUtils;
-import static jdk.testlibrary.ProcessTools.executeTestJava;
+import static jdk.test.lib.process.ProcessTools.executeTestJava;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -35,9 +35,9 @@
/**
* @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
- * @build AccessTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @build AccessTest jdk.test.lib.compiler.CompilerUtils
* @run testng AccessTest
* @summary Driver for test that checks access to access to types in
* exported and non-exported packages.
--- a/test/jdk/java/lang/Runtime/shutdown/ShutdownInterruptedMain.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/Runtime/shutdown/ShutdownInterruptedMain.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -24,16 +24,15 @@
/*
* @test
* @bug 8154017
- * @library /lib/testlibrary
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @summary Shutdown hooks are racing against shutdown sequence,
if System.exit()-calling thread is interrupted
* @run main ShutdownInterruptedMain exec
*/
-import jdk.testlibrary.OutputAnalyzer;
-import static jdk.testlibrary.ProcessTools.createJavaProcessBuilder;
-import static jdk.testlibrary.ProcessTools.executeProcess;
+import jdk.test.lib.process.OutputAnalyzer;
+import static jdk.test.lib.process.ProcessTools.createJavaProcessBuilder;
+import static jdk.test.lib.process.ProcessTools.executeProcess;
public class ShutdownInterruptedMain {
--- a/test/jdk/java/lang/StackWalker/CallerFromMain.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/StackWalker/CallerFromMain.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -24,14 +24,13 @@
/*
* @test
* @bug 8140450
- * @library /lib/testlibrary
- * @build jdk.testlibrary.*
+ * @library /test/lib
* @summary Test if the getCallerClass method returns empty optional
* @run main CallerFromMain exec
*/
-import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
public class CallerFromMain {
--- a/test/jdk/java/lang/System/LoggerFinder/modules/Base.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/Base.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -35,7 +35,7 @@
import jdk.testlibrary.JDKToolFinder;
import jdk.test.lib.compiler.CompilerUtils;
-import static jdk.testlibrary.ProcessTools.executeCommand;
+import static jdk.test.lib.process.ProcessTools.executeCommand;
/*
* Base class for tests.
--- a/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForImageTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForImageTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -23,19 +23,6 @@
* questions.
*/
-import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Stream;
-
-import jdk.testlibrary.JDKToolFinder;
-
-import static jdk.testlibrary.ProcessTools.executeCommand;
-
/*
* @test
* @modules jdk.compiler
--- a/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForJDKTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForJDKTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -23,19 +23,6 @@
* questions.
*/
-import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Stream;
-
-import jdk.testlibrary.JDKToolFinder;
-
-import static jdk.testlibrary.ProcessTools.executeCommand;
-
/*
* @test
* @modules java.logging
--- a/test/jdk/java/lang/System/LoggerFinder/modules/LoggerInImageTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/LoggerInImageTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -23,19 +23,6 @@
* questions.
*/
-import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Stream;
-
-import jdk.testlibrary.JDKToolFinder;
-
-import static jdk.testlibrary.ProcessTools.executeCommand;
-
/*
* @test
* @modules jdk.compiler
--- a/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForImageTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForImageTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -24,17 +24,6 @@
*/
import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Stream;
-
-import jdk.testlibrary.JDKToolFinder;
-
-import static jdk.testlibrary.ProcessTools.executeCommand;
/*
* @test
--- a/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForJDKTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForJDKTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -24,17 +24,6 @@
*/
import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Stream;
-
-import jdk.testlibrary.JDKToolFinder;
-
-import static jdk.testlibrary.ProcessTools.executeCommand;
/*
* @test
--- a/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForImageTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForImageTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -24,17 +24,6 @@
*/
import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Stream;
-
-import jdk.testlibrary.JDKToolFinder;
-
-import static jdk.testlibrary.ProcessTools.executeCommand;
/*
* @test
--- a/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForJDKTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForJDKTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -24,17 +24,6 @@
*/
import java.io.File;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Stream;
-
-import jdk.testlibrary.JDKToolFinder;
-
-import static jdk.testlibrary.ProcessTools.executeCommand;
/*
* @test
--- a/test/jdk/java/lang/System/OsVersionTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/System/OsVersionTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -22,16 +22,15 @@
*/
import jdk.test.lib.Platform;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
/*
* @test
* @bug 8132374
* @summary Check that the value of the os.version property is equal
* to the value of the corresponding OS provided tools.
- * @library /lib/testlibrary /test/lib
- * @build jdk.test.lib.Platform
+ * @library /test/lib
* @run main OsVersionTest
* @author Volker Simonis
*/
--- a/test/jdk/java/lang/instrument/DaemonThread/TestDaemonThread.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/instrument/DaemonThread/TestDaemonThread.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,6 +1,6 @@
/*
* Copyright 2014 Goldman Sachs.
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -24,11 +24,11 @@
/* @test
* @bug 7142035
* @summary Assert in java.lang.instrument agents during shutdown when classloading occurs after shutdown
- * @library /lib/testlibrary
+ * @library /test/lib
*
* @modules java.instrument
* java.management
- * @build jdk.testlibrary.* DummyAgent DummyClass TestDaemonThreadLauncher TestDaemonThread
+ * @build DummyAgent DummyClass TestDaemonThreadLauncher TestDaemonThread
* @run shell ../MakeJAR3.sh DummyAgent
* @run main/timeout=240 TestDaemonThreadLauncher
*
--- a/test/jdk/java/lang/instrument/DaemonThread/TestDaemonThreadLauncher.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/instrument/DaemonThread/TestDaemonThreadLauncher.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,6 +1,6 @@
/*
* Copyright 2014 Goldman Sachs.
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -23,8 +23,8 @@
*/
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
public class TestDaemonThreadLauncher {
public static void main(String args[]) throws Exception {
--- a/test/jdk/java/lang/instrument/PremainClass/NoPremainAgentTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/instrument/PremainClass/NoPremainAgentTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -21,8 +21,8 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils;
/*
@@ -30,6 +30,7 @@
* @bug 6289149
* @summary test when the agent's class is missing the premain() function.
* @library /lib/testlibrary
+ * @library /test/lib
* @modules java.management
* java.instrument
* @run build jdk.testlibrary.* DummyMain
--- a/test/jdk/java/lang/instrument/PremainClass/PremainClassTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/instrument/PremainClass/PremainClassTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -21,8 +21,8 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils;
/*
@@ -30,6 +30,7 @@
* @bug 5055293
* @summary Test non ascii characters in the Premain-Class attribute.
* @library /lib/testlibrary
+ * @library /test/lib
* @modules java.management
* @run build jdk.testlibrary.* DummyMain
* @run main PremainClassTest
--- a/test/jdk/java/lang/instrument/PremainClass/ZeroArgPremainAgentTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/instrument/PremainClass/ZeroArgPremainAgentTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -21,8 +21,8 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils;
/*
@@ -30,6 +30,7 @@
* @bug 6289149
* @summary test when the agent's class has a zero arg premain() function.
* @library /lib/testlibrary
+ * @library /test/lib
* @modules java.management
* java.instrument
* @run build jdk.testlibrary.* DummyMain
--- a/test/jdk/java/lang/instrument/executableJAR/ExecJarWithAgent.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/instrument/executableJAR/ExecJarWithAgent.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -24,6 +24,7 @@
/**
* @test
* @library /lib/testlibrary
+ * @library /test/lib
* @build ExecJarWithAgent Main Agent AgentHelper JarUtils jdk.testlibrary.*
* @run testng ExecJarWithAgent
* @summary Test starting agents in executable JAR files
@@ -38,8 +39,8 @@
import org.testng.annotations.Test;
import static org.testng.Assert.*;
-import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
@Test
public class ExecJarWithAgent {
--- a/test/jdk/java/lang/instrument/modules/AppendToClassPathModuleTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/instrument/modules/AppendToClassPathModuleTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -24,14 +24,18 @@
/**
* @test
* @bug 8169909
- * @library src /lib/testlibrary
+ * @library src /test/lib
* @build test/*
* @run shell AppendToClassPathModuleTest.sh
* @run main AppendToClassPathModuleTest
*/
+import jdk.test.lib.JDKToolFinder;
+
import java.util.Map;
-import static jdk.testlibrary.ProcessTools.*;
+import java.util.stream.Stream;
+
+import static jdk.test.lib.process.ProcessTools.*;
/**
* Launch a modular test with no class path and no CLASSPATH set.
@@ -41,14 +45,17 @@
public class AppendToClassPathModuleTest {
public static void main(String... args) throws Throwable {
String modulepath = System.getProperty("test.module.path");
- ProcessBuilder pb =
- createJavaProcessBuilder("-javaagent:Agent.jar",
- "--module-path", modulepath,
- "-m", "test/jdk.test.Main");
- // remove CLASSPATH environment variable
+ // can't use ProcessTools.createJavaProcessBuilder as it always adds -cp
+ ProcessBuilder pb = new ProcessBuilder(
+ JDKToolFinder.getTestJDKTool("java"),
+ "-javaagent:Agent.jar",
+ "--module-path", modulepath,
+ "-m", "test/jdk.test.Main");
+
Map<String,String> env = pb.environment();
- String value = env.remove("CLASSPATH");
+ // remove CLASSPATH environment variable
+ env.remove("CLASSPATH");
int exitCode = executeCommand(pb).getExitValue();
if (exitCode != 0) {
--- a/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -45,7 +45,7 @@
import java.util.concurrent.Phaser;
import javax.management.*;
import javax.management.openmbean.CompositeData;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.JDKToolFinder;
import jdk.testlibrary.Utils;
--- a/test/jdk/java/lang/management/MemoryMXBean/RunUtil.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/management/MemoryMXBean/RunUtil.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -28,9 +28,9 @@
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils;
-import jdk.testlibrary.ProcessTools;
import jdk.testlibrary.JDKToolFinder;
public class RunUtil {
--- a/test/jdk/java/lang/reflect/Proxy/ProxyClassAccessTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/reflect/Proxy/ProxyClassAccessTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -30,7 +30,7 @@
import java.util.List;
import jdk.test.lib.compiler.CompilerUtils;
-import static jdk.testlibrary.ProcessTools.executeTestJava;
+import static jdk.test.lib.process.ProcessTools.executeTestJava;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -38,9 +38,9 @@
/**
* @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
- * @build ProxyClassAccessTest q.NP jdk.testlibrary.*
+ * @build ProxyClassAccessTest q.NP
* jdk.test.lib.compiler.CompilerUtils
* @run testng ProxyClassAccessTest
* @summary Driver for testing proxy class doesn't have access to
--- a/test/jdk/java/lang/reflect/Proxy/ProxyLayerTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/reflect/Proxy/ProxyLayerTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -30,7 +30,7 @@
import java.util.Arrays;
import jdk.test.lib.compiler.CompilerUtils;
-import static jdk.testlibrary.ProcessTools.executeTestJava;
+import static jdk.test.lib.process.ProcessTools.executeTestJava;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -38,9 +38,9 @@
/**
* @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
- * @build ProxyTest jdk.testlibrary.ProcessTools
+ * @build ProxyTest jdk.test.lib.process.ProcessTools
* jdk.test.lib.compiler.CompilerUtils
* @run testng ProxyLayerTest
* @summary Test proxies to implement interfaces in a layer
--- a/test/jdk/java/lang/reflect/Proxy/ProxyTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/lang/reflect/Proxy/ProxyTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -27,7 +27,7 @@
import java.util.List;
import jdk.test.lib.compiler.CompilerUtils;
-import static jdk.testlibrary.ProcessTools.executeTestJava;
+import static jdk.test.lib.process.ProcessTools.executeTestJava;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -35,9 +35,9 @@
/**
* @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
- * @build ProxyTest q.U jdk.testlibrary.*
+ * @build ProxyTest q.U
* jdk.test.lib.compiler.CompilerUtils
* @run testng ProxyTest
* @summary Driver for testing proxies accessing interfaces in named modules
--- a/test/jdk/java/nio/file/spi/SetDefaultProvider.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/nio/file/spi/SetDefaultProvider.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, 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
@@ -24,8 +24,8 @@
/**
* @test
* @modules jdk.jartool
- * @library /lib/testlibrary
- * @build SetDefaultProvider TestProvider m/* jdk.testlibrary.ProcessTools
+ * @library /test/lib
+ * @build SetDefaultProvider TestProvider m/* jdk.test.lib.process.ProcessTools
* @run testng/othervm SetDefaultProvider
* @summary Runs tests with -Djava.nio.file.spi.DefaultFileSystemProvider set on
* the command line to override the default file system provider
@@ -38,7 +38,7 @@
import java.nio.file.Paths;
import java.util.spi.ToolProvider;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
--- a/test/jdk/java/rmi/module/ModuleTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/rmi/module/ModuleTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -24,13 +24,13 @@
/**
* @test
* @library /lib/testlibrary /test/lib
- * @build jdk.testlibrary.ProcessTools
+ * @build jdk.test.lib.process.ProcessTools
* ModuleTest jdk.test.lib.compiler.CompilerUtils JarUtils
* @run testng ModuleTest
* @summary Basic tests for using rmi in module world
*/
-import static jdk.testlibrary.ProcessTools.executeTestJava;
+import static jdk.test.lib.process.ProcessTools.executeTestJava;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
--- a/test/jdk/java/security/AccessController/DoPrivAccompliceTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/security/AccessController/DoPrivAccompliceTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -23,7 +23,6 @@
* questions.
*/
-import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.util.JarUtils;
--- a/test/jdk/java/security/KeyStore/PKCS12/KeytoolReaderP12Test.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/security/KeyStore/PKCS12/KeytoolReaderP12Test.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -26,7 +26,7 @@
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.util.Base64;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import static java.lang.System.out;
import java.nio.file.Paths;
import java.util.List;
@@ -37,6 +37,7 @@
* @summary Test for PKCS12 keystore list , export commands. Refer README for
* keystore files information
* @library /lib/testlibrary ../
+ * @library /test/lib
* @run main KeytoolReaderP12Test
*/
public class KeytoolReaderP12Test {
--- a/test/jdk/java/security/KeyStore/PKCS12/KeytoolWriteP12Test.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/security/KeyStore/PKCS12/KeytoolWriteP12Test.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -24,7 +24,7 @@
*/
import java.io.File;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import static java.lang.System.out;
/**
@@ -32,6 +32,7 @@
* @bug 8048830
* @summary Tests for creating pkcs12 keystore with various algorithms
* @library /lib/testlibrary ../
+ * @library /test/lib
* @run main KeytoolWriteP12Test
*/
public class KeytoolWriteP12Test {
--- a/test/jdk/java/security/KeyStore/PKCS12/MetadataEmptyTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/security/KeyStore/PKCS12/MetadataEmptyTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -40,6 +40,7 @@
* @bug 8048830
* @summary Entry's attribute set should be empty
* @library /lib/testlibrary ../
+ * @library /test/lib
* @run main MetadataEmptyTest
*/
public class MetadataEmptyTest {
--- a/test/jdk/java/security/KeyStore/PKCS12/MetadataStoreLoadTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/security/KeyStore/PKCS12/MetadataStoreLoadTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -44,6 +44,7 @@
* @bug 8048830
* @summary Test store metadata attributes to PKCS12 keystore.
* @library /lib/testlibrary ../
+ * @library /test/lib
* @run main MetadataStoreLoadTest
*/
public class MetadataStoreLoadTest {
--- a/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertAPITest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertAPITest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -43,6 +43,7 @@
* trusted certificate Check import errors (must be not errors) & check keystore
* content after import
* @library /lib/testlibrary ../
+ * @library /test/lib
* @run main StoreTrustedCertAPITest
*/
public class StoreTrustedCertAPITest {
--- a/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertKeytool.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertKeytool.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -30,7 +30,7 @@
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import static java.lang.System.out;
/**
@@ -39,6 +39,7 @@
* @summary Tests keytool command imports certificate , list keystore, print
* certificate and import password help.
* @library /lib/testlibrary ../
+ * @library /test/lib
* @run main StoreTrustedCertKeytool
*/
public class StoreTrustedCertKeytool {
--- a/test/jdk/java/security/KeyStore/PKCS12/Utils.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/security/KeyStore/PKCS12/Utils.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -32,8 +32,8 @@
import java.security.cert.CertificateException;
import java.util.Arrays;
import java.util.List;
-import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.testlibrary.JDKToolFinder;
import static java.lang.System.out;
import java.util.ArrayList;
--- a/test/jdk/java/security/Policy/ExtensiblePolicy/ExtensiblePolicyWithJarTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/security/Policy/ExtensiblePolicy/ExtensiblePolicyWithJarTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -26,14 +26,14 @@
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.AccessController;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8050402
* @summary Check policy is extensible with user defined permissions
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @build jdk.test.lib.util.JarUtils
* @compile TVJar/TVPermission.java
* @run main ExtensiblePolicyWithJarTest
--- a/test/jdk/java/security/Policy/SignedJar/SignedJarTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/security/Policy/SignedJar/SignedJarTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -28,13 +28,13 @@
import java.security.AccessController;
import java.security.Permission;
import java.security.PrivilegedAction;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
/**
* @test
* @bug 8048360
* @summary test policy entry with signedBy alias
- * @library /lib/testlibrary
+ * @library /test/lib
* @run main/othervm SignedJarTest
*/
public class SignedJarTest {
--- a/test/jdk/java/util/Arrays/TimSortStackSize2.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/util/Arrays/TimSortStackSize2.java Fri Sep 07 14:01:52 2018 -0700
@@ -26,10 +26,9 @@
* @bug 8072909
* @summary Test TimSort stack size on big arrays
* @key intermittent
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules java.management
* java.base/jdk.internal
- * @build jdk.testlibrary.*
* @build TimSortStackSize2
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
@@ -41,9 +40,8 @@
import java.util.List;
import java.util.function.Consumer;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import sun.hotspot.WhiteBox;
public class TimSortStackSize2 {
--- a/test/jdk/java/util/Locale/bcp47u/SystemPropertyTests.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/util/Locale/bcp47u/SystemPropertyTests.java Fri Sep 07 14:01:52 2018 -0700
@@ -23,15 +23,15 @@
/*
* @test
- * @library /lib/testlibrary
+ * @library /test/lib
* @bug 8189134
* @summary Tests the system properties
* @modules jdk.localedata
- * @build DefaultLocaleTest jdk.testlibrary.*
+ * @build DefaultLocaleTest
* @run testng/othervm SystemPropertyTests
*/
-import static jdk.testlibrary.ProcessTools.executeTestJava;
+import static jdk.test.lib.process.ProcessTools.executeTestJava;
import static org.testng.Assert.assertTrue;
import java.util.Locale;
--- a/test/jdk/java/util/ResourceBundle/modules/cache/CacheTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/util/ResourceBundle/modules/cache/CacheTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -24,19 +24,17 @@
/**
* @test
* @bug 8170772
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
- * @build CacheTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @build CacheTest jdk.test.lib.compiler.CompilerUtils
* @run testng CacheTest
*/
-import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import jdk.testlibrary.OutputAnalyzer;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
import jdk.test.lib.compiler.CompilerUtils;
import org.testng.annotations.BeforeTest;
--- a/test/jdk/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/util/ResourceBundle/modules/casesensitive/CaseInsensitiveNameClash.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -24,17 +24,17 @@
/*
* @test
* @bug 8177980
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
* @build jdk.test.lib.compiler.CompilerUtils
- * jdk.testlibrary.ProcessTools CaseInsensitiveNameClash
+ * jdk.test.lib.process.ProcessTools CaseInsensitiveNameClash
* @run testng CaseInsensitiveNameClash
*/
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.compiler.CompilerUtils;
import org.testng.annotations.BeforeTest;
--- a/test/jdk/java/util/ResourceBundle/modules/security/TestPermission.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/util/ResourceBundle/modules/security/TestPermission.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -27,7 +27,7 @@
import java.util.List;
import jdk.test.lib.compiler.CompilerUtils;
-import static jdk.testlibrary.ProcessTools.executeTestJava;
+import static jdk.test.lib.process.ProcessTools.executeTestJava;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -35,9 +35,9 @@
/**
* @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
- * @build TestPermission jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @build TestPermission jdk.test.lib.compiler.CompilerUtils
* @run testng TestPermission
* @summary Driver for testing ResourceBundle::getBundle(String, Module)
*/
--- a/test/jdk/java/util/logging/TestLoggerWeakRefLeak.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/util/logging/TestLoggerWeakRefLeak.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, 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
@@ -26,7 +26,7 @@
import java.io.InputStreamReader;
import static jdk.testlibrary.Asserts.assertGreaterThan;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import com.sun.tools.attach.AttachNotSupportedException;
import com.sun.tools.attach.VirtualMachine;
@@ -38,9 +38,10 @@
* @bug 6942989
* @summary Check for WeakReference leak in Logger and anonymous Logger objects
* @library /lib/testlibrary
+ * @library /test/lib
* @modules jdk.attach/sun.tools.attach
* java.logging
- * @build jdk.testlibrary.ProcessTools
+ * @build jdk.test.lib.process.ProcessTools
* @run main/othervm -Djdk.attach.allowAttachSelf TestLoggerWeakRefLeak Logger
* @run main/othervm -Djdk.attach.allowAttachSelf TestLoggerWeakRefLeak AnonymousLogger
*/
--- a/test/jdk/java/util/logging/modules/GetResourceBundleTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/util/logging/modules/GetResourceBundleTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -29,17 +29,17 @@
import org.testng.annotations.Test;
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
import jdk.test.lib.compiler.CompilerUtils;
import static org.testng.Assert.*;
/**
* @test
* @bug 8129126 8136802 8137316 8137317 8136804 8139350
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
* java.logging
- * @build GetResourceBundleTest jdk.testlibrary.ProcessTools
+ * @build GetResourceBundleTest jdk.test.lib.process.ProcessTools
* jdk.test.lib.compiler.CompilerUtils
* @run testng GetResourceBundleTest
* @summary Tests Logger.getLogger + logger.getResourceBundle in an named/unnamed module,
--- a/test/jdk/java/util/zip/EntryCount64k.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/java/util/zip/EntryCount64k.java Fri Sep 07 14:01:52 2018 -0700
@@ -24,7 +24,7 @@
/**
* @test
* @summary Test java.util.zip behavior with ~64k entries
- * @library /lib/testlibrary
+ * @library /test/lib
* @run main/othervm EntryCount64k
* @run main/othervm -Djdk.util.zip.inhibitZip64=true EntryCount64k
* @run main/othervm -Djdk.util.zip.inhibitZip64=false EntryCount64k
@@ -44,8 +44,8 @@
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
public class EntryCount64k {
public static class Main {
--- a/test/jdk/javax/management/mxbean/MXBeanWeirdParamTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/javax/management/mxbean/MXBeanWeirdParamTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -29,6 +29,7 @@
* @author Olivier Lagneau
* @modules java.management.rmi
* @library /lib/testlibrary
+ * @library /test/lib
* @compile Basic.java
* @run main/othervm/timeout=300 -DDEBUG_STANDARD MXBeanWeirdParamTest
*/
@@ -58,7 +59,7 @@
import javax.management.openmbean.TabularDataSupport;
import javax.management.openmbean.TabularType;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.JDKToolFinder;
public class MXBeanWeirdParamTest {
--- a/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -25,6 +25,7 @@
* @test
* @bug 8159377
* @library /lib/testlibrary
+ * @library /test/lib
* @summary Tests ObjectFilter on default agent
* @author Harsha Wardhana B
* @modules java.management
@@ -54,7 +55,7 @@
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils;
public class DefaultAgentFilterTest {
--- a/test/jdk/javax/management/security/AuthorizationTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/javax/management/security/AuthorizationTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -28,6 +28,7 @@
* @author Olivier Lagneau
* @modules java.management.rmi
* @library /lib/testlibrary
+ * @library /test/lib
* @compile Simple.java
* @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=username1 -Dpassword=password1 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials
* @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=username2 -Dpassword=password2 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials -expectedCreateException -expectedSetException -expectedInvokeException
@@ -64,7 +65,7 @@
import javax.management.Attribute ;
import javax.management.ObjectName ;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.JDKToolFinder;
public class AuthorizationTest {
--- a/test/jdk/javax/management/security/SecurityTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/javax/management/security/SecurityTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -28,6 +28,7 @@
* @author Olivier Lagneau
* @modules java.management.rmi
* @library /lib/testlibrary
+ * @library /test/lib
* @compile MBS_Light.java ServerDelegate.java TestSampleLoginModule.java
* @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=SQE_username -Dpassword=SQE_password SecurityTest -server -mapType x.password.file -client -mapType credentials
* @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=UNKNOWN_username -Dpassword=SQE_password SecurityTest -server -mapType x.password.file -client -mapType credentials -expectedThrowable java.lang.SecurityException
@@ -80,7 +81,7 @@
import java.security.Security;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.JDKToolFinder;
public class SecurityTest {
--- a/test/jdk/javax/security/auth/Subject/doAs/NestedActions.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/javax/security/auth/Subject/doAs/NestedActions.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2018, 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
@@ -41,7 +41,7 @@
import java.util.jar.Manifest;
import javax.security.auth.Subject;
import javax.security.auth.x500.X500Principal;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
/**
* @test
@@ -50,7 +50,7 @@
* in case of nested Subject.doAs() invocations
* when one of protection domains doesn't have permissions
*
- * @library /lib/testlibrary
+ * @library /test/lib
*
* @run main NestedActions jar NestedActionsACE.jar
* NestedActionsACE.class Utils.class
--- a/test/jdk/jdk/internal/misc/VM/RuntimeArguments.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/jdk/internal/misc/VM/RuntimeArguments.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -24,7 +24,7 @@
/**
* @test
* @summary Basic test of VM::getRuntimeArguments
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules java.base/jdk.internal.misc
* jdk.zipfs
* @run testng RuntimeArguments
@@ -34,7 +34,7 @@
import java.util.List;
import java.util.stream.Stream;
import jdk.internal.misc.VM;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
--- a/test/jdk/jdk/modules/etc/DefaultModules.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/jdk/modules/etc/DefaultModules.java Fri Sep 07 14:01:52 2018 -0700
@@ -27,7 +27,7 @@
* @modules jdk.compiler
* jdk.jlink
* jdk.zipfs
- * @library src /lib/testlibrary
+ * @library src /test/lib
* @build java.json/*
* @run main DefaultModules
* @summary Test that all modules that export an API are in the set of modules
@@ -37,13 +37,9 @@
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.lang.module.ModuleDescriptor;
-import java.lang.module.ModuleFinder;
-import java.lang.module.ModuleReference;
import java.util.spi.ToolProvider;
-import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
/**
* This test compiles and runs the following tests on the class path:
--- a/test/jdk/jdk/modules/incubator/DefaultImage.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/jdk/modules/incubator/DefaultImage.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -25,7 +25,7 @@
* @test
* @bug 8170859
* @summary Ensure no incubator modules are resolved by default in the image
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
* @build jdk.test.lib.compiler.CompilerUtils
* @run testng DefaultImage
@@ -47,7 +47,7 @@
import org.testng.annotations.Test;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static jdk.testlibrary.ProcessTools.executeCommand;
+import static jdk.test.lib.process.ProcessTools.executeCommand;
import static org.testng.Assert.*;
@Test
--- a/test/jdk/jdk/modules/incubator/ImageModules.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/jdk/modules/incubator/ImageModules.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -25,7 +25,7 @@
* @test
* @bug 8170859
* @summary Basic test for incubator modules in jmods and images
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @key intermittent
* @modules jdk.compiler jdk.jartool jdk.jlink
* @build jdk.test.lib.Platform
@@ -54,7 +54,7 @@
import org.testng.annotations.Test;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static jdk.testlibrary.ProcessTools.executeCommand;
+import static jdk.test.lib.process.ProcessTools.executeCommand;
import static org.testng.Assert.*;
public class ImageModules {
--- a/test/jdk/jdk/modules/scenarios/automaticmodules/RunWithAutomaticModules.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/jdk/modules/scenarios/automaticmodules/RunWithAutomaticModules.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -28,7 +28,7 @@
* java.scripting
* jdk.zipfs
* @build RunWithAutomaticModules jdk.test.lib.compiler.CompilerUtils JarUtils
- * jdk.testlibrary.ProcessTools
+ * jdk.test.lib.process.ProcessTools
* @run testng RunWithAutomaticModules
* @summary Runs tests that make use of automatic modules
*/
@@ -38,7 +38,7 @@
import java.nio.file.Paths;
import jdk.test.lib.compiler.CompilerUtils;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
--- a/test/jdk/jdk/modules/scenarios/container/ContainerTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/jdk/modules/scenarios/container/ContainerTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -23,12 +23,12 @@
/**
* @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.jartool/sun.tools.jar
* jdk.compiler
* jdk.zipfs
* java.se
- * @build ContainerTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @build ContainerTest jdk.test.lib.compiler.CompilerUtils
* @run testng ContainerTest
* @summary Starts a simple container that uses dynamic configurations
* and launches two applications in the same VM
@@ -39,7 +39,7 @@
import java.nio.file.Paths;
import jdk.test.lib.compiler.CompilerUtils;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
--- a/test/jdk/jdk/modules/scenarios/overlappingpackages/OverlappingPackagesTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/jdk/modules/scenarios/overlappingpackages/OverlappingPackagesTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -23,9 +23,9 @@
/**
* @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
- * @build OverlappingPackagesTest jdk.testlibrary.*
+ * @build OverlappingPackagesTest
* jdk.test.lib.compiler.CompilerUtils
* @run testng OverlappingPackagesTest
* @summary Basic test to ensure that startup fails if two or more modules
@@ -38,7 +38,7 @@
import java.util.List;
import jdk.test.lib.compiler.CompilerUtils;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
--- a/test/jdk/lib/testlibrary/OutputAnalyzerReportingTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/lib/testlibrary/OutputAnalyzerReportingTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -21,18 +21,18 @@
* questions.
*/
-package jdk.testlibrary;
-
/*
* @test
* @summary Test the OutputAnalyzer reporting functionality,
* such as printing additional diagnostic info
* (exit code, stdout, stderr, command line, etc.)
* @modules java.management
- * @build jdk.testlibrary.*
- * @run main jdk.testlibrary.OutputAnalyzerReportingTest
+ * @library /test/lib
+ * @run main OutputAnalyzerReportingTest
*/
+import jdk.test.lib.process.OutputAnalyzer;
+
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
--- a/test/jdk/lib/testlibrary/OutputAnalyzerTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/lib/testlibrary/OutputAnalyzerTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -20,16 +20,17 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package jdk.testlibrary;
/*
* @test
* @summary Test the OutputAnalyzer utility class
* @modules java.management
- * @build jdk.testlibrary.*
- * @run main jdk.testlibrary.OutputAnalyzerTest
+ * @library /test/lib
+ * @run main OutputAnalyzerTest
*/
+import jdk.test.lib.process.OutputAnalyzer;
+
public class OutputAnalyzerTest {
public static void main(String args[]) throws Exception {
@@ -150,17 +151,23 @@
// expected
}
- if (output.shouldMatchByLine(byLinePattern) != 1) {
- throw new Exception("shouldMatchByLine() should find one line");
+ try {
+ output.shouldMatchByLine(byLinePattern);
+ } catch (RuntimeException e) {
+ throw new Exception("shouldMatchByLine() failed", e);
}
+
try {
output.shouldMatchByLine(nonExistingPattern);
throw new Exception("shouldMatchByLine() failed to throw exception");
} catch (RuntimeException e) {
// expected
}
- if (output.stdoutShouldMatchByLine(stdoutByLinePattern) != 1) {
- throw new Exception("stdoutShouldMatchByLine() should find one line");
+
+ try {
+ output.stdoutShouldMatchByLine(stdoutByLinePattern);
+ } catch (RuntimeException e) {
+ throw new Exception("stdoutShouldMatchByLine() failed", e);
}
// Should not match
--- a/test/jdk/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java Fri Sep 07 15:18:14 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,577 +0,0 @@
-/*
- * Copyright (c) 2013, 2018, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.testlibrary;
-
-import static jdk.testlibrary.Asserts.*;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-
-
-/**
- * Utility class for verifying output and exit value from a {@code Process}.
- *
- * @deprecated This class is deprecated. Use the one from
- * {@code <root>/test/lib/jdk/test/lib/process}
- *
- */
-@Deprecated
-public final class OutputAnalyzer {
- private final OutputBuffer output;
- private final String stdout;
- private final String stderr;
- private final int exitValue; // useless now. output contains exit value.
-
- /**
- * Create an OutputAnalyzer, a utility class for verifying output and exit
- * value from a Process.
- * <p>
- * OutputAnalyzer should never be instantiated directly -
- * use {@linkplain ProcessTools#executeProcess(ProcessBuilder)} instead
- *
- * @param process
- * Process to analyze
- * @throws IOException
- * If an I/O error occurs.
- */
- OutputAnalyzer(Process process) throws IOException {
- output = new OutputBuffer(process);
- exitValue = -1;
- this.stdout = null;
- this.stderr = null;
- }
-
- /**
- * Create an OutputAnalyzer, a utility class for verifying output.
- *
- * @param buf
- * String buffer to analyze
- */
- OutputAnalyzer(String buf) {
- this(buf, buf);
- }
-
- /**
- * Create an OutputAnalyzer, a utility class for verifying output
- *
- * @param stdout
- * stdout buffer to analyze
- * @param stderr
- * stderr buffer to analyze
- */
- OutputAnalyzer(String stdout, String stderr) {
- this.output = null;
- this.stdout = stdout;
- this.stderr = stderr;
- exitValue = -1;
- }
-
- /**
- * Verify that the stdout and stderr contents of output buffer contains the
- * string
- *
- * @param expectedString
- * String that buffer should contain
- * @throws RuntimeException
- * If the string was not found
- */
- public OutputAnalyzer shouldContain(String expectedString) {
- if (!getStdout().contains(expectedString)
- && !getStderr().contains(expectedString)) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + expectedString
- + "' missing from stdout/stderr \n");
- }
- return this;
- }
-
- /**
- * Verify that the stdout contents of output buffer contains the string
- *
- * @param expectedString
- * String that buffer should contain
- * @throws RuntimeException
- * If the string was not found
- */
- public OutputAnalyzer stdoutShouldContain(String expectedString) {
- if (!getStdout().contains(expectedString)) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + expectedString
- + "' missing from stdout \n");
- }
- return this;
- }
-
- /**
- * Verify that the stderr contents of output buffer contains the string
- *
- * @param expectedString
- * String that buffer should contain
- * @throws RuntimeException
- * If the string was not found
- */
- public OutputAnalyzer stderrShouldContain(String expectedString) {
- if (!getStderr().contains(expectedString)) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + expectedString
- + "' missing from stderr \n");
- }
- return this;
- }
-
- /**
- * Verify that the stdout and stderr contents of output buffer does not
- * contain the string
- *
- * @param notExpectedString
- * String that the buffer should not contain
- * @throws RuntimeException
- * If the string was found
- */
- public OutputAnalyzer shouldNotContain(String notExpectedString) {
- if (getStdout().contains(notExpectedString)) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + notExpectedString
- + "' found in stdout \n");
- }
- if (getStderr().contains(notExpectedString)) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + notExpectedString
- + "' found in stderr \n");
- }
- return this;
- }
-
- /**
- * Verify that the stdout contents of output buffer does not contain the
- * string
- *
- * @param notExpectedString
- * String that the buffer should not contain
- * @throws RuntimeException
- * If the string was found
- */
- public OutputAnalyzer stdoutShouldNotContain(String notExpectedString) {
- if (getStdout().contains(notExpectedString)) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + notExpectedString
- + "' found in stdout \n");
- }
- return this;
- }
-
- /**
- * Verify that the stderr contents of output buffer does not contain the
- * string
- *
- * @param notExpectedString
- * String that the buffer should not contain
- * @throws RuntimeException
- * If the string was found
- */
- public OutputAnalyzer stderrShouldNotContain(String notExpectedString) {
- if (getStderr().contains(notExpectedString)) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + notExpectedString
- + "' found in stderr \n");
- }
- return this;
- }
-
- /**
- * Verify that the stdout and stderr contents of output buffer matches the
- * pattern
- *
- * @param pattern
- * @throws RuntimeException
- * If the pattern was not found
- */
- public OutputAnalyzer shouldMatch(String pattern) {
- Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
- .matcher(getStdout());
- Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
- .matcher(getStderr());
- if (!stdoutMatcher.find() && !stderrMatcher.find()) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern
- + "' missing from stdout/stderr \n");
- }
- return this;
- }
-
- /**
- * Verify that the stdout contents of output buffer matches the pattern
- *
- * @param pattern
- * @throws RuntimeException
- * If the pattern was not found
- */
- public OutputAnalyzer stdoutShouldMatch(String pattern) {
- Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
- getStdout());
- if (!matcher.find()) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern
- + "' missing from stdout \n");
- }
- return this;
- }
-
- /**
- * Verify that the stderr contents of output buffer matches the pattern
- *
- * @param pattern
- * @throws RuntimeException
- * If the pattern was not found
- */
- public OutputAnalyzer stderrShouldMatch(String pattern) {
- Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
- getStderr());
- if (!matcher.find()) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern
- + "' missing from stderr \n");
- }
- return this;
- }
-
- /**
- * Verify that the stdout and stderr contents of output buffer does not
- * match the pattern
- *
- * @param pattern
- * @throws RuntimeException
- * If the pattern was found
- */
- public OutputAnalyzer shouldNotMatch(String pattern) {
- Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
- getStdout());
- if (matcher.find()) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern + "' found in stdout: '"
- + matcher.group() + "' \n");
- }
- matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(getStderr());
- if (matcher.find()) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern + "' found in stderr: '"
- + matcher.group() + "' \n");
- }
- return this;
- }
-
- /**
- * Verify that the stdout contents of output buffer does not match the
- * pattern
- *
- * @param pattern
- * @throws RuntimeException
- * If the pattern was found
- */
- public OutputAnalyzer stdoutShouldNotMatch(String pattern) {
- Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
- getStdout());
- if (matcher.find()) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern + "' found in stdout \n");
- }
- return this;
- }
-
- /**
- * Verify that the stderr contents of output buffer does not match the
- * pattern
- *
- * @param pattern
- * @throws RuntimeException
- * If the pattern was found
- */
- public OutputAnalyzer stderrShouldNotMatch(String pattern) {
- Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
- getStderr());
- if (matcher.find()) {
- reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern + "' found in stderr \n");
- }
- return this;
- }
-
- /**
- * Get the captured group of the first string matching the pattern. stderr
- * is searched before stdout.
- *
- * @param pattern
- * The multi-line pattern to match
- * @param group
- * The group to capture
- * @return The matched string or null if no match was found
- */
- public String firstMatch(String pattern, int group) {
- Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
- .matcher(getStderr());
- Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
- .matcher(getStdout());
- if (stderrMatcher.find()) {
- return stderrMatcher.group(group);
- }
- if (stdoutMatcher.find()) {
- return stdoutMatcher.group(group);
- }
- return null;
- }
-
- /**
- * Get the first string matching the pattern. stderr is searched before
- * stdout.
- *
- * @param pattern
- * The multi-line pattern to match
- * @return The matched string or null if no match was found
- */
- public String firstMatch(String pattern) {
- return firstMatch(pattern, 0);
- }
-
- /**
- * Verify the exit value of the process
- *
- * @param expectedExitValue
- * Expected exit value from process
- * @throws RuntimeException
- * If the exit value from the process did not match the expected
- * value
- */
- public OutputAnalyzer shouldHaveExitValue(int expectedExitValue) {
- if (getExitValue() != expectedExitValue) {
- reportDiagnosticSummary();
- throw new RuntimeException("Expected to get exit value of ["
- + expectedExitValue + "]\n");
- }
- return this;
- }
-
- /**
- * Report summary that will help to diagnose the problem Currently includes:
- * - standard input produced by the process under test - standard output -
- * exit code Note: the command line is printed by the ProcessTools
- */
- private OutputAnalyzer reportDiagnosticSummary() {
- String msg = " stdout: [" + getStdout() + "];\n" + " stderr: [" + getStderr()
- + "]\n" + " exitValue = " + getExitValue() + "\n";
-
- System.err.println(msg);
- return this;
- }
-
- /**
- * Get the contents of the output buffer (stdout and stderr)
- *
- * @return Content of the output buffer
- */
- public String getOutput() {
- return getStdout() + getStderr();
- }
-
- /**
- * Get the contents of the stdout buffer
- *
- * @return Content of the stdout buffer
- */
- public String getStdout() {
- return output == null ? stdout : output.getStdout();
- }
-
- /**
- * Get the contents of the stderr buffer
- *
- * @return Content of the stderr buffer
- */
- public String getStderr() {
- return output == null ? stderr : output.getStderr();
- }
-
- /**
- * Get the process exit value
- *
- * @return Process exit value
- */
- public int getExitValue() {
- return output == null ? exitValue : output.getExitValue();
- }
-
-
- /**
- * Print the stdout buffer to the given {@code PrintStream}.
- *
- * @return this OutputAnalyzer
- */
- public OutputAnalyzer outputTo(PrintStream out) {
- out.println(getStdout());
- return this;
- }
-
- /**
- * Print the stderr buffer to the given {@code PrintStream}.
- *
- * @return this OutputAnalyzer
- */
- public OutputAnalyzer errorTo(PrintStream out) {
- out.println(getStderr());
- return this;
- }
-
-
- /**
- * Get the contents of the output buffer (stdout and stderr)
- * as a list of strings. Output will be split at new-lines as
- * recognized by java.io.BufferedReader.readLine().
- *
- * @return Contents of the output buffer as list of strings
- */
- public List<String> asLines() {
- return asLines(getOutput());
- }
-
- private List<String> asLines(String buffer) {
- return new BufferedReader(new StringReader(buffer))
- .lines().collect(Collectors.toList());
- }
-
- /**
- * Check if there is a line matching {@code pattern} and return its index
- *
- * @param pattern Matching pattern
- * @return Index of first matching line
- */
- private int indexOf(List<String> lines, String pattern) {
- for (int i = 0; i < lines.size(); i++) {
- if (lines.get(i).matches(pattern)) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * @see #shouldMatchByLine(String, String, String)
- */
- public int shouldMatchByLine(String pattern) {
- return shouldMatchByLine(null, null, pattern);
- }
-
- /**
- * @see #stdoutShouldMatchByLine(String, String, String)
- */
- public int stdoutShouldMatchByLine(String pattern) {
- return stdoutShouldMatchByLine(null, null, pattern);
- }
-
- /**
- * @see #shouldMatchByLine(String, String, String)
- */
- public int shouldMatchByLineFrom(String from, String pattern) {
- return shouldMatchByLine(from, null, pattern);
- }
-
- /**
- * @see #shouldMatchByLine(String, String, String)
- */
- public int shouldMatchByLineTo(String to, String pattern) {
- return shouldMatchByLine(null, to, pattern);
- }
-
- /**
- * Verify that the stdout and stderr contents of output buffer match the
- * {@code pattern} line by line. The whole output could be matched or
- * just a subset of it.
- *
- * @param from
- * The line from where output will be matched.
- * Set {@code from} to null for matching from the first line.
- * @param to
- * The line until where output will be matched.
- * Set {@code to} to null for matching until the last line.
- * @param pattern
- * Matching pattern
- * @return Count of lines which match the {@code pattern}
- */
- public int shouldMatchByLine(String from, String to, String pattern) {
- return shouldMatchByLine(getOutput(), from, to, pattern);
- }
-
- /**
- * Verify that the stdout contents of output buffer matches the
- * {@code pattern} line by line. The whole stdout could be matched or
- * just a subset of it.
- *
- * @param from
- * The line from where stdout will be matched.
- * Set {@code from} to null for matching from the first line.
- * @param to
- * The line until where stdout will be matched.
- * Set {@code to} to null for matching until the last line.
- * @param pattern
- * Matching pattern
- * @return Count of lines which match the {@code pattern}
- */
- public int stdoutShouldMatchByLine(String from, String to, String pattern) {
- return shouldMatchByLine(getStdout(), from, to, pattern);
- }
-
- private int shouldMatchByLine(String buffer, String from, String to, String pattern) {
- List<String> lines = asLines(buffer);
-
- int fromIndex = 0;
- if (from != null) {
- fromIndex = indexOf(lines, from);
- assertGreaterThan(fromIndex, -1,
- "The line/pattern '" + from + "' from where the output should match can not be found");
- }
-
- int toIndex = lines.size();
- if (to != null) {
- toIndex = indexOf(lines, to);
- assertGreaterThan(toIndex, -1,
- "The line/pattern '" + to + "' until where the output should match can not be found");
- }
-
- List<String> subList = lines.subList(fromIndex, toIndex);
- int matchedCount = 0;
- for (String line : subList) {
- assertTrue(line.matches(pattern),
- "The line '" + line + "' does not match pattern '" + pattern + "'");
- matchedCount++;
- }
-
- return matchedCount;
- }
-
-}
--- a/test/jdk/lib/testlibrary/jdk/testlibrary/OutputBuffer.java Fri Sep 07 15:18:14 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2013, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.testlibrary;
-
-import java.io.ByteArrayOutputStream;
-import java.util.concurrent.CancellationException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
-/**
- * @deprecated This class is deprecated. Use the one from
- * {@code <root>/test/lib/jdk/test/lib/process}
- */
-@Deprecated
-class OutputBuffer {
- private static class OutputBufferException extends RuntimeException {
- private static final long serialVersionUID = 8528687792643129571L;
-
- public OutputBufferException(Throwable cause) {
- super(cause);
- }
- }
-
- private final Process p;
- private final Future<Void> outTask;
- private final Future<Void> errTask;
- private final ByteArrayOutputStream stderrBuffer = new ByteArrayOutputStream();
- private final ByteArrayOutputStream stdoutBuffer = new ByteArrayOutputStream();
-
- /**
- * Create an OutputBuffer, a class for storing and managing stdout and
- * stderr results separately
- *
- * @param stdout
- * stdout result
- * @param stderr
- * stderr result
- */
- OutputBuffer(Process p) {
- this.p = p;
- StreamPumper outPumper = new StreamPumper(p.getInputStream(),
- stdoutBuffer);
- StreamPumper errPumper = new StreamPumper(p.getErrorStream(),
- stderrBuffer);
-
- outTask = outPumper.process();
- errTask = errPumper.process();
- }
-
- /**
- * Returns the stdout result
- *
- * @return stdout result
- */
- public String getStdout() {
- try {
- outTask.get();
- return stdoutBuffer.toString();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new OutputBufferException(e);
- } catch (ExecutionException | CancellationException e) {
- throw new OutputBufferException(e);
- }
- }
-
- /**
- * Returns the stderr result
- *
- * @return stderr result
- */
- public String getStderr() {
- try {
- errTask.get();
- return stderrBuffer.toString();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new OutputBufferException(e);
- } catch (ExecutionException | CancellationException e) {
- throw new OutputBufferException(e);
- }
- }
-
- public int getExitValue() {
- try {
- return p.waitFor();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new OutputBufferException(e);
- }
- }
-}
--- a/test/jdk/lib/testlibrary/jdk/testlibrary/ProcessTools.java Fri Sep 07 15:18:14 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,560 +0,0 @@
-/*
- * Copyright (c) 2013, 2017, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.testlibrary;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.concurrent.CountDownLatch;
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.function.Predicate;
-import java.util.function.Consumer;
-import java.util.stream.Collectors;
-
-
-/**
- * @deprecated This class is deprecated. Use the one from
- * {@code <root>/test/lib/jdk/test/lib/process}
- */
-@Deprecated
-public final class ProcessTools {
- private static final class LineForwarder extends StreamPumper.LinePump {
- private final PrintStream ps;
- private final String prefix;
- LineForwarder(String prefix, PrintStream os) {
- this.ps = os;
- this.prefix = prefix;
- }
- @Override
- protected void processLine(String line) {
- ps.println("[" + prefix + "] " + line);
- }
- }
-
- private ProcessTools() {
- }
-
- /**
- * <p>Starts a process from its builder.</p>
- * <span>The default redirects of STDOUT and STDERR are started</span>
- * @param name The process name
- * @param processBuilder The process builder
- * @return Returns the initialized process
- * @throws IOException
- */
- public static Process startProcess(String name,
- ProcessBuilder processBuilder)
- throws IOException {
- return startProcess(name, processBuilder, (Consumer<String>)null);
- }
-
- /**
- * <p>Starts a process from its builder.</p>
- * <span>The default redirects of STDOUT and STDERR are started</span>
- * <p>It is possible to monitor the in-streams via the provided {@code consumer}
- * @param name The process name
- * @param consumer {@linkplain Consumer} instance to process the in-streams
- * @param processBuilder The process builder
- * @return Returns the initialized process
- * @throws IOException
- */
- @SuppressWarnings("overloads")
- public static Process startProcess(String name,
- ProcessBuilder processBuilder,
- Consumer<String> consumer)
- throws IOException {
- try {
- return startProcess(name, processBuilder, consumer, null, -1, TimeUnit.NANOSECONDS);
- } catch (InterruptedException | TimeoutException e) {
- // will never happen
- throw new RuntimeException(e);
- }
- }
-
- /**
- * <p>Starts a process from its builder.</p>
- * <span>The default redirects of STDOUT and STDERR are started</span>
- * <p>
- * It is possible to wait for the process to get to a warmed-up state
- * via {@linkplain Predicate} condition on the STDOUT
- * </p>
- * @param name The process name
- * @param processBuilder The process builder
- * @param linePredicate The {@linkplain Predicate} to use on the STDOUT
- * Used to determine the moment the target app is
- * properly warmed-up.
- * It can be null - in that case the warmup is skipped.
- * @param timeout The timeout for the warmup waiting; -1 = no wait; 0 = wait forever
- * @param unit The timeout {@linkplain TimeUnit}
- * @return Returns the initialized {@linkplain Process}
- * @throws IOException
- * @throws InterruptedException
- * @throws TimeoutException
- */
- public static Process startProcess(String name,
- ProcessBuilder processBuilder,
- final Predicate<String> linePredicate,
- long timeout,
- TimeUnit unit)
- throws IOException, InterruptedException, TimeoutException {
- return startProcess(name, processBuilder, null, linePredicate, timeout, unit);
- }
-
- /**
- * <p>Starts a process from its builder.</p>
- * <span>The default redirects of STDOUT and STDERR are started</span>
- * <p>
- * It is possible to wait for the process to get to a warmed-up state
- * via {@linkplain Predicate} condition on the STDOUT and monitor the
- * in-streams via the provided {@linkplain Consumer}
- * </p>
- * @param name The process name
- * @param processBuilder The process builder
- * @param lineConsumer The {@linkplain Consumer} the lines will be forwarded to
- * @param linePredicate The {@linkplain Predicate} to use on the STDOUT
- * Used to determine the moment the target app is
- * properly warmed-up.
- * It can be null - in that case the warmup is skipped.
- * @param timeout The timeout for the warmup waiting; -1 = no wait; 0 = wait forever
- * @param unit The timeout {@linkplain TimeUnit}
- * @return Returns the initialized {@linkplain Process}
- * @throws IOException
- * @throws InterruptedException
- * @throws TimeoutException
- */
- public static Process startProcess(String name,
- ProcessBuilder processBuilder,
- final Consumer<String> lineConsumer,
- final Predicate<String> linePredicate,
- long timeout,
- TimeUnit unit)
- throws IOException, InterruptedException, TimeoutException {
- System.out.println("["+name+"]:" + processBuilder.command().stream().collect(Collectors.joining(" ")));
- Process p = processBuilder.start();
- StreamPumper stdout = new StreamPumper(p.getInputStream());
- StreamPumper stderr = new StreamPumper(p.getErrorStream());
-
- stdout.addPump(new LineForwarder(name, System.out));
- stderr.addPump(new LineForwarder(name, System.err));
- if (lineConsumer != null) {
- StreamPumper.LinePump pump = new StreamPumper.LinePump() {
- @Override
- protected void processLine(String line) {
- lineConsumer.accept(line);
- }
- };
- stdout.addPump(pump);
- stderr.addPump(pump);
- }
-
-
- CountDownLatch latch = new CountDownLatch(1);
- if (linePredicate != null) {
- StreamPumper.LinePump pump = new StreamPumper.LinePump() {
- @Override
- protected void processLine(String line) {
- if (latch.getCount() > 0 && linePredicate.test(line)) {
- latch.countDown();
- }
- }
- };
- stdout.addPump(pump);
- stderr.addPump(pump);
- } else {
- latch.countDown();
- }
- final Future<Void> stdoutTask = stdout.process();
- final Future<Void> stderrTask = stderr.process();
-
- try {
- if (timeout > -1) {
- if (timeout == 0) {
- latch.await();
- } else {
- if (!latch.await(Utils.adjustTimeout(timeout), unit)) {
- throw new TimeoutException();
- }
- }
- }
- } catch (TimeoutException | InterruptedException e) {
- System.err.println("Failed to start a process (thread dump follows)");
- for(Map.Entry<Thread, StackTraceElement[]> s : Thread.getAllStackTraces().entrySet()) {
- printStack(s.getKey(), s.getValue());
- }
-
- if (p.isAlive()) {
- p.destroyForcibly();
- }
-
- stdoutTask.cancel(true);
- stderrTask.cancel(true);
- throw e;
- }
-
- return new ProcessImpl(p, stdoutTask, stderrTask);
- }
-
- /**
- * <p>Starts a process from its builder.</p>
- * <span>The default redirects of STDOUT and STDERR are started</span>
- * <p>
- * It is possible to wait for the process to get to a warmed-up state
- * via {@linkplain Predicate} condition on the STDOUT. The warm-up will
- * wait indefinitely.
- * </p>
- * @param name The process name
- * @param processBuilder The process builder
- * @param linePredicate The {@linkplain Predicate} to use on the STDOUT
- * Used to determine the moment the target app is
- * properly warmed-up.
- * It can be null - in that case the warmup is skipped.
- * @return Returns the initialized {@linkplain Process}
- * @throws IOException
- * @throws InterruptedException
- * @throws TimeoutException
- */
- @SuppressWarnings("overloads")
- public static Process startProcess(String name,
- ProcessBuilder processBuilder,
- final Predicate<String> linePredicate)
- throws IOException, InterruptedException, TimeoutException {
- return startProcess(name, processBuilder, linePredicate, 0, TimeUnit.SECONDS);
- }
-
- /**
- * Get the process id of the current running Java process
- *
- * @return Process id
- */
- public static long getProcessId() {
- return ProcessHandle.current().pid();
- }
-
- /**
- * Create ProcessBuilder using the java launcher from the jdk to be tested,
- * and with any platform specific arguments prepended.
- *
- * @param command Arguments to pass to the java command.
- * @return The ProcessBuilder instance representing the java command.
- */
- public static ProcessBuilder createJavaProcessBuilder(String... command) {
- return createJavaProcessBuilder(false, command);
- }
-
- /**
- * Create ProcessBuilder using the java launcher from the jdk to be tested,
- * and with any platform specific arguments prepended.
- *
- * @param addTestVmAndJavaOptions If true, adds test.vm.opts and test.java.opts
- * to the java arguments.
- * @param command Arguments to pass to the java command.
- * @return The ProcessBuilder instance representing the java command.
- */
- public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) {
- String javapath = JDKToolFinder.getJDKTool("java");
-
- ArrayList<String> args = new ArrayList<>();
- args.add(javapath);
-
- if (addTestVmAndJavaOptions) {
- // -cp is needed to make sure the same classpath is used whether the test is
- // run in AgentVM mode or OtherVM mode. It was added to the hotspot version
- // of this API as part of 8077608. However, for the jdk version it is only
- // added when addTestVmAndJavaOptions is true in order to minimize
- // disruption to existing JDK tests, which have yet to be tested with -cp
- // being added. At some point -cp should always be added to be consistent
- // with what the hotspot version does.
- args.add("-cp");
- args.add(System.getProperty("java.class.path"));
- Collections.addAll(args, Utils.getTestJavaOpts());
- }
-
- Collections.addAll(args, command);
-
- // Reporting
- StringBuilder cmdLine = new StringBuilder();
- for (String cmd : args)
- cmdLine.append(cmd).append(' ');
- System.out.println("Command line: [" + cmdLine.toString() + "]");
-
- return new ProcessBuilder(args.toArray(new String[args.size()]));
- }
-
- private static void printStack(Thread t, StackTraceElement[] stack) {
- System.out.println("\t" + t +
- " stack: (length = " + stack.length + ")");
- if (t != null) {
- for (StackTraceElement stack1 : stack) {
- System.out.println("\t" + stack1);
- }
- System.out.println();
- }
- }
-
- /**
- * Executes a test java process, waits for it to finish and returns the process output.
- * The default options from jtreg, test.vm.opts and test.java.opts, are added.
- * The java from the test.jdk is used to execute the command.
- *
- * The command line will be like:
- * {test.jdk}/bin/java {test.vm.opts} {test.java.opts} cmds
- *
- * The java process will have exited before this method returns.
- *
- * @param cmds User specifed arguments.
- * @return The output from the process.
- */
- public static OutputAnalyzer executeTestJava(String... options) throws Exception {
- ProcessBuilder pb = createJavaProcessBuilder(Utils.addTestJavaOpts(options));
- return executeProcess(pb);
- }
-
- /**
- * @deprecated Use executeTestJava instead
- */
- public static OutputAnalyzer executeTestJvm(String... options) throws Exception {
- return executeTestJava(options);
- }
-
- /**
- * Executes a process, waits for it to finish and returns the process output.
- * The process will have exited before this method returns.
- * @param pb The ProcessBuilder to execute.
- * @return The {@linkplain OutputAnalyzer} instance wrapping the process.
- */
- public static OutputAnalyzer executeProcess(ProcessBuilder pb) throws Exception {
- return executeProcess(pb, null);
- }
-
- /**
- * Executes a process, pipe some text into its STDIN, waits for it
- * to finish and returns the process output. The process will have exited
- * before this method returns.
- * @param pb The ProcessBuilder to execute.
- * @param input The text to pipe into STDIN. Can be null.
- * @return The {@linkplain OutputAnalyzer} instance wrapping the process.
- */
- public static OutputAnalyzer executeProcess(ProcessBuilder pb, String input)
- throws Exception {
- OutputAnalyzer output = null;
- Process p = null;
- boolean failed = false;
- try {
- p = pb.start();
- if (input != null) {
- try (OutputStream os = p.getOutputStream();
- PrintStream ps = new PrintStream(os)) {
- ps.print(input);
- ps.flush();
- }
- }
- output = new OutputAnalyzer(p);
- p.waitFor();
-
- return output;
- } catch (Throwable t) {
- if (p != null) {
- p.destroyForcibly().waitFor();
- }
-
- failed = true;
- System.out.println("executeProcess() failed: " + t);
- throw t;
- } finally {
- if (failed) {
- System.err.println(getProcessLog(pb, output));
- }
- }
- }
-
- /**
- * Executes a process, waits for it to finish and returns the process output.
- *
- * The process will have exited before this method returns.
- *
- * @param cmds The command line to execute.
- * @return The output from the process.
- */
- public static OutputAnalyzer executeProcess(String... cmds) throws Exception {
- return executeProcess(new ProcessBuilder(cmds));
- }
-
- /**
- * Used to log command line, stdout, stderr and exit code from an executed process.
- * @param pb The executed process.
- * @param output The output from the process.
- */
- public static String getProcessLog(ProcessBuilder pb, OutputAnalyzer output) {
- String stderr = output == null ? "null" : output.getStderr();
- String stdout = output == null ? "null" : output.getStdout();
- String exitValue = output == null ? "null": Integer.toString(output.getExitValue());
- StringBuilder logMsg = new StringBuilder();
- final String nl = System.getProperty("line.separator");
- logMsg.append("--- ProcessLog ---" + nl);
- logMsg.append("cmd: " + getCommandLine(pb) + nl);
- logMsg.append("exitvalue: " + exitValue + nl);
- logMsg.append("stderr: " + stderr + nl);
- logMsg.append("stdout: " + stdout + nl);
-
- return logMsg.toString();
- }
-
- /**
- * @return The full command line for the ProcessBuilder.
- */
- public static String getCommandLine(ProcessBuilder pb) {
- if (pb == null) {
- return "null";
- }
- StringBuilder cmd = new StringBuilder();
- for (String s : pb.command()) {
- cmd.append(s).append(" ");
- }
- return cmd.toString().trim();
- }
-
- /**
- * Executes a process, waits for it to finish, prints the process output
- * to stdout, and returns the process output.
- *
- * The process will have exited before this method returns.
- *
- * @param cmds The command line to execute.
- * @return The {@linkplain OutputAnalyzer} instance wrapping the process.
- */
- public static OutputAnalyzer executeCommand(String... cmds)
- throws Throwable {
- String cmdLine = Arrays.stream(cmds).collect(Collectors.joining(" "));
- System.out.println("Command line: [" + cmdLine + "]");
- OutputAnalyzer analyzer = ProcessTools.executeProcess(cmds);
- System.out.println(analyzer.getOutput());
- return analyzer;
- }
-
- /**
- * Executes a process, waits for it to finish, prints the process output
- * to stdout and returns the process output.
- *
- * The process will have exited before this method returns.
- *
- * @param pb The ProcessBuilder to execute.
- * @return The {@linkplain OutputAnalyzer} instance wrapping the process.
- */
- public static OutputAnalyzer executeCommand(ProcessBuilder pb)
- throws Throwable {
- String cmdLine = pb.command().stream().collect(Collectors.joining(" "));
- System.out.println("Command line: [" + cmdLine + "]");
- OutputAnalyzer analyzer = ProcessTools.executeProcess(pb);
- System.out.println(analyzer.getOutput());
- return analyzer;
- }
-
- private static class ProcessImpl extends Process {
-
- private final Process p;
- private final Future<Void> stdoutTask;
- private final Future<Void> stderrTask;
-
- public ProcessImpl(Process p, Future<Void> stdoutTask, Future<Void> stderrTask) {
- this.p = p;
- this.stdoutTask = stdoutTask;
- this.stderrTask = stderrTask;
- }
-
- @Override
- public OutputStream getOutputStream() {
- return p.getOutputStream();
- }
-
- @Override
- public InputStream getInputStream() {
- return p.getInputStream();
- }
-
- @Override
- public InputStream getErrorStream() {
- return p.getErrorStream();
- }
-
- @Override
- public int waitFor() throws InterruptedException {
- int rslt = p.waitFor();
- waitForStreams();
- return rslt;
- }
-
- @Override
- public int exitValue() {
- return p.exitValue();
- }
-
- @Override
- public void destroy() {
- p.destroy();
- }
-
- @Override
- public long pid() {
- return p.pid();
- }
-
- @Override
- public boolean isAlive() {
- return p.isAlive();
- }
-
- @Override
- public Process destroyForcibly() {
- return p.destroyForcibly();
- }
-
- @Override
- public boolean waitFor(long timeout, TimeUnit unit) throws InterruptedException {
- boolean rslt = p.waitFor(timeout, unit);
- if (rslt) {
- waitForStreams();
- }
- return rslt;
- }
-
- private void waitForStreams() throws InterruptedException {
- try {
- stdoutTask.get();
- } catch (ExecutionException e) {
- }
- try {
- stderrTask.get();
- } catch (ExecutionException e) {
- }
- }
- }
-}
--- a/test/jdk/lib/testlibrary/jdk/testlibrary/StreamPumper.java Fri Sep 07 15:18:14 2018 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/*
- * Copyright (c) 2013, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.testlibrary;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.Future;
-import java.util.concurrent.FutureTask;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * @deprecated This class is deprecated. Use the one from
- * {@code <root>/test/lib/jdk/test/lib/process}
- */
-@Deprecated
-public final class StreamPumper implements Runnable {
-
- private static final int BUF_SIZE = 256;
-
- /**
- * Pump will be called by the StreamPumper to process the incoming data
- */
- abstract public static class Pump {
- abstract void register(StreamPumper d);
- }
-
- /**
- * OutputStream -> Pump adapter
- */
- final public static class StreamPump extends Pump {
- private final OutputStream out;
- public StreamPump(OutputStream out) {
- this.out = out;
- }
-
- @Override
- void register(StreamPumper sp) {
- sp.addOutputStream(out);
- }
- }
-
- /**
- * Used to process the incoming data line-by-line
- */
- abstract public static class LinePump extends Pump {
- @Override
- final void register(StreamPumper sp) {
- sp.addLineProcessor(this);
- }
-
- abstract protected void processLine(String line);
- }
-
- private final InputStream in;
- private final Set<OutputStream> outStreams = new HashSet<>();
- private final Set<LinePump> linePumps = new HashSet<>();
-
- private final AtomicBoolean processing = new AtomicBoolean(false);
- private final FutureTask<Void> processingTask = new FutureTask<>(this, null);
-
- public StreamPumper(InputStream in) {
- this.in = in;
- }
-
- /**
- * Create a StreamPumper that reads from in and writes to out.
- *
- * @param in
- * The stream to read from.
- * @param out
- * The stream to write to.
- */
- public StreamPumper(InputStream in, OutputStream out) {
- this(in);
- this.addOutputStream(out);
- }
-
- /**
- * Implements Thread.run(). Continuously read from {@code in} and write to
- * {@code out} until {@code in} has reached end of stream. Abort on
- * interruption. Abort on IOExceptions.
- */
- @Override
- public void run() {
- try (BufferedInputStream is = new BufferedInputStream(in)) {
- ByteArrayOutputStream lineBos = new ByteArrayOutputStream();
- byte[] buf = new byte[BUF_SIZE];
- int len = 0;
- int linelen = 0;
-
- while ((len = is.read(buf)) > 0 && !Thread.interrupted()) {
- for(OutputStream out : outStreams) {
- out.write(buf, 0, len);
- }
- if (!linePumps.isEmpty()) {
- int i = 0;
- int lastcrlf = -1;
- while (i < len) {
- if (buf[i] == '\n' || buf[i] == '\r') {
- int bufLinelen = i - lastcrlf - 1;
- if (bufLinelen > 0) {
- lineBos.write(buf, lastcrlf + 1, bufLinelen);
- }
- linelen += bufLinelen;
-
- if (linelen > 0) {
- lineBos.flush();
- final String line = lineBos.toString();
- linePumps.stream().forEach((lp) -> {
- lp.processLine(line);
- });
- lineBos.reset();
- linelen = 0;
- }
- lastcrlf = i;
- }
-
- i++;
- }
- if (lastcrlf == -1) {
- lineBos.write(buf, 0, len);
- linelen += len;
- } else if (lastcrlf < len - 1) {
- lineBos.write(buf, lastcrlf + 1, len - lastcrlf - 1);
- linelen += len - lastcrlf - 1;
- }
- }
- }
-
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- for(OutputStream out : outStreams) {
- try {
- out.flush();
- } catch (IOException e) {}
- }
- try {
- in.close();
- } catch (IOException e) {}
- }
- }
-
- final void addOutputStream(OutputStream out) {
- outStreams.add(out);
- }
-
- final void addLineProcessor(LinePump lp) {
- linePumps.add(lp);
- }
-
- final public StreamPumper addPump(Pump ... pump) {
- if (processing.get()) {
- throw new IllegalStateException("Can not modify pumper while " +
- "processing is in progress");
- }
- for(Pump p : pump) {
- p.register(this);
- }
- return this;
- }
-
- final public Future<Void> process() {
- if (!processing.compareAndSet(false, true)) {
- throw new IllegalStateException("Can not re-run the processing");
- }
- Thread t = new Thread(new Runnable() {
- @Override
- public void run() {
- processingTask.run();
- }
- });
- t.setDaemon(true);
- t.start();
-
- return processingTask;
- }
-}
--- a/test/jdk/native_sanity/simplenativelauncher/ProgramTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/native_sanity/simplenativelauncher/ProgramTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -23,14 +23,14 @@
/*
* @test
- * @library /lib/testlibrary
- * @build jdk.testlibrary.OutputAnalyzer
+ * @library /test/lib
+ * @build jdk.test.lib.process.OutputAnalyzer
* @build ProgramTest
* @run main/native ProgramTest
*/
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
public class ProgramTest {
public static void main(String... args) throws Exception {
--- a/test/jdk/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2018, 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
@@ -21,7 +21,6 @@
* questions.
*/
-import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
@@ -34,8 +33,8 @@
import java.util.UUID;
import java.util.concurrent.Semaphore;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import sun.jvmstat.monitor.MonitorException;
import sun.jvmstat.monitor.MonitoredHost;
import sun.jvmstat.monitor.MonitoredVm;
@@ -66,11 +65,10 @@
* @test
* @bug 4990825
* @summary attach to external but local JVM processes
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules java.management
* jdk.internal.jvmstat/sun.jvmstat.monitor
* jdk.internal.jvmstat/sun.jvmstat.monitor.event
- * @build jdk.testlibrary.*
* @run main/othervm MonitorVmStartTerminate
*/
public final class MonitorVmStartTerminate {
--- a/test/jdk/sun/management/jdp/DynamicLauncher.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/management/jdp/DynamicLauncher.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -22,8 +22,8 @@
*/
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils;
import java.util.UUID;
--- a/test/jdk/sun/management/jdp/JdpDefaultsTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/management/jdp/JdpDefaultsTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -32,6 +32,7 @@
* @summary Assert that we can read JDP packets from a multicast socket connection, on default IP and port.
*
* @library /lib/testlibrary
+ * @library /test/lib
*
* @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher
* @run main/othervm JdpDefaultsTest
--- a/test/jdk/sun/management/jdp/JdpJmxRemoteDynamicPortTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/management/jdp/JdpJmxRemoteDynamicPortTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -28,6 +28,7 @@
* when VM is started with jmxremote.port=0.
*
* @library /lib/testlibrary
+ * @library /test/lib
*
* @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpJmxRemoteDynamicPortTestCase DynamicLauncher
* @run main/othervm JdpJmxRemoteDynamicPortTest
--- a/test/jdk/sun/management/jdp/JdpOffTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/management/jdp/JdpOffTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -33,6 +33,7 @@
* @summary Assert that no JDP packets are sent to the default address and port.
*
* @library /lib/testlibrary
+ * @library /test/lib
*
* @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOffTestCase DynamicLauncher
* @run main/othervm JdpOffTest
--- a/test/jdk/sun/management/jdp/JdpSpecificAddressTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/management/jdp/JdpSpecificAddressTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -32,6 +32,7 @@
* @summary Assert that we can read JDP packets from a multicast socket connection, on specific IP and port.
*
* @library /lib/testlibrary
+ * @library /test/lib
*
* @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher
* @run main/othervm JdpSpecificAddressTest
--- a/test/jdk/sun/management/jdp/PortAlreadyInUseTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/management/jdp/PortAlreadyInUseTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -22,7 +22,7 @@
*/
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.testlibrary.Utils;
import java.io.IOException;
--- a/test/jdk/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -21,8 +21,8 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.Platform;
import java.io.BufferedWriter;
--- a/test/jdk/sun/management/jmxremote/bootstrap/CustomLauncherTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/bootstrap/CustomLauncherTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -35,19 +35,18 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
/**
* @test
* @bug 6434402 8004926
* @author Jaroslav Bachorik
*
- * @library /lib/testlibrary
+ * @library /test/lib
* @modules java.management
* jdk.attach
* jdk.management.agent/jdk.internal.agent
*
- * @build jdk.testlibrary.*
* @build TestManager TestApplication CustomLauncherTest
* @run main/othervm CustomLauncherTest
*/
--- a/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -30,7 +30,7 @@
import java.util.stream.Collectors;
import jdk.test.lib.thread.ProcessThread;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
/**
* NOTE:
@@ -48,11 +48,10 @@
* @summary Test JMX agent host address binding. Same ports but different
* interfaces to bind to (using plain sockets and SSL sockets).
*
- * @library /lib/testlibrary
* @library /test/lib
* @modules java.management.rmi
*
- * @build jdk.testlibrary.* JMXAgentInterfaceBinding
+ * @build JMXAgentInterfaceBinding
* @run main/timeout=5 JMXInterfaceBindingTest
*/
public class JMXInterfaceBindingTest {
--- a/test/jdk/sun/management/jmxremote/bootstrap/LocalManagementTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/bootstrap/LocalManagementTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -27,7 +27,7 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils;
/**
@@ -39,6 +39,7 @@
* both agent properties and jvmstat buffer.
*
* @library /lib/testlibrary
+ * @library /test/lib
* @modules java.management
* jdk.attach
* jdk.management.agent/jdk.internal.agent
--- a/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -21,8 +21,8 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils;
import java.io.BufferedReader;
@@ -44,6 +44,7 @@
* @author Luis-Miguel Alventosa, Taras Ledkov
*
* @library /lib/testlibrary
+ * @library /test/lib
*
* @build jdk.testlibrary.* RmiRegistrySslTestApp
* @run main/timeout=300 RmiRegistrySslTest
--- a/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -44,7 +44,7 @@
import javax.management.remote.*;
import javax.net.ssl.SSLHandshakeException;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils;
import jdk.internal.agent.Agent;
import jdk.internal.agent.AgentConfigurationError;
@@ -58,6 +58,7 @@
* achieves the desired results
*
* @library /lib/testlibrary
+ * @library /test/lib
* @modules java.management
* java.rmi
* jdk.management.agent/jdk.internal.agent
--- a/test/jdk/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/startstop/JMXStatusPerfCountersTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -32,7 +32,7 @@
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
/**
@@ -43,6 +43,7 @@
* in the related performance counters.
*
* @library /lib/testlibrary
+ * @library /test/lib
*
* @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd
* @run testng/othervm -XX:+UsePerfData JMXStatusPerfCountersTest
--- a/test/jdk/sun/management/jmxremote/startstop/JMXStatusTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/startstop/JMXStatusTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -29,7 +29,7 @@
import org.testng.annotations.*;
import static org.testng.Assert.*;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
/**
* @test
@@ -39,6 +39,7 @@
* The test asserts that the expected text is being printed.
*
* @library /lib/testlibrary
+ * @library /test/lib
*
* @build jdk.testlibrary.* PortAllocator TestApp ManagementAgentJcmd
* JMXStatusTest JMXStatus1Test JMXStatus2Test
--- a/test/jdk/sun/management/jmxremote/startstop/ManagementAgentJcmd.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/startstop/ManagementAgentJcmd.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -34,7 +34,7 @@
import jdk.internal.agent.AgentConfigurationError;
import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
/**
* A helper class for issuing ManagementAgent.* diagnostic commands and capturing
--- a/test/jdk/sun/security/krb5/auto/tools/KinitConfPlusProps.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/krb5/auto/tools/KinitConfPlusProps.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -24,15 +24,15 @@
import java.io.File;
import java.util.HashMap;
import java.util.Map;
-import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
/*
* @test
* @bug 6857795 8075299
* @summary Checks if kinit uses both krb5 conf file and system properties
* @requires os.family == "windows"
- * @library /lib/testlibrary
+ * @library /test/lib
* @library /sun/security/krb5/auto
* @run main/othervm KinitConfPlusProps
*/
--- a/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java Fri Sep 07 14:01:52 2018 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8164879
* @library /lib/testlibrary ../../
+ * @library /test/lib
* @summary Verify AES/GCM's limits set in the jdk.tls.keyLimits property
* start a new handshake sequence to renegotiate the symmetric key with an
* SSLSocket connection. This test verifies the handshake method was called
@@ -53,9 +54,9 @@
import java.security.SecureRandom;
import java.util.Arrays;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.testlibrary.Utils;
-import jdk.testlibrary.OutputAnalyzer;
public class SSLEngineKeyLimit {
--- a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java Fri Sep 07 14:01:52 2018 -0700
@@ -25,6 +25,7 @@
* @test
* @bug 8164879
* @library /lib/testlibrary ../../
+ * @library /test/lib
* @modules java.base/sun.security.util
* @summary Verify AES/GCM's limits set in the jdk.tls.keyLimits property
* @run main SSLSocketKeyLimit 0 server AES/GCM/NoPadding keyupdate 1000000
@@ -47,8 +48,6 @@
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManagerFactory;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
@@ -57,9 +56,9 @@
import java.security.SecureRandom;
import java.util.Arrays;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils;
-import jdk.testlibrary.OutputAnalyzer;
import sun.security.util.HexDumpEncoder;
public class SSLSocketKeyLimit {
--- a/test/jdk/sun/security/tools/jarsigner/TsacertOptionTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/TsacertOptionTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -21,7 +21,7 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.util.JarUtils;
/**
--- a/test/jdk/sun/security/tools/jarsigner/Warning.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/Warning.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -23,8 +23,8 @@
import jdk.testlibrary.JDKToolLauncher;
import jdk.test.lib.util.JarUtils;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import java.nio.file.Files;
import java.nio.file.Paths;
--- a/test/jdk/sun/security/tools/jarsigner/warnings/AliasNotInStoreTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/warnings/AliasNotInStoreTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -21,14 +21,14 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for aliasNotInStore warning
- * @library /lib/testlibrary /test/lib ../
+ * @library /test/lib ../
* @build jdk.test.lib.util.JarUtils
* @run main AliasNotInStoreTest
*/
--- a/test/jdk/sun/security/tools/jarsigner/warnings/BadExtendedKeyUsageTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/warnings/BadExtendedKeyUsageTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -21,14 +21,14 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for badExtendedKeyUsage warning
- * @library /lib/testlibrary /test/lib ../
+ * @library /test/lib ../
* @build jdk.test.lib.util.JarUtils
* @run main BadExtendedKeyUsageTest
*/
--- a/test/jdk/sun/security/tools/jarsigner/warnings/BadKeyUsageTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/warnings/BadKeyUsageTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -21,14 +21,14 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for badKeyUsage warning
- * @library /lib/testlibrary /test/lib ../
+ * @library /test/lib ../
* @ignore until 8026393 is fixed
* @build jdk.test.lib.util.JarUtils
* @run main BadKeyUsageTest
--- a/test/jdk/sun/security/tools/jarsigner/warnings/BadNetscapeCertTypeTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/warnings/BadNetscapeCertTypeTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -21,14 +21,14 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for badNetscapeCertType warning
- * @library /lib/testlibrary /test/lib ../
+ * @library /test/lib ../
* @build jdk.test.lib.util.JarUtils
* @run main BadNetscapeCertTypeTest
*/
--- a/test/jdk/sun/security/tools/jarsigner/warnings/ChainNotValidatedTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/warnings/ChainNotValidatedTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -21,7 +21,7 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.util.JarUtils;
import java.nio.file.Files;
@@ -31,7 +31,7 @@
* @test
* @bug 8024302 8026037
* @summary Test for chainNotValidated warning
- * @library /lib/testlibrary /test/lib ../
+ * @library /test/lib ../
* @build jdk.test.lib.util.JarUtils
* @run main ChainNotValidatedTest ca2yes
* @run main ChainNotValidatedTest ca2no
--- a/test/jdk/sun/security/tools/jarsigner/warnings/HasExpiredCertTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/warnings/HasExpiredCertTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -21,14 +21,14 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for hasExpiredCert warning
- * @library /lib/testlibrary /test/lib ../
+ * @library /test/lib ../
* @build jdk.test.lib.util.JarUtils
* @run main HasExpiredCertTest
*/
--- a/test/jdk/sun/security/tools/jarsigner/warnings/HasExpiringCertTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/warnings/HasExpiringCertTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -21,14 +21,14 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for hasExpiringCert warning
- * @library /lib/testlibrary /test/lib ../
+ * @library /test/lib ../
* @build jdk.test.lib.util.JarUtils
* @run main HasExpiringCertTest
*/
--- a/test/jdk/sun/security/tools/jarsigner/warnings/HasUnsignedEntryTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/warnings/HasUnsignedEntryTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -21,14 +21,14 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for hasUnsignedEntry warning
- * @library /lib/testlibrary /test/lib ../
+ * @library /test/lib ../
* @build jdk.test.lib.util.JarUtils
* @run main HasUnsignedEntryTest
*/
--- a/test/jdk/sun/security/tools/jarsigner/warnings/MultipleWarningsTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/warnings/MultipleWarningsTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -21,14 +21,14 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Checks if jarsigner prints appropriate warnings
- * @library /lib/testlibrary /test/lib ../
+ * @library /test/lib ../
* @build jdk.test.lib.util.JarUtils
* @run main MultipleWarningsTest
*/
--- a/test/jdk/sun/security/tools/jarsigner/warnings/NoTimestampTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/warnings/NoTimestampTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -23,14 +23,14 @@
import java.util.Date;
import java.util.Locale;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037 8196213
* @summary Checks warnings if -tsa and -tsacert options are not specified
- * @library /lib/testlibrary /test/lib ../
+ * @library /test/lib ../
* @build jdk.test.lib.util.JarUtils
* @run main NoTimestampTest
*/
--- a/test/jdk/sun/security/tools/jarsigner/warnings/NotSignedByAliasTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/warnings/NotSignedByAliasTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -21,14 +21,14 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for notSignedByAlias warning
- * @library /lib/testlibrary /test/lib ../
+ * @library /test/lib ../
* @build jdk.test.lib.util.JarUtils
* @run main NotSignedByAliasTest
*/
--- a/test/jdk/sun/security/tools/jarsigner/warnings/NotYetValidCertTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/warnings/NotYetValidCertTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -21,14 +21,14 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.util.JarUtils;
/**
* @test
* @bug 8024302 8026037
* @summary Test for notYetValidCert warning
- * @library /lib/testlibrary /test/lib ../
+ * @library /test/lib ../
* @build jdk.test.lib.util.JarUtils
* @run main NotYetValidCertTest
*/
--- a/test/jdk/sun/security/tools/jarsigner/warnings/Test.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/warnings/Test.java Fri Sep 07 14:01:52 2018 -0700
@@ -21,8 +21,8 @@
* questions.
*/
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import java.util.ArrayList;
import java.util.Arrays;
--- a/test/jdk/sun/tools/jcmd/JcmdBase.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/tools/jcmd/JcmdBase.java Fri Sep 07 14:01:52 2018 -0700
@@ -23,8 +23,8 @@
import java.util.Arrays;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.JDKToolLauncher;
/**
--- a/test/jdk/sun/tools/jcmd/TestJcmdDefaults.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/tools/jcmd/TestJcmdDefaults.java Fri Sep 07 14:01:52 2018 -0700
@@ -23,14 +23,13 @@
import static jdk.testlibrary.Asserts.*;
-import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.testlibrary.Utils;
/*
@@ -40,6 +39,7 @@
* requests to a specific JVM process.
*
* @library /lib/testlibrary
+ * @library /test/lib
*
* @build jdk.testlibrary.*
* @run main TestJcmdDefaults
@@ -90,12 +90,9 @@
* 24428 com.sun.javatest.regtest.MainWrapper /tmp/jtreg/jtreg-workdir/classes/sun/tools/jcmd/TestJcmdDefaults.jta
*
* @param output The generated output from the jcmd.
- * @throws Exception
*/
- private static void matchListedProcesses(OutputAnalyzer output) throws Exception {
- int matchedCount = output.shouldMatchByLine(JCMD_LIST_REGEX);
- assertGreaterThan(matchedCount , 0,
- "Found no lines matching pattern: " + JCMD_LIST_REGEX);
+ private static void matchListedProcesses(OutputAnalyzer output) {
+ output.shouldMatchByLine(JCMD_LIST_REGEX);
}
private static void verifyOutputAgainstFile(OutputAnalyzer output) throws IOException {
--- a/test/jdk/sun/tools/jcmd/TestJcmdSanity.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/tools/jcmd/TestJcmdSanity.java Fri Sep 07 14:01:52 2018 -0700
@@ -30,8 +30,8 @@
import java.nio.file.Paths;
import java.util.List;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils;
/*
@@ -41,6 +41,7 @@
* command requests to the current java process.
*
* @library /lib/testlibrary
+ * @library /test/lib
*
* @build jdk.testlibrary.*
* @run main/othervm -XX:+UsePerfData TestJcmdSanity
@@ -134,12 +135,10 @@
* @param output The generated output from the jcmd.
* @throws Exception
*/
- private static void matchJcmdCommands(OutputAnalyzer output) throws Exception {
- int matchedCount = output.shouldMatchByLine(JCMD_COMMAND_REGEX,
+ private static void matchJcmdCommands(OutputAnalyzer output) {
+ output.shouldMatchByLine(JCMD_COMMAND_REGEX,
"help",
JCMD_COMMAND_REGEX);
- assertGreaterThan(matchedCount , 0,
- "Found no lines matching pattern: " + JCMD_COMMAND_REGEX);
}
/**
@@ -154,11 +153,9 @@
* @param output The generated output from the PerfCounter.print command.
* @throws Exception
*/
- private static void matchPerfCounters(OutputAnalyzer output) throws Exception {
- int matchedCount = output.shouldMatchByLineFrom(PERF_COUNTER_REGEX,
+ private static void matchPerfCounters(OutputAnalyzer output) {
+ output.shouldMatchByLineFrom(PERF_COUNTER_REGEX,
PERF_COUNTER_REGEX);
- assertGreaterThan(matchedCount , 0,
- "Found no lines matching pattern: " + PERF_COUNTER_REGEX);
}
private static void verifyOutputAgainstFile(OutputAnalyzer output) throws IOException {
--- a/test/jdk/sun/tools/jhsdb/BasicLauncherTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/tools/jhsdb/BasicLauncherTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -40,12 +40,12 @@
import java.util.List;
import java.util.Arrays;
import java.util.Optional;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.apps.LingeredApp;
+import jdk.test.lib.Platform;
import jdk.testlibrary.JDKToolLauncher;
import jdk.testlibrary.Utils;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
-import jdk.test.lib.apps.LingeredApp;
-import jdk.test.lib.Platform;
public class BasicLauncherTest {
--- a/test/jdk/sun/tools/jhsdb/HeapDumpTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/tools/jhsdb/HeapDumpTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -38,12 +38,13 @@
import java.io.File;
import java.util.List;
import java.util.Arrays;
-import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
import jdk.test.lib.hprof.parser.HprofReader;
+import jdk.testlibrary.JDKToolLauncher;
public class HeapDumpTest {
--- a/test/jdk/sun/tools/jinfo/BasicJInfoTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/tools/jinfo/BasicJInfoTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -23,14 +23,15 @@
import java.util.Arrays;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
/*
* @test
* @summary Unit test for jinfo utility
* @library /lib/testlibrary
+ * @library /test/lib
* @build jdk.testlibrary.*
* @run main BasicJInfoTest
*/
--- a/test/jdk/sun/tools/jmap/BasicJMapTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/tools/jmap/BasicJMapTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -28,9 +28,9 @@
import java.util.Arrays;
import jdk.test.lib.hprof.HprofParser;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
/*
* @test
--- a/test/jdk/sun/tools/jps/JpsHelper.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/tools/jps/JpsHelper.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -35,11 +35,11 @@
import java.util.Arrays;
import java.util.List;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Asserts;
import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.OutputAnalyzer;
import jdk.testlibrary.Utils;
-import jdk.testlibrary.ProcessTools;
/**
* The helper class for running jps utility and verifying output from it
@@ -184,10 +184,9 @@
* 35417 Main
* 31103 org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
*/
- public static void verifyJpsOutput(OutputAnalyzer output, String regex) throws Exception {
+ public static void verifyJpsOutput(OutputAnalyzer output, String regex) {
output.shouldHaveExitValue(0);
- int matchedCount = output.stdoutShouldMatchByLine(regex);
- assertGreaterThan(matchedCount , 0, "Found no lines matching pattern: " + regex);
+ output.stdoutShouldMatchByLine(regex);
output.stderrShouldNotMatch("[E|e]xception");
output.stderrShouldNotMatch("[E|e]rror");
}
--- a/test/jdk/sun/tools/jps/TestJpsSanity.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/tools/jps/TestJpsSanity.java Fri Sep 07 14:01:52 2018 -0700
@@ -22,7 +22,7 @@
*/
import jdk.testlibrary.Asserts;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.apps.LingeredApp;
/*
--- a/test/jdk/sun/tools/jstack/BasicJStackTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/tools/jstack/BasicJStackTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -23,14 +23,15 @@
import java.util.Arrays;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
/*
* @test
* @summary Unit test for jstack utility
* @library /lib/testlibrary
+ * @library /test/lib
* @build jdk.testlibrary.*
* @run main BasicJStackTest
*/
--- a/test/jdk/sun/tools/jstack/DeadlockDetectionTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/tools/jstack/DeadlockDetectionTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -28,11 +28,11 @@
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.apps.LingeredAppWithDeadlock;
import jdk.test.lib.Platform;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils;
import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
/**
* @test
--- a/test/jdk/sun/tools/jstat/JStatInterval.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/tools/jstat/JStatInterval.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -25,6 +25,7 @@
* @test
* @bug 8035668
* @library /lib/testlibrary
+ * @library /test/lib
* @summary Test checks case when target application finishes execution and jstat didn't complete work.
jstat is started with interval = 100 (jstat -compiler 100) and monitored application finishes
after 500ms. This shouldn't cause crash or hang in target application or in jstat.
@@ -33,7 +34,7 @@
* @run main JStatInterval
*/
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.JDKToolLauncher;
import java.util.concurrent.TimeUnit;
--- a/test/jdk/sun/tools/jstatd/JstatdTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/tools/jstatd/JstatdTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -32,8 +32,8 @@
import static jdk.testlibrary.Asserts.*;
import jdk.testlibrary.JDKToolLauncher;
import jdk.testlibrary.Utils;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
/**
* The base class for tests of jstatd.
@@ -328,7 +328,7 @@
}
// Verify output from jstatd
- jdk.test.lib.process.OutputAnalyzer output = jstatdThread.getOutput();
+ OutputAnalyzer output = jstatdThread.getOutput();
assertTrue(output.getOutput().isEmpty(),
"jstatd should get an empty output, got: "
+ Utils.NEW_LINE + output.getOutput());
--- a/test/jdk/sun/tools/jstatd/TestJstatdUsage.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/sun/tools/jstatd/TestJstatdUsage.java Fri Sep 07 14:01:52 2018 -0700
@@ -22,8 +22,8 @@
*/
import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
/*
* @test
--- a/test/jdk/tools/jimage/JImageToolTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/jimage/JImageToolTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -22,8 +22,8 @@
*/
/*
* @test
- * @library /lib/testlibrary
- * @build jdk.testlibrary.ProcessTools
+ * @library /test/lib
+ * @build jdk.test.lib.process.ProcessTools
* @summary Test to check if jimage tool exists and is working
* @run main/timeout=360 JImageToolTest
*/
@@ -34,7 +34,7 @@
import java.util.ArrayList;
import java.util.Arrays;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
/**
* Basic test for jimage tool.
--- a/test/jdk/tools/jlink/basic/AllModulePath.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/jlink/basic/AllModulePath.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -24,10 +24,10 @@
/*
* @test
* @summary jlink test of --add-module ALL-MODULE-PATH
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
- * @build jdk.testlibrary.ProcessTools
- * jdk.testlibrary.OutputAnalyzer
+ * @build jdk.test.lib.process.ProcessTools
+ * jdk.test.lib.process.OutputAnalyzer
* jdk.test.lib.compiler.CompilerUtils
* @run testng AllModulePath
*/
@@ -49,7 +49,7 @@
import java.util.spi.ToolProvider;
import jdk.test.lib.compiler.CompilerUtils;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
--- a/test/jdk/tools/jlink/basic/BasicTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/jlink/basic/BasicTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -29,8 +29,8 @@
* @modules java.base/jdk.internal.module
* jdk.jlink
* jdk.compiler
- * @build jdk.testlibrary.ProcessTools
- * jdk.testlibrary.OutputAnalyzer
+ * @build jdk.test.lib.process.ProcessTools
+ * jdk.test.lib.process.OutputAnalyzer
* JarUtils jdk.test.lib.compiler.CompilerUtils
* @run main BasicTest
*/
@@ -46,8 +46,8 @@
import java.util.spi.ToolProvider;
import jdk.test.lib.compiler.CompilerUtils;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
public class BasicTest {
static final ToolProvider JMOD_TOOL = ToolProvider.findFirst("jmod")
--- a/test/jdk/tools/jlink/bindservices/BindServices.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/jlink/bindservices/BindServices.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -34,7 +34,7 @@
import java.util.stream.Stream;
import jdk.test.lib.compiler.CompilerUtils;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -43,9 +43,9 @@
/**
* @test
* @bug 8174826
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler jdk.jlink
- * @build BindServices jdk.testlibrary.ProcessTools
+ * @build BindServices jdk.test.lib.process.ProcessTools
* jdk.test.lib.compiler.CompilerUtils
* @run testng BindServices
*/
--- a/test/jdk/tools/jlink/plugins/SystemModuleDescriptors/CompiledVersionTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/jlink/plugins/SystemModuleDescriptors/CompiledVersionTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -31,7 +31,7 @@
import jdk.test.lib.compiler.CompilerUtils;
import jdk.test.lib.util.FileUtils;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
import org.testng.annotations.BeforeTest;
@@ -40,12 +40,12 @@
/**
* @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler jdk.jlink
* @build jdk.test.lib.compiler.CompilerUtils
* jdk.test.lib.util.FileUtils
* jdk.test.lib.Platform
- * CompiledVersionTest jdk.testlibrary.ProcessTools
+ * CompiledVersionTest jdk.test.lib.process.ProcessTools
* @run testng CompiledVersionTest
*/
--- a/test/jdk/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/jlink/plugins/SystemModuleDescriptors/UserModuleTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -35,7 +35,7 @@
import jdk.test.lib.compiler.CompilerUtils;
import jdk.test.lib.util.FileUtils;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -51,7 +51,7 @@
* @build jdk.test.lib.compiler.CompilerUtils
* jdk.test.lib.util.FileUtils
* jdk.test.lib.Platform
- * ModuleTargetHelper UserModuleTest jdk.testlibrary.ProcessTools
+ * ModuleTargetHelper UserModuleTest jdk.test.lib.process.ProcessTools
* @run testng UserModuleTest
*/
--- a/test/jdk/tools/launcher/InfoStreams.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/InfoStreams.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -23,15 +23,14 @@
/**
* @test
- * @library /lib/testlibrary
- * @build InfoStreams jdk.testlibrary.ProcessTools
+ * @library /test/lib
+ * @build InfoStreams jdk.test.lib.process.ProcessTools
* @run main InfoStreams
* @summary Test that informational options use the correct streams
*/
-import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.OutputAnalyzer;
-
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
public class InfoStreams {
--- a/test/jdk/tools/launcher/modules/addexports/AddExportsTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/addexports/AddExportsTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -23,9 +23,9 @@
/**
* @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
- * @build AddExportsTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @build AddExportsTest jdk.test.lib.compiler.CompilerUtils
* @run testng AddExportsTest
* @summary Basic tests for java --add-exports
*/
@@ -35,8 +35,8 @@
import java.util.stream.Stream;
import jdk.test.lib.compiler.CompilerUtils;
-import jdk.testlibrary.OutputAnalyzer;
-import static jdk.testlibrary.ProcessTools.*;
+import jdk.test.lib.process.OutputAnalyzer;
+import static jdk.test.lib.process.ProcessTools.*;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/tools/launcher/modules/addexports/AddExportsTestWarningError.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/addexports/AddExportsTestWarningError.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -25,11 +25,10 @@
* @test
* @bug 8168836
* @summary Basic argument validation for --add-exports
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
* @build jdk.test.lib.compiler.ModuleInfoMaker
* jdk.test.lib.compiler.CompilerUtils
- * jdk.testlibrary.*
* @run testng AddExportsTestWarningError
*/
@@ -42,8 +41,8 @@
import java.util.stream.Stream;
import jdk.test.lib.compiler.ModuleInfoMaker;
-import jdk.testlibrary.OutputAnalyzer;
-import static jdk.testlibrary.ProcessTools.*;
+import jdk.test.lib.process.OutputAnalyzer;
+import static jdk.test.lib.process.ProcessTools.*;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/tools/launcher/modules/addexports/manifest/AddExportsAndOpensInManifest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/addexports/manifest/AddExportsAndOpensInManifest.java Fri Sep 07 14:01:52 2018 -0700
@@ -24,6 +24,7 @@
/**
* @test
* @library /lib/testlibrary
+ * @library /test/lib
* @modules jdk.compiler
* @build AddExportsAndOpensInManifest Test2 JarUtils jdk.testlibrary.*
* @compile --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED Test1.java
@@ -39,8 +40,8 @@
import java.util.jar.Attributes;
import java.util.jar.Manifest;
-import jdk.testlibrary.OutputAnalyzer;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
--- a/test/jdk/tools/launcher/modules/addmods/AddModsTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/addmods/AddModsTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -23,10 +23,10 @@
/**
* @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.jlink/jdk.tools.jmod
* jdk.compiler
- * @build AddModsTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @build AddModsTest jdk.test.lib.compiler.CompilerUtils
* @run testng AddModsTest
* @summary Basic test for java --add-modules
*/
@@ -36,7 +36,7 @@
import java.nio.file.Paths;
import jdk.test.lib.compiler.CompilerUtils;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
--- a/test/jdk/tools/launcher/modules/addreads/AddReadsTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/addreads/AddReadsTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -25,7 +25,7 @@
* @test
* @library /lib/testlibrary /test/lib
* @modules jdk.compiler
- * @build AddReadsTest JarUtils jdk.testlibrary.*
+ * @build AddReadsTest JarUtils
* jdk.test.lib.compiler.CompilerUtils
* @run testng AddReadsTest
* @summary Basic tests for java --add-reads
@@ -35,8 +35,8 @@
import java.nio.file.Paths;
import jdk.test.lib.compiler.CompilerUtils;
-import jdk.testlibrary.OutputAnalyzer;
-import static jdk.testlibrary.ProcessTools.*;
+import jdk.test.lib.process.OutputAnalyzer;
+import static jdk.test.lib.process.ProcessTools.*;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/tools/launcher/modules/addreads/AddReadsTestWarningError.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/addreads/AddReadsTestWarningError.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -25,11 +25,10 @@
* @test
* @bug 8168836
* @summary Basic argument validation for --add-reads
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
* @build jdk.test.lib.compiler.ModuleInfoMaker
* @build jdk.test.lib.compiler.CompilerUtils
- * @build jdk.testlibrary.*
* @build AddReadsTestWarningError
* @run testng AddReadsTestWarningError
*/
@@ -43,8 +42,8 @@
import java.util.stream.Stream;
import jdk.test.lib.compiler.ModuleInfoMaker;
-import jdk.testlibrary.OutputAnalyzer;
-import static jdk.testlibrary.ProcessTools.*;
+import jdk.test.lib.process.OutputAnalyzer;
+import static jdk.test.lib.process.ProcessTools.*;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/tools/launcher/modules/basic/BasicTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/basic/BasicTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -23,11 +23,11 @@
/**
* @test
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
* jdk.jartool
* jdk.jlink
- * @build BasicTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @build BasicTest jdk.test.lib.compiler.CompilerUtils
* @run testng BasicTest
* @summary Basic test of starting an application as a module
*/
@@ -39,7 +39,7 @@
import java.util.spi.ToolProvider;
import jdk.test.lib.compiler.CompilerUtils;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
--- a/test/jdk/tools/launcher/modules/basic/InitErrors.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/basic/InitErrors.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -23,8 +23,8 @@
/**
* @test
- * @library /lib/testlibrary
- * @build InitErrors jdk.testlibrary.*
+ * @library /test/lib
+ * @build InitErrors
* @run testng InitErrors
* @summary Basic test to ensure that module system initialization errors
* go the right stream and with the right level of verbosity
@@ -32,8 +32,8 @@
import java.util.Arrays;
-import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
--- a/test/jdk/tools/launcher/modules/classpath/JavaClassPathTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/classpath/JavaClassPathTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -29,24 +29,27 @@
import java.util.List;
import java.util.Map;
import java.util.spi.ToolProvider;
+import java.util.stream.Stream;
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.Platform;
import jdk.test.lib.compiler.CompilerUtils;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.testng.Assert.assertTrue;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
/**
* @test
* @bug 8168205
* @summary Test the default class path if -Djava.class.path is set
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
* jdk.jartool
- * @build jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @build jdk.test.lib.compiler.CompilerUtils
* @run testng JavaClassPathTest
*/
@@ -197,28 +200,27 @@
}
private OutputAnalyzer execute(List<String> options) throws Throwable {
- ProcessBuilder pb = createJavaProcessBuilder(
- options.stream()
- .map(this::autoQuote)
- .toArray(String[]::new)
+ // can't use ProcessTools.createJavaProcessBuilder as it always adds -cp
+ ProcessBuilder pb = new ProcessBuilder(
+ Stream.concat(Stream.of(JDKToolFinder.getTestJDKTool("java")),
+ options.stream()
+ .map(this::autoQuote))
+ .toArray(String[]::new)
);
Map<String,String> env = pb.environment();
// remove CLASSPATH environment variable
- String value = env.remove("CLASSPATH");
+ env.remove("CLASSPATH");
return executeCommand(pb)
.outputTo(System.out)
.errorTo(System.out);
}
- private static final boolean IS_WINDOWS
- = System.getProperty("os.name").startsWith("Windows");
-
/*
* Autoquote empty string argument on Windows
*/
private String autoQuote(String arg) {
- if (IS_WINDOWS && arg.isEmpty()) {
+ if (Platform.isWindows() && arg.isEmpty()) {
return "\"\"";
}
return arg;
--- a/test/jdk/tools/launcher/modules/describe/DescribeModuleTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/describe/DescribeModuleTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -24,13 +24,13 @@
/**
* @test
* @modules java.xml
- * @library /lib/testlibrary
- * @build DescribeModuleTest jdk.testlibrary.*
+ * @library /test/lib
+ * @build DescribeModuleTest
* @run testng DescribeModuleTest
* @summary Basic test for java --describe-module
*/
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
--- a/test/jdk/tools/launcher/modules/dryrun/DryRunTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/dryrun/DryRunTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -24,10 +24,10 @@
/**
* @test
* @bug 8159596
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules jdk.compiler
* jdk.jartool
- * @build DryRunTest jdk.testlibrary.ProcessTools
+ * @build DryRunTest jdk.test.lib.process.ProcessTools
* jdk.test.lib.compiler.CompilerUtils
* @run testng DryRunTest
* @summary Test java --dry-run
@@ -41,7 +41,7 @@
import java.util.spi.ToolProvider;
import jdk.test.lib.compiler.CompilerUtils;
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
--- a/test/jdk/tools/launcher/modules/illegalaccess/IllegalAccessTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/illegalaccess/IllegalAccessTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -29,7 +29,6 @@
* @library /test/lib /lib/testlibrary modules
* @build IllegalAccessTest TryAccess JarUtils
* jdk.test.lib.compiler.CompilerUtils
- * jdk.testlibrary.*
* @build m/*
* @run testng/othervm/timeout=180 IllegalAccessTest
* @summary Basic test for java --illegal-access=$VALUE
@@ -45,8 +44,8 @@
import java.util.stream.Stream;
import jdk.test.lib.compiler.CompilerUtils;
-import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
--- a/test/jdk/tools/launcher/modules/limitmods/LimitModsTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/limitmods/LimitModsTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -24,9 +24,9 @@
/**
* @test
* @requires !vm.graal.enabled
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules java.desktop java.logging jdk.compiler
- * @build LimitModsTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @build LimitModsTest jdk.test.lib.compiler.CompilerUtils
* @run testng LimitModsTest
* @summary Basic tests for java --limit-modules
*/
@@ -35,7 +35,7 @@
import java.nio.file.Paths;
import jdk.test.lib.compiler.CompilerUtils;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
--- a/test/jdk/tools/launcher/modules/listmods/ListModsTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/listmods/ListModsTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -24,9 +24,9 @@
/**
* @test
* @requires !vm.graal.enabled
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
* @modules java.se
- * @build ListModsTest jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @build ListModsTest jdk.test.lib.compiler.CompilerUtils
* @run testng ListModsTest
* @summary Basic test for java --list-modules
*/
@@ -35,8 +35,8 @@
import java.nio.file.Paths;
import jdk.test.lib.compiler.CompilerUtils;
-import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
--- a/test/jdk/tools/launcher/modules/patch/basic/PatchTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/patch/basic/PatchTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -26,7 +26,7 @@
* @library /lib/testlibrary /test/lib
* @modules jdk.compiler
* jdk.naming.dns
- * @build PatchTest JarUtils jdk.testlibrary.*
+ * @build PatchTest JarUtils
* jdk.test.lib.compiler.CompilerUtils
* @run testng PatchTest
* @summary Basic test for --patch-module
@@ -40,7 +40,7 @@
import java.util.stream.Stream;
import jdk.test.lib.compiler.CompilerUtils;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
--- a/test/jdk/tools/launcher/modules/patch/basic/PatchTestWarningError.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/patch/basic/PatchTestWarningError.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -27,7 +27,7 @@
* @summary Basic argument validation for --patch-module
* @library /lib/testlibrary /test/lib
* @modules jdk.compiler
- * @build PatchTestWarningError JarUtils jdk.testlibrary.*
+ * @build PatchTestWarningError JarUtils
* jdk.test.lib.compiler.CompilerUtils
* @run testng PatchTestWarningError
*/
@@ -40,7 +40,7 @@
import java.util.stream.Stream;
import jdk.test.lib.compiler.CompilerUtils;
-import static jdk.testlibrary.ProcessTools.*;
+import static jdk.test.lib.process.ProcessTools.*;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
--- a/test/jdk/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -47,7 +47,7 @@
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-import static jdk.testlibrary.ProcessTools.executeCommand;
+import static jdk.test.lib.process.ProcessTools.executeCommand;
import static org.testng.Assert.*;
public class PatchSystemModules {
--- a/test/jdk/tools/launcher/modules/showmoduleresolution/ShowModuleResolutionTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/showmoduleresolution/ShowModuleResolutionTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -25,13 +25,13 @@
* @test
* @requires !vm.graal.enabled
* @modules jdk.jdeps jdk.zipfs
- * @library /lib/testlibrary
- * @build ShowModuleResolutionTest jdk.testlibrary.*
+ * @library /test/lib
+ * @build ShowModuleResolutionTest
* @run testng ShowModuleResolutionTest
* @summary Basic test for java --show-module-resolution
*/
-import jdk.testlibrary.ProcessTools;
+import jdk.test.lib.process.ProcessTools;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
--- a/test/jdk/tools/launcher/modules/validate/ValidateModulesTest.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/jdk/tools/launcher/modules/validate/ValidateModulesTest.java Fri Sep 07 14:01:52 2018 -0700
@@ -25,8 +25,8 @@
* @test
* @bug 8178380 8194937
* @modules java.xml
- * @library src /lib/testlibrary
- * @build ValidateModulesTest hello/* JarUtils jdk.testlibrary.*
+ * @library src /lib/testlibrary /test/lib
+ * @build ValidateModulesTest hello/* JarUtils
* @run testng ValidateModulesTest
* @summary Basic test for java --validate-modules
*/
@@ -36,8 +36,8 @@
import java.nio.file.Files;
import java.nio.file.Path;
-import jdk.testlibrary.ProcessTools;
-import jdk.testlibrary.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
--- a/test/lib/jdk/test/lib/apps/LingeredApp.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/lib/jdk/test/lib/apps/LingeredApp.java Fri Sep 07 14:01:52 2018 -0700
@@ -146,7 +146,7 @@
throw new RuntimeException("Process is still alive. Can't get its output.");
}
if (output == null) {
- output = new OutputBuffer(stdoutBuffer.toString(), stderrBuffer.toString());
+ output = OutputBuffer.of(stdoutBuffer.toString(), stderrBuffer.toString());
}
return output;
}
--- a/test/lib/jdk/test/lib/dcmd/CommandExecutor.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/lib/jdk/test/lib/dcmd/CommandExecutor.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -34,7 +34,7 @@
* Execute a diagnostic command
*
* @param cmd The diagnostic command to execute
- * @return an {@link jdk.testlibrary.OutputAnalyzer} encapsulating the output of the command
+ * @return an {@link jdk.test.lib.process.OutputAnalyzer} encapsulating the output of the command
* @throws CommandExecutorException if there is an exception on the "calling side" while trying to execute the
* Diagnostic Command. Exceptions thrown on the remote side are available as textual representations in
* stderr, regardless of the specific executor used.
@@ -48,7 +48,7 @@
*
* @param cmd The diagnostic command to execute
* @param silent Do not print the command output
- * @return an {@link jdk.testlibrary.OutputAnalyzer} encapsulating the output of the command
+ * @return an {@link jdk.test.lib.process.OutputAnalyzer} encapsulating the output of the command
* @throws CommandExecutorException if there is an exception on the "calling side" while trying to execute the
* Diagnostic Command. Exceptions thrown on the remote side are available as textual representations in
* stderr, regardless of the specific executor used.
--- a/test/lib/jdk/test/lib/process/OutputAnalyzer.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/lib/jdk/test/lib/process/OutputAnalyzer.java Fri Sep 07 14:01:52 2018 -0700
@@ -23,6 +23,8 @@
package jdk.test.lib.process;
+import jdk.test.lib.Asserts;
+
import java.io.IOException;
import java.io.PrintStream;
import java.util.Arrays;
@@ -33,10 +35,7 @@
public final class OutputAnalyzer {
- private final String stdout;
- private final String stderr;
- private final int exitValue;
-
+ private final OutputBuffer buffer;
/**
* Create an OutputAnalyzer, a utility class for verifying output and exit
* value from a Process
@@ -45,10 +44,7 @@
* @throws IOException If an I/O error occurs.
*/
public OutputAnalyzer(Process process) throws IOException {
- OutputBuffer output = ProcessTools.getOutput(process);
- exitValue = process.exitValue();
- this.stdout = output.getStdout();
- this.stderr = output.getStderr();
+ buffer = OutputBuffer.of(process);
}
/**
@@ -57,7 +53,7 @@
* @param buf String buffer to analyze
*/
public OutputAnalyzer(String buf) {
- this(buf, buf);
+ buffer = OutputBuffer.of(buf, buf);
}
/**
@@ -67,9 +63,7 @@
* @param stderr stderr buffer to analyze
*/
public OutputAnalyzer(String stdout, String stderr) {
- this.stdout = stdout;
- this.stderr = stderr;
- exitValue = -1;
+ buffer = OutputBuffer.of(stdout, stderr);
}
/**
@@ -78,11 +72,12 @@
* @throws RuntimeException
* If stdout was not empty
*/
- public void stdoutShouldBeEmpty() {
+ public OutputAnalyzer stdoutShouldBeEmpty() {
if (!getStdout().isEmpty()) {
reportDiagnosticSummary();
throw new RuntimeException("stdout was not empty");
}
+ return this;
}
/**
@@ -91,11 +86,12 @@
* @throws RuntimeException
* If stderr was not empty
*/
- public void stderrShouldBeEmpty() {
+ public OutputAnalyzer stderrShouldBeEmpty() {
if (!getStderr().isEmpty()) {
reportDiagnosticSummary();
throw new RuntimeException("stderr was not empty");
}
+ return this;
}
/**
@@ -105,11 +101,12 @@
* @throws RuntimeException
* If stderr was not empty
*/
- public void stderrShouldBeEmptyIgnoreVMWarnings() {
+ public OutputAnalyzer stderrShouldBeEmptyIgnoreVMWarnings() {
if (!getStderr().replaceAll(jvmwarningmsg + "\\R", "").isEmpty()) {
reportDiagnosticSummary();
throw new RuntimeException("stderr was not empty");
}
+ return this;
}
/**
@@ -118,11 +115,12 @@
* @throws RuntimeException
* If stdout was empty
*/
- public void stdoutShouldNotBeEmpty() {
+ public OutputAnalyzer stdoutShouldNotBeEmpty() {
if (getStdout().isEmpty()) {
reportDiagnosticSummary();
throw new RuntimeException("stdout was empty");
}
+ return this;
}
/**
@@ -131,11 +129,12 @@
* @throws RuntimeException
* If stderr was empty
*/
- public void stderrShouldNotBeEmpty() {
+ public OutputAnalyzer stderrShouldNotBeEmpty() {
if (getStderr().isEmpty()) {
reportDiagnosticSummary();
throw new RuntimeException("stderr was empty");
}
+ return this;
}
/**
@@ -145,6 +144,8 @@
* @throws RuntimeException If the string was not found
*/
public OutputAnalyzer shouldContain(String expectedString) {
+ String stdout = getStdout();
+ String stderr = getStderr();
if (!stdout.contains(expectedString) && !stderr.contains(expectedString)) {
reportDiagnosticSummary();
throw new RuntimeException("'" + expectedString + "' missing from stdout/stderr \n");
@@ -159,6 +160,7 @@
* @throws RuntimeException If the string was not found
*/
public OutputAnalyzer stdoutShouldContain(String expectedString) {
+ String stdout = getStdout();
if (!stdout.contains(expectedString)) {
reportDiagnosticSummary();
throw new RuntimeException("'" + expectedString + "' missing from stdout \n");
@@ -173,6 +175,7 @@
* @throws RuntimeException If the string was not found
*/
public OutputAnalyzer stderrShouldContain(String expectedString) {
+ String stderr = getStderr();
if (!stderr.contains(expectedString)) {
reportDiagnosticSummary();
throw new RuntimeException("'" + expectedString + "' missing from stderr \n");
@@ -183,10 +186,12 @@
/**
* Verify that the stdout and stderr contents of output buffer does not contain the string
*
- * @param expectedString String that the buffer should not contain
+ * @param notExpectedString String that the buffer should not contain
* @throws RuntimeException If the string was found
*/
public OutputAnalyzer shouldNotContain(String notExpectedString) {
+ String stdout = getStdout();
+ String stderr = getStderr();
if (stdout.contains(notExpectedString)) {
reportDiagnosticSummary();
throw new RuntimeException("'" + notExpectedString + "' found in stdout \n");
@@ -204,6 +209,8 @@
* @throws RuntimeException If the stdout and stderr are not empty
*/
public OutputAnalyzer shouldBeEmpty() {
+ String stdout = getStdout();
+ String stderr = getStderr();
if (!stdout.isEmpty()) {
reportDiagnosticSummary();
throw new RuntimeException("stdout was not empty");
@@ -218,10 +225,11 @@
/**
* Verify that the stdout contents of output buffer does not contain the string
*
- * @param expectedString String that the buffer should not contain
+ * @param notExpectedString String that the buffer should not contain
* @throws RuntimeException If the string was found
*/
public OutputAnalyzer stdoutShouldNotContain(String notExpectedString) {
+ String stdout = getStdout();
if (stdout.contains(notExpectedString)) {
reportDiagnosticSummary();
throw new RuntimeException("'" + notExpectedString + "' found in stdout \n");
@@ -232,10 +240,11 @@
/**
* Verify that the stderr contents of output buffer does not contain the string
*
- * @param expectedString String that the buffer should not contain
+ * @param notExpectedString String that the buffer should not contain
* @throws RuntimeException If the string was found
*/
public OutputAnalyzer stderrShouldNotContain(String notExpectedString) {
+ String stderr = getStderr();
if (stderr.contains(notExpectedString)) {
reportDiagnosticSummary();
throw new RuntimeException("'" + notExpectedString + "' found in stderr \n");
@@ -247,15 +256,18 @@
* Verify that the stdout and stderr contents of output buffer matches
* the pattern
*
- * @param pattern
+ * @param regexp
* @throws RuntimeException If the pattern was not found
*/
- public OutputAnalyzer shouldMatch(String pattern) {
- Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout);
- Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
+ public OutputAnalyzer shouldMatch(String regexp) {
+ String stdout = getStdout();
+ String stderr = getStderr();
+ Pattern pattern = Pattern.compile(regexp, Pattern.MULTILINE);
+ Matcher stdoutMatcher = pattern.matcher(stdout);
+ Matcher stderrMatcher = pattern.matcher(stderr);
if (!stdoutMatcher.find() && !stderrMatcher.find()) {
reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern
+ throw new RuntimeException("'" + regexp
+ "' missing from stdout/stderr \n");
}
return this;
@@ -265,14 +277,15 @@
* Verify that the stdout contents of output buffer matches the
* pattern
*
- * @param pattern
+ * @param regexp
* @throws RuntimeException If the pattern was not found
*/
- public OutputAnalyzer stdoutShouldMatch(String pattern) {
- Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout);
+ public OutputAnalyzer stdoutShouldMatch(String regexp) {
+ String stdout = getStdout();
+ Matcher matcher = Pattern.compile(regexp, Pattern.MULTILINE).matcher(stdout);
if (!matcher.find()) {
reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern
+ throw new RuntimeException("'" + regexp
+ "' missing from stdout \n");
}
return this;
@@ -286,7 +299,7 @@
* @throws RuntimeException If the pattern was not found
*/
public OutputAnalyzer stderrShouldMatch(String pattern) {
-
+ String stderr = getStderr();
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
if (!matcher.find()) {
reportDiagnosticSummary();
@@ -300,22 +313,27 @@
* Verify that the stdout and stderr contents of output buffer does not
* match the pattern
*
- * @param pattern
+ * @param regexp
* @throws RuntimeException If the pattern was found
*/
- public OutputAnalyzer shouldNotMatch(String pattern) {
- Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout);
+ public OutputAnalyzer shouldNotMatch(String regexp) {
+ String stdout = getStdout();
+ Pattern pattern = Pattern.compile(regexp, Pattern.MULTILINE);
+ Matcher matcher = pattern.matcher(stdout);
if (matcher.find()) {
reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern
+ throw new RuntimeException("'" + regexp
+ "' found in stdout: '" + matcher.group() + "' \n");
}
- matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
+
+ String stderr = getStderr();
+ matcher = pattern.matcher(stderr);
if (matcher.find()) {
reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern
+ throw new RuntimeException("'" + regexp
+ "' found in stderr: '" + matcher.group() + "' \n");
}
+
return this;
}
@@ -323,14 +341,15 @@
* Verify that the stdout contents of output buffer does not match the
* pattern
*
- * @param pattern
+ * @param regexp
* @throws RuntimeException If the pattern was found
*/
- public OutputAnalyzer stdoutShouldNotMatch(String pattern) {
- Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout);
+ public OutputAnalyzer stdoutShouldNotMatch(String regexp) {
+ String stdout = getStdout();
+ Matcher matcher = Pattern.compile(regexp, Pattern.MULTILINE).matcher(stdout);
if (matcher.find()) {
reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern
+ throw new RuntimeException("'" + regexp
+ "' found in stdout \n");
}
return this;
@@ -340,14 +359,15 @@
* Verify that the stderr contents of output buffer does not match the
* pattern
*
- * @param pattern
+ * @param regexp
* @throws RuntimeException If the pattern was found
*/
- public OutputAnalyzer stderrShouldNotMatch(String pattern) {
- Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
+ public OutputAnalyzer stderrShouldNotMatch(String regexp) {
+ String stderr = getStderr();
+ Matcher matcher = Pattern.compile(regexp, Pattern.MULTILINE).matcher(stderr);
if (matcher.find()) {
reportDiagnosticSummary();
- throw new RuntimeException("'" + pattern
+ throw new RuntimeException("'" + regexp
+ "' found in stderr \n");
}
return this;
@@ -357,16 +377,19 @@
* Get the captured group of the first string matching the pattern.
* stderr is searched before stdout.
*
- * @param pattern The multi-line pattern to match
+ * @param regexp The multi-line pattern to match
* @param group The group to capture
* @return The matched string or null if no match was found
*/
- public String firstMatch(String pattern, int group) {
- Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
- Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stdout);
+ public String firstMatch(String regexp, int group) {
+ Pattern pattern = Pattern.compile(regexp, Pattern.MULTILINE);
+ String stderr = getStderr();
+ Matcher stderrMatcher = pattern.matcher(stderr);
if (stderrMatcher.find()) {
return stderrMatcher.group(group);
}
+ String stdout = getStdout();
+ Matcher stdoutMatcher = pattern.matcher(stdout);
if (stdoutMatcher.find()) {
return stdoutMatcher.group(group);
}
@@ -425,8 +448,8 @@
*/
public void reportDiagnosticSummary() {
String msg =
- " stdout: [" + stdout + "];\n" +
- " stderr: [" + stderr + "]\n" +
+ " stdout: [" + getStdout() + "];\n" +
+ " stderr: [" + getStderr() + "]\n" +
" exitValue = " + getExitValue() + "\n";
System.err.println(msg);
@@ -458,7 +481,7 @@
* @return Content of the output buffer
*/
public String getOutput() {
- return stdout + stderr;
+ return getStdout() + getStderr();
}
/**
@@ -467,7 +490,7 @@
* @return Content of the stdout buffer
*/
public String getStdout() {
- return stdout;
+ return buffer.getStdout();
}
/**
@@ -476,7 +499,7 @@
* @return Content of the stderr buffer
*/
public String getStderr() {
- return stderr;
+ return buffer.getStderr();
}
/**
@@ -485,7 +508,7 @@
* @return Process exit value
*/
public int getExitValue() {
- return exitValue;
+ return buffer.getExitValue();
}
/**
@@ -499,7 +522,7 @@
}
private List<String> asLines(String buffer) {
- return Arrays.asList(buffer.split("(\\r\\n|\\n|\\r)"));
+ return Arrays.asList(buffer.split("\\R"));
}
@@ -512,6 +535,8 @@
* @throws RuntimeException If the stdout and stderr are not empty
*/
public OutputAnalyzer shouldBeEmptyIgnoreVMWarnings() {
+ String stdout = getStdout();
+ String stderr = getStderr();
if (!stdout.isEmpty()) {
reportDiagnosticSummary();
throw new RuntimeException("stdout was not empty");
@@ -531,7 +556,7 @@
* @throws RuntimeException If the pattern was not found
*/
public OutputAnalyzer stderrShouldMatchIgnoreVMWarnings(String pattern) {
- String stderr = this.stderr.replaceAll(jvmwarningmsg + "\\R", "");
+ String stderr = getStderr().replaceAll(jvmwarningmsg + "\\R", "");
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
if (!matcher.find()) {
reportDiagnosticSummary();
@@ -548,10 +573,118 @@
* @return Contents of the output buffer as list of strings
*/
public List<String> asLinesWithoutVMWarnings() {
- return Arrays.asList(getOutput().split("\\R"))
- .stream()
- .filter(Pattern.compile(jvmwarningmsg).asPredicate().negate())
- .collect(Collectors.toList());
+ return Arrays.stream(getOutput().split("\\R"))
+ .filter(Pattern.compile(jvmwarningmsg).asPredicate().negate())
+ .collect(Collectors.toList());
+ }
+
+ /**
+ * @see #shouldMatchByLine(String, String, String)
+ */
+ public OutputAnalyzer shouldMatchByLine(String pattern) {
+ return shouldMatchByLine(null, null, pattern);
+ }
+
+ /**
+ * @see #stdoutShouldMatchByLine(String, String, String)
+ */
+ public OutputAnalyzer stdoutShouldMatchByLine(String pattern) {
+ return stdoutShouldMatchByLine(null, null, pattern);
+ }
+
+ /**
+ * @see #shouldMatchByLine(String, String, String)
+ */
+ public OutputAnalyzer shouldMatchByLineFrom(String from, String pattern) {
+ return shouldMatchByLine(from, null, pattern);
+ }
+
+ /**
+ * @see #shouldMatchByLine(String, String, String)
+ */
+ public OutputAnalyzer shouldMatchByLineTo(String to, String pattern) {
+ return shouldMatchByLine(null, to, pattern);
+ }
+
+ /**
+ * Verify that the stdout and stderr contents of output buffer match the
+ * {@code pattern} line by line. The whole output could be matched or
+ * just a subset of it.
+ *
+ * @param from
+ * The line from where output will be matched.
+ * Set {@code from} to null for matching from the first line.
+ * @param to
+ * The line until where output will be matched.
+ * Set {@code to} to null for matching until the last line.
+ * @param pattern
+ * Matching pattern
+ */
+ public OutputAnalyzer shouldMatchByLine(String from, String to, String pattern) {
+ return shouldMatchByLine(getOutput(), from, to, pattern);
+ }
+
+ /**
+ * Verify that the stdout contents of output buffer matches the
+ * {@code pattern} line by line. The whole stdout could be matched or
+ * just a subset of it.
+ *
+ * @param from
+ * The line from where stdout will be matched.
+ * Set {@code from} to null for matching from the first line.
+ * @param to
+ * The line until where stdout will be matched.
+ * Set {@code to} to null for matching until the last line.
+ * @param pattern
+ * Matching pattern
+ */
+ public OutputAnalyzer stdoutShouldMatchByLine(String from, String to, String pattern) {
+ return shouldMatchByLine(getStdout(), from, to, pattern);
+ }
+
+ private OutputAnalyzer shouldMatchByLine(String buffer, String from, String to, String pattern) {
+ List<String> lines = asLines(buffer);
+
+ int fromIndex = 0;
+ if (from != null) {
+ fromIndex = indexOf(lines, from);
+ Asserts.assertGreaterThan(fromIndex, -1,
+ "The line/pattern '" + from + "' from where the output should match can not be found");
+ }
+
+ int toIndex = lines.size();
+ if (to != null) {
+ toIndex = indexOf(lines, to);
+ Asserts.assertGreaterThan(toIndex, -1,
+ "The line/pattern '" + to + "' until where the output should match can not be found");
+ }
+
+ List<String> subList = lines.subList(fromIndex, toIndex);
+ Asserts.assertFalse(subList.isEmpty(), "There are no lines to check");
+
+ subList.stream()
+ .filter(Pattern.compile(pattern).asPredicate().negate())
+ .findAny()
+ .ifPresent(line -> Asserts.assertTrue(false,
+ "The line '" + line + "' does not match pattern '" + pattern + "'"));
+
+ return this;
+ }
+
+ /**
+ * Check if there is a line matching {@code regexp} and return its index
+ *
+ * @param regexp Matching pattern
+ * @return Index of first matching line
+ */
+ private int indexOf(List<String> lines, String regexp) {
+ Pattern pattern = Pattern.compile(regexp);
+ for (int i = 0; i < lines.size(); i++) {
+ if (pattern.matcher(lines.get(i)).matches()) {
+ return i;
+ }
+ }
+ return -1;
}
}
--- a/test/lib/jdk/test/lib/process/OutputBuffer.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/lib/jdk/test/lib/process/OutputBuffer.java Fri Sep 07 14:01:52 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -23,20 +23,19 @@
package jdk.test.lib.process;
-public class OutputBuffer {
- private final String stdout;
- private final String stderr;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
- /**
- * Create an OutputBuffer, a class for storing and managing stdout and stderr
- * results separately
- *
- * @param stdout stdout result
- * @param stderr stderr result
- */
- public OutputBuffer(String stdout, String stderr) {
- this.stdout = stdout;
- this.stderr = stderr;
+public interface OutputBuffer {
+ public static class OutputBufferException extends RuntimeException {
+ private static final long serialVersionUID = 8528687792643129571L;
+
+ public OutputBufferException(Throwable cause) {
+ super(cause);
+ }
}
/**
@@ -44,16 +43,105 @@
*
* @return stdout result
*/
- public String getStdout() {
- return stdout;
- }
-
+ public String getStdout();
/**
* Returns the stderr result
*
* @return stderr result
*/
- public String getStderr() {
- return stderr;
+ public String getStderr();
+ public int getExitValue();
+
+ public static OutputBuffer of(Process p) {
+ return new LazyOutputBuffer(p);
+ }
+
+ public static OutputBuffer of(String stdout, String stderr, int exitValue) {
+ return new EagerOutputBuffer(stdout, stderr, exitValue);
+ }
+
+ public static OutputBuffer of(String stdout, String stderr) {
+ return of(stdout, stderr, -1);
+ }
+
+ class LazyOutputBuffer implements OutputBuffer {
+ private static class StreamTask {
+ private final ByteArrayOutputStream buffer;
+ private final Future<Void> future;
+
+ private StreamTask(InputStream stream) {
+ this.buffer = new ByteArrayOutputStream();
+ this.future = new StreamPumper(stream, buffer).process();
+ }
+
+ public String get() {
+ try {
+ future.get();
+ return buffer.toString();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new OutputBufferException(e);
+ } catch (ExecutionException | CancellationException e) {
+ throw new OutputBufferException(e);
+ }
+ }
+ }
+
+ private final StreamTask outTask;
+ private final StreamTask errTask;
+ private final Process p;
+
+ private LazyOutputBuffer(Process p) {
+ this.p = p;
+ outTask = new StreamTask(p.getInputStream());
+ errTask = new StreamTask(p.getErrorStream());
+ }
+
+ @Override
+ public String getStdout() {
+ return outTask.get();
+ }
+
+ @Override
+ public String getStderr() {
+ return errTask.get();
+ }
+
+ @Override
+ public int getExitValue() {
+ try {
+ return p.waitFor();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new OutputBufferException(e);
+ }
+ }
+ }
+
+ class EagerOutputBuffer implements OutputBuffer {
+ private final String stdout;
+ private final String stderr;
+ private final int exitValue;
+
+ private EagerOutputBuffer(String stdout, String stderr, int exitValue) {
+ this.stdout = stdout;
+ this.stderr = stderr;
+ this.exitValue = exitValue;
+ }
+
+ @Override
+ public String getStdout() {
+ return stdout;
+ }
+
+ @Override
+ public String getStderr() {
+ return stderr;
+ }
+
+ @Override
+ public int getExitValue() {
+ return exitValue;
+ }
}
}
--- a/test/lib/jdk/test/lib/process/ProcessTools.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/lib/jdk/test/lib/process/ProcessTools.java Fri Sep 07 14:01:52 2018 -0700
@@ -23,7 +23,6 @@
package jdk.test.lib.process;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -65,50 +64,6 @@
}
/**
- * Pumps stdout and stderr from running the process into a String.
- *
- * @param processBuilder ProcessBuilder to run.
- * @return Output from process.
- * @throws IOException If an I/O error occurs.
- */
- public static OutputBuffer getOutput(ProcessBuilder processBuilder) throws IOException {
- return getOutput(privilegedStart(processBuilder));
- }
-
- /**
- * Pumps stdout and stderr the running process into a String.
- *
- * @param process Process to pump.
- * @return Output from process.
- * @throws IOException If an I/O error occurs.
- */
- public static OutputBuffer getOutput(Process process) throws IOException {
- ByteArrayOutputStream stderrBuffer = new ByteArrayOutputStream();
- ByteArrayOutputStream stdoutBuffer = new ByteArrayOutputStream();
- StreamPumper outPumper = new StreamPumper(process.getInputStream(), stdoutBuffer);
- StreamPumper errPumper = new StreamPumper(process.getErrorStream(), stderrBuffer);
- Thread outPumperThread = new Thread(outPumper);
- Thread errPumperThread = new Thread(errPumper);
-
- outPumperThread.setDaemon(true);
- errPumperThread.setDaemon(true);
-
- outPumperThread.start();
- errPumperThread.start();
-
- try {
- process.waitFor();
- outPumperThread.join();
- errPumperThread.join();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- return null;
- }
-
- return new OutputBuffer(stdoutBuffer.toString(), stderrBuffer.toString());
- }
-
- /**
* <p>Starts a process from its builder.</p>
* <span>The default redirects of STDOUT and STDERR are started</span>
* @param name The process name
@@ -392,11 +347,29 @@
* @return The {@linkplain OutputAnalyzer} instance wrapping the process.
*/
public static OutputAnalyzer executeProcess(ProcessBuilder pb) throws Exception {
+ return executeProcess(pb, null);
+ }
+
+ /**
+ * Executes a process, pipe some text into its STDIN, waits for it
+ * to finish and returns the process output. The process will have exited
+ * before this method returns.
+ * @param pb The ProcessBuilder to execute.
+ * @param input The text to pipe into STDIN. Can be null.
+ * @return The {@linkplain OutputAnalyzer} instance wrapping the process.
+ */
+ public static OutputAnalyzer executeProcess(ProcessBuilder pb, String input) throws Exception {
OutputAnalyzer output = null;
Process p = null;
boolean failed = false;
try {
p = privilegedStart(pb);
+ if (input != null) {
+ try (PrintStream ps = new PrintStream(p.getOutputStream())) {
+ ps.print(input);
+ }
+ }
+
output = new OutputAnalyzer(p);
p.waitFor();
--- a/test/lib/jdk/test/lib/process/StreamPumper.java Fri Sep 07 15:18:14 2018 -0400
+++ b/test/lib/jdk/test/lib/process/StreamPumper.java Fri Sep 07 14:01:52 2018 -0700
@@ -41,14 +41,14 @@
/**
* Pump will be called by the StreamPumper to process the incoming data
*/
- abstract public static class Pump {
+ public abstract static class Pump {
abstract void register(StreamPumper d);
}
/**
* OutputStream -> Pump adapter
*/
- final public static class StreamPump extends Pump {
+ public final static class StreamPump extends Pump {
private final OutputStream out;
public StreamPump(OutputStream out) {
this.out = out;
@@ -63,13 +63,13 @@
/**
* Used to process the incoming data line-by-line
*/
- abstract public static class LinePump extends Pump {
+ public abstract static class LinePump extends Pump {
@Override
final void register(StreamPumper sp) {
sp.addLineProcessor(this);
}
- abstract protected void processLine(String line);
+ protected abstract void processLine(String line);
}
private final InputStream in;
@@ -77,7 +77,6 @@
private final Set<LinePump> linePumps = new HashSet<>();
private final AtomicBoolean processing = new AtomicBoolean(false);
- private final FutureTask<Void> processingTask = new FutureTask<>(this, null);
public StreamPumper(InputStream in) {
this.in = in;
@@ -108,7 +107,7 @@
int linelen = 0;
while ((len = is.read(buf)) > 0 && !Thread.interrupted()) {
- for(OutputStream out : outStreams) {
+ for (OutputStream out : outStreams) {
out.write(buf, 0, len);
}
if (!linePumps.isEmpty()) {
@@ -125,9 +124,7 @@
if (linelen > 0) {
lineBos.flush();
final String line = lineBos.toString();
- linePumps.stream().forEach((lp) -> {
- lp.processLine(line);
- });
+ linePumps.forEach((lp) -> lp.processLine(line));
lineBos.reset();
linelen = 0;
}
@@ -149,7 +146,7 @@
} catch (IOException e) {
e.printStackTrace();
} finally {
- for(OutputStream out : outStreams) {
+ for (OutputStream out : outStreams) {
try {
out.flush();
} catch (IOException e) {}
@@ -168,30 +165,26 @@
linePumps.add(lp);
}
- final public StreamPumper addPump(Pump ... pump) {
+ public final StreamPumper addPump(Pump ... pump) {
if (processing.get()) {
throw new IllegalStateException("Can not modify pumper while " +
"processing is in progress");
}
- for(Pump p : pump) {
+ for (Pump p : pump) {
p.register(this);
}
return this;
}
- final public Future<Void> process() {
+ public final Future<Void> process() {
if (!processing.compareAndSet(false, true)) {
throw new IllegalStateException("Can not re-run the processing");
}
- Thread t = new Thread(new Runnable() {
- @Override
- public void run() {
- processingTask.run();
- }
- });
+ FutureTask<Void> result = new FutureTask<>(this, null);
+ Thread t = new Thread(result);
t.setDaemon(true);
t.start();
- return processingTask;
+ return result;
}
}