summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2018-08-14 17:57:15 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-08-14 17:57:15 +0000
commit76b8d5f6a1f87ff964972709ca9b7b5fe9a488c4 (patch)
treef61555de57b30fd80de4c9ad3bc8309682f6a854 /src/main
parentdbb67329053206c4b7b2c0c69b52fff846b31a9c (diff)
parent29173a5e7ec27236f197a1b7af9357740ec95900 (diff)
downloaddashboard-76b8d5f6a1f87ff964972709ca9b7b5fe9a488c4.tar.gz
Merge "Updating job servlet because of entity change"
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/android/vts/job/VtsAlertJobServlet.java24
-rw-r--r--src/main/java/com/android/vts/job/VtsCoverageAlertJobServlet.java2
-rw-r--r--src/main/java/com/android/vts/job/VtsInactivityJobServlet.java8
-rw-r--r--src/main/java/com/android/vts/job/VtsProfilingStatsJobServlet.java29
4 files changed, 33 insertions, 30 deletions
diff --git a/src/main/java/com/android/vts/job/VtsAlertJobServlet.java b/src/main/java/com/android/vts/job/VtsAlertJobServlet.java
index 511017f..7e66ac8 100644
--- a/src/main/java/com/android/vts/job/VtsAlertJobServlet.java
+++ b/src/main/java/com/android/vts/job/VtsAlertJobServlet.java
@@ -77,13 +77,13 @@ public class VtsAlertJobServlet extends HttpServlet {
* @returns a map from test case name to the test case run ID for which the test case failed.
*/
private static Map<String, TestCase> getCurrentFailures(TestStatusEntity status) {
- if (status.failingTestCases == null || status.failingTestCases.size() == 0) {
+ if (status.getFailingTestCases() == null || status.getFailingTestCases().size() == 0) {
return new HashMap<>();
}
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Map<String, TestCase> failingTestcases = new HashMap<>();
Set<Key> gets = new HashSet<>();
- for (TestCaseReference testCaseRef : status.failingTestCases) {
+ for (TestCaseReference testCaseRef : status.getFailingTestCases()) {
gets.add(KeyFactory.createKey(TestCaseRunEntity.KIND, testCaseRef.parentId));
}
if (gets.size() == 0) {
@@ -91,7 +91,7 @@ public class VtsAlertJobServlet extends HttpServlet {
}
Map<Key, Entity> testCaseMap = datastore.get(gets);
- for (TestCaseReference testCaseRef : status.failingTestCases) {
+ for (TestCaseReference testCaseRef : status.getFailingTestCases()) {
Key key = KeyFactory.createKey(TestCaseRunEntity.KIND, testCaseRef.parentId);
if (!testCaseMap.containsKey(key)) {
continue;
@@ -119,7 +119,7 @@ public class VtsAlertJobServlet extends HttpServlet {
List<TestAcknowledgmentEntity> acks = new ArrayList<>();
Filter testFilter =
new Query.FilterPredicate(
- TestAcknowledgmentEntity.TEST_KEY, Query.FilterOperator.EQUAL, testKey);
+ TestAcknowledgmentEntity.TEST_KEY, Query.FilterOperator.EQUAL, testKey);
Query q = new Query(TestAcknowledgmentEntity.KIND).setFilter(testFilter);
for (Entity ackEntity : datastore.prepare(q).asIterable()) {
@@ -133,7 +133,7 @@ public class VtsAlertJobServlet extends HttpServlet {
/**
* Get the test runs for the test in the specified time window.
*
- * If the start and end time delta is greater than one day, the query will be truncated.
+ * <p>If the start and end time delta is greater than one day, the query will be truncated.
*
* @param testKey The key to the test whose runs to query.
* @param startTime The start time for the query.
@@ -188,9 +188,9 @@ public class VtsAlertJobServlet extends HttpServlet {
if (!isRelevant) {
for (DeviceInfoEntity device : devices) {
boolean deviceAcknowledged =
- allDevices || ack.devices.contains(device.buildFlavor);
+ allDevices || ack.devices.contains(device.getBuildFlavor());
boolean branchAcknowledged =
- allBranches || ack.branches.contains(device.branch);
+ allBranches || ack.branches.contains(device.getBranch());
if (deviceAcknowledged && branchAcknowledged) isRelevant = true;
}
}
@@ -308,7 +308,7 @@ public class VtsAlertJobServlet extends HttpServlet {
if (deviceEntity == null) {
continue;
}
- buildIdList.add(deviceEntity.buildId);
+ buildIdList.add(deviceEntity.getBuildId());
devices.add(deviceEntity);
}
String footer = EmailHelper.getEmailFooter(mostRecentRun, devices, link);
@@ -519,7 +519,7 @@ public class VtsAlertJobServlet extends HttpServlet {
if (status == null) {
status = new TestStatusEntity(testName);
}
- if (status.timestamp >= testRunKey.getId()) {
+ if (status.getUpdatedTimestamp() >= testRunKey.getId()) {
// Another job has already updated the status first
return;
}
@@ -535,7 +535,8 @@ public class VtsAlertJobServlet extends HttpServlet {
List<TestAcknowledgmentEntity> testAcks =
getTestCaseAcknowledgments(testRunKey.getParent());
List<TestRunEntity> testRuns =
- getTestRuns(testRunKey.getParent(), status.timestamp, testRunKey.getId());
+ getTestRuns(
+ testRunKey.getParent(), status.getUpdatedTimestamp(), testRunKey.getId());
if (testRuns.size() == 0) return;
TestStatusEntity newStatus =
@@ -554,7 +555,8 @@ public class VtsAlertJobServlet extends HttpServlet {
} catch (EntityNotFoundException e) {
// no status left
}
- if (status == null || status.timestamp >= newStatus.timestamp) {
+ if (status == null
+ || status.getUpdatedTimestamp() >= newStatus.getUpdatedTimestamp()) {
txn.rollback();
} else { // This update is most recent.
datastore.put(newStatus.toEntity());
diff --git a/src/main/java/com/android/vts/job/VtsCoverageAlertJobServlet.java b/src/main/java/com/android/vts/job/VtsCoverageAlertJobServlet.java
index a112496..bb82749 100644
--- a/src/main/java/com/android/vts/job/VtsCoverageAlertJobServlet.java
+++ b/src/main/java/com/android/vts/job/VtsCoverageAlertJobServlet.java
@@ -134,7 +134,7 @@ public class VtsCoverageAlertJobServlet extends HttpServlet {
continue;
}
devices.add(deviceEntity);
- buildIdList.add(deviceEntity.buildId);
+ buildIdList.add(deviceEntity.getBuildId());
}
String deviceBuild = StringUtils.join(buildIdList, ", ");
String footer = EmailHelper.getEmailFooter(testRunEntity, devices, link);
diff --git a/src/main/java/com/android/vts/job/VtsInactivityJobServlet.java b/src/main/java/com/android/vts/job/VtsInactivityJobServlet.java
index 7e52987..ce2b77a 100644
--- a/src/main/java/com/android/vts/job/VtsInactivityJobServlet.java
+++ b/src/main/java/com/android/vts/job/VtsInactivityJobServlet.java
@@ -78,10 +78,10 @@ public class VtsInactivityJobServlet extends HttpServlet {
// test is assumed to be deprecated).
if (diff >= TimeUnit.DAYS.toMicros(1) && diff < TimeUnit.DAYS.toMicros(8)) {
String uploadTimeString = TimeUtil.getDateTimeString(lastRunTime);
- String subject = "Warning! Inactive test: " + test.testName;
+ String subject = "Warning! Inactive test: " + test.getTestName();
String body =
"Hello,<br><br>Test \""
- + test.testName
+ + test.getTestName()
+ "\" is inactive. "
+ "No new data has been uploaded since "
+ uploadTimeString
@@ -159,12 +159,12 @@ public class VtsInactivityJobServlet extends HttpServlet {
if (status == null) {
return;
}
- Key testKey = KeyFactory.createKey(TestEntity.KIND, status.testName);
+ Key testKey = KeyFactory.createKey(TestEntity.KIND, status.getTestName());
long lastRunTime = getLastRunTime(testKey);
StringBuffer fullUrl = request.getRequestURL();
String baseUrl = fullUrl.substring(0, fullUrl.indexOf(request.getRequestURI()));
- String link = baseUrl + "/show_tree?testName=" + status.testName;
+ String link = baseUrl + "/show_tree?testName=" + status.getTestName();
List<Message> messageQueue = new ArrayList<>();
List<String> emails;
diff --git a/src/main/java/com/android/vts/job/VtsProfilingStatsJobServlet.java b/src/main/java/com/android/vts/job/VtsProfilingStatsJobServlet.java
index c118b09..96d635d 100644
--- a/src/main/java/com/android/vts/job/VtsProfilingStatsJobServlet.java
+++ b/src/main/java/com/android/vts/job/VtsProfilingStatsJobServlet.java
@@ -121,11 +121,11 @@ public class VtsProfilingStatsJobServlet extends HttpServlet {
ProfilingPointEntity profilingPoint =
new ProfilingPointEntity(
testKey.getName(),
- profilingPointRun.name,
- profilingPointRun.type.getNumber(),
- profilingPointRun.regressionMode.getNumber(),
- profilingPointRun.xLabel,
- profilingPointRun.yLabel);
+ profilingPointRun.getName(),
+ profilingPointRun.getType(),
+ profilingPointRun.getRegressionMode(),
+ profilingPointRun.getXLabel(),
+ profilingPointRun.getYLabel());
puts.add(profilingPoint.toEntity());
String option = PerformanceUtil.getOptionAlias(profilingPointRun, splitKeySet);
@@ -137,8 +137,8 @@ public class VtsProfilingStatsJobServlet extends HttpServlet {
deviceNames.add(ProfilingPointSummaryEntity.ALL);
for (DeviceInfoEntity d : devices) {
- branches.add(d.branch);
- deviceNames.add(d.buildFlavor);
+ branches.add(d.getBranch());
+ deviceNames.add(d.getBuildFlavor());
}
List<Key> summaryGets = new ArrayList<>();
@@ -146,7 +146,7 @@ public class VtsProfilingStatsJobServlet extends HttpServlet {
for (String device : deviceNames) {
summaryGets.add(
ProfilingPointSummaryEntity.createKey(
- profilingPoint.key, branch, device, option, time));
+ profilingPoint.getKey(), branch, device, option, time));
}
}
@@ -160,12 +160,12 @@ public class VtsProfilingStatsJobServlet extends HttpServlet {
logger.log(Level.WARNING, "Invalid profiling point summary: " + e.getKey());
continue;
}
- if (!summaryMap.containsKey(profilingPointSummary.branch)) {
- summaryMap.put(profilingPointSummary.branch, new HashMap<>());
+ if (!summaryMap.containsKey(profilingPointSummary.getBranch())) {
+ summaryMap.put(profilingPointSummary.getBranch(), new HashMap<>());
}
Map<String, ProfilingPointSummaryEntity> deviceMap =
- summaryMap.get(profilingPointSummary.branch);
- deviceMap.put(profilingPointSummary.buildFlavor, profilingPointSummary);
+ summaryMap.get(profilingPointSummary.getBranch());
+ deviceMap.put(profilingPointSummary.getBuildFlavor(), profilingPointSummary);
}
Set<ProfilingPointSummaryEntity> modifiedEntities = new HashSet<>();
@@ -183,7 +183,7 @@ public class VtsProfilingStatsJobServlet extends HttpServlet {
} else {
summary =
new ProfilingPointSummaryEntity(
- profilingPoint.key, branch, device, option, time);
+ profilingPoint.getKey(), branch, device, option, time);
deviceMap.put(device, summary);
}
summary.update(profilingPointRun);
@@ -205,7 +205,8 @@ public class VtsProfilingStatsJobServlet extends HttpServlet {
tx.rollback();
logger.log(
Level.WARNING,
- "Profiling stats job transaction still active: " + profilingPointRun.key);
+ "Profiling stats job transaction still active: "
+ + profilingPointRun.getKey());
return false;
}
}