Commit Graph

692 Commits

Author SHA1 Message Date
Andrew Gaul 35f4f2bbf1 Use more unique names in containerDoesntExist
Previously this failed on AWS due to another container named
"forgetaboutit".
2016-03-27 13:48:42 -07:00
Andrew Gaul 2638ba4e69 Consistently quote ETags during comparison
Regression from e0a7ea7fdf.
2016-02-16 23:10:16 -08:00
Andrew Gaul 66609e6d70 JCLOUDS-651: Local blobstore support for conditional copies 2016-02-16 16:29:54 -08:00
Andrew Gaul 8945258d79 JCLOUDS-651: Portable support for conditional copies 2016-02-16 16:29:54 -08:00
Andrew Gaul 293d3f864e Convert CopyOptions into an AutoValue
This commit requires an interface change since AutoValue lacks support
for Optional and uses Nullable annotations instead.
2016-02-16 16:29:54 -08:00
Andrew Gaul a697396e8c Correctly remove prefix in DelimiterFilter
Previously this called String.replaceFirst which uses a regular
expression and incorrectly handles characters like *.  Also remove
other correct but unnecessary call to String.replaceFirst.
2016-02-09 10:48:01 -08:00
Andrew Gaul de333e8b3c Check Content-Length in local blobstore putBlob 2016-02-03 22:03:48 -08:00
quod3 77eef902b4 Use parseLong instead of parseInt in range parser
Use parseLong instead of parseInt when parsing open-ended byte ranges in LocalBlobStore. Without this fix, any "from byte x" or "to byte x" getBlob() call will throw a NumberFormatException if x is too big to fit into an int (2 GB).

Fixes https://issues.apache.org/jira/browse/JCLOUDS-1073
2016-01-30 20:11:07 -05:00
Andrew Gaul eb6f16e2f9 Enable CollectionIncompatibleType
Also suppress two false positives.
2016-01-29 08:50:09 -08:00
Andrew Gaul b6920ca44b JCLOUDS-1065: Deprecate inDirectory option
Superseded by prefix and delimiter support.
2016-01-28 22:59:12 -08:00
Andrew Gaul a3376d4efe Consistently implement domain object methods
Including equals, hashCode, and toString.
2016-01-24 21:58:39 -08:00
Andrew Gaul b50c518f7e Avoid sleeping in signed URL tests
Also bump expiration to a consistent 60 seconds.
2016-01-23 13:48:43 -08:00
Andrew Gaul b2c0786fc0 Enable range tests for azureblob 2016-01-23 12:38:50 -08:00
Andrew Gaul 52dc1a3ccf Add BaseBlobIntegrationTest.testSetBlobAccess
Similar to BaseContainerIntegrationTest.testSetContainerAccess.
2016-01-19 14:40:55 -08:00
Andrew Gaul 688890819e Fix replacing metadata in BaseBlobStore
Fixes Atmos errors.  Uncovered by removing unneeded addContentMetadata
call in BaseBlobIntegrationTest.testCopyBlobReplaceMetadata.
2016-01-15 13:22:15 -08:00
Andrew Gaul 5fd7b1aa78 JCLOUDS-948: Portable Cache-Control support 2016-01-15 04:41:01 -08:00
Andrew Gaul a90245afe5 Add marker and prefix to equals and toString 2016-01-11 19:18:14 -08:00
Andrew Gaul c0d72b6f53 JCLOUDS-844: Local blobstore putBlob ACLs 2015-12-22 00:46:33 -08:00
Andrew Gaul 86491bc607 JCLOUDS-844: Portable putBlob ACLs 2015-12-22 00:46:33 -08:00
Andrew Gaul 37f307ecd0 Skip testSetContainerAccess for local blobstores
These lack a public HTTP endpoint needed for this test.
2015-12-20 01:14:33 -08:00
Andrew Gaul 13701bf7ab Do not test marker contents
Some providers like Azure have opaque markers.
2015-12-19 15:24:12 -08:00
Andrew Gaul a7c66d5120 JCLOUDS-1042: Test reading from public container
Blob has default access but container is public-read.
2015-12-18 23:28:39 -08:00
Andrew Gaul 4abd5dd16f Revert "Delete parts when removing Swift multipart objects"
This reverts commit 3c1588527d.
2015-12-08 10:08:22 +08:00
Andrew Gaul 2dd231b02b Filter out folders when listing a container
These folders represent directories in the filesystem blobstore which
real blobstores do not have.  Their presence complicates providing the
correct marker for paginated listing.  Future commits will remove
folders entirely.
2015-11-20 16:27:53 -08:00
Andrew Gaul 4ce357ba69 Consistently quote ETags in comparisons
Addresses integration test regression in
25f4807df8.
2015-11-19 19:00:34 -08:00
Andrew Gaul 25f4807df8 Tolerate missing or extra quotes in ETags
References andrewgaul/s3proxy#77.
2015-11-19 17:40:48 -08:00
Andrew Gaul 8d87bfc61b Avoid buffering ByteSource when not needed
This allows range requests of large files to work.  Regression from
79fe91bd03.
2015-11-19 15:10:23 -08:00
Andrew Gaul 3c1588527d Delete parts when removing Swift multipart objects
Swift implements multi-part upload with user-visible parts and an
explicit manifest.  When deleting an MPU blob it can delete only the
manifest or both the manifest and parts.  For consistency with other
providers, we now do the latter in the portable abstraction.  Swift
ignores the multipart-manifest=delete parameter for single-part
objects.  Fixes andrewgaul/s3proxy#92.
2015-11-17 23:06:33 -08:00
Zack Shoylev 41ce90ec36 Fixes tests failing on windows filesystems Makes windows behavior more consistent, especially for deletes 2015-11-11 21:01:13 -06:00
Andrew Gaul e0c959c212 Pagination for listing LocalBlobStore MPU parts 2015-10-20 14:01:32 -07:00
Timur Alperovich aaa164179c JCLOUDS-217: Percent encoding changes.
jclouds should not check if the string is encoded, but rather expect
that all strings would be encoded prior to transmission. As part of
that change, we must make sure that no code relies on such behavior
within jclouds. This commit adds a blobstore test to check encoding
pattern for blobs. It also removes the encoding check in the Strings2
class and the related test.
2015-09-08 15:12:14 -07:00
Oliver Gondža edde721937 JCLOUDS-962: Make all @Provider methods final 2015-09-02 23:54:44 +02:00
Timur Alperovich 3757a64abf JCLOUDS-992: LocalBlobStore - use FOLDER for DIR.
Changed the LocalBlobStore to use FOLDER, as opposed to RELATIVE_PATH
when creating directories. Changed the delete keys strategy to treat
FOLDER blobs as regular blobs.
2015-08-20 12:42:11 -07:00
Timur Alperovich 0c5a3db9df JCLOUDS-992: remove special directory handling. 2015-08-20 12:42:11 -07:00
Timur Alperovich 42bfeccdfd Remove last marker test from ListContainerMarker.
Azure does not allow arbitrary marker specification and the generic
testListContainerMarker test should not assume that the behavior is
possible. There is already a separate test for such scenario that is
skipped on Azure.
2015-08-19 16:03:33 -07:00
Roman Coedo 53c3a4918a Fix LocalBlobStore 2015-08-06 09:43:33 -05:00
Roman Coedo 79fe91bd03 JCLOUDS-979: Fix range get for LocalBlobStore 2015-08-04 11:40:57 +02:00
Andrew Gaul 86f47394bf Correct FindBugs violations 2015-07-31 14:53:58 -07:00
Andrew Gaul 7e6284dd86 Add missing equals and hashCode methods
Possible cause of odd PageSet behavior.
2015-07-31 14:17:41 -07:00
Andrew Gaul 5ad245dea5 Do not buffer range get in LocalBlobStore
This avoids OutOfMemoryError with large blobs and enables offsets over
2 GB.
2015-07-27 18:02:54 -07:00
Ka-Hing Cheung 2c578d7bcb marker should be null when there are no more items 2015-07-21 15:46:58 -07:00
Timur Alperovich 19d54369db Propagate delimiter changes to LocalBlobStore.
Propagates the changes to add delimiter support to the local blob
store. The prefix option no longer works with the non-recursive
option. The caller _must_ set the delimiter option to enable the same
functionality.
2015-07-14 14:11:34 -07:00
Timur Alperovich e4161a59bb Move tests to test the file system API.
Move the prefix and delimiter tests from BaseContainerLiveTest to
BaseContainerIntegrationTest, as that class is subclassed in
Filesystem integration tests. This will make sure the file system blob
store will not regress.

The ListContainerTest is updated to _not_ use a file separator
character, as that leads to a possible creation of directories.
Instead, "-" is used as the delimiter for the delimiter option tests.
2015-07-14 14:11:34 -07:00
Timur Alperovich 613b6bf045 Add a test that sets delimiter and prefix.
Expands the delimiter tests to include a test that uses both prefix
and delimiter.
2015-07-14 14:11:34 -07:00
Timur Alperovich 4dc33ab564 JCLOUDS-929: Implement delimiter support in Local.
Adds the delimiter support in the local blob store. The existing
directory implementation is preserved and is not compatible with the
delimiter option, as the existing implementation assumes the usage of
filesystem directories.
2015-07-13 14:34:59 -07:00
Timur Alperovich a29d75a5d1 JCLOUDS-929: Implement generic delimiter support.
The patch adds delimiter option support in the generic blob store
interface. A live integration test is added to verify that jclouds
correctly lists objects separated by a delimiter.
2015-07-13 14:34:58 -07:00
Andrew Gaul 7d7deefb75 JCLOUDS-894: Handle part size when > maximum
Azure has a small part size that was not handled by the existing
logic.  This code is twisty and confusing and should be rewritten!
2015-07-09 18:00:37 -07:00
Zack Shoylev 65b7bdf282 Removes CopyObjectException in favor of jclouds-standard blobstore exceptions 2015-07-09 18:28:14 -05:00
Timur Alperovich 669feb4d0c LocalBlobStore: list marker blobs with delimiters.
When the delimiter option is specified, local blob store should behave
similarly to swift and return the directory marker blobs (directory
blobs) and the common prefix. This undoes the filtering we were
previously doing.
2015-07-07 18:00:31 -07:00
Timur Alperovich 6d27fbb18a JCLOUDS-930: Handle subdir entries correctly.
When listing blobs, Swift returns an array of "subdir" entries for
every common prefix. The openstack-swift provider needs to process
such entries and add them to the result set. The subdir array is an
array of strings, so additional metadata needs to be added to the
objects (bogus ETag, bogus LastModifiedDate, and so on).

When directory marker blobs are used, this means that potential _two_
entries are generated for every directory if:
1. the delimiter is set and matches the directory blob (e.g. dir/ and
   delimiter /)
2. there are objects under the directory name (e.g. dir/blob), which
   will result in results that include common prefixes (subdir)

In the above example, we should expect two results: "dir" and "dir/"
representing the directory marker blob and the common prefix,
respectively.

This is caught in the testDirectory integration test.

The patch changes the behavior of the Swift provider to correctly
handle the results in the subdir stanza and changes the test to expect
the directory marker to be returned in the list.
2015-07-07 17:55:50 -07:00
Timur Alperovich 03248b4c94 JCLOUDS-930: LocalStore -- fixup for prefixes.
When filtering results, we have to consider that a result was added to
the common prefixes list in its entirety (i.e. a directory). Such
results should be filtered out from the delimiter test.

An example that demonstrates this problem is if one creates a
directory "foo" and an object within it called "file". When listing
the results, they will include the directory object "foo" and the
object under "foo/file". During a non-recursive listing, we create a
list of common prefixes ("foo"). Subsequently, jclouds should remove
all objects that include the delimiter ("/"), however, that would not
apply to "foo". With the change to include the delimiter in the
listing, we need to be careful not to return two values "foo" and
"foo/".

A unit test for the local blob store to highlight this problem is
included. An integration test "testDirectory" also catches this issue.
2015-07-07 16:31:04 +02:00
Timur Alperovich 3009da3761 JCLOUDS-930: Expect a trailing "/" in tests.
We should expect a trailing prefix in delimiter tests, as the object
stores will return common prefixes up to and including the delimiter
character.
2015-07-07 16:30:59 +02:00
Timur Alperovich 14087e56bd Relax membership assertion for the prefix test.
Relaxes the membership check in prefix testing. The check is no longer
sensitive to ordering of the results, as different providers may
append, prepend, or insert in sorted order the relative prefixes.
2015-07-06 15:10:29 -07:00
Andrew Gaul bf93cadec6 Use correct default in testPublicAccess
Regression from d57b6e7b8f.
2015-07-02 16:25:49 -07:00
Andrew Gaul bc9cda2e37 JCLOUDS-930: Remove bogus dependsOnMethods 2015-07-02 16:21:03 -07:00
Andrew Gaul d109dd6326 Use prefix instead of marker to list MPU parts 2015-06-30 13:43:01 -07:00
Timur Alperovich aade18b76d JCLOUDS-930: LocalBlobStore -- marker regression.
We should not append a "/" to the marker when returning list results
in the case of directories (RELATIVE_PATH), as the names will already
include the delimiter.

Added a jclouds test to catch such regressions in the local store in
the future.
2015-06-30 08:46:46 -07:00
Timur Alperovich 8677ffcb21 JCLOUDS-930: Implement prefix for LocalBlobStore.
Implements prefix support for the local blob store. The patch allows
for correctly parsing prefixes that may not terminate with a delimiter
(i.e. foo with delimiter "/" and a key foobar/key, should return
foobar/ as the common path) and ones that do (i.e. foo/).

NOTE: there is a small change in behavior in this patch.
LocalBlobStore used to return the common prefixes without the
delimiter character ("/"). However, other providers do include the
delimiter (I checked S3 and Google Cloud Storage) and LocalBlobStore
should include it as well.
2015-06-29 17:31:55 -07:00
Timur Alperovich db4e4e5ba7 Factor out the common prefixes method.
Refactoring the code in the list() method to create a common
extractCommonPrefixes method.
2015-06-29 17:31:55 -07:00
Timur Alperovich 7c7d2e2df6 JCLOUDS-930: Add the prefix option.
Add a prefix option to the ListContainerOptions class.
2015-06-29 17:31:55 -07:00
Timur Alperovich e63474a824 JCLOUDS-931: Sleep only after creating containers.
jclouds should issue the requests to create all of the containers in
the container pool before sleeping. The patch modifies the
createContainerAndEnsureEmpty() method to take an additional
parameter, which specifies whether awaitConsistency() should be called
or not.
2015-06-26 14:04:43 -07:00
Ka-Hing Cheung 8b325d585e object stores typically sort the list of containers 2015-06-24 15:08:23 -07:00
Andrew Gaul d57b6e7b8f Use correct port in testPublicAccess
Also reduce timeout from 20 minutes to 1.
2015-06-24 14:51:16 -07:00
Iván López f155242838 Add missing value in Content-Range header
This is related with #776. It's necessary to add
the 'bytes' string before the bytes.
2015-06-19 08:24:18 +02:00
Andrew Gaul 3a410a25a8 Test for Content-Range header in single range get
Also emit this header in LocalBlobStore.
2015-06-17 11:43:17 -07:00
Andrew Gaul 1f7f8c8c86 Refine HTTP 416 into IllegalArgumentException
Providers yield different messages so remove parsing from test.  Also
narrow exception handling scope.TTP 416 into IllegalArgumentException

Providers yield different messages so remove parsing from test.  Also
narrow exception handling scope.
2015-06-16 21:47:30 -07:00
Andrew Gaul b0dfae1092 Use a configurable timeout for awaitConsistency
This allows setting to zero for strongly-consistency implementations
of s3 and swift stores.
2015-06-15 15:45:17 -07:00
Ka-Hing Cheung 6ed95d8968 fix range get for manifest object
swift doesn't return the etag if the client is doing a range
get of a manifest (SLO or DLO), this fixes SwiftObject so
etag is optional
2015-06-10 13:38:55 -07:00
Ka-Hing Cheung 23ef39416d use awaitConsistency in more places so provider can override it 2015-06-09 23:05:37 -07:00
Ka-Hing Cheung 140fb7ea7b fix multipart put of a blob with content md5
previously the parts will carry the content md5 of the entire
object, because unsetting the md5 of a ContentMetadata actually
didn't do anything
2015-06-09 22:59:30 -07:00
Ka-Hing Cheung 573ceb51c3 metadata and content metadata should have the same length
for range get in a LocalBlobStore, metadata.getSize() has the
original blob size and contentMetadata.getContentLength() has
the actual payload size. Other blobstores have the same size
in both
2015-06-08 14:28:16 -07:00
Andrew Gaul f14514c068 JCLOUDS-894: Add portable multipart upload
This unifies the provider multipart upload code paths and removes code
duplication.
2015-06-06 16:32:16 -07:00
Andrew Gaul 00734ee755 JCLOUDS-894: Move MultipartUploadSlicingAlgorithm to core 2015-06-06 16:32:16 -07:00
Ka-Hing Cheung 1ccdae46fa remove blob uri from transient blobstore
container may not be valid hostnames and the current blob uri
code can fail. there isn't really a way to use uri for transient
blobstore anyway, and removing it is the easier option. for
reference, filesystem blobstore also doesn't do this
2015-05-30 22:24:48 -07:00
Andrew Gaul f19853c278 Revert "metadata and content metadata should have the same length"
This reverts commit bbafc34d46.
2015-05-27 22:19:15 -07:00
Ka-Hing Cheung 1103a778d2 implemented some basic range validations in local blob store
also fixed a range get bug in local blob store
2015-05-27 16:30:05 -07:00
Ka-Hing Cheung bbafc34d46 metadata and content metadata should have the same length
for range get in a LocalBlobStore, metadata.getSize() has the
original blob size and contentMetadata.getContentLength() has
the actual payload size. Other blobstores have the same size
in both
2015-05-26 16:45:34 -07:00
Zack Shoylev f397bebeb2 JCLOUDS-894 Multipart upload code fixes for swift 2015-05-12 19:13:15 -05:00
Andrew Gaul b9c5b5b4e9 JCLOUDS-894: Expose local blobstore multipart operations 2015-05-01 13:07:23 -07:00
Andrew Gaul 71cdba1571 JCLOUDS-894: Expose multipart component operations 2015-05-01 13:07:23 -07:00
Andrew Gaul 40ba156937 JCLOUDS-651: portable copy object content metadata 2015-04-08 17:58:41 -07:00
Andrew Gaul b35295c238 JCLOUDS-651: Add @Beta annotations to copy methods 2015-04-08 17:12:51 -07:00
Ignasi Barrera b6fcac9667 JCLOUDS-651: Fix filesystem integration tests in OSX 2015-04-07 10:53:48 +02:00
Andrew Gaul d8f48c48b4 JCLOUDS-651: Copy Swift system metadata 2015-04-06 15:35:59 -07:00
Andrew Gaul a6a232a7a1 JCLOUDS-651: Ensure copy replaces user metadata
Some object stores have additive semantics for metadata.  As currently
implemented Azure, S3, and Swift consistently replace user metadata
but have different behavior for system metadata, e.g., Content-Type.
2015-04-03 17:50:33 -07:00
Andrew Gaul 3cf8abc22e JCLOUDS-651: Add copyBlob to portable abstraction
Some providers optimize this operation with a server-side copy.  Add a
fallback implementation which does a client-side copy.
2015-04-02 15:36:52 -07:00
Zack Shoylev 914ad04ae9 Fixes missing consistency waits in testDirectory 2015-04-02 17:14:40 -05:00
Andrew Gaul 279a984fee JCLOUDS-732: Transient portable object ACLs 2015-03-31 15:33:34 -07:00
Andrew Gaul a062bf841a JCLOUDS-660: Transient portable container ACLs 2015-03-31 15:33:33 -07:00
Andrew Gaul e7940d52f9 Add ReadOnlyBlobStore
This prohibits mutating operations.
2015-03-31 13:13:19 -07:00
Andrew Gaul 9d9acd1559 Add ForwardingBlobStore
Useful for implementing various facades: encryption, read-only, etc.
2015-03-31 13:13:19 -07:00
Ignasi Barrera f469cf8b51 Next development version 2.0.0-SNAPSHOT 2015-03-24 10:52:01 +01:00
Ignasi Barrera bb41ed4341 Apache jclouds 1.9.0 release 2015-03-24 10:35:42 +01:00
Andrew Gaul 9f93941525 Add content length to exception message 2015-03-02 16:51:59 -08:00
Ka-Hing Cheung a2ee7341e3 fix non-recursive list of dir with empty prefix 2015-02-23 17:52:42 -08:00
Andrew Gaul d8aea21f72 JCLOUDS-732: Local blobstore portable object ACLs
Intentionally unimplemented.
2015-02-21 10:28:02 -08:00
Andrew Gaul 49cd0aeba2 JCLOUDS-732: portable object ACLs 2015-02-21 10:28:01 -08:00
Andrew Gaul bc81919c58 Add @Beta annotations to BlobStore ACL methods
Also add missing @Override annotations.
2015-02-21 10:18:57 -08:00
Ka-Hing Cheung be7b9f4cc4 fix non-recursive list with empty prefix 2015-02-20 23:29:48 -08:00
Zack Shoylev 290a458e5e Fixes more timing issues in the BaseBlobIntegrationTest 2015-02-18 04:53:40 -06:00