use of org.apache.jackrabbit.core.data.DataStoreException in project jackrabbit-oak by apache.
the class AzureDataStoreTest method testBackendGetRecordInvalidIdentifierThrowsDataStoreException.
@Test
public void testBackendGetRecordInvalidIdentifierThrowsDataStoreException() {
try {
backend.getRecord(new DataIdentifier("invalid"));
fail();
} catch (DataStoreException e) {
}
}
use of org.apache.jackrabbit.core.data.DataStoreException in project jackrabbit-oak by apache.
the class AzureBlobStoreBackend method addMetadataRecordImpl.
private void addMetadataRecordImpl(final InputStream input, String name, long recordLength) throws DataStoreException {
try {
CloudBlobDirectory metaDir = getAzureContainer().getDirectoryReference(META_DIR_NAME);
CloudBlockBlob blob = metaDir.getBlockBlobReference(name);
blob.upload(input, recordLength);
} catch (StorageException e) {
LOG.info("Error adding metadata record. metadataName={} length={}", name, recordLength, e);
throw new DataStoreException(e);
} catch (URISyntaxException | IOException e) {
throw new DataStoreException(e);
}
}
use of org.apache.jackrabbit.core.data.DataStoreException in project jackrabbit-oak by apache.
the class AzureDataStoreTest method testBackendAddMetadataRecordFileNotFoundThrowsDataStoreException.
@Test
public void testBackendAddMetadataRecordFileNotFoundThrowsDataStoreException() throws IOException {
File testFile = folder.newFile();
copyInputStreamToFile(randomStream(0, 10), testFile);
testFile.delete();
try {
backend.addMetadataRecord(testFile, "name");
fail();
} catch (DataStoreException e) {
assertTrue(e.getCause() instanceof FileNotFoundException);
}
}
use of org.apache.jackrabbit.core.data.DataStoreException in project jackrabbit-oak by apache.
the class AzureDataStoreTest method testBackendWriteRecordFileNotFoundThrowsException.
@Test
public void testBackendWriteRecordFileNotFoundThrowsException() throws IOException, NoSuchAlgorithmException {
File testFile = folder.newFile();
copyInputStreamToFile(randomStream(0, 10), testFile);
DataIdentifier identifier = new DataIdentifier(getIdForInputStream(new FileInputStream(testFile)));
assertTrue(testFile.delete());
try {
backend.write(identifier, testFile);
fail();
} catch (DataStoreException e) {
assertTrue(e.getCause() instanceof FileNotFoundException);
}
}
use of org.apache.jackrabbit.core.data.DataStoreException in project jackrabbit-oak by apache.
the class FSBackend method addMetadataRecord.
@Override
public void addMetadataRecord(File input, String name) throws DataStoreException {
try {
File file = new File(fsPathDir, name);
FileUtils.copyFile(input, file);
} catch (IOException e) {
LOG.error("Exception while adding metadata record file {} with name {}, {}", input, name, e);
throw new DataStoreException("Could not add root record", e);
}
}
Aggregations