Skip to content

Commit

Permalink
Base64Util (#188 continued) (#189)
Browse files Browse the repository at this point in the history
* Use Base64Util in generator

* Regenerate

* Fully remove apache commons dependency

* Bump to v2.0.17

* Use RunServerListener instead of exec plugin to run testserver

* Reduce wait time for testserver to start

* Fix remaining tests
  • Loading branch information
RikkiGibson committed Apr 25, 2018
1 parent 13cae91 commit 1a2b7b2
Show file tree
Hide file tree
Showing 26 changed files with 377 additions and 428 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft.azure/autorest.java",
"version": "2.0.16",
"version": "2.0.17",
"description": "The Java extension for classic generators in AutoRest.",
"scripts": {
"autorest": "autorest",
Expand Down
11 changes: 0 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,6 @@
<artifactId>azure-client-runtime</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion src/JavaCodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5318,7 +5318,7 @@ private static void ConvertClientTypesToWireTypes(JavaBlock function, IEnumerabl
{
if (parameterWireType.IsPrimaryType(AutoRestKnownPrimaryType.String))
{
function.Line($"{parameterWireTypeName} {parameterWireName} = Base64.encodeBase64String({parameterName});");
function.Line($"{parameterWireTypeName} {parameterWireName} = Base64Util.encodeToString({parameterName});");
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/Model/ClientMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public virtual void AddImportsTo(ISet<string> imports, bool includeImplementatio
{
if (parameterModelType.IsPrimaryType(AutoRestKnownPrimaryType.ByteArray))
{
imports.Add("org.apache.commons.codec.binary.Base64");
imports.Add("com.microsoft.rest.v2.util.Base64Util");
}
else if (parameterModelType is AutoRestSequenceType)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Model/RestAPIParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void AddImportsTo(ISet<string> imports, bool includeImplementationImports
{
if (Type == ArrayType.ByteArray)
{
imports.Add("org.apache.commons.codec.binary.Base64");
imports.Add("com.microsoft.rest.v2.util.Base64Util");
}
else if (Type is ListType)
{
Expand Down
32 changes: 8 additions & 24 deletions test/azure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>codegen-tests</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down Expand Up @@ -102,36 +109,13 @@
</configuration>
</plugin>

<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>1.5.0</version>
<executions>
<execution>
<id>run-server</id>
<phase>test-compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>node</executable>
<workingDirectory>${session.executionRootDirectory}</workingDirectory>
<arguments>
<argument>node_modules/@microsoft.azure/autorest.testserver</argument>
</arguments>
<async>true</async>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<properties>
<property>
<name>listener</name>
<value>fixtures.azurereport.CoverageReporter</value>
<value>fixtures.azurereport.CoverageReporter,fixtures.server.RunServerListener</value>
</property>
</properties>
</configuration>
Expand Down
32 changes: 8 additions & 24 deletions test/azurefluent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>codegen-tests</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down Expand Up @@ -106,36 +113,13 @@
</configuration>
</plugin>

<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>1.5.0</version>
<executions>
<execution>
<id>run-server</id>
<phase>test-compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>node</executable>
<workingDirectory>${session.executionRootDirectory}</workingDirectory>
<arguments>
<argument>node_modules/@microsoft.azure/autorest.testserver</argument>
</arguments>
<async>true</async>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<properties>
<property>
<name>listener</name>
<value>fixtures.azurereport.CoverageReporter</value>
<value>fixtures.azurereport.CoverageReporter,fixtures.server.RunServerListener</value>
</property>
</properties>
</configuration>
Expand Down
38 changes: 17 additions & 21 deletions test/clienttypeprefix/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>codegen-tests</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down Expand Up @@ -106,27 +113,16 @@
</configuration>
</plugin>

<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>1.5.0</version>
<executions>
<execution>
<id>run-server</id>
<phase>test-compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>node</executable>
<workingDirectory>${session.executionRootDirectory}</workingDirectory>
<arguments>
<argument>node_modules/@microsoft.azure/autorest.testserver</argument>
</arguments>
<async>true</async>
</configuration>
</execution>
</executions>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<properties>
<property>
<name>listener</name>
<value>fixtures.server.RunServerListener</value>
</property>
</properties>
</configuration>
</plugin>

<plugin>
Expand Down
38 changes: 17 additions & 21 deletions test/generateclientinterfaces/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>codegen-tests</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down Expand Up @@ -106,27 +113,16 @@
</configuration>
</plugin>

<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>1.5.0</version>
<executions>
<execution>
<id>run-server</id>
<phase>test-compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>node</executable>
<workingDirectory>${session.executionRootDirectory}</workingDirectory>
<arguments>
<argument>node_modules/@microsoft.azure/autorest.testserver</argument>
</arguments>
<async>true</async>
</configuration>
</execution>
</executions>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<properties>
<property>
<name>listener</name>
<value>fixtures.server.RunServerListener</value>
</property>
</properties>
</configuration>
</plugin>

<plugin>
Expand Down
38 changes: 17 additions & 21 deletions test/implementationsubpackage-empty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>codegen-tests</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down Expand Up @@ -106,27 +113,16 @@
</configuration>
</plugin>

<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>1.5.0</version>
<executions>
<execution>
<id>run-server</id>
<phase>test-compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>node</executable>
<workingDirectory>${session.executionRootDirectory}</workingDirectory>
<arguments>
<argument>node_modules/@microsoft.azure/autorest.testserver</argument>
</arguments>
<async>true</async>
</configuration>
</execution>
</executions>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<properties>
<property>
<name>listener</name>
<value>fixtures.server.RunServerListener</value>
</property>
</properties>
</configuration>
</plugin>

<plugin>
Expand Down
38 changes: 17 additions & 21 deletions test/implementationsubpackage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>codegen-tests</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down Expand Up @@ -106,27 +113,16 @@
</configuration>
</plugin>

<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<version>1.5.0</version>
<executions>
<execution>
<id>run-server</id>
<phase>test-compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>node</executable>
<workingDirectory>${session.executionRootDirectory}</workingDirectory>
<arguments>
<argument>node_modules/@microsoft.azure/autorest.testserver</argument>
</arguments>
<async>true</async>
</configuration>
</execution>
</executions>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<properties>
<property>
<name>listener</name>
<value>fixtures.server.RunServerListener</value>
</property>
</properties>
</configuration>
</plugin>

<plugin>
Expand Down
Loading

0 comments on commit 1a2b7b2

Please sign in to comment.