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

Proof of concept on higher build Java version #40025

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions eng/code-quality-reports/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>9.3</version> <!-- {x-version-update;com.puppycrawl.tools:checkstyle;external_dependency} -->
<version>10.16.0</version> <!-- {x-version-update;com.puppycrawl.tools:checkstyle;external_dependency} -->
</dependency>

<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>9.3</version> <!-- {x-version-update;com.puppycrawl.tools:checkstyle;external_dependency} -->
<version>10.16.0</version> <!-- {x-version-update;com.puppycrawl.tools:checkstyle;external_dependency} -->
<type>test-jar</type>
<scope>test</scope>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/templates/steps/build-and-test-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ steps:
displayName: 'Build for non-From Source run'
inputs:
mavenPomFile: pom.xml
options: $(DefaultOptions) $(DefaultSkipOptions) -Djacoco.skip=true -T ${{ parameters.BuildParallelization }} -pl $(ProjectList) -am -Pnative
options: $(DefaultOptions) $(DefaultSkipOptions) -Djacoco.skip=true -T ${{ parameters.BuildParallelization }} -pl $(ProjectList),!com.azure:sdk-build-tools -am -Pnative
mavenOptions: '$(MemoryOptions) $(LoggingOptions)'
javaHomeOption: 'Path'
jdkDirectory: $(Agent.BuildDirectory)/graalvm-22.3.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ steps:
options: ${{ parameters.Options }}
mavenOptions: ${{ parameters.MavenOptions }}
javaHomeOption: 'JDKVersion'
jdkVersionOption: ${{ parameters.JdkVersion }}
jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
publishJUnitResults: false
goals: 'install'
8 changes: 5 additions & 3 deletions eng/versioning/external_dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,12 @@ com.google.truth:truth;1.1.3
com.azure:sdk-build-tools;1.0.0
com.azure.tools:codesnippet-maven-plugin;1.0.0-beta.10
com.beust:jcommander;1.78
# Spotless 2.30.0 is the last version supporting a Java 8 runtime
com.diffplug.spotless:spotless-maven-plugin;2.30.0
com.diffplug.spotless:spotless-maven-plugin;2.43.0
com.github.javaparser:javaparser-core;3.24.2
com.google.code.findbugs:jsr305;3.0.2
com.microsoft.azure:azure-webapp-maven-plugin;1.14.0
com.nimbusds:nimbus-jose-jwt;9.37.3
com.puppycrawl.tools:checkstyle;9.3
com.puppycrawl.tools:checkstyle;10.16.0
com.toasttab.android:gummy-bears-api-26;0.8.0
commons-io:commons-io;2.11.0
commons-validator:commons-validator;1.6
Expand Down Expand Up @@ -448,3 +447,6 @@ spring_com.microsoft.azure:azure;1.34.0

# sdk\spring\spring-cloud-azure-service\pom.xml
spring_redis.clients:jedis;3.8.0

# Needed as data-plane libraries build using an older Java version.
dataplane_com.puppycrawl.tools:checkstyle;9.3
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public class ProxyOptions implements AutoCloseable {
private static final ConfigurationProperty<ProxyAuthenticationType> AUTH_TYPE_PROPERTY
= new ConfigurationPropertyBuilder<>(ConfigurationProperties.AMQP_PROXY_AUTHENTICATION_TYPE,
s -> ProxyAuthenticationType.valueOf(s)).shared(true)
.logValue(true)
.defaultValue(ProxyAuthenticationType.NONE)
.build();
.logValue(true)
.defaultValue(ProxyAuthenticationType.NONE)
.build();

private static final ConfigurationProperty<Proxy.Type> TYPE_PROPERTY
= new ConfigurationPropertyBuilder<>(ConfigurationProperties.AMQP_PROXY_TYPE, s -> Proxy.Type.valueOf(s))
Expand Down Expand Up @@ -249,7 +249,7 @@ private static ProxyOptions loadFromEnvironmentConfiguration(Configuration confi
/**
* Lists available configuration property names for AMQP {@link ProxyOptions}.
*/
private static class ConfigurationProperties {
private static final class ConfigurationProperties {
/**
* The AMQP proxy server authentication type that match {@link ProxyAuthenticationType} enum.
* Supported values are {@code NONE} (no authentication), {@code BASIC} or {@code DIGEST}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public Mono<AmqpManagementNode> getManagementNode(String entityPath) {

final TokenManager tokenManager = new AzureTokenManagerProvider(connectionOptions.getAuthorizationType(),
connectionOptions.getFullyQualifiedNamespace(), connectionOptions.getAuthorizationScope())
.getTokenManager(getClaimsBasedSecurityNode(), entityPath);
.getTokenManager(getClaimsBasedSecurityNode(), entityPath);

return tokenManager.authorize().thenReturn(managementNodes.compute(entityPath, (key, current) -> {
if (current != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ private int getPriority() {
}
}

private static class DeliveryTagComparator implements Comparator<WeightedDeliveryTag>, Serializable {
private static final class DeliveryTagComparator implements Comparator<WeightedDeliveryTag>, Serializable {
private static final long serialVersionUID = -7057500582037295635L;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ public Mono<AmqpLink> createConsumer(String linkName, String entityPath, Duratio
// Here we've to pass (DeliverySettleMode.SETTLE_ON_DELIVERY, false) as the values for those two parameters.
return createConsumer(linkName, entityPath, timeout, retry, null, null, null, SenderSettleMode.UNSETTLED,
ReceiverSettleMode.SECOND, new ConsumerFactory())
.or(onClosedError("Connection closed while waiting for new receive link.", entityPath, linkName))
.cast(AmqpLink.class);
.or(onClosedError("Connection closed while waiting for new receive link.", entityPath, linkName))
.cast(AmqpLink.class);
}

/**
Expand Down Expand Up @@ -319,8 +319,8 @@ public Mono<? extends AmqpTransactionCoordinator> getOrCreateTransactionCoordina
return transactionCoordinator.get();
}
})
.or(onClosedError("Connection closed while waiting for transaction coordinator creation.",
NOT_APPLICABLE, NOT_APPLICABLE));
.or(onClosedError("Connection closed while waiting for transaction coordinator creation.", NOT_APPLICABLE,
NOT_APPLICABLE));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ public void testProxyOptionsFromEnvironmentConfiguration(String proxyConfigurati
new TestConfigurationSource().put(Configuration.PROPERTY_HTTP_PROXY, proxyConfiguration)
.put(ProxyOptions.PROXY_AUTHENTICATION_TYPE, AUTH_TYPE)
.put(ProxyOptions.PROXY_USERNAME, SOME_USERNAME)
.put(ProxyOptions.PROXY_PASSWORD, SOME_PASSWORD)).build();
.put(ProxyOptions.PROXY_PASSWORD, SOME_PASSWORD))
.build();

ProxyOptions proxyConfig = ProxyOptions.fromConfiguration(configuration);
if (expectSystemDefault) {
Expand All @@ -255,7 +256,8 @@ public void testNullProxyAddress() {
new TestConfigurationSource().put(JAVA_NET_USE_SYSTEM_PROXIES, "true")
.put(ProxyOptions.PROXY_AUTHENTICATION_TYPE, AUTH_TYPE)
.put(ProxyOptions.PROXY_USERNAME, SOME_USERNAME)
.put(ProxyOptions.PROXY_PASSWORD, SOME_PASSWORD)).build();
.put(ProxyOptions.PROXY_PASSWORD, SOME_PASSWORD))
.build();

ProxyOptions proxyConfig = ProxyOptions.fromConfiguration(configuration);
assertIsSystemDefaultProxy(proxyConfig);
Expand All @@ -272,7 +274,8 @@ public void mixedConfigurationExplicitWins() {
.put(Configuration.PROPERTY_HTTP_PROXY, PROXY_HOST)
.put(ProxyOptions.PROXY_AUTHENTICATION_TYPE, AUTH_TYPE)
.put(ProxyOptions.PROXY_USERNAME, SOME_USERNAME)
.put(ProxyOptions.PROXY_PASSWORD, SOME_PASSWORD)).build();
.put(ProxyOptions.PROXY_PASSWORD, SOME_PASSWORD))
.build();

ProxyOptions proxyOptions = ProxyOptions.fromConfiguration(configuration);
assertEquals(ProxyAuthenticationType.DIGEST, proxyOptions.getAuthentication());
Expand All @@ -296,7 +299,8 @@ public void mixedConfigurationNoExplicitHost() {
.put(Configuration.PROPERTY_HTTP_PROXY, "localhost:4242")
.put(ProxyOptions.PROXY_AUTHENTICATION_TYPE, "BASIC")
.put(ProxyOptions.PROXY_USERNAME, SOME_USERNAME)
.put(ProxyOptions.PROXY_PASSWORD, SOME_PASSWORD)).build();
.put(ProxyOptions.PROXY_PASSWORD, SOME_PASSWORD))
.build();

ProxyOptions proxyOptions = ProxyOptions.fromConfiguration(configuration);
assertEquals(ProxyAuthenticationType.BASIC, proxyOptions.getAuthentication());
Expand All @@ -317,7 +321,8 @@ public void testSystemProxiesConfiguration() {
Configuration configuration = new ConfigurationBuilder(EMPTY_SOURCE, EMPTY_SOURCE,
new TestConfigurationSource().put(Configuration.PROPERTY_HTTP_PROXY, "invalid_proxy")
.put(Configuration.PROPERTY_HTTPS_PROXY, "https://localhost:80")
.put(JAVA_NET_USE_SYSTEM_PROXIES, "true")).build();
.put(JAVA_NET_USE_SYSTEM_PROXIES, "true"))
.build();

ProxyOptions proxyConfig = ProxyOptions.fromConfiguration(configuration);
assertNotNull(proxyConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void setup() throws IOException {
when(reactor.selectable()).thenReturn(selectable);
when(
reactor.connectionToHost(FULLY_QUALIFIED_NAMESPACE, connectionHandler.getProtocolPort(), connectionHandler))
.thenReturn(connectionProtonJ);
.thenReturn(connectionProtonJ);
when(reactor.attachments()).thenReturn(mock(Record.class));

final Pipe pipe = Pipe.open();
Expand All @@ -159,7 +159,7 @@ void setup() throws IOException {
when(reactorProvider.createReactor(CONNECTION_ID, connectionHandler.getMaxFrameSize())).thenReturn(reactor);
when(reactorProvider.createExecutor(any(Reactor.class), anyString(), anyString(),
any(ReactorConnection.ReactorExceptionHandler.class), any(AmqpRetryOptions.class)))
.then(answerByCreatingExecutor());
.then(answerByCreatingExecutor());

when(reactorHandlerProvider.createConnectionHandler(CONNECTION_ID, connectionOptions))
.thenReturn(connectionHandler);
Expand Down Expand Up @@ -838,7 +838,7 @@ void createManagementNode() {
when(sessionHandler.getEndpointStates()).thenReturn(sessionEndpoints.flux());
when(reactorHandlerProvider.createSessionHandler(any(),
argThat(path -> path.contains("mgmt") && path.contains(entityPath)), anyString(), any()))
.thenReturn(sessionHandler);
.thenReturn(sessionHandler);

final SendLinkHandler linkHandler = new SendLinkHandler(CONNECTION_ID, FULLY_QUALIFIED_NAMESPACE, linkName,
entityPath, AmqpMetricsProvider.noop());
Expand All @@ -847,7 +847,7 @@ void createManagementNode() {
argThat(path -> path.contains("management")))).thenReturn(linkHandler);
when(reactorHandlerProvider.createSendLinkHandler(eq(CONNECTION_ID), eq(FULLY_QUALIFIED_NAMESPACE),
argThat(path -> path.contains("cbs") && path.contains(entityPath)), argThat(path -> path.contains("cbs"))))
.thenReturn(linkHandler);
.thenReturn(linkHandler);

final ReceiveLinkHandler receiveLinkHandler = new ReceiveLinkHandler(CONNECTION_ID, FULLY_QUALIFIED_NAMESPACE,
linkName, entityPath, AmqpMetricsProvider.noop());
Expand All @@ -856,7 +856,7 @@ void createManagementNode() {
argThat(path -> path.contains("management")))).thenReturn(receiveLinkHandler);
when(reactorHandlerProvider.createReceiveLinkHandler(eq(CONNECTION_ID), eq(FULLY_QUALIFIED_NAMESPACE),
argThat(path -> path.contains("cbs") && path.contains(entityPath)), argThat(path -> path.contains("cbs"))))
.thenReturn(receiveLinkHandler);
.thenReturn(receiveLinkHandler);

// Act and Assert
StepVerifier.create(connection.getManagementNode(entityPath))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public void noProxySelected(ProxyOptions configuration) {
// The default port used for the first ConnectionOptions constructor is the default HTTPS_PORT.
when(proxySelector.select(
argThat(u -> u.getHost().equals(hostname) && u.getPort() == WebSocketsConnectionHandler.HTTPS_PORT)))
.thenReturn(Collections.singletonList(PROXY));
.thenReturn(Collections.singletonList(PROXY));

final ConnectionOptions connectionOptions = new ConnectionOptions(hostname, tokenCredential,
CbsAuthorizationType.SHARED_ACCESS_SIGNATURE, "scope", AmqpTransportType.AMQP_WEB_SOCKETS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ void arrange(ReactorConnection connection, String fqdn, String chLinkName, Strin
when(receiveLinkHandler.getMessages()).thenReturn(Flux.never());
when(
handlerProvider.createSendLinkHandler(eq(connectionId), eq(fqdn), eq(chLinkName), eq(chEntityPath)))
.thenReturn(sendLinkHandler);
.thenReturn(sendLinkHandler);

final MessageSerializer serializer = mock(MessageSerializer.class);
final SenderSettleMode settleMode = SenderSettleMode.SETTLED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ void logIfClosedUnexpectedly(ClientLogger logger) {
}
}

private static class Releaser<T> implements Consumer<T> {
private static final class Releaser<T> implements Consumer<T> {
private final Deque<T> released = new ConcurrentLinkedDeque<>();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ public void buildWithHttpProxyFromEnvConfiguration() {
new TestConfigurationSource()
.put(Configuration.PROPERTY_HTTP_PROXY,
"http://" + PROXY_USER_INFO + "localhost:" + PROXY_SERVER_HTTP_PORT)
.put("java.net.useSystemProxies", "true")).build();
.put("java.net.useSystemProxies", "true"))
.build();

configurationProxyTest(configuration);
}
Expand Down Expand Up @@ -193,7 +194,8 @@ private static Stream<Arguments> buildWithExplicitConfigurationProxySupplier() {

final Configuration envConfiguration = new ConfigurationBuilder(EMPTY_SOURCE, EMPTY_SOURCE,
new TestConfigurationSource().put(Configuration.PROPERTY_HTTP_PROXY, "http://localhost:8888")
.put(Configuration.PROPERTY_NO_PROXY, "localhost")).build();
.put(Configuration.PROPERTY_NO_PROXY, "localhost"))
.build();

arguments.add(Arguments.of(envConfiguration));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ public void testNullHttpClientOptionsInstanceCreation() {
private static Configuration getConfiguration(boolean enableSharing) {
return new ConfigurationBuilder(EMPTY_SOURCE, EMPTY_SOURCE,
new TestConfigurationSource().put("AZURE_ENABLE_HTTP_CLIENT_SHARING", Boolean.toString(enableSharing)))
.build();
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ private static Stream<Arguments> buildWithEnvConfigurationProxySupplier() {

Configuration simpleEnvProxy = new ConfigurationBuilder(EMPTY_SOURCE, EMPTY_SOURCE,
new TestConfigurationSource().put(Configuration.PROPERTY_HTTP_PROXY, "http://localhost:12345")
.put(JAVA_SYSTEM_PROXY_PREREQUISITE, "true")).build();
.put(JAVA_SYSTEM_PROXY_PREREQUISITE, "true"))
.build();
arguments.add(Arguments.of(true, false, simpleEnvProxy, DEFAULT_URL));

/*
Expand All @@ -279,7 +280,8 @@ private static Stream<Arguments> buildWithEnvConfigurationProxySupplier() {

Configuration envProxyWithAuthentication = new ConfigurationBuilder(EMPTY_SOURCE, EMPTY_SOURCE,
new TestConfigurationSource().put(Configuration.PROPERTY_HTTP_PROXY, "http://1:1@localhost:12345")
.put(JAVA_SYSTEM_PROXY_PREREQUISITE, "true")).build();
.put(JAVA_SYSTEM_PROXY_PREREQUISITE, "true"))
.build();
arguments.add(Arguments.of(true, true, envProxyWithAuthentication, DEFAULT_URL));

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ public void testNullHttpClientOptionsInstanceCreation() {
private static Configuration getConfiguration(boolean enableSharing) {
return new ConfigurationBuilder(EMPTY_SOURCE, EMPTY_SOURCE,
new TestConfigurationSource().put("AZURE_ENABLE_HTTP_CLIENT_SHARING", Boolean.toString(enableSharing)))
.build();
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -550,10 +550,10 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
promise.setFailure(new SSLException(new ProxyConnectException("Simulated SSLException")));
}
});
})).proxy(
}))
.proxy(
new ProxyOptions(ProxyOptions.Type.HTTP, mockProxyServer.socketAddress()).setCredentials("1", "1"))
.build())
.build();
.build()).build();

StepVerifier.create(httpPipeline.send(new HttpRequest(HttpMethod.GET, url(PROXY_TO_ADDRESS))))
.verifyErrorMatches(exception -> exception instanceof SSLException
Expand Down Expand Up @@ -589,8 +589,8 @@ public void httpClientWithResolverUsesConfiguredResolverWithProxy() {
try (MockProxyServer mockProxyServer = new MockProxyServer()) {
NettyAsyncHttpClient httpClient = (NettyAsyncHttpClient) new NettyAsyncHttpClientBuilder(
reactor.netty.http.client.HttpClient.create().resolver(DefaultAddressResolverGroup.INSTANCE))
.proxy(new ProxyOptions(ProxyOptions.Type.HTTP, mockProxyServer.socketAddress()))
.build();
.proxy(new ProxyOptions(ProxyOptions.Type.HTTP, mockProxyServer.socketAddress()))
.build();
assertNotEquals(NoopAddressResolverGroup.INSTANCE, httpClient.nettyClient.configuration().resolver());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@ private static Stream<Arguments> buildWithEnvConfigurationProxySupplier() {

Configuration simpleEnvProxy = new ConfigurationBuilder(EMPTY_SOURCE, EMPTY_SOURCE,
new TestConfigurationSource().put(Configuration.PROPERTY_HTTP_PROXY, "http://localhost:12345")
.put(JAVA_SYSTEM_PROXY_PREREQUISITE, "true")).build();
.put(JAVA_SYSTEM_PROXY_PREREQUISITE, "true"))
.build();
arguments.add(Arguments.of(true, simpleEnvProxy, SERVER_HTTP_URI + DEFAULT_PATH));

/*
Expand All @@ -471,7 +472,8 @@ private static Stream<Arguments> buildWithEnvConfigurationProxySupplier() {

Configuration envProxyWithAuthentication = new ConfigurationBuilder(EMPTY_SOURCE, EMPTY_SOURCE,
new TestConfigurationSource().put(Configuration.PROPERTY_HTTP_PROXY, "http://1:1@localhost:12345")
.put(JAVA_SYSTEM_PROXY_PREREQUISITE, "true")).build();
.put(JAVA_SYSTEM_PROXY_PREREQUISITE, "true"))
.build();
arguments.add(Arguments.of(true, envProxyWithAuthentication, SERVER_HTTP_URI + DEFAULT_PATH));

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ public void testNullHttpClientOptionsInstanceCreation() {
private static Configuration getConfiguration(boolean enableSharing) {
return new ConfigurationBuilder(EMPTY_SOURCE, EMPTY_SOURCE,
new TestConfigurationSource().put("AZURE_ENABLE_HTTP_CLIENT_SHARING", Boolean.toString(enableSharing)))
.build();
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ public void buildWithHttpProxyFromEnvConfiguration() {
new TestConfigurationSource()
.put(Configuration.PROPERTY_HTTP_PROXY,
"http://" + PROXY_USER_INFO + "localhost:" + PROXY_SERVER_HTTP_PORT)
.put("java.net.useSystemProxies", "true")).build();
.put("java.net.useSystemProxies", "true"))
.build();

HttpClient httpClient = new VertxAsyncHttpClientBuilder().configuration(configuration).build();

Expand Down