Skip to content

Commit

Permalink
Revert "Merge branch 'feature/spring-boot-3' of https://github.com/Az…
Browse files Browse the repository at this point in the history
…ure/azure-sdk-for-java into feature/spring-boot-3"

This reverts commit 312e74c, reversing
changes made to 0d80d86.
  • Loading branch information
mrm9084 committed Jan 16, 2024
1 parent 312e74c commit 90dec31
Show file tree
Hide file tree
Showing 1,134 changed files with 23,818 additions and 55,863 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
/sdk/spring/spring-cloud-azure-starter-appconfiguration-config/ @mrm9084 @chenrujun @netyyyy @saragluna @moarychan

# PRLabel: %azure-spring
/sdk/spring/azure-spring-data-cosmos/ @kushagraThapar @FabianMeiswinkel @trande4884 @TheovanKraay @xinlian12 @chenrujun @netyyyy @saragluna @moarychan @aayush3011 @simorenoh @jeet1995 @Pilchie
/sdk/spring/azure-spring-data-cosmos/ @kushagraThapar @FabianMeiswinkel @chenrujun @netyyyy @saragluna @xinlian12 @moarychan @aayush3011 @simorenoh @jeet1995 @Pilchie
2 changes: 0 additions & 2 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
"*.parquet",
"**/sdk/**/src/main/java/**/implementation/**",
"**/*-perf/**",
"**/*-stress/**",
"**/*-tests/**",
"**/*-test-*/**",
"**/resourcemanager/**",
Expand Down Expand Up @@ -378,7 +377,6 @@
"SBOM",
"scalastyle",
"schemaregistryapacheavroserializer",
"SERIALVERSIONID",
"servicebus",
"sftdl",
"skus",
Expand Down
17 changes: 0 additions & 17 deletions common/perf-test-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<include>com.beust:jcommander:[1.78]</include> <!-- {x-include-update;com.beust:jcommander;external_dependency} -->

<include>io.projectreactor:reactor-core:[3.6.0]</include> <!-- {x-include-update;io.projectreactor:reactor-core;external_dependency} -->
<include>io.vertx:vertx-codegen:[4.5.0]</include> <!-- {x-include-update;io.vertx:vertx-codegen;external_dependency} -->
</includes>
</bannedDependencies>
</rules>
Expand Down Expand Up @@ -82,21 +81,5 @@
<artifactId>azure-core-http-okhttp</artifactId>
<version>1.11.17</version> <!-- {x-version-update;com.azure:azure-core-http-okhttp;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-jdk-httpclient</artifactId>
<version>1.0.0-beta.9</version> <!-- {x-version-update;com.azure:azure-core-http-jdk-httpclient;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-vertx</artifactId>
<version>1.0.0-beta.14</version> <!-- {x-version-update;com.azure:azure-core-http-vertx;dependency} -->
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-codegen</artifactId>
<version>4.5.0</version> <!-- {x-version-update;io.vertx:vertx-codegen;external_dependency} -->
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@

import com.azure.core.client.traits.HttpTrait;
import com.azure.core.http.HttpClient;
import com.azure.core.http.HttpClientProvider;
import com.azure.core.http.netty.NettyAsyncHttpClientBuilder;
import com.azure.core.http.netty.NettyAsyncHttpClientProvider;
import com.azure.core.http.okhttp.OkHttpAsyncClientProvider;
import com.azure.core.http.okhttp.OkHttpAsyncHttpClientBuilder;
import com.azure.core.http.policy.HttpPipelinePolicy;
import com.azure.core.http.vertx.VertxAsyncHttpClientBuilder;
import com.azure.core.http.vertx.VertxAsyncHttpClientProvider;
import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder;
import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
Expand All @@ -30,11 +27,6 @@
import java.util.Collections;
import java.util.concurrent.CompletableFuture;

import static com.azure.perf.test.core.PerfStressOptions.HttpClientType.JDK;
import static com.azure.perf.test.core.PerfStressOptions.HttpClientType.NETTY;
import static com.azure.perf.test.core.PerfStressOptions.HttpClientType.OKHTTP;
import static com.azure.perf.test.core.PerfStressOptions.HttpClientType.VERTX;

/**
* The Base Performance Test class for API based Perf Tests.
*
Expand All @@ -47,9 +39,10 @@ public abstract class ApiPerfTestBase<TOptions extends PerfStressOptions> extend
private String recordingId;
private long completedOperations;

// Derived classes should use the configureClientBuilder() method by default. If a ClientBuilder does not

// Derived classes should use the ConfigureClientBuilder() method by default. If a ClientBuilder does not
// follow the standard convention, it can be configured manually using these fields.
protected HttpClient httpClient;
protected final HttpClient httpClient;
protected final Iterable<HttpPipelinePolicy> policies;

/**
Expand All @@ -62,6 +55,7 @@ public ApiPerfTestBase(TOptions options) {
super(options);

httpClient = createHttpClient(options);

if (options.getTestProxies() != null && !options.getTestProxies().isEmpty()) {
recordPlaybackHttpClient = createRecordPlaybackClient(options);
testProxy = options.getTestProxies().get(parallelIndex % options.getTestProxies().size());
Expand All @@ -77,84 +71,44 @@ public ApiPerfTestBase(TOptions options) {

private static HttpClient createHttpClient(PerfStressOptions options) {
PerfStressOptions.HttpClientType httpClientType = options.getHttpClient();
Class<? extends HttpClientProvider> httpClientProvider = null;
if (httpClientType.equals(NETTY)) {
if (options.isInsecure()) {
try {
SslContext sslContext = SslContextBuilder.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE)
.build();
switch (httpClientType) {
case NETTY:
if (options.isInsecure()) {
try {
SslContext sslContext = SslContextBuilder.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE)
.build();

reactor.netty.http.client.HttpClient nettyHttpClient =
reactor.netty.http.client.HttpClient.create()
.secure(sslContextSpec -> sslContextSpec.sslContext(sslContext));
reactor.netty.http.client.HttpClient nettyHttpClient =
reactor.netty.http.client.HttpClient.create()
.secure(sslContextSpec -> sslContextSpec.sslContext(sslContext));

return new NettyAsyncHttpClientBuilder(nettyHttpClient).build();
} catch (SSLException e) {
throw new IllegalStateException(e);
return new NettyAsyncHttpClientBuilder(nettyHttpClient).build();
} catch (SSLException e) {
throw new IllegalStateException(e);
}
} else {
return new NettyAsyncHttpClientProvider().createInstance();
}
} else {
httpClientProvider = NettyAsyncHttpClientProvider.class;
}
} else if (httpClientType.equals(OKHTTP)) {
if (options.isInsecure()) {
try {
SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(
null, InsecureTrustManagerFactory.INSTANCE.getTrustManagers(), new SecureRandom());
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.sslSocketFactory(sslContext.getSocketFactory(),
(X509TrustManager) InsecureTrustManagerFactory.INSTANCE.getTrustManagers()[0])
.build();
return new OkHttpAsyncHttpClientBuilder(okHttpClient).build();
} catch (NoSuchAlgorithmException | KeyManagementException e) {
throw new IllegalStateException(e);
case OKHTTP:
if (options.isInsecure()) {
try {
SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(
null, InsecureTrustManagerFactory.INSTANCE.getTrustManagers(), new SecureRandom());
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.sslSocketFactory(sslContext.getSocketFactory(),
(X509TrustManager) InsecureTrustManagerFactory.INSTANCE.getTrustManagers()[0])
.build();
return new OkHttpAsyncHttpClientBuilder(okHttpClient).build();
} catch (NoSuchAlgorithmException | KeyManagementException e) {
throw new IllegalStateException(e);
}
} else {
return new OkHttpAsyncClientProvider().createInstance();
}
} else {
httpClientProvider = OkHttpAsyncClientProvider.class;
}
} else if (httpClientType.equals(JDK)) {
if (options.isInsecure()) {
// can't configure JDK HttpClient for insecure mode with source set to Java 8
throw new UnsupportedOperationException("Can't configure JDK HttpClient for insecure mode.");
} else {
// we want to support friendly name for jdk, but can't use JdkHttpClientProvider on Java 8
httpClientType = PerfStressOptions.HttpClientType.fromString("com.azure.core.http.jdk.httpclient.JdkHttpClientProvider");
}
} else if (httpClientType.equals(VERTX)) {
if (options.isInsecure()) {
io.vertx.core.http.HttpClientOptions vertxOptions = new io.vertx.core.http.HttpClientOptions()
.setSsl(true)
.setTrustAll(true);
return new VertxAsyncHttpClientBuilder().httpClientOptions(vertxOptions).build();
} else {
httpClientProvider = VertxAsyncHttpClientProvider.class;
}
}

if (httpClientProvider == null) {
httpClientProvider = getHttpClientProvider(httpClientType);
}

try {
return httpClientProvider.getDeclaredConstructor().newInstance().createInstance();
} catch (Throwable e) {
throw new IllegalArgumentException("Could not create HttpClient from given provider: " + httpClientType, e);
}
}

@SuppressWarnings("unchecked")
private static Class<? extends HttpClientProvider> getHttpClientProvider(PerfStressOptions.HttpClientType httpClientType) {
String providerClassName = httpClientType.toString();
try {
Class<?> provider = Class.forName(providerClassName, false, ApiPerfTestBase.class.getClassLoader());
if (HttpClientProvider.class.isAssignableFrom(provider)) {
return (Class<? extends HttpClientProvider>) provider;
} else {
throw new IllegalArgumentException("Http client type does not match HttpClientProvider implementation: " + providerClassName);
}
} catch (Throwable e) {
throw new IllegalArgumentException("Http client provider type is not found: " + providerClassName, e);
default:
throw new IllegalArgumentException("Unsupported http client " + httpClientType);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,8 @@

import java.net.URI;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;

import com.azure.core.http.netty.NettyAsyncHttpClientProvider;
import com.azure.core.util.ExpandableStringEnum;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.converters.IParameterSplitter;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
Expand Down Expand Up @@ -51,8 +46,8 @@ public class PerfStressOptions {
@Parameter(names = { "-c", "--count" }, description = "Number of items")
private int count = 10;

@Parameter(names = { "--http-client" }, description = "The http client to use. Can be netty, okhttp, jdk, vertx or a full name of HttpClientProvider implementation class.")
private String httpClient = HttpClientType.NETTY.toString();
@Parameter(names = { "--http-client" }, description = "The http client to use. Can be netty, okhttp.")
private HttpClientType httpClient = HttpClientType.NETTY;

/**
* Get the configured count for performance test.
Expand Down Expand Up @@ -139,7 +134,7 @@ public boolean isSync() {
* @return The http client to use.
*/
public HttpClientType getHttpClient() {
return HttpClientType.fromString(httpClient);
return httpClient;
}

private static class SemiColonSplitter implements IParameterSplitter {
Expand All @@ -148,22 +143,7 @@ public List<String> split(String value) {
}
}

public static class HttpClientType extends ExpandableStringEnum<HttpClientType> {
public static final HttpClientType NETTY = fromString("netty", HttpClientType.class);
public static final HttpClientType OKHTTP = fromString("okhttp", HttpClientType.class);
public static final HttpClientType JDK = fromString("jdk", HttpClientType.class);
public static final HttpClientType VERTX = fromString("vertx", HttpClientType.class);

public static HttpClientType fromString(String name) {
return fromString(name, HttpClientType.class);
}

public static Collection<HttpClientType> values() {
return values(HttpClientType.class);
}

@Deprecated
public HttpClientType() {
}
public enum HttpClientType {
NETTY, OKHTTP
}
}
3 changes: 0 additions & 3 deletions common/perf-test-core/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
requires com.azure.core;
requires com.azure.core.http.okhttp;
requires com.azure.http.netty;
requires com.azure.core.http.jdk.httpclient;
requires com.azure.core.http.vertx;
requires reactor.core;
requires org.reactivestreams;
requires jcommander;
Expand All @@ -18,5 +16,4 @@
requires reactor.netty.core;
requires io.netty.codec.http;
requires okhttp3;
requires io.vertx.core;
}
3 changes: 1 addition & 2 deletions eng/.docsettings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ omitted_paths:
- "sdk/*/mgmt-*/*"
- "sdk/*/swagger/*"
- "sdk/*/codegen/*"
- sdk/*/*-stress/*
- doc/*
- eng/*
- common/smoke-tests/*
Expand Down Expand Up @@ -124,7 +123,7 @@ known_content_issues:
- ['sdk/cosmos/azure-cosmos-spark_3-1_2-12/README.md', '#3113']
- ['sdk/cosmos/azure-cosmos-spark_3-2_2-12/README.md', '#3113']
- ['sdk/cosmos/azure-cosmos-spark_3-3_2-12/README.md', '#3113']
- ['sdk/cosmos/azure-cosmos-spark_3-4_2-12/README.md', '#3113']
- ['sdk/cosmos/azure-cosmos-spark_3-4_2-12/README.md', '#3113']
- ['sdk/cosmos/azure-cosmos-spark_3_2-12/dev/README.md', '#3113']
- ['sdk/cosmos/azure-cosmos-spark_3_2-12/docs/catalog-api.md', '#3113']
- ['sdk/cosmos/azure-cosmos-spark_3_2-12/docs/configuration-reference.md', '#3113']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public class GoodLoggingCheck extends AbstractCheck {
private static final int[] REQUIRED_TOKENS = new int[]{
TokenTypes.IMPORT,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.CLASS_DEF,
TokenTypes.LITERAL_NEW,
TokenTypes.VARIABLE_DEF,
TokenTypes.METHOD_CALL
};

static final String STATIC_LOGGER_ERROR = "Use a static ClientLogger instance in a static method.";
static final String LOGGER_NAME_ERROR = "ClientLogger instance naming: use \"%s\" instead of \"%s\" for consistency.";
static final String NOT_CLIENT_LOGGER_ERROR = "Do not use %s class. Use \"%s\" as a logging mechanism instead of \"%s\".";
static final String LOGGER_NAME_MISMATCH_ERROR = "Not newing a ClientLogger with matching class name. Use \"%s.class\" "
Expand Down Expand Up @@ -78,9 +78,7 @@ public void finishTree(DetailAST ast) {

@Override
public void leaveToken(DetailAST ast) {
if (ast.getType() == TokenTypes.CLASS_DEF
|| ast.getType() == TokenTypes.INTERFACE_DEF
|| ast.getType() == TokenTypes.ENUM_DEF) {
if (ast.getType() == TokenTypes.CLASS_DEF) {
classNameDeque.poll();
}
}
Expand All @@ -100,7 +98,6 @@ public void visitToken(DetailAST ast) {
break;
case TokenTypes.CLASS_DEF:
case TokenTypes.INTERFACE_DEF:
case TokenTypes.ENUM_DEF:
classNameDeque.offer(ast.findFirstToken(TokenTypes.IDENT).getText());
break;
case TokenTypes.LITERAL_NEW:
Expand Down
Loading

0 comments on commit 90dec31

Please sign in to comment.