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 de03f99 Responsible persons were removed from code; DI refactoring proceed de03f99 is described below commit de03f99940ce5ba2ea267049031dc8ec4c6fb2ea Author: Dmitriy Pavlov <dpav...@apache.org> AuthorDate: Fri Sep 28 00:34:08 2018 +0300 Responsible persons were removed from code; DI refactoring proceed --- .../java/org/apache/ignite/ci/HelperConfig.java | 18 ------------- .../ignite/ci/chain/BuildChainProcessor.java | 5 ---- .../ci/chain/TrackedBranchChainsProcessor.java | 9 ++++--- .../org/apache/ignite/ci/issue/IssueDetector.java | 11 ++++---- .../ignite/ci/runners/GenerateStatusHtml.java | 30 +++++----------------- .../rest/tracked/GetTrackedBranchTestResults.java | 9 ++++--- 6 files changed, 23 insertions(+), 59 deletions(-) diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/HelperConfig.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/HelperConfig.java index 181afcb..67be102 100644 --- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/HelperConfig.java +++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/HelperConfig.java @@ -41,7 +41,6 @@ import static com.google.common.base.Strings.isNullOrEmpty; */ public class HelperConfig { public static final String CONFIG_FILE_NAME = "auth.properties"; - public static final String RESP_FILE_NAME = "resp.properties"; public static final String MAIL_PROPS = "mail.auth.properties"; public static final String HOST = "host"; public static final String USERNAME = "username"; @@ -207,23 +206,6 @@ public class HelperConfig { } } - @Nullable public static Properties loadContactPersons(String tcName) { - try { - String respConf = prefixedWithServerName(tcName, RESP_FILE_NAME); - final File workDir = resolveWorkDir(); - final File file = new File(workDir, respConf); - - if(!file.exists()) - return null; - - return loadProps(file); - } - catch (IOException e) { - e.printStackTrace(); - return new Properties(); - } - } - public static Properties loadEmailSettings() { try { String respConf = prefixedWithServerName(null, MAIL_PROPS); diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/chain/BuildChainProcessor.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/chain/BuildChainProcessor.java index 7731099..65b6e6f 100644 --- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/chain/BuildChainProcessor.java +++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/chain/BuildChainProcessor.java @@ -52,11 +52,6 @@ public class BuildChainProcessor { /** Logger. */ private static final Logger logger = LoggerFactory.getLogger(BuildChainProcessor.class); - @Nullable private static Properties getContactPersonProperties(ITeamcity teamcity) { - return HelperConfig.loadContactPersons(teamcity.serverId()); - } - - /** * @param teamcity Teamcity. * @param entryPoints Builds. diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/chain/TrackedBranchChainsProcessor.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/chain/TrackedBranchChainsProcessor.java index 3a4147b..170b605 100644 --- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/chain/TrackedBranchChainsProcessor.java +++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/chain/TrackedBranchChainsProcessor.java @@ -21,10 +21,12 @@ import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; +import javax.inject.Inject; import javax.ws.rs.QueryParam; import org.apache.ignite.ci.HelperConfig; import org.apache.ignite.ci.IAnalyticsEnabledTeamcity; import org.apache.ignite.ci.ITcHelper; +import org.apache.ignite.ci.ITcServerProvider; import org.apache.ignite.ci.analysis.FullChainRunCtx; import org.apache.ignite.ci.analysis.mode.LatestRebuildMode; import org.apache.ignite.ci.analysis.mode.ProcessLogsMode; @@ -40,13 +42,14 @@ import org.jetbrains.annotations.Nullable; import static com.google.common.base.Strings.isNullOrEmpty; public class TrackedBranchChainsProcessor { + @Inject private ITcServerProvider srvProv; + //todo make it part of context, non static @NotNull - public static TestFailuresSummary getTrackedBranchTestFailures( + public TestFailuresSummary getTrackedBranchTestFailures( @Nullable @QueryParam("branch") String branch, @Nullable @QueryParam("checkAllLogs") Boolean checkAllLogs, int buildResMergeCnt, - ITcHelper helper, ICredentialsProv creds, @Nullable ExecutorService pool) { final TestFailuresSummary res = new TestFailuresSummary(); @@ -70,7 +73,7 @@ public class TrackedBranchChainsProcessor { chainStatus.baseBranchForTc = baseBranchTc; - IAnalyticsEnabledTeamcity teamcity = helper.server(srvId, creds); + IAnalyticsEnabledTeamcity teamcity = srvProv.server(srvId, creds); final List<BuildRef> builds = teamcity.getFinishedBuildsIncludeSnDepFailed( chainTracked.getSuiteIdMandatory(), diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/issue/IssueDetector.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/issue/IssueDetector.java index c2e507e..599c825 100644 --- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/issue/IssueDetector.java +++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/issue/IssueDetector.java @@ -84,6 +84,8 @@ public class IssueDetector { @Inject private Provider<CheckQueueJob> checkQueueJobProv; + @Inject private TrackedBranchChainsProcessor tbProc; + public IssueDetector() { } @@ -425,15 +427,14 @@ public class IssueDetector { ExecutorService executor = MoreExecutors.newDirectExecutorService(); - TrackedBranchChainsProcessor.getTrackedBranchTestFailures(FullQueryParams.DEFAULT_BRANCH_NAME, - false, buildsToQry, backgroundOpsTcHelper, backgroundOpsCreds, executor); + tbProc.getTrackedBranchTestFailures(FullQueryParams.DEFAULT_BRANCH_NAME, + false, buildsToQry, backgroundOpsCreds, executor); TestFailuresSummary failures = - TrackedBranchChainsProcessor.getTrackedBranchTestFailures(FullQueryParams.DEFAULT_BRANCH_NAME, + tbProc.getTrackedBranchTestFailures(FullQueryParams.DEFAULT_BRANCH_NAME, false, 1, - backgroundOpsTcHelper, - backgroundOpsCreds, + backgroundOpsCreds, executor); registerIssuesLater(failures, backgroundOpsTcHelper, backgroundOpsCreds); diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/GenerateStatusHtml.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/GenerateStatusHtml.java index 116c948..1e23d51 100644 --- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/GenerateStatusHtml.java +++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/GenerateStatusHtml.java @@ -97,9 +97,8 @@ public class GenerateStatusHtml { } public static void generate(Writer writer) throws Exception { - boolean groupByResponsible = true; - boolean includeTabAll = groupByResponsible && true; - final String verComments = "Version 10. Responsibilities loaded from config"; + boolean groupByResponsible = false; + final String verComments = "Version 11. Responsibilities removed"; final List<Branch> branchesPriv = Lists.newArrayList( new Branch("", "<default>", "master"), //new Branch("ignite-2.1.4", "ignite-2.1.4", "ignite-2.1.4"), @@ -122,23 +121,6 @@ public class GenerateStatusHtml { final String projectId = "Ignite20Tests"; ProjectStatus pubStatus = getBuildStatuses(pubTcId, projectId, branchesPub); - TreeSet<String> respPersons; - Properties privResp; - Properties pubResp; - if (groupByResponsible) { - privResp = HelperConfig.loadContactPersons(tcPrivId); - pubResp = HelperConfig.loadContactPersons(pubTcId); - - respPersons = allRespPersons(privResp, pubResp); - System.err.println(respPersons); - } - else { - respPersons = Sets.newTreeSet(); - respPersons.add("all"); - pubResp = null; - privResp = null; - } - line(writer, "<html>"); header(writer, groupByResponsible); line(writer, "<body>"); @@ -146,7 +128,7 @@ public class GenerateStatusHtml { HtmlBuilder builder = new HtmlBuilder(writer); String tabAllId = "all"; - Iterable<String> tabs = includeTabAll ? Iterables.concat(Lists.newArrayList(tabAllId), respPersons) : respPersons; + Iterable<String> tabs = Lists.newArrayList(tabAllId) ; if (groupByResponsible) { builder.line("<div id=\"tabs\">"); @@ -163,13 +145,13 @@ public class GenerateStatusHtml { builder.line("<div id='" + getDivId(curResponsiblePerson) + "'>"); builder.line("Private TC status"); - boolean includeAll = !groupByResponsible || (isFirst & includeTabAll); + writeBuildsTable(branchesPriv, privStatuses, builder, - buildId -> includeAll || isPropertyValueEquals(privResp, buildId, curResponsiblePerson)); + buildId -> true); builder.line("<br><br>Public TC status"); writeBuildsTable(branchesPub, pubStatus, builder, - buildId -> includeAll || isPropertyValueEquals(pubResp, buildId, curResponsiblePerson)); + buildId -> true); builder.line("</div>"); diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/tracked/GetTrackedBranchTestResults.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/tracked/GetTrackedBranchTestResults.java index 69332ac..af5de5e 100644 --- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/tracked/GetTrackedBranchTestResults.java +++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/tracked/GetTrackedBranchTestResults.java @@ -89,10 +89,11 @@ public class GetTrackedBranchTestResults { @Nullable @QueryParam("branch") String branch, @Nullable @QueryParam("checkAllLogs") Boolean checkAllLogs) { - final ITcHelper helper = CtxListener.getTcHelper(ctx); final ICredentialsProv creds = ICredentialsProv.get(request); - return TrackedBranchChainsProcessor.getTrackedBranchTestFailures(branch, checkAllLogs, 1, helper, creds, + final TrackedBranchChainsProcessor tbProc = CtxListener.getInjector(ctx).getInstance(TrackedBranchChainsProcessor.class); + + return tbProc.getTrackedBranchTestFailures(branch, checkAllLogs, 1, creds, CtxListener.getPool(ctx)); } @@ -132,10 +133,10 @@ public class GetTrackedBranchTestResults { public TestFailuresSummary getAllTestFailsNoCache(@Nullable @QueryParam("branch") String branchOpt, @QueryParam("count") Integer cnt, @Nullable @QueryParam("checkAllLogs") Boolean checkAllLogs) { - final ITcHelper helper = CtxListener.getTcHelper(ctx); final ICredentialsProv creds = ICredentialsProv.get(request); int cntLimit = cnt == null ? FullQueryParams.DEFAULT_COUNT : cnt; + final TrackedBranchChainsProcessor tbProc = CtxListener.getInjector(ctx).getInstance(TrackedBranchChainsProcessor.class); - return TrackedBranchChainsProcessor.getTrackedBranchTestFailures(branchOpt, checkAllLogs, cntLimit, helper, creds, CtxListener.getPool(ctx)); + return tbProc.getTrackedBranchTestFailures(branchOpt, checkAllLogs, cntLimit, creds, CtxListener.getPool(ctx)); } }