Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/test/functional/CacheManagement/src/tests/sharedclasses/options/TestExpiringCaches.java
6005 views
1
/*******************************************************************************
2
* Copyright (c) 2010, 2019 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* 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
21
*******************************************************************************/
22
23
package tests.sharedclasses.options;
24
25
import tests.sharedclasses.TestUtils;
26
27
/*
28
* Create the four caches (2 persistent, 2 non-persistent) and check they list OK
29
* then expire them, check they all go.
30
*/
31
public class TestExpiringCaches extends TestUtils {
32
public static void main(String[] args) {
33
34
if (isMVS()) {
35
36
destroyNonPersistentCache("Foo");
37
destroyNonPersistentCache("Bar");
38
checkNoFileForNonPersistentCache("Foo");
39
checkNoFileForNonPersistentCache("Bar");
40
41
createNonPersistentCache("Bar");
42
createNonPersistentCache("Foo");
43
checkFileExistsForNonPersistentCache("Foo");
44
checkFileExistsForNonPersistentCache("Bar");
45
46
listAllCaches();
47
checkOutputContains("Foo.*(no|non-persistent)",
48
"Did not find a non-persistent cache called Foo");
49
checkOutputContains("Bar.*(no|non-persistent)",
50
"Did not find a non-persistent cache called Bar");
51
try {
52
Thread.sleep(1000);
53
} catch (Exception e) {
54
} // required???!?!?
55
expireAllCaches();
56
57
checkForSuccessfulNonPersistentCacheDestoryMessage("Bar");
58
checkForSuccessfulNonPersistentCacheDestoryMessage("Foo");
59
checkNoFileForNonPersistentCache("Foo");
60
checkNoFileForNonPersistentCache("Bar");
61
} else {
62
destroyPersistentCache("Foo");
63
destroyPersistentCache("Bar");
64
destroyNonPersistentCache("Foo");
65
destroyNonPersistentCache("Bar");
66
checkNoFileForNonPersistentCache("Foo");
67
checkNoFileForNonPersistentCache("Bar");
68
checkNoFileForPersistentCache("Foo");
69
checkNoFileForPersistentCache("Bar");
70
71
createNonPersistentCache("Bar");
72
createNonPersistentCache("Foo");
73
createPersistentCache("Bar");
74
createPersistentCache("Foo");
75
checkFileExistsForNonPersistentCache("Foo");
76
checkFileExistsForNonPersistentCache("Bar");
77
checkFileExistsForPersistentCache("Foo");
78
checkFileExistsForPersistentCache("Bar");
79
80
listAllCaches();
81
checkOutputContains("Foo.*(yes|persistent)",
82
"Did not find a persistent cache called Foo");
83
checkOutputContains("Foo.*(no|non-persistent)",
84
"Did not find a non-persistent cache called Foo");
85
checkOutputContains("Bar.*(yes|persistent)",
86
"Did not find a persistent cache called Bar");
87
checkOutputContains("Bar.*(no|non-persistent)",
88
"Did not find a non-persistent cache called Bar");
89
90
try {
91
Thread.sleep(1000);
92
} catch (Exception e) {
93
} // required???!?!?
94
expireAllCaches();
95
96
checkForSuccessfulPersistentCacheDestroyMessage("Bar");
97
checkForSuccessfulPersistentCacheDestroyMessage("Foo");
98
checkForSuccessfulNonPersistentCacheDestoryMessage("Bar");
99
checkForSuccessfulNonPersistentCacheDestoryMessage("Foo");
100
101
checkNoFileForNonPersistentCache("Foo");
102
checkNoFileForNonPersistentCache("Bar");
103
checkNoFileForPersistentCache("Foo");
104
checkNoFileForPersistentCache("Bar");
105
}
106
}
107
}
108
109