@Test public void testOperationGeneratorWithBadParamsPath() { List<Operation> generatedOps = IntStream.range(0, 10).mapToObj(i -> new Operation()).collect(Collectors.toList()); TestGeneratedOutputObject generatedOutputObject = new TestGeneratedOutputObject(generatedOps, null); doReturn(jsonHelper.getJSONString(generatedOutputObject)).when(mockOperationWrapper).getOutputPayload(); setupOperationOutputDefinition(TestGeneratedOutputObject.OPERATIONS_PATH, "/badpath"); modifier.modify(mockExecutorContext, mockOperationWrapper, mockOperationConductor); }
@Override public void modify(ExecutorContext executorContext, OperationWrapper operationWrapper, OperationConductor operationConductor) { if(!isOperationGenerator(operationWrapper.getOperation())) return; OperationGeneratorOutputDefinition outputDefinition = retrieveOutputDefinition(operationWrapper.getOperation()); if(outputDefinition.getLogOnly() != null && outputDefinition.getLogOnly()) { logger.info("Skipping operation injection (by request)."); return; } GeneratedOperationData generatedOperationData = retrieveGeneratedOperationData(operationWrapper, outputDefinition); List<Operation> generatedOperations = generatedOperationData.getOperations(); if(generatedOperations == null || generatedOperations.size() == 0) { logger.warn("No operations were generated by operation: %1$s", operationWrapper.getOperation().getName()); return; } generatedOperations.forEach(op -> { OperationWrapper opWrapper = operationWrapperFactory.create(op); opWrapper.init(executorContext, operationConductor.getJsonContextUpdater()); operationConductor.getPendingOperations().add(opWrapper); }); executorContext.getAgendaProgressReporter().adjustOperationTotalCount(generatedOperations.size()); }
GeneratedOperationsModifier implements OperationConductorModifier { @Override public void modify(ExecutorContext executorContext, OperationWrapper operationWrapper, OperationConductor operationConductor) { if(!isOperationGenerator(operationWrapper.getOperation())) return; OperationGeneratorOutputDefinition outputDefinition = retrieveOutputDefinition(operationWrapper.getOperation()); if(outputDefinition.getLogOnly() != null && outputDefinition.getLogOnly()) { logger.info("Skipping operation injection (by request)."); return; } GeneratedOperationData generatedOperationData = retrieveGeneratedOperationData(operationWrapper, outputDefinition); List<Operation> generatedOperations = generatedOperationData.getOperations(); if(generatedOperations == null || generatedOperations.size() == 0) { logger.warn("No operations were generated by operation: %1$s", operationWrapper.getOperation().getName()); return; } generatedOperations.forEach(op -> { OperationWrapper opWrapper = operationWrapperFactory.create(op); opWrapper.init(executorContext, operationConductor.getJsonContextUpdater()); operationConductor.getPendingOperations().add(opWrapper); }); executorContext.getAgendaProgressReporter().adjustOperationTotalCount(generatedOperations.size()); } }
GeneratedOperationsModifier implements OperationConductorModifier { @Override public void modify(ExecutorContext executorContext, OperationWrapper operationWrapper, OperationConductor operationConductor) { if(!isOperationGenerator(operationWrapper.getOperation())) return; OperationGeneratorOutputDefinition outputDefinition = retrieveOutputDefinition(operationWrapper.getOperation()); if(outputDefinition.getLogOnly() != null && outputDefinition.getLogOnly()) { logger.info("Skipping operation injection (by request)."); return; } GeneratedOperationData generatedOperationData = retrieveGeneratedOperationData(operationWrapper, outputDefinition); List<Operation> generatedOperations = generatedOperationData.getOperations(); if(generatedOperations == null || generatedOperations.size() == 0) { logger.warn("No operations were generated by operation: %1$s", operationWrapper.getOperation().getName()); return; } generatedOperations.forEach(op -> { OperationWrapper opWrapper = operationWrapperFactory.create(op); opWrapper.init(executorContext, operationConductor.getJsonContextUpdater()); operationConductor.getPendingOperations().add(opWrapper); }); executorContext.getAgendaProgressReporter().adjustOperationTotalCount(generatedOperations.size()); } GeneratedOperationsModifier(ExecutorContext executorContext); }
GeneratedOperationsModifier implements OperationConductorModifier { @Override public void modify(ExecutorContext executorContext, OperationWrapper operationWrapper, OperationConductor operationConductor) { if(!isOperationGenerator(operationWrapper.getOperation())) return; OperationGeneratorOutputDefinition outputDefinition = retrieveOutputDefinition(operationWrapper.getOperation()); if(outputDefinition.getLogOnly() != null && outputDefinition.getLogOnly()) { logger.info("Skipping operation injection (by request)."); return; } GeneratedOperationData generatedOperationData = retrieveGeneratedOperationData(operationWrapper, outputDefinition); List<Operation> generatedOperations = generatedOperationData.getOperations(); if(generatedOperations == null || generatedOperations.size() == 0) { logger.warn("No operations were generated by operation: %1$s", operationWrapper.getOperation().getName()); return; } generatedOperations.forEach(op -> { OperationWrapper opWrapper = operationWrapperFactory.create(op); opWrapper.init(executorContext, operationConductor.getJsonContextUpdater()); operationConductor.getPendingOperations().add(opWrapper); }); executorContext.getAgendaProgressReporter().adjustOperationTotalCount(generatedOperations.size()); } GeneratedOperationsModifier(ExecutorContext executorContext); @Override void modify(ExecutorContext executorContext, OperationWrapper operationWrapper, OperationConductor operationConductor); void setOperationWrapperFactory(OperationWrapperFactory operationWrapperFactory); }
GeneratedOperationsModifier implements OperationConductorModifier { @Override public void modify(ExecutorContext executorContext, OperationWrapper operationWrapper, OperationConductor operationConductor) { if(!isOperationGenerator(operationWrapper.getOperation())) return; OperationGeneratorOutputDefinition outputDefinition = retrieveOutputDefinition(operationWrapper.getOperation()); if(outputDefinition.getLogOnly() != null && outputDefinition.getLogOnly()) { logger.info("Skipping operation injection (by request)."); return; } GeneratedOperationData generatedOperationData = retrieveGeneratedOperationData(operationWrapper, outputDefinition); List<Operation> generatedOperations = generatedOperationData.getOperations(); if(generatedOperations == null || generatedOperations.size() == 0) { logger.warn("No operations were generated by operation: %1$s", operationWrapper.getOperation().getName()); return; } generatedOperations.forEach(op -> { OperationWrapper opWrapper = operationWrapperFactory.create(op); opWrapper.init(executorContext, operationConductor.getJsonContextUpdater()); operationConductor.getPendingOperations().add(opWrapper); }); executorContext.getAgendaProgressReporter().adjustOperationTotalCount(generatedOperations.size()); } GeneratedOperationsModifier(ExecutorContext executorContext); @Override void modify(ExecutorContext executorContext, OperationWrapper operationWrapper, OperationConductor operationConductor); void setOperationWrapperFactory(OperationWrapperFactory operationWrapperFactory); static final String OPERATION_GENERATOR; }