@Test public void testIsUpdateAllowedDevModeSNAPSHOT() throws IOException { testDeployContainer(VERSION_SNAPSHOT); mode = KieServerMode.DEVELOPMENT; assertTrue(extension.isUpdateContainerAllowed(CONTAINER_ID, new KieContainerInstanceImpl(CONTAINER_ID, KieContainerStatus.STARTED, kieContainer), new HashMap<>())); }
@Override public boolean isUpdateContainerAllowed(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) { if (isDevelopmentMode()) { return true; } List<Integer> states = new ArrayList<Integer>(); states.add(ProcessInstance.STATE_ACTIVE); states.add(ProcessInstance.STATE_PENDING); states.add(ProcessInstance.STATE_SUSPENDED); Collection<ProcessInstanceDesc> activeProcesses = runtimeDataService.getProcessInstancesByDeploymentId(id, states, new QueryContext()); if (!activeProcesses.isEmpty()) { parameters.put(KieServerConstants.FAILURE_REASON_PROP, "Update of container forbidden - there are active process instances for container " + id); return false; } return true; }
JbpmKieServerExtension implements KieServerExtension { @Override public boolean isUpdateContainerAllowed(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) { if (isDevelopmentMode()) { return true; } List<Integer> states = new ArrayList<Integer>(); states.add(ProcessInstance.STATE_ACTIVE); states.add(ProcessInstance.STATE_PENDING); states.add(ProcessInstance.STATE_SUSPENDED); Collection<ProcessInstanceDesc> activeProcesses = runtimeDataService.getProcessInstancesByDeploymentId(id, states, new QueryContext()); if (!activeProcesses.isEmpty()) { parameters.put(KieServerConstants.FAILURE_REASON_PROP, "Update of container forbidden - there are active process instances for container " + id); return false; } return true; } }
JbpmKieServerExtension implements KieServerExtension { @Override public boolean isUpdateContainerAllowed(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) { if (isDevelopmentMode()) { return true; } List<Integer> states = new ArrayList<Integer>(); states.add(ProcessInstance.STATE_ACTIVE); states.add(ProcessInstance.STATE_PENDING); states.add(ProcessInstance.STATE_SUSPENDED); Collection<ProcessInstanceDesc> activeProcesses = runtimeDataService.getProcessInstancesByDeploymentId(id, states, new QueryContext()); if (!activeProcesses.isEmpty()) { parameters.put(KieServerConstants.FAILURE_REASON_PROP, "Update of container forbidden - there are active process instances for container " + id); return false; } return true; }  }
JbpmKieServerExtension implements KieServerExtension { @Override public boolean isUpdateContainerAllowed(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) { if (isDevelopmentMode()) { return true; } List<Integer> states = new ArrayList<Integer>(); states.add(ProcessInstance.STATE_ACTIVE); states.add(ProcessInstance.STATE_PENDING); states.add(ProcessInstance.STATE_SUSPENDED); Collection<ProcessInstanceDesc> activeProcesses = runtimeDataService.getProcessInstancesByDeploymentId(id, states, new QueryContext()); if (!activeProcesses.isEmpty()) { parameters.put(KieServerConstants.FAILURE_REASON_PROP, "Update of container forbidden - there are active process instances for container " + id); return false; } return true; }  @Override boolean isInitialized(); @Override boolean isActive(); @Override void init(KieServerImpl kieServer, KieServerRegistry registry); @Override void destroy(KieServerImpl kieServer, KieServerRegistry registry); @Override void serverStarted(); @SuppressWarnings("unchecked") @Override void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override boolean isUpdateContainerAllowed(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void prepareContainerUpdate(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void updateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void activateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void deactivateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void disposeContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override List<Object> getAppComponents(SupportedTransports type); @Override T getAppComponents(Class<T> serviceType); @Override String getImplementedCapability(); @Override List<Object> getServices(); @Override String getExtensionName(); @Override Integer getStartOrder(); @Override String toString(); @Override List<Message> healthCheck(boolean report); }
JbpmKieServerExtension implements KieServerExtension { @Override public boolean isUpdateContainerAllowed(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) { if (isDevelopmentMode()) { return true; } List<Integer> states = new ArrayList<Integer>(); states.add(ProcessInstance.STATE_ACTIVE); states.add(ProcessInstance.STATE_PENDING); states.add(ProcessInstance.STATE_SUSPENDED); Collection<ProcessInstanceDesc> activeProcesses = runtimeDataService.getProcessInstancesByDeploymentId(id, states, new QueryContext()); if (!activeProcesses.isEmpty()) { parameters.put(KieServerConstants.FAILURE_REASON_PROP, "Update of container forbidden - there are active process instances for container " + id); return false; } return true; }  @Override boolean isInitialized(); @Override boolean isActive(); @Override void init(KieServerImpl kieServer, KieServerRegistry registry); @Override void destroy(KieServerImpl kieServer, KieServerRegistry registry); @Override void serverStarted(); @SuppressWarnings("unchecked") @Override void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override boolean isUpdateContainerAllowed(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void prepareContainerUpdate(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void updateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void activateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void deactivateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override void disposeContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters); @Override List<Object> getAppComponents(SupportedTransports type); @Override T getAppComponents(Class<T> serviceType); @Override String getImplementedCapability(); @Override List<Object> getServices(); @Override String getExtensionName(); @Override Integer getStartOrder(); @Override String toString(); @Override List<Message> healthCheck(boolean report); static final String EXTENSION_NAME; }