use of ddf.catalog.content.operation.CreateStorageResponse in project ddf by codice.
the class FileSystemStorageProviderTest method testUpdate.
@Test
public void testUpdate() throws Exception {
CreateStorageResponse createResponse = assertContentItem(TEST_INPUT_CONTENTS, NITF_MIME_TYPE, TEST_INPUT_FILENAME);
String id = createResponse.getCreatedContentItems().get(0).getId();
ByteSource byteSource = new ByteSource() {
@Override
public InputStream openStream() throws IOException {
return IOUtils.toInputStream("Updated NITF");
}
};
ContentItem updateItem = new ContentItemImpl(id, byteSource, NITF_MIME_TYPE, mock(Metacard.class));
submitAndVerifySuccessfulUpdateStorageRequest(updateItem);
}
use of ddf.catalog.content.operation.CreateStorageResponse in project ddf by codice.
the class FileSystemStorageProviderTest method testCreateAndReadReference.
@Test
public void testCreateAndReadReference() throws Exception {
String path = baseTmpDir + File.separator + TEST_INPUT_FILENAME;
FileUtils.writeStringToFile(new File(path), TEST_INPUT_CONTENTS);
Map<String, Serializable> properties = new HashMap<>();
properties.put(Constants.STORE_REFERENCE_KEY, path);
CreateStorageResponse createResponse = assertContentItem(TEST_INPUT_CONTENTS, NITF_MIME_TYPE, TEST_INPUT_FILENAME, properties);
String uriString = createResponse.getCreatedContentItems().get(0).getUri();
assertReadRequest(uriString, NITF_MIME_TYPE, true);
}
use of ddf.catalog.content.operation.CreateStorageResponse in project ddf by codice.
the class FileSystemStorageProviderTest method testRead.
@Test
public void testRead() throws Exception {
CreateStorageResponse createResponse = assertContentItem(TEST_INPUT_CONTENTS, NITF_MIME_TYPE, TEST_INPUT_FILENAME);
String uriString = createResponse.getCreatedContentItems().get(0).getUri();
assertReadRequest(uriString, NITF_MIME_TYPE);
}
use of ddf.catalog.content.operation.CreateStorageResponse in project ddf by codice.
the class FileSystemStorageProviderTest method testReadWithMultipleItems.
@Test
public void testReadWithMultipleItems() throws Exception {
CreateStorageResponse createResponse = assertContentItem(TEST_INPUT_CONTENTS, NITF_MIME_TYPE, TEST_INPUT_FILENAME);
String unqualifiedUriString = createResponse.getCreatedContentItems().get(0).getUri();
createResponse = assertContentItemWithQualifier(TEST_INPUT_CONTENTS, NITF_MIME_TYPE, TEST_INPUT_FILENAME, createResponse.getCreatedContentItems().get(0).getId(), QUALIFIER);
String qualifiedUriString = createResponse.getCreatedContentItems().get(0).getUri();
assertReadRequest(unqualifiedUriString, NITF_MIME_TYPE);
assertReadRequest(qualifiedUriString, NITF_MIME_TYPE);
}
Aggregations