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
  	public void pokeSubprocessTest(){	
  		Map<String, Object> params = new HashMap<String, Object>();
  		params.put("k", "v");
  		wfc.setRuntimeService(runtimeServiceExecutionMock);
  		wfc.pokeSubProcess(RUNNER_PID, EXECUTION_ID, params); 
  		//does nothing but log; is void method
  	}
test_case.class_method_signature: WorkFlowControllerTest.pokeSubprocessTest()
test_case.full_signature: @Test public void pokeSubprocessTest()
test_case.identifier: pokeSubprocessTest
test_case.invocations: put setRuntimeService pokeSubProcess
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void pokeSubprocessTest()
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 void pokeSubProcess(String processId, String executionId, Map<String,Object> params){
  
          List<Execution> subExecutions = runtimeService.createExecutionQuery().processInstanceId(processId).activityId("pwo").list();
          
  		int retries = subExecutions.size() > 0 ? subExecutions.size() + 1 : 3;
  		
  		for (int i=1; i<=retries ; i++) {
  			try {
  				Set<Entry<String, Object>> enstrySetInMap = params.entrySet();
  			    for (Entry<String, Object> aMapEntry : enstrySetInMap) {
  				    runtimeService.setVariableLocal(executionId, aMapEntry.getKey(), aMapEntry.getValue());
  			    }
  			    logger.info("Poking sub process with id - " + executionId+" deployment : "+isDeployment(params)+" id: "+getIdTobeLogged(params));
  			    runtimeService.signal(executionId);  
  			    break;
  			} catch (ActivitiOptimisticLockingException aole) {
  				//this is ok, some other process beat this on completion
  				logger.warn(aole);
  				// but what seems to be the issues - transaction is being rolled back and the subprocess is not completed
  				//so in this case we will retry subprocess
  				//go to retry
  			} catch (ActivitiObjectNotFoundException aonf) {
  				logger.warn("seems like this is a dup on inductor response and this was already processed deployment : "+isDeployment(params)+" id: "+getIdTobeLogged(params));
  				logger.warn(aonf);
  				//seems like this is a dup on inductor reponse and this was already processed
  				// to avoid clogging the queue we will ignore this
  				break;
  			} catch (PersistenceException pe) {
  				//some activiti race condition need to retry
  				logger.error("Error on processing inductor responce deployment : "+isDeployment(params)+" id: "+getIdTobeLogged(params));
  				logger.error(pe);
  				//go to retry
  			}
  		}
  		
  	    if (subExecutions.size()>0) {
  		    List<Execution> execsSyncWait = runtimeService.createExecutionQuery()
  				      .processInstanceId(processId)
  				      .activityId("subSync").list();
  
  		    logger.info("Number of subprocesses - " + subExecutions.size());
  		    logger.info("Number of subprocesses waiting in sync block - " + execsSyncWait.size());
  		    
  	        Boolean reachedSubProcEnd = (Boolean)runtimeService.getVariable(processId, SUB_PROC_END_VAR);
  		    
  		    if (execsSyncWait.size() == subExecutions.size() || (reachedSubProcEnd != null && reachedSubProcEnd)) {
  		        
  		    	logger.info("All sub processes waiting in sync block, will poke all of them now.");
  		    	
  		    	runtimeService.setVariable(processId, SUB_PROC_END_VAR, new Boolean(true));
  		    	
  		        int pokesCounter = 0;
  		        
  		        for (Execution syncExec : execsSyncWait) {
  		        	boolean needReTry = true;
  		        	for (int i=1; i<=STEP_FINISH_RETRIES && needReTry; i++) {
  			        	needReTry = false;
  			        	logger.info("Poking sync sub process with id - " + syncExec.getId()+" deployment: " +isDeployment(params)+" id "+getIdTobeLogged(params));
  		 	    		try {
  		 	    			runtimeService.signal(syncExec.getId());
  		 	    			pokesCounter++;
  		 	    		} catch (ActivitiException aole) {
  			 	   			//this is ok, some other process beat this on completion
  			 	   			logger.warn(aole);
  			 	   			needReTry = true;
  		 	    		} catch (PersistenceException pe) {
  		 	    			pe.printStackTrace();
  		 	    			logger.error("Error on joing sub processes");
  		 	    			logger.error(pe.getMessage());
  		 	    			//workaround of activi bug when multiple instances of the same var is created
  		 	    			String[] badVars = {"wostate", "wo"};
  		 	    			for (String varName : badVars) {
  		 	    				runtimeService.removeVariableLocal(syncExec.getId(), varName);
  		 	    			}
  		 	    			needReTry = true;
  		 	    		}
  		        	}
  		        }
  		        
  		        logger.info(">>>>>>Completed " + pokesCounter + " subprocesses out of " + execsSyncWait.size() + " waiting!");
  		        logger.info(">>>>>>Completed step ExecOrder " + getExecOrder(params)+ "  deployment " +isDeployment(params) +" id: " +getIdTobeLogged(params));
  		        
  		        signalSubJoin(processId);
  		    }
  	    } else {
  	    	signalSubJoin(processId);
  	    }
  	}
focal_method.class_method_signature: WorkflowController.pokeSubProcess(String processId, String executionId, Map<String,Object> params)
focal_method.full_signature: public void pokeSubProcess(String processId, String executionId, Map<String,Object> params)
focal_method.identifier: pokeSubProcess
focal_method.invocations: list activityId processInstanceId createExecutionQuery size size entrySet setVariableLocal getKey getValue info isDeployment getIdTobeLogged signal warn warn isDeployment getIdTobeLogged warn error isDeployment getIdTobeLogged error size list activityId processInstanceId createExecutionQuery info size info size getVariable size size info setVariable info getId isDeployment getIdTobeLogged signal getId warn printStackTrace error error getMessage removeVariableLocal getId info size info getExecOrder isDeployment getIdTobeLogged signalSubJoin signalSubJoin
focal_method.modifiers: public
focal_method.parameters: (String processId, String executionId, Map<String,Object> params)
focal_method.return: void
focal_method.signature: void pokeSubProcess(String processId, String executionId, Map<String,Object> params)