@Test public void testFindFile() throws Exception { final Path file = randomFile(); new MantaTouchFeature(session).touch(file, new TransferStatus().withMime("x-application/cyberduck")); final PathAttributes attributes = new MantaAttributesFinderFeature(session).find(file); assertNotNull(attributes); assertEquals(-1L, attributes.getCreationDate()); assertNotEquals(-1L, attributes.getModificationDate()); assertNotNull(attributes.getETag()); new MantaDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
@Override public PathAttributes find(final Path file) throws BackgroundException { if(file.isRoot()) { return PathAttributes.EMPTY; } try { return new MantaObjectAttributeAdapter(session) .convert(session.getClient().head(file.getAbsolute())); } catch(MantaException e) { throw new MantaExceptionMappingService().map("Failure to read attributes of {0}", e, file); } catch(MantaClientHttpResponseException e) { throw new MantaHttpExceptionMappingService().map("Failure to read attributes of {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Failure to read attributes of {0}", e, file); } }
MantaAttributesFinderFeature implements AttributesFinder { @Override public PathAttributes find(final Path file) throws BackgroundException { if(file.isRoot()) { return PathAttributes.EMPTY; } try { return new MantaObjectAttributeAdapter(session) .convert(session.getClient().head(file.getAbsolute())); } catch(MantaException e) { throw new MantaExceptionMappingService().map("Failure to read attributes of {0}", e, file); } catch(MantaClientHttpResponseException e) { throw new MantaHttpExceptionMappingService().map("Failure to read attributes of {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Failure to read attributes of {0}", e, file); } } }
MantaAttributesFinderFeature implements AttributesFinder { @Override public PathAttributes find(final Path file) throws BackgroundException { if(file.isRoot()) { return PathAttributes.EMPTY; } try { return new MantaObjectAttributeAdapter(session) .convert(session.getClient().head(file.getAbsolute())); } catch(MantaException e) { throw new MantaExceptionMappingService().map("Failure to read attributes of {0}", e, file); } catch(MantaClientHttpResponseException e) { throw new MantaHttpExceptionMappingService().map("Failure to read attributes of {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Failure to read attributes of {0}", e, file); } } MantaAttributesFinderFeature(final MantaSession session); }
MantaAttributesFinderFeature implements AttributesFinder { @Override public PathAttributes find(final Path file) throws BackgroundException { if(file.isRoot()) { return PathAttributes.EMPTY; } try { return new MantaObjectAttributeAdapter(session) .convert(session.getClient().head(file.getAbsolute())); } catch(MantaException e) { throw new MantaExceptionMappingService().map("Failure to read attributes of {0}", e, file); } catch(MantaClientHttpResponseException e) { throw new MantaHttpExceptionMappingService().map("Failure to read attributes of {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Failure to read attributes of {0}", e, file); } } MantaAttributesFinderFeature(final MantaSession session); @Override PathAttributes find(final Path file); }
MantaAttributesFinderFeature implements AttributesFinder { @Override public PathAttributes find(final Path file) throws BackgroundException { if(file.isRoot()) { return PathAttributes.EMPTY; } try { return new MantaObjectAttributeAdapter(session) .convert(session.getClient().head(file.getAbsolute())); } catch(MantaException e) { throw new MantaExceptionMappingService().map("Failure to read attributes of {0}", e, file); } catch(MantaClientHttpResponseException e) { throw new MantaHttpExceptionMappingService().map("Failure to read attributes of {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Failure to read attributes of {0}", e, file); } } MantaAttributesFinderFeature(final MantaSession session); @Override PathAttributes find(final Path file);  }