Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/javax/crypto/SecretKeyFactory/TestFailOver.java
41149 views
1
/*
2
* Copyright (c) 2006, 2021, 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
import java.io.File;
25
import java.nio.file.Path;
26
import java.nio.file.Paths;
27
import java.util.ArrayList;
28
import java.util.List;
29
import jdk.test.lib.compiler.CompilerUtils;
30
import jdk.test.lib.process.OutputAnalyzer;
31
import jdk.test.lib.process.ProcessTools;
32
33
/*
34
* @test
35
* @bug 6370923 8180568
36
* @summary SecretKeyFactory failover does not work
37
* @library /test/lib
38
* @build jdk.test.lib.compiler.CompilerUtils
39
* @run main TestFailOver
40
*/
41
public class TestFailOver {
42
43
private static final Path SRC = Paths.get(System.getProperty("test.src"));
44
private static final String P1_JAR
45
= SRC.resolve("P1.jar").toFile().getAbsolutePath();
46
private static final String P2_JAR
47
= SRC.resolve("P2.jar").toFile().getAbsolutePath();
48
private static final String SEC_PROP
49
= SRC.resolve("security.properties").toFile().getAbsolutePath();
50
private static final String JF_NAME = "FailOverTest";
51
private static final Path SRC_PATH = SRC.resolve(JF_NAME + ".java");
52
private static final Path COMPILE_PATH = Paths.get(".");
53
private static final String PS = File.pathSeparator;
54
55
public static void main(String[] args) throws Exception {
56
57
List<String> params = getParameters();
58
// Compile all source files.
59
boolean done = CompilerUtils.compile(SRC_PATH, COMPILE_PATH,
60
params.toArray(String[]::new));
61
if (!done) {
62
throw new RuntimeException("Test setup failed.");
63
}
64
params.add(0, "-Djava.security.properties=" + SEC_PROP);
65
params.add(JF_NAME);
66
OutputAnalyzer oa = ProcessTools.executeTestJava(
67
params.toArray(String[]::new));
68
System.out.println(oa.getOutput());
69
oa.shouldHaveExitValue(0);
70
}
71
72
private static List<String> getParameters() {
73
74
List<String> cmds = new ArrayList<>();
75
cmds.add("-cp");
76
cmds.add(P1_JAR + PS + P2_JAR + PS + COMPILE_PATH);
77
return cmds;
78
}
79
80
}
81
82