@Test public void testAcceptKO_stepIdIsRootStep() throws Exception { final String datasetId = "1234"; final String format = ""; final String preparation = createEmptyPreparationFromDataset(datasetId, "test"); applyAction(preparation, "[{}]"); applyAction(preparation, "[{}]"); final PreparationDTO preparationDetails = getPreparation(preparation); final List<String> stepsWithoutRootStep = new ArrayList<>(preparationDetails.getSteps()); stepsWithoutRootStep.remove(0); putTransformationAndMetadataInCacheForSteps(stepsWithoutRootStep, preparation, datasetId, format); ExportParameters exportParameters = new ExportParameters(); exportParameters.setPreparationId(preparation); exportParameters.setDatasetId(datasetId); exportParameters.setExportType(format); exportParameters.setFrom(HEAD); exportParameters.setStepId(Step.ROOT_STEP.id()); assertFalse("The OptimizedExportStrategy should not be acceptable if version is ROOT_STEP", optimizedExportStrategy.test(exportParameters)); }
@Override public boolean test(ExportParameters parameters) { if (parameters == null) { return false; } if (parameters.getContent() != null) { return false; } if (StringUtils.isEmpty(parameters.getPreparationId())) { return false; } final OptimizedPreparationInput optimizedPreparationInput = new OptimizedPreparationInput(parameters); return optimizedPreparationInput.applicable(); }
OptimizedExportStrategy extends BaseSampleExportStrategy { @Override public boolean test(ExportParameters parameters) { if (parameters == null) { return false; } if (parameters.getContent() != null) { return false; } if (StringUtils.isEmpty(parameters.getPreparationId())) { return false; } final OptimizedPreparationInput optimizedPreparationInput = new OptimizedPreparationInput(parameters); return optimizedPreparationInput.applicable(); } }
OptimizedExportStrategy extends BaseSampleExportStrategy { @Override public boolean test(ExportParameters parameters) { if (parameters == null) { return false; } if (parameters.getContent() != null) { return false; } if (StringUtils.isEmpty(parameters.getPreparationId())) { return false; } final OptimizedPreparationInput optimizedPreparationInput = new OptimizedPreparationInput(parameters); return optimizedPreparationInput.applicable(); }  }
OptimizedExportStrategy extends BaseSampleExportStrategy { @Override public boolean test(ExportParameters parameters) { if (parameters == null) { return false; } if (parameters.getContent() != null) { return false; } if (StringUtils.isEmpty(parameters.getPreparationId())) { return false; } final OptimizedPreparationInput optimizedPreparationInput = new OptimizedPreparationInput(parameters); return optimizedPreparationInput.applicable(); }  @Override boolean test(ExportParameters parameters); @Override StreamingResponseBody execute(ExportParameters parameters); }
OptimizedExportStrategy extends BaseSampleExportStrategy { @Override public boolean test(ExportParameters parameters) { if (parameters == null) { return false; } if (parameters.getContent() != null) { return false; } if (StringUtils.isEmpty(parameters.getPreparationId())) { return false; } final OptimizedPreparationInput optimizedPreparationInput = new OptimizedPreparationInput(parameters); return optimizedPreparationInput.applicable(); }  @Override boolean test(ExportParameters parameters); @Override StreamingResponseBody execute(ExportParameters parameters);  }