@Test public void testAcceptKO_withMetadataCacheNoContentCache() throws Exception { final String preparation = createEmptyPreparationFromDataset("1234", "test"); applyAction(preparation, "[{}]"); applyAction(preparation, "[{}]"); final PreparationDTO preparationDetails = getPreparation(preparation); for (String step : preparationDetails.getSteps()) { try (OutputStream content = contentCache.put(cacheKeyGenerator.generateMetadataKey(preparation, step, HEAD), ContentCache.TimeToLive.DEFAULT)) { content.write("{}".getBytes()); content.flush(); } } ExportParameters exportParameters = new ExportParameters(); exportParameters.setPreparationId(preparation); exportParameters.setFrom(HEAD); assertFalse(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);  }