public void executeWorkItem(WorkItem workItem, WorkItemManager workItemManager) { final String methodName = "PollDSLAMInitialsWorkItemHandler.executeWorkItem() "; LOG.info(methodName); WorkflowProcessInstance processInstance = (WorkflowProcessInstance) kieSession.getProcessInstance((workItem.getProcessInstanceId())); String processMock = (String) processInstance.getVariable("processMock"); LOG.info(methodName + " process mock before mock code: " + processMock); processMock = MockVOHelper.getMockCode(processMock, processInstance); LOG.info(methodName + " process mock after mock code: " + processMock); LOG.info( methodName + " process mock from process variable: " + (String) processInstance.getVariable("processMock")); mockData(processMock); PollDSLAMInitialsVO pollDSLAMInitialsVO = mockService.getPollDSLAMInitialsVO(processMock); if (pollDSLAMInitialsVO == null) { pollDSLAMInitialsVO = MockVOHelper.getPollDSLAMInitialsVO(false, false, 0, null, false); } Map<String, Object> outputParams = new HashMap<String, Object>(); outputParams.put("isErrored", pollDSLAMInitialsVO.isErrored()); outputParams.put("isPollDSLAMSupported", pollDSLAMInitialsVO.isPollDSLAMSupported()); outputParams.put("customerExpScore", pollDSLAMInitialsVO.getCustomerExpScore()); outputParams.put("deviceTID", pollDSLAMInitialsVO.getDeviceTID()); outputParams.put("isNetworkCongested", pollDSLAMInitialsVO.isNetworkCongested()); workItemManager.completeWorkItem(workItem.getId(), outputParams); }
private void mockData(String product) { when(mockService.getPollDSLAMInitialsVO(Matchers.contains("POLLCONG"))) .thenReturn(MockVOHelper.getPollDSLAMInitialsVO(true, true, 1, "1", true)); }