Package net.jmesnil.jmx.core.tests.util

Examples of net.jmesnil.jmx.core.tests.util.TestProjectProvider


    }

  @SuppressWarnings("unchecked")
  public void testConnection() throws Exception {
    TestProjectProvider projectProvider;
    IProject project;
    projectProvider = new TestProjectProvider(JMXTestPlugin.PLUGIN_ID,
        "projects" + Path.SEPARATOR + "JMX_EXAMPLE",
        null, true);
    project = projectProvider.getProject();
    project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());

    ILaunchConfigurationWorkingCopy wc = createLaunch();
    ILaunch launch = wc.launch("run", new NullProgressMonitor());
   
    Thread.sleep(10000);
   
    try {
      IConnectionProvider defProvider =
        ExtensionManager.getProvider(DefaultConnectionProvider.PROVIDER_ID);
      HashMap map = new HashMap();
      map.put(DefaultConnectionProvider.ID, "Test Connection");
      map.put(DefaultConnectionProvider.URL, "service:jmx:rmi:///jndi/rmi://localhost:9999" +
          "/jmxrmi");
      map.put(DefaultConnectionProvider.USERNAME, "");
      map.put(DefaultConnectionProvider.PASSWORD, "");
      IConnectionWrapper wrapper = defProvider.createConnection(map);
      assertTrue("Connection was null", wrapper != null);

      wrapper.connect();
      Root root = wrapper.getRoot();
      assertTrue("Root was not null", root == null);
     
      wrapper.loadRoot();
      root = wrapper.getRoot();
      assertTrue("Root was null", root != null);
     
      Node[] children = root.getChildren();
      assertTrue("children were null", children != null);
      assertEquals("Example had the wrong number of domains", 5, children.length);
    } finally {
       projectProvider.dispose();
      launch.terminate();
    }
  }
View Full Code Here

TOP

Related Classes of net.jmesnil.jmx.core.tests.util.TestProjectProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.