diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a9a1b115..fbb46131 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,19 +17,19 @@ on: jobs: deploy: name: Build SNAPSHOT to Sonatype - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ github.event.inputs.branch }} - name: Set up JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: - distribution: 'adopt' - java-version: '11' + distribution: 'corretto' + java-version: '21' java-package: jdk server-id: central # Value of the distributionManagement/repository/id field of the pom.xml server-username: SONATYPE_USERNAME # env variable for username in deploy diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e729239d..bdb9330d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,7 +7,7 @@ jobs: name: Package and run all tests runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Init Coveralls @@ -24,10 +24,10 @@ jobs: fi echo "COVERALLS_SKIP=${COVERALLS_SKIP}" >> $GITHUB_ENV - name: Set up JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: - distribution: 'adopt' - java-version: '11' + distribution: 'corretto' + java-version: '21' java-package: jdk - name: Run Maven Package diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e6349444..afc302c0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,17 +10,17 @@ jobs: steps: - name: Checkout source code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 ref: main # Hardcoded to main branch token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} - name: Set up JDK - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: - distribution: 'adopt' - java-version: '11' + distribution: 'corretto' + java-version: '21' java-package: jdk server-id: central # Value of the distributionManagement/repository/id field of the pom.xml server-username: SONATYPE_USERNAME # env variable for username in deploy diff --git a/.gitignore b/.gitignore index 43147406..4cd5ca05 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,5 @@ target/ # HMS data metastore_db derby.log + +CLAUDE.md diff --git a/beekeeper-api/pom.xml b/beekeeper-api/pom.xml index b6c8cb2b..082467ec 100644 --- a/beekeeper-api/pom.xml +++ b/beekeeper-api/pom.xml @@ -11,8 +11,8 @@ ${project.groupId}:${project.artifactId} - 2.18.1 - 1.6.14 + 3.1.0 + 2.3.0 @@ -39,13 +39,12 @@ lombok - mysql - mysql-connector-java - 8.0.17 + com.mysql + mysql-connector-j org.springdoc - springdoc-openapi-ui + springdoc-openapi-starter-webmvc-ui ${springdoc.version} @@ -77,14 +76,16 @@ - pl.project13.maven - git-commit-id-plugin + io.github.git-commit-id + git-commit-id-maven-plugin + 7.0.0 com.google.cloud.tools jib-maven-plugin + eclipse-temurin:21-jre amd64 @@ -98,6 +99,16 @@ USE_CURRENT_TIMESTAMP + + --add-opens=java.base/java.lang=ALL-UNNAMED + --add-opens=java.base/java.lang.reflect=ALL-UNNAMED + --add-opens=java.base/java.io=ALL-UNNAMED + --add-opens=java.base/java.net=ALL-UNNAMED + --add-opens=java.base/java.nio=ALL-UNNAMED + --add-opens=java.base/java.util=ALL-UNNAMED + --add-opens=java.base/java.util.concurrent=ALL-UNNAMED + --add-opens=java.base/sun.nio.ch=ALL-UNNAMED + diff --git a/beekeeper-api/src/main/java/com/expediagroup/beekeeper/api/conf/SwaggerConfiguration.java b/beekeeper-api/src/main/java/com/expediagroup/beekeeper/api/conf/SwaggerConfiguration.java index 156f4f32..b082ad24 100644 --- a/beekeeper-api/src/main/java/com/expediagroup/beekeeper/api/conf/SwaggerConfiguration.java +++ b/beekeeper-api/src/main/java/com/expediagroup/beekeeper/api/conf/SwaggerConfiguration.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019-2023 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,7 @@ */ package com.expediagroup.beekeeper.api.conf; - -import org.springdoc.core.GroupedOpenApi; +import org.springdoc.core.models.GroupedOpenApi; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/beekeeper-api/src/main/java/com/expediagroup/beekeeper/api/controller/BeekeeperController.java b/beekeeper-api/src/main/java/com/expediagroup/beekeeper/api/controller/BeekeeperController.java index 68cc24b5..ca4304cd 100644 --- a/beekeeper-api/src/main/java/com/expediagroup/beekeeper/api/controller/BeekeeperController.java +++ b/beekeeper-api/src/main/java/com/expediagroup/beekeeper/api/controller/BeekeeperController.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019-2025 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ */ package com.expediagroup.beekeeper.api.controller; -import org.springdoc.api.annotations.ParameterObject; +import org.springdoc.core.annotations.ParameterObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -80,7 +80,6 @@ public ResponseEntity> getAllMetadata( return ResponseEntity.ok(housekeepingEntityService.getAllMetadata(spec, pageable)); } - @RequestMapping(value = "/database/{databaseName}/table/{tableName}/unreferenced-paths", method = RequestMethod.GET) @Parameter(name = "tableName", in = ParameterIn.PATH) @Parameter(name = "databaseName", in = ParameterIn.PATH) @@ -95,7 +94,7 @@ public ResponseEntity> getAllMetadata( public ResponseEntity> getAllPaths( @PathVariable String databaseName, @PathVariable String tableName, - @Parameter(hidden = true) @And(value ={ + @Parameter(hidden = true) @And(value = { @Spec(path = "tableName", pathVars = "tableName", spec = EqualIgnoreCase.class), @Spec(path = "databaseName", pathVars = "databaseName", spec = EqualIgnoreCase.class), @Spec(path = "path", params = "path", spec = EqualIgnoreCase.class), diff --git a/beekeeper-api/src/main/java/com/expediagroup/beekeeper/api/error/BeekeeperExceptionHandler.java b/beekeeper-api/src/main/java/com/expediagroup/beekeeper/api/error/BeekeeperExceptionHandler.java index ceea01b5..963f1179 100644 --- a/beekeeper-api/src/main/java/com/expediagroup/beekeeper/api/error/BeekeeperExceptionHandler.java +++ b/beekeeper-api/src/main/java/com/expediagroup/beekeeper/api/error/BeekeeperExceptionHandler.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019-2025 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ import java.time.LocalDateTime; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.data.mapping.PropertyReferenceException; import org.springframework.http.HttpStatus; diff --git a/beekeeper-api/src/main/java/com/expediagroup/beekeeper/api/response/HousekeepingMetadataResponse.java b/beekeeper-api/src/main/java/com/expediagroup/beekeeper/api/response/HousekeepingMetadataResponse.java index f2510c0f..c662c45f 100644 --- a/beekeeper-api/src/main/java/com/expediagroup/beekeeper/api/response/HousekeepingMetadataResponse.java +++ b/beekeeper-api/src/main/java/com/expediagroup/beekeeper/api/response/HousekeepingMetadataResponse.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019-2023 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,8 @@ import java.time.LocalDateTime; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; import org.hibernate.annotations.UpdateTimestamp; diff --git a/beekeeper-api/src/test/java/com/expediagroup/beekeeper/api/TestApplication.java b/beekeeper-api/src/test/java/com/expediagroup/beekeeper/api/TestApplication.java index e74e28fe..4bf3eeed 100644 --- a/beekeeper-api/src/test/java/com/expediagroup/beekeeper/api/TestApplication.java +++ b/beekeeper-api/src/test/java/com/expediagroup/beekeeper/api/TestApplication.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019-2021 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,9 +15,38 @@ */ package com.expediagroup.beekeeper.api; +import java.util.List; + import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.FilterType; +import org.springframework.web.method.support.HandlerMethodArgumentResolver; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import net.kaczmarzyk.spring.data.jpa.web.SpecificationArgumentResolver; + +import com.expediagroup.beekeeper.api.conf.JpaConfiguration; @SpringBootApplication @EnableConfigurationProperties -public class TestApplication {} +@ComponentScan( + excludeFilters = { + @ComponentScan.Filter( + type = FilterType.ASSIGNABLE_TYPE, + classes = BeekeeperApiApplication.class), + @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = JpaConfiguration.class) + }) +public class TestApplication { + + @Bean + public WebMvcConfigurer specificationArgumentResolverConfigurer() { + return new WebMvcConfigurer() { + @Override + public void addArgumentResolvers(List argumentResolvers) { + argumentResolvers.add(new SpecificationArgumentResolver()); + } + }; + } +} diff --git a/beekeeper-cleanup/pom.xml b/beekeeper-cleanup/pom.xml index 58581098..d87edc63 100644 --- a/beekeeper-cleanup/pom.xml +++ b/beekeeper-cleanup/pom.xml @@ -65,6 +65,14 @@ javax.servlet servlet-api + + javax.servlet + javax.servlet-api + + + log4j + log4j + @@ -76,6 +84,26 @@ net.java.dev.jna jna + + javax.servlet + servlet-api + + + javax.servlet + javax.servlet-api + + + org.slf4j + slf4j-log4j12 + + + org.slf4j + slf4j-reload4j + + + log4j + log4j + @@ -124,6 +152,20 @@ hadoop-aws 2.9.2 test + + + org.slf4j + slf4j-log4j12 + + + org.slf4j + slf4j-reload4j + + + log4j + log4j + + diff --git a/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/TestApplication.java b/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/TestApplication.java index 2d3c3237..2e35ee49 100644 --- a/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/TestApplication.java +++ b/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/TestApplication.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019-2020 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,13 +17,16 @@ import java.util.TimeZone; -import javax.annotation.PostConstruct; - import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.ComponentScan; -@SpringBootApplication +import jakarta.annotation.PostConstruct; + +@SpringBootApplication( + exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) @EnableConfigurationProperties @ComponentScan("com.expediagroup.beekeeper.core") public class TestApplication { diff --git a/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3ClientTest.java b/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3ClientTest.java index 7c692bd4..0f65db6e 100644 --- a/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3ClientTest.java +++ b/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3ClientTest.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019-2022 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,10 +60,12 @@ class S3ClientTest { @Rule public static LocalStackContainer awsContainer = new LocalStackContainer( DockerImageName.parse("localstack/localstack:0.14.2")).withServices(S3); + static { awsContainer.start(); } - public static String S3_ENDPOINT = awsContainer.getEndpointConfiguration(S3).getServiceEndpoint(); + + public static String S3_ENDPOINT = awsContainer.getEndpointOverride(S3).toString(); @BeforeEach void setUp() { diff --git a/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3DryRunPathCleanerTest.java b/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3DryRunPathCleanerTest.java index 5fab57af..cc605cfa 100644 --- a/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3DryRunPathCleanerTest.java +++ b/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3DryRunPathCleanerTest.java @@ -69,7 +69,7 @@ class S3DryRunPathCleanerTest { @BeforeEach void setUp() { - String S3_ENDPOINT = awsContainer.getEndpointConfiguration(S3).getServiceEndpoint(); + String S3_ENDPOINT = awsContainer.getEndpointOverride(S3).toString(); amazonS3 = AmazonS3ClientBuilder .standard() .withCredentials(new BasicAWSCredentialsProvider("accesskey", "secretkey")) diff --git a/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3PathCleanerTest.java b/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3PathCleanerTest.java index 7b00bcb6..c958c134 100644 --- a/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3PathCleanerTest.java +++ b/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3PathCleanerTest.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019-2023 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,10 +84,12 @@ class S3PathCleanerTest { @Rule public static LocalStackContainer awsContainer = new LocalStackContainer( DockerImageName.parse("localstack/localstack:0.14.2")).withServices(S3); + static { awsContainer.start(); } - public static String S3_ENDPOINT = awsContainer.getEndpointConfiguration(S3).getServiceEndpoint(); + + public static String S3_ENDPOINT = awsContainer.getEndpointOverride(S3).toString(); @BeforeEach void setUp() { diff --git a/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3SentinelFilesCleanerTest.java b/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3SentinelFilesCleanerTest.java index afa2b64d..559d82cc 100644 --- a/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3SentinelFilesCleanerTest.java +++ b/beekeeper-cleanup/src/test/java/com/expediagroup/beekeeper/cleanup/aws/S3SentinelFilesCleanerTest.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019-2022 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,10 +49,12 @@ class S3SentinelFilesCleanerTest { @Rule public static LocalStackContainer awsContainer = new LocalStackContainer( DockerImageName.parse("localstack/localstack:0.14.2")).withServices(S3); + static { awsContainer.start(); } - public static String S3_ENDPOINT = awsContainer.getEndpointConfiguration(S3).getServiceEndpoint(); + + public static String S3_ENDPOINT = awsContainer.getEndpointOverride(S3).toString(); @BeforeEach void setUp() { diff --git a/beekeeper-core/pom.xml b/beekeeper-core/pom.xml index fff8af81..0e8aca83 100644 --- a/beekeeper-core/pom.xml +++ b/beekeeper-core/pom.xml @@ -90,13 +90,11 @@ com.h2database h2 - 1.4.199 test org.junit.jupiter junit-jupiter-params - ${junit.jupiter.version} test diff --git a/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/model/HousekeepingMetadata.java b/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/model/HousekeepingMetadata.java index a06ee7eb..5a7943fc 100644 --- a/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/model/HousekeepingMetadata.java +++ b/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/model/HousekeepingMetadata.java @@ -1,34 +1,31 @@ /** - * Copyright (C) 2019-2023 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.core.model; import java.time.LocalDateTime; -import javax.persistence.Column; -import javax.persistence.Convert; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - import org.hibernate.annotations.UpdateTimestamp; +import jakarta.persistence.Column; +import jakarta.persistence.Convert; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/model/HousekeepingPath.java b/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/model/HousekeepingPath.java index b80e895c..7d7da4d4 100644 --- a/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/model/HousekeepingPath.java +++ b/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/model/HousekeepingPath.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2023 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.core.model; @@ -19,18 +17,17 @@ import java.time.LocalDateTime; -import javax.persistence.Column; -import javax.persistence.Convert; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - import org.hibernate.annotations.UpdateTimestamp; +import jakarta.persistence.Column; +import jakarta.persistence.Convert; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; @@ -83,6 +80,7 @@ public class HousekeepingPath implements HousekeepingEntity { @Column(name = "client_id") private String clientId; + @Column(name = "lifecycle_type", nullable = false) private String lifecycleType; diff --git a/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/model/PeriodDurationConverter.java b/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/model/PeriodDurationConverter.java index 0da210b7..4e228b9a 100644 --- a/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/model/PeriodDurationConverter.java +++ b/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/model/PeriodDurationConverter.java @@ -1,22 +1,20 @@ /** - * Copyright (C) 2019-2023 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.core.model; -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; @Converter(autoApply = true) public class PeriodDurationConverter implements AttributeConverter { diff --git a/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/model/history/BeekeeperHistory.java b/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/model/history/BeekeeperHistory.java index 1046126f..bafe31d9 100644 --- a/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/model/history/BeekeeperHistory.java +++ b/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/model/history/BeekeeperHistory.java @@ -1,29 +1,26 @@ /** - * Copyright (C) 2019-2025 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.core.model.history; import java.time.LocalDateTime; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; @@ -69,8 +66,7 @@ public BeekeeperHistory( String tableName, String lifecycleType, String housekeepingStatus, - String eventDetails - ) { + String eventDetails) { this.id = id; this.eventTimestamp = eventTimestamp; this.databaseName = databaseName; @@ -84,5 +80,4 @@ public BeekeeperHistory( public MetricTag getMetricTag() { return new MetricTag("table", String.join(".", databaseName, tableName)); } - } diff --git a/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/repository/BeekeeperHistoryRepository.java b/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/repository/BeekeeperHistoryRepository.java index 5c3dffb3..99636269 100644 --- a/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/repository/BeekeeperHistoryRepository.java +++ b/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/repository/BeekeeperHistoryRepository.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2025 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.core.repository; @@ -19,16 +17,16 @@ import org.springframework.data.domain.Slice; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; import com.expediagroup.beekeeper.core.model.history.BeekeeperHistory; public interface BeekeeperHistoryRepository extends PagingAndSortingRepository, - JpaSpecificationExecutor { + CrudRepository, JpaSpecificationExecutor { @Query(value = "from BeekeeperHistory t where t.lifecycleType = :lifecycle") Slice findRecordsByLifecycleType( - @Param("lifecycle") String lifecycle, - Pageable pageable); + @Param("lifecycle") String lifecycle, Pageable pageable); } diff --git a/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/repository/HousekeepingMetadataRepository.java b/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/repository/HousekeepingMetadataRepository.java index a6b2ce06..81d27827 100644 --- a/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/repository/HousekeepingMetadataRepository.java +++ b/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/repository/HousekeepingMetadataRepository.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2025 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.core.repository; @@ -24,13 +22,15 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; import com.expediagroup.beekeeper.core.model.HousekeepingMetadata; public interface HousekeepingMetadataRepository - extends PagingAndSortingRepository, JpaSpecificationExecutor { + extends PagingAndSortingRepository, CrudRepository, + JpaSpecificationExecutor { @Query(value = "from HousekeepingMetadata t where t.cleanupTimestamp <= :instant " + "and (t.housekeepingStatus = 'SCHEDULED' or t.housekeepingStatus = 'FAILED') " @@ -72,8 +72,7 @@ Optional findRecordForCleanupByDbTableAndPartitionName( + "and t.tableName = :tableName " + "and (t.housekeepingStatus = 'SCHEDULED' or t.housekeepingStatus = 'FAILED')") LocalDateTime findMaximumCleanupTimestampForDbAndTable( - @Param("databaseName") String databaseName, - @Param("tableName") String tableName); + @Param("databaseName") String databaseName, @Param("tableName") String tableName); /** * This method returns the count of all records for a database and table name pair where the partitionName is not diff --git a/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/repository/HousekeepingPathRepository.java b/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/repository/HousekeepingPathRepository.java index 2e28e858..04397025 100644 --- a/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/repository/HousekeepingPathRepository.java +++ b/beekeeper-core/src/main/java/com/expediagroup/beekeeper/core/repository/HousekeepingPathRepository.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2023 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.core.repository; @@ -22,6 +20,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; @@ -30,7 +29,8 @@ @Repository public interface HousekeepingPathRepository - extends PagingAndSortingRepository, JpaSpecificationExecutor { + extends PagingAndSortingRepository, CrudRepository, + JpaSpecificationExecutor { @Query(value = "from HousekeepingPath p where p.cleanupTimestamp <= :instant " + "and (p.housekeepingStatus = 'SCHEDULED' or p.housekeepingStatus = 'FAILED') " diff --git a/beekeeper-core/src/test/java/com/expediagroup/beekeeper/core/TestApplication.java b/beekeeper-core/src/test/java/com/expediagroup/beekeeper/core/TestApplication.java index a4302a61..8c78b910 100644 --- a/beekeeper-core/src/test/java/com/expediagroup/beekeeper/core/TestApplication.java +++ b/beekeeper-core/src/test/java/com/expediagroup/beekeeper/core/TestApplication.java @@ -1,30 +1,28 @@ /** - * Copyright (C) 2019-2021 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.core; import java.util.TimeZone; -import javax.annotation.PostConstruct; - import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.ComponentScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import jakarta.annotation.PostConstruct; + @SpringBootApplication @EnableConfigurationProperties @ComponentScan("com.expediagroup.beekeeper.core") @@ -36,5 +34,4 @@ public class TestApplication { void started() { TimeZone.setDefault(TimeZone.getTimeZone("UTC")); } - } diff --git a/beekeeper-core/src/test/java/com/expediagroup/beekeeper/core/repository/HousekeepingMetadataRepositoryTest.java b/beekeeper-core/src/test/java/com/expediagroup/beekeeper/core/repository/HousekeepingMetadataRepositoryTest.java index ef6df464..6a405baa 100644 --- a/beekeeper-core/src/test/java/com/expediagroup/beekeeper/core/repository/HousekeepingMetadataRepositoryTest.java +++ b/beekeeper-core/src/test/java/com/expediagroup/beekeeper/core/repository/HousekeepingMetadataRepositoryTest.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019-2023 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ import static java.time.temporal.ChronoUnit.DAYS; import static java.time.temporal.ChronoUnit.HOURS; +import static java.time.temporal.ChronoUnit.MICROS; import static java.time.temporal.ChronoUnit.MONTHS; import static org.assertj.core.api.Assertions.assertThat; @@ -71,7 +72,7 @@ public class HousekeepingMetadataRepositoryTest { private static final String DATABASE_NAME = "database"; private static final String TABLE_NAME = "table"; private static final String PARTITION_NAME = "event_date=2020-01-01/event_hour=0/event_type=A"; - private static final LocalDateTime CREATION_TIMESTAMP = LocalDateTime.now(ZoneId.of("UTC")); + private static final LocalDateTime CREATION_TIMESTAMP = LocalDateTime.now(ZoneId.of("UTC")).truncatedTo(MICROS); private static final PeriodDuration CLEANUP_DELAY = PeriodDuration.parse("P3D"); private static final LocalDateTime CLEANUP_TIMESTAMP = CREATION_TIMESTAMP.plus(CLEANUP_DELAY); @@ -525,8 +526,10 @@ private void compare(HousekeepingMetadata expected, HousekeepingMetadata actual) assertThat(actual.getTableName()).isEqualTo(expected.getTableName()); assertThat(actual.getPartitionName()).isEqualTo(expected.getPartitionName()); assertThat(actual.getHousekeepingStatus()).isEqualTo(expected.getHousekeepingStatus()); - assertThat(actual.getCreationTimestamp()).isEqualTo(expected.getCreationTimestamp()); - assertThat(actual.getModifiedTimestamp()).isEqualTo(expected.getModifiedTimestamp()); + assertThat(actual.getCreationTimestamp().truncatedTo(MICROS)) + .isEqualTo(expected.getCreationTimestamp().truncatedTo(MICROS)); + assertThat(actual.getModifiedTimestamp().truncatedTo(MICROS)) + .isEqualTo(expected.getModifiedTimestamp().truncatedTo(MICROS)); assertThat(actual.getCleanupDelay()).isEqualTo(expected.getCleanupDelay()); assertThat(actual.getCleanupAttempts()).isEqualTo(expected.getCleanupAttempts()); assertThat(actual.getLifecycleType()).isEqualTo(expected.getLifecycleType()); diff --git a/beekeeper-core/src/test/java/com/expediagroup/beekeeper/core/repository/HousekeepingPathRepositoryTest.java b/beekeeper-core/src/test/java/com/expediagroup/beekeeper/core/repository/HousekeepingPathRepositoryTest.java index 6aba9e9d..a79f2621 100644 --- a/beekeeper-core/src/test/java/com/expediagroup/beekeeper/core/repository/HousekeepingPathRepositoryTest.java +++ b/beekeeper-core/src/test/java/com/expediagroup/beekeeper/core/repository/HousekeepingPathRepositoryTest.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019-2023 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ import static java.time.temporal.ChronoUnit.DAYS; import static java.time.temporal.ChronoUnit.HOURS; +import static java.time.temporal.ChronoUnit.MICROS; import static java.time.temporal.ChronoUnit.MONTHS; import static org.assertj.core.api.Assertions.assertThat; @@ -64,7 +65,7 @@ @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) public class HousekeepingPathRepositoryTest { - private static final LocalDateTime CREATION_TIMESTAMP = LocalDateTime.now(ZoneId.of("UTC")); + private static final LocalDateTime CREATION_TIMESTAMP = LocalDateTime.now(ZoneId.of("UTC")).truncatedTo(MICROS); private static final PeriodDuration CLEANUP_DELAY = PeriodDuration.parse("PT1H"); private static final LocalDateTime CLEANUP_TIMESTAMP = CREATION_TIMESTAMP.plus(CLEANUP_DELAY); diff --git a/beekeeper-integration-tests/pom.xml b/beekeeper-integration-tests/pom.xml index 20065a7c..96443448 100644 --- a/beekeeper-integration-tests/pom.xml +++ b/beekeeper-integration-tests/pom.xml @@ -34,6 +34,18 @@ org.apache.hive hive-service-rpc + + javax.servlet + servlet-api + + + javax.servlet + javax.servlet-api + + + log4j + log4j + @@ -53,6 +65,18 @@ org.apache.hive hive-service-rpc + + javax.servlet + servlet-api + + + javax.servlet + javax.servlet-api + + + log4j + log4j + @@ -74,6 +98,10 @@ slf4j-log4j12 org.slf4j + + log4j + log4j + @@ -128,8 +156,34 @@ org.eclipse.jetty.aggregate jetty-all + + javax.servlet + servlet-api + + + javax.servlet + javax.servlet-api + + + log4j + log4j + + + tomcat + jasper-compiler + + + tomcat + jasper-runtime + + + org.apache.derby + derbytools + 10.16.1.1 + test + org.flywaydb flyway-mysql diff --git a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperDryRunMetadataCleanupIntegrationTest.java b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperDryRunMetadataCleanupIntegrationTest.java index dd1c80b0..55ecf156 100644 --- a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperDryRunMetadataCleanupIntegrationTest.java +++ b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperDryRunMetadataCleanupIntegrationTest.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2025 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.integration; @@ -28,6 +26,7 @@ import static com.expediagroup.beekeeper.integration.CommonTestVariables.TABLE_NAME_VALUE; import java.sql.SQLException; +import java.time.Duration; import java.util.List; import java.util.Map; import java.util.Set; @@ -38,8 +37,6 @@ import org.apache.hadoop.hive.metastore.HiveMetaStoreClient; import org.apache.hadoop.hive.metastore.api.Table; import org.apache.thrift.TException; -import org.awaitility.Duration; -import org.junit.Rule; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; @@ -47,6 +44,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import org.testcontainers.containers.localstack.LocalStackContainer; +import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; import ch.qos.logback.classic.spi.ILoggingEvent; @@ -116,20 +114,16 @@ public class BeekeeperDryRunMetadataCleanupIntegrationTest extends BeekeeperInte private static final String S3_CLIENT_CLASS_NAME = "S3Client"; private static final String HIVE_CLIENT_CLASS_NAME = "HiveClient"; - @Rule - public static final LocalStackContainer S3_CONTAINER = ContainerTestUtils.awsContainer(S3); - static { - S3_CONTAINER.start(); - } + @Container + private static final LocalStackContainer S3_CONTAINER = ContainerTestUtils.awsContainer(S3); private static AmazonS3 amazonS3; - private static final String S3_ENDPOINT = ContainerTestUtils.awsServiceEndpoint(S3_CONTAINER, S3); private final ExecutorService executorService = Executors.newFixedThreadPool(1); private final TestAppender appender = new TestAppender(); - private static Map metastoreProperties = ImmutableMap + private Map metastoreProperties = ImmutableMap .builder() - .put(ENDPOINT, S3_ENDPOINT) + .put(ENDPOINT, ContainerTestUtils.awsServiceEndpoint(S3_CONTAINER, S3)) .put(ACCESS_KEY, S3_ACCESS_KEY) .put(SECRET_KEY, S3_SECRET_KEY) .build(); @@ -146,7 +140,7 @@ public static void init() { System.setProperty(SPRING_PROFILES_ACTIVE_PROPERTY, "test"); System.setProperty(SCHEDULER_DELAY_MS_PROPERTY, SCHEDULER_DELAY_MS); System.setProperty(DRY_RUN_ENABLED_PROPERTY, "true"); - System.setProperty(AWS_S3_ENDPOINT_PROPERTY, S3_ENDPOINT); + System.setProperty(AWS_S3_ENDPOINT_PROPERTY, ContainerTestUtils.awsServiceEndpoint(S3_CONTAINER, S3)); System.setProperty(AWS_DISABLE_GET_VALIDATION_PROPERTY, "true"); System.setProperty(AWS_DISABLE_PUT_VALIDATION_PROPERTY, "true"); @@ -165,7 +159,6 @@ public static void teardown() { System.clearProperty(METASTORE_URI_PROPERTY); amazonS3.shutdown(); - S3_CONTAINER.stop(); } @BeforeEach @@ -179,7 +172,7 @@ void setup() { .getObjectSummaries() .forEach(object -> amazonS3.deleteObject(BUCKET, object.getKey())); executorService.execute(() -> BeekeeperMetadataCleanup.main(new String[] {})); - await().atMost(Duration.ONE_MINUTE).until(BeekeeperMetadataCleanup::isRunning); + await().atMost(Duration.ofMinutes(1)).until(BeekeeperMetadataCleanup::isRunning); // clear all logs before asserting them appender.clear(); diff --git a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperDryRunPathCleanupIntegrationTest.java b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperDryRunPathCleanupIntegrationTest.java index 63d2e443..01ef194c 100644 --- a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperDryRunPathCleanupIntegrationTest.java +++ b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperDryRunPathCleanupIntegrationTest.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2020 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.integration; @@ -24,12 +22,12 @@ import static com.expediagroup.beekeeper.integration.CommonTestVariables.TABLE_NAME_VALUE; import java.sql.SQLException; +import java.time.Duration; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import org.awaitility.Duration; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; @@ -115,8 +113,7 @@ public void setup() { .getObjectSummaries() .forEach(object -> amazonS3.deleteObject(BUCKET, object.getKey())); executorService.execute(() -> BeekeeperPathCleanup.main(new String[] {})); - await().atMost(Duration.ONE_MINUTE) - .until(BeekeeperPathCleanup::isRunning); + await().atMost(Duration.ofMinutes(1)).until(BeekeeperPathCleanup::isRunning); // clear all logs before asserting them appender.clear(); diff --git a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperExpiredMetadataSchedulerApiaryIntegrationTest.java b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperExpiredMetadataSchedulerApiaryIntegrationTest.java index 398033b4..98e3ddb3 100644 --- a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperExpiredMetadataSchedulerApiaryIntegrationTest.java +++ b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperExpiredMetadataSchedulerApiaryIntegrationTest.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2025 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.integration; @@ -36,6 +34,7 @@ import java.io.IOException; import java.net.URISyntaxException; import java.sql.SQLException; +import java.time.Duration; import java.util.List; import java.util.Map; import java.util.Set; @@ -46,7 +45,6 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; -import org.awaitility.Duration; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; @@ -86,6 +84,8 @@ public class BeekeeperExpiredMetadataSchedulerApiaryIntegrationTest extends Beek protected static final int TIMEOUT = 30; protected static final String APIARY_QUEUE_URL_PROPERTY = "properties.apiary.queue-url"; + protected static final String SQS_ENDPOINT_PROPERTY = "properties.sqs.endpoint"; + protected static final String SQS_REGION_PROPERTY = "properties.sqs.region"; protected static final String QUEUE = "apiary-receiver-queue"; protected static final String SCHEDULED_EXPIRED_METRIC = "metadata-scheduled"; @@ -116,16 +116,13 @@ public class BeekeeperExpiredMetadataSchedulerApiaryIntegrationTest extends Beek protected static final LocalStackContainer S3_CONTAINER = ContainerTestUtils.awsContainer(S3); protected static AmazonSQS amazonSQS; + protected static String ACTUAL_QUEUE_URL; protected HiveTestUtils hiveTestUtils; protected HiveMetaStoreClient metastoreClient; - static { - S3_CONTAINER.start(); - } - protected static AmazonS3 amazonS3; - private static Map metastoreProperties = ImmutableMap + private Map metastoreProperties = ImmutableMap .builder() .put(ENDPOINT, ContainerTestUtils.awsServiceEndpoint(S3_CONTAINER, S3)) .put(ACCESS_KEY, S3_ACCESS_KEY) @@ -138,11 +135,12 @@ public class BeekeeperExpiredMetadataSchedulerApiaryIntegrationTest extends Beek @BeforeAll public static void init() { - String queueUrl = ContainerTestUtils.queueUrl(SQS_CONTAINER, QUEUE); - System.setProperty(APIARY_QUEUE_URL_PROPERTY, queueUrl); - amazonSQS = ContainerTestUtils.sqsClient(SQS_CONTAINER, AWS_REGION); + ACTUAL_QUEUE_URL = ContainerTestUtils.queueUrl(SQS_CONTAINER, QUEUE); amazonSQS.createQueue(QUEUE); + System.setProperty(APIARY_QUEUE_URL_PROPERTY, ACTUAL_QUEUE_URL); + System.setProperty(SQS_ENDPOINT_PROPERTY, ContainerTestUtils.awsServiceEndpoint(SQS_CONTAINER, SQS)); + System.setProperty(SQS_REGION_PROPERTY, AWS_REGION); amazonS3 = ContainerTestUtils.s3Client(S3_CONTAINER, AWS_REGION); amazonS3.createBucket(new CreateBucketRequest(BUCKET, AWS_REGION)); @@ -151,6 +149,8 @@ public static void init() { @AfterAll public static void teardown() { System.clearProperty(APIARY_QUEUE_URL_PROPERTY); + System.clearProperty(SQS_ENDPOINT_PROPERTY); + System.clearProperty(SQS_REGION_PROPERTY); System.clearProperty(METASTORE_URI_PROPERTY); amazonSQS.shutdown(); @@ -163,11 +163,11 @@ public void setup() { metastoreClient = thriftHiveMetaStore.client(); hiveTestUtils = new HiveTestUtils(metastoreClient); - amazonSQS.purgeQueue(new PurgeQueueRequest(ContainerTestUtils.queueUrl(SQS_CONTAINER, QUEUE))); + amazonSQS.purgeQueue(new PurgeQueueRequest(ACTUAL_QUEUE_URL)); amazonS3.listObjectsV2(BUCKET).getObjectSummaries() .forEach(object -> amazonS3.deleteObject(BUCKET, object.getKey())); executorService.execute(() -> BeekeeperSchedulerApiary.main(new String[] {})); - await().atMost(Duration.ONE_MINUTE).until(BeekeeperSchedulerApiary::isRunning); + await().atMost(Duration.ofMinutes(1)).until(BeekeeperSchedulerApiary::isRunning); } @AfterEach @@ -351,7 +351,7 @@ public void prometheus() { } protected SendMessageRequest sendMessageRequest(String payload) { - return new SendMessageRequest(ContainerTestUtils.queueUrl(SQS_CONTAINER, QUEUE), payload); + return new SendMessageRequest(ACTUAL_QUEUE_URL, payload); } protected void assertExpiredMetadata(HousekeepingMetadata actual, String expectedPath, String partitionName) { diff --git a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperMetadataCleanupIntegrationTest.java b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperMetadataCleanupIntegrationTest.java index 4ec80b7c..98413aac 100644 --- a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperMetadataCleanupIntegrationTest.java +++ b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperMetadataCleanupIntegrationTest.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2025 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.integration; @@ -35,6 +33,7 @@ import static com.expediagroup.beekeeper.integration.CommonTestVariables.TABLE_NAME_VALUE; import java.sql.SQLException; +import java.time.Duration; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -50,8 +49,6 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.thrift.TException; -import org.awaitility.Duration; -import org.junit.Rule; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; @@ -59,6 +56,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import org.testcontainers.containers.localstack.LocalStackContainer; +import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; import io.micrometer.core.instrument.Meter; @@ -126,19 +124,15 @@ public class BeekeeperMetadataCleanupIntegrationTest extends BeekeeperIntegratio + UNPARTITIONED_TABLE_NAME + "/id1/file1"; - @Rule - public static final LocalStackContainer S3_CONTAINER = ContainerTestUtils.awsContainer(S3); - static { - S3_CONTAINER.start(); - } + @Container + protected static final LocalStackContainer S3_CONTAINER = ContainerTestUtils.awsContainer(S3); protected static AmazonS3 amazonS3; - protected static final String S3_ENDPOINT = ContainerTestUtils.awsServiceEndpoint(S3_CONTAINER, S3); protected final ExecutorService executorService = Executors.newFixedThreadPool(1); - private static Map metastoreProperties = ImmutableMap + private Map metastoreProperties = ImmutableMap .builder() - .put(ENDPOINT, S3_ENDPOINT) + .put(ENDPOINT, ContainerTestUtils.awsServiceEndpoint(S3_CONTAINER, S3)) .put(ACCESS_KEY, S3_ACCESS_KEY) .put(SECRET_KEY, S3_SECRET_KEY) .build(); @@ -155,7 +149,7 @@ public static void init() { System.setProperty(SPRING_PROFILES_ACTIVE_PROPERTY, "test"); System.setProperty(SCHEDULER_DELAY_MS_PROPERTY, SCHEDULER_DELAY_MS); System.setProperty(DRY_RUN_ENABLED_PROPERTY, "false"); - System.setProperty(AWS_S3_ENDPOINT_PROPERTY, S3_ENDPOINT); + System.setProperty(AWS_S3_ENDPOINT_PROPERTY, ContainerTestUtils.awsServiceEndpoint(S3_CONTAINER, S3)); System.setProperty(AWS_DISABLE_GET_VALIDATION_PROPERTY, "true"); System.setProperty(AWS_DISABLE_PUT_VALIDATION_PROPERTY, "true"); @@ -166,7 +160,6 @@ public static void init() { @AfterAll public static void teardown() { amazonS3.shutdown(); - S3_CONTAINER.stop(); System.clearProperty(SPRING_PROFILES_ACTIVE_PROPERTY); System.clearProperty(SCHEDULER_DELAY_MS_PROPERTY); @@ -188,7 +181,7 @@ public void setup() { .getObjectSummaries() .forEach(object -> amazonS3.deleteObject(BUCKET, object.getKey())); executorService.execute(() -> BeekeeperMetadataCleanup.main(new String[] {})); - await().atMost(Duration.ONE_MINUTE).until(BeekeeperMetadataCleanup::isRunning); + await().atMost(Duration.ofMinutes(1)).until(BeekeeperMetadataCleanup::isRunning); } @AfterEach @@ -213,7 +206,7 @@ public void cleanupUnpartitionedTable() throws TException, SQLException { @Test public void cleanupPartitionedTable() throws Exception { - Table table = hiveTestUtils.createTableWithProperties(PARTITIONED_TABLE_PATH, TABLE_NAME_VALUE, true, createBeeKeeperDeletionProperties(), true); + Table table = hiveTestUtils.createTableWithProperties(PARTITIONED_TABLE_PATH, TABLE_NAME_VALUE,true, createBeeKeeperDeletionProperties(),true); hiveTestUtils.addPartitionsToTable(PARTITION_ROOT_PATH, table, PARTITION_VALUES); amazonS3.putObject(BUCKET, PARTITIONED_TABLE_OBJECT_KEY, ""); @@ -376,7 +369,7 @@ public void onlyCleanupLocationWhenTableExists() throws SQLException { @Test public void onlyCleanupLocationWhenPartitionExists() throws TException, SQLException { - hiveTestUtils.createTableWithProperties(PARTITIONED_TABLE_PATH, TABLE_NAME_VALUE, true, createBeeKeeperDeletionProperties() ,true); + hiveTestUtils.createTableWithProperties(PARTITIONED_TABLE_PATH, TABLE_NAME_VALUE, true, createBeeKeeperDeletionProperties(), true); amazonS3.putObject(BUCKET, PARTITIONED_TABLE_OBJECT_KEY, ""); amazonS3.putObject(BUCKET, PARTITIONED_OBJECT_KEY, TABLE_DATA); diff --git a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperPathCleanupIntegrationTest.java b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperPathCleanupIntegrationTest.java index 64309c55..88fa4b1c 100644 --- a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperPathCleanupIntegrationTest.java +++ b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperPathCleanupIntegrationTest.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2024 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.integration; @@ -27,6 +25,7 @@ import static com.expediagroup.beekeeper.integration.CommonTestVariables.TABLE_NAME_VALUE; import java.sql.SQLException; +import java.time.Duration; import java.util.List; import java.util.Set; import java.util.concurrent.ExecutorService; @@ -36,7 +35,6 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; -import org.awaitility.Duration; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; @@ -117,7 +115,7 @@ public void setup() { .getObjectSummaries() .forEach(object -> amazonS3.deleteObject(BUCKET, object.getKey())); executorService.execute(() -> BeekeeperPathCleanup.main(new String[] {})); - await().atMost(Duration.ONE_MINUTE) + await().atMost(Duration.ofMinutes(1)) .until(BeekeeperPathCleanup::isRunning); } diff --git a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperUnreferencedPathSchedulerApiaryIntegrationTest.java b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperUnreferencedPathSchedulerApiaryIntegrationTest.java index 67a2c39d..eda37c91 100644 --- a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperUnreferencedPathSchedulerApiaryIntegrationTest.java +++ b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/BeekeeperUnreferencedPathSchedulerApiaryIntegrationTest.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2025 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.integration; @@ -34,6 +32,7 @@ import java.io.IOException; import java.net.URISyntaxException; import java.sql.SQLException; +import java.time.Duration; import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; @@ -41,7 +40,6 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; -import org.awaitility.Duration; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; @@ -75,7 +73,7 @@ @Testcontainers public class BeekeeperUnreferencedPathSchedulerApiaryIntegrationTest extends BeekeeperIntegrationTestBase { - protected static final int TIMEOUT = 5; + protected static final int TIMEOUT = 30; protected static final String APIARY_QUEUE_URL_PROPERTY = "properties.apiary.queue-url"; protected static final String METASTORE_URI_PROPERTY = "properties.metastore-uri"; @@ -87,23 +85,30 @@ public class BeekeeperUnreferencedPathSchedulerApiaryIntegrationTest extends Bee @Container protected static final LocalStackContainer SQS_CONTAINER = ContainerTestUtils.awsContainer(SQS); protected static AmazonSQS amazonSQS; + protected static String ACTUAL_QUEUE_URL; @RegisterExtension protected ThriftHiveMetaStoreJUnitExtension thriftHiveMetaStore = new ThriftHiveMetaStoreJUnitExtension( DATABASE_NAME_VALUE, emptyMap()); + protected static final String SQS_ENDPOINT_PROPERTY = "properties.sqs.endpoint"; + protected static final String SQS_REGION_PROPERTY = "properties.sqs.region"; + @BeforeAll public static void init() { - String queueUrl = ContainerTestUtils.queueUrl(SQS_CONTAINER, QUEUE); - System.setProperty(APIARY_QUEUE_URL_PROPERTY, queueUrl); - amazonSQS = ContainerTestUtils.sqsClient(SQS_CONTAINER, AWS_REGION); + ACTUAL_QUEUE_URL = ContainerTestUtils.queueUrl(SQS_CONTAINER, QUEUE); amazonSQS.createQueue(QUEUE); + System.setProperty(APIARY_QUEUE_URL_PROPERTY, ACTUAL_QUEUE_URL); + System.setProperty(SQS_ENDPOINT_PROPERTY, ContainerTestUtils.awsServiceEndpoint(SQS_CONTAINER, SQS)); + System.setProperty(SQS_REGION_PROPERTY, AWS_REGION); } @AfterAll public static void teardown() { System.clearProperty(APIARY_QUEUE_URL_PROPERTY); + System.clearProperty(SQS_ENDPOINT_PROPERTY); + System.clearProperty(SQS_REGION_PROPERTY); amazonSQS.shutdown(); } @@ -112,9 +117,9 @@ public static void teardown() { public void setup() { System.setProperty(METASTORE_URI_PROPERTY, thriftHiveMetaStore.getThriftConnectionUri()); - amazonSQS.purgeQueue(new PurgeQueueRequest(ContainerTestUtils.queueUrl(SQS_CONTAINER, QUEUE))); + amazonSQS.purgeQueue(new PurgeQueueRequest(ACTUAL_QUEUE_URL)); executorService.execute(() -> BeekeeperSchedulerApiary.main(new String[] {})); - await().atMost(Duration.ONE_MINUTE).until(BeekeeperSchedulerApiary::isRunning); + await().atMost(Duration.ofMinutes(1)).until(BeekeeperSchedulerApiary::isRunning); } @AfterEach @@ -242,7 +247,7 @@ public void prometheus() { } protected SendMessageRequest sendMessageRequest(String payload) { - return new SendMessageRequest(ContainerTestUtils.queueUrl(SQS_CONTAINER, QUEUE), payload); + return new SendMessageRequest(ACTUAL_QUEUE_URL, payload); } protected void assertUnreferencedPath(HousekeepingPath actual, String expectedPath) { diff --git a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/api/BeekeeperApiIntegrationTest.java b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/api/BeekeeperApiIntegrationTest.java index d7cbc63c..9c59c733 100644 --- a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/api/BeekeeperApiIntegrationTest.java +++ b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/api/BeekeeperApiIntegrationTest.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2025 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.integration.api; @@ -26,6 +24,7 @@ import static com.expediagroup.beekeeper.integration.CommonTestVariables.DATABASE_NAME_VALUE; import java.io.IOException; +import java.net.ServerSocket; import java.net.http.HttpResponse; import java.sql.SQLException; import java.time.Duration; @@ -43,7 +42,6 @@ import org.springframework.context.ConfigurableApplicationContext; import org.springframework.data.domain.Page; import org.springframework.http.HttpStatus; -import org.springframework.util.SocketUtils; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; @@ -91,10 +89,14 @@ public ObjectMapper geObjectMapper() { protected final HousekeepingMetadata testMetadataC = createHousekeepingMetadata(someTable, pathC, partitionC, LifecycleEventType.EXPIRED, duration.toString(),HousekeepingStatus.FAILED); protected final HousekeepingMetadata testMetadataD = createHousekeepingMetadata(someTable, pathC, partitionB, LifecycleEventType.UNREFERENCED, duration.toString(), HousekeepingStatus.SCHEDULED); protected final HousekeepingMetadata testMetadataE = createHousekeepingMetadata(someTable, pathC, partitionC, LifecycleEventType.UNREFERENCED, duration.toString(),HousekeepingStatus.SCHEDULED); + @BeforeEach - public void beforeEach() { - int port = SocketUtils.findAvailableTcpPort(); - String[] args = new String[] { "--server.port=" + port }; + public void beforeEach() throws IOException { + int port; + try (ServerSocket socket = new ServerSocket(0)) { + port = socket.getLocalPort(); + } + String[] args = new String[] {"--server.port=" + port}; final String url = format("http://localhost:%d", port); log.info("Starting to run Beekeeper API on: {} and args: {}", url, args); context = SpringApplication.run(BeekeeperApiApplication.class, args); diff --git a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/utils/ContainerTestUtils.java b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/utils/ContainerTestUtils.java index 32b8241d..38f9bb7b 100644 --- a/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/utils/ContainerTestUtils.java +++ b/beekeeper-integration-tests/src/test/java/com/expediagroup/beekeeper/integration/utils/ContainerTestUtils.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2023 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.integration.utils; @@ -20,6 +18,7 @@ import org.testcontainers.containers.MySQLContainer; import org.testcontainers.containers.localstack.LocalStackContainer; +import org.testcontainers.utility.DockerImageName; import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; import com.amazonaws.services.s3.AmazonS3; @@ -36,15 +35,16 @@ public static MySQLContainer mySqlContainer() { } public static LocalStackContainer awsContainer(LocalStackContainer.Service service) { - return new LocalStackContainer().withServices(service); + return new LocalStackContainer(DockerImageName.parse("localstack/localstack:3.0.0")) + .withServices(service); } public static String awsServiceEndpoint(LocalStackContainer awsContainer, LocalStackContainer.Service service) { - return awsContainer.getEndpointConfiguration(service).getServiceEndpoint(); + return awsContainer.getEndpointOverride(service).toString(); } public static String queueUrl(LocalStackContainer awsContainer, String queue) { - return awsServiceEndpoint(awsContainer, SQS) + "/queue/" + queue; + return awsServiceEndpoint(awsContainer, SQS) + "/000000000000/" + queue; } public static AmazonSQS sqsClient(LocalStackContainer awsContainer, String region) { @@ -61,6 +61,7 @@ public static AmazonS3 s3Client(LocalStackContainer awsContainer, String region) return AmazonS3ClientBuilder .standard() .withEndpointConfiguration(endpointConfiguration) + .withPathStyleAccessEnabled(true) .disableChunkedEncoding() .build(); } diff --git a/beekeeper-metadata-cleanup/pom.xml b/beekeeper-metadata-cleanup/pom.xml index 279c8a5f..ac1c7086 100644 --- a/beekeeper-metadata-cleanup/pom.xml +++ b/beekeeper-metadata-cleanup/pom.xml @@ -37,9 +37,13 @@ - mysql - mysql-connector-java - 8.0.17 + com.h2database + h2 + test + + + com.mysql + mysql-connector-j org.springframework.boot @@ -76,6 +80,18 @@ javax.servlet servlet-api + + javax.servlet + javax.servlet-api + + + org.slf4j + slf4j-reload4j + + + log4j + log4j + @@ -133,14 +149,16 @@ - pl.project13.maven - git-commit-id-plugin + io.github.git-commit-id + git-commit-id-maven-plugin + 7.0.0 com.google.cloud.tools jib-maven-plugin + eclipse-temurin:21-jre amd64 @@ -154,6 +172,16 @@ USE_CURRENT_TIMESTAMP + + --add-opens=java.base/java.lang=ALL-UNNAMED + --add-opens=java.base/java.lang.reflect=ALL-UNNAMED + --add-opens=java.base/java.io=ALL-UNNAMED + --add-opens=java.base/java.net=ALL-UNNAMED + --add-opens=java.base/java.nio=ALL-UNNAMED + --add-opens=java.base/java.util=ALL-UNNAMED + --add-opens=java.base/java.util.concurrent=ALL-UNNAMED + --add-opens=java.base/sun.nio.ch=ALL-UNNAMED + diff --git a/beekeeper-metadata-cleanup/src/main/resources/beekeeper-metadata-cleanup-application.yml b/beekeeper-metadata-cleanup/src/main/resources/beekeeper-metadata-cleanup-application.yml index f0c7ae1f..0fd60f78 100644 --- a/beekeeper-metadata-cleanup/src/main/resources/beekeeper-metadata-cleanup-application.yml +++ b/beekeeper-metadata-cleanup/src/main/resources/beekeeper-metadata-cleanup-application.yml @@ -9,7 +9,7 @@ spring: hibernate: ddl-auto: validate properties.hibernate: - dialect: org.hibernate.dialect.MySQL8Dialect + dialect: org.hibernate.dialect.MySQLDialect properties: cleanup-page-size: 500 dry-run-enabled: false diff --git a/beekeeper-metadata-cleanup/src/test/java/com/expediagroup/beekeeper/metadata/cleanup/TestApplication.java b/beekeeper-metadata-cleanup/src/test/java/com/expediagroup/beekeeper/metadata/cleanup/TestApplication.java index 96d4a8e9..8ffaedad 100644 --- a/beekeeper-metadata-cleanup/src/test/java/com/expediagroup/beekeeper/metadata/cleanup/TestApplication.java +++ b/beekeeper-metadata-cleanup/src/test/java/com/expediagroup/beekeeper/metadata/cleanup/TestApplication.java @@ -1,30 +1,28 @@ /** - * Copyright (C) 2019-2021 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.metadata.cleanup; import java.util.TimeZone; -import javax.annotation.PostConstruct; - import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.ComponentScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import jakarta.annotation.PostConstruct; + @SpringBootApplication @EnableConfigurationProperties @ComponentScan("com.expediagroup.beekeeper.core") diff --git a/beekeeper-metadata-cleanup/src/test/java/com/expediagroup/beekeeper/metadata/cleanup/service/CleanupServiceSchedulerTest.java b/beekeeper-metadata-cleanup/src/test/java/com/expediagroup/beekeeper/metadata/cleanup/service/CleanupServiceSchedulerTest.java index 0757d3ec..1fc99238 100644 --- a/beekeeper-metadata-cleanup/src/test/java/com/expediagroup/beekeeper/metadata/cleanup/service/CleanupServiceSchedulerTest.java +++ b/beekeeper-metadata-cleanup/src/test/java/com/expediagroup/beekeeper/metadata/cleanup/service/CleanupServiceSchedulerTest.java @@ -21,9 +21,9 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.verify; +import java.time.Duration; import java.time.Instant; -import org.awaitility.Duration; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; @@ -58,7 +58,7 @@ class CleanupServiceSchedulerTest { @Test void typical() { - await().atMost(Duration.TEN_SECONDS) + await().atMost(Duration.ofSeconds(10)) .untilAsserted(() -> verify(cleanupService, atLeast(2)).cleanUp(any())); } @@ -66,7 +66,7 @@ void typical() { void cleanupServiceException() { doThrow(BeekeeperException.class).when(cleanupService) .cleanUp(any(Instant.class)); - await().atMost(Duration.TEN_SECONDS) + await().atMost(Duration.ofSeconds(10)) .untilAsserted(() -> verify(cleanupService, atLeast(2)).cleanUp(any())); } } diff --git a/beekeeper-metadata-cleanup/src/test/java/com/expediagroup/beekeeper/metadata/cleanup/service/PagingMetadataCleanupServiceTest.java b/beekeeper-metadata-cleanup/src/test/java/com/expediagroup/beekeeper/metadata/cleanup/service/PagingMetadataCleanupServiceTest.java index b022d3b2..6d3b4e94 100644 --- a/beekeeper-metadata-cleanup/src/test/java/com/expediagroup/beekeeper/metadata/cleanup/service/PagingMetadataCleanupServiceTest.java +++ b/beekeeper-metadata-cleanup/src/test/java/com/expediagroup/beekeeper/metadata/cleanup/service/PagingMetadataCleanupServiceTest.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2025 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.metadata.cleanup.service; @@ -61,8 +59,8 @@ import com.expediagroup.beekeeper.cleanup.hive.HiveClientFactory; import com.expediagroup.beekeeper.cleanup.metadata.MetadataCleaner; import com.expediagroup.beekeeper.cleanup.path.PathCleaner; +import com.expediagroup.beekeeper.core.model.HousekeepingEntity; import com.expediagroup.beekeeper.core.model.HousekeepingMetadata; -import com.expediagroup.beekeeper.core.model.HousekeepingPath; import com.expediagroup.beekeeper.core.model.HousekeepingStatus; import com.expediagroup.beekeeper.core.model.PeriodDuration; import com.expediagroup.beekeeper.core.repository.HousekeepingMetadataRepository; @@ -73,7 +71,7 @@ @ExtendWith(SpringExtension.class) @ExtendWith(MockitoExtension.class) -@ContextConfiguration(classes = { TestApplication.class }, loader = AnnotationConfigContextLoader.class) +@ContextConfiguration(classes = {TestApplication.class}, loader = AnnotationConfigContextLoader.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) public class PagingMetadataCleanupServiceTest { @@ -83,7 +81,7 @@ public class PagingMetadataCleanupServiceTest { private final LocalDateTime localNow = LocalDateTime.ofInstant(Instant.now(), ZoneOffset.UTC); private PagingMetadataCleanupService pagingCleanupService; private @Captor ArgumentCaptor metadataCaptor; - private @Captor ArgumentCaptor pathCaptor; + private @Captor ArgumentCaptor pathCaptor; private @Captor ArgumentCaptor hiveClientCaptor; private @Autowired HousekeepingMetadataRepository metadataRepository; private @MockBean MetadataCleaner metadataCleaner; diff --git a/beekeeper-metadata-cleanup/src/test/java/com/expediagroup/beekeeper/metadata/cleanup/service/RepositoryCleanupSchedulerTest.java b/beekeeper-metadata-cleanup/src/test/java/com/expediagroup/beekeeper/metadata/cleanup/service/RepositoryCleanupSchedulerTest.java index d84ea203..28b735b3 100644 --- a/beekeeper-metadata-cleanup/src/test/java/com/expediagroup/beekeeper/metadata/cleanup/service/RepositoryCleanupSchedulerTest.java +++ b/beekeeper-metadata-cleanup/src/test/java/com/expediagroup/beekeeper/metadata/cleanup/service/RepositoryCleanupSchedulerTest.java @@ -21,9 +21,9 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.verify; +import java.time.Duration; import java.time.Instant; -import org.awaitility.Duration; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; @@ -55,7 +55,7 @@ class RepositoryCleanupSchedulerTest { @Test void typical() { - await().atMost(Duration.TEN_SECONDS) + await().atMost(Duration.ofSeconds(10)) .untilAsserted(() -> verify(repositoryCleanupService, atLeast(2)).cleanUp(any())); } @@ -63,7 +63,7 @@ void typical() { void cleanupServiceException() { doThrow(BeekeeperException.class).when(repositoryCleanupService) .cleanUp(any(Instant.class)); - await().atMost(Duration.TEN_SECONDS) + await().atMost(Duration.ofSeconds(10)) .untilAsserted(() -> verify(repositoryCleanupService, atLeast(2)).cleanUp(any())); } } diff --git a/beekeeper-path-cleanup/pom.xml b/beekeeper-path-cleanup/pom.xml index 99015d6f..d8b41fe7 100644 --- a/beekeeper-path-cleanup/pom.xml +++ b/beekeeper-path-cleanup/pom.xml @@ -39,9 +39,8 @@ h2 - mysql - mysql-connector-java - 8.0.17 + com.mysql + mysql-connector-j org.springframework.boot @@ -113,14 +112,16 @@ - pl.project13.maven - git-commit-id-plugin + io.github.git-commit-id + git-commit-id-maven-plugin + 7.0.0 com.google.cloud.tools jib-maven-plugin + eclipse-temurin:21-jre amd64 @@ -134,6 +135,16 @@ USE_CURRENT_TIMESTAMP + + --add-opens=java.base/java.lang=ALL-UNNAMED + --add-opens=java.base/java.lang.reflect=ALL-UNNAMED + --add-opens=java.base/java.io=ALL-UNNAMED + --add-opens=java.base/java.net=ALL-UNNAMED + --add-opens=java.base/java.nio=ALL-UNNAMED + --add-opens=java.base/java.util=ALL-UNNAMED + --add-opens=java.base/java.util.concurrent=ALL-UNNAMED + --add-opens=java.base/sun.nio.ch=ALL-UNNAMED + diff --git a/beekeeper-path-cleanup/src/main/resources/beekeeper-path-cleanup-application.yml b/beekeeper-path-cleanup/src/main/resources/beekeeper-path-cleanup-application.yml index fab3d2d3..43cdb976 100644 --- a/beekeeper-path-cleanup/src/main/resources/beekeeper-path-cleanup-application.yml +++ b/beekeeper-path-cleanup/src/main/resources/beekeeper-path-cleanup-application.yml @@ -9,7 +9,7 @@ spring: hibernate: ddl-auto: validate properties.hibernate: - dialect: org.hibernate.dialect.MySQL8Dialect + dialect: org.hibernate.dialect.MySQLDialect properties: cleanup-page-size: 500 dry-run-enabled: false diff --git a/beekeeper-path-cleanup/src/test/java/com/expediagroup/beekeeper/path/cleanup/TestApplication.java b/beekeeper-path-cleanup/src/test/java/com/expediagroup/beekeeper/path/cleanup/TestApplication.java index 255a07f2..1cb68316 100644 --- a/beekeeper-path-cleanup/src/test/java/com/expediagroup/beekeeper/path/cleanup/TestApplication.java +++ b/beekeeper-path-cleanup/src/test/java/com/expediagroup/beekeeper/path/cleanup/TestApplication.java @@ -1,30 +1,28 @@ /** - * Copyright (C) 2019-2021 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.path.cleanup; import java.util.TimeZone; -import javax.annotation.PostConstruct; - import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.ComponentScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import jakarta.annotation.PostConstruct; + @SpringBootApplication @EnableConfigurationProperties @ComponentScan("com.expediagroup.beekeeper.core") diff --git a/beekeeper-path-cleanup/src/test/java/com/expediagroup/beekeeper/path/cleanup/service/CleanupServiceSchedulerTest.java b/beekeeper-path-cleanup/src/test/java/com/expediagroup/beekeeper/path/cleanup/service/CleanupServiceSchedulerTest.java index 85390fa0..7807da61 100644 --- a/beekeeper-path-cleanup/src/test/java/com/expediagroup/beekeeper/path/cleanup/service/CleanupServiceSchedulerTest.java +++ b/beekeeper-path-cleanup/src/test/java/com/expediagroup/beekeeper/path/cleanup/service/CleanupServiceSchedulerTest.java @@ -21,9 +21,9 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.verify; +import java.time.Duration; import java.time.Instant; -import org.awaitility.Duration; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; @@ -60,7 +60,7 @@ class CleanupServiceSchedulerTest { @Test void typical() { - await().atMost(Duration.TEN_SECONDS) + await().atMost(Duration.ofSeconds(10)) .untilAsserted(() -> verify(cleanupService, atLeast(2)).cleanUp(any())); } @@ -68,7 +68,7 @@ void typical() { void cleanupServiceException() { doThrow(BeekeeperException.class).when(cleanupService) .cleanUp(any(Instant.class)); - await().atMost(Duration.TEN_SECONDS) + await().atMost(Duration.ofSeconds(10)) .untilAsserted(() -> verify(cleanupService, atLeast(2)).cleanUp(any())); } } diff --git a/beekeeper-path-cleanup/src/test/java/com/expediagroup/beekeeper/path/cleanup/service/RepositoryCleanupSchedulerTest.java b/beekeeper-path-cleanup/src/test/java/com/expediagroup/beekeeper/path/cleanup/service/RepositoryCleanupSchedulerTest.java index fafeecbc..6945c34e 100644 --- a/beekeeper-path-cleanup/src/test/java/com/expediagroup/beekeeper/path/cleanup/service/RepositoryCleanupSchedulerTest.java +++ b/beekeeper-path-cleanup/src/test/java/com/expediagroup/beekeeper/path/cleanup/service/RepositoryCleanupSchedulerTest.java @@ -21,9 +21,9 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.verify; +import java.time.Duration; import java.time.Instant; -import org.awaitility.Duration; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; @@ -55,7 +55,7 @@ class RepositoryCleanupSchedulerTest { @Test void typical() { - await().atMost(Duration.TEN_SECONDS) + await().atMost(Duration.ofSeconds(10)) .untilAsserted(() -> verify(repositoryCleanupService, atLeast(2)).cleanUp(any())); } @@ -63,7 +63,7 @@ void typical() { void cleanupServiceException() { doThrow(BeekeeperException.class).when(repositoryCleanupService) .cleanUp(any(Instant.class)); - await().atMost(Duration.TEN_SECONDS) + await().atMost(Duration.ofSeconds(10)) .untilAsserted(() -> verify(repositoryCleanupService, atLeast(2)).cleanUp(any())); } } diff --git a/beekeeper-scheduler-apiary/pom.xml b/beekeeper-scheduler-apiary/pom.xml index ccd89134..96a69bfa 100644 --- a/beekeeper-scheduler-apiary/pom.xml +++ b/beekeeper-scheduler-apiary/pom.xml @@ -48,10 +48,22 @@ javax.servlet servlet-api + + javax.servlet + javax.servlet-api + org.eclipse.jetty.orbit javax.servlet + + org.slf4j + slf4j-reload4j + + + log4j + log4j + org.apache.geronimo.specs geronimo-jaspic_1.0_spec @@ -67,14 +79,12 @@ - mysql - mysql-connector-java - 8.0.17 + com.mysql + mysql-connector-j org.flywaydb - flyway-core - 5.2.4 + flyway-mysql org.springframework.boot @@ -131,14 +141,16 @@ - pl.project13.maven - git-commit-id-plugin + io.github.git-commit-id + git-commit-id-maven-plugin + 7.0.0 com.google.cloud.tools jib-maven-plugin + eclipse-temurin:21-jre amd64 @@ -152,6 +164,16 @@ USE_CURRENT_TIMESTAMP + + --add-opens=java.base/java.lang=ALL-UNNAMED + --add-opens=java.base/java.lang.reflect=ALL-UNNAMED + --add-opens=java.base/java.io=ALL-UNNAMED + --add-opens=java.base/java.net=ALL-UNNAMED + --add-opens=java.base/java.nio=ALL-UNNAMED + --add-opens=java.base/java.util=ALL-UNNAMED + --add-opens=java.base/java.util.concurrent=ALL-UNNAMED + --add-opens=java.base/sun.nio.ch=ALL-UNNAMED + diff --git a/beekeeper-scheduler-apiary/src/main/java/com/expediagroup/beekeeper/scheduler/apiary/app/SchedulerApiaryRunner.java b/beekeeper-scheduler-apiary/src/main/java/com/expediagroup/beekeeper/scheduler/apiary/app/SchedulerApiaryRunner.java index 31e923e4..7234180a 100644 --- a/beekeeper-scheduler-apiary/src/main/java/com/expediagroup/beekeeper/scheduler/apiary/app/SchedulerApiaryRunner.java +++ b/beekeeper-scheduler-apiary/src/main/java/com/expediagroup/beekeeper/scheduler/apiary/app/SchedulerApiaryRunner.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2020 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.scheduler.apiary.app; @@ -20,8 +18,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.locks.ReentrantLock; -import javax.annotation.PreDestroy; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -29,6 +25,8 @@ import org.springframework.boot.ApplicationRunner; import org.springframework.stereotype.Component; +import jakarta.annotation.PreDestroy; + import com.expediagroup.beekeeper.core.error.BeekeeperException; import com.expediagroup.beekeeper.scheduler.apiary.service.SchedulerApiary; diff --git a/beekeeper-scheduler-apiary/src/main/java/com/expediagroup/beekeeper/scheduler/apiary/context/CommonBeans.java b/beekeeper-scheduler-apiary/src/main/java/com/expediagroup/beekeeper/scheduler/apiary/context/CommonBeans.java index 53893e35..01824679 100644 --- a/beekeeper-scheduler-apiary/src/main/java/com/expediagroup/beekeeper/scheduler/apiary/context/CommonBeans.java +++ b/beekeeper-scheduler-apiary/src/main/java/com/expediagroup/beekeeper/scheduler/apiary/context/CommonBeans.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2025 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.scheduler.apiary.context; @@ -29,6 +27,10 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.retry.annotation.EnableRetry; +import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; +import com.amazonaws.services.sqs.AmazonSQS; +import com.amazonaws.services.sqs.AmazonSQSClientBuilder; + import com.expedia.apiary.extensions.receiver.common.event.AddPartitionEvent; import com.expedia.apiary.extensions.receiver.common.event.AlterPartitionEvent; import com.expedia.apiary.extensions.receiver.common.event.AlterTableEvent; @@ -78,8 +80,19 @@ public EnumMap schedulerServiceMap(List handlers = List.of( unreferencedHousekeepingPathMessageEventHandler, expiredHousekeepingMetadataMessageEventHandler diff --git a/beekeeper-scheduler-apiary/src/main/resources/beekeeper-scheduler-apiary-application.yml b/beekeeper-scheduler-apiary/src/main/resources/beekeeper-scheduler-apiary-application.yml index 089c744f..9b89d0a6 100644 --- a/beekeeper-scheduler-apiary/src/main/resources/beekeeper-scheduler-apiary-application.yml +++ b/beekeeper-scheduler-apiary/src/main/resources/beekeeper-scheduler-apiary-application.yml @@ -9,7 +9,7 @@ spring: hibernate: ddl-auto: validate properties.hibernate: - dialect: org.hibernate.dialect.MySQL8Dialect + dialect: org.hibernate.dialect.MySQLDialect properties: beekeeper: default-cleanup-delay: P3D diff --git a/beekeeper-scheduler-apiary/src/test/java/com/expediagroup/beekeeper/scheduler/apiary/app/SchedulerApiaryRunnerTest.java b/beekeeper-scheduler-apiary/src/test/java/com/expediagroup/beekeeper/scheduler/apiary/app/SchedulerApiaryRunnerTest.java index c57ddd7c..2c749cd1 100644 --- a/beekeeper-scheduler-apiary/src/test/java/com/expediagroup/beekeeper/scheduler/apiary/app/SchedulerApiaryRunnerTest.java +++ b/beekeeper-scheduler-apiary/src/test/java/com/expediagroup/beekeeper/scheduler/apiary/app/SchedulerApiaryRunnerTest.java @@ -27,7 +27,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; -import org.awaitility.Duration; +import java.time.Duration; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -54,7 +54,7 @@ public void init() { @Test public void typicalRun() throws Exception { runRunner(); - await().atMost(Duration.FIVE_SECONDS) + await().atMost(Duration.ofSeconds(5)) .untilAsserted(() -> verify(schedulerApiary, atLeast(1)).scheduleBeekeeperEvent()); destroy(); verify(schedulerApiary).close(); @@ -67,7 +67,7 @@ public void typicalRunWithException() throws Exception { .when(schedulerApiary) .scheduleBeekeeperEvent(); runRunner(); - await().atMost(Duration.FIVE_SECONDS) + await().atMost(Duration.ofSeconds(5)) .untilAsserted(() -> verify(schedulerApiary, atLeast(2)).scheduleBeekeeperEvent()); destroy(); verify(schedulerApiary).close(); @@ -83,7 +83,7 @@ public void typicalRunSchedulerTimesoutOnDestroy() throws Exception { try { runRunner(); - await().atMost(Duration.FIVE_SECONDS) + await().atMost(Duration.ofSeconds(5)) .untilAsserted(() -> verify(schedulerApiary, atLeast(1)).scheduleBeekeeperEvent()); destroy(); fail("Runner should have thrown exception"); diff --git a/beekeeper-scheduler-apiary/src/test/java/com/expediagroup/beekeeper/scheduler/apiary/context/CommonBeansTest.java b/beekeeper-scheduler-apiary/src/test/java/com/expediagroup/beekeeper/scheduler/apiary/context/CommonBeansTest.java index 2e2441f1..aef53bb0 100644 --- a/beekeeper-scheduler-apiary/src/test/java/com/expediagroup/beekeeper/scheduler/apiary/context/CommonBeansTest.java +++ b/beekeeper-scheduler-apiary/src/test/java/com/expediagroup/beekeeper/scheduler/apiary/context/CommonBeansTest.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2025 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.scheduler.apiary.context; @@ -86,7 +84,7 @@ public void validateSchedulerServiceMap() { @Test public void validateMessageReader() { - MessageReader reader = commonBeans.messageReader("some_path"); + MessageReader reader = commonBeans.messageReader("some_path", "", "us-east-1"); assertThat(reader).isInstanceOf(SqsMessageReader.class); } @@ -98,7 +96,8 @@ public void validateRetryingMessageReader() { @Test public void validateUnreferencedHousekeepingPathGenerator() { - HousekeepingEntityGenerator generator = commonBeans.unreferencedHousekeepingPathGenerator("P30D"); + HousekeepingEntityGenerator generator = + commonBeans.unreferencedHousekeepingPathGenerator("P30D"); assertThat(generator).isInstanceOf(UnreferencedHousekeepingPathGenerator.class); } diff --git a/beekeeper-scheduler/pom.xml b/beekeeper-scheduler/pom.xml index 091a46af..82b5d9f8 100644 --- a/beekeeper-scheduler/pom.xml +++ b/beekeeper-scheduler/pom.xml @@ -64,6 +64,14 @@ javax.servlet servlet-api + + javax.servlet + javax.servlet-api + + + log4j + log4j + @@ -75,6 +83,26 @@ net.java.dev.jna jna + + javax.servlet + servlet-api + + + javax.servlet + javax.servlet-api + + + org.slf4j + slf4j-log4j12 + + + org.slf4j + slf4j-reload4j + + + log4j + log4j + diff --git a/beekeeper-vacuum-tool/pom.xml b/beekeeper-vacuum-tool/pom.xml index 94c71557..f879d77d 100644 --- a/beekeeper-vacuum-tool/pom.xml +++ b/beekeeper-vacuum-tool/pom.xml @@ -48,11 +48,32 @@ com.hotels hcommon-hive-metastore 1.4.1 + + + javax.servlet + servlet-api + + + javax.servlet + javax.servlet-api + + + org.slf4j + slf4j-log4j12 + + + org.slf4j + slf4j-reload4j + + + log4j + log4j + + - mysql - mysql-connector-java - 8.0.17 + com.mysql + mysql-connector-j @@ -101,11 +122,55 @@ org.apache.hadoop hadoop-common ${hadoop.version} + + + javax.servlet + servlet-api + + + javax.servlet + javax.servlet-api + + + org.slf4j + slf4j-log4j12 + + + org.slf4j + slf4j-reload4j + + + log4j + log4j + + org.apache.hadoop hadoop-hdfs ${hadoop.version} + + + javax.servlet + servlet-api + + + javax.servlet + javax.servlet-api + + + org.slf4j + slf4j-log4j12 + + + org.slf4j + slf4j-reload4j + + + log4j + log4j + + org.apache.hadoop @@ -116,6 +181,26 @@ com.amazonaws aws-java-sdk-bundle + + javax.servlet + servlet-api + + + javax.servlet + javax.servlet-api + + + org.slf4j + slf4j-log4j12 + + + org.slf4j + slf4j-reload4j + + + log4j + log4j + @@ -138,32 +223,57 @@ jdk.tools jdk.tools + + javax.servlet + servlet-api + + + javax.servlet + javax.servlet-api + + + org.slf4j + slf4j-log4j12 + + + org.slf4j + slf4j-reload4j + + + org.apache.logging.log4j + log4j-slf4j-impl + + + log4j + log4j + + + com.h2database + h2 + test + org.assertj assertj-core - ${assertj.version} test org.junit.jupiter junit-jupiter - ${junit.jupiter.version} test org.mockito mockito-core - ${mockito.version} test org.mockito mockito-junit-jupiter - ${mockito.version} test diff --git a/beekeeper-vacuum-tool/src/main/java/com/expediagroup/beekeeper/vacuum/CommonBeans.java b/beekeeper-vacuum-tool/src/main/java/com/expediagroup/beekeeper/vacuum/CommonBeans.java index 98d41423..a64f832e 100644 --- a/beekeeper-vacuum-tool/src/main/java/com/expediagroup/beekeeper/vacuum/CommonBeans.java +++ b/beekeeper-vacuum-tool/src/main/java/com/expediagroup/beekeeper/vacuum/CommonBeans.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2025 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.vacuum; @@ -37,7 +35,7 @@ import com.hotels.hcommon.hive.metastore.client.supplier.HiveMetaStoreClientSupplier; @Configuration -@EntityScan(basePackages = { "com.expediagroup.beekeeper.core.model" }) +@EntityScan(basePackages = {"com.expediagroup.beekeeper.core.model"}) @EnableJpaRepositories(basePackages = { "com.expediagroup.beekeeper.core.repository", "com.expediagroup.beekeeper.vacuum.repository" }) public class CommonBeans { @@ -60,6 +58,13 @@ public HiveConf hiveConf(@Value("${metastore-uri}") String metastoreUri) { conf.set("fs.s3a.aws.credentials.provider", EC2ContainerCredentialsProviderWrapper.class.getName()); conf.set("fs.s3n.aws.credentials.provider", EC2ContainerCredentialsProviderWrapper.class.getName()); + // Disable FileSystem cache to avoid UserGroupInformation.getCurrentUser() which is + // incompatible with Java 17+ when the security manager is not installed + conf.setBoolean("fs.file.impl.disable.cache", true); + conf.setBoolean("fs.s3.impl.disable.cache", true); + conf.setBoolean("fs.s3a.impl.disable.cache", true); + conf.setBoolean("fs.s3n.impl.disable.cache", true); + return conf; } @@ -77,7 +82,7 @@ Supplier metaStoreClientSupplier( } @Bean - public BeekeeperHistoryService beekeeperHistoryService(BeekeeperEventsHistoryRepository repository){ + public BeekeeperHistoryService beekeeperHistoryService(BeekeeperEventsHistoryRepository repository) { return new BeekeeperHistoryService(repository); } @@ -85,5 +90,4 @@ public BeekeeperHistoryService beekeeperHistoryService(BeekeeperEventsHistoryRep public SchedulerService schedulerService(BeekeeperRepository beekeeperRepository, BeekeeperHistoryService beekeeperHistoryService) { return new UnreferencedHousekeepingPathSchedulerService(beekeeperRepository, beekeeperHistoryService); } - } diff --git a/beekeeper-vacuum-tool/src/test/java/com/expediagroup/beekeeper/vacuum/ConsistencyCheckTest.java b/beekeeper-vacuum-tool/src/test/java/com/expediagroup/beekeeper/vacuum/ConsistencyCheckTest.java index 7dc1f995..2d56ae2e 100644 --- a/beekeeper-vacuum-tool/src/test/java/com/expediagroup/beekeeper/vacuum/ConsistencyCheckTest.java +++ b/beekeeper-vacuum-tool/src/test/java/com/expediagroup/beekeeper/vacuum/ConsistencyCheckTest.java @@ -1,16 +1,14 @@ /** - * Copyright (C) 2019-2020 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.vacuum; @@ -36,8 +34,10 @@ void metastorePathsCorrect() { @Test void metastorePathsDepthIncorrect() { assertThatExceptionOfType(IllegalStateException.class) - .isThrownBy(() -> ConsistencyCheck.checkMetastorePaths( - Collections.singleton(new Path("/db/snapshot/partition")), 4)); + .isThrownBy( + () -> + ConsistencyCheck.checkMetastorePaths( + Collections.singleton(new Path("/db/snapshot/partition")), 4)); } @Test @@ -55,14 +55,18 @@ void metastorePathDepthIncorrect() { @Test void unvisitedPath() throws IOException { Path nonExistent = new Path("/db/table/snapshot/" + RandomStringUtils.randomAlphanumeric(8) + "/partition"); - FileSystem fs = nonExistent.getFileSystem(new Configuration(false)); + Configuration conf = new Configuration(false); + conf.setBoolean("fs.file.impl.disable.cache", true); + FileSystem fs = nonExistent.getFileSystem(conf); ConsistencyCheck.checkUnvisitedPath(fs, nonExistent); } @Test void unvisitedPathExists() throws IOException { Path exists = new Path("/tmp"); - FileSystem fs = exists.getFileSystem(new Configuration(false)); + Configuration conf = new Configuration(false); + conf.setBoolean("fs.file.impl.disable.cache", true); + FileSystem fs = exists.getFileSystem(conf); assertThatExceptionOfType(IllegalStateException.class) .isThrownBy(() -> ConsistencyCheck.checkUnvisitedPath(fs, exists)); } diff --git a/beekeeper-vacuum-tool/src/test/java/com/expediagroup/beekeeper/vacuum/TestApplication.java b/beekeeper-vacuum-tool/src/test/java/com/expediagroup/beekeeper/vacuum/TestApplication.java index e658c020..3a5c9415 100644 --- a/beekeeper-vacuum-tool/src/test/java/com/expediagroup/beekeeper/vacuum/TestApplication.java +++ b/beekeeper-vacuum-tool/src/test/java/com/expediagroup/beekeeper/vacuum/TestApplication.java @@ -1,32 +1,30 @@ /** - * Copyright (C) 2019-2021 Expedia, Inc. + * Copyright (C) 2019-2026 Expedia, Inc. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + *

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + *

http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + *

Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.expediagroup.beekeeper.vacuum; import java.util.TimeZone; -import javax.annotation.PostConstruct; - import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import jakarta.annotation.PostConstruct; + @SpringBootApplication @EnableConfigurationProperties -@EntityScan(basePackages = { "com.expediagroup.beekeeper.core.model" }) +@EntityScan(basePackages = {"com.expediagroup.beekeeper.core.model"}) @EnableJpaRepositories(basePackages = { "com.expediagroup.beekeeper.core.repository", "com.expediagroup.beekeeper.vacuum.repository" }) public class TestApplication { diff --git a/beekeeper-vacuum-tool/src/test/java/com/expediagroup/beekeeper/vacuum/repository/BeekeeperRepositoryTest.java b/beekeeper-vacuum-tool/src/test/java/com/expediagroup/beekeeper/vacuum/repository/BeekeeperRepositoryTest.java index 881aba7e..fce3eb0f 100644 --- a/beekeeper-vacuum-tool/src/test/java/com/expediagroup/beekeeper/vacuum/repository/BeekeeperRepositoryTest.java +++ b/beekeeper-vacuum-tool/src/test/java/com/expediagroup/beekeeper/vacuum/repository/BeekeeperRepositoryTest.java @@ -21,6 +21,8 @@ import static com.expediagroup.beekeeper.core.model.HousekeepingStatus.SCHEDULED; import static com.expediagroup.beekeeper.core.model.LifecycleEventType.UNREFERENCED; +import static java.time.temporal.ChronoUnit.MICROS; + import java.time.LocalDateTime; import java.time.ZoneId; import java.util.List; @@ -109,7 +111,7 @@ public void notNullableField() { } private HousekeepingPath createEntityHousekeepingPath() { - LocalDateTime creationTimestamp = LocalDateTime.now(ZoneId.of("UTC")); + LocalDateTime creationTimestamp = LocalDateTime.now(ZoneId.of("UTC")).truncatedTo(MICROS); return HousekeepingPath .builder() .path("path") diff --git a/pom.xml b/pom.xml index 4fce8c0a..1e5971a3 100644 --- a/pom.xml +++ b/pom.xml @@ -40,25 +40,27 @@ 1.12.311 3.0 - 3.12.2 - 3.1.6 + 3.25.3 + 4.2.0 expediagroup - 11 - 5.6.3 - 1.2.3 - 2.16.0 - 1.18.20 + 21 + ${jdk.version} + ${jdk.version} + ${jdk.version} + 1.4.14 + 2.22.1 + 1.18.36 3.1.0 - 3.11.2 - 1.27 - 2.7.9 - 5.3.25 - 1.17.6 - 11-slim - 2.17.2 + 2.2 + 3.2.12 + 1.19.3 + ${jdk.version}-slim + 2.16.1 2.3.7 1.4.2 3.4.4 + 2.43.0 + 4.8.6.6 @@ -69,33 +71,6 @@ ${awaitility.version} test - - org.junit - junit-bom - ${junit.jupiter.version} - pom - import - - - org.springframework - spring-core - ${springframework.version} - - - org.springframework - spring-context - ${springframework.version} - - - org.springframework - spring-beans - ${springframework.version} - - - org.springframework - spring-aop - ${springframework.version} - org.springframework.boot spring-boot-dependencies @@ -158,25 +133,21 @@ org.junit.jupiter junit-jupiter - ${junit.jupiter.version} test org.mockito mockito-core - ${mockito.version} test org.mockito mockito-junit-jupiter - ${mockito.version} test org.assertj assertj-core - ${assertj.version} test @@ -210,7 +181,113 @@ maven-install-plugin 3.0.0-M1 + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + ${jdk.version} + ${jdk.version} + ${jdk.version} + UTF-8 + true + + + org.projectlombok + lombok + ${lombok.version} + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.2.5 + + @{argLine} -Duser.timezone=UTC -Djava.security.manager=allow --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/javax.security.auth=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED + + + + org.jacoco + jacoco-maven-plugin + 0.8.12 + + + com.diffplug.spotless + spotless-maven-plugin + 2.43.0 + + + + 1.19.2 + + + + \#java,\#javax,\#org,\#,\#com,\#com.expedia,\#com.expediagroup,\#com.hotels,java,javax,org,,com,com.expedia,com.expediagroup,com.hotels + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + 21 + 21 + 21 + UTF-8 + true + + + org.projectlombok + lombok + ${lombok.version} + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.2.5 + + @{argLine} -Duser.timezone=UTC --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED + + + + org.jacoco + jacoco-maven-plugin + 0.8.12 + + + com.diffplug.spotless + spotless-maven-plugin + 2.43.0 + + + process-sources + + apply + + + + + + + 1.19.2 + + + + \#java,\#javax,\#org,\#,\#com,\#com.expedia,\#com.expediagroup,\#com.hotels,java,javax,org,,com,com.expedia,com.expediagroup,com.hotels + + + + +