@Test @Ignore public void testSetTimestamp() throws Exception { final Path file = new Path(new DefaultHomeFinderService(session).find(), UUID.randomUUID().toString(), EnumSet.of(Path.Type.file)); session.getFeature(Touch.class).touch(file, new TransferStatus()); new DAVTimestampFeature(session).setTimestamp(file, 5000L); assertEquals(5000L, new DAVAttributesFinderFeature(session).find(file).getModificationDate()); assertEquals(5000L, new DefaultAttributesFinderFeature(session).find(file).getModificationDate()); new DAVDeleteFeature(session).delete(Collections.<Path>singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
@Override public void setTimestamp(final Path file, final TransferStatus status) throws BackgroundException { try { final List<DavResource> resources = session.getClient().propfind(new DAVPathEncoder().encode(file), 0, Collections.singleton(SardineUtil.createQNameWithDefaultNamespace("getlastmodified"))); for(DavResource resource : resources) { session.getClient().patch(new DAVPathEncoder().encode(file), this.getCustomProperties(resource, status.getTimestamp()), Collections.emptyList(), this.getCustomHeaders(file, status)); break; } } catch(SardineException e) { throw new DAVExceptionMappingService().map("Failure to write attributes of {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e, file); } }
DAVTimestampFeature extends DefaultTimestampFeature implements Timestamp { @Override public void setTimestamp(final Path file, final TransferStatus status) throws BackgroundException { try { final List<DavResource> resources = session.getClient().propfind(new DAVPathEncoder().encode(file), 0, Collections.singleton(SardineUtil.createQNameWithDefaultNamespace("getlastmodified"))); for(DavResource resource : resources) { session.getClient().patch(new DAVPathEncoder().encode(file), this.getCustomProperties(resource, status.getTimestamp()), Collections.emptyList(), this.getCustomHeaders(file, status)); break; } } catch(SardineException e) { throw new DAVExceptionMappingService().map("Failure to write attributes of {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e, file); } } }
DAVTimestampFeature extends DefaultTimestampFeature implements Timestamp { @Override public void setTimestamp(final Path file, final TransferStatus status) throws BackgroundException { try { final List<DavResource> resources = session.getClient().propfind(new DAVPathEncoder().encode(file), 0, Collections.singleton(SardineUtil.createQNameWithDefaultNamespace("getlastmodified"))); for(DavResource resource : resources) { session.getClient().patch(new DAVPathEncoder().encode(file), this.getCustomProperties(resource, status.getTimestamp()), Collections.emptyList(), this.getCustomHeaders(file, status)); break; } } catch(SardineException e) { throw new DAVExceptionMappingService().map("Failure to write attributes of {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e, file); } } DAVTimestampFeature(final DAVSession session); }
DAVTimestampFeature extends DefaultTimestampFeature implements Timestamp { @Override public void setTimestamp(final Path file, final TransferStatus status) throws BackgroundException { try { final List<DavResource> resources = session.getClient().propfind(new DAVPathEncoder().encode(file), 0, Collections.singleton(SardineUtil.createQNameWithDefaultNamespace("getlastmodified"))); for(DavResource resource : resources) { session.getClient().patch(new DAVPathEncoder().encode(file), this.getCustomProperties(resource, status.getTimestamp()), Collections.emptyList(), this.getCustomHeaders(file, status)); break; } } catch(SardineException e) { throw new DAVExceptionMappingService().map("Failure to write attributes of {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e, file); } } DAVTimestampFeature(final DAVSession session); @Override void setTimestamp(final Path file, final TransferStatus status); }
DAVTimestampFeature extends DefaultTimestampFeature implements Timestamp { @Override public void setTimestamp(final Path file, final TransferStatus status) throws BackgroundException { try { final List<DavResource> resources = session.getClient().propfind(new DAVPathEncoder().encode(file), 0, Collections.singleton(SardineUtil.createQNameWithDefaultNamespace("getlastmodified"))); for(DavResource resource : resources) { session.getClient().patch(new DAVPathEncoder().encode(file), this.getCustomProperties(resource, status.getTimestamp()), Collections.emptyList(), this.getCustomHeaders(file, status)); break; } } catch(SardineException e) { throw new DAVExceptionMappingService().map("Failure to write attributes of {0}", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e, file); } } DAVTimestampFeature(final DAVSession session); @Override void setTimestamp(final Path file, final TransferStatus status); static final QName LAST_MODIFIED_DEFAULT_NAMESPACE; static final QName LAST_MODIFIED_CUSTOM_NAMESPACE; static final QName LAST_MODIFIED_SERVER_CUSTOM_NAMESPACE; }