Skip to content

Commit

Permalink
Integration Testing Dependency Clean Up (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
musketyr authored Sep 20, 2024
1 parent 5945036 commit 16ac8b4
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
*/
dependencies {
api group: 'org.testcontainers', name: 'localstack', version: testcontainersVersion
implementation 'com.amazonaws:aws-java-sdk-core'
implementation "software.amazon.awssdk:netty-nio-client:$kinesisClientV2Version"

compileOnly 'com.amazonaws:aws-java-sdk-core'
compileOnly "software.amazon.awssdk:netty-nio-client:$kinesisClientV2Version"

compileOnly project(':micronaut-amazon-awssdk-cloudwatch')
compileOnly project(':micronaut-amazon-awssdk-cloudwatchlogs')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
import io.micronaut.context.annotation.Primary;
import io.micronaut.context.annotation.Replaces;
import io.micronaut.context.annotation.Requires;
import software.amazon.awssdk.http.Protocol;
import software.amazon.awssdk.http.SdkHttpConfigurationOption;
import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
import software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient;
import software.amazon.awssdk.utils.AttributeMap;

import jakarta.inject.Singleton;
import java.util.List;
Expand All @@ -47,22 +42,4 @@ public LocalstackContainerHolder localstackContainerHolder(
return new LocalstackContainerHolder(configuration, overrides);
}

@Primary
@Singleton
@Bean(preDestroy = "close")
public SdkAsyncHttpClient client() {
return NettyNioAsyncHttpClient
.builder()
.protocol(Protocol.HTTP1_1)
.buildWithDefaults(
AttributeMap
.builder()
.put(
SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES,
Boolean.TRUE
)
.build()
);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2018-2024 Agorapulse.
*
* 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
*
* https://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 com.agorapulse.micronaut.amazon.awssdk.itest.localstack.v2;

import com.agorapulse.micronaut.amazon.awssdk.core.AwsConfiguration;
import io.micronaut.context.annotation.Bean;
import io.micronaut.context.annotation.Factory;
import io.micronaut.context.annotation.Primary;
import io.micronaut.context.annotation.Replaces;
import io.micronaut.context.annotation.Requires;
import jakarta.inject.Singleton;
import software.amazon.awssdk.http.Protocol;
import software.amazon.awssdk.http.SdkHttpConfigurationOption;
import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
import software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient;
import software.amazon.awssdk.utils.AttributeMap;

@Factory
@Replaces(AwsConfiguration.class)
@Requires(missingProperty = "localstack.disabled", classes = NettyNioAsyncHttpClient.class)
public class SdkAsyncClientFactory {

@Primary
@Singleton
@Bean(preDestroy = "close")
public SdkAsyncHttpClient client() {
return NettyNioAsyncHttpClient
.builder()
.protocol(Protocol.HTTP1_1)
.buildWithDefaults(
AttributeMap
.builder()
.put(
SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES,
Boolean.TRUE
)
.build()
);
}

}

0 comments on commit 16ac8b4

Please sign in to comment.