diff options
Diffstat (limited to 'src/main/java/com/android/vts/job/VtsAlertJobServlet.java')
-rw-r--r-- | src/main/java/com/android/vts/job/VtsAlertJobServlet.java | 24 |
1 files changed, 13 insertions, 11 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()); |