@Test public void testCreate() throws Exception { req = ControlJvmRequestFactory.create(JvmControlOperation.START, mockJvm); assertEquals(req.getClass(), StartServiceControlJvmRequest.class); req = ControlJvmRequestFactory.create(JvmControlOperation.STOP, mockJvm); assertEquals(req.getClass(), StopServiceControlJvmRequest.class); req = ControlJvmRequestFactory.create(JvmControlOperation.DELETE_SERVICE, mockJvm); assertEquals(req.getClass(), DeleteServiceControlJvmRequest.class); req = ControlJvmRequestFactory.create(JvmControlOperation.DEPLOY_JVM_ARCHIVE, mockJvm); assertEquals(req.getClass(), DeployArchiveControlJvmRequest.class); req = ControlJvmRequestFactory.create(JvmControlOperation.INSTALL_SERVICE, mockJvm); assertEquals(req.getClass(), InstallServiceControlJvmRequest.class); req = ControlJvmRequestFactory.create(JvmControlOperation.HEAP_DUMP, mockJvm); assertEquals(req.getClass(), HeapDumpControlJvmRequest.class); }
public static ControlJvmRequest create(JvmControlOperation jvmControlOperation, Jvm jvm) { if (jvmControlOperation == null) { throw new IllegalArgumentException("jvmControlOperation is required"); } if (jvm == null) { throw new IllegalArgumentException("jvm is required"); } switch (jvmControlOperation) { case START: return new StartServiceControlJvmRequest(jvm); case STOP: return new StopServiceControlJvmRequest(jvm); case DELETE_SERVICE: return new DeleteServiceControlJvmRequest(jvm); case DEPLOY_JVM_ARCHIVE: return new DeployArchiveControlJvmRequest(jvm); case INSTALL_SERVICE: return new InstallServiceControlJvmRequest(jvm); case HEAP_DUMP: return new HeapDumpControlJvmRequest(jvm); case THREAD_DUMP: return new ThreadDumpControlJvmRequest(jvm); default: throw new UnsupportedJvmControlOperationException(jvmControlOperation); } }
ControlJvmRequestFactory { public static ControlJvmRequest create(JvmControlOperation jvmControlOperation, Jvm jvm) { if (jvmControlOperation == null) { throw new IllegalArgumentException("jvmControlOperation is required"); } if (jvm == null) { throw new IllegalArgumentException("jvm is required"); } switch (jvmControlOperation) { case START: return new StartServiceControlJvmRequest(jvm); case STOP: return new StopServiceControlJvmRequest(jvm); case DELETE_SERVICE: return new DeleteServiceControlJvmRequest(jvm); case DEPLOY_JVM_ARCHIVE: return new DeployArchiveControlJvmRequest(jvm); case INSTALL_SERVICE: return new InstallServiceControlJvmRequest(jvm); case HEAP_DUMP: return new HeapDumpControlJvmRequest(jvm); case THREAD_DUMP: return new ThreadDumpControlJvmRequest(jvm); default: throw new UnsupportedJvmControlOperationException(jvmControlOperation); } } }
ControlJvmRequestFactory { public static ControlJvmRequest create(JvmControlOperation jvmControlOperation, Jvm jvm) { if (jvmControlOperation == null) { throw new IllegalArgumentException("jvmControlOperation is required"); } if (jvm == null) { throw new IllegalArgumentException("jvm is required"); } switch (jvmControlOperation) { case START: return new StartServiceControlJvmRequest(jvm); case STOP: return new StopServiceControlJvmRequest(jvm); case DELETE_SERVICE: return new DeleteServiceControlJvmRequest(jvm); case DEPLOY_JVM_ARCHIVE: return new DeployArchiveControlJvmRequest(jvm); case INSTALL_SERVICE: return new InstallServiceControlJvmRequest(jvm); case HEAP_DUMP: return new HeapDumpControlJvmRequest(jvm); case THREAD_DUMP: return new ThreadDumpControlJvmRequest(jvm); default: throw new UnsupportedJvmControlOperationException(jvmControlOperation); } }  }
ControlJvmRequestFactory { public static ControlJvmRequest create(JvmControlOperation jvmControlOperation, Jvm jvm) { if (jvmControlOperation == null) { throw new IllegalArgumentException("jvmControlOperation is required"); } if (jvm == null) { throw new IllegalArgumentException("jvm is required"); } switch (jvmControlOperation) { case START: return new StartServiceControlJvmRequest(jvm); case STOP: return new StopServiceControlJvmRequest(jvm); case DELETE_SERVICE: return new DeleteServiceControlJvmRequest(jvm); case DEPLOY_JVM_ARCHIVE: return new DeployArchiveControlJvmRequest(jvm); case INSTALL_SERVICE: return new InstallServiceControlJvmRequest(jvm); case HEAP_DUMP: return new HeapDumpControlJvmRequest(jvm); case THREAD_DUMP: return new ThreadDumpControlJvmRequest(jvm); default: throw new UnsupportedJvmControlOperationException(jvmControlOperation); } }  static ControlJvmRequest create(JvmControlOperation jvmControlOperation, Jvm jvm); }
ControlJvmRequestFactory { public static ControlJvmRequest create(JvmControlOperation jvmControlOperation, Jvm jvm) { if (jvmControlOperation == null) { throw new IllegalArgumentException("jvmControlOperation is required"); } if (jvm == null) { throw new IllegalArgumentException("jvm is required"); } switch (jvmControlOperation) { case START: return new StartServiceControlJvmRequest(jvm); case STOP: return new StopServiceControlJvmRequest(jvm); case DELETE_SERVICE: return new DeleteServiceControlJvmRequest(jvm); case DEPLOY_JVM_ARCHIVE: return new DeployArchiveControlJvmRequest(jvm); case INSTALL_SERVICE: return new InstallServiceControlJvmRequest(jvm); case HEAP_DUMP: return new HeapDumpControlJvmRequest(jvm); case THREAD_DUMP: return new ThreadDumpControlJvmRequest(jvm); default: throw new UnsupportedJvmControlOperationException(jvmControlOperation); } }  static ControlJvmRequest create(JvmControlOperation jvmControlOperation, Jvm jvm);  }