Esempio n. 1
0
 /**
  * If you need to test server plugins, you must first prepare the server plugin service. After
  * this returns, the caller must explicitly start the PC by using the appropriate API on the given
  * mbean; this method will only start the service, it will NOT start the master PC.
  *
  * @param testServiceMBean the object that will house your test server plugins
  * @throws RuntimeException
  */
 public void prepareCustomServerPluginService(ServerPluginService testServiceMBean) {
   try {
     MBeanServer mbs = getJBossMBeanServer();
     testServiceMBean.start();
     mbs.registerMBean(testServiceMBean, ServerPluginServiceManagement.OBJECT_NAME);
     serverPluginService = testServiceMBean;
     return;
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
Esempio n. 2
0
  /**
   * If you need to test server plugins, you must first prepare the server plugin service. After
   * this returns, the caller must explicitly start the PC by using the appropriate API on the given
   * mbean; this method will only start the service, it will NOT start the master PC.
   *
   * @param testServiceMBean the object that will house your test server plugins
   * @throws RuntimeException
   */
  public void prepareCustomServerPluginService(ServerPluginService testServiceMBean) {
    try {
      // first, unregister the real service...
      MBeanServer mbs = getPlatformMBeanServer();
      if (mbs.isRegistered(ServerPluginService.OBJECT_NAME)) {
        mbs.unregisterMBean(ServerPluginService.OBJECT_NAME);
      }

      // Now replace with the test service...
      testServiceMBean.start();
      mbs.registerMBean(testServiceMBean, ServerPluginServiceMBean.OBJECT_NAME);
      serverPluginService = testServiceMBean;

    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }