author | mseledtsov |
Thu, 16 Nov 2017 19:01:01 -0800 | |
changeset 47908 | d6d00f785f39 |
permissions | -rw-r--r-- |
47908
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
1 |
/* |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
2 |
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
4 |
* |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
8 |
* |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
13 |
* accompanied this code). |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
14 |
* |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
18 |
* |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
21 |
* questions. |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
22 |
*/ |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
23 |
|
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
24 |
import sun.hotspot.WhiteBox; |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
25 |
|
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
26 |
public class CheckContainerized { |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
27 |
public static String OUTSIDE_OF_CONTAINER = |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
28 |
"CheckContainerized: Running outside of a container"; |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
29 |
public static String INSIDE_A_CONTAINER = |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
30 |
"CheckContainerized: Running inside a container"; |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
31 |
|
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
32 |
public static void main(String[] args) { |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
33 |
System.out.println("CheckContainerized: Entering"); |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
34 |
WhiteBox wb = WhiteBox.getWhiteBox(); |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
35 |
|
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
36 |
if (wb.isContainerized()) { |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
37 |
System.out.println(INSIDE_A_CONTAINER); |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
38 |
|
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
39 |
} else { |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
40 |
System.out.println(OUTSIDE_OF_CONTAINER); |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
41 |
} |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
42 |
} |
d6d00f785f39
8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents:
diff
changeset
|
43 |
} |