@Test public void testCustomModified_PropertyNotAvailable() { final MicrosoftIISDAVAttributesFinderFeature f = new MicrosoftIISDAVAttributesFinderFeature(null); final DavResource mock = mock(DavResource.class); Map<QName, String> map = new HashMap<>(); final Date modified = new DateTime("2018-11-01T15:31:57Z").toDate(); when(mock.getModified()).thenReturn(modified); when(mock.getCustomPropsNS()).thenReturn(map); final PathAttributes attrs = f.toAttributes(mock); assertEquals(modified.getTime(), attrs.getModificationDate()); }
protected PathAttributes toAttributes(final DavResource resource) { final PathAttributes attributes = super.toAttributes(resource); final Map<QName, String> properties = resource.getCustomPropsNS(); if(null != properties && properties.containsKey(MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE)) { final String value = properties.get(MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE); if(StringUtils.isNotBlank(value)) { try { attributes.setModificationDate(rfc1123.parse(value).getTime()); } catch(InvalidDateException e) { log.warn(String.format("Failure parsing property %s with value %s", MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE, value)); if(resource.getModified() != null) { attributes.setModificationDate(resource.getModified().getTime()); } } } else { if(log.isDebugEnabled()) { log.debug(String.format("Missing value for property %s", MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE)); } if(resource.getModified() != null) { attributes.setModificationDate(resource.getModified().getTime()); } } } return attributes; }
MicrosoftIISDAVAttributesFinderFeature extends DAVAttributesFinderFeature { protected PathAttributes toAttributes(final DavResource resource) { final PathAttributes attributes = super.toAttributes(resource); final Map<QName, String> properties = resource.getCustomPropsNS(); if(null != properties && properties.containsKey(MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE)) { final String value = properties.get(MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE); if(StringUtils.isNotBlank(value)) { try { attributes.setModificationDate(rfc1123.parse(value).getTime()); } catch(InvalidDateException e) { log.warn(String.format("Failure parsing property %s with value %s", MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE, value)); if(resource.getModified() != null) { attributes.setModificationDate(resource.getModified().getTime()); } } } else { if(log.isDebugEnabled()) { log.debug(String.format("Missing value for property %s", MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE)); } if(resource.getModified() != null) { attributes.setModificationDate(resource.getModified().getTime()); } } } return attributes; } }
MicrosoftIISDAVAttributesFinderFeature extends DAVAttributesFinderFeature { protected PathAttributes toAttributes(final DavResource resource) { final PathAttributes attributes = super.toAttributes(resource); final Map<QName, String> properties = resource.getCustomPropsNS(); if(null != properties && properties.containsKey(MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE)) { final String value = properties.get(MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE); if(StringUtils.isNotBlank(value)) { try { attributes.setModificationDate(rfc1123.parse(value).getTime()); } catch(InvalidDateException e) { log.warn(String.format("Failure parsing property %s with value %s", MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE, value)); if(resource.getModified() != null) { attributes.setModificationDate(resource.getModified().getTime()); } } } else { if(log.isDebugEnabled()) { log.debug(String.format("Missing value for property %s", MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE)); } if(resource.getModified() != null) { attributes.setModificationDate(resource.getModified().getTime()); } } } return attributes; } MicrosoftIISDAVAttributesFinderFeature(DAVSession session); }
MicrosoftIISDAVAttributesFinderFeature extends DAVAttributesFinderFeature { protected PathAttributes toAttributes(final DavResource resource) { final PathAttributes attributes = super.toAttributes(resource); final Map<QName, String> properties = resource.getCustomPropsNS(); if(null != properties && properties.containsKey(MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE)) { final String value = properties.get(MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE); if(StringUtils.isNotBlank(value)) { try { attributes.setModificationDate(rfc1123.parse(value).getTime()); } catch(InvalidDateException e) { log.warn(String.format("Failure parsing property %s with value %s", MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE, value)); if(resource.getModified() != null) { attributes.setModificationDate(resource.getModified().getTime()); } } } else { if(log.isDebugEnabled()) { log.debug(String.format("Missing value for property %s", MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE)); } if(resource.getModified() != null) { attributes.setModificationDate(resource.getModified().getTime()); } } } return attributes; } MicrosoftIISDAVAttributesFinderFeature(DAVSession session);  }
MicrosoftIISDAVAttributesFinderFeature extends DAVAttributesFinderFeature { protected PathAttributes toAttributes(final DavResource resource) { final PathAttributes attributes = super.toAttributes(resource); final Map<QName, String> properties = resource.getCustomPropsNS(); if(null != properties && properties.containsKey(MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE)) { final String value = properties.get(MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE); if(StringUtils.isNotBlank(value)) { try { attributes.setModificationDate(rfc1123.parse(value).getTime()); } catch(InvalidDateException e) { log.warn(String.format("Failure parsing property %s with value %s", MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE, value)); if(resource.getModified() != null) { attributes.setModificationDate(resource.getModified().getTime()); } } } else { if(log.isDebugEnabled()) { log.debug(String.format("Missing value for property %s", MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE)); } if(resource.getModified() != null) { attributes.setModificationDate(resource.getModified().getTime()); } } } return attributes; } MicrosoftIISDAVAttributesFinderFeature(DAVSession session);   }