Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete jacoco setting in spring modules #26187

Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions sdk/spring/spring-cloud-azure-actuator-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@
<url>https://github.com/Azure/azure-sdk-for-java/issues</url>
</issueManagement>

<properties>
<jacoco.min.linecoverage>0.10</jacoco.min.linecoverage>
<jacoco.min.branchcoverage>0.15</jacoco.min.branchcoverage>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
5 changes: 0 additions & 5 deletions sdk/spring/spring-cloud-azure-actuator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@
<url>https://github.com/Azure/azure-sdk-for-java/issues</url>
</issueManagement>

<properties>
<jacoco.min.linecoverage>0.10</jacoco.min.linecoverage>
<jacoco.min.branchcoverage>0.15</jacoco.min.branchcoverage>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
4 changes: 2 additions & 2 deletions sdk/spring/spring-cloud-azure-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
<!-- https://issues.apache.org/jira/browse/SUREFIRE-1563 -->
<javaModulesSurefireArgLine>
--add-modules com.azure.storage.blob
--add-modules com.azure.storage.internal.avro
--add-modules com.azure.storage.file.share
--add-opens com.azure.spring.core/com.azure.spring.core=ALL-UNNAMED
--add-modules com.azure.storage.internal.avro
--add-opens com.azure.spring.core/com.azure.spring.core.factory=ALL-UNNAMED
--add-opens com.azure.spring.core/com.azure.spring.core.implementation.connectionstring=ALL-UNNAMED
--add-opens com.azure.spring.core/com.azure.spring.core.resource=ALL-UNNAMED
--add-opens com.azure.spring.core/com.azure.spring.core.util=ALL-UNNAMED
--add-opens com.azure.spring.core/com.azure.spring.core=ALL-UNNAMED
</javaModulesSurefireArgLine>
</properties>

Expand Down
5 changes: 0 additions & 5 deletions sdk/spring/spring-cloud-azure-resourcemanager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@
<url>https://github.com/Azure/azure-sdk-for-java/issues</url>
</issueManagement>

<properties>
<jacoco.min.linecoverage>0.09</jacoco.min.linecoverage>
<jacoco.min.branchcoverage>0.14</jacoco.min.branchcoverage>
</properties>

<dependencies>
<dependency>
<groupId>com.azure.spring</groupId>
Expand Down
17 changes: 9 additions & 8 deletions sdk/spring/spring-cloud-azure-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,32 @@
</issueManagement>

<properties>
<jacoco.min.linecoverage>0.39</jacoco.min.linecoverage>
<jacoco.min.branchcoverage>0.16</jacoco.min.branchcoverage>
<javaModulesSurefireArgLine>
--add-modules com.azure.cosmos
--add-modules com.azure.data.appconfiguration
--add-modules com.azure.messaging.eventhubs
--add-modules com.azure.messaging.servicebus
--add-modules com.azure.security.keyvault.certificates
--add-modules com.azure.security.keyvault.secrets
--add-modules com.azure.storage.blob
--add-modules com.azure.storage.file.share
--add-modules com.azure.storage.queue
--add-modules com.azure.storage.internal.avro
--add-modules com.azure.data.appconfiguration
--add-opens com.azure.spring.service/com.azure.spring.service=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service.core=ALL-UNNAMED
--add-modules com.azure.storage.queue
--add-opens com.azure.spring.core/com.azure.spring.core.factory=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service.appconfiguration=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service.core=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service.cosmos=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service.credential=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service.eventhubs=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service.implementation.storage.credential=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service.keyvault.certificates=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service.keyvault.secret=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service.servicebus.factory=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service.servicebus=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service.storage.blob=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service.storage.fileshare=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service.storage.queue=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service.keyvault.secret=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service.keyvault.certificates=ALL-UNNAMED
--add-opens com.azure.spring.service/com.azure.spring.service=ALL-UNNAMED
</javaModulesSurefireArgLine>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ abstract class AbstractServiceBusSubClientBuilderFactory<T, P extends ServiceBus
}
}

protected boolean isShareServiceBusClientBuilder() {
return shareServiceBusClientBuilder;
}

@Override
protected BiConsumer<T, ProxyOptions> consumeProxyOptions() {
return (builder, proxy) -> {
if (!this.shareServiceBusClientBuilder) {
if (!isShareServiceBusClientBuilder()) {
this.serviceBusClientBuilder.proxyOptions(proxy);
}
};
Expand All @@ -72,7 +76,7 @@ protected BiConsumer<T, ProxyOptions> consumeProxyOptions() {
@Override
protected BiConsumer<T, AmqpTransportType> consumeAmqpTransportType() {
return (builder, t) -> {
if (!this.shareServiceBusClientBuilder) {
if (!isShareServiceBusClientBuilder()) {
this.serviceBusClientBuilder.transportType(t);
}
};
Expand All @@ -81,7 +85,7 @@ protected BiConsumer<T, AmqpTransportType> consumeAmqpTransportType() {
@Override
protected BiConsumer<T, AmqpRetryOptions> consumeAmqpRetryOptions() {
return (builder, retry) -> {
if (!this.shareServiceBusClientBuilder) {
if (!isShareServiceBusClientBuilder()) {
this.serviceBusClientBuilder.retryOptions(retry);
}
};
Expand All @@ -90,7 +94,7 @@ protected BiConsumer<T, AmqpRetryOptions> consumeAmqpRetryOptions() {
@Override
protected BiConsumer<T, ClientOptions> consumeClientOptions() {
return (builder, client) -> {
if (!this.shareServiceBusClientBuilder) {
if (!isShareServiceBusClientBuilder()) {
this.serviceBusClientBuilder.clientOptions(client);
}
};
Expand All @@ -105,19 +109,19 @@ protected AzureProperties getAzureProperties() {
protected List<AuthenticationDescriptor<?>> getAuthenticationDescriptors(T builder) {
return Arrays.asList(
new NamedKeyAuthenticationDescriptor(provider -> {
if (!this.shareServiceBusClientBuilder) {
if (!isShareServiceBusClientBuilder()) {
this.serviceBusClientBuilder.credential(properties.getFullyQualifiedNamespace(),
provider.getCredential());
}
}),
new SasAuthenticationDescriptor(provider -> {
if (!this.shareServiceBusClientBuilder) {
if (!isShareServiceBusClientBuilder()) {
this.serviceBusClientBuilder.credential(properties.getFullyQualifiedNamespace(),
provider.getCredential());
}
}),
new TokenAuthenticationDescriptor(provider -> {
if (!this.shareServiceBusClientBuilder) {
if (!isShareServiceBusClientBuilder()) {
this.serviceBusClientBuilder.credential(properties.getFullyQualifiedNamespace(),
provider.getCredential());
}
Expand All @@ -128,7 +132,7 @@ protected List<AuthenticationDescriptor<?>> getAuthenticationDescriptors(T build
@Override
protected BiConsumer<T, Configuration> consumeConfiguration() {
return (builder, configuration) -> {
if (!this.shareServiceBusClientBuilder) {
if (!isShareServiceBusClientBuilder()) {
this.serviceBusClientBuilder.configuration(configuration);
}
};
Expand All @@ -137,7 +141,7 @@ protected BiConsumer<T, Configuration> consumeConfiguration() {
@Override
protected BiConsumer<T, TokenCredential> consumeDefaultTokenCredential() {
return (builder, credential) -> {
if (!this.shareServiceBusClientBuilder) {
if (!isShareServiceBusClientBuilder()) {
this.serviceBusClientBuilder.credential(this.properties.getFullyQualifiedNamespace(), credential);
}
};
Expand All @@ -146,7 +150,7 @@ protected BiConsumer<T, TokenCredential> consumeDefaultTokenCredential() {
@Override
protected BiConsumer<T, String> consumeConnectionString() {
return (builder, connectionString) -> {
if (!this.shareServiceBusClientBuilder) {
if (!isShareServiceBusClientBuilder()) {
this.serviceBusClientBuilder.connectionString(connectionString);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@
exports com.azure.spring.service.storage.common.credential;
exports com.azure.spring.service.storage.fileshare;
exports com.azure.spring.service.storage.queue;

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@

package com.azure.spring.service.cosmos;

import com.azure.core.credential.AzureKeyCredential;
import com.azure.cosmos.ConnectionMode;
import com.azure.cosmos.CosmosClient;
import com.azure.cosmos.CosmosClientBuilder;
import com.azure.cosmos.DirectConnectionConfig;
import com.azure.cosmos.GatewayConnectionConfig;
import com.azure.cosmos.ThrottlingRetryOptions;
import com.azure.identity.ClientCertificateCredential;
import com.azure.identity.ClientSecretCredential;
import com.azure.spring.core.properties.retry.RetryProperties;
import com.azure.spring.service.AzureServiceClientBuilderFactoryTestBase;
import org.junit.jupiter.api.Test;
Expand All @@ -25,7 +29,44 @@ public class CosmosClientBuilderFactoryTest extends AzureServiceClientBuilderFac
private static final String ENDPOINT = "https://test.documents.azure.com:443/";

@Test
void testGatewayConnectionModeConfigured() {
void azureKeyCredentialConfigured() {
TestAzureCosmosHttpProperties properties = createMinimalServiceProperties();
properties.setKey("key");
final CosmosClientBuilder builder = new CosmosClientBuilderFactoryExt(properties).build();
CosmosClient cosmosClient = builder.buildClient();
verify(builder, times(1)).credential(any(AzureKeyCredential.class));
}

@Test
void tokenCredentialConfigured() {
TestAzureCosmosHttpProperties properties = createMinimalServiceProperties();

properties.getCredential().setClientId("test-client");
properties.getCredential().setClientSecret("test-secret");
properties.getProfile().setTenantId("test-tenant");

final CosmosClientBuilder builder = new CosmosClientBuilderFactoryExt(properties).build();
final CosmosClient cosmosClient = builder.buildClient();

verify(builder, times(1)).credential(any(ClientSecretCredential.class));
}

@Test
void clientCertificateTokenCredentialConfigured() {
TestAzureCosmosHttpProperties properties = createMinimalServiceProperties();

properties.getCredential().setClientId("test-client");
properties.getCredential().setClientCertificatePath("test-cert-path");
properties.getCredential().setClientCertificatePassword("test-cert-password");
properties.getProfile().setTenantId("test-tenant");

final CosmosClientBuilder builder = new CosmosClientBuilderFactoryExt(properties).build();
final CosmosClient cosmosClient = builder.buildClient();
verify(builder, times(1)).credential(any(ClientCertificateCredential.class));
}

@Test
void gatewayConnectionModeConfigured() {
TestAzureCosmosHttpProperties properties = createMinimalServiceProperties();
properties.setConnectionMode(ConnectionMode.GATEWAY);
final CosmosClientBuilderFactoryExt factoryExt = new CosmosClientBuilderFactoryExt(properties);
Expand All @@ -35,7 +76,7 @@ void testGatewayConnectionModeConfigured() {
}

@Test
void testDirectConnectionModeConfigured() {
void directConnectionModeConfigured() {
TestAzureCosmosHttpProperties properties = createMinimalServiceProperties();
properties.setConnectionMode(ConnectionMode.DIRECT);
final CosmosClientBuilderFactoryExt factoryExt = new CosmosClientBuilderFactoryExt(properties);
Expand All @@ -45,7 +86,7 @@ void testDirectConnectionModeConfigured() {
}

@Test
void testThrottlingRetryOptionsConfiguredRetry() {
void throttlingRetryOptionsConfiguredRetry() {
TestAzureCosmosHttpProperties properties = createMinimalServiceProperties();
RetryProperties retryProperties = properties.getRetry();
retryProperties.setTimeout(Duration.ofMillis(1000));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.time.Duration;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;

import static org.mockito.ArgumentMatchers.any;
Expand All @@ -37,7 +38,7 @@ protected TestAzureGlobalProperties createMinimalServiceProperties() {
}

@Test
void testAuthorityHostAndExecutorServiceConfigured() {
void authorityHostAndExecutorServiceConfigured() {
AzureProperties properties = createMinimalServiceProperties();

DefaultAzureCredentialBuilderFactoryExt factory = new DefaultAzureCredentialBuilderFactoryExt(properties);
Expand All @@ -53,7 +54,7 @@ void testAuthorityHostAndExecutorServiceConfigured() {
}

@Test
void testHttpClientConfigured() {
void httpClientConfigured() {
AzureProperties properties = createMinimalServiceProperties();
DefaultAzureCredentialBuilderFactoryExt factory = new DefaultAzureCredentialBuilderFactoryExt(properties);
factory.setExecutorService(getThreadPoolExecutor());
Expand All @@ -63,7 +64,7 @@ void testHttpClientConfigured() {
}

@Test
void testRetryOptionsConfigured() {
void retryOptionsConfigured() {
TestAzureGlobalProperties properties = createMinimalServiceProperties();
RetryProperties retryProperties = properties.getRetry();
retryProperties.setMaxAttempts(3);
Expand All @@ -77,13 +78,12 @@ void testRetryOptionsConfigured() {
}

@Test
void testProxyOptionsConfigured() {
void proxyOptionsConfigured() {
TestAzureGlobalProperties properties = createMinimalServiceProperties();
ProxyProperties proxyProperties = properties.getProxy();
proxyProperties.setHostname("localhost");
proxyProperties.setPort(8080);
DefaultAzureCredentialBuilderFactoryProxyExt factory = new DefaultAzureCredentialBuilderFactoryProxyExt(properties);
factory.setExecutorService(getThreadPoolExecutor());

DefaultAzureCredentialBuilder builder = factory.getBuilder();
HttpClientProvider defaultHttpClientProvider = factory.getDefaultHttpClientProvider();
Expand All @@ -92,6 +92,17 @@ void testProxyOptionsConfigured() {
verify(defaultHttpClientProvider, times(1)).createInstance(any(HttpClientOptions.class));
}

@Test
void executorServiceConfigured() {
TestAzureGlobalProperties properties = createMinimalServiceProperties();
DefaultAzureCredentialBuilderFactoryExt factory = new DefaultAzureCredentialBuilderFactoryExt(properties);
factory.setExecutorService(getThreadPoolExecutor());

DefaultAzureCredentialBuilder builder = factory.getBuilder();
DefaultAzureCredentialBuilder credentialBuilder = factory.build();
verify(builder, times(1)).executorService(any(ExecutorService.class));
}

private ThreadPoolExecutor getThreadPoolExecutor() {
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
taskExecutor.initialize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import com.azure.spring.service.eventhubs.factory.EventHubClientBuilderFactory;
import org.junit.jupiter.api.Test;

import java.util.ArrayList;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
Expand All @@ -27,8 +25,6 @@ protected TestAzureEventHubsProperties createMinimalServiceProperties() {

@Test
void testRetryOptionsConfigured() {
ArrayList<String> list = new ArrayList<>();

TestAzureEventHubsProperties properties = createMinimalServiceProperties();
final EventHubClientBuilderFactoryExt builderFactory = new EventHubClientBuilderFactoryExt(properties);
final EventHubClientBuilder builder = builderFactory.build();
Expand Down
Loading