if (!this.accessCondition.getIfMatch().equals(this.parentFileRef.getProperties().getEtag())) { throw new StorageException(StorageErrorCode.CONDITION_FAILED.toString(), SR.INVALID_CONDITIONAL_HEADERS, HttpURLConnection.HTTP_PRECON_FAILED, null, null);
if (!this.accessCondition.getIfMatch().equals(this.parentFileRef.getProperties().getEtag())) { throw new StorageException(StorageErrorCode.CONDITION_FAILED.toString(), SR.INVALID_CONDITIONAL_HEADERS, HttpURLConnection.HTTP_PRECON_FAILED, null, null);
public static void assertAreEqual(FileProperties prop1, FileProperties prop2) { if (prop1 == null) { Assert.assertNull(prop2); } else { Assert.assertNotNull(prop2); Assert.assertEquals(prop1.getCacheControl(), prop2.getCacheControl()); Assert.assertEquals(prop1.getContentDisposition(), prop2.getContentDisposition()); Assert.assertEquals(prop1.getContentEncoding(), prop2.getContentEncoding()); Assert.assertEquals(prop1.getContentLanguage(), prop2.getContentLanguage()); Assert.assertEquals(prop1.getContentMD5(), prop2.getContentMD5()); Assert.assertEquals(prop1.getContentType(), prop2.getContentType()); Assert.assertEquals(prop1.getEtag(), prop2.getEtag()); Assert.assertEquals(prop1.getLastModified(), prop2.getLastModified()); Assert.assertEquals(prop1.getLength(), prop2.getLength()); } }
this.setLockedETag(file.properties.getEtag()); this.setArePropertiesPopulated(true); if (!this.getLockedETag().equals(file.properties.getEtag())) { throw new StorageException(StorageErrorCode.CONDITION_FAILED.toString(), SR.INVALID_CONDITIONAL_HEADERS, HttpURLConnection.HTTP_PRECON_FAILED, null, null);
this.setLockedETag(file.properties.getEtag()); this.setArePropertiesPopulated(true); if (!this.getLockedETag().equals(file.properties.getEtag())) { throw new StorageException(StorageErrorCode.CONDITION_FAILED.toString(), SR.INVALID_CONDITIONAL_HEADERS, HttpURLConnection.HTTP_PRECON_FAILED, null, null);
this.accessCondition = AccessCondition.generateIfMatchCondition(this.parentFileRef.getProperties().getEtag()); this.accessCondition.setLeaseID(previousLeaseId);
this.accessCondition = AccessCondition.generateIfMatchCondition(this.parentFileRef.getProperties().getEtag()); this.accessCondition.setLeaseID(previousLeaseId);
file.create(1024); assertEquals(1024, file.getProperties().getLength()); assertNotNull(file.getProperties().getEtag()); GregorianCalendar now = new GregorianCalendar(); now.add(GregorianCalendar.MINUTE, 5); file2.downloadAttributes(); assertEquals(1024, file2.getProperties().getLength()); assertEquals(file.getProperties().getEtag(), file2.getProperties().getEtag()); assertEquals(file.getProperties().getLastModified(), file2.getProperties().getLastModified()); assertNull(file2.getProperties().getCacheControl());