Skip to content
Permalink
Browse files
Refactoring for critical/non critical suites
  • Loading branch information
dspavlov committed May 15, 2019
1 parent f054eb2 commit 85ee006a3f1239456c57c362d137a397fe72298b
Showing 3 changed files with 36 additions and 25 deletions.
@@ -117,13 +117,13 @@
/** List of build parameters should be specified for triggering build. Each parameter should have name and may have randomly selected or fixed value. */
"triggerParameters": [
{
name: "reverse.dep.*.env.JAVA_HOME",
randomValue: true,
"name": "reverse.dep.*.env.JAVA_HOME",
"randomValue": true,
"selection": [
{value:"%env.JDK_ORA_18%", label:"JDK8"},
{value:"%env.JDK_ORA_9%", label:"JDK9"},
{value:"%env.JDK_ORA_10%", label:"JDK10"},
{value:"%env.JDK_OPEN_11%", label:"JDK11"}
{"value":"%env.JDK_ORA_18%", "label":"JDK8"},
{"value":"%env.JDK_ORA_9%", "label":"JDK9"},
{"value":"%env.JDK_ORA_10%", "label":"JDK10"},
{"value":"%env.JDK_OPEN_11%", "label":"JDK11"}
]
}
]
@@ -621,25 +621,24 @@ public int[] snapshotDependencies() {
.toString();
}

public Invocation toInvocation(IStringCompactor compactor,
BiPredicate<Integer, Integer> paramsFilter) {
/**
* Transforms suite to compact invocation.
*
* @param compactor Compactor.
* @param paramsFilter Params filter (key compactor's code, value compactor's code) for checking parameters to be
* saved in Invocation.
*/
public Invocation toInvocation(IStringCompactor compactor, BiPredicate<Integer, Integer> paramsFilter) {
boolean success = isSuccess(compactor);

final int failCode ;

if (success)
failCode = InvocationData.OK;
else {
if (problems()
.stream().anyMatch(occurrence ->
occurrence.isExecutionTimeout(compactor)
|| occurrence.isJvmCrash(compactor)
|| occurrence.isBuildFailureOnMetric(compactor)
|| occurrence.isCompilationError(compactor)))
failCode = InvocationData.CRITICAL_FAILURE;
else
failCode = InvocationData.FAILURE;

failCode = problems().stream().anyMatch(occurrence -> occurrence.isCriticalProblem(compactor))
? InvocationData.CRITICAL_FAILURE
: InvocationData.FAILURE;
}

Invocation invocation = new Invocation(getId())
@@ -649,14 +648,14 @@ public Invocation toInvocation(IStringCompactor compactor,

java.util.Map<Integer, Integer> importantParms = new TreeMap<>();

ParametersCompacted parameters = this.parameters();
if (parameters == null)
return invocation;
ParametersCompacted parameters = parameters();

parameters.forEach((k, v) -> {
if (paramsFilter.test(k, v))
importantParms.put(k, v);
});
if (parameters != null) {
parameters.forEach((k, v) -> {
if (paramsFilter.test(k, v))
importantParms.put(k, v);
});
}

return invocation;
}
@@ -166,6 +166,7 @@ public int type() {
return type;
}

/** {@inheritDoc} */
@Override public String toString() {
return MoreObjects.toStringHelper(this)
.add("id", id)
@@ -174,4 +175,15 @@ public int type() {
.add("actualBuildId", actualBuildId)
.toString() + "\n";
}

/**
* @param compactor Compactor.
* @return if this problem is critical.
*/
public boolean isCriticalProblem(IStringCompactor compactor) {
return isExecutionTimeout(compactor)
|| isJvmCrash(compactor)
|| isBuildFailureOnMetric(compactor)
|| isCompilationError(compactor);
}
}

0 comments on commit 85ee006

Please sign in to comment.