Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine04/VM04Target.java
41160 views
/*1* Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223package nsk.aod.VirtualMachine.VirtualMachine04;2425import nsk.share.TestBug;26import nsk.share.aod.DummyTargetApplication;2728/*29* This target application during initialization sets special system property,30* main test application tries to get this property using VirtualMachine.getSystemProperties()31*/32public class VM04Target extends DummyTargetApplication {33static final String TEST_PROPERTY_KEY = "VirtualMachine04_testPropertyKey";34static final String TEST_PROPERTY_VALUE = "VirtualMachine04_testPropertyValue";35static final String CHANGED_TEST_PROPERTY_VALUE = "VirtualMachine04_testPropertyValue_changed";3637VM04Target(String[] args) {38super(args);3940log.display("Setting property " + TEST_PROPERTY_KEY + " = " + TEST_PROPERTY_VALUE);41System.setProperty(TEST_PROPERTY_KEY, TEST_PROPERTY_VALUE);42}4344protected void targetApplicationActions() {45String signal = pipe.readln();46log.display("Received signal: " + signal);47if (!signal.equals(VirtualMachine04.SIGNAL_CHANGE_PROPERTY)) {48throw new TestBug("Received unexpected signal: " + signal);49}5051log.display("Setting property " + TEST_PROPERTY_KEY + " = " + CHANGED_TEST_PROPERTY_VALUE);52System.setProperty(TEST_PROPERTY_KEY, CHANGED_TEST_PROPERTY_VALUE);5354log.display("Sending signal " + VirtualMachine04.SIGNAL_PROPERTY_CHANGED);55pipe.println(VirtualMachine04.SIGNAL_PROPERTY_CHANGED);56}5758public static void main(String[] args) {59new VM04Target(args).runTargetApplication();60}61}626364