[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-08 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r223283252
 
 

 ##
 File path: ignite-tc-helper-web/src/main/webapp/comparison.html
 ##
 @@ -173,6 +185,139 @@
 return parseFloat(string.substring(string.indexOf("-") + 2, 
string.lastIndexOf("-") - 1));
 }
 
+var changeDisplay = function(id) {
+$("#" + id).toggle();
+}
+
+function mergeSuits(results) {
+let mergedSuites = new Set();
+
+for (let key of Object.keys(results)) {
+for (let suite of Object.keys(results[key]))
+mergedSuites.add(suite);
+}
+
+return Array.from(mergedSuites);
+}
+
+function printTests(results) {
+$("#testsTable tr:not(:first-child)").remove();
+
+let markedRow = true;
+
+for (let s of mergeSuits(results).sort()) {
+let suiteName = s.split('_').filter((value, index) => index != 
0).join('_');
+
+let backgroundColor = markedRow ? "background-color:#fafaff" : '';
+
+let testsCntCells = '';
+
+let testsCells = '';
+
+for (let key of Object.keys(results)) {
+let obj = results[key];
+
+let testLength = !obj.hasOwnProperty(s) || obj[s].length == 0 ?
+'' : obj[s].length;
+
+testsCntCells = testsCntCells + '' +
+testLength + '';
+
+testsCells = testsCells + ''
++ getSuiteTestsHtml(results, s, key) + ''
+}
+
+$("#testsTable > tbody:last-child").append('' +
+'' + suiteName +
+'' + testsCntCells + '');
+
+$("#testsTable tbody").append('' +
+'' + testsCells + '');
+
+markedRow = !markedRow;
+}
+}
+
+function generateCompareTestsResults(results) {
+let compareTestsResults = {};
+
+for (let key of  Object.keys(results)) {
+let uniqueObj = {};
+
+for (let suite of  Object.keys(results[key])) {
+let allTests = [];
+
+for (let key2 of Object.keys(results)) {
+if (key == key2)
+continue;
+
+allTests = allTests.concat(results[key2][suite]);
+}
+
+let uniqTests = results[key][suite].filter(function(test) {
+return allTests.indexOf(test) == -1;
+});
+
+if (uniqTests.length != 0)
+uniqueObj[suite] = uniqTests;
+}
+
+compareTestsResults[key] = uniqueObj;
+}
+
+return compareTestsResults;
+}
+
+function getSuiteTestsHtml(results, suite, key) {
+if (!results[key].hasOwnProperty(suite) || results[key][suite].length 
== 0)
+return '';
+
+let res = '';
+
+for (let v of results[key][suite].sort()) {
+let list = v.toString().split(".");
+
+if (list.length < 2)
+list = v.toString().split(":");
+
+let testName = list.pop();
+
 
 Review comment:
   Remove empty line between `let` statements.


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-08 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r223284955
 
 

 ##
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/hist/BuildsHistory.java
 ##
 @@ -0,0 +1,257 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.ci.web.model.hist;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.servlet.ServletContext;
+import org.apache.ignite.ci.IAnalyticsEnabledTeamcity;
+import org.apache.ignite.ci.ITcHelper;
+import org.apache.ignite.ci.tcbot.chain.BuildChainProcessor;
+import org.apache.ignite.ci.tcmodel.result.Build;
+import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrence;
+import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrences;
+import org.apache.ignite.ci.user.ICredentialsProv;
+import org.apache.ignite.ci.web.CtxListener;
+import org.apache.ignite.ci.web.model.current.BuildStatisticsSummary;
+import org.apache.ignite.ci.web.rest.exception.ServiceUnauthorizedException;
+import org.apache.ignite.ci.web.rest.parms.FullQueryParams;
+
+import static com.google.common.base.Strings.isNullOrEmpty;
+import static 
org.apache.ignite.ci.web.rest.build.GetBuildTestFailures.BUILDS_STATISTICS_SUMMARY_CACHE_NAME;
+
+/**
+ * Builds History: includes statistic for every build and merged failed 
unmuted tests in specified time interval.
+ */
+
+public class BuildsHistory {
+/** */
+private String srvId;
+
+/** */
+private String projectId;
+
+/** */
+private String buildTypeId;
+
+/** */
+private String branchName;
+
+/** */
+private Date sinceDateFilter;
+
+/** */
+private Date untilDateFilter;
+
+/** */
+private Map> mergedTestsBySuites = new HashMap<>();
+
+/** */
+public List buildsStatistics = new ArrayList<>();
+
+/** */
+public String mergedTestsJson;
+
+/** */
+public void initialize(ICredentialsProv prov, ServletContext context) {
+if (!prov.hasAccess(srvId))
+throw ServiceUnauthorizedException.noCreds(srvId);
+
+ITcHelper tcHelper = CtxListener.getTcHelper(context);
+
+IAnalyticsEnabledTeamcity teamcity = tcHelper.server(srvId, prov);
+
+int[] finishedBuildsIds = 
teamcity.getBuildNumbersFromHistory(buildTypeId, branchName,
+sinceDateFilter, untilDateFilter);
+
+initBuildsStatistics(teamcity, prov, context, finishedBuildsIds);
+
+initBuildsMergedFailedTests(teamcity, finishedBuildsIds);
+}
+
+/** */
+private void initBuildsStatistics(IAnalyticsEnabledTeamcity teamcity, 
ICredentialsProv prov,
+ServletContext context, int[] buildIds) {
+for (int buildId : buildIds) {
+FullQueryParams buildParams = new FullQueryParams();
+
+buildParams.setBuildId(buildId);
+
+buildParams.setBranch(branchName);
+
+buildParams.setServerId(srvId);
+
+BuildStatisticsSummary buildsStatistic = 
CtxListener.getBackgroundUpdater(context).get(
+BUILDS_STATISTICS_SUMMARY_CACHE_NAME, prov, buildParams,
+(k) -> {
+BuildStatisticsSummary stat = new 
BuildStatisticsSummary(buildId);
+
+stat.initialize(teamcity);
+
+return stat;
+}, false);
+
+if (buildsStatistic != null && !buildsStatistic.isFakeStub)
+buildsStatistics.add(buildsStatistic);
+}
+}
+
+/** */
+private void initBuildsMergedFailedTests(IAnalyticsEnabledTeamcity 
teamcity, int[] buildIds) {
+for (int buildId : buildIds) {
+Build build = 
teamcity.getBuild(teamcity.getBuildHrefById(buildId));
+
+TestOccurrences 

[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-08 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r223286978
 
 

 ##
 File path: ignite-tc-helper-web/src/main/webapp/comparison.html
 ##
 @@ -173,6 +185,139 @@
 return parseFloat(string.substring(string.indexOf("-") + 2, 
string.lastIndexOf("-") - 1));
 }
 
+var changeDisplay = function(id) {
+$("#" + id).toggle();
+}
+
+function mergeSuits(results) {
 
 Review comment:
   How looks `results` in this and other methods?


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-08 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r223271317
 
 

 ##
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/hist/BuildsHistory.java
 ##
 @@ -0,0 +1,256 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.ci.web.model.hist;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.servlet.ServletContext;
+import org.apache.ignite.ci.IAnalyticsEnabledTeamcity;
+import org.apache.ignite.ci.ITcHelper;
+import org.apache.ignite.ci.tcbot.chain.BuildChainProcessor;
+import org.apache.ignite.ci.tcmodel.result.Build;
+import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrence;
+import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrences;
+import org.apache.ignite.ci.user.ICredentialsProv;
+import org.apache.ignite.ci.web.CtxListener;
+import org.apache.ignite.ci.web.model.current.BuildStatisticsSummary;
+import org.apache.ignite.ci.web.rest.exception.ServiceUnauthorizedException;
+import org.apache.ignite.ci.web.rest.parms.FullQueryParams;
+
+import static com.google.common.base.Strings.isNullOrEmpty;
+import static 
org.apache.ignite.ci.web.rest.build.GetBuildTestFailures.BUILDS_STATISTICS_SUMMARY_CACHE_NAME;
+
+/**
+ * Builds History: includes statistic for every build and merged failed 
unmuted tests in specified time interval.
+ */
+
 
 Review comment:
   Redundant empty line.


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-08 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r223279959
 
 

 ##
 File path: ignite-tc-helper-web/src/main/webapp/comparison.html
 ##
 @@ -173,6 +185,139 @@
 return parseFloat(string.substring(string.indexOf("-") + 2, 
string.lastIndexOf("-") - 1));
 }
 
+var changeDisplay = function(id) {
+$("#" + id).toggle();
+}
+
+function mergeSuits(results) {
+let mergedSuites = new Set();
+
+for (let key of Object.keys(results)) {
+for (let suite of Object.keys(results[key]))
+mergedSuites.add(suite);
+}
+
+return Array.from(mergedSuites);
+}
+
+function printTests(results) {
+$("#testsTable tr:not(:first-child)").remove();
+
+let markedRow = true;
+
+for (let s of mergeSuits(results).sort()) {
+let suiteName = s.split('_').filter((value, index) => index != 
0).join('_');
+
 
 Review comment:
   Redundant empty lines between `let` statements.


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-08 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r223286626
 
 

 ##
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
 ##
 @@ -159,75 +155,63 @@ public TestFailuresSummary getBuildTestFails(
 }
 
 @GET
-@Path("history")
-public List getBuildsHistory(
+@Produces(MediaType.TEXT_PLAIN)
+@Path("testRef")
+public String getTestRef(
+@NotNull @QueryParam("testName") String name,
+@NotNull @QueryParam("suiteName") String suiteName,
 @Nullable @QueryParam("server") String srv,
-@Nullable @QueryParam("buildType") String buildType,
-@Nullable @QueryParam("branch") String branch,
-@Nullable @QueryParam("sinceDate") String sinceDate,
-@Nullable @QueryParam("untilDate") String untilDate)
-throws ServiceUnauthorizedException {
-String srvId = isNullOrEmpty(srv) ? "apache" : srv;
-String buildTypeId = isNullOrEmpty(buildType) ? 
"IgniteTests24Java8_RunAll" : buildType;
-String branchName = isNullOrEmpty(branch) ? "refs/heads/master" : 
branch;
-Date sinceDateFilter = isNullOrEmpty(sinceDate) ? null : 
dateParse(sinceDate);
-Date untilDateFilter = isNullOrEmpty(untilDate) ? null : 
dateParse(untilDate);
-
-final BackgroundUpdater updater = 
CtxListener.getBackgroundUpdater(ctx);
-
-final ITcHelper tcHelper = CtxListener.getTcHelper(ctx);
+@Nullable @QueryParam("projectId") String projectId)
+throws InterruptedException, ExecutionException, 
ServiceUnauthorizedException {
+final ITcHelper helper = CtxListener.getTcHelper(ctx);
 
 final ICredentialsProv prov = ICredentialsProv.get(req);
 
-IAnalyticsEnabledTeamcity teamcity = tcHelper.server(srvId, prov);
+String project = projectId == null ? "IgniteTests24Java8" : projectId;
 
-int[] finishedBuilds = 
teamcity.getBuildNumbersFromHistory(buildTypeId, branchName, sinceDateFilter, 
untilDateFilter);
+String srvId = srv == null ? "apache" : srv;
 
-List buildsStatistics = new ArrayList<>();
+if (!prov.hasAccess(srvId))
+throw ServiceUnauthorizedException.noCreds(srvId);
 
-for (int i = 0; i < finishedBuilds.length; i++) {
-int buildId = finishedBuilds[i];
+IAnalyticsEnabledTeamcity teamcity = helper.server(srvId, prov);
 
-FullQueryParams param = new FullQueryParams();
-param.setBuildId(buildId);
-param.setBranch(branchName);
-param.setServerId(srvId);
+FullQueryParams key = new FullQueryParams();
 
-BuildStatisticsSummary buildsStatistic = updater.get(
-BUILDS_STATISTICS_SUMMARY_CACHE_NAME, prov, param,
-(k) -> getBuildStatisticsSummaryNoCache(srvId, buildId), 
false);
+key.setTestName(name);
 
 Review comment:
   Redundant empty lines between `set` calls.


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-08 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r223274311
 
 

 ##
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/hist/BuildsHistory.java
 ##
 @@ -0,0 +1,256 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.ci.web.model.hist;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.servlet.ServletContext;
+import org.apache.ignite.ci.IAnalyticsEnabledTeamcity;
+import org.apache.ignite.ci.ITcHelper;
+import org.apache.ignite.ci.tcbot.chain.BuildChainProcessor;
+import org.apache.ignite.ci.tcmodel.result.Build;
+import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrence;
+import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrences;
+import org.apache.ignite.ci.user.ICredentialsProv;
+import org.apache.ignite.ci.web.CtxListener;
+import org.apache.ignite.ci.web.model.current.BuildStatisticsSummary;
+import org.apache.ignite.ci.web.rest.exception.ServiceUnauthorizedException;
+import org.apache.ignite.ci.web.rest.parms.FullQueryParams;
+
+import static com.google.common.base.Strings.isNullOrEmpty;
+import static 
org.apache.ignite.ci.web.rest.build.GetBuildTestFailures.BUILDS_STATISTICS_SUMMARY_CACHE_NAME;
+
+/**
+ * Builds History: includes statistic for every build and merged failed 
unmuted tests in specified time interval.
+ */
+
+public class BuildsHistory {
+/** */
+private String srvId;
+
+/** */
+private String projectId;
+
+/** */
+private String buildTypeId;
+
+/** */
+private String branchName;
+
+/** */
+private Date sinceDateFilter;
+
+/** */
+private Date untilDateFilter;
+
+/** */
+private ObjectMapper objectMapper = new ObjectMapper();
+
+/** */
+private Map> mergedTestsBySuites = new HashMap<>();
+
+/** */
+public List buildsStatistics = new ArrayList<>();
+
+/** */
+public String mergedTestsJson;
+
+/** */
+public void initialize(ICredentialsProv prov, ServletContext context) {
+if (!prov.hasAccess(srvId))
+throw ServiceUnauthorizedException.noCreds(srvId);
+
+ITcHelper tcHelper = CtxListener.getTcHelper(context);
+
+IAnalyticsEnabledTeamcity teamcity = tcHelper.server(srvId, prov);
+
+int[] finishedBuildsIds = 
teamcity.getBuildNumbersFromHistory(buildTypeId, branchName,
+sinceDateFilter, untilDateFilter);
+
+initBuildsStatistics(teamcity, prov, context, finishedBuildsIds);
+
+initBuildsMergedFailedTests(teamcity, finishedBuildsIds);
+}
+
+/** */
+private void initBuildsStatistics(IAnalyticsEnabledTeamcity teamcity, 
ICredentialsProv prov,
+ServletContext context, int[] buildIds) {
+for (int buildId : buildIds) {
+FullQueryParams buildParams = new FullQueryParams();
+
+buildParams.setBuildId(buildId);
+buildParams.setBranch(branchName);
+buildParams.setServerId(srvId);
+
+BuildStatisticsSummary buildsStatistic = 
CtxListener.getBackgroundUpdater(context).get(
+BUILDS_STATISTICS_SUMMARY_CACHE_NAME, prov, buildParams,
+(k) -> {
+BuildStatisticsSummary stat = new 
BuildStatisticsSummary(buildId);
+
+stat.initialize(teamcity);
+
+return stat;
+}, false);
+
+if (buildsStatistic != null && !buildsStatistic.isFakeStub)
+buildsStatistics.add(buildsStatistic);
+}
+}
+
+/** */
+private void initBuildsMergedFailedTests(IAnalyticsEnabledTeamcity 
teamcity, int[] buildIds) {
+for (int buildId : buildIds) {
+Build build = 

[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-08 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r223279740
 
 

 ##
 File path: ignite-tc-helper-web/src/main/webapp/comparison.html
 ##
 @@ -173,6 +185,139 @@
 return parseFloat(string.substring(string.indexOf("-") + 2, 
string.lastIndexOf("-") - 1));
 }
 
+var changeDisplay = function(id) {
+$("#" + id).toggle();
+}
+
+function mergeSuits(results) {
+let mergedSuites = new Set();
+
+for (let key of Object.keys(results)) {
+for (let suite of Object.keys(results[key]))
+mergedSuites.add(suite);
+}
+
+return Array.from(mergedSuites);
+}
+
+function printTests(results) {
+$("#testsTable tr:not(:first-child)").remove();
 
 Review comment:
   Create local variable for `$("#testsTable")`.


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-03 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r79867
 
 

 ##
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
 ##
 @@ -159,75 +156,59 @@ public TestFailuresSummary getBuildTestFails(
 }
 
 @GET
-@Path("history")
-public List getBuildsHistory(
-@Nullable @QueryParam("server") String srv,
-@Nullable @QueryParam("buildType") String buildType,
-@Nullable @QueryParam("branch") String branch,
-@Nullable @QueryParam("sinceDate") String sinceDate,
-@Nullable @QueryParam("untilDate") String untilDate)
-throws ServiceUnauthorizedException {
-String srvId = isNullOrEmpty(srv) ? "apache" : srv;
-String buildTypeId = isNullOrEmpty(buildType) ? 
"IgniteTests24Java8_RunAll" : buildType;
-String branchName = isNullOrEmpty(branch) ? "refs/heads/master" : 
branch;
-Date sinceDateFilter = isNullOrEmpty(sinceDate) ? null : 
dateParse(sinceDate);
-Date untilDateFilter = isNullOrEmpty(untilDate) ? null : 
dateParse(untilDate);
-
-final BackgroundUpdater updater = 
CtxListener.getBackgroundUpdater(ctx);
-
-final ITcHelper tcHelper = CtxListener.getTcHelper(ctx);
+@Produces(MediaType.TEXT_PLAIN)
+@Path("testRef")
+public String getTestRef(
+@NotNull @QueryParam("testName") String name,
+@Nullable @QueryParam("server") String server,
+@Nullable @QueryParam("projectId") String projectId)
+throws InterruptedException, ExecutionException {
+final ITcHelper helper = CtxListener.getTcHelper(ctx);
 
 final ICredentialsProv prov = ICredentialsProv.get(req);
 
-IAnalyticsEnabledTeamcity teamcity = tcHelper.server(srvId, prov);
-
-int[] finishedBuilds = 
teamcity.getBuildNumbersFromHistory(buildTypeId, branchName, sinceDateFilter, 
untilDateFilter);
+String project = projectId == null ? "IgniteTests24Java8" : projectId;
 
-List buildsStatistics = new ArrayList<>();
+String serverId = server == null ? "apache" : server;
 
-for (int i = 0; i < finishedBuilds.length; i++) {
-int buildId = finishedBuilds[i];
+IAnalyticsEnabledTeamcity teamcity = helper.server(serverId, prov);
 
-FullQueryParams param = new FullQueryParams();
-param.setBuildId(buildId);
-param.setBranch(branchName);
-param.setServerId(srvId);
+FullQueryParams key = new FullQueryParams();
 
-BuildStatisticsSummary buildsStatistic = updater.get(
-BUILDS_STATISTICS_SUMMARY_CACHE_NAME, prov, param,
-(k) -> getBuildStatisticsSummaryNoCache(srvId, buildId), 
false);
+key.setTestName(name);
 
-if (!buildsStatistic.isFakeStub)
-buildsStatistics.add(buildsStatistic);
-}
+key.setProjectId(project);
 
-return buildsStatistics;
-}
+key.setServerId(serverId);
 
-private Date dateParse(String date){
-DateFormat dateFormat = new SimpleDateFormat("ddMMHHmmss");
+CompletableFuture ref = teamcity.getTestRef(key);
 
-try {
-return dateFormat.parse(date);
-}
-catch (ParseException e) {
-return null;
-}
+return ref.isDone() ? teamcity.host() + "project.html?"
++ "projectId=" + project
++ "=" + ref.get().id
++ "=testDetails" : null;
 }
 
-private BuildStatisticsSummary getBuildStatisticsSummaryNoCache(String 
server, int buildId) {
-String srvId = isNullOrEmpty(server) ? "apache" : server;
-
-final ITcHelper tcHelper = CtxListener.getTcHelper(ctx);
-
-final ICredentialsProv creds = ICredentialsProv.get(req);
-
-IAnalyticsEnabledTeamcity teamcity = tcHelper.server(srvId, creds);
+@GET
+@Path("history")
+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 
ParseException {
+BuildsHistory buildsHistory = new BuildsHistory.Builder()
+.branch(branch)
+.server(server)
+.buildType(buildType)
+.sinceDate(sinceDate)
+.untilDate(untilDate)
+.build();
 
-BuildStatisticsSummary stat = new BuildStatisticsSummary(buildId);
+System.out.println("History request handled");
 
 Review comment:
   Use logger instead of `sout`. Do we really need this in the log?


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-03 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r90983
 
 

 ##
 File path: ignite-tc-helper-web/src/main/webapp/comparison.html
 ##
 @@ -247,6 +422,7 @@
 
 $(document).ready(function() {
 loadData(1, moment(oneWeekAgo), moment());
+
 
 Review comment:
   Don't separate same semantic units. 
   See [Coding 
Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines#CodingGuidelines-SemanticUnits).


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-03 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r222307974
 
 

 ##
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
 ##
 @@ -159,75 +156,59 @@ public TestFailuresSummary getBuildTestFails(
 }
 
 @GET
-@Path("history")
-public List getBuildsHistory(
-@Nullable @QueryParam("server") String srv,
-@Nullable @QueryParam("buildType") String buildType,
-@Nullable @QueryParam("branch") String branch,
-@Nullable @QueryParam("sinceDate") String sinceDate,
-@Nullable @QueryParam("untilDate") String untilDate)
-throws ServiceUnauthorizedException {
-String srvId = isNullOrEmpty(srv) ? "apache" : srv;
-String buildTypeId = isNullOrEmpty(buildType) ? 
"IgniteTests24Java8_RunAll" : buildType;
-String branchName = isNullOrEmpty(branch) ? "refs/heads/master" : 
branch;
-Date sinceDateFilter = isNullOrEmpty(sinceDate) ? null : 
dateParse(sinceDate);
-Date untilDateFilter = isNullOrEmpty(untilDate) ? null : 
dateParse(untilDate);
-
-final BackgroundUpdater updater = 
CtxListener.getBackgroundUpdater(ctx);
-
-final ITcHelper tcHelper = CtxListener.getTcHelper(ctx);
+@Produces(MediaType.TEXT_PLAIN)
+@Path("testRef")
+public String getTestRef(
+@NotNull @QueryParam("testName") String name,
+@Nullable @QueryParam("server") String server,
 
 Review comment:
   Rename variable to `srv`. See [abbreviation 
rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules).


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-03 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r63950
 
 

 ##
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/hist/BuildsHistory.java
 ##
 @@ -0,0 +1,209 @@
+package org.apache.ignite.ci.web.model.hist;
 
 Review comment:
   Missed license and javadocs.


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-03 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r72279
 
 

 ##
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/hist/BuildsHistory.java
 ##
 @@ -0,0 +1,209 @@
+package org.apache.ignite.ci.web.model.hist;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.servlet.ServletContext;
+import org.apache.ignite.ci.IAnalyticsEnabledTeamcity;
+import org.apache.ignite.ci.ITcHelper;
+import org.apache.ignite.ci.IgnitePersistentTeamcity;
+import org.apache.ignite.ci.chain.BuildChainProcessor;
+import org.apache.ignite.ci.tcmodel.result.Build;
+import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrence;
+import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrences;
+import org.apache.ignite.ci.user.ICredentialsProv;
+import org.apache.ignite.ci.web.CtxListener;
+import org.apache.ignite.ci.web.model.current.BuildStatisticsSummary;
+import org.apache.ignite.ci.web.rest.parms.FullQueryParams;
+
+import static com.google.common.base.Strings.isNullOrEmpty;
+import static 
org.apache.ignite.ci.web.rest.build.GetBuildTestFailures.BUILDS_STATISTICS_SUMMARY_CACHE_NAME;
+
+public class BuildsHistory {
+private String srvId;
+
+private String projectId;
+
+private String buildTypeId;
+
+private String branchName;
+
+private Date sinceDateFilter;
+
+private Date untilDateFilter;
+
+private ObjectMapper objectMapper = new ObjectMapper();
+
+private Map> mergedTestsBySuites = new HashMap<>();
+
+private Set mergedTests = new HashSet<>();
+
+public List buildsStatistics = new ArrayList<>();
+
+public String mergedTestsResult;
+
+public void initialize(ICredentialsProv prov, ServletContext context) {
+ITcHelper tcHelper = CtxListener.getTcHelper(context);
+
+IAnalyticsEnabledTeamcity teamcity = tcHelper.server(srvId, prov);
+
+
 
 Review comment:
   Remove double empty line.


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-03 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r71593
 
 

 ##
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
 ##
 @@ -542,6 +545,19 @@ public ProblemOccurrences getProblems(Build build) {
 return supplyAsync(() -> getJaxbUsingHref(href, 
TestOccurrenceFull.class), executor);
 }
 
+@AutoProfiling
+@Override public TestOccurrences getFailedUnmutedTests(String href, int 
count, String normalizedBranch) {
+return getTests(href + ",muted:false,status:FAILURE,count:" + count, 
normalizedBranch);
+}
+
+@Override
 
 Review comment:
   `Override` annotation should be on the same line with method signature.


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-03 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r89732
 
 

 ##
 File path: ignite-tc-helper-web/src/main/webapp/comparison.html
 ##
 @@ -173,6 +178,176 @@
 return parseFloat(string.substring(string.indexOf("-") + 2, 
string.lastIndexOf("-") - 1));
 }
 
+var ch_disp = function(id) {
+let el = document.getElementById(id);
+
+el.style.display = el.style.display == 'block' ? 'none' : 'block';
+}
+
+function printTests(num, result) {
+let obj = {};
+
+try {
+obj = JSON.parse(result);
+} catch (e) {
+showErrInLoadStatus
+
+return;
+}
+
+if (obj == null)
+return;
+
+let tests = getTests(obj, num);
+
+window.sessionStorage.setItem('tests' + num, tests);
+
+$('#MT' + num).html(tests);
+}
+
+function compareHandler() {
+var compareMode = window.sessionStorage.compareMode;
+
+var needTestsUpdate = window.sessionStorage.needTestsUpdate;
+
+if (needTestsUpdate == 'true') {
+let result1 = window.sessionStorage.result1;
+
+let result2 = window.sessionStorage.result2;
+
+if (result1 == null || result2 == null) {
+alert("Two columns should be loaded for compareMode!");
+
+return;
+}
+
+let obj1 = {};
+
+let obj2 = {};
+
+try {
+obj1 = JSON.parse(result1);
+
+obj2 = JSON.parse(result2);
+} catch (e) {
+showErrInLoadStatus
+}
+
+window.sessionStorage.uniqTests1 = getUniqueTests(obj1, obj2, 1);
+
+window.sessionStorage.uniqTests2 = getUniqueTests(obj2, obj1, 2);
+
+window.sessionStorage.needTestsUpdate = 'false';
+}
+
+if (compareMode == 'true') {
+$('#btt').html("CompareMode");
+
+$('#MT1').html(window.sessionStorage.tests1);
+
+$('#MT2').html(window.sessionStorage.tests2);
+
+window.sessionStorage.compareMode = 'false';
+} else {
+$('#btt').html("FullMode");
+
+$('#MT1').html(window.sessionStorage.uniqTests1);
+
+$('#MT2').html(window.sessionStorage.uniqTests2);
+
+window.sessionStorage.compareMode = 'true';
+}
+
+}
+
+function getUniqueTests(obj1, obj2, num) {
+let uniqObj = {};
+
+let suites = Object.keys(obj1);
+
+for (let suite of suites) {
+if (!obj2.hasOwnProperty(suite)) {
+uniqObj[suite] = obj1[suite];
+
+continue;
+}
+
+let tests = obj2[suite];
+
+let uniqTests = [];
+
+for (let v of obj1[suite])
 
 Review comment:
   Need bracers for multiline `for`.


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-03 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r63852
 
 

 ##
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/result/tests/TestOccurrence.java
 ##
 @@ -98,4 +98,15 @@ public TestOccurrence setStatus(String status) {
 
 return this;
 }
+
+public Integer getBuildId() {
 
 Review comment:
   Missed javadoc.


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-03 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r78498
 
 

 ##
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgnitePersistentTeamcity.java
 ##
 @@ -125,6 +128,11 @@
  */
 private ConcurrentMap> 
testOccFullFutures = new ConcurrentHashMap<>();
 
+/**
+ * cached loads of test refs.
 
 Review comment:
   Start sentence with a capital letter.


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-03 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r222307517
 
 

 ##
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
 ##
 @@ -159,75 +156,59 @@ public TestFailuresSummary getBuildTestFails(
 }
 
 @GET
-@Path("history")
-public List getBuildsHistory(
-@Nullable @QueryParam("server") String srv,
-@Nullable @QueryParam("buildType") String buildType,
-@Nullable @QueryParam("branch") String branch,
-@Nullable @QueryParam("sinceDate") String sinceDate,
-@Nullable @QueryParam("untilDate") String untilDate)
-throws ServiceUnauthorizedException {
-String srvId = isNullOrEmpty(srv) ? "apache" : srv;
-String buildTypeId = isNullOrEmpty(buildType) ? 
"IgniteTests24Java8_RunAll" : buildType;
-String branchName = isNullOrEmpty(branch) ? "refs/heads/master" : 
branch;
-Date sinceDateFilter = isNullOrEmpty(sinceDate) ? null : 
dateParse(sinceDate);
-Date untilDateFilter = isNullOrEmpty(untilDate) ? null : 
dateParse(untilDate);
-
-final BackgroundUpdater updater = 
CtxListener.getBackgroundUpdater(ctx);
-
-final ITcHelper tcHelper = CtxListener.getTcHelper(ctx);
+@Produces(MediaType.TEXT_PLAIN)
+@Path("testRef")
+public String getTestRef(
+@NotNull @QueryParam("testName") String name,
+@Nullable @QueryParam("server") String server,
+@Nullable @QueryParam("projectId") String projectId)
+throws InterruptedException, ExecutionException {
+final ITcHelper helper = CtxListener.getTcHelper(ctx);
 
 final ICredentialsProv prov = ICredentialsProv.get(req);
 
-IAnalyticsEnabledTeamcity teamcity = tcHelper.server(srvId, prov);
-
-int[] finishedBuilds = 
teamcity.getBuildNumbersFromHistory(buildTypeId, branchName, sinceDateFilter, 
untilDateFilter);
+String project = projectId == null ? "IgniteTests24Java8" : projectId;
 
 Review comment:
   Missed authorization check.
   ```
   if (!prov.hasAccess(serverId))
   throw ServiceUnauthorizedException.noCreds(serverId);
   ```


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-03 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r85591
 
 

 ##
 File path: ignite-tc-helper-web/src/main/webapp/comparison.html
 ##
 @@ -173,6 +178,176 @@
 return parseFloat(string.substring(string.indexOf("-") + 2, 
string.lastIndexOf("-") - 1));
 }
 
+var ch_disp = function(id) {
+let el = document.getElementById(id);
+
+el.style.display = el.style.display == 'block' ? 'none' : 'block';
+}
+
+function printTests(num, result) {
+let obj = {};
+
+try {
+obj = JSON.parse(result);
+} catch (e) {
+showErrInLoadStatus
 
 Review comment:
   String do nothing. This is not a method call.


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-03 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r89864
 
 

 ##
 File path: ignite-tc-helper-web/src/main/webapp/comparison.html
 ##
 @@ -173,6 +178,176 @@
 return parseFloat(string.substring(string.indexOf("-") + 2, 
string.lastIndexOf("-") - 1));
 }
 
+var ch_disp = function(id) {
+let el = document.getElementById(id);
+
+el.style.display = el.style.display == 'block' ? 'none' : 'block';
+}
+
+function printTests(num, result) {
+let obj = {};
+
+try {
+obj = JSON.parse(result);
+} catch (e) {
+showErrInLoadStatus
+
+return;
+}
+
+if (obj == null)
+return;
+
+let tests = getTests(obj, num);
+
+window.sessionStorage.setItem('tests' + num, tests);
+
+$('#MT' + num).html(tests);
+}
+
+function compareHandler() {
+var compareMode = window.sessionStorage.compareMode;
+
+var needTestsUpdate = window.sessionStorage.needTestsUpdate;
+
+if (needTestsUpdate == 'true') {
+let result1 = window.sessionStorage.result1;
+
+let result2 = window.sessionStorage.result2;
+
+if (result1 == null || result2 == null) {
+alert("Two columns should be loaded for compareMode!");
+
+return;
+}
+
+let obj1 = {};
+
+let obj2 = {};
+
+try {
+obj1 = JSON.parse(result1);
+
+obj2 = JSON.parse(result2);
+} catch (e) {
+showErrInLoadStatus
+}
+
+window.sessionStorage.uniqTests1 = getUniqueTests(obj1, obj2, 1);
+
+window.sessionStorage.uniqTests2 = getUniqueTests(obj2, obj1, 2);
+
+window.sessionStorage.needTestsUpdate = 'false';
+}
+
+if (compareMode == 'true') {
+$('#btt').html("CompareMode");
+
+$('#MT1').html(window.sessionStorage.tests1);
+
+$('#MT2').html(window.sessionStorage.tests2);
+
+window.sessionStorage.compareMode = 'false';
+} else {
+$('#btt').html("FullMode");
+
+$('#MT1').html(window.sessionStorage.uniqTests1);
+
+$('#MT2').html(window.sessionStorage.uniqTests2);
+
+window.sessionStorage.compareMode = 'true';
+}
+
+}
+
+function getUniqueTests(obj1, obj2, num) {
+let uniqObj = {};
+
+let suites = Object.keys(obj1);
+
+for (let suite of suites) {
+if (!obj2.hasOwnProperty(suite)) {
+uniqObj[suite] = obj1[suite];
+
+continue;
+}
+
+let tests = obj2[suite];
+
+let uniqTests = [];
+
+for (let v of obj1[suite])
+if (!tests.includes(v, 0))
+uniqTests.push(v);
+
+if (uniqTests.length != 0)
+uniqObj[suite] = uniqTests;
+}
+
+return getTests(uniqObj, num);
+}
+
+function getTests(obj, num) {
+let res = '';
+
+let suites = Object.keys(obj).sort();
+
+for (let suite of suites) {
+let suiteName = suite.split('_').filter((value, index) => index != 
0).join('_');
+
+res += '' + suiteName + '' + ' (' + obj[suite].length + 
')' +
+'\n' +
+'';
+
+for (let v of obj[suite].sort()) {
+let list = v.toString().split(".");
+
+if (list.length < 2)
+list = v.toString().split(":");
+
+let testName = list.pop();
+
+let testClass = list.pop();
+
+res += ''
++ testClass + '.' + testName + ' ' +
+'' +
+'' +
+''
+}
+
+res += '';
+}
+
+res += '';
+
+return res;
+}
+
+function getTestRef(testName) {
+let res = '';
+
+$.ajax(
+{
 
 Review comment:
   Move to previous line.


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-03 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r68058
 
 

 ##
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/IgniteTeamcityConnection.java
 ##
 @@ -42,12 +42,15 @@
 import org.apache.ignite.ci.tcmodel.result.issues.IssuesUsagesList;
 import org.apache.ignite.ci.tcmodel.result.problems.ProblemOccurrences;
 import org.apache.ignite.ci.tcmodel.result.stat.Statistics;
+import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrence;
 
 Review comment:
   Unused import.


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


[GitHub] SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add comparison of failed tests lists in two date intervals

2018-10-03 Thread GitBox
SomeFire commented on a change in pull request #25: IGNITE-9645 [TC Bot] Add 
comparison of failed tests lists in two date intervals
URL: https://github.com/apache/ignite-teamcity-bot/pull/25#discussion_r222308185
 
 

 ##
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
 ##
 @@ -46,16 +50,9 @@
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
-import java.util.ArrayList;
 import java.util.Collections;
-import java.util.List;
-import java.util.Date;
+import java.util.Optional;
 
 Review comment:
   Unused import.


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