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 2018/09/28 16:27:28 UTC
[ignite-teamcity-bot] 02/02: DI refactoring: pool completely moved
from Web CTX to Guice CTX
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
commit 458914469d9052340841ac0465b20f56c77f8ece
Author: Dmitriy Pavlov <dp...@apache.org>
AuthorDate: Fri Sep 28 19:27:18 2018 +0300
DI refactoring: pool completely moved from Web CTX to Guice CTX
---
.../main/java/org/apache/ignite/ci/TcHelper.java | 27 +++++++--------------
.../ignite/ci/chain/BuildChainProcessor.java | 25 +++++++++++--------
.../apache/ignite/ci/chain/PrChainsProcessor.java | 22 ++++++++---------
.../ci/chain/TrackedBranchChainsProcessor.java | 22 ++++++++++-------
.../org/apache/ignite/ci/di/IgniteTcBotModule.java | 3 ++-
.../org/apache/ignite/ci/issue/IssueDetector.java | 14 ++++-------
.../java/org/apache/ignite/ci/web/CtxListener.java | 10 ++------
.../org/apache/ignite/ci/web/TcUpdatePool.java | 3 +++
.../ignite/ci/web/rest/GetChainResultsAsHtml.java | 7 +++---
.../org/apache/ignite/ci/web/rest/Metrics.java | 4 ++--
.../ci/web/rest/build/GetBuildTestFailures.java | 2 +-
.../ignite/ci/web/rest/login/UserService.java | 28 +++++++++++-----------
.../ignite/ci/web/rest/pr/GetPrTestFailures.java | 4 ++--
.../rest/tracked/GetTrackedBranchTestResults.java | 7 +++---
14 files changed, 84 insertions(+), 94 deletions(-)
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/TcHelper.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/TcHelper.java
index 108502e..8573a99 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/TcHelper.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/TcHelper.java
@@ -53,8 +53,6 @@ public class TcHelper implements ITcHelper, IJiraIntegration {
/** Stop guard. */
private AtomicBoolean stop = new AtomicBoolean();
- @Inject private TcUpdatePool tcUpdatePool;
-
@Inject private IssuesStorage issuesStorage;
@Inject private ITcServerProvider serverProvider;
@@ -132,8 +130,7 @@ public class TcHelper implements ITcHelper, IJiraIntegration {
String comment;
try {
- comment = generateJiraComment(buildTypeId, build.branchName, srvId, prov, build.webUrl,
- getService());
+ comment = generateJiraComment(buildTypeId, build.branchName, srvId, prov, build.webUrl);
}
catch (RuntimeException e) {
logger.error("Exception happened during generating comment for JIRA " +
@@ -151,21 +148,19 @@ public class TcHelper implements ITcHelper, IJiraIntegration {
* @param srvId Server id.
* @param prov Credentials.
* @param webUrl Build URL.
- * @param executorSvc Executor service to process TC communication requests there.
* @return Comment, which should be sent to the JIRA ticket.
*/
private String generateJiraComment(
- String buildTypeId,
- String branchForTc,
- String srvId,
- ICredentialsProv prov,
- String webUrl,
- @Nullable ExecutorService executorSvc
+ String buildTypeId,
+ String branchForTc,
+ String srvId,
+ ICredentialsProv prov,
+ String webUrl
) {
StringBuilder res = new StringBuilder();
TestFailuresSummary summary = prChainsProcessor.getTestFailuresSummary(
prov, srvId, buildTypeId, branchForTc,
- "Latest", null, null, executorSvc);
+ "Latest", null, null);
if (summary != null) {
for (ChainAtServerCurrentStatus server : summary.servers) {
@@ -277,14 +272,8 @@ public class TcHelper implements ITcHelper, IJiraIntegration {
}
public void close() {
- if (stop.compareAndSet(false, true)) {
- tcUpdatePool.stop();
-
+ if (stop.compareAndSet(false, true))
detector.stop();
- }
}
- public ExecutorService getService() {
- return tcUpdatePool.getService();
- }
}
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 b32a515..64b70de 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
@@ -23,12 +23,13 @@ import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.concurrent.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-
-import com.google.common.util.concurrent.MoreExecutors;
+import javax.inject.Inject;
import org.apache.ignite.ci.IAnalyticsEnabledTeamcity;
import org.apache.ignite.ci.ITeamcity;
import org.apache.ignite.ci.analysis.FullChainRunCtx;
@@ -42,15 +43,21 @@ import org.apache.ignite.ci.di.AutoProfiling;
import org.apache.ignite.ci.tcmodel.hist.BuildRef;
import org.apache.ignite.ci.tcmodel.result.Build;
import org.apache.ignite.ci.util.FutureUtil;
+import org.apache.ignite.ci.web.TcUpdatePool;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Process whole Build Chain, E.g. runAll at particular server, including all builds involved
+ */
public class BuildChainProcessor {
/** Logger. */
private static final Logger logger = LoggerFactory.getLogger(BuildChainProcessor.class);
+ /** TC REST updates pool. */
+ @Inject private TcUpdatePool tcUpdatePool;
/**
* @param teamcity Teamcity.
@@ -59,7 +66,6 @@ public class BuildChainProcessor {
* @param procLog Process logger.
* @param includeScheduledInfo Include scheduled info.
* @param failRateBranch Fail rate branch.
- * @param executor Executor .
*/
@AutoProfiling
public FullChainRunCtx loadFullChainContext(
@@ -68,10 +74,7 @@ public class BuildChainProcessor {
LatestRebuildMode includeLatestRebuild,
ProcessLogsMode procLog,
boolean includeScheduledInfo,
- @Nullable String failRateBranch,
- @Nullable ExecutorService executor) {
-
- ExecutorService executorToUse = executor == null ? MoreExecutors.newDirectExecutorService() : executor;
+ @Nullable String failRateBranch) {
if (entryPoints.isEmpty())
return new FullChainRunCtx(Build.createFakeStub());
@@ -91,14 +94,16 @@ public class BuildChainProcessor {
.filter(ref -> ensureUnique(unique, ref))
;
+ final ExecutorService svc = tcUpdatePool.getService();
+
final List<Future<Stream<BuildRef>>> phase1Submitted = uniqueBuldsInvolved
- .map((buildRef) -> executorToUse.submit(
+ .map((buildRef) -> svc.submit(
() -> replaceWithRecent(teamcity, includeLatestRebuild, unique, buildRef, entryPoints.size())))
.collect(Collectors.toList());
final List<Future<? extends Stream<? extends BuildRef>>> phase2Submitted = phase1Submitted.stream()
.map(FutureUtil::getResult)
- .map((s) -> executorToUse.submit(
+ .map((s) -> svc.submit(
() -> processBuildList(teamcity, buildsCtxMap, s)))
.collect(Collectors.toList());
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/chain/PrChainsProcessor.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/chain/PrChainsProcessor.java
index eb99aae..3650327 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/chain/PrChainsProcessor.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/chain/PrChainsProcessor.java
@@ -35,10 +35,12 @@ import javax.inject.Inject;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
-import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
+/**
+ * Process pull request/untracked branch chain at particular server.
+ */
public class PrChainsProcessor {
/** Build chain processor. */
@Inject BuildChainProcessor buildChainProcessor;
@@ -54,19 +56,17 @@ public class PrChainsProcessor {
* @param act Action.
* @param cnt Count.
* @param baseBranchForTc Base branch name in TC identification.
- * @param executorSvc Executor service to process TC communication requests there.
* @return Test failures summary.
*/
@AutoProfiling
public TestFailuresSummary getTestFailuresSummary(
- ICredentialsProv creds,
- String srvId,
- String suiteId,
- String branchForTc,
- String act,
- Integer cnt,
- @Nullable String baseBranchForTc,
- @Nullable ExecutorService executorSvc) {
+ ICredentialsProv creds,
+ String srvId,
+ String suiteId,
+ String branchForTc,
+ String act,
+ Integer cnt,
+ @Nullable String baseBranchForTc) {
final TestFailuresSummary res = new TestFailuresSummary();
final AtomicInteger runningUpdates = new AtomicInteger();
@@ -111,7 +111,7 @@ public class PrChainsProcessor {
final FullChainRunCtx val = buildChainProcessor.loadFullChainContext(teamcity, chains,
rebuild,
logs, singleBuild,
- baseBranch, executorSvc);
+ baseBranch);
Optional<FullChainRunCtx> pubCtx = Optional.of(val);
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 30421f1..f5bcfb0 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
@@ -18,7 +18,6 @@ package org.apache.ignite.ci.chain;
import java.util.Comparator;
import java.util.List;
-import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import javax.inject.Inject;
@@ -33,6 +32,7 @@ import org.apache.ignite.ci.conf.BranchTracked;
import org.apache.ignite.ci.di.AutoProfiling;
import org.apache.ignite.ci.tcmodel.hist.BuildRef;
import org.apache.ignite.ci.user.ICredentialsProv;
+import org.apache.ignite.ci.web.TcUpdatePool;
import org.apache.ignite.ci.web.model.current.ChainAtServerCurrentStatus;
import org.apache.ignite.ci.web.model.current.TestFailuresSummary;
import org.apache.ignite.ci.web.rest.parms.FullQueryParams;
@@ -46,14 +46,15 @@ public class TrackedBranchChainsProcessor {
@Inject private BuildChainProcessor chainProc;
+ @Inject private TcUpdatePool tcUpdatePool;
+
@AutoProfiling
@NotNull
public TestFailuresSummary getTrackedBranchTestFailures(
- @Nullable @QueryParam("branch") String branch,
- @Nullable @QueryParam("checkAllLogs") Boolean checkAllLogs,
- int buildResMergeCnt,
- ICredentialsProv creds,
- @Nullable ExecutorService pool) {
+ @Nullable @QueryParam("branch") String branch,
+ @Nullable @QueryParam("checkAllLogs") Boolean checkAllLogs,
+ int buildResMergeCnt,
+ ICredentialsProv creds) {
final TestFailuresSummary res = new TestFailuresSummary();
final AtomicInteger runningUpdates = new AtomicInteger();
@@ -97,10 +98,13 @@ public class TrackedBranchChainsProcessor {
boolean includeScheduled = buildResMergeCnt == 1;
- final FullChainRunCtx ctx = chainProc.loadFullChainContext(teamcity, chains,
+ final FullChainRunCtx ctx = chainProc.loadFullChainContext(teamcity,
+ chains,
rebuild,
- logs, includeScheduled,
- baseBranchTc, pool);
+ logs,
+ includeScheduled,
+ baseBranchTc
+ );
int cnt = (int)ctx.getRunningUpdates().count();
if (cnt > 0)
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/IgniteTcBotModule.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/IgniteTcBotModule.java
index 3bf34de..442301c 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/IgniteTcBotModule.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/di/IgniteTcBotModule.java
@@ -25,6 +25,7 @@ import com.google.inject.matcher.Matchers;
import org.apache.ignite.Ignite;
import org.apache.ignite.ci.*;
import org.apache.ignite.ci.db.Ignite1Init;
+import org.apache.ignite.ci.issue.IssueDetector;
import org.apache.ignite.ci.jira.IJiraIntegration;
import org.apache.ignite.ci.observer.BuildObserver;
import org.apache.ignite.ci.observer.ObserverTask;
@@ -67,7 +68,7 @@ public class IgniteTcBotModule extends AbstractModule {
bind(ITcServerFactory.class).to(InitializingServerFactory.class).in(new SingletonScope());
bind(ITcServerProvider.class).to(TcServerCachingProvider.class).in(new SingletonScope());
bind(TcUpdatePool.class).in(new SingletonScope());
- //todo bind(IssueDetector.clas)
+ bind(IssueDetector.class).in(new SingletonScope());
bind(ObserverTask.class).in(new SingletonScope());
bind(BuildObserver.class).in(new SingletonScope());
bind(ITcHelper.class).to(TcHelper.class).in(new SingletonScope());
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 b2b9f69..577e254 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
@@ -32,7 +32,6 @@ import javax.cache.Cache;
import javax.inject.Inject;
import javax.inject.Provider;
-import com.google.common.util.concurrent.MoreExecutors;
import org.apache.ignite.ci.HelperConfig;
import org.apache.ignite.ci.IAnalyticsEnabledTeamcity;
import org.apache.ignite.ci.ITcHelper;
@@ -384,7 +383,7 @@ public class IssueDetector {
this.backgroundOpsCreds = prov;
this.backgroundOpsTcHelper = helper;
- executorService = Executors.newScheduledThreadPool(1);
+ executorService = Executors.newScheduledThreadPool(3);
executorService.scheduleAtFixedRate(this::checkFailures, 0, 15, TimeUnit.MINUTES);
@@ -392,8 +391,7 @@ public class IssueDetector {
checkQueueJob.init(backgroundOpsTcHelper, backgroundOpsCreds);
- executorService.scheduleAtFixedRate(
- checkQueueJob, 0, 10, TimeUnit.MINUTES);
+ executorService.scheduleAtFixedRate(checkQueueJob, 0, 10, TimeUnit.MINUTES);
}
}
@@ -437,17 +435,15 @@ public class IssueDetector {
protected String checkFailuresEx(String brachName) {
int buildsToQry = EventTemplates.templates.stream().mapToInt(EventTemplate::cntEvents).max().getAsInt();
- ExecutorService executor = MoreExecutors.newDirectExecutorService();
-
tbProc.getTrackedBranchTestFailures(brachName,
- false, buildsToQry, backgroundOpsCreds, executor);
+ false, buildsToQry, backgroundOpsCreds);
TestFailuresSummary failures =
tbProc.getTrackedBranchTestFailures(brachName,
false,
1,
- backgroundOpsCreds,
- executor);
+ backgroundOpsCreds
+ );
registerIssuesAndNotifyLater(failures, backgroundOpsTcHelper, backgroundOpsCreds);
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/CtxListener.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/CtxListener.java
index db1bd75..fa60de9 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/CtxListener.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/CtxListener.java
@@ -48,8 +48,6 @@ public class CtxListener implements ServletContextListener {
public static final String INJECTOR = "injector";
- private static final String POOL = "pool";
-
public static Ignite getIgnite(ServletContext ctx) {
return getInjector(ctx).getInstance(Ignite.class);
}
@@ -87,18 +85,13 @@ public class CtxListener implements ServletContextListener {
ctx.setAttribute(INJECTOR, injector);
- final TcHelper tcHelper = injector.getInstance(TcHelper.class);
+ final ITcHelper tcHelper = injector.getInstance(TcHelper.class);
BackgroundUpdater backgroundUpdater = new BackgroundUpdater(tcHelper);
ctx.setAttribute(UPDATER, backgroundUpdater);
ctx.setAttribute(TC_HELPER, tcHelper);
- ctx.setAttribute(POOL, tcHelper.getService());
- }
-
- public static ExecutorService getPool(ServletContext context) {
- return (ExecutorService)context.getAttribute(POOL);
}
@Override public void contextDestroyed(ServletContextEvent sctxEvt) {
@@ -118,6 +111,7 @@ public class CtxListener implements ServletContextListener {
helper.close();
try {
+ injector.getInstance(TcUpdatePool.class).stop();
injector.getInstance(BuildObserver.class).stop();
}
catch (Exception e) {
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/TcUpdatePool.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/TcUpdatePool.java
index 3622f29..58a5ee3 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/TcUpdatePool.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/TcUpdatePool.java
@@ -37,6 +37,9 @@ public class TcUpdatePool {
});
+ /**
+ * @return Executor service to process TC communication requests there.
+ */
public ExecutorService getService() {
return service;
}
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/GetChainResultsAsHtml.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/GetChainResultsAsHtml.java
index 9e4d950..ca9cf56 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/GetChainResultsAsHtml.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/GetChainResultsAsHtml.java
@@ -28,7 +28,6 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
-import com.google.common.util.concurrent.MoreExecutors;
import com.google.inject.Injector;
import org.apache.ignite.ci.chain.BuildChainProcessor;
import org.apache.ignite.ci.IAnalyticsEnabledTeamcity;
@@ -75,9 +74,9 @@ public class GetChainResultsAsHtml {
IAnalyticsEnabledTeamcity teamcity = CtxListener.server(srvId, ctx, req);
final FullChainRunCtx ctx = buildChainProcessor.loadFullChainContext(teamcity, Collections.singletonList(build),
- LatestRebuildMode.NONE,
- ProcessLogsMode.SUITE_NOT_COMPLETE, false,
- failRateBranch, MoreExecutors.newDirectExecutorService());
+ LatestRebuildMode.NONE,
+ ProcessLogsMode.SUITE_NOT_COMPLETE, false,
+ failRateBranch);
ChainAtServerCurrentStatus status = new ChainAtServerCurrentStatus(teamcity.serverId(), ctx.branchName());
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/Metrics.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/Metrics.java
index f4e17a2..d1ab1d2 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/Metrics.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/Metrics.java
@@ -17,7 +17,6 @@
package org.apache.ignite.ci.web.rest;
-import com.google.common.util.concurrent.MoreExecutors;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -92,7 +91,8 @@ public class Metrics {
singletonList(next),
LatestRebuildMode.NONE,
ProcessLogsMode.DISABLED, false,
- ITeamcity.DEFAULT, MoreExecutors.newDirectExecutorService());
+ ITeamcity.DEFAULT);
+
if (ctx == null)
return null;
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
index 45b56b5..e80a73f 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/build/GetBuildTestFailures.java
@@ -139,7 +139,7 @@ public class GetBuildTestFailures {
final FullChainRunCtx ctx = buildChainProcessor.loadFullChainContext(teamcity, Collections.singletonList(build),
LatestRebuildMode.NONE,
procLogs, false,
- failRateBranch, CtxListener.getPool(this.ctx));
+ failRateBranch);
final ChainAtServerCurrentStatus chainStatus = new ChainAtServerCurrentStatus(serverId, ctx.branchName());
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/login/UserService.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/login/UserService.java
index fbbdd17..76ed98b 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/login/UserService.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/login/UserService.java
@@ -54,20 +54,20 @@ public class UserService {
public static final String USER = "user";
@Context
- private ServletContext context;
+ private ServletContext ctx;
@Context
- private HttpServletRequest request;
+ private HttpServletRequest req;
@GET
@Path("currentUserName")
public SimpleResult currentUserName() {
- final ICredentialsProv prov = ICredentialsProv.get(request);
+ final ICredentialsProv prov = ICredentialsProv.get(req);
if (prov == null)
return new SimpleResult("");
- final ITcHelper helper = CtxListener.getTcHelper(context);
+ final ITcHelper helper = CtxListener.getTcHelper(ctx);
return userMenu(prov, helper);
}
@@ -86,9 +86,9 @@ public class UserService {
@POST
@Path("authorize")
public SimpleResult setAuthorizedState() {
- final ICredentialsProv prov = ICredentialsProv.get(request);
+ final ICredentialsProv prov = ICredentialsProv.get(req);
- final ITcHelper helper = CtxListener.getTcHelper(context);
+ final ITcHelper helper = CtxListener.getTcHelper(ctx);
IssueDetector detector = helper.issueDetector();
@@ -100,9 +100,9 @@ public class UserService {
@GET
@Path("get")
public TcHelperUserUi getUserData(@Nullable @QueryParam("login") final String loginParm) {
- final String currUserLogin = ICredentialsProv.get(request).getPrincipalId();
+ final String currUserLogin = ICredentialsProv.get(req).getPrincipalId();
final String login = Strings.isNullOrEmpty(loginParm) ? currUserLogin : loginParm;
- ITcHelper helper = CtxListener.getTcHelper(context);
+ ITcHelper helper = CtxListener.getTcHelper(ctx);
final TcHelperUser user = helper.users().getUser(login);
final TcHelperUserUi tcHelperUserUi = new TcHelperUserUi(user, helper.getTrackedBranchesIds());
@@ -128,11 +128,11 @@ public class UserService {
@POST
@Path("resetCredentials")
public SimpleResult resetCredentials(@Nullable @FormParam("login") final String loginParm) {
- final String currUserLogin = ICredentialsProv.get(request).getPrincipalId();
+ final String currUserLogin = ICredentialsProv.get(req).getPrincipalId();
final String login = Strings.isNullOrEmpty(loginParm) ? currUserLogin : loginParm;
//todo check admin
- final UserAndSessionsStorage users = CtxListener.getTcHelper(context).users();
+ final UserAndSessionsStorage users = CtxListener.getTcHelper(ctx).users();
final TcHelperUser user = users.getUser(login);
user.resetCredentials();
@@ -151,9 +151,9 @@ public class UserService {
Preconditions.checkState(!Strings.isNullOrEmpty(serviceLogin));
Preconditions.checkState(!Strings.isNullOrEmpty(servicePassword));
- final ICredentialsProv prov = ICredentialsProv.get(request);
+ final ICredentialsProv prov = ICredentialsProv.get(req);
final String currentUserLogin = prov.getPrincipalId();
- final UserAndSessionsStorage users = CtxListener.getTcHelper(context).users();
+ final UserAndSessionsStorage users = CtxListener.getTcHelper(ctx).users();
final TcHelperUser user = users.getUser(currentUserLogin);
//todo check service credentials first
@@ -184,10 +184,10 @@ public class UserService {
@Nullable @FormParam("fullName") final String fullName,
Form form) {
- final String currUserLogin = ICredentialsProv.get(request).getPrincipalId();
+ final String currUserLogin = ICredentialsProv.get(req).getPrincipalId();
final String login = currUserLogin; //todo check admin Strings.isNullOrEmpty(loginParm) ? currUserLogin : loginParm;
- final UserAndSessionsStorage users = CtxListener.getTcHelper(context).users();
+ final UserAndSessionsStorage users = CtxListener.getTcHelper(ctx).users();
final TcHelperUser user = users.getUser(login);
user.resetNotifications();
diff --git a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/pr/GetPrTestFailures.java b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/pr/GetPrTestFailures.java
index aff2a6b..902e86a 100644
--- a/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/pr/GetPrTestFailures.java
+++ b/ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/rest/pr/GetPrTestFailures.java
@@ -111,8 +111,8 @@ public class GetPrTestFailures {
final Injector injector = CtxListener.getInjector(ctx);
final PrChainsProcessor prChainsProcessor = injector.getInstance(PrChainsProcessor.class);
- return prChainsProcessor.getTestFailuresSummary(creds, srvId, suiteId, branchForTc, act, cnt, baseBranchForTc,
- CtxListener.getPool(ctx));
+ return prChainsProcessor.getTestFailuresSummary(creds, srvId, suiteId, branchForTc, act, cnt, baseBranchForTc
+ );
}
@POST
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 af5de5e..e4bd1ea 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
@@ -17,7 +17,6 @@
package org.apache.ignite.ci.web.rest.tracked;
-import org.apache.ignite.ci.ITcHelper;
import org.apache.ignite.ci.chain.TrackedBranchChainsProcessor;
import org.apache.ignite.ci.user.ICredentialsProv;
import org.apache.ignite.ci.web.BackgroundUpdater;
@@ -93,8 +92,8 @@ public class GetTrackedBranchTestResults {
final TrackedBranchChainsProcessor tbProc = CtxListener.getInjector(ctx).getInstance(TrackedBranchChainsProcessor.class);
- return tbProc.getTrackedBranchTestFailures(branch, checkAllLogs, 1, creds,
- CtxListener.getPool(ctx));
+ return tbProc.getTrackedBranchTestFailures(branch, checkAllLogs, 1, creds
+ );
}
@GET
@@ -137,6 +136,6 @@ public class GetTrackedBranchTestResults {
int cntLimit = cnt == null ? FullQueryParams.DEFAULT_COUNT : cnt;
final TrackedBranchChainsProcessor tbProc = CtxListener.getInjector(ctx).getInstance(TrackedBranchChainsProcessor.class);
- return tbProc.getTrackedBranchTestFailures(branchOpt, checkAllLogs, cntLimit, creds, CtxListener.getPool(ctx));
+ return tbProc.getTrackedBranchTestFailures(branchOpt, checkAllLogs, cntLimit, creds);
}
}