@Test public void testWriteTimestamp() throws Exception { final SDSNodeIdProvider nodeid = new SDSNodeIdProvider(session).withCache(cache); final Path room = new SDSDirectoryFeature(session, nodeid).mkdir( new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.volume, Path.Type.triplecrypt)), null, new TransferStatus()); final Path test = new SDSTouchFeature(session, nodeid).touch(new Path(room, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); new SDSTimestampFeature(session, nodeid).setTimestamp(test, 1599047952805L); final SDSAttributesFinderFeature f = new SDSAttributesFinderFeature(session, nodeid); final PathAttributes attributes = f.find(test); assertNotEquals(1599047952805L, attributes.getModificationDate()); new SDSDeleteFeature(session, nodeid).delete(Collections.singletonList(room), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
@Override public void setTimestamp(final Path file, final TransferStatus status) throws BackgroundException { try { final SoftwareVersionData version = session.softwareVersion(); final Matcher matcher = Pattern.compile(SDSSession.VERSION_REGEX).matcher(version.getRestApiVersion()); if(matcher.matches()) { if(new Version(matcher.group(1)).compareTo(new Version(String.valueOf(4.22))) < 0) { throw new UnsupportedException(); } } new NodesApi(session.getClient()).updateFile(new UpdateFileRequest().timestampModification(new DateTime(status.getTimestamp())), Long.parseLong(nodeid.getFileid(file, new DisabledListProgressListener())), StringUtils.EMPTY, null); } catch(ApiException e) { throw new SDSExceptionMappingService().map("Failure to write attributes of {0}", e, file); } }
SDSTimestampFeature extends DefaultTimestampFeature { @Override public void setTimestamp(final Path file, final TransferStatus status) throws BackgroundException { try { final SoftwareVersionData version = session.softwareVersion(); final Matcher matcher = Pattern.compile(SDSSession.VERSION_REGEX).matcher(version.getRestApiVersion()); if(matcher.matches()) { if(new Version(matcher.group(1)).compareTo(new Version(String.valueOf(4.22))) < 0) { throw new UnsupportedException(); } } new NodesApi(session.getClient()).updateFile(new UpdateFileRequest().timestampModification(new DateTime(status.getTimestamp())), Long.parseLong(nodeid.getFileid(file, new DisabledListProgressListener())), StringUtils.EMPTY, null); } catch(ApiException e) { throw new SDSExceptionMappingService().map("Failure to write attributes of {0}", e, file); } } }
SDSTimestampFeature extends DefaultTimestampFeature { @Override public void setTimestamp(final Path file, final TransferStatus status) throws BackgroundException { try { final SoftwareVersionData version = session.softwareVersion(); final Matcher matcher = Pattern.compile(SDSSession.VERSION_REGEX).matcher(version.getRestApiVersion()); if(matcher.matches()) { if(new Version(matcher.group(1)).compareTo(new Version(String.valueOf(4.22))) < 0) { throw new UnsupportedException(); } } new NodesApi(session.getClient()).updateFile(new UpdateFileRequest().timestampModification(new DateTime(status.getTimestamp())), Long.parseLong(nodeid.getFileid(file, new DisabledListProgressListener())), StringUtils.EMPTY, null); } catch(ApiException e) { throw new SDSExceptionMappingService().map("Failure to write attributes of {0}", e, file); } } SDSTimestampFeature(final SDSSession session, final SDSNodeIdProvider nodeid); }
SDSTimestampFeature extends DefaultTimestampFeature { @Override public void setTimestamp(final Path file, final TransferStatus status) throws BackgroundException { try { final SoftwareVersionData version = session.softwareVersion(); final Matcher matcher = Pattern.compile(SDSSession.VERSION_REGEX).matcher(version.getRestApiVersion()); if(matcher.matches()) { if(new Version(matcher.group(1)).compareTo(new Version(String.valueOf(4.22))) < 0) { throw new UnsupportedException(); } } new NodesApi(session.getClient()).updateFile(new UpdateFileRequest().timestampModification(new DateTime(status.getTimestamp())), Long.parseLong(nodeid.getFileid(file, new DisabledListProgressListener())), StringUtils.EMPTY, null); } catch(ApiException e) { throw new SDSExceptionMappingService().map("Failure to write attributes of {0}", e, file); } } SDSTimestampFeature(final SDSSession session, final SDSNodeIdProvider nodeid); @Override void setTimestamp(final Path file, final TransferStatus status); }
SDSTimestampFeature extends DefaultTimestampFeature { @Override public void setTimestamp(final Path file, final TransferStatus status) throws BackgroundException { try { final SoftwareVersionData version = session.softwareVersion(); final Matcher matcher = Pattern.compile(SDSSession.VERSION_REGEX).matcher(version.getRestApiVersion()); if(matcher.matches()) { if(new Version(matcher.group(1)).compareTo(new Version(String.valueOf(4.22))) < 0) { throw new UnsupportedException(); } } new NodesApi(session.getClient()).updateFile(new UpdateFileRequest().timestampModification(new DateTime(status.getTimestamp())), Long.parseLong(nodeid.getFileid(file, new DisabledListProgressListener())), StringUtils.EMPTY, null); } catch(ApiException e) { throw new SDSExceptionMappingService().map("Failure to write attributes of {0}", e, file); } } SDSTimestampFeature(final SDSSession session, final SDSNodeIdProvider nodeid); @Override void setTimestamp(final Path file, final TransferStatus status);  }