@Test public void testIllegalKey() { BlobStore bs = new TempFileSystemBlobStore(); InputStream inputStream = null; try { bs.update(".", "!", null, inputStream); assertTrue("illegal key passed as valid", false); } catch (ObjectKeyFormatException e) { assertTrue(true); } catch (IllegalStoreStateException e) { assertTrue("IllegalStoreStateException should not be thrown", false); } }
@Override public void update(String namespace, String key, Map<String, String> headers, InputStream blob) throws ObjectKeyFormatException, IllegalStoreStateException { try { delete(namespace, key); create(namespace, key, headers, blob); } catch (DuplicateObjectKeyException e) { log.error( "Duplicate keys happened. most likely something wrong with implementation. " + "This should never happens.", e); } }
TempFileSystemBlobStore implements BlobStore { @Override public void update(String namespace, String key, Map<String, String> headers, InputStream blob) throws ObjectKeyFormatException, IllegalStoreStateException { try { delete(namespace, key); create(namespace, key, headers, blob); } catch (DuplicateObjectKeyException e) { log.error( "Duplicate keys happened. most likely something wrong with implementation. " + "This should never happens.", e); } } }
TempFileSystemBlobStore implements BlobStore { @Override public void update(String namespace, String key, Map<String, String> headers, InputStream blob) throws ObjectKeyFormatException, IllegalStoreStateException { try { delete(namespace, key); create(namespace, key, headers, blob); } catch (DuplicateObjectKeyException e) { log.error( "Duplicate keys happened. most likely something wrong with implementation. " + "This should never happens.", e); } } TempFileSystemBlobStore(); }
TempFileSystemBlobStore implements BlobStore { @Override public void update(String namespace, String key, Map<String, String> headers, InputStream blob) throws ObjectKeyFormatException, IllegalStoreStateException { try { delete(namespace, key); create(namespace, key, headers, blob); } catch (DuplicateObjectKeyException e) { log.error( "Duplicate keys happened. most likely something wrong with implementation. " + "This should never happens.", e); } } TempFileSystemBlobStore(); void create(String namespace, String key, Map<String, String> headers, final InputStream blob); @Override void create(String namespace, String key, Map<String, String> headers, BlobWriter blobWriter); @Override void update(String namespace, String key, Map<String, String> headers, InputStream blob); @Override void update(String namespace, String key, Map<String, String> headers, BlobWriter blobWriter); @Override void moveNameSpace(final String oldNamespace, final String key, final String newNamespace); void ren(File[] files, String target, String replacement); @Override void readBlob(final String namespace, final String key, BlobReader reader); @Override void readBlob(final String namespace, final String key, final OutputStream out); @Override Map<String, String> readHeaders(final String namespace, final String key); @Override void delete(int expirySeconds); @Override void delete(final String namespace, final String key); FilenameFilter getHeadersFilenameFilter(String namespace, String key); FilenameFilter getFilenameFilter(String namespace, String key); @Override boolean isExists(final String namespace, final String key); @Override Collection<BlobStoreLink> list(); }
TempFileSystemBlobStore implements BlobStore { @Override public void update(String namespace, String key, Map<String, String> headers, InputStream blob) throws ObjectKeyFormatException, IllegalStoreStateException { try { delete(namespace, key); create(namespace, key, headers, blob); } catch (DuplicateObjectKeyException e) { log.error( "Duplicate keys happened. most likely something wrong with implementation. " + "This should never happens.", e); } } TempFileSystemBlobStore(); void create(String namespace, String key, Map<String, String> headers, final InputStream blob); @Override void create(String namespace, String key, Map<String, String> headers, BlobWriter blobWriter); @Override void update(String namespace, String key, Map<String, String> headers, InputStream blob); @Override void update(String namespace, String key, Map<String, String> headers, BlobWriter blobWriter); @Override void moveNameSpace(final String oldNamespace, final String key, final String newNamespace); void ren(File[] files, String target, String replacement); @Override void readBlob(final String namespace, final String key, BlobReader reader); @Override void readBlob(final String namespace, final String key, final OutputStream out); @Override Map<String, String> readHeaders(final String namespace, final String key); @Override void delete(int expirySeconds); @Override void delete(final String namespace, final String key); FilenameFilter getHeadersFilenameFilter(String namespace, String key); FilenameFilter getFilenameFilter(String namespace, String key); @Override boolean isExists(final String namespace, final String key); @Override Collection<BlobStoreLink> list();  }