Commit Graph

1626 Commits

Author SHA1 Message Date
Rita Zhang e65950b858 Add FalseOnNotFoundOr204 Fallback 2016-04-15 23:51:55 +02:00
Alex Heneveld 4ecb078092 JCLOUDS-1075: Clean up logic and docs for setting proxies 2016-02-08 19:12:04 -05:00
Andrew Gaul eb6f16e2f9 Enable CollectionIncompatibleType
Also suppress two false positives.
2016-01-29 08:50:09 -08:00
Andrew Gaul bcc06cc6ec Emit sensitive property name instead of constant
This makes more sense to users of external utilities like jclouds-cli.
2016-01-28 22:58:15 -08:00
Andrew Gaul 3872b57483 Remove userMetadata from equals and hashCode
This caused test failures, regression from
a3376d4efe.
2016-01-26 14:08:39 -08:00
Andrew Gaul a3376d4efe Consistently implement domain object methods
Including equals, hashCode, and toString.
2016-01-24 21:58:39 -08:00
Ignasi Barrera 40f31786c5 JCLOUDS-512: Implement the ImageCache
This commit refactors the ImageCacheSupplier to act as a
proper cache. It is used by the ImageExtesion and all operations
on the images are propagated to the cache.

A method has also been added to the TemplateBuilder to let users
force a cache refresh. There have been several requests to provide a way
to disable image caching in the compute abstraction, and this new method
should fix that.
2016-01-19 11:25:09 +01:00
Andrew Gaul 5fd7b1aa78 JCLOUDS-948: Portable Cache-Control support 2016-01-15 04:41:01 -08:00
Josef Cacek 0fb1b459a6 JCLOUDS-1044 fix handling NULL JsonTokens in adapters under NullFilteringTypeAdapterFactories class 2015-12-05 22:45:24 +01: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 df48540cb7 Enable FindBugs CheckRelaxingNullnessAnnotation
Also fix up warnings.
2015-11-13 17:44:55 -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
Timur Alperovich 1fc9b0e259 Move QueryParam encoding to a separate class.
The patch implements a QueryValue class, which encodes the underlying
value based on whether the "encoded" flag is set. This class is used
by the RestAnnotationProcessor to propagate the @Encoded value set on
any parameters.

Since the encoding is now handled by the QueryValue instances, we
should no longer call encodeQueryLine() in the URI builder and instead
call buildQueryLine(). The caveat is that we need to make sure all of
the parameters that may need to be encoded are converted to QueryValue
objects. This is done by converting Object instances to QueryValue by
an instance of the TransformObjectToQueryValue when adding any query
parameters to the URI.
2015-11-02 17:11:42 +01:00
Ignasi Barrera afd3c322a9 JCLOUDS-1030: Ignore synthetic members in serialization strategies 2015-10-28 23:15:41 +01:00
Ignasi Barrera 0a27a04888 Added RateLimit exception 2015-10-21 23:12:01 +02:00
Timur Alperovich 5bbcb8342f JCLOUDS-1008: Add @Encoded to @QueryParam.
Adds support for the @Encoded option for the @QueryParam annotation.
The @Encoded params are not encoded, while all parameters that don't
have it are encoded. The change applies to the @QueryParam annotation
on a single parameter. There is no way to express @Encoded on the list
of parameters and their values in @QueryParams.

The big change is that query parameter encoding is now handled within
the annotation processor, as opposed to relying on the UriBuilder to
perform the encoding. This is required since the UriBuilder does not
have any information about additional annotations associated with each
of the query parameters.

Also, adds unit tests for making sure keys and values are properly
encoded when using the @QueryParams option.
2015-10-21 00:06:23 +02:00
Timur Alperovich 94b3cba6c2 JCLOUDS-1008: Add @Encoded annotation.
Certain providers (e.g. Google Cloud Storage) place tokens that should
be encoded in the request path (e.g. GET
http://<host>/b/<bucket>/o/<object>) and expect them to be
percent-encoded. In the above example a GET request for "foo/bar"
should be translated to http://<host>/b/<bucket>/o/foo%2Fbar.
Currently, there is no way to express this in jclouds, as the entire
request path is encoded exactly once and there is no control over
whether a request parameter should be handled specially. In the
example above, "/" are not encoded in the path and the URL is
submitted as "http://<host>/b/<bucket>/o/foo/bar", which may be wrong.

This patch extends the annotation processor to support @Encoded for
the individual parameters of the request. However, this means that the
entire path is _NOT_ URL encoded. The caller *must* make sure that the
appropriate parameters are encoded -- ones that are marked with the
@Encoded annotation. Parameters not marked with the @Encoded
annotation are URI encoded prior to being added to the path. This
means that "/" characters will also be URI encoded in this case (i.e.
"foo/bar" is turned into "foo%2Fbar").

For the Google Storage provider, we will annotate the parameters that
are going to be pre-encoded (object names) and ensure the provider
encodes them prior to calling the API (separate patch in
jclouds-labs-google).
2015-10-21 00:06:15 +02:00
Ignasi Barrera 07e64a2d07 Allow to globally configure the 'Connection: close' header 2015-10-02 15:44:24 +02:00
Timur Alperovich 075c912d87 JCLOUDS-217: Do not decode query strings.
jclouds should not decode query strings that are passed to create HTTP
requests. This is problematic because in some cases a wrong request
may be generated. The most obvious example is if one passes the "+"
character. For example, the following query parameter: "users=me+you"
is stored by the URI builder as "me you" and subsequently appears in
the request as "users=me%20you", as opposed to "users=me%2Byou" (%2b
is percent encoding for "+").

This is not currently a problem because jclouds relies on the
isUrlEncoded() method to check if a query parameter should be decoded
and the situation above is avoided.

This PR attempts to suggest an alternative (and what I believe is
simpler) approach: on the path of crafting requests, jclouds should
only *encode*, not decode strings. Specifically, jclouds should
_never_ be in a situation where it relies on the isUrlEncoded()
method.
2015-09-17 13:08:44 -07:00
Timur Alperovich a0b95ea7a3 JCLOUDS-217: Fix encoding handling in S3.
When constructing the query path, S3 does not properly handle encoded
paths. For example, if a blob named %20 is to be placed into the blob
store, S3 would end up placing blob named " " (what %20 represents).
This occurs because the S3 provider examines the URI's path portion
(which is presented in a decoded fasion to the caller). After
examining the path, it is not encoded again. Instead, we should call
getRawPath() to avoid this issue.

There are two issues on the decoding path:
1. Given a blob named " ", S3 API will throw a RuntimeException due to
a NULL check -- the key that it uses is NULL to represent the XML
content " " corresponding to the blob name.
2. Given a blob named "%20 ", S3 API will generate a URI for a blob
named "%20%20", which is also incorrect. The correct URI would be
"%2520%20" (escaping the first "%" and " " characters).

The first issue is due to the currentOrNull() helper, which calls
trim() on the string and then compares the string to an empty string.
This means that a blob named " " will be parsed as "" and then
converted to NULL as the result of that method. Passing "null" as the
key then fails in a number of places (notably, appendPath()).

The second issue is due to the appendPath() method in the jclouds Uris
class. The issue here is that appendPath() calls urlDecode() and
passes the result to path(). The path() method, in turn, also calls
urlDecode(). After these transformations, a properly encoded blob of
the form %2520%20 turns into "%20 " and then "  " (two spaces). After
these transformations the path is encoded again, resulting in "%20%20"
(which is wrong).
2015-09-08 15:19:02 -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
Oliver Gondža 6cd716f1ea JCLOUDS-962: Do not override provider methods 2015-09-02 23:54:44 +02:00
Andrew Gaul 62f088cf14 JCLOUDS-974: Upgrade to GSON 2.3.1
This may resolve issues with older versions of Maven.  Release notes:

https://sites.google.com/site/gson/gson-roadmap
2015-08-04 11:09:28 -07:00
Andrew Gaul 86f47394bf Correct FindBugs violations 2015-07-31 14:53:58 -07:00
Arvind Nadendla ba55ab4b12 Fix bug where password information is printed in logs in case of exceptions 2015-07-30 12:16:16 -05:00
Andrea Turli 7480d6e363 replace ExpectTests with MockWebServerTests
refactor AccountApiExpectedTest to AccountApiMockTest
refactor DatacenterApiExpectTest to DatacenterApiMockTest
refactor SoftwareDescriptionApiExpectTest to SoftwareDescriptionApiMockTest
refactor VirtualGuestApiExpectTest to VirtualGuestApiMockTest
refactor VirtualGuestBlockDeviceTemplateGroupApiExpectTest to VirtualGuestBlockDeviceTemplateGroupApiMockTest
2015-06-25 00:03:47 +02: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
Andrew Gaul c22afc5a55 Revert "tighten the isUrlEncoded check"
This reverts commit 82ab88d589.
2015-05-27 17:46:24 -07:00
Ka-Hing Cheung 82ab88d589 tighten the isUrlEncoded check
ideally we shouldn't need this function and instead never double
encode strings, but auditing for that is beyond what I have time
for. currently, putBlob(" ") and putBlob("%20") behave the same
way which is arguably incorrect
2015-05-27 16:48:30 -07:00
Andrew Gaul ff1f2c01ef JCLOUDS-912: Implement RandomInputStream.close
Prevent reading closed RandomInputStream.
2015-05-25 22:26:09 -07:00
Zack Shoylev 6fa59ca22d Upgrade to autovalue 1.1; Adds autovalue/gson builders tests 2015-05-21 16:26:11 -05:00
Ignasi Barrera 7053a7870d JCLOUDS-897: Remove the Rocoto dependency 2015-05-21 00:26:57 +02:00
Svetoslav Neykov d4fa1159ac Don't retry unsafe HTTP methods in case of an IOException
If an IOException is thrown during the execution of an HttpCommand retry only if the HTTP method is idempotent (i.e. GET, DELETE, PUT). Otherwise the retry could cause unwanted side effects (i.e. creating and leaking multiple new nodes).
2015-05-13 22:01:00 +02:00
Andrew Gaul 6a7a52642a Convert Windows to Unix line endings
Converted with:

mvn checkstyle:checkstyle --quiet -Dcheckstyle.output.file=/dev/stdout -Dcheckstyle.output.format=plain | grep warn | cut -f1 -d: | uniq | xargs -n 1 dos2unix
2015-03-31 18:25:54 -07:00
Andrew Gaul 77d846c5ff Remove unused import 2015-03-30 20:57:59 -07:00
Andrew Gaul 4f566d3b6e Address and suppress FindBugs warnings 2015-03-30 20:40:10 -07:00
Andrew Gaul db5acb8588 Fix error-prone DepAnn 2015-03-30 19:06:48 -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
Ignasi Barrera 4db2b75add Fixes OpenStack extension namespace configuration
* Improves extension namespace configuration to use Guice multibindings
  so each provider can cleanly provide their own namespaces.
* Fixes the HPCloud Compute volume attachment namespace and adds the
  corresponding live tests.
* Fixes the Rackspace CloudServers UK volume attachment namespace.
2015-03-23 22:40:43 +01:00
Zack Shoylev 8217248571 Adds a rackspace-specific test and a fix for the volume-attach extension problem. 2015-03-20 11:41:24 -05:00
Ignasi Barrera ec63b55a04 JCLOUDS-532: Properly close HTTP streams 2015-03-10 21:28:14 +01:00
Zack Shoylev fb1f3b9dfd Adds additional details to the jclouds log error message. 2015-02-26 15:01:24 -06:00
Ignasi Barrera acd06b3024 JCLOUDS-462: Fix AWSEC2TemplateBuilderLiveTest 2015-02-04 11:04:18 +01:00
Aled Sage 55f7e48d89 Fix/improve retry-predicate:
- If get timeout of 0 (or negative), then still try once.
- Remove (unlikely) race in retry’s apply(T) where context-switching
  delays could cause `before(end)` to return false the first time, even
  though the timeout was positive.
- Ensure retries at end of the timeout (e.g. if timeout is 30 secs
  and last sleep takes us up to the 30 secs mark, then test again
  rather than returning immediately after the sleep!)
- Use `long` for time, rather than `java.util.Date`, for internal
  calculations. Deprecates old protected methods that use Date.
2015-01-30 11:07:25 +01:00
Zack Shoylev 46f4a4e454 More robust line-ending detection for Bundles 2015-01-22 12:45:54 -06:00
Zack Shoylev f5523c9412 Fixes the exponential backoff for small delay values 2015-01-21 16:50:01 -06:00
Andrew Gaul e183d9e651 Add ByteSourcePayloadIterator to BasePayloadSlicer
ByteSourcePayloadIterator avoids buffering the entire slice like
InputStreamPayloadIterator does.  Also rename PayloadIterator to
better reflect its intent and reduce its visibility.
2015-01-09 22:19:24 -08:00
Jeremy Daggett d3c1e2eab4 Use AutoService to generate service loader metadata 2015-01-09 11:22:12 -08:00
Andrew Gaul d5fadb598e Implement read(byte[]) with read() for consistency
Previously multiple calls to read() returned different results than a
single call to read(byte[]).
2014-12-30 17:37:26 -08:00
Ignasi Barrera 958d09ecbd JCLOUDS-753: Make ConnectionSpec configurable in the OkHttp driver 2014-12-02 18:17:17 +01:00
Ignasi Barrera 902f1b4105 JCLOUDS-744: Upgrade to OkHttp 2.1.0 and use its native API 2014-11-27 18:44:08 +01:00
Adrian Cole a449b24e7d JCLOUDS-480 support version 4 signatures for aws-ec2. 2014-11-22 08:08:37 -08:00
Adrian Cole 6f974f34b5 JCLOUDS-780 Remove vcloud. 2014-11-17 08:18:39 -08:00
Adrian Cole d8cb6958f0 JCLOUDS-774 cleanup derived location suppliers and backfill test for inconsistent region and zone mappings. 2014-11-16 13:38:48 -08:00
Adrian Cole 90a6bb19f4 Finished partial fix in 91f405c9fe. 2014-11-16 10:37:31 -08:00
Zack Shoylev 91f405c9fe Small cleanup of how RegionToEndpoint checks arguments. 2014-11-13 04:37:07 -06:00
Adrian Cole 4b3fa75a68 Implicitly create a json response parser when using @Transform. 2014-11-10 06:57:45 -08:00
Adrian Cole d8d7b130a3 fixed javadoc typo. 2014-11-02 08:14:45 -08:00
Adrian Cole 45fd59f4b7 JCLOUDS-750 Revert 5b6f1e929e in favor of tighter contract on @SerializedNames. 2014-11-01 10:56:04 -07:00
Adrian Cole 1e35c0fe19 Use type adapter factory to hard-set serialization of Credentials. 2014-10-30 10:02:27 -07:00
Adrian Cole e21cbd09cb JCLOUDS-750 support serializing auto-value types without custom type adapters. 2014-10-30 07:19:01 -07:00
Adrian Cole 0012e6f950 JCLOUDS-534 Avoid runtime incompatibility introduced by Guava's closeQuietly. 2014-10-29 17:01:26 -07:00
Adrian Cole 02801321a2 JCLOUDS-410 note that ByteArrayPayload needs to handle offsets. 2014-10-29 10:20:39 -07:00
Adrian Cole 177fd6d37f Do not require Guava ByteSource in order to create a payload. 2014-10-29 10:20:39 -07:00
Adrian Cole 035d9d1ed7 Revert "Remove ByteArrayPayload"
This reverts commit ac22383648.
2014-10-29 10:20:39 -07:00
Adrian Cole 1702bddffa Revert "Replace uses of ByteArrayPayload"
This reverts commit bd5b6853ee.
2014-10-29 10:20:38 -07:00
Andrew Phillips ae8b7636df Moving Guava version config into <dependencyManagement>
- Follow-up to c426e7e: allows overriding of the Guava version
  in modules that inherit from core
- Also consolidating dependency versions
2014-10-28 23:16:19 -04:00
Adrian Cole c50e32c116 Accidentally set limited json fallback field naming to an enum. 2014-10-28 00:19:58 -07:00
Andrew Phillips 2a5928b55d Re-adding Reflection2.constructor
Removed in 671749d but used downstream in jclouds-labs
2014-10-26 19:18:39 -04:00
Andrew Phillips c426e7ec24 Extracting Guava version into a property
This allows it to be overridden in CI jobs etc.
2014-10-26 18:31:37 -04:00
Adrian Cole c0e6a2c51c Fixed bug found in docker provider where deserialization constructors don't handle json null. 2014-10-26 12:31:06 -07:00
Adrian Cole 5b6f1e929e JCLOUDS-750 allow apis to bind FieldNamingPolicy, which controls fallback naming policy of serialized fields. 2014-10-26 12:31:06 -07:00
Adrian Cole 0b88dadb8f JCLOUDS-750 Added @SerializedNames which can apply to either a constructor or factory method to capture the corresponding json field names.
Removed wildly confusing mixed naming of constructor params feature.
2014-10-26 12:31:05 -07:00
Adrian Cole 671749d6b7 JCLOUDS-750 Allow abstract value types to be constructed from json using static factory methods. 2014-10-26 12:31:05 -07:00
Adrian Cole f3f8f0e010 JCLOUDS-264 Conditionally allow default http driver to support sending >2GB payloads without chunked encoding. 2014-10-25 10:29:09 -07:00
Adrian Cole 99d54c6631 Revert "JCLOUDS-264: Allow payloads greater than 2 GB"
This reverts commit 7e4cacf9ea.
2014-10-25 10:28:56 -07:00
Adrian Cole 0785d80827 Revert "Remove Java 6 litter"
This reverts commit a10bf3e9c5.
2014-10-25 10:28:46 -07:00
Adrian Cole 0a801d2ad2 Revert "JCLOUDS-652: Require JDK 7"
This reverts commit 5e8bd02c93.
2014-10-25 10:28:34 -07:00
Adrian Cole 0339cd2fd0 JCLOUDS-653 revert guava 18. 2014-10-24 10:46:09 -07:00
Adrian Cole 3980cd791b Revert "JCLOUDS-653: Address Guava 18 deprecations"
This reverts commit 95cfc0d950.

Many conflicts due to duration between above commit and now
2014-10-24 10:45:58 -07:00
Andrew Gaul 489850d7db Fix GuiceAssistedInjectScoping error-prone warning 2014-10-12 15:47:30 -07:00
Adrian Cole d735a9fa21 JCLOUDS-40 clear remaining references to Async. 2014-10-12 09:05:35 -07:00
Adrian Cole b9525a0877 JCLOUDS-40 unasync Fallback 2014-10-06 13:14:59 -07:00
Adrian Cole 0a236f59ad JCLOUDS-153 remove IO Executor and usage of it. 2014-10-06 07:56:31 -07:00
Adrian Cole c349753624 JCLOUDS-152 remove RestContext and its dependencies. 2014-10-05 22:32:55 -07:00
Adrian Cole 99e217b720 Move off confusing test names. 2014-10-05 17:22:18 -07:00
Adrian Cole 1a54f0fb09 JCLOUDS-153 Remove deprecated ExecutorService and HttpAsyncClient accessors. 2014-10-05 16:16:28 -07:00
Andrew Gaul 2d70087bfa Add modernizer-maven-plugin to build
This plugin finds uses of legacy APIs:

https://github.com/andrewgaul/modernizer-maven-plugin
2014-09-22 21:57:55 -07:00
Andrew Gaul dc3011469b Prefer Charsets.UTF_8 over string literal
Found with modernizer-maven-plugin.
2014-09-20 18:31:24 -07:00
Jeremy Daggett 9f0b86ec1a JCLOUDS-719: Updgrade to Gson 2.3 2014-09-17 08:52:24 -07:00
Andrew Gaul ac22383648 Remove ByteArrayPayload
Callers should use ByteSourcePayload instead.
2014-09-07 07:43:14 -07:00
Andrew Gaul bd5b6853ee Replace uses of ByteArrayPayload
Prefer ByteSourcePayload which offers a superset of its functionality.
Note that ByteArrayPayload implicitly set the contentLength while
users of ByteSourcePayload must do so explicitly.
2014-09-07 07:43:14 -07:00
Andrew Gaul a4bc36dafa Add PayloadEnclosing.setPayload(ByteSource) 2014-09-06 22:27:22 -07:00
Andrew Gaul e1a5c521c5 Improve XML compatibility with trace-level logging
Some providers, notably Azure, include a byte-order mark in their XML
responses.  ParseSax.apply buffers these responses in a String when
users enable trace-level logging to include the response in any thrown
exceptions.  InputSource(InputStream) skips these byte-order marks
while InputSource(Reader) does not, yielding a SAXParseException.
2014-09-05 17:53:50 -07:00
Andrew Gaul 58438d7d1e Address Checkstyle violations 2014-09-04 17:24:27 -07:00
Andrew Gaul 0b89b1fd10 Ensure that Content-MD5 has 128 bits
Update many tests Content-MD5 headers and ETag responses.
2014-09-04 16:57:48 -07:00
Andrew Gaul 8613967820 Remove ByteStreams2.asByteSource
This method is dangerous since all ByteSource should provide a new
InputStream on every call to openStream while the method returns the
same InputStream for non-repeatable Payloads.
2014-09-04 16:55:55 -07:00
Andrew Gaul 34cfdbe266 Enforce Override annotation via Checkstyle
Also remove bogus inheritDoc on base and static methods.
2014-08-31 19:37:50 -07:00
Andrew Gaul 5399cb6877 Avoid unnecessary boxing
Found with FindBugs.
2014-08-30 14:30:47 -07:00
Andrew Gaul 1b824afbfc Remove redundant modifiers from interfaces 2014-08-26 17:34:13 -07:00
Andrew Gaul 74fb8f0183 Add whitespace after semicolons
Also correct some bad line-wrapping.
2014-08-26 11:06:00 -07:00
Andrew Gaul 614f5194ef JCLOUDS-653: Upgrade to Guava 18.0
Release notes:

https://code.google.com/p/guava-libraries/wiki/Release18
2014-08-25 17:47:23 -07:00
Jeremy Daggett e711275fb1 Prefer isEmpty() for collections rather than size() 2014-08-20 11:07:48 -07:00
Jeremy Daggett 744cd5d7eb Prefer Regions to Zones in OpenStack APIs 2014-08-13 09:58:53 -07:00
Andrew Gaul 9009bb5268 JCLOUDS-658: use xattr only on supported systems
Mac OS X HFS+ does not support UserDefinedFileAttributeView:

https://bugs.openjdk.java.net/browse/JDK-8030048
2014-08-12 12:30:06 -07:00
Andrew Gaul f236e046e3 Merge identical tests 2014-08-11 12:45:28 -07:00
Andrew Gaul a10bf3e9c5 Remove Java 6 litter 2014-08-11 12:45:27 -07:00
Andrew Phillips a6412ad66b Addressing Checkstyle violation
Introduced in 7e4cacf
2014-08-09 09:12:43 -04:00
Andrew Gaul 7e4cacf9ea JCLOUDS-264: Allow payloads greater than 2 GB
Enabled by JDK 7.
2014-08-09 00:28:49 -07:00
Andrew Gaul 80a0256cc7 JCLOUDS-622: Remove last vestiges of InputSupplier
Guava 16 deprecated InputSupplier and a future release will remove it.
2014-08-08 15:40:33 -07:00
Andrew Gaul b219208d6c JCLOUDS-653: correct mock expectation 2014-08-08 15:21:58 -07:00
Andrew Gaul 95cfc0d950 JCLOUDS-653: Address Guava 18 deprecations
Mostly renaming Objects.toStringHelper to MoreObjects.toStringHelper.
2014-08-08 11:12:21 -07:00
Andrew Gaul f26431b3e7 JCLOUDS-653: Upgrade to Guava 18.0-rc1
Release notes:

https://code.google.com/p/guava-libraries/wiki/Release18
2014-08-08 11:08:09 -07:00
Andrew Gaul 59462747e7 Reset StringBuilder instead of creating new ones
This avoids unneeded garbage, especially during XML parsing.  Replaced
with:

find -name \*.java | xargs sed -i 's/^\( *[^ ]*\) = new StringBuilder();$/\1.setLength(0);/'
2014-08-06 11:22:49 -07:00
Andrew Gaul 9e9acf1f3e Address Checkstyle violations 2014-08-05 17:13:29 -07:00
Andrew Phillips e3d9851216 Up to 2.0.0-SNAPSHOT after the 1.8.0 release 2014-08-05 09:10:24 +02:00
Zack Shoylev 231a60675e Adds support for ImmutableMap in jclouds gson 2014-07-29 12:36:53 -05:00
Andrew Phillips eba727fef7 'iso8601DateParseWithOptionalTZ' -> 'iso8601DateOrSecondsDateParse' in DateService
Follow-up to d57bbebe
2014-07-28 12:20:49 -04:00
Shri Javadekar d57bbebe7e Try iso8601SecondsDateParse if iso8601DateParse fails.
S3 compatible blobStores sometimes return date in the format:
"2014-07-23T20:53:17+0000" instead of the more common
"2014-07-23T18:09:39.944Z". This caused jclouds to barf with an
IllegalArgumentException.

This commit tries to parse both the formats for S3. The exception
is thrown if both fail.

Added unit tests for the same.
2014-07-26 22:19:54 -07:00
Andrew Gaul 5c8bdcdfbb Remove ByteSources.asByteSource
This method breaks the contract of ByteSource which specifies that
openStream can produce multiple independent streams.
2014-07-24 13:02:13 -07:00
Andrew Gaul f17c876d8d Replace const.txt file input with synthetic inputs
This commit replaces file resource-based test inputs with in-memory
equivalents.  This is more consistent and efficient than the previous
approach.  Also resized some test inputs to be partSize + 1 instead of
2 * partSize.  Tested against aws-s3, blobstore, core, cloudfiles-us,
and filesystem.
2014-07-19 18:35:25 -07:00
Andrew Gaul 0df905a870 JCLOUDS-622: add Strings2.toString(InputSupplier)
We did not deprecate this in 1.7.x as previously thought.
2014-07-18 21:48:08 -07:00
Aled Sage 1fb286809e JCLOUDS-549: Fix NPE in LoginCredentials.toString
- also deprecates LoginCredentails.get(Password|PrivateKey)
- use getOptionalPassword and getOptionalPrivateKey instead
2014-07-18 14:09:18 +01:00
Andrew Gaul fb60d76704 JCLOUDS-622: Remove most vestiges of InputSupplier
Guava 16 deprecated InputSupplier and a future release will remove it.
2014-07-16 16:07:59 -07:00
Andrew Gaul a8b106c2bb JCLOUDS-622: remove calls to InputSupplier methods
Guava 16 deprecated these methods and Guava 18 will remove them.
2014-07-15 03:09:58 -07:00
Andrew Gaul bdb5cbcbe7 Improve use of ByteSource with test resources
This commit ensures proper resource cleanup, simplifies
initialization, and paves the way for purely synthetic inputs in a
subsequent commit.
2014-07-11 09:10:51 -07:00
Andrew Gaul de68449cde JCLOUDS-622: Deprecate Strings2.toString
Guava 16 deprecated InputSupplier.
2014-07-10 23:32:41 -07:00
Andrew Gaul 1d218b1705 JCLOUDS-417: Test closing a stream w/o reading it 2014-07-10 20:59:10 -07:00
Tom Manville afc0ca557d JCLOUDS-417: Remove ConsumeOnCloseInputStream
ConsumeOnCloseInputStream can potentially perform a copy in finalize()
if the stream was not closed properly.
2014-07-10 20:59:09 -07:00
Andrew Gaul 66dab8d96e JCLOUDS-410: Remove InputStreamSupplierPayload
ByteSourcePayload replaces this.  jclouds 1.7 deprecated
InputStreamSupplierPayload and Guava 16 deprecated InputSupplier
itself.
2014-07-10 20:43:08 -07:00
Andrew Gaul 66307d9816 Use consistent stage for the two-stage injection 2014-07-07 23:36:53 -07:00
Andrew Gaul 3fdb6d2e91 Avoid extra copy with Splitter result 2014-07-07 23:36:22 -07:00
Christopher Dancy 3659a5f583 JCLOUDS-607: ComputeService.createNodesInGroup throws NPE on FloatingIPApi.create() 2014-07-07 19:46:54 -04:00
Andrew Gaul f5244884a5 Avoid impossible UnsupportedEncodingException 2014-07-02 17:30:09 -07:00
Andrew Gaul d43c3ea3e0 Handle short reads in BasePayloadSlicer
InputStream.read(byte[]) can return fewer bytes than requested.
Specifically ByteSource.concat(ByteSource...).openStream() will only
return as many bytes as the current ByteSource contains.  Thus
ByteSources.repeatingArrayByteSource(byte[]).openStream() will return
short reads despite the byte[] input from its single logical
InputStream.
2014-07-02 15:13:20 -07:00
Ignasi Barrera b9029ea7a6 JCLOUDS-617: Use the configured JCE provider in the Cipher payloads 2014-07-02 00:27:08 +02:00
Andrew Gaul 77eff6fffb Close InputStream after use
Found with Kohsuke's file-leak-detector.
2014-06-30 18:26:55 -07:00
Andrew Gaul 8fa209b15e Use more specific testng asserts where possible
These asserts yield more informative error messages.  Found with:

grep -rI 'assertTrue(.* =='
grep -rI 'assertTrue(.* !='
grep -rI 'assertTrue(.*\.equals('
2014-06-24 13:54:01 -07:00
Andrew Gaul 5b5e713cba Avoid unnecessary object creation
Prefer StringBuffer.append(string, index1, index2) over
StringBuffer.append(String.substring(index1, index2).
2014-06-24 13:15:18 -07:00
Andrew Gaul e799a7409c JCLOUDS-597: HashCode methods for Content-MD5
This works more naturally with Guava Hashing methods and immutability
provides better safety guarantees.  Also deprecate existing byte[]
methods.
2014-06-12 15:29:17 -07:00
Jeremy Daggett 446671a2a7 Improve readability of expect test output 2014-06-11 15:35:45 -05:00
Andrew Gaul 9cdd53b0b7 JCLOUDS-546: Remove Javadoc @author annotations
Annotations removed with:

find -name \*.java | xargs sed -i /@author/d

Empty Javadoc removed with multiple iterations of:

find -name \*.java | xargs sed -i -z 's/ \*\n \*\// \*\//'
find -name \*.java | xargs sed -i -z 's/ \* \n \*\// \*\//'
find -name \*.java | xargs sed -i -z 's/\/\*\*\n \*\/\n//'
2014-06-07 21:44:54 -07:00
Andrew Gaul 2342abd3c5 Address Checkstyle violations 2014-05-30 11:10:14 -07:00
Andrew Gaul 186f052022 Remove BlobBuilder and Payloads.calculateMD5
Callers should instead explicitly set contentMD5, usually with the
results from Guava Hashing.md5(). This narrows the API and removes a
strange IOException from callers.  Further it removes a dangerous
rebuffering of arbitrarily-large non-repeatable Payloads.
2014-05-28 12:54:18 -07:00
Andrew Gaul bae4377dca Prefer File.delete over File.deleteOnExit
The former has deterministic behavior and avoids resource leaks.
2014-05-23 16:17:10 -07:00
Andrew Gaul 26b53e52b7 Use ByteSource methods to create test input
Also avoids excessive system calls due to unbuffered writes.  Finally
migrate repeatingArrayByteSource to ByteSources.
2014-05-22 10:43:57 -07:00
Andrew Gaul 4c265d3168 Prefer Guava Hashing over MessageDigest 2014-05-22 09:40:06 -07:00
Andrew Gaul 644fbf2052 Prefer ByteStreams over ByteArrayOutputStream 2014-05-22 00:40:21 -07:00