< prev index next >

test/jdk/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java

Print this page
rev 51789 : [mq]: asserts


   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.IOException;
  25 import java.net.URISyntaxException;
  26 import java.util.ArrayList;
  27 import java.util.List;
  28 
  29 import jdk.testlibrary.Asserts;
  30 import jdk.test.lib.Utils;
  31 import jdk.test.lib.apps.LingeredApp;
  32 import sun.jvmstat.monitor.MonitorException;
  33 import sun.jvmstat.monitor.MonitoredHost;
  34 import sun.jvmstat.monitor.MonitoredVm;
  35 import sun.jvmstat.monitor.MonitoredVmUtil;
  36 import sun.jvmstat.monitor.VmIdentifier;
  37 
  38 /**
  39  *
  40  * @test
  41  * @bug 6672135
  42  * @summary setInterval() for local MonitoredHost and local MonitoredVm
  43  *
  44  * @library /lib/testlibrary
  45  * @library /test/lib
  46  *
  47  * @build jdk.testlibrary.*
  48  * @build jdk.test.lib.apps.*
  49  * @run main TestPollingInterval
  50  */
  51 public class TestPollingInterval {
  52 
  53     private static final int INTERVAL = 2000;
  54 
  55     public static void main(String[] args) throws IOException,
  56             MonitorException, URISyntaxException {
  57         LingeredApp app = null;
  58         try {
  59             List<String> vmArgs = new ArrayList<String>();
  60             vmArgs.add("-XX:+UsePerfData");
  61             vmArgs.addAll(Utils.getVmOptions());
  62             app = LingeredApp.startApp(vmArgs);
  63 
  64             MonitoredHost localHost = MonitoredHost.getMonitoredHost("localhost");
  65             String uriString = "//" + app.getPid() + "?mode=r"; // NOI18N
  66             VmIdentifier vmId = new VmIdentifier(uriString);
  67             MonitoredVm vm = localHost.getMonitoredVm(vmId);


   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.IOException;
  25 import java.net.URISyntaxException;
  26 import java.util.ArrayList;
  27 import java.util.List;
  28 
  29 import jdk.test.lib.Asserts;
  30 import jdk.test.lib.Utils;
  31 import jdk.test.lib.apps.LingeredApp;
  32 import sun.jvmstat.monitor.MonitorException;
  33 import sun.jvmstat.monitor.MonitoredHost;
  34 import sun.jvmstat.monitor.MonitoredVm;
  35 import sun.jvmstat.monitor.MonitoredVmUtil;
  36 import sun.jvmstat.monitor.VmIdentifier;
  37 
  38 /**
  39  *
  40  * @test
  41  * @bug 6672135
  42  * @summary setInterval() for local MonitoredHost and local MonitoredVm
  43  *

  44  * @library /test/lib
  45  *

  46  * @build jdk.test.lib.apps.*
  47  * @run main TestPollingInterval
  48  */
  49 public class TestPollingInterval {
  50 
  51     private static final int INTERVAL = 2000;
  52 
  53     public static void main(String[] args) throws IOException,
  54             MonitorException, URISyntaxException {
  55         LingeredApp app = null;
  56         try {
  57             List<String> vmArgs = new ArrayList<String>();
  58             vmArgs.add("-XX:+UsePerfData");
  59             vmArgs.addAll(Utils.getVmOptions());
  60             app = LingeredApp.startApp(vmArgs);
  61 
  62             MonitoredHost localHost = MonitoredHost.getMonitoredHost("localhost");
  63             String uriString = "//" + app.getPid() + "?mode=r"; // NOI18N
  64             VmIdentifier vmId = new VmIdentifier(uriString);
  65             MonitoredVm vm = localHost.getMonitoredVm(vmId);
< prev index next >