Skip to content

Commit 58dcd83

Browse files
authored
Merge pull request #505 from rpmoore/v3_5_1
Merging the Java8 changes into the 3.5 branch
2 parents 1c76266 + c84066f commit 58dcd83

File tree

40 files changed

+466
-225
lines changed

40 files changed

+466
-225
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
language: java
22
jdk:
33
- oraclejdk8
4-
- oraclejdk7
5-
- openjdk7
64
script: ./gradlew -S clean jar ds3-sdk:test ds3-utils:test ds3-metadata:test

build.gradle

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,45 +13,61 @@
1313
* ****************************************************************************
1414
*/
1515

16+
buildscript {
17+
ext.kotlin_version = '1.1.4-2'
18+
19+
repositories {
20+
mavenCentral()
21+
}
22+
23+
dependencies {
24+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
25+
}
26+
}
27+
28+
1629
allprojects {
1730
group = 'com.spectralogic.ds3'
18-
version = '3.5.1'
31+
version = '3.5.2'
1932
}
2033

2134
subprojects {
2235
apply plugin: 'maven'
2336
apply plugin: 'java'
37+
apply plugin: 'kotlin'
2438
apply plugin: 'findbugs'
2539

26-
sourceCompatibility = JavaVersion.VERSION_1_7
40+
sourceCompatibility = JavaVersion.VERSION_1_8
2741
repositories {
2842
mavenCentral()
2943
mavenLocal()
3044
}
3145

3246
dependencies {
33-
compile 'org.slf4j:slf4j-api:1.7.22'
34-
testCompile ('org.mockito:mockito-core:1.10.19') {
47+
compile "org.slf4j:slf4j-api:$slf4jVersion"
48+
testCompile ("org.mockito:mockito-core:$mockitoVersion") {
3549
exclude group: 'org.hamcrest'
3650
}
3751

38-
testCompile 'junit:junit:4.12'
39-
testCompile 'org.slf4j:slf4j-simple:1.7.22'
52+
testCompile "junit:junit:$junitVersion"
53+
testCompile "org.slf4j:slf4j-simple:$slf4jVersion"
4054
}
4155
}
4256

4357
task wrapper(type: Wrapper) {
44-
gradleVersion = '3.5'
58+
gradleVersion = '4.1'
4559
}
4660

4761
project(':ds3-sdk') {
4862
dependencies {
63+
compile project(':ds3-interfaces')
4964
compile project(':ds3-utils')
5065
}
5166
}
5267

5368
project(':ds3-metadata') {
5469
dependencies {
70+
compile project(':ds3-interfaces')
5571
compile project(':ds3-utils')
5672
}
5773
}

ds3-metadata/build.gradle

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
buildscript {
1717
repositories { jcenter() }
1818
dependencies {
19-
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
19+
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1'
2020
}
2121
}
2222

@@ -26,14 +26,19 @@ shadowJar {
2626
relocate 'org.apache', 'ds3metafatjar.org.apache'
2727
relocate 'com.google', 'ds3metafatjar.com.google'
2828
relocate 'com.sun.jna', 'ds3metafatjar.net.java.dev.jna'
29+
relocate 'org.jetbrains', 'ds3metafatjar.org.jetbrains'
30+
relocate 'org.intellij', 'ds3metafatjar.org.intellij'
31+
relocate 'org.codehaus', 'ds3metafatjar.org.codehaus'
2932

3033
dependencies {
31-
exclude(dependency('org.hamcrest:hamcrest-library:1.3'))
32-
exclude(dependency('org.mockito:mockito-core:1.10.19'))
33-
exclude(dependency('junit:junit:4.12'))
34-
exclude(dependency('org.slf4j:slf4j-api:1.7.22'))
35-
exclude(dependency('org.slf4j:slf4j-simple:1.7.22'))
36-
exclude(dependency('org.apache.commons:commons-lang3:3.0'))
34+
exclude(project(":ds3-interfaces")) // this is being excluded since it must be used with the sdk, which already has this dependency included
35+
exclude(project(":ds3-utils")) // this is being excluded since it must be used with the sdk, which already has this dependency included
36+
exclude(dependency("org.hamcrest:hamcrest-library:$hamcrestVersion"))
37+
exclude(dependency("org.mockito:mockito-core:$mockitoVersion"))
38+
exclude(dependency("junit:junit:$junitVersion"))
39+
exclude(dependency("org.slf4j:slf4j-api:$slf4jVersion"))
40+
exclude(dependency("org.slf4j:slf4j-simple:$slf4jVersion"))
41+
exclude(dependency("org.apache.commons:commons-lang3:$commonslangVersion"))
3742
}
3843
}
3944

@@ -42,10 +47,10 @@ artifacts {
4247
}
4348

4449
dependencies {
45-
compile group: 'net.java.dev.jna', name: 'jna-platform', version: '4.2.2'
46-
compile group: 'net.java.dev.jna', name: 'jna', version: '4.2.2'
47-
compile 'commons-io:commons-io:2.4'
48-
compile 'org.apache.httpcomponents:httpclient:4.5.1'
50+
compile group: 'net.java.dev.jna', name: 'jna-platform', version: "$jnaVersion"
51+
compile group: 'net.java.dev.jna', name: 'jna', version: "$jnaVersion"
52+
compile "commons-io:commons-io:$commonsioVersion"
53+
compile "org.apache.httpcomponents:httpclient:$httpclientVersion"
4954

50-
testCompile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
55+
testCompile group: 'org.apache.commons', name: 'commons-lang3', version: "$commonslangVersion"
5156
}

ds3-sdk-integration/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
*/
1515

1616
dependencies {
17-
compile 'commons-codec:commons-codec:1.10'
18-
compile 'junit:junit:4.12'
19-
testCompile 'org.hamcrest:hamcrest-library:1.3'
20-
testCompile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
17+
compile "commons-codec:commons-codec:$commonscodecVersion"
18+
compile "junit:junit:$junitVersion"
19+
testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
20+
testCompile group: 'org.apache.commons', name: 'commons-lang3', version: "$commonslangVersion"
2121
}
2222

ds3-sdk-integration/src/main/java/com/spectralogic/ds3client/integration/Util.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.spectralogic.ds3client.commands.DeleteBucketRequest;
2121
import com.spectralogic.ds3client.commands.DeleteObjectRequest;
2222
import com.spectralogic.ds3client.commands.spectrads3.GetSystemInformationSpectraS3Request;
23+
import com.spectralogic.ds3client.helpers.DeleteBucket;
2324
import com.spectralogic.ds3client.helpers.Ds3ClientHelpers;
2425
import com.spectralogic.ds3client.helpers.channelbuilders.PrefixAdderObjectChannelBuilder;
2526
import com.spectralogic.ds3client.models.Contents;
@@ -39,7 +40,7 @@
3940
import static org.junit.Assume.assumeThat;
4041

4142

42-
public class Util {
43+
public final class Util {
4344
private static final Logger LOG = LoggerFactory.getLogger(Util.class);
4445
public static final String RESOURCE_BASE_NAME = "books/";
4546
public static final String[] BOOKS = {"beowulf.txt", "sherlock_holmes.txt", "tale_of_two_cities.txt", "ulysses.txt"};
@@ -103,22 +104,11 @@ public static void loadBookTestDataWithPrefix(final Ds3Client client, final Stri
103104
}
104105

105106
public static void deleteAllContents(final Ds3Client client, final String bucketName) throws IOException {
106-
final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client);
107-
108-
final Iterable<Contents> objects = helpers.listObjects(bucketName);
109-
for(final Contents contents : objects) {
110-
client.deleteObject(new DeleteObjectRequest(bucketName, contents.getKey()));
111-
}
112-
113-
client.deleteBucket(new DeleteBucketRequest(bucketName));
107+
Ds3ClientHelpers.wrap(client).deleteBucket(bucketName);
114108
}
115109

116110
public static void deleteBucketContents(final Ds3Client client, final String bucketName) throws IOException {
117111
final Ds3ClientHelpers helpers = Ds3ClientHelpers.wrap(client);
118-
119-
final Iterable<Contents> objects = helpers.listObjects(bucketName);
120-
for(final Contents contents : objects) {
121-
client.deleteObject(new DeleteObjectRequest(bucketName, contents.getKey()));
122-
}
112+
DeleteBucket.INSTANCE.deleteBucketContents(helpers, bucketName);
123113
}
124114
}

ds3-sdk-integration/src/test/java/com/spectralogic/ds3client/integration/test/helpers/TempStorageUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* and partition for use in the integration tests to avoid error if the BP does not currently
3131
* have a partition available for running the unit tests.
3232
*/
33-
public class TempStorageUtil {
33+
public final class TempStorageUtil {
3434

3535
private static final String DATA_POLICY_NAME = "_dp";
3636
private static final String STORAGE_DOMAIN_NAME = "_sd";

ds3-sdk-samples/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ apply plugin: 'application'
1818
mainClassName = 'com.spectralogic.ds3client.samples.PartialObjectGetExample'
1919

2020
dependencies {
21-
compile 'org.slf4j:slf4j-simple:1.7.22'
21+
compile "org.slf4j:slf4j-simple:$slf4jVersion"
2222
}

ds3-sdk/build.gradle

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,33 @@ import java.nio.file.Path
1919
buildscript {
2020
repositories { jcenter() }
2121
dependencies {
22-
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
22+
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1'
2323
}
2424
}
2525

2626
apply plugin: 'com.github.johnrengelman.shadow'
2727

2828
shadowJar {
2929
relocate 'com.google', 'ds3fatjar.com.google'
30-
relocate 'org.apache', 'ds3fatjar.org.apache'
30+
relocate 'org.jetbrains', 'ds3fatjar.org.jetbrains'
31+
relocate 'org.intellij', 'ds3fatjar.org.intellij'
3132
relocate 'org.codehaus', 'ds3fatjar.org.codehaus'
33+
relocate 'kotlin', 'ds3fatjar.kotlin'
34+
relocate 'edu.umd', 'ds3fatjar.edu.emd'
35+
relocate 'net.jcip', 'ds3fatjar.net.jcip'
36+
relocate 'com.ctc', 'ds3fatjar.com.ctc'
37+
relocate 'org.apache', 'ds3fatjar.org.apache'
3238
relocate 'com.fasterxml', 'ds3fatjar.com.fasterxml'
3339
dependencies {
34-
exclude(dependency('org.hamcrest:hamcrest-library:1.3'))
35-
exclude(dependency('org.mockito:mockito-core:1.10.19'))
36-
exclude(dependency('junit:junit:4.12'))
37-
exclude(dependency('org.slf4j:slf4j-api:1.7.22'))
38-
exclude(dependency('org.slf4j:slf4j-simple:1.7.22'))
39-
exclude(dependency('org.apache.commons:commons-lang3:3.0'))
40+
exclude(dependency("org.hamcrest:hamcrest-library:$hamcrestVersion"))
41+
exclude(dependency("org.mockito:mockito-core:$mockitoVersion"))
42+
exclude(dependency("junit:junit:$junitVersion"))
43+
exclude(dependency("org.slf4j:slf4j-api:$slf4jVersion"))
44+
exclude(dependency("org.slf4j:slf4j-simple:$slf4jVersion"))
45+
exclude(dependency("org.apache.commons:commons-lang3:$commonslangVersion"))
4046
}
47+
48+
mergeServiceFiles()
4149
}
4250

4351
artifacts {
@@ -78,10 +86,12 @@ jar {
7886
jar.dependsOn genConfigProperties
7987

8088
dependencies {
81-
compile 'org.apache.httpcomponents:httpclient:4.5.1'
89+
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
90+
compile "org.apache.httpcomponents:httpclient:$httpclientVersion"
91+
compile "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:$jacksonVersion"
92+
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion"
93+
compile "com.google.guava:guava:$guavaVersion"
8294
compile 'org.codehaus.woodstox:woodstox-core-asl:4.4.1'
83-
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.7.1'
84-
compile 'com.google.guava:guava:20.0'
8595
compile 'com.google.code.findbugs:annotations:3.0.1'
86-
testCompile 'org.hamcrest:hamcrest-library:1.3'
96+
testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
8797
}

ds3-sdk/src/main/java/com/spectralogic/ds3client/commands/interfaces/AbstractRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private static RequestHeaders buildDefaultHeaders() {
3636

3737
@Override
3838
public String getContentType() {
39-
return ContentType.APPLICATION_XML.toString();
39+
return ContentType.APPLICATION_XML.getMimeType();
4040
}
4141

4242
@Override

ds3-sdk/src/main/java/com/spectralogic/ds3client/helpers/Ds3ClientHelpers.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,12 @@ public abstract Iterable<Contents> listObjects(final String bucket, final String
509509
*/
510510
public abstract Iterable<FileSystemKey> remoteListDirectory(final String bucket, final String keyPrefix, final String delimiter, final String nextMarker, final int maxKeys) throws IOException;
511511

512+
/**
513+
*
514+
* @param bucket
515+
*/
516+
public abstract void deleteBucket(final String bucket) throws IOException;
517+
512518
/**
513519
* Returns an Iterable of {@link Ds3Object} that have a prefix added.
514520
*/
@@ -526,20 +532,12 @@ public abstract Iterable<Contents> listObjects(final String bucket, final String
526532
@SafeVarargs
527533
public final Iterable<Ds3Object> toDs3Iterable(final Iterable<Contents> objects, final Predicate<Contents>... filters) {
528534

529-
FluentIterable<Contents> fluentIterable = FluentIterable.from(objects).filter(new com.google.common.base.Predicate<Contents>() {
530-
@Override
531-
public boolean apply(@Nullable final Contents input) {
532-
return input != null;
533-
}
534-
});
535+
FluentIterable<Contents> fluentIterable = FluentIterable.from(objects).filter(input -> input != null);
535536

536537
if (filters != null) {
537538
for (final Predicate<Contents> filter : filters) {
538-
fluentIterable = fluentIterable.filter(new com.google.common.base.Predicate<Contents>() {
539-
@Override
540-
public boolean apply(@Nullable final Contents input) {
541-
return filter == null || filter.test(input); // do not filter anything if filter is null
542-
}
539+
fluentIterable = fluentIterable.filter(input -> {
540+
return filter == null || filter.test(input); // do not filter anything if filter is null
543541
});
544542
}
545543
}
@@ -586,4 +584,9 @@ public abstract ObjectStorageSpaceVerificationResult objectsFromBucketWillFitInD
586584
* Creates a folder in the specified bucket
587585
*/
588586
public abstract void createFolder(final String bucketName, final String folderName) throws IOException;
587+
588+
/**
589+
* Returns the client being wrapped
590+
*/
591+
public abstract Ds3Client getClient();
589592
}

0 commit comments

Comments
 (0)