@Test void cancelEveryFlowWithoutDbUpdate() { Set<FlowLog> flowLogs = new HashSet<>(getFlowLogs(2, 5000)); Set<Long> myStackIds = flowLogs.stream().map(FlowLog::getResourceId).collect(Collectors.toSet()); for (Long myStackId : myStackIds) { InMemoryStateStore.putStack(myStackId, PollGroup.POLLABLE); } Set<String> flowIds = myStackIds.stream().map(i -> Long.toString(i)).collect(Collectors.toSet()); when(runningFlows.getRunningFlowIds()).thenReturn(flowIds); underTest.cancelEveryFlowWithoutDbUpdate(); for (Long myStackId : myStackIds) { assertEquals(PollGroup.CANCELLED, InMemoryStateStore.getStack(myStackId)); } flowIds.forEach(id -> verify(runningFlows, times(1)).remove(eq(id))); }
public void cancelEveryFlowWithoutDbUpdate() { for (String resourceType : InMemoryResourceStateStore.getResourceTypes()) { for (Long resourceId : InMemoryResourceStateStore.getAllResourceId(resourceType)) { InMemoryResourceStateStore.putResource(resourceType, resourceId, PollGroup.CANCELLED); } } for (String id : runningFlows.getRunningFlowIds()) { cancelFlowWithoutDbUpdate(id); } }
InMemoryCleanup { public void cancelEveryFlowWithoutDbUpdate() { for (String resourceType : InMemoryResourceStateStore.getResourceTypes()) { for (Long resourceId : InMemoryResourceStateStore.getAllResourceId(resourceType)) { InMemoryResourceStateStore.putResource(resourceType, resourceId, PollGroup.CANCELLED); } } for (String id : runningFlows.getRunningFlowIds()) { cancelFlowWithoutDbUpdate(id); } } }
InMemoryCleanup { public void cancelEveryFlowWithoutDbUpdate() { for (String resourceType : InMemoryResourceStateStore.getResourceTypes()) { for (Long resourceId : InMemoryResourceStateStore.getAllResourceId(resourceType)) { InMemoryResourceStateStore.putResource(resourceType, resourceId, PollGroup.CANCELLED); } } for (String id : runningFlows.getRunningFlowIds()) { cancelFlowWithoutDbUpdate(id); } }  }
InMemoryCleanup { public void cancelEveryFlowWithoutDbUpdate() { for (String resourceType : InMemoryResourceStateStore.getResourceTypes()) { for (Long resourceId : InMemoryResourceStateStore.getAllResourceId(resourceType)) { InMemoryResourceStateStore.putResource(resourceType, resourceId, PollGroup.CANCELLED); } } for (String id : runningFlows.getRunningFlowIds()) { cancelFlowWithoutDbUpdate(id); } }  void cancelEveryFlowWithoutDbUpdate(); void cancelFlowWithoutDbUpdate(String flowId); }
InMemoryCleanup { public void cancelEveryFlowWithoutDbUpdate() { for (String resourceType : InMemoryResourceStateStore.getResourceTypes()) { for (Long resourceId : InMemoryResourceStateStore.getAllResourceId(resourceType)) { InMemoryResourceStateStore.putResource(resourceType, resourceId, PollGroup.CANCELLED); } } for (String id : runningFlows.getRunningFlowIds()) { cancelFlowWithoutDbUpdate(id); } }  void cancelEveryFlowWithoutDbUpdate(); void cancelFlowWithoutDbUpdate(String flowId);  }