Skip to content

Commit

Permalink
Adding IcebergValidator to constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamza Jugon committed Nov 20, 2024
1 parent 223e086 commit 1f6e360
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import com.expediagroup.beekeeper.cleanup.service.CleanupService;
import com.expediagroup.beekeeper.cleanup.service.DisableTablesService;
import com.expediagroup.beekeeper.cleanup.service.RepositoryCleanupService;
import com.expediagroup.beekeeper.cleanup.validation.IcebergValidator;
import com.expediagroup.beekeeper.core.repository.HousekeepingMetadataRepository;
import com.expediagroup.beekeeper.metadata.cleanup.handler.ExpiredMetadataHandler;
import com.expediagroup.beekeeper.metadata.cleanup.handler.MetadataHandler;
Expand Down Expand Up @@ -102,8 +103,9 @@ public DeletedMetadataReporter deletedMetadataReporter(

@Bean(name = "hiveTableCleaner")
MetadataCleaner metadataCleaner(
DeletedMetadataReporter deletedMetadataReporter) {
return new HiveMetadataCleaner(deletedMetadataReporter);
DeletedMetadataReporter deletedMetadataReporter,
IcebergValidator icebergValidator) {
return new HiveMetadataCleaner(deletedMetadataReporter, icebergValidator);
}

@Bean
Expand Down Expand Up @@ -139,8 +141,9 @@ public S3Client s3Client(AmazonS3 amazonS3, @Value("${properties.dry-run-enabled
@Bean(name = "s3PathCleaner")
PathCleaner pathCleaner(
S3Client s3Client,
BytesDeletedReporter bytesDeletedReporter) {
return new S3PathCleaner(s3Client, new S3SentinelFilesCleaner(s3Client), bytesDeletedReporter);
BytesDeletedReporter bytesDeletedReporter,
IcebergValidator icebergValidator) {
return new S3PathCleaner(s3Client, new S3SentinelFilesCleaner(s3Client), bytesDeletedReporter, icebergValidator);
}

@Bean(name = "expiredMetadataHandler")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import com.expediagroup.beekeeper.cleanup.service.CleanupService;
import com.expediagroup.beekeeper.cleanup.service.DisableTablesService;
import com.expediagroup.beekeeper.cleanup.service.RepositoryCleanupService;
import com.expediagroup.beekeeper.cleanup.validation.IcebergValidator;
import com.expediagroup.beekeeper.core.repository.HousekeepingMetadataRepository;
import com.expediagroup.beekeeper.metadata.cleanup.handler.ExpiredMetadataHandler;
import com.expediagroup.beekeeper.metadata.cleanup.service.MetadataDisableTablesService;
Expand Down Expand Up @@ -76,6 +77,7 @@ public class CommonBeansTest {
private @Mock PathCleaner pathCleaner;
private @Mock MeterRegistry meterRegistry;
private @Mock HiveClientFactory hiveClientFactory;
private @Mock IcebergValidator icebergValidator;

@BeforeEach
public void awsSetUp() {
Expand Down Expand Up @@ -122,7 +124,7 @@ public void verifyHiveClient() {
@Test
public void verifyHiveMetadataCleaner() {
DeletedMetadataReporter reporter = commonBeans.deletedMetadataReporter(meterRegistry, false);
MetadataCleaner metadataCleaner = commonBeans.metadataCleaner(reporter);
MetadataCleaner metadataCleaner = commonBeans.metadataCleaner(reporter, icebergValidator);
assertThat(metadataCleaner).isInstanceOf(HiveMetadataCleaner.class);
}

Expand Down Expand Up @@ -152,7 +154,7 @@ public void verifyS3Client() {
void verifyS3pathCleaner() {
BytesDeletedReporter reporter = commonBeans.bytesDeletedReporter(meterRegistry, false);
S3Client s3Client = commonBeans.s3Client(commonBeans.amazonS3(), false);
PathCleaner pathCleaner = commonBeans.pathCleaner(s3Client, reporter);
PathCleaner pathCleaner = commonBeans.pathCleaner(s3Client, reporter, icebergValidator);
assertThat(pathCleaner).isInstanceOf(S3PathCleaner.class);
}

Expand Down

0 comments on commit 1f6e360

Please sign in to comment.