1 /*
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 8167237
27 * @summary test that both old style command line options and new gnu style
28 * command line options work with the --release option whether or
29 * not the --release option is preceded by a file name.
30 * @library /lib/testlibrary
31 * @modules jdk.jartool/sun.tools.jar
32 * @build jdk.testlibrary.FileUtils
33 * @run testng ReleaseBeforeFiles
34 */
35
36 import org.testng.Assert;
37 import org.testng.annotations.AfterMethod;
38 import org.testng.annotations.BeforeMethod;
39 import org.testng.annotations.Test;
40
41 import java.io.IOException;
42 import java.io.UncheckedIOException;
43 import java.nio.file.Files;
44 import java.nio.file.Path;
45 import java.nio.file.Paths;
46 import java.util.Arrays;
47 import java.util.stream.Stream;
48
49 import jdk.testlibrary.FileUtils;
50
51 public class ReleaseBeforeFiles {
52 private Runnable onCompletion;
53
54 @BeforeMethod
55 public void reset() {
56 onCompletion = null;
57 }
58
59 @AfterMethod
60 public void run() {
61 if (onCompletion != null) {
62 onCompletion.run();
63 }
64 }
65
66 @Test // passes before bug fix
67 public void test1() throws IOException {
68 mkdir("test1");
69 touch("test1/testfile1");
|
1 /*
2 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 8167237
27 * @summary test that both old style command line options and new gnu style
28 * command line options work with the --release option whether or
29 * not the --release option is preceded by a file name.
30 * @library /test/lib
31 * @modules jdk.jartool/sun.tools.jar
32 * @run testng ReleaseBeforeFiles
33 */
34
35 import org.testng.Assert;
36 import org.testng.annotations.AfterMethod;
37 import org.testng.annotations.BeforeMethod;
38 import org.testng.annotations.Test;
39
40 import java.io.IOException;
41 import java.io.UncheckedIOException;
42 import java.nio.file.Files;
43 import java.nio.file.Path;
44 import java.nio.file.Paths;
45 import java.util.Arrays;
46 import java.util.stream.Stream;
47
48 import jdk.test.lib.util.FileUtils;
49
50 public class ReleaseBeforeFiles {
51 private Runnable onCompletion;
52
53 @BeforeMethod
54 public void reset() {
55 onCompletion = null;
56 }
57
58 @AfterMethod
59 public void run() {
60 if (onCompletion != null) {
61 onCompletion.run();
62 }
63 }
64
65 @Test // passes before bug fix
66 public void test1() throws IOException {
67 mkdir("test1");
68 touch("test1/testfile1");
|