zzzadruga commented on a change in pull request #20: Ignite 9645
URL: https://github.com/apache/ignite-teamcity-bot/pull/20#discussion_r220834879
 
 

 ##########
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
 ##########
 @@ -159,51 +160,24 @@ public TestFailuresSummary getBuildTestFails(
 
     @GET
     @Path("history")
-    public List<BuildStatisticsSummary> getBuildsHistory(
+    public BuildsHistory getBuildsHistory(
         @Nullable @QueryParam("server") String server,
         @Nullable @QueryParam("buildType") String buildType,
         @Nullable @QueryParam("branch") String branch,
         @Nullable @QueryParam("sinceDate") String sinceDate,
         @Nullable @QueryParam("untilDate") String untilDate)
         throws ServiceUnauthorizedException, ParseException {
-        DateFormat dateFormat = new SimpleDateFormat("ddMMyyyyHHmmss");
+        BuildsHistory buildsHistory = new BuildsHistory.Builder()
+            .branch(branch)
+            .server(server)
+            .buildType(buildType)
+            .sinceDate(sinceDate)
+            .untilDate(untilDate)
+            .build();
 
-        String srvId = isNullOrEmpty(server) ? "apache" : server;
-        String buildTypeId = isNullOrEmpty(buildType) ? 
"IgniteTests24Java8_RunAll" : buildType;
-        String branchName = isNullOrEmpty(branch) ? "refs/heads/master" : 
branch;
-        Date sinceDateFilter = isNullOrEmpty(sinceDate) ? null : 
dateFormat.parse(sinceDate);
-        Date untilDateFilter = isNullOrEmpty(untilDate) ? null : 
dateFormat.parse(untilDate);
-
-        final BackgroundUpdater updater = 
CtxListener.getBackgroundUpdater(context);
-
-        final ITcHelper tcHelper = CtxListener.getTcHelper(context);
-
-        final ICredentialsProv prov = ICredentialsProv.get(req);
-
-        try (IAnalyticsEnabledTeamcity teamcity = tcHelper.server(srvId, 
prov)) {
+        buildsHistory.initialize(ICredentialsProv.get(req), context);
 
-            int[] finishedBuilds = 
teamcity.getBuildNumbersFromHistory(buildTypeId, branchName, sinceDateFilter, 
untilDateFilter);
-
-            List<BuildStatisticsSummary> buildsStatistics = new ArrayList<>();
-
-            for (int i = 0; i < finishedBuilds.length; i++) {
-                int buildId = finishedBuilds[i];
-
-                FullQueryParams param = new FullQueryParams();
-                param.setBuildId(buildId);
-                param.setBranch(branchName);
-                param.setServerId(srvId);
-
-                BuildStatisticsSummary buildsStatistic = updater.get(
-                    BUILDS_STATISTICS_SUMMARY_CACHE_NAME, prov, param,
-                    (k) -> getBuildStatisticsSummaryNoCache(srvId, buildId), 
false);
-
-                if (!buildsStatistic.isFakeStub)
-                    buildsStatistics.add(buildsStatistic);
-            }
-
-            return buildsStatistics;
-        }
+        return buildsHistory;
     }
 
     private BuildStatisticsSummary getBuildStatisticsSummaryNoCache(String 
server, int buildId) {
 
 Review comment:
   Method is never used

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to