Currently LAST_MODIFIED always equals to now() due to this string: objectMetadata.setLastModified(org.joda.time.DateTime.now().toDate)
It blocks any attempt to test Date-related testing. Fix for it is pretty simple:
override def putObject(bucket: String, key: String, data: Array[Byte], objectMetadata: ObjectMetadata): Unit = {
bucketDataStore.get(bucket) match {
case Some(bucketContent) =>
logger.debug(s"putting object for s3://$bucket/$key, bytes = ${data.length}")
Option(objectMetadata.getRawMetadataValue(Headers.LAST_MODIFIED)) match {
case Some(date) if date.isInstanceOf[Date] => bucketContent.keysInBucket.put(key,
KeyContents(DateTime(date.asInstanceOf[Date].getTime), data))
case None =>
bucketContent.keysInBucket.put(key, KeyContents(DateTime.now, data))
objectMetadata.setLastModified(org.joda.time.DateTime.now().toDate)
}
metadataStore.put(bucket, key, objectMetadata)
case None => throw NoSuchBucketException(bucket)
}
}
I am going to create PR for it if there are no additional suggestions.
Currently LAST_MODIFIED always equals to now() due to this string:
objectMetadata.setLastModified(org.joda.time.DateTime.now().toDate)
It blocks any attempt to test Date-related testing. Fix for it is pretty simple:I am going to create PR for it if there are no additional suggestions.
Thanks.