Skip to content
Permalink
Browse files
Removal of guava objects usage for equals/hash code & code commenting
  • Loading branch information
dspavlov committed Mar 14, 2019
1 parent 5cd5df2 commit d3d6711e0eed90b1ee9ab1fec034012b024e1c71
Showing 8 changed files with 99 additions and 86 deletions.
@@ -17,7 +17,7 @@

package org.apache.ignite.ci.jira.ignited;

import com.google.common.base.Objects;
import java.util.Objects;
import org.apache.ignite.ci.jira.pure.Fields;
import org.apache.ignite.ci.jira.pure.Status;
import org.apache.ignite.ci.jira.pure.Ticket;
@@ -93,13 +93,13 @@ public Ticket toTicket(IStringCompactor comp, String projectCode) {
return id == compacted.id &&
igniteId == compacted.igniteId &&
status == compacted.status &&
Objects.equal(summary, compacted.summary) &&
Objects.equal(customfield_11050, compacted.customfield_11050) &&
Objects.equal(description, compacted.description);
Objects.equals(summary, compacted.summary) &&
Objects.equals(customfield_11050, compacted.customfield_11050) &&
Objects.equals(description, compacted.description);
}

/** {@inheritDoc} */
@Override public int hashCode() {
return Objects.hashCode(id, igniteId, status, summary, customfield_11050, description);
return Objects.hash(id, igniteId, status, summary, customfield_11050, description);
}
}
@@ -18,7 +18,7 @@
package org.apache.ignite.ci.tcmodel.hist;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import java.util.Objects;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@@ -121,23 +121,29 @@ public boolean isFailedToStart() {

/** {@inheritDoc} */
@Override public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BuildRef buildRef = (BuildRef) o;
return Objects.equal(id, buildRef.id) &&
Objects.equal(buildTypeId, buildRef.buildTypeId) &&
Objects.equal(branchName, buildRef.branchName) &&
Objects.equal(status, buildRef.status) &&
Objects.equal(state, buildRef.state) &&
Objects.equal(buildNumber, buildRef.buildNumber) &&
Objects.equal(defaultBranch, buildRef.defaultBranch) &&
Objects.equal(composite, buildRef.composite) &&
Objects.equal(webUrl, buildRef.webUrl);
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;

BuildRef ref = (BuildRef)o;

return Objects.equals(id, ref.id) &&
Objects.equals(buildTypeId, ref.buildTypeId) &&
Objects.equals(branchName, ref.branchName) &&
Objects.equals(status, ref.status) &&
Objects.equals(state, ref.state) &&
Objects.equals(buildNumber, ref.buildNumber) &&
Objects.equals(defaultBranch, ref.defaultBranch) &&
Objects.equals(composite, ref.composite) &&
Objects.equals(failedToStart, ref.failedToStart) &&
Objects.equals(webUrl, ref.webUrl);
}

/** {@inheritDoc} */
@Override public int hashCode() {
return Objects.hashCode(id, buildTypeId, branchName, status, state, buildNumber, defaultBranch, composite, webUrl);
return Objects.hash(id, buildTypeId, branchName, status, state, buildNumber, defaultBranch, composite,
failedToStart, webUrl);
}

/** {@inheritDoc} */
@@ -18,11 +18,12 @@
package org.apache.ignite.ci.teamcity.ignited.fatbuild;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Strings;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Objects;
import org.apache.ignite.ci.analysis.RunStat;
import org.apache.ignite.ci.tcbot.common.StringFieldCompacted;
import org.apache.ignite.ci.tcmodel.hist.BuildRef;
@@ -289,13 +290,15 @@ private int idInBuild() {
duration == compacted.duration &&
testId == compacted.testId &&
actualBuildId == compacted.actualBuildId &&
Objects.equal(flags, compacted.flags) &&
Objects.equal(details, compacted.details);
Objects.equals(flags, compacted.flags) &&
Arrays.equals(details, compacted.details);
}

/** {@inheritDoc} */
@Override public int hashCode() {
return Objects.hashCode(idInBuild, name, status, duration, flags, testId, actualBuildId, details);
int res = Objects.hash(idInBuild, name, status, duration, flags, testId, actualBuildId);
res = 31 * res + Arrays.hashCode(details);
return res;
}

public boolean isFailedButNotMuted(IStringCompactor compactor) {
@@ -18,9 +18,9 @@
package org.apache.ignite.ci.teamcity.ignited.runhist;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import java.time.Duration;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.ignite.ci.analysis.RunStat;
@@ -160,12 +160,12 @@ public int failuresCount() {
InvocationData data = (InvocationData)o;
return allHistRuns == data.allHistRuns &&
allHistFailures == data.allHistFailures &&
Objects.equal(invocationMap, data.invocationMap);
Objects.equals(invocationMap, data.invocationMap);
}

/** {@inheritDoc} */
@Override public int hashCode() {
return Objects.hashCode(allHistRuns, allHistFailures, invocationMap);
return Objects.hash(allHistRuns, allHistFailures, invocationMap);
}

/**
@@ -18,8 +18,8 @@
package org.apache.ignite.ci.teamcity.ignited.runhist;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
import org.apache.ignite.ci.analysis.IVersionedEntity;
@@ -207,11 +207,11 @@ private static Integer checkTemplateAtPos(int[] template, int centralEvtBuild, L
return false;
RunHistCompacted compacted = (RunHistCompacted)o;
return _ver == compacted._ver &&
Objects.equal(data, compacted.data);
Objects.equals(data, compacted.data);
}

/** {@inheritDoc} */
@Override public int hashCode() {
return Objects.hashCode(_ver, data);
return Objects.hash(_ver, data);
}
}
@@ -17,31 +17,31 @@

package org.apache.ignite.ci.web.model.current;

import com.google.common.base.Objects;
import com.google.common.base.Strings;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Stream;
import javax.annotation.Nullable;

import org.apache.ignite.ci.analysis.FullChainRunCtx;
import org.apache.ignite.ci.analysis.IMultTestOccurrence;
import org.apache.ignite.ci.analysis.MultBuildRunCtx;
import org.apache.ignite.ci.github.PullRequest;
import org.apache.ignite.ci.github.ignited.IGitHubConnIgnited;
import org.apache.ignite.ci.github.pure.IGitHubConnection;
import org.apache.ignite.ci.jira.ignited.IJiraIgnited;
import org.apache.ignite.ci.jira.pure.IJiraIntegration;
import org.apache.ignite.ci.tcbot.visa.BranchTicketMatcher;
import org.apache.ignite.ci.tcmodel.conf.BuildType;
import org.apache.ignite.ci.teamcity.ignited.ITeamcityIgnited;
import org.apache.ignite.ci.util.CollectionUtil;
import org.apache.ignite.internal.util.typedef.T2;

import static org.apache.ignite.ci.util.UrlUtil.escape;
import static org.apache.ignite.ci.web.model.current.SuiteCurrentStatus.*;
import static org.apache.ignite.ci.web.model.current.SuiteCurrentStatus.branchForLink;
import static org.apache.ignite.ci.web.model.current.SuiteCurrentStatus.createOccurForLogConsumer;
import static org.apache.ignite.ci.web.model.current.SuiteCurrentStatus.createOrrucForLongRun;

/**
* Represent Run All chain results/ or RunAll+latest re-runs.
@@ -245,27 +245,31 @@ public String serverName() {
if (o == null || getClass() != o.getClass())
return false;
ChainAtServerCurrentStatus status = (ChainAtServerCurrentStatus)o;
return Objects.equal(chainName, status.chainName) &&
Objects.equal(serverId, status.serverId) &&
Objects.equal(branchName, status.branchName) &&
Objects.equal(webToHist, status.webToHist) &&
Objects.equal(webToBuild, status.webToBuild) &&
Objects.equal(suites, status.suites) &&
Objects.equal(failedTests, status.failedTests) &&
Objects.equal(failedToFinish, status.failedToFinish) &&
Objects.equal(durationPrintable, status.durationPrintable) &&
Objects.equal(testsDurationPrintable, status.testsDurationPrintable) &&
Objects.equal(lostInTimeouts, status.lostInTimeouts) &&
Objects.equal(logConsumers, status.logConsumers) &&
Objects.equal(topLongRunning, status.topLongRunning) &&
Objects.equal(buildNotFound, status.buildNotFound);
return buildNotFound == status.buildNotFound &&
Objects.equals(chainName, status.chainName) &&
Objects.equals(serverId, status.serverId) &&
Objects.equals(branchName, status.branchName) &&
Objects.equals(webToHist, status.webToHist) &&
Objects.equals(webToBuild, status.webToBuild) &&
Objects.equals(ticketFullName, status.ticketFullName) &&
Objects.equals(webToTicket, status.webToTicket) &&
Objects.equals(prNum, status.prNum) &&
Objects.equals(webToPr, status.webToPr) &&
Objects.equals(suites, status.suites) &&
Objects.equals(failedTests, status.failedTests) &&
Objects.equals(failedToFinish, status.failedToFinish) &&
Objects.equals(durationPrintable, status.durationPrintable) &&
Objects.equals(testsDurationPrintable, status.testsDurationPrintable) &&
Objects.equals(lostInTimeouts, status.lostInTimeouts) &&
Objects.equals(topLongRunning, status.topLongRunning) &&
Objects.equals(logConsumers, status.logConsumers) &&
Objects.equals(baseBranchForTc, status.baseBranchForTc);
}

/** {@inheritDoc} */
@Override public int hashCode() {
return Objects.hashCode(chainName, serverId, branchName, webToHist, webToBuild, suites,
failedTests, failedToFinish, durationPrintable, testsDurationPrintable,
lostInTimeouts, logConsumers, topLongRunning, buildNotFound);
return Objects.hash(chainName, serverId, branchName, webToHist, webToBuild, ticketFullName, webToTicket, prNum,
webToPr, suites, failedTests, failedToFinish, durationPrintable, testsDurationPrintable, lostInTimeouts, topLongRunning, logConsumers, buildNotFound, baseBranchForTc);
}

public void setBuildNotFound(boolean buildNotFound) {
@@ -17,12 +17,12 @@

package org.apache.ignite.ci.web.model.current;

import com.google.common.base.Objects;
import com.google.common.base.Strings;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -325,41 +325,40 @@ public static String branchForLink(@Nullable String branchName) {
return true;
if (o == null || getClass() != o.getClass())
return false;
if (!super.equals(o))
return false;
SuiteCurrentStatus status = (SuiteCurrentStatus)o;
return Objects.equal(name, status.name) &&
Objects.equal(result, status.result) &&
Objects.equal(hasCriticalProblem, status.hasCriticalProblem) &&
Objects.equal(webToHist, status.webToHist) &&
Objects.equal(webToHistBaseBranch, status.webToHistBaseBranch) &&
Objects.equal(webToBuild, status.webToBuild) &&
Objects.equal(testFailures, status.testFailures) &&
Objects.equal(topLongRunning, status.topLongRunning) &&
Objects.equal(webUrlThreadDump, status.webUrlThreadDump) &&
Objects.equal(runningBuildCount, status.runningBuildCount) &&
Objects.equal(queuedBuildCount, status.queuedBuildCount) &&
Objects.equal(serverId, status.serverId) &&
Objects.equal(suiteId, status.suiteId) &&
Objects.equal(branchName, status.branchName) &&
Objects.equal(failures, status.failures) &&
Objects.equal(runs, status.runs) &&
Objects.equal(failureRate, status.failureRate) &&
Objects.equal(failsAllHist, status.failsAllHist) &&
Objects.equal(criticalFails, status.criticalFails) &&
Objects.equal(userCommits, status.userCommits) &&
Objects.equal(failedTests, status.failedTests) &&
Objects.equal(durationPrintable, status.durationPrintable) &&
Objects.equal(testsDurationPrintable, status.testsDurationPrintable) &&
Objects.equal(lostInTimeouts, status.lostInTimeouts) &&
Objects.equal(warnOnly, status.warnOnly);
return Objects.equals(name, status.name) &&
Objects.equals(result, status.result) &&
Objects.equals(hasCriticalProblem, status.hasCriticalProblem) &&
Objects.equals(webToHist, status.webToHist) &&
Objects.equals(webToHistBaseBranch, status.webToHistBaseBranch) &&
Objects.equals(webToBuild, status.webToBuild) &&
Objects.equals(testFailures, status.testFailures) &&
Objects.equals(topLongRunning, status.topLongRunning) &&
Objects.equals(warnOnly, status.warnOnly) &&
Objects.equals(logConsumers, status.logConsumers) &&
Objects.equals(webUrlThreadDump, status.webUrlThreadDump) &&
Objects.equals(runningBuildCount, status.runningBuildCount) &&
Objects.equals(queuedBuildCount, status.queuedBuildCount) &&
Objects.equals(serverId, status.serverId) &&
Objects.equals(suiteId, status.suiteId) &&
Objects.equals(branchName, status.branchName) &&
Objects.equals(failsAllHist, status.failsAllHist) &&
Objects.equals(criticalFails, status.criticalFails) &&
Objects.equals(latestRuns, status.latestRuns) &&
Objects.equals(userCommits, status.userCommits) &&
Objects.equals(failedTests, status.failedTests) &&
Objects.equals(durationPrintable, status.durationPrintable) &&
Objects.equals(testsDurationPrintable, status.testsDurationPrintable) &&
Objects.equals(lostInTimeouts, status.lostInTimeouts) &&
Objects.equals(problemRef, status.problemRef) &&
Objects.equals(possibleBlocker, status.possibleBlocker);
}

/** {@inheritDoc} */
@Override public int hashCode() {
return Objects.hashCode(name, result, hasCriticalProblem, webToHist, webToHistBaseBranch, webToBuild, testFailures,
topLongRunning, webUrlThreadDump, runningBuildCount, queuedBuildCount, serverId,
suiteId, branchName, failures, runs, failureRate,
failsAllHist, criticalFails, userCommits, failedTests, durationPrintable, testsDurationPrintable,
lostInTimeouts, warnOnly);
return Objects.hash(super.hashCode(), name, result, hasCriticalProblem, webToHist, webToHistBaseBranch, webToBuild, testFailures, topLongRunning, warnOnly, logConsumers, webUrlThreadDump, runningBuildCount, queuedBuildCount, serverId, suiteId, branchName, failsAllHist, criticalFails, latestRuns, userCommits, failedTests, durationPrintable, testsDurationPrintable, lostInTimeouts, problemRef, possibleBlocker);
}

/** {@inheritDoc} */
@@ -17,7 +17,7 @@

package org.apache.ignite.ci.web.model.hist;

import com.google.common.base.Objects;
import java.util.Objects;
import javax.annotation.Nullable;

/**
@@ -40,13 +40,14 @@ public class FailureSummary {
if (o == null || getClass() != o.getClass())
return false;
FailureSummary summary = (FailureSummary)o;
return Objects.equal(failures, summary.failures) &&
Objects.equal(runs, summary.runs) &&
Objects.equal(failureRate, summary.failureRate);

return Objects.equals(failures, summary.failures) &&
Objects.equals(runs, summary.runs) &&
Objects.equals(failureRate, summary.failureRate);
}

/** {@inheritDoc} */
@Override public int hashCode() {
return Objects.hashCode(failures, runs, failureRate);
return Objects.hash(failures, runs, failureRate);
}
}

0 comments on commit d3d6711

Please sign in to comment.