NitfPostIngestPlugin implements PostIngestPlugin { @Override public CreateResponse process(CreateResponse createResponse) throws PluginExecutionException { if (createResponse == null) { throw new PluginExecutionException("process(): argument 'createResponse' may not be null."); } try { updateContent( new HashSet<>(createResponse.getCreatedMetacards()), createResponse.getRequest().getProperties()); } catch (InterruptedException e) { LOGGER.debug("Interrupt received while doing image processing.", e); Thread.currentThread().interrupt(); } return createResponse; } NitfPostIngestPlugin();  NitfPostIngestPlugin(Semaphore lock); @Override CreateResponse process(CreateResponse createResponse); @Override UpdateResponse process(UpdateResponse updateResponse); @Override DeleteResponse process(DeleteResponse deleteResponse); void setMaxSideLength(int maxSideLength); void setMaxNitfSizeMB(int maxNitfSizeMB); void setCreateOverview(boolean createOverview); void setStoreOriginalImage(boolean storeOriginalImage); void setCatalogFramework(CatalogFramework catalogFramework); void setNitfParserService(NitfParserService nitfParserService);  }
@Test(expected = PluginExecutionException.class) public void testNullInputOnCreate() throws PluginExecutionException { nitfPostIngestPlugin.process((CreateResponse) null); }
@Test(expected = PluginExecutionException.class) public void testNullInputOnUpdate() throws PluginExecutionException { nitfPostIngestPlugin.process((UpdateResponse) null); }
@Test public void testCreateResponse() throws Exception { nitfPostIngestPlugin.process(createResponse); validate(); verify(lock).acquire(); verify(lock).release(); }
@Test public void testNullResourceSize() throws Exception { metacard.setResourceSize(null); nitfPostIngestPlugin.process(createResponse); validate(); verify(lock).acquire(); verify(lock).release(); }
@Test public void testUpdateResponse() throws Exception { nitfPostIngestPlugin.process(updateResponse); validate(); verify(lock).acquire(); verify(lock).release(); }
@Test public void testNonNitfContent() throws Exception { metacard.setAttribute(Media.TYPE, "text/xml"); nitfPostIngestPlugin.process(updateResponse); assertThat(metacard.getThumbnail(), is(nullValue())); assertThat(metacard.getAttribute(Core.DERIVED_RESOURCE_URI), is(nullValue())); }
@Test public void testNoMediaType() throws Exception { metacard.setAttribute(Media.TYPE, null); nitfPostIngestPlugin.process(updateResponse); assertThat(metacard.getThumbnail(), is(nullValue())); assertThat(metacard.getAttribute(Core.DERIVED_RESOURCE_URI), is(nullValue())); }
@Test public void testAlreadyProcessedRequest() throws Exception { requestProperties.put("NitfPostIngestPlugin.Processed", true); nitfPostIngestPlugin.process(createResponse); assertThat(metacard.getThumbnail(), is(nullValue())); assertThat(metacard.getAttribute(Core.DERIVED_RESOURCE_URI), is(nullValue())); verify(catalogFramework, never()).update(updateStorageCaptor.capture()); verify(catalogFramework, never()).update(updateMetacardCaptor.capture()); }