Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/test/functional/cmdLineTests/URLClassLoaderTests/SignedSealed/readme.txt
12877 views
1
2
#
3
# Copyright (c) 2001, 2018 IBM Corp. and others
4
#
5
# This program and the accompanying materials are made available under
6
# the terms of the Eclipse Public License 2.0 which accompanies this
7
# distribution and is available at https://www.eclipse.org/legal/epl-2.0/
8
# or the Apache License, Version 2.0 which accompanies this distribution and
9
# is available at https://www.apache.org/licenses/LICENSE-2.0.
10
#
11
# This Source Code may also be made available under the following
12
# Secondary Licenses when the conditions for such availability set
13
# forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
14
# General Public License, version 2 with the GNU Classpath
15
# Exception [1] and GNU General Public License, version 2 with the
16
# OpenJDK Assembly Exception [2].
17
#
18
# [1] https://www.gnu.org/software/classpath/license.html
19
# [2] http://openjdk.java.net/legal/assembly-exception.html
20
#
21
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
22
#
23
24
These tests ensure that package sealing and Jar signing work correctly for shared classes
25
26
SignedSealed.BuildInitial1
27
Builds AB.jar, which contains A classes and B classes from a sealed package and C classes from an unsealed package
28
Builds B1.jar, which contains B classes from a sealed package, but which is not sealed and C classes from an unsealed package
29
Builds B2.jar, which contains a single B class from the sealed package, but which is not sealed
30
31
Sealed.success
32
Runs A_Main which loads classes from classpath AB.jar;B1.jar
33
This should work because all the sealed classes come from the same jar (AB.jar)
34
35
Sealed.failure1
36
Runs A_Main with classpath B1.jar;AB.jar which should fail because the classes loaded from B1 are not sealed.
37
Expect a SecurityException
38
39
Sealed.failure2
40
Runs A_Main with classpath B2.jar;AB.jar which should fail because the classes loaded from B1 are not sealed.
41
This is different from failure1 because only the second B class is loaded from B2, the first is loaded from AB.jar.
42
Expect a SecurityException
43
44
(Note that the above 3 tests each get their own cache)
45
46
Sealed.verify1
47
Runs A_Main again with the failure1 classpath to ensure that it still throws a SecurityException
48
49
Sealed.verify2
50
Runs A_Main again with the failure2 classpath to ensure that it still throws a SecurityException
51
52
SignedSealed.BuildInitial2
53
Builds A.jar, B.jar and C.jar and then signs them using jarsigner to produce sA.jar, sB.jar and sC.jar
54
C.jar contains classes from one package. A.jar and B.jar contain classes from a different package.
55
56
Signed.success1Store
57
Runs A_Main and stores classes using sA.jar;sB.jar;sC.jar in the cache
58
59
Signed.success1Find
60
Runs the same test as success1Store to ensure that no error is thrown loading classes out of the cache
61
62
Signed.success2Store
63
Runs A_Main and stores classes using sA.jar;sB.jar;C.jar in the cache
64
This should work because the unsigned classes in C are from a different package than A or B.
65
66
Signed.success2Find
67
Runs the same test as success2Store to ensure that no error is thrown loading classes out of the cache
68
69
Signed.success3Store
70
Runs A_Main and stores classes using A.jar;B.jar;sC.jar in the cache
71
This should work because the signed classes in C are from a different package than A or B.
72
73
Signed.success3Find
74
Runs the same test as success3Store to ensure that no error is thrown loading classes out of the cache
75
76
Signed.failure1Store
77
Runs A_Main and stores classes using A.jar;sB.jar;C.jar in the cache
78
This should throw a SecurityException because A is offering unsigned classes in sB's signed package
79
80
Signed.failure1Find
81
Runs the same test as failure1Store to ensure that an exception is still thrown
82
83
Signed.failure2Store
84
Runs A_Main and stores classes using sA.jar;B.jar;C.jar in the cache
85
This should throw a SecurityException because B is offering unsigned classes in sA's signed package
86
87
Signed.failure2Find
88
Runs the same test as failure1Store to ensure that an exception is still thrown
89