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

Remove rest proxy code and move shared test to annotation-processor-test #44660

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
131 changes: 117 additions & 14 deletions sdk/clientcore/annotation-processor-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
--add-exports io.clientcore.core/io.clientcore.core.implementation.http=ALL-UNNAMED
--add-exports io.clientcore.core/io.clientcore.core.implementation.http.serializer=ALL-UNNAMED
--add-exports io.clientcore.core/io.clientcore.core.implementation.utils=ALL-UNNAMED

--add-opens io.clientcore.http.okhttp3/io.clientcore.http.okhttp3=ALL-UNNAMED
-add-opens annotation.processor.test/io.clientcore.anntation.processor.test.shared=ALL-UNNAMED
--add-exports annotation.processor.test/io.clientcore.anntation.processor.test.shared=ALL-UNNAMED
</javaModulesSurefireArgLine>
</properties>

Expand All @@ -57,20 +57,8 @@
<artifactId>core</artifactId>
<version>1.0.0-beta.8</version> <!-- {x-version-update;unreleased_io.clientcore:core;dependency} -->
</dependency>
<dependency>
<groupId>io.clientcore</groupId>
<artifactId>http-okhttp3</artifactId>
<version>1.0.0-beta.3</version> <!-- {x-version-update;io.clientcore:http-okhttp3;current} -->
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>io.clientcore</groupId>
<artifactId>core</artifactId>
<version>1.0.0-beta.8</version> <!-- {x-version-update;unreleased_io.clientcore:core;dependency} -->
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
Expand Down Expand Up @@ -101,6 +89,12 @@
<version>5.11.2</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-params;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.conscrypt</groupId>
<artifactId>conscrypt-openjdk-uber</artifactId>
<version>2.5.2</version> <!-- {x-version-update;org.conscrypt:conscrypt-openjdk-uber;external_dependency} -->
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -146,6 +140,34 @@
</excludes>
</configuration>
</execution>

<execution>
<id>run-annotation-processing-test</id>
<phase>generate-test-sources</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<source>1.8</source>
<target>1.8</target>
<release>8</release>
<proc>only</proc>
<generatedTestSourcesDirectory>${project.build.directory}/generated-test-sources/</generatedTestSourcesDirectory>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>io.clientcore</groupId>
<artifactId>annotation-processor</artifactId>
<version>1.0.0-beta.2</version> <!-- {x-version-update;unreleased_io.clientcore:annotation-processor;dependency} -->
</annotationProcessorPath>
</annotationProcessorPaths>
<annotationProcessors>
<annotationProcessor>io.clientcore.annotation.processor.AnnotationProcessor</annotationProcessor>
</annotationProcessors>
<compilerArgs>
<arg>-Xlint:-options</arg>
</compilerArgs>
</configuration>
</execution>
</executions>

<dependencies>
Expand Down Expand Up @@ -174,8 +196,89 @@
</sources>
</configuration>
</execution>

<execution>
<id>add-generated-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/target/generated-test-sources</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.5.2</version> <!-- {x-version-update;org.apache.maven.plugins:maven-failsafe-plugin;external_dependency} -->
</plugin>

<!-- HttpClientTests is inherited by tests in http-okhttp3 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version> <!-- {x-version-update;org.apache.maven.plugins:maven-jar-plugin;external_dependency} -->
<executions>
<execution>
<id>test-jar</id>
<phase>test-compile</phase>
<goals>
<goal>test-jar</goal>
</goals>
</execution>

<execution>
<id>default-jar</id>
<phase>package</phase>
<configuration>
<archive>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>java12-plus</id>
<activation>
<jdk>[12,)</jdk>
</activation>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version> <!-- {x-version-update;org.apache.maven.plugins:maven-compiler-plugin;external_dependency} -->
<executions>
<execution>
<id>java12-plus-mr</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>12</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/main/java12</compileSourceRoot>
</compileSourceRoots>
<multiReleaseOutput>true</multiReleaseOutput>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import io.clientcore.annotation.processor.test.implementation.models.Foo;
import io.clientcore.annotation.processor.test.implementation.models.FooListResult;
import io.clientcore.annotation.processor.test.implementation.models.HttpBinJSON;
import io.clientcore.core.annotations.ServiceInterface;
import io.clientcore.core.http.annotations.BodyParam;
import io.clientcore.core.http.annotations.HeaderParam;
Expand All @@ -18,9 +17,7 @@
import io.clientcore.core.http.models.RequestOptions;
import io.clientcore.core.http.models.Response;
import io.clientcore.core.http.pipeline.HttpPipeline;
import io.clientcore.core.implementation.http.ContentType;
import io.clientcore.core.models.binarydata.BinaryData;

import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.nio.ByteBuffer;
Expand Down Expand Up @@ -100,39 +97,5 @@ Response<List<Foo>> listFoo(@HostParam("uri") String uri, @QueryParam(value = "t
@HttpRequestInformation(method = HttpMethod.GET, path = "{nextLink}", expectedStatusCodes = { 200 })
Response<List<Foo>> listNextFoo(@PathParam(value = "nextLink", encoded = true) String nextLink,
RequestOptions requestOptions);
// HttpClientTests
// Need to add RequestOptions to specify ResponseBodyMode, which is otherwise provided by convenience methods
@SuppressWarnings({ "unchecked", "cast" })
@HttpRequestInformation(method = HttpMethod.PUT, path = "put", expectedStatusCodes = {200})
default HttpBinJSON putConvenience(String uri, int putBody, RequestOptions options) {
return putResponse(uri, putBody, options).getValue();
}

@HttpRequestInformation(method = HttpMethod.PUT, path = "put", expectedStatusCodes = { 200 })
Response<HttpBinJSON> putResponse(@HostParam("uri") String uri,
@BodyParam(ContentType.APPLICATION_OCTET_STREAM) int putBody, RequestOptions options);

@HttpRequestInformation(method = HttpMethod.POST, path = "stream", expectedStatusCodes = { 200 })
default HttpBinJSON postStreamConvenience(@HostParam("uri") String uri,
@BodyParam(ContentType.APPLICATION_OCTET_STREAM) int putBody, RequestOptions options) {
return postStreamResponse(uri, putBody, options).getValue();
}

@HttpRequestInformation(method = HttpMethod.POST, path = "stream", expectedStatusCodes = { 200 })
Response<HttpBinJSON> postStreamResponse(@HostParam("uri") String uri,
@BodyParam(ContentType.APPLICATION_OCTET_STREAM) int putBody, RequestOptions options);

// Service 1
@HttpRequestInformation(method = HttpMethod.GET, path = "bytes/100", expectedStatusCodes = {200})
byte[] getByteArray(@HostParam("uri") String uri);

// Service 2
@HttpRequestInformation(method = HttpMethod.GET, path = "bytes/{numberOfBytes}", expectedStatusCodes = { 200 })
byte[] getByteArray(@HostParam("scheme") String scheme, @HostParam("hostName") String hostName,
@PathParam("numberOfBytes") int numberOfBytes);

// Service 3
@HttpRequestInformation(method = HttpMethod.GET, path = "bytes/100", expectedStatusCodes = { 200 })
void getNothing(@HostParam("uri") String uri);
}
}
Loading
Loading