test_class.declarator: wfc = new WorkflowController()
test_class.modifier: private
test_class.original_string: private WorkflowController wfc = new WorkflowController();
test_class.type: WorkflowController
test_class.var_name: wfc
test_class.declarator: PROCESS_START_KEY = "key-pst"
test_class.modifier: private static final
test_class.original_string: private static final String PROCESS_START_KEY = "key-pst";
test_class.type: String
test_class.var_name: PROCESS_START_KEY
test_class.declarator: RUNNER_PID = "12468!1579"
test_class.modifier: private static final
test_class.original_string: private static final String RUNNER_PID = "12468!1579";
test_class.type: String
test_class.var_name: RUNNER_PID
test_class.declarator: EXECUTION_ID = "EXECA"
test_class.modifier: private static final
test_class.original_string: private static final String EXECUTION_ID = "EXECA";
test_class.type: String
test_class.var_name: EXECUTION_ID
test_class.declarator: NEW_PID = "1A2B3C"
test_class.modifier: private static final
test_class.original_string: private static final String NEW_PID = "1A2B3C";
test_class.type: String
test_class.var_name: NEW_PID
test_class.declarator: WAIT_TASK_ID = "11111!222222"
test_class.modifier: private static final
test_class.original_string: private static final String WAIT_TASK_ID = "11111!222222";
test_class.type: String
test_class.var_name: WAIT_TASK_ID
test_class.declarator: runtimeServiceProcessMock = mock(RuntimeService.class)
test_class.original_string: RuntimeService runtimeServiceProcessMock = mock(RuntimeService.class);
test_class.type: RuntimeService
test_class.var_name: runtimeServiceProcessMock
test_class.declarator: csmClientMock = mock(CMSClient.class)
test_class.original_string: CMSClient csmClientMock = mock(CMSClient.class);
test_class.type: CMSClient
test_class.var_name: csmClientMock
test_class.declarator: runtimeServiceExecutionMock = mock(RuntimeService.class)
test_class.original_string: RuntimeService runtimeServiceExecutionMock = mock(RuntimeService.class);
test_class.type: RuntimeService
test_class.var_name: runtimeServiceExecutionMock
test_class.file: controller/src/test/java/com/oneops/controller/workflow/WorkFlowControllerTest.java
test_class.identifier: WorkFlowControllerTest
test_case.body: @Test (priority=1)
  	/** start deployment using runtimeservice, no pre-existing process*/
  	public void startDpmtProcessTest(){
  		Map<String, Object> params = new HashMap<String, Object>();
  		CmsDeployment theDeployment = new CmsDeployment();
  		theDeployment.setProcessId(null);
  		params.put("dpmt", theDeployment);
  		wfc.setRuntimeService(runtimeServiceProcessMock);
  		DeploymentNotifier notifier = new DeploymentNotifier();
  		ReliableExecutor<NotificationMessage> antennaClient = mock(ReliableExecutor.class );
  
  		notifier.setAntennaClient(antennaClient);
  
  		wfc.setNotifier(notifier);
  		String pid =wfc.startDpmtProcess(PROCESS_START_KEY, params); //start *new* process since pid is null
  		assertEquals(pid, RUNNER_PID);
  	}
test_case.class_method_signature: WorkFlowControllerTest.startDpmtProcessTest()
test_case.full_signature: @Test (priority=1) /** start deployment using runtimeservice, no pre-existing process*/ public void startDpmtProcessTest()
test_case.identifier: startDpmtProcessTest
test_case.invocations: setProcessId put setRuntimeService mock setAntennaClient setNotifier startDpmtProcess assertEquals
test_case.modifiers: @Test (priority=1) /** start deployment using runtimeservice, no pre-existing process*/ public
test_case.parameters: ()
test_case.return: void
test_case.signature: void startDpmtProcessTest()
focal_class.declarator: WO_SUBMITTED = "submitted"
focal_class.modifier: public static final
focal_class.original_string: public static final String WO_SUBMITTED = "submitted";
focal_class.type: String
focal_class.var_name: WO_SUBMITTED
focal_class.declarator: WO_FAILED = "failed"
focal_class.modifier: public static final
focal_class.original_string: public static final String WO_FAILED = "failed";
focal_class.type: String
focal_class.var_name: WO_FAILED
focal_class.declarator: WO_RECEIVED = "received"
focal_class.modifier: public static final
focal_class.original_string: public static final String WO_RECEIVED = "received";
focal_class.type: String
focal_class.var_name: WO_RECEIVED
focal_class.declarator: WO_STATE = "wostate"
focal_class.modifier: public static final
focal_class.original_string: public static final String WO_STATE = "wostate";
focal_class.type: String
focal_class.var_name: WO_STATE
focal_class.declarator: SUB_PROC_END_VAR = "sub_proc_end"
focal_class.modifier: public static final
focal_class.original_string: public static final String SUB_PROC_END_VAR = "sub_proc_end";
focal_class.type: String
focal_class.var_name: SUB_PROC_END_VAR
focal_class.declarator: logger = Logger.getLogger(WorkflowController.class)
focal_class.modifier: private static
focal_class.original_string: private static Logger logger = Logger.getLogger(WorkflowController.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: STEP_FINISH_RETRIES = 3
focal_class.modifier: private static final
focal_class.original_string: private static final int STEP_FINISH_RETRIES = 3;
focal_class.type: int
focal_class.var_name: STEP_FINISH_RETRIES
focal_class.declarator: runtimeService
focal_class.modifier: private
focal_class.original_string: private RuntimeService runtimeService;
focal_class.type: RuntimeService
focal_class.var_name: runtimeService
focal_class.declarator: notifier
focal_class.modifier: private
focal_class.original_string: private DeploymentNotifier notifier;
focal_class.type: DeploymentNotifier
focal_class.var_name: notifier
focal_class.file: controller/src/main/java/com/oneops/controller/workflow/WorkflowController.java
focal_class.identifier: WorkflowController
focal_class.class_method_signature: WorkflowController.getNotifier()
focal_class.full_signature: public DeploymentNotifier getNotifier()
focal_class.identifier: getNotifier
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: DeploymentNotifier
focal_class.signature: DeploymentNotifier getNotifier()
focal_class.class_method_signature: WorkflowController.setNotifier(DeploymentNotifier notifier)
focal_class.full_signature: public void setNotifier(DeploymentNotifier notifier)
focal_class.identifier: setNotifier
focal_class.modifiers: public
focal_class.parameters: (DeploymentNotifier notifier)
focal_class.return: void
focal_class.signature: void setNotifier(DeploymentNotifier notifier)
focal_class.class_method_signature: WorkflowController.setRuntimeService(RuntimeService runtimeService)
focal_class.full_signature: public void setRuntimeService(RuntimeService runtimeService)
focal_class.identifier: setRuntimeService
focal_class.modifiers: public
focal_class.parameters: (RuntimeService runtimeService)
focal_class.return: void
focal_class.signature: void setRuntimeService(RuntimeService runtimeService)
focal_class.class_method_signature: WorkflowController.startDpmtProcess(String processKey, Map<String,Object> params)
focal_class.full_signature: public String startDpmtProcess(String processKey, Map<String,Object> params)
focal_class.identifier: startDpmtProcess
focal_class.modifiers: public
focal_class.parameters: (String processKey, Map<String,Object> params)
focal_class.return: String
focal_class.signature: String startDpmtProcess(String processKey, Map<String,Object> params)
focal_class.class_method_signature: WorkflowController.startReleaseProcess(String processKey, Map<String,Object> params)
focal_class.full_signature: public String startReleaseProcess(String processKey, Map<String,Object> params)
focal_class.identifier: startReleaseProcess
focal_class.modifiers: public
focal_class.parameters: (String processKey, Map<String,Object> params)
focal_class.return: String
focal_class.signature: String startReleaseProcess(String processKey, Map<String,Object> params)
focal_class.class_method_signature: WorkflowController.startOpsProcess(String processKey, Map<String,Object> params)
focal_class.full_signature: public String startOpsProcess(String processKey, Map<String,Object> params)
focal_class.identifier: startOpsProcess
focal_class.modifiers: public
focal_class.parameters: (String processKey, Map<String,Object> params)
focal_class.return: String
focal_class.signature: String startOpsProcess(String processKey, Map<String,Object> params)
focal_class.class_method_signature: WorkflowController.pokeProcess(String processId)
focal_class.full_signature: public void pokeProcess(String processId)
focal_class.identifier: pokeProcess
focal_class.modifiers: public
focal_class.parameters: (String processId)
focal_class.return: void
focal_class.signature: void pokeProcess(String processId)
focal_class.class_method_signature: WorkflowController.pokeSubProcess(String processId, String executionId, Map<String,Object> params)
focal_class.full_signature: public void pokeSubProcess(String processId, String executionId, Map<String,Object> params)
focal_class.identifier: pokeSubProcess
focal_class.modifiers: public
focal_class.parameters: (String processId, String executionId, Map<String,Object> params)
focal_class.return: void
focal_class.signature: void pokeSubProcess(String processId, String executionId, Map<String,Object> params)
focal_class.class_method_signature: WorkflowController.signalSubJoin(String processId)
focal_class.full_signature: private void signalSubJoin(String processId)
focal_class.identifier: signalSubJoin
focal_class.modifiers: private
focal_class.parameters: (String processId)
focal_class.return: void
focal_class.signature: void signalSubJoin(String processId)
focal_class.class_method_signature: WorkflowController.checkSyncWait(String processId, String executionId)
focal_class.full_signature: public void checkSyncWait(String processId, String executionId)
focal_class.identifier: checkSyncWait
focal_class.modifiers: public
focal_class.parameters: (String processId, String executionId)
focal_class.return: void
focal_class.signature: void checkSyncWait(String processId, String executionId)
focal_class.class_method_signature: WorkflowController.getIdTobeLogged(final Map<String, Object> params)
focal_class.full_signature: private long getIdTobeLogged(final Map<String, Object> params)
focal_class.identifier: getIdTobeLogged
focal_class.modifiers: private
focal_class.parameters: (final Map<String, Object> params)
focal_class.return: long
focal_class.signature: long getIdTobeLogged(final Map<String, Object> params)
focal_class.class_method_signature: WorkflowController.getExecOrder(final Map<String, Object> params)
focal_class.full_signature: private long getExecOrder(final Map<String, Object> params)
focal_class.identifier: getExecOrder
focal_class.modifiers: private
focal_class.parameters: (final Map<String, Object> params)
focal_class.return: long
focal_class.signature: long getExecOrder(final Map<String, Object> params)
focal_class.class_method_signature: WorkflowController.isDeployment(final Map<String, Object> params)
focal_class.full_signature: private boolean isDeployment(final Map<String, Object> params)
focal_class.identifier: isDeployment
focal_class.modifiers: private
focal_class.parameters: (final Map<String, Object> params)
focal_class.return: boolean
focal_class.signature: boolean isDeployment(final Map<String, Object> params)
focal_method.body: public String startDpmtProcess(String processKey, Map<String,Object> params){
  		CmsDeployment dpmt = (CmsDeployment)params.get("dpmt");
  		String processId = dpmt.getProcessId();
  		if (processId == null) {
  			logger.info("starting new process for " + processKey + " with params: " + params.toString());
  			ProcessInstance pi = runtimeService.startProcessInstanceByKey(processKey, params);
  			logger.info("started process with id - " + pi.getId());
  			return pi.getId();
  		} else {
  			String[] procParts = processId.split("!");
  			String procInstanceId = procParts[0]; 
  			ProcessInstance process = runtimeService.createProcessInstanceQuery().processInstanceId(procInstanceId).singleResult();
  			if (process != null) {
  				ExecutionEntity exec = (ExecutionEntity)process;
  				//if the process is in waiting for pause state - resume
  				if (exec.isActive() && exec.getActivityId().equals("dpmtPauseWait")) {
  					//sedn resume notification
  					notifier.sendDeploymentNotification(dpmt, "Deployment resumed by " + dpmt.getUpdatedBy(),
  							notifier.createDeploymentNotificationText(dpmt), NotificationSeverity.info, null);
  					return exec.getId();
  					//runtimeService.signal(exec.getId());
  				} else {
  					//lets check if there are any workorders wating for completion
  					List<Execution> subExecutions = runtimeService.createExecutionQuery().processInstanceId(procInstanceId).activityId("pwo").list();
  					if (subExecutions.size() > 0) {
  						//seems like the process is waiting for WOs to complete, lets sleep for 5 sec and try again, if subExecs are not decreasing it's stuck deployment
  						try {
  							Thread.sleep(5000);
  						} catch (InterruptedException e) {
  							e.printStackTrace();
  						}
  						List<Execution> newSubExecutions = runtimeService.createExecutionQuery().processInstanceId(procInstanceId).activityId("pwo").list();
  						if (subExecutions.size() == newSubExecutions.size()) {
  					    	String executionId = runtimeService.startProcessInstanceByKey(processKey, params).getId();
  							notifier.sendDeploymentNotification(dpmt,  "Deployment being retried by " + dpmt.getUpdatedBy(),
  							notifier.createDeploymentNotificationText(dpmt), NotificationSeverity.info, null);
  							return executionId;
  						}
  						return "skip";
  					} else {
  						//seems like we got stuck deployment lets see if it's stucked at subJoined
  					    Execution exSubJoin = runtimeService.createExecutionQuery()
  							      .processInstanceId(processId)
  							      .activityId("subJoined").singleResult();
  					    
  					    if (exSubJoin != null) {
  					    	return exSubJoin.getId();
  					    } else {
  					    	// if we got here it's a stuck deployment and we need to create a new process
  					    	String executionId = runtimeService.startProcessInstanceByKey(processKey, params).getId();
  							notifier.sendDeploymentNotification(dpmt,  "Deployment being retried by " + dpmt.getUpdatedBy(),
  							notifier.createDeploymentNotificationText(dpmt), NotificationSeverity.info, null);
  							return executionId;
  					    }
  					}
  				}
  			} else {
  				//the old process ended there is an attempt to restart the deployment (normally should not happened)
  				//will create new process instance
  				String executionId = runtimeService.startProcessInstanceByKey(processKey, params).getId();
  				notifier.sendDeploymentNotification(dpmt,  "Deployment being retried by " + dpmt.getUpdatedBy(),
  				notifier.createDeploymentNotificationText(dpmt), NotificationSeverity.info, null);
  				return executionId;
  			}
  		}
  		//return null;
  	}
focal_method.class_method_signature: WorkflowController.startDpmtProcess(String processKey, Map<String,Object> params)
focal_method.full_signature: public String startDpmtProcess(String processKey, Map<String,Object> params)
focal_method.identifier: startDpmtProcess
focal_method.invocations: get getProcessId info toString startProcessInstanceByKey info getId getId split singleResult processInstanceId createProcessInstanceQuery isActive equals getActivityId sendDeploymentNotification getUpdatedBy createDeploymentNotificationText getId list activityId processInstanceId createExecutionQuery size sleep printStackTrace list activityId processInstanceId createExecutionQuery size size getId startProcessInstanceByKey sendDeploymentNotification getUpdatedBy createDeploymentNotificationText singleResult activityId processInstanceId createExecutionQuery getId getId startProcessInstanceByKey sendDeploymentNotification getUpdatedBy createDeploymentNotificationText getId startProcessInstanceByKey sendDeploymentNotification getUpdatedBy createDeploymentNotificationText
focal_method.modifiers: public
focal_method.parameters: (String processKey, Map<String,Object> params)
focal_method.return: String
focal_method.signature: String startDpmtProcess(String processKey, Map<String,Object> params)