You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by dp...@apache.org on 2019/05/29 17:44:46 UTC

[ignite-teamcity-bot] branch master updated: Removal of unused code

This is an automated email from the ASF dual-hosted git repository.

dpavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-teamcity-bot.git


The following commit(s) were added to refs/heads/master by this push:
     new 0bca9d2  Removal of unused code
0bca9d2 is described below

commit 0bca9d21e6aa647408759f070a83a2717d7a3bc2
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Wed May 29 20:44:39 2019 +0300

    Removal of unused code
---
 .../org/apache/ignite/ci/analysis/RunStat.java     | 448 ---------------------
 .../org/apache/ignite/ci/issue/EventTemplates.java |   8 +-
 .../ci/tcmodel/result/tests/TestOccurrence.java    |   8 -
 .../ignited/fatbuild/ProblemCompacted.java         |   2 +-
 .../teamcity/ignited/fatbuild/TestCompacted.java   |  71 +++-
 .../teamcity/ignited/runhist/InvocationData.java   |   9 +-
 .../teamcity/ignited/runhist/RunHistCompacted.java |   5 +-
 .../ci/teamcity/ignited/runhist/RunHistSync.java   |   1 +
 .../ci/teamcity/ignited/runhist/RunStatus.java     |  64 +++
 .../ignite/ci/issue/DetectingFailureTest.java      | 196 ---------
 .../ci/tcbot/chain/PrChainsProcessorTest.java      |   3 -
 11 files changed, 145 insertions(+), 670 deletions(-)

diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/RunStat.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/RunStat.java
deleted file mode 100644
index 5d388eb..0000000
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/analysis/RunStat.java
+++ /dev/null
@@ -1,448 +0,0 @@
-/*
- * 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.analysis;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import javax.annotation.Nullable;
-import org.apache.ignite.ci.issue.EventTemplate;
-import org.apache.ignite.ci.tcmodel.result.Build;
-import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrence;
-import org.apache.ignite.ci.teamcity.ignited.IRunHistory;
-import org.apache.ignite.ci.teamcity.ignited.runhist.ChangesState;
-import org.jetbrains.annotations.NotNull;
-
-import static org.apache.ignite.ci.analysis.RunStat.RunStatus.RES_CRITICAL_FAILURE;
-import static org.apache.ignite.ci.analysis.RunStat.RunStatus.RES_FAILURE;
-import static org.apache.ignite.ci.analysis.RunStat.RunStatus.RES_MUTED_FAILURE;
-import static org.apache.ignite.ci.analysis.RunStat.RunStatus.RES_OK;
-
-/**
- * Test or Build run statistics.
- */
-@Deprecated
-public class RunStat implements IRunHistory {
-    public static final int MAX_LATEST_RUNS = 100;
-
-    /**
-     * Runs registered all the times.
-     */
-    private int runs;
-
-    /**
-     * Failures registered all the times.
-     */
-    private int failures;
-
-    public long totalDurationMs;
-    public int runsWithDuration;
-
-    /**
-     * Name: Key in run stat cache
-     */
-    private String name;
-
-    @Nullable
-    SortedMap<TestId, RunInfo> latestRuns;
-
-    /**
-     * @param name Name of test or suite.
-     */
-    public RunStat(String name) {
-        this.name = name;
-    }
-
-    public void addTestRunToLatest(TestOccurrence testOccurrence, ChangesState changesState) {
-        TestId id = extractFullId(testOccurrence.getId());
-        if (id == null) {
-            System.err.println("Unable to parse TestOccurrence.id: " + id);
-
-            return;
-        }
-
-        addRunToLatest(id, new RunInfo(testToResCode(testOccurrence), changesState));
-    }
-
-    public static TestId extractFullId(String id) {
-        Integer buildId = extractIdPrefixed(id, "build:(id:", ")");
-
-        if (buildId == null)
-            return null;
-
-        Integer testId = extractIdPrefixed(id, "id:", ",");
-
-        if (testId == null)
-            return null;
-
-        return new TestId(buildId, testId);
-
-    }
-
-    public static Integer extractIdPrefixed(String id, String prefix, String postfix) {
-        try {
-            int buildIdIdx = id.indexOf(prefix);
-            if (buildIdIdx < 0)
-                return null;
-
-            int buildIdPrefixLen = prefix.length();
-            int absBuildIdx = buildIdIdx + buildIdPrefixLen;
-            int buildIdEndIdx = id.substring(absBuildIdx).indexOf(postfix);
-            if (buildIdEndIdx < 0)
-                return null;
-
-            String substring = id.substring(absBuildIdx, absBuildIdx + buildIdEndIdx);
-
-            return Integer.valueOf(substring);
-        }
-        catch (Exception ignored) {
-            return null;
-        }
-    }
-
-    private RunStatus testToResCode(TestOccurrence testOccurrence) {
-        if (!testOccurrence.isFailedTest())
-            return RES_OK;
-
-        return testOccurrence.isNotMutedOrIgnoredTest() ? RES_FAILURE : RES_MUTED_FAILURE;
-    }
-
-    private void addRunToLatest(TestId id, RunInfo runInfo) {
-        if (latestRuns == null)
-            latestRuns = new TreeMap<>();
-
-        latestRuns.put(id, runInfo);
-
-        if (latestRuns.size() > MAX_LATEST_RUNS)
-            latestRuns.remove(latestRuns.firstKey());
-    }
-
-    public String name() {
-        return name;
-    }
-
-    @Override public int getFailuresAllHist() {
-        return failures;
-    }
-
-    @Override public int getRunsAllHist() {
-        return runs;
-    }
-
-    @Override public int getFailuresCount() {
-        if (latestRuns == null)
-            return 0;
-
-        return (int)latestRuns.values().stream().filter(res -> res.status != RES_OK).count();
-    }
-
-    @Override public int getCriticalFailuresCount() {
-        if (latestRuns == null)
-            return 0;
-
-        return (int)latestRuns.values().stream().filter(res -> res.status == RES_CRITICAL_FAILURE).count();
-    }
-
-    @Override public int getRunsCount() {
-        return latestRuns == null ? 0 : latestRuns.size();
-    }
-
-    public long getAverageDurationMs() {
-        if (runsWithDuration == 0)
-            return 0;
-        return (long)(1.0 * totalDurationMs / runsWithDuration);
-    }
-
-    @Deprecated
-    public void addBuildRun(Build build) {
-        runs++;
-
-        if (!build.isSuccess())
-            failures++;
-
-        RunStatus resCode = build.isSuccess() ? RES_OK : RES_FAILURE;
-
-        setBuildResCode(build.getId(), new RunInfo(resCode, ChangesState.UNKNOWN));
-    }
-
-    private void setBuildResCode(Integer buildId, RunInfo runInfo) {
-        addRunToLatest(new TestId(buildId, 0), runInfo);
-    }
-
-    /**
-     * Sets build status as having critical failure
-     *
-     * @param buildId Build id.
-     */
-    public void setBuildCriticalError(Integer buildId) {
-        setBuildResCode(buildId, new RunInfo(RES_CRITICAL_FAILURE, ChangesState.UNKNOWN));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override public String toString() {
-        return "RunStat{" +
-            "name='" + name + '\'' +
-            ", failRate=" + getFailPercentPrintable() + "%" +
-            '}';
-    }
-
-    /**
-     * @return
-     */
-    @Nullable
-    @Override public List<Integer> getLatestRunResults() {
-        if (latestRuns == null)
-            return Collections.emptyList();
-
-        return latestRuns.values().stream().map(info -> info.status.code).collect(Collectors.toList());
-    }
-
-    private static int[] concatArr(int[] arr1, int[] arr2) {
-        int[] arr1and2 = new int[arr1.length + arr2.length];
-        System.arraycopy(arr1, 0, arr1and2, 0, arr1.length);
-        System.arraycopy(arr2, 0, arr1and2, arr1.length, arr2.length);
-
-        return arr1and2;
-    }
-
-    @Nullable
-    public Integer detectTemplate(EventTemplate t) {
-        if (latestRuns == null)
-            return null;
-
-        int centralEvtBuild = t.beforeEvent().length;
-
-        int[] template = concatArr(t.beforeEvent(), t.eventAndAfter());
-
-        assert centralEvtBuild < template.length;
-        assert centralEvtBuild >= 0;
-
-        Set<Map.Entry<TestId, RunInfo>> entries = latestRuns.entrySet();
-
-        if (entries.size() < template.length)
-            return null;
-
-        List<Map.Entry<TestId, RunInfo>> histAsArr = new ArrayList<>(entries);
-
-        TestId detectedAt = null;
-        if (t.shouldBeFirst()) {
-            if (histAsArr.size() >= runs) // skip if total runs can't fit to latest runs
-                detectedAt = checkTemplateAtPos(template, centralEvtBuild, histAsArr, 0);
-        }
-        else {
-            //startIgnite from the end to find most recent
-            for (int idx = histAsArr.size() - template.length; idx >= 0; idx--) {
-                detectedAt = checkTemplateAtPos(template, centralEvtBuild, histAsArr, idx);
-
-                if (detectedAt != null)
-                    break;
-            }
-        }
-
-        return detectedAt == null ? null : detectedAt.getBuildId();
-    }
-
-    @Nullable
-    private static TestId checkTemplateAtPos(int[] template, int centralEvtBuild,
-        List<Map.Entry<TestId, RunInfo>> histAsArr,
-        int idx) {
-        for (int tIdx = 0; tIdx < template.length; tIdx++) {
-            RunInfo curStatus = histAsArr.get(idx + tIdx).getValue();
-
-            if (curStatus == null)
-                break;
-
-            RunStatus tmpl = RunStatus.byCode(template[tIdx]);
-
-            if ((tmpl == RunStatus.RES_OK_OR_FAILURE && (curStatus.status == RES_OK || curStatus.status == RES_FAILURE))
-                || curStatus.status == tmpl) {
-                if (tIdx == template.length - 1)
-                    return histAsArr.get(idx + centralEvtBuild).getKey();
-            }
-            else
-                break;
-        }
-
-        return null;
-    }
-
-    public boolean isFlaky() {
-        return getFlakyComments() != null;
-    }
-
-    @Nullable
-    @Override public String getFlakyComments() {
-        if (latestRuns == null)
-            return null;
-
-        int statusChange = 0;
-
-        RunInfo prev = null;
-
-        for (RunInfo cur : latestRuns.values()) {
-            if (prev != null && cur != null) {
-                if (prev.status != cur.status
-                    && cur.changesState == ChangesState.NONE
-                    && prev.changesState != ChangesState.UNKNOWN)
-                    statusChange++;
-            }
-            prev = cur;
-        }
-
-        if (statusChange < 1)
-            return null;
-
-        return "Test seems to be flaky: " +
-            "changed its status [" + statusChange + "/" + latestRuns.size() + "] without code modifications";
-    }
-
-    /**
-     * Status of run.
-     */
-    public enum RunStatus {
-        /** Result: success. */
-        RES_OK(0),
-        /** Result: general failure of test or suite. */
-        RES_FAILURE(1),
-        /** RES OK or RES FAILURE */
-        RES_OK_OR_FAILURE(10),
-        /** Result of test execution, muted failure found. */
-        RES_MUTED_FAILURE(2),
-        /** Result of suite: Critical failure, no results. */
-        RES_CRITICAL_FAILURE(3);
-
-        /** Mapping of status int -> object. */
-        private static Map<Integer, RunStatus> holder = Stream.of(values()).collect(Collectors.toMap(RunStatus::getCode, i -> i));
-
-        /** Represent status in int. */
-        int code;
-
-        /** */
-        RunStatus(int code) {
-            this.code = code;
-        }
-
-        /**
-         * @return Status as int.
-         */
-        public int getCode() {
-            return code;
-        }
-
-        /**
-         * @param code Status as int.
-         * @return Status of build.
-         */
-        public static RunStatus byCode(int code) {
-            return holder.get(code);
-        }
-    }
-
-    /**
-     * Run info for storage in cache.
-     */
-    public static class RunInfo {
-        /** Status of run. */
-        RunStatus status;
-
-        /** State of changes for run. */
-        ChangesState changesState;
-
-        /**
-         *
-         */
-        public RunInfo(RunStatus status, ChangesState changesState) {
-            this.status = status;
-            this.changesState = changesState;
-        }
-    }
-
-    public static class TestId implements Comparable<TestId> {
-        int buildId;
-        int testId;
-
-        public TestId(Integer buildId, Integer testId) {
-            this.buildId = buildId;
-            this.testId = testId;
-        }
-
-        public int getBuildId() {
-            return buildId;
-        }
-
-        public int getTestId() {
-            return testId;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override public boolean equals(Object o) {
-            if (this == o)
-                return true;
-            if (o == null || getClass() != o.getClass())
-                return false;
-            TestId id = (TestId)o;
-            return buildId == id.buildId &&
-                testId == id.testId;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override public int hashCode() {
-            return Objects.hashCode(buildId, testId);
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override public int compareTo(@NotNull TestId o) {
-            int buildComp = buildId - o.buildId;
-            if (buildComp != 0)
-                return buildComp > 0 ? 1 : -1;
-
-            int testComp = testId - o.testId;
-            if (testComp != 0)
-                return testComp > 0 ? 1 : -1;
-
-            return 0;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override public String toString() {
-            return MoreObjects.toStringHelper(this)
-                .add("buildId", buildId)
-                .add("testId", testId)
-                .toString();
-        }
-    }
-
-}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/issue/EventTemplates.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/issue/EventTemplates.java
index 66fd0c6..49d4ece 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/issue/EventTemplates.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/issue/EventTemplates.java
@@ -20,10 +20,10 @@ package org.apache.ignite.ci.issue;
 import com.google.common.collect.Lists;
 import java.util.ArrayList;
 
-import static org.apache.ignite.ci.analysis.RunStat.RunStatus.RES_CRITICAL_FAILURE;
-import static org.apache.ignite.ci.analysis.RunStat.RunStatus.RES_FAILURE;
-import static org.apache.ignite.ci.analysis.RunStat.RunStatus.RES_OK;
-import static org.apache.ignite.ci.analysis.RunStat.RunStatus.RES_OK_OR_FAILURE;
+import static org.apache.ignite.ci.teamcity.ignited.runhist.RunStatus.RES_CRITICAL_FAILURE;
+import static org.apache.ignite.ci.teamcity.ignited.runhist.RunStatus.RES_FAILURE;
+import static org.apache.ignite.ci.teamcity.ignited.runhist.RunStatus.RES_OK;
+import static org.apache.ignite.ci.teamcity.ignited.runhist.RunStatus.RES_OK_OR_FAILURE;
 
 public class EventTemplates {
     private static final int OK = RES_OK.getCode();
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/result/tests/TestOccurrence.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/result/tests/TestOccurrence.java
index c3f092f..72cc174 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/result/tests/TestOccurrence.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/result/tests/TestOccurrence.java
@@ -20,7 +20,6 @@ package org.apache.ignite.ci.tcmodel.result.tests;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
-import org.apache.ignite.ci.analysis.RunStat;
 
 /**
  * Test occurrence. Can be provided by build as list of occurrences.
@@ -101,13 +100,6 @@ public class TestOccurrence {
         return this;
     }
 
-    /**
-     * @return BuildId which that test occurrence belongs to
-     */
-    public Integer getBuildId() {
-        return RunStat.extractIdPrefixed(id, "build:(id:", ")");
-    }
-
     public void id(String s) {
         id = s;
     }
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/ProblemCompacted.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/ProblemCompacted.java
index 247cf67..5ea9994 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/ProblemCompacted.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/ProblemCompacted.java
@@ -26,7 +26,7 @@ import org.apache.ignite.ci.teamcity.ignited.IStringCompactor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.ignite.ci.analysis.RunStat.extractIdPrefixed;
+import static org.apache.ignite.ci.teamcity.ignited.fatbuild.TestCompacted.extractIdPrefixed;
 
 /**
  *
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/TestCompacted.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/TestCompacted.java
index b0060ee..d1eb5e9 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/TestCompacted.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/fatbuild/TestCompacted.java
@@ -26,7 +26,6 @@ import java.util.BitSet;
 import java.util.Objects;
 import java.util.TreeMap;
 import java.util.function.BiPredicate;
-import org.apache.ignite.ci.analysis.RunStat;
 import org.apache.ignite.ci.tcbot.common.StringFieldCompacted;
 import org.apache.ignite.ci.tcmodel.hist.BuildRef;
 import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrence;
@@ -36,6 +35,7 @@ import org.apache.ignite.ci.teamcity.ignited.IStringCompactor;
 import org.apache.ignite.ci.teamcity.ignited.buildtype.ParametersCompacted;
 import org.apache.ignite.ci.teamcity.ignited.runhist.Invocation;
 import org.apache.ignite.ci.teamcity.ignited.runhist.InvocationData;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -91,7 +91,7 @@ public class TestCompacted {
         String testOccurrenceId = testOccurrence.getId();
         if (!Strings.isNullOrEmpty(testOccurrenceId)) {
             try {
-                final RunStat.TestId testId = RunStat.extractFullId(testOccurrenceId);
+                final TestId testId = extractFullId(testOccurrenceId);
                 if (testId != null)
                     idInBuild = testId.getTestId();
             } catch (Exception e) {
@@ -117,6 +117,42 @@ public class TestCompacted {
         setDetails(testOccurrence.details);
     }
 
+    public static TestId extractFullId(String id) {
+        Integer buildId = extractIdPrefixed(id, "build:(id:", ")");
+
+        if (buildId == null)
+            return null;
+
+        Integer testId = extractIdPrefixed(id, "id:", ",");
+
+        if (testId == null)
+            return null;
+
+        return new TestId(buildId, testId);
+
+    }
+
+    public static Integer extractIdPrefixed(String id, String prefix, String postfix) {
+        try {
+            int buildIdIdx = id.indexOf(prefix);
+            if (buildIdIdx < 0)
+                return null;
+
+            int buildIdPrefixLen = prefix.length();
+            int absBuildIdx = buildIdIdx + buildIdPrefixLen;
+            int buildIdEndIdx = id.substring(absBuildIdx).indexOf(postfix);
+            if (buildIdEndIdx < 0)
+                return null;
+
+            String substring = id.substring(absBuildIdx, absBuildIdx + buildIdEndIdx);
+
+            return Integer.valueOf(substring);
+        }
+        catch (Exception ignored) {
+            return null;
+        }
+    }
+
     private void setFlag(int off, Boolean val) {
         flags.clear(off, off + 2);
 
@@ -402,4 +438,35 @@ public class TestCompacted {
 
         return invocation.withParameters(importantParms);
     }
+
+    /**
+     * Pair of build and test Ids.
+     */
+    private static class TestId {
+        int buildId;
+        int testId;
+
+        public TestId(Integer buildId, Integer testId) {
+            this.buildId = buildId;
+            this.testId = testId;
+        }
+
+        public int getBuildId() {
+            return buildId;
+        }
+
+        public int getTestId() {
+            return testId;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override public String toString() {
+            return MoreObjects.toStringHelper(this)
+                .add("buildId", buildId)
+                .add("testId", testId)
+                .toString();
+        }
+    }
 }
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/InvocationData.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/InvocationData.java
index b6782c8..279aa9c 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/InvocationData.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/InvocationData.java
@@ -25,7 +25,6 @@ import java.util.Objects;
 import java.util.TreeMap;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
-import org.apache.ignite.ci.analysis.RunStat;
 import org.apache.ignite.ci.db.Persisted;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.jetbrains.annotations.NotNull;
@@ -38,13 +37,13 @@ public class InvocationData {
     /** Max days to keep test invocatoin data in run statistics: affects Bot Visa. */
     public static final int MAX_DAYS = 21;
     /** Muted. */
-    public static final int MUTED = RunStat.RunStatus.RES_MUTED_FAILURE.getCode();
+    public static final int MUTED = RunStatus.RES_MUTED_FAILURE.getCode();
     /** Failure. */
-    public static final int FAILURE = RunStat.RunStatus.RES_FAILURE.getCode();
+    public static final int FAILURE = RunStatus.RES_FAILURE.getCode();
     /** Ok. */
-    public static final int OK = RunStat.RunStatus.RES_OK.getCode();
+    public static final int OK = RunStatus.RES_OK.getCode();
     /** Ok. */
-    public static final int CRITICAL_FAILURE = RunStat.RunStatus.RES_CRITICAL_FAILURE.getCode();
+    public static final int CRITICAL_FAILURE = RunStatus.RES_CRITICAL_FAILURE.getCode();
 
     /**
      * Runs registered all the times.
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunHistCompacted.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunHistCompacted.java
index 73e7e21..32259b0 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunHistCompacted.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunHistCompacted.java
@@ -23,7 +23,6 @@ import java.util.Objects;
 import java.util.stream.Collectors;
 import javax.annotation.Nullable;
 import org.apache.ignite.ci.analysis.IVersionedEntity;
-import org.apache.ignite.ci.analysis.RunStat;
 import org.apache.ignite.ci.db.Persisted;
 import org.apache.ignite.ci.issue.EventTemplate;
 import org.apache.ignite.ci.teamcity.ignited.IRunHistory;
@@ -176,9 +175,9 @@ public class RunHistCompacted implements IVersionedEntity, IRunHistory {
             if (curStatus == null)
                 break;
 
-            RunStat.RunStatus tmpl = RunStat.RunStatus.byCode(template[tIdx]);
+            RunStatus tmpl = RunStatus.byCode(template[tIdx]);
 
-            if ((tmpl == RunStat.RunStatus.RES_OK_OR_FAILURE && (curStatus.status() == InvocationData.OK || curStatus.status() == InvocationData.FAILURE))
+            if ((tmpl == RunStatus.RES_OK_OR_FAILURE && (curStatus.status() == InvocationData.OK || curStatus.status() == InvocationData.FAILURE))
                 || curStatus.status() == tmpl.getCode()) {
                 if (tIdx == template.length - 1)
                     return histAsArr.get(idx + centralEvtBuild).buildId();
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunHistSync.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunHistSync.java
index f733b9a..2c62389 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunHistSync.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunHistSync.java
@@ -75,6 +75,7 @@ public class RunHistSync {
     /** Build DAO. */
     @Inject private FatBuildDao fatBuildDao;
 
+    /** Config. */
     @Inject private ITcBotConfig cfg;
 
     /** Build to save to history. */
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunStatus.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunStatus.java
new file mode 100644
index 0000000..ca1815d
--- /dev/null
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/runhist/RunStatus.java
@@ -0,0 +1,64 @@
+/*
+ * 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.teamcity.ignited.runhist;
+
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * Status of run: Generalized result of execution of Suite/Test.
+ */
+public enum RunStatus {
+    /** Result: success. */
+    RES_OK(0),
+    /** Result: general failure of test or suite. */
+    RES_FAILURE(1),
+    /** RES OK or RES FAILURE */
+    RES_OK_OR_FAILURE(10),
+    /** Result of test execution, muted failure found. */
+    RES_MUTED_FAILURE(2),
+    /** Result of suite: Critical failure, no results. */
+    RES_CRITICAL_FAILURE(3);
+
+    /** Mapping of status int -> object. */
+    private static Map<Integer, RunStatus> holder = Stream.of(values()).collect(Collectors.toMap(RunStatus::getCode, i -> i));
+
+    /** Represent status in int. */
+    int code;
+
+    /** */
+    RunStatus(int code) {
+        this.code = code;
+    }
+
+    /**
+     * @return Status as int.
+     */
+    public int getCode() {
+        return code;
+    }
+
+    /**
+     * @param code Status as int.
+     * @return Status of build.
+     */
+    public static RunStatus byCode(int code) {
+        return holder.get(code);
+    }
+}
diff --git a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/issue/DetectingFailureTest.java b/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/issue/DetectingFailureTest.java
deleted file mode 100644
index 8797812..0000000
--- a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/issue/DetectingFailureTest.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * 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.issue;
-
-import org.apache.ignite.ci.teamcity.ignited.runhist.ChangesState;
-import org.apache.ignite.ci.analysis.RunStat;
-import org.apache.ignite.ci.tcmodel.result.Build;
-import org.apache.ignite.ci.tcmodel.result.tests.TestOccurrence;
-import org.jetbrains.annotations.NotNull;
-import org.junit.Test;
-
-import static org.apache.ignite.ci.teamcity.ignited.runhist.ChangesState.UNKNOWN;
-import static org.apache.ignite.ci.tcmodel.result.tests.TestOccurrence.STATUS_SUCCESS;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Issue detection test
- */
-public class DetectingFailureTest {
-    @Test
-    public void detectFirstFailure() {
-        RunStat stat = new RunStat("");
-
-        TestOccurrence occurrence = new TestOccurrence().setStatus(STATUS_SUCCESS);
-
-        for (int i = 0; i < 5; i++)
-            stat.addTestRunToLatest(occurrence.setId(fakeTestId(113 + i)), UNKNOWN);
-
-        occurrence.status = "FAILED";
-
-        int firstFailedBuildId = 150;
-
-        for (int i = 0; i < 5; i++)
-            stat.addTestRunToLatest(occurrence.setId(fakeTestId(firstFailedBuildId + i)), UNKNOWN);
-
-        Integer buildId = stat.detectTemplate(EventTemplates.newFailure);
-
-        assertNotNull(buildId);
-        assertEquals(firstFailedBuildId, buildId.intValue());
-
-        assertNull(stat.detectTemplate(EventTemplates.fixOfFailure));
-    }
-
-    /**
-     * @param buildId Build Id.
-     */
-    @NotNull private String fakeTestId(int buildId) {
-        return "id:10231,build:(id:" + buildId + ")";
-    }
-
-    @Test
-    public void detectSuiteFailure() {
-        RunStat stat = new RunStat("");
-
-        Build occurrence = new Build();
-
-        for (int i = 0; i < 5; i++) {
-            occurrence.setId(113 + i);
-            boolean ok = (int)(Math.random() * 1000) % 2 == 0;
-            occurrence.status = ok ? Build.STATUS_SUCCESS : "FAILURE";
-
-            stat.addBuildRun(occurrence);
-        }
-
-        int firstFailedBuildId = 150;
-
-        occurrence.status = "FAILED";
-        for (int i = 0; i < 4; i++)
-            stat.setBuildCriticalError(firstFailedBuildId + i);
-
-        Integer buildId = stat.detectTemplate(EventTemplates.newCriticalFailure);
-
-        System.out.println(stat.getLatestRunResults());
-        assertNotNull(buildId);
-        assertEquals(firstFailedBuildId, buildId.intValue());
-    }
-
-    @Test
-    public void detectFlakyTest() {
-        RunStat stat = new RunStat("");
-
-        TestOccurrence occurrence = new TestOccurrence().setStatus(STATUS_SUCCESS);
-
-        final int[] ints = {
-            0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0,
-            1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0};
-
-        for (int i = 0; i < 50; i++) {
-            occurrence.status = ints[i] == 0 ? Build.STATUS_SUCCESS : "FAILURE";
-
-            stat.addTestRunToLatest(occurrence.setId(fakeTestId(100 + i)), ChangesState.NONE);
-        }
-
-        occurrence.status = "FAILED";
-
-        int firstFailedBuildId = 150;
-        for (int i = 0; i < 4; i++)
-            stat.addTestRunToLatest(occurrence.setId(fakeTestId(firstFailedBuildId + i)), UNKNOWN);
-
-        assertTrue(stat.isFlaky());
-
-        System.out.println(stat.getLatestRunResults());
-        Integer buildId = stat.detectTemplate(EventTemplates.newFailure);
-        assertNotNull(buildId);
-        assertEquals(firstFailedBuildId, buildId.intValue());
-    }
-
-    @Test
-    public void detectNewContributedTestFailure() {
-        RunStat statWithHist = new RunStat("");
-
-        TestOccurrence occurrence = new TestOccurrence().setStatus(STATUS_SUCCESS);
-
-        final int[] results = {0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0};
-
-        for (int i = 0; i < results.length; i++) {
-            statWithHist.addTestRunToLatest(occurrence
-                .setStatus(results[i] == 0 ? Build.STATUS_SUCCESS : "FAILURE")
-                .setId(fakeTestId(100 + i)), UNKNOWN);
-        }
-
-        occurrence.setStatus("FAILED");
-
-        int firstFailedBuildId = 150;
-        for (int i = 0; i < 15; i++)
-            statWithHist.addTestRunToLatest(occurrence.setId(fakeTestId(firstFailedBuildId + i)), UNKNOWN);
-
-        assertNull(statWithHist.detectTemplate(EventTemplates.newContributedTestFailure));
-
-        RunStat contributedTestStat = new RunStat("");
-        for (int i = 0; i < 5; i++)
-            contributedTestStat.addTestRunToLatest(occurrence.setId(fakeTestId(firstFailedBuildId + i)), UNKNOWN);
-
-        Integer buildId = contributedTestStat.detectTemplate(EventTemplates.newContributedTestFailure);
-        assertNotNull(buildId);
-        assertEquals(firstFailedBuildId, buildId.intValue());
-    }
-
-    @Test
-    public void detectSuiteFailureIsOnlyOnce() {
-        RunStat stat = new RunStat("");
-
-        Build occurrence = new Build();
-
-        int startBuildId = 113;
-        int okOrFailedBuildsCnt = 5;
-        for (int i = 0; i < okOrFailedBuildsCnt; i++) {
-            occurrence.setId(startBuildId + i);
-            boolean ok = (int)(Math.random() * 1000) % 2 == 0;
-            occurrence.status = ok ? Build.STATUS_SUCCESS : "FAILURE";
-
-            stat.addBuildRun(occurrence);
-        }
-
-        int firstFailedBuildId = startBuildId + okOrFailedBuildsCnt;
-
-        int timedOutBuildCnt = 4;
-        for (int i = 0; i < timedOutBuildCnt; i++)
-            stat.setBuildCriticalError(firstFailedBuildId + i);
-
-        Integer buildId = stat.detectTemplate(EventTemplates.newCriticalFailure);
-
-        assertNotNull(buildId);
-        assertEquals(firstFailedBuildId, buildId.intValue());
-
-        for (int i = 0; i < 4; i++)
-            stat.setBuildCriticalError(timedOutBuildCnt + firstFailedBuildId + i);
-
-        Integer buildId2 = stat.detectTemplate(EventTemplates.newCriticalFailure);
-
-        System.out.println(stat.getLatestRunResults());
-        System.out.println(buildId);
-        System.out.println(buildId2);
-
-        assertEquals(buildId, buildId2);
-
-    }
-}
\ No newline at end of file
diff --git a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/tcbot/chain/PrChainsProcessorTest.java b/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/tcbot/chain/PrChainsProcessorTest.java
index e4fd07c..898f34d 100644
--- a/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/tcbot/chain/PrChainsProcessorTest.java
+++ b/ignite-tc-helper-web/src/test/java/org/apache/ignite/ci/tcbot/chain/PrChainsProcessorTest.java
@@ -20,7 +20,6 @@ import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
 import com.google.inject.Guice;
 import com.google.inject.Injector;
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -29,7 +28,6 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.TimeUnit;
 import java.util.function.Predicate;
 import org.apache.ignite.ci.ITeamcity;
-import org.apache.ignite.ci.analysis.RunStat;
 import org.apache.ignite.ci.tcmodel.conf.BuildType;
 import org.apache.ignite.ci.tcmodel.hist.BuildRef;
 import org.apache.ignite.ci.tcmodel.result.Build;
@@ -49,7 +47,6 @@ import org.jetbrains.annotations.NotNull;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;