diff --git a/build.gradle b/build.gradle index 4c4274b0107..5645fa65c9c 100644 --- a/build.gradle +++ b/build.gradle @@ -39,9 +39,6 @@ allprojects { repositories { jcenter() - maven { - url "https://repo.spring.io/snapshot" - } } } @@ -122,6 +119,10 @@ configure(javaProjects) { // https://curator.apache.org/zk-compatibility.html dependency("org.apache.zookeeper:zookeeper:3.4.12") dependency("org.bitbucket.b_c:jose4j:0.6.3") + // Looks like as of Boot 2.1.x this dependency isn't managed by them anymore. This matches whats available + // in Spring per + // https://github.com/spring-projects/spring-boot/blob/2.1.x/spring-boot-project/spring-boot-dependencies/pom.xml#L67 + dependency("org.codehaus.groovy:groovy-all:2.5.5") dependency("org.codehaus.janino:janino:2.5.16") dependency("org.dbunit:dbunit:2.5.4") dependencySet(group: "org.jruby", version: "9.1.14.0") { @@ -139,8 +140,8 @@ configure(javaProjects) { // https://spring.io/blog/2018/03/16/spring-security-saml-1-0-4-released // For now staying on 1.0.3 as not really thrilled with adding yet another maven repo dependency("org.springframework.security.extensions:spring-security-saml2-core:1.0.3.RELEASE") - dependency("org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.0.1.RELEASE") - dependencySet(group: "org.springframework.statemachine", version: "2.0.2.RELEASE") { + dependency("org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:2.1.2.RELEASE") + dependencySet(group: "org.springframework.statemachine", version: "2.0.3.RELEASE") { entry "spring-statemachine-core" entry "spring-statemachine-test" } diff --git a/genie-web/src/main/java/com/netflix/genie/web/configs/GenieApiAutoConfiguration.java b/genie-web/src/main/java/com/netflix/genie/web/configs/GenieApiAutoConfiguration.java index f68c4dd0b4b..c900ba570a7 100644 --- a/genie-web/src/main/java/com/netflix/genie/web/configs/GenieApiAutoConfiguration.java +++ b/genie-web/src/main/java/com/netflix/genie/web/configs/GenieApiAutoConfiguration.java @@ -46,6 +46,8 @@ import java.net.InetAddress; import java.net.UnknownHostException; import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.time.temporal.ChronoUnit; import java.util.Collections; /** @@ -108,8 +110,8 @@ public RestTemplate genieRestTemplate( final RestTemplateBuilder restTemplateBuilder ) { return restTemplateBuilder - .setConnectTimeout(httpProperties.getConnect().getTimeout()) - .setReadTimeout(httpProperties.getRead().getTimeout()) + .setConnectTimeout(Duration.of(httpProperties.getConnect().getTimeout(), ChronoUnit.MILLIS)) + .setReadTimeout(Duration.of(httpProperties.getRead().getTimeout(), ChronoUnit.MILLIS)) .build(); } diff --git a/genie-web/src/main/java/com/netflix/genie/web/jobs/workflow/impl/InitialSetupTask.java b/genie-web/src/main/java/com/netflix/genie/web/jobs/workflow/impl/InitialSetupTask.java index a9bb74e87c0..7b900a14098 100644 --- a/genie-web/src/main/java/com/netflix/genie/web/jobs/workflow/impl/InitialSetupTask.java +++ b/genie-web/src/main/java/com/netflix/genie/web/jobs/workflow/impl/InitialSetupTask.java @@ -33,6 +33,7 @@ import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tag; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.RegExUtils; import org.apache.commons.lang3.StringUtils; import javax.validation.constraints.NotNull; @@ -460,6 +461,6 @@ String tagsToString(final Set tags) { sortedTags.sort(Comparator.naturalOrder()); final String joinedString = StringUtils.join(sortedTags, ','); // Escape quotes - return StringUtils.replaceAll(StringUtils.replaceAll(joinedString, "\'", "\\\'"), "\"", "\\\""); + return RegExUtils.replaceAll(RegExUtils.replaceAll(joinedString, "\'", "\\\'"), "\"", "\\\""); } } diff --git a/genie-web/src/main/java/com/netflix/genie/web/resources/writers/DefaultDirectoryWriter.java b/genie-web/src/main/java/com/netflix/genie/web/resources/writers/DefaultDirectoryWriter.java index 81a5c80b0ba..5ff4fc0bee0 100644 --- a/genie-web/src/main/java/com/netflix/genie/web/resources/writers/DefaultDirectoryWriter.java +++ b/genie-web/src/main/java/com/netflix/genie/web/resources/writers/DefaultDirectoryWriter.java @@ -21,7 +21,6 @@ import com.netflix.genie.common.util.GenieObjectMapper; import lombok.Data; import lombok.EqualsAndHashCode; -import org.apache.catalina.util.ConcurrentDateFormat; import org.apache.catalina.util.ServerInfo; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; @@ -33,8 +32,9 @@ import java.io.File; import java.io.IOException; import java.time.Instant; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; import java.util.Comparator; -import java.util.Date; import java.util.List; /** @@ -174,7 +174,9 @@ private void writeFileHtml( builder.append(FileUtils.byteCountToDisplaySize(entry.getSize())); } builder.append(""); - final String lastModified = ConcurrentDateFormat.formatRfc1123(Date.from(entry.getLastModified())); + final String lastModified = DateTimeFormatter + .RFC_1123_DATE_TIME + .format(entry.getLastModified().atOffset(ZoneOffset.UTC)); builder.append("").append(lastModified).append(""); builder.append(""); } diff --git a/genie-web/src/main/java/com/netflix/genie/web/services/impl/DiskJobFileServiceImpl.java b/genie-web/src/main/java/com/netflix/genie/web/services/impl/DiskJobFileServiceImpl.java index 659fa21fb85..a4569133120 100644 --- a/genie-web/src/main/java/com/netflix/genie/web/services/impl/DiskJobFileServiceImpl.java +++ b/genie-web/src/main/java/com/netflix/genie/web/services/impl/DiskJobFileServiceImpl.java @@ -23,7 +23,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.StringUtils; -import org.springframework.core.io.PathResource; +import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.Resource; import javax.annotation.Nullable; @@ -172,7 +172,7 @@ public Resource getJobFileAsResource(final String jobId, @Nullable final String final Path jobDirectoryLocation = StringUtils.isBlank(relativePath) ? this.jobsDirRoot.resolve(jobId) : this.jobsDirRoot.resolve(jobId).resolve(relativePath); - return new PathResource(jobDirectoryLocation); + return new FileSystemResource(jobDirectoryLocation); } /** diff --git a/genie-web/src/main/java/com/netflix/genie/web/services/impl/JobSpecificationServiceImpl.java b/genie-web/src/main/java/com/netflix/genie/web/services/impl/JobSpecificationServiceImpl.java index a3772d292bd..12ff238626a 100644 --- a/genie-web/src/main/java/com/netflix/genie/web/services/impl/JobSpecificationServiceImpl.java +++ b/genie-web/src/main/java/com/netflix/genie/web/services/impl/JobSpecificationServiceImpl.java @@ -45,6 +45,7 @@ import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tag; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.RegExUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.aop.TargetClassAware; import org.springframework.validation.annotation.Validated; @@ -525,7 +526,7 @@ private String tagsToString(final Set tags) { sortedTags.sort(Comparator.naturalOrder()); final String joinedString = StringUtils.join(sortedTags, ','); // Escape quotes - return StringUtils.replaceAll(StringUtils.replaceAll(joinedString, "\'", "\\\'"), "\"", "\\\""); + return RegExUtils.replaceAll(RegExUtils.replaceAll(joinedString, "\'", "\\\'"), "\"", "\\\""); } /** diff --git a/genie-web/src/test/groovy/com/netflix/genie/web/services/impl/DiskJobFileServiceImplSpec.groovy b/genie-web/src/test/groovy/com/netflix/genie/web/services/impl/DiskJobFileServiceImplSpec.groovy index 3e6b3c7e264..dae4e6471b5 100644 --- a/genie-web/src/test/groovy/com/netflix/genie/web/services/impl/DiskJobFileServiceImplSpec.groovy +++ b/genie-web/src/test/groovy/com/netflix/genie/web/services/impl/DiskJobFileServiceImplSpec.groovy @@ -24,17 +24,17 @@ import org.apache.commons.codec.digest.DigestUtils import org.junit.Rule import org.junit.experimental.categories.Category import org.junit.rules.TemporaryFolder -import org.springframework.core.io.PathResource +import org.springframework.core.io.FileSystemResource import spock.lang.Specification import java.nio.charset.Charset import java.nio.file.Files import java.nio.file.Paths + /** * Specifications for the {@link DiskJobFileServiceImpl} class. * * @author tgianos - * @since 4.0.0 */ @Category(UnitTest.class) class DiskJobFileServiceImplSpec extends Specification { @@ -45,7 +45,7 @@ class DiskJobFileServiceImplSpec extends Specification { DiskJobFileServiceImpl diskLogService def setup() { - def jobDirRoot = new PathResource(this.temporaryFolder.getRoot().toPath()) + def jobDirRoot = new FileSystemResource(this.temporaryFolder.getRoot().toPath()) this.diskLogService = new DiskJobFileServiceImpl(jobDirRoot) } @@ -69,12 +69,12 @@ class DiskJobFileServiceImplSpec extends Specification { def file1 = UUID.randomUUID().toString() + ".txt" def file2 = "GenieLogo.png" def file3 = + UUID.randomUUID().toString() + + separator + + UUID.randomUUID().toString() + + separator + UUID.randomUUID().toString() + - separator + - UUID.randomUUID().toString() + - separator + - UUID.randomUUID().toString() + - ".log" + ".log" def jobDir = this.temporaryFolder.getRoot().toPath().resolve(jobId) def file1Path = jobDir.resolve(file1) def file2Path = jobDir.resolve(file2) @@ -158,9 +158,9 @@ class DiskJobFileServiceImplSpec extends Specification { when: "Directory state is read without MD5 it matches expected output" def expectedJobDirectoryStateWithoutMd5 = Sets.newHashSet( - new JobFileState(file1, file1Length, null), - new JobFileState(file2, file2Length, null), - new JobFileState(file3, file3Length, null) + new JobFileState(file1, file1Length, null), + new JobFileState(file2, file2Length, null), + new JobFileState(file3, file3Length, null) ) def jobDirectoryState = this.diskLogService.getJobDirectoryFileState(jobId, false) @@ -169,9 +169,9 @@ class DiskJobFileServiceImplSpec extends Specification { when: "Directory state is read with MD5 it matches expected output" def expectedJobDirectoryStateWithMd5 = Sets.newHashSet( - new JobFileState(file1, file1Length, DigestUtils.md5Hex(file1ContentsAsBytes)), - new JobFileState(file2, file2Length, DigestUtils.md5Hex(file2ContentsAsBytes)), - new JobFileState(file3, file3Length, DigestUtils.md5Hex(file3RealContents)) + new JobFileState(file1, file1Length, DigestUtils.md5Hex(file1ContentsAsBytes)), + new JobFileState(file2, file2Length, DigestUtils.md5Hex(file2ContentsAsBytes)), + new JobFileState(file3, file3Length, DigestUtils.md5Hex(file3RealContents)) ) jobDirectoryState = this.diskLogService.getJobDirectoryFileState(jobId, true) @@ -186,7 +186,7 @@ class DiskJobFileServiceImplSpec extends Specification { then: "Since we wrote bytes in the middle of a file the md5 comparison will fail but the naive one based on " + - "size won't" + "size won't" jobDirectoryState != expectedJobDirectoryStateWithMd5 jobDirectoryStateWithoutMd5 == expectedJobDirectoryStateWithoutMd5 @@ -217,7 +217,7 @@ class DiskJobFileServiceImplSpec extends Specification { def resource = this.diskLogService.getJobFileAsResource(jobId, file) then: - resource instanceof PathResource + resource instanceof FileSystemResource !resource.exists() when: diff --git a/gradle.properties b/gradle.properties index 5e7398427a6..269b693bafe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,15 +19,14 @@ ## Spring Dependency Versions # Used in documentation and for including the Gradle plugin -spring_boot_version=2.0.7.RELEASE -spring_cloud_version=Finchley.SR2 +spring_boot_version=2.1.2.RELEASE +spring_cloud_version=Greenwich.RELEASE ## Override Spring Dependency Managed Versions #Version 1.4.197 from BOM seems to break build. Pin back. h2.version=1.4.196 lombok.version=1.18.2 -spring-cloud-aws.version=2.0.3.BUILD-SNAPSHOT ## Gradle Property Overrides diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 558870dad58..75b8c7c8c67 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists