nastra commented on code in PR #7590: URL: https://github.com/apache/iceberg/pull/7590#discussion_r1192926468
########## aws/src/test/java/org/apache/iceberg/aws/TestS3FileIOAwsClientFactories.java: ########## @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + * + * 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 org.apache.iceberg.aws; + +import java.util.Map; +import org.apache.iceberg.aws.s3.S3FileIOAwsClientFactory; +import org.apache.iceberg.aws.s3.S3FileIOProperties; +import org.apache.iceberg.relocated.com.google.common.collect.Maps; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +public class TestS3FileIOAwsClientFactories { + + @Test + public void testS3FileIOImplCatalogPropertyDefined() { + Map<String, String> properties = Maps.newHashMap(); + properties.put( + S3FileIOProperties.CLIENT_FACTORY, + "org.apache.iceberg.aws.s3.DefaultS3FileIOAwsClientFactory"); + Object factoryImpl = S3FileIOAwsClientFactories.initFactory(properties); + Assertions.assertThat(factoryImpl) + .withFailMessage( + "should instantiate an object of type S3FileIOAwsClientFactory when s3.client-factory-impl is set") + .isInstanceOf(S3FileIOAwsClientFactory.class); + } + + @Test + public void testS3FileIOImplCatalogPropertyNotDefined() { + // don't set anything + Map<String, String> properties = Maps.newHashMap(); + Object factoryImpl = S3FileIOAwsClientFactories.initFactory(properties); + Assertions.assertThat(factoryImpl) + .withFailMessage( + "should instantiate an object of type AwsClientFactory when s3.client-factory-impl is set to false") Review Comment: looks like the "is set to false" doesn't apply anymore ########## aws/src/main/java/org/apache/iceberg/aws/S3FileIOAwsClientFactories.java: ########## @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 + * + * 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 org.apache.iceberg.aws; + +import java.util.Map; +import org.apache.iceberg.aws.s3.S3FileIOAwsClientFactory; +import org.apache.iceberg.aws.s3.S3FileIOProperties; +import org.apache.iceberg.common.DynConstructors; +import org.apache.iceberg.relocated.com.google.common.base.Strings; +import org.apache.iceberg.util.PropertyUtil; + +@SuppressWarnings("checkstyle:HideUtilityClassConstructor") Review Comment: nit: I believe we typically just add a private no-arg constructor instead of suppressing this -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
