From 469f44270c1f37e6fe16bc324fea487a6354679a Mon Sep 17 00:00:00 2001 From: Jianghao Lu Date: Mon, 6 Jun 2016 13:48:57 -0700 Subject: [PATCH] Squashed 'runtimes/' changes from 0bcf347..4736d63 4736d63 Merge pull request #16 from jianghaolu/checkstyle 9b363b4 Making corresponding changes to gradle 122b780 Update travis to install build tools 62865c0 Move checkstyle to build-tools eb8754b Add checkstyle to travis build de698f7 Optional suppression file for maven scenario 55702f0 Merge commit 'bebdec5b1bbf8d0d2b6be78eb00cd2fc85646763' into checkstyle 9071c8d Add checkstyle rules 7282bf8 Merge pull request #14 from jianghaolu/ua 13575b4 Pull runtimes subtree git-subtree-dir: runtimes git-subtree-split: 4736d6335db5a84896461e93f84f6ad78ef5bdc4 --- .travis.yml | 3 +- azure-client-authentication/build.gradle | 7 +-- azure-client-runtime/build.gradle | 8 ++-- .../java/com/microsoft/azure/AzureClient.java | 23 ++++----- .../java/com/microsoft/azure/PagedList.java | 7 ++- build-tools/pom.xml | 47 +++++++++++++++++++ .../src/main/resources}/checkstyle.xml | 1 + .../src/main/resources}/suppressions.xml | 0 client-runtime/build.gradle | 8 ++-- pom.xml | 40 +++++++++++----- 10 files changed, 102 insertions(+), 42 deletions(-) create mode 100644 build-tools/pom.xml rename {checkstyle => build-tools/src/main/resources}/checkstyle.xml (99%) rename {checkstyle => build-tools/src/main/resources}/suppressions.xml (100%) diff --git a/.travis.yml b/.travis.yml index 7c6423f5079cc..05c26fa53735e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,5 +9,6 @@ android: - extra-android-m2repository sudo: false script: - - mvn clean package + - mvn clean install + - mvn checkstyle:check - cd ./azure-android-client-authentication && ./gradlew check diff --git a/azure-client-authentication/build.gradle b/azure-client-authentication/build.gradle index 75d0404be1f54..7c4d070dc10a5 100644 --- a/azure-client-authentication/build.gradle +++ b/azure-client-authentication/build.gradle @@ -13,9 +13,10 @@ apply plugin: 'checkstyle' version = '1.0.0-SNAPSHOT' checkstyle { - configFile = new File("$rootDir/ClientRuntimes/Java/checkstyle/checkstyle.xml") - configProperties = [samedir: "$rootDir/ClientRuntimes/Java/checkstyle"] - reportsDir = new File("$rootDir/ClientRuntimes/Java/checkstyle/reports") + toolVersion = "6.18" + configFile = new File("$rootDir/ClientRuntimes/Java/build-tools/src/main/resources/checkstyle.xml") + configProperties = [samedir: "$rootDir/ClientRuntimes/Java/build-tools/src/main/resources"] + reportsDir = new File("$rootDir/ClientRuntimes/Java/build-tools/reports") } dependencies { diff --git a/azure-client-runtime/build.gradle b/azure-client-runtime/build.gradle index 775736ec22dba..5c29359536abc 100644 --- a/azure-client-runtime/build.gradle +++ b/azure-client-runtime/build.gradle @@ -13,10 +13,10 @@ apply plugin: 'checkstyle' version = '1.0.0-SNAPSHOT' checkstyle { - toolVersion = "6.9" - configFile = new File("$rootDir/ClientRuntimes/Java/checkstyle/checkstyle.xml") - configProperties = [samedir: "$rootDir/ClientRuntimes/Java/checkstyle"] - reportsDir = new File("$rootDir/ClientRuntimes/Java/checkstyle/reports") + toolVersion = "6.18" + configFile = new File("$rootDir/ClientRuntimes/Java/build-tools/src/main/resources/checkstyle.xml") + configProperties = [samedir: "$rootDir/ClientRuntimes/Java/build-tools/src/main/resources"] + reportsDir = new File("$rootDir/ClientRuntimes/Java/build-tools/reports") } dependencies { diff --git a/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java b/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java index 56f377008512e..f6eaecdb44676 100644 --- a/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java +++ b/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java @@ -13,6 +13,12 @@ import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseCallback; import com.microsoft.rest.ServiceResponseWithHeaders; +import okhttp3.ResponseBody; +import retrofit2.Call; +import retrofit2.Response; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Url; import java.io.IOException; import java.lang.reflect.Type; @@ -22,13 +28,6 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -import okhttp3.ResponseBody; -import retrofit2.Call; -import retrofit2.Response; -import retrofit2.http.GET; -import retrofit2.http.Header; -import retrofit2.http.Url; - /** * An instance of this class defines a ServiceClient that handles polling and * retrying for long running operations when accessing Azure resources. @@ -288,8 +287,7 @@ public ServiceResponse getPostOrDeleteResult(Response respo } // Check if operation failed - if (AzureAsyncOperation.getFailedStatuses().contains(pollingState.getStatus())) - { + if (AzureAsyncOperation.getFailedStatuses().contains(pollingState.getStatus())) { throw new CloudException("Async operation failed"); } @@ -778,7 +776,7 @@ class PutPatchPollingTask extends AsyncPollingTask { * @param serviceCall the ServiceCall object tracking Retrofit calls. * @param clientCallback the client callback to call when a terminal status is hit. */ - public PutPatchPollingTask(final PollingState pollingState, final String url, final ServiceCall serviceCall, final ServiceCallback clientCallback) { + PutPatchPollingTask(final PollingState pollingState, final String url, final ServiceCall serviceCall, final ServiceCallback clientCallback) { this.serviceCall = serviceCall; this.pollingState = pollingState; this.url = url; @@ -835,7 +833,7 @@ class PostDeletePollingTask extends AsyncPollingTask { * @param serviceCall the ServiceCall object tracking Retrofit calls. * @param clientCallback the client callback to call when a terminal status is hit. */ - public PostDeletePollingTask(final PollingState pollingState, final ServiceCall serviceCall, final ServiceCallback clientCallback) { + PostDeletePollingTask(final PollingState pollingState, final ServiceCall serviceCall, final ServiceCallback clientCallback) { this.serviceCall = serviceCall; this.pollingState = pollingState; this.clientCallback = clientCallback; @@ -867,8 +865,7 @@ public void run() { } } else { // Check if operation failed - if (AzureAsyncOperation.getFailedStatuses().contains(pollingState.getStatus())) - { + if (AzureAsyncOperation.getFailedStatuses().contains(pollingState.getStatus())) { clientCallback.failure(new ServiceException("Async operation failed")); } else { clientCallback.success(new ServiceResponse<>(pollingState.getResource(), pollingState.getResponse())); diff --git a/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java b/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java index f501163ff03e0..a88a044f751e7 100644 --- a/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java +++ b/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java @@ -9,6 +9,8 @@ import com.microsoft.rest.RestException; +import javax.xml.bind.DataBindingException; +import javax.xml.ws.WebServiceException; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; @@ -17,9 +19,6 @@ import java.util.ListIterator; import java.util.NoSuchElementException; -import javax.xml.bind.DataBindingException; -import javax.xml.ws.WebServiceException; - /** * Defines a list response from a paging operation. The pages are * lazy initialized when an instance of this class is iterated. @@ -128,7 +127,7 @@ private class ListItr implements ListIterator { * * @param index the position in the list to start. */ - public ListItr(int index) { + ListItr(int index) { itemsListItr = items.listIterator(index); } diff --git a/build-tools/pom.xml b/build-tools/pom.xml new file mode 100644 index 0000000000000..d540f8f5e6980 --- /dev/null +++ b/build-tools/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + + com.microsoft.azure + autorest-clientruntime-for-java + 1.0.0-SNAPSHOT + ../pom.xml + + + autorest-build-tools + jar + + Build tools for AutoRest client runtime for Java + This package contains the build tools for AutoRest generated Java clients. + https://github.com/Azure/autorest-clientruntime-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + scm:git:https://github.com/Azure/autorest-clientruntime-for-java + scm:git:git@github.com:Azure/autorest-clientruntime-for-java.git + HEAD + + + + UTF-8 + + + + + + microsoft + Microsoft + + + diff --git a/checkstyle/checkstyle.xml b/build-tools/src/main/resources/checkstyle.xml similarity index 99% rename from checkstyle/checkstyle.xml rename to build-tools/src/main/resources/checkstyle.xml index d2b92aa67f9ef..d156ff63e65f6 100644 --- a/checkstyle/checkstyle.xml +++ b/build-tools/src/main/resources/checkstyle.xml @@ -38,6 +38,7 @@ +