From cad4cb8cbb304510985dd3eac4b58390af0f2f0a Mon Sep 17 00:00:00 2001 From: daisy-ycguo Date: Fri, 30 Oct 2015 12:20:41 +0800 Subject: [PATCH] Add a new parameter includeAutomatedEntry to API getContributionStatics --- .../java/org/zanata/rest/service/MockStatisticsResource.java | 2 +- .../org/zanata/rest/client/StatisticsResourceClient.java | 5 +++-- .../org/zanata/rest/client/StatisticsResourceClientTest.java | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/stub-server/src/main/java/org/zanata/rest/service/MockStatisticsResource.java b/stub-server/src/main/java/org/zanata/rest/service/MockStatisticsResource.java index f6de9387..2bb18d6f 100644 --- a/stub-server/src/main/java/org/zanata/rest/service/MockStatisticsResource.java +++ b/stub-server/src/main/java/org/zanata/rest/service/MockStatisticsResource.java @@ -69,7 +69,7 @@ public ContainerTranslationStatistics getStatistics(String projectSlug, @Override public ContributionStatistics getContributionStatistics(String projectSlug, - String versionSlug, String username, String dateRange) { + String versionSlug, String username, String dateRange, boolean includeAutomatedEntry) { ContributionStatistics contributionStatistics = new ContributionStatistics(); LocaleStatistics localeStatistics = new LocaleStatistics(); diff --git a/zanata-rest-client/src/main/java/org/zanata/rest/client/StatisticsResourceClient.java b/zanata-rest-client/src/main/java/org/zanata/rest/client/StatisticsResourceClient.java index 19db011d..28f3f3ea 100644 --- a/zanata-rest-client/src/main/java/org/zanata/rest/client/StatisticsResourceClient.java +++ b/zanata-rest-client/src/main/java/org/zanata/rest/client/StatisticsResourceClient.java @@ -95,7 +95,7 @@ public ContainerTranslationStatistics getStatistics(String projectSlug, @Override public ContributionStatistics getContributionStatistics(String projectSlug, - String versionSlug, String username, String dateRange) { + String versionSlug, String username, String dateRange, boolean includeAutomatedEntry) { WebResource webResource = factory.getClient().resource(baseUri).path("stats") .path("project") @@ -104,7 +104,8 @@ public ContributionStatistics getContributionStatistics(String projectSlug, .path(versionSlug) .path("contributor") .path(username) - .path(dateRange); + .path(dateRange) + .queryParam("includeAutomatedEntry", String.valueOf(includeAutomatedEntry)); return webResource.get(ContributionStatistics.class); } } diff --git a/zanata-rest-client/src/test/java/org/zanata/rest/client/StatisticsResourceClientTest.java b/zanata-rest-client/src/test/java/org/zanata/rest/client/StatisticsResourceClientTest.java index 78a64608..ffa369ff 100644 --- a/zanata-rest-client/src/test/java/org/zanata/rest/client/StatisticsResourceClientTest.java +++ b/zanata-rest-client/src/test/java/org/zanata/rest/client/StatisticsResourceClientTest.java @@ -73,7 +73,7 @@ public void testGetDocStatistics() { public void testGetContributorStatistics() { ContributionStatistics statistics = client.getContributionStatistics("about-fedora", "master", - "pahuang", "2014-10-01..2014-11-10"); + "pahuang", "2014-10-01..2014-11-10",false); assertThat(statistics, Matchers.hasKey("pahuang")); }