From 9bad56729ad45d30d2c1cf452a7915c6f1eac5a7 Mon Sep 17 00:00:00 2001 From: Young Gyu Park Date: Tue, 14 Aug 2018 11:20:10 +0900 Subject: Updating servlet according to the change of entity Test: go/vts-web-staging Bug: 111481322 Change-Id: I8d10727045ce71f434b257deea5214c40795dc5b --- .../android/vts/servlet/DashboardMainServlet.java | 33 ++++++++++++++-------- .../com/android/vts/servlet/ShowGraphServlet.java | 6 ++-- .../vts/servlet/ShowPlanReleaseServlet.java | 14 +++++++-- .../android/vts/servlet/ShowPlanRunServlet.java | 12 ++++++-- .../vts/servlet/ShowProfilingOverviewServlet.java | 12 ++++---- 5 files changed, 52 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/main/java/com/android/vts/servlet/DashboardMainServlet.java b/src/main/java/com/android/vts/servlet/DashboardMainServlet.java index 634f892..73a7287 100644 --- a/src/main/java/com/android/vts/servlet/DashboardMainServlet.java +++ b/src/main/java/com/android/vts/servlet/DashboardMainServlet.java @@ -81,8 +81,12 @@ public class DashboardMainServlet extends BaseServlet { * @param muteNotifications The flag for user notification in case of test failure. * @param isFavorite The flag for showing favorite mark on All Tests Tab page. */ - public TestDisplay(Key testKey, int passCount, int failCount, boolean muteNotifications, - boolean isFavorite) { + public TestDisplay( + Key testKey, + int passCount, + int failCount, + boolean muteNotifications, + boolean isFavorite) { this.testKey = testKey; this.passCount = passCount; this.failCount = failCount; @@ -180,15 +184,15 @@ public class DashboardMainServlet extends BaseServlet { List favoriteKeyList = new ArrayList(); Filter userFilter = - new FilterPredicate( - UserFavoriteEntity.USER, FilterOperator.EQUAL, currentUser); + new FilterPredicate(UserFavoriteEntity.USER, FilterOperator.EQUAL, currentUser); Query filterQuery = new Query(UserFavoriteEntity.KIND).setFilter(userFilter); Iterable favoriteIter = datastore.prepare(filterQuery).asIterable(); - favoriteIter.forEach(fe -> { - Key testKey = UserFavoriteEntity.fromEntity(fe).testKey; - favoriteKeyList.add(testKey); - subscriptionMap.put(testKey.getName(), KeyFactory.keyToString(fe.getKey())); - }); + favoriteIter.forEach( + fe -> { + Key testKey = UserFavoriteEntity.fromEntity(fe).testKey; + favoriteKeyList.add(testKey); + subscriptionMap.put(testKey.getName(), KeyFactory.keyToString(fe.getKey())); + }); Query query = new Query(TestStatusEntity.KIND) @@ -199,12 +203,17 @@ public class DashboardMainServlet extends BaseServlet { for (Entity status : datastore.prepare(query).asIterable()) { TestStatusEntity statusEntity = TestStatusEntity.fromEntity(status); if (statusEntity == null) continue; - Key testKey = KeyFactory.createKey(TestEntity.KIND, statusEntity.testName); + Key testKey = KeyFactory.createKey(TestEntity.KIND, statusEntity.getTestName()); boolean isFavorite = favoriteKeyList.contains(testKey); TestDisplay display = new TestDisplay(testKey, -1, -1, false, isFavorite); if (!unprocessedTestKeys.contains(testKey)) { - display = new TestDisplay(testKey, statusEntity.passCount, statusEntity.failCount, - false, isFavorite); + display = + new TestDisplay( + testKey, + statusEntity.getPassCount(), + statusEntity.getFailCount(), + false, + isFavorite); } testMap.put(testKey, display); } diff --git a/src/main/java/com/android/vts/servlet/ShowGraphServlet.java b/src/main/java/com/android/vts/servlet/ShowGraphServlet.java index 05496ef..22b7098 100644 --- a/src/main/java/com/android/vts/servlet/ShowGraphServlet.java +++ b/src/main/java/com/android/vts/servlet/ShowGraphServlet.java @@ -94,9 +94,9 @@ public class ShowGraphServlet extends BaseServlet { if (pt == null) return; String name = PerformanceUtil.getOptionAlias(pt, splitKeySet); Graph g = null; - if (pt.labels != null && pt.labels.size() == pt.values.size()) { + if (pt.getLabels() != null && pt.getLabels().size() == pt.getValues().size()) { g = new LineGraph(name); - } else if (pt.labels == null && pt.values.size() > 0) { + } else if (pt.getLabels() == null && pt.getValues().size() > 0) { g = new Histogram(name); } else { return; @@ -117,7 +117,7 @@ public class ShowGraphServlet extends BaseServlet { if (devices == null) return null; List buildInfos = new ArrayList<>(); for (DeviceInfoEntity device : devices) { - buildInfos.add(device.product + " (" + device.buildId + ")"); + buildInfos.add(device.getProduct() + " (" + device.getBuildId() + ")"); } return StringUtils.join(buildInfos, ", "); } diff --git a/src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java b/src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java index fda4c13..acccf8b 100644 --- a/src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java +++ b/src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java @@ -89,7 +89,13 @@ public class ShowPlanReleaseServlet extends BaseServlet { public void addDevice(DeviceInfoEntity device) { if (device == null || deviceSet.contains(device)) return; - devices.add(device.branch + "/" + device.buildFlavor + " (" + device.buildId + ")"); + devices.add( + device.getBranch() + + "/" + + device.getBuildFlavor() + + " (" + + device.getBuildId() + + ")"); deviceSet.add(device); } @@ -196,6 +202,7 @@ public class ShowPlanReleaseServlet extends BaseServlet { dir, MAX_RUNS_PER_PAGE); Map entityMap = datastore.get(gets); + logger.log(Level.INFO, "entityMap => " + entityMap); for (Key key : gets) { if (!entityMap.containsKey(key)) { continue; @@ -232,6 +239,7 @@ public class ShowPlanReleaseServlet extends BaseServlet { deviceGets.add(device.getKey()); } } + logger.log(Level.INFO, "deviceGets => " + deviceGets); Map devices = datastore.get(deviceGets); for (Key key : devices.keySet()) { if (!testPlanMap.containsKey(key.getParent())) continue; @@ -243,6 +251,7 @@ public class ShowPlanReleaseServlet extends BaseServlet { } testPlanRuns.sort(Comparator.naturalOrder()); + logger.log(Level.INFO, "testPlanRuns => " + testPlanRuns); if (testPlanRuns.size() > 0) { TestPlanRunMetadata firstRun = testPlanRuns.get(0); @@ -328,7 +337,8 @@ public class ShowPlanReleaseServlet extends BaseServlet { if (Objects.nonNull(request.getParameter("deviceName"))) { request.setAttribute("deviceName", request.getParameter("deviceName")); testSuiteResultEntityQuery = - testSuiteResultEntityQuery.filter("deviceName", request.getParameter("deviceName")); + testSuiteResultEntityQuery.filter( + "deviceName", request.getParameter("deviceName")); } testSuiteResultEntityQuery = testSuiteResultEntityQuery.orderKey(true); diff --git a/src/main/java/com/android/vts/servlet/ShowPlanRunServlet.java b/src/main/java/com/android/vts/servlet/ShowPlanRunServlet.java index bce89fc..9138a90 100644 --- a/src/main/java/com/android/vts/servlet/ShowPlanRunServlet.java +++ b/src/main/java/com/android/vts/servlet/ShowPlanRunServlet.java @@ -98,18 +98,24 @@ public class ShowPlanRunServlet extends BaseServlet { long startTime = 0; long endTime = 0; long moduleCount = 0; + long totalApiCount = 0L; + long totalCoveredApiCount = 0L; try { Entity testPlanRunEntity = datastore.get(planRunKey); TestPlanRunEntity testPlanRun = TestPlanRunEntity.fromEntity(testPlanRunEntity); - Map testRuns = datastore.get(testPlanRun.getTestRuns()); + Map testRuns = datastore.get(testPlanRun.getOldTestRuns()); testBuildId = testPlanRun.getTestBuildId(); passCount = (int) testPlanRun.getPassCount(); failCount = (int) testPlanRun.getFailCount(); + totalApiCount = testPlanRun.getTotalApiCount(); + logger.log(Level.INFO, "totalApiCount => " + totalApiCount); + totalCoveredApiCount = testPlanRun.getCoveredApiCount(); + logger.log(Level.INFO, "totalCoveredApiCount => " + totalCoveredApiCount); startTime = testPlanRun.getStartTimestamp(); endTime = testPlanRun.getEndTimestamp(); moduleCount = testPlanRun.getTestRuns().size(); - for (Key key : testPlanRun.getTestRuns()) { + for (Key key : testPlanRun.getOldTestRuns()) { if (!testRuns.containsKey(key)) continue; TestRunEntity testRunEntity = TestRunEntity.fromEntity(testRuns.get(key)); if (testRunEntity == null) continue; @@ -150,6 +156,8 @@ public class ShowPlanRunServlet extends BaseServlet { request.setAttribute("moduleCount", new Gson().toJson(moduleCount)); request.setAttribute("passingTestCaseCount", new Gson().toJson(passCount)); request.setAttribute("failingTestCaseCount", new Gson().toJson(failCount)); + request.setAttribute("totalApiCount", totalApiCount); + request.setAttribute("totalCoveredApiCount", totalCoveredApiCount); // data for pie chart request.setAttribute("topBuildResultCounts", new Gson().toJson(topBuildResultCounts)); diff --git a/src/main/java/com/android/vts/servlet/ShowProfilingOverviewServlet.java b/src/main/java/com/android/vts/servlet/ShowProfilingOverviewServlet.java index 558654e..5dc8c6e 100644 --- a/src/main/java/com/android/vts/servlet/ShowProfilingOverviewServlet.java +++ b/src/main/java/com/android/vts/servlet/ShowProfilingOverviewServlet.java @@ -139,7 +139,7 @@ public class ShowProfilingOverviewServlet extends BaseServlet { for (ProfilingPointEntity pp : profilingPoints) { Query profilingQuery = new Query(ProfilingPointSummaryEntity.KIND) - .setAncestor(pp.key) + .setAncestor(pp.getKey()) .setFilter(filter); asyncEntities.put( pp, @@ -150,17 +150,17 @@ public class ShowProfilingOverviewServlet extends BaseServlet { Map plotMap = new HashMap<>(); for (ProfilingPointEntity pp : profilingPoints) { - if (!plotMap.containsKey(pp.profilingPointName)) { + if (!plotMap.containsKey(pp.getProfilingPointName())) { plotMap.put( - pp.profilingPointName, new BoxPlot(pp.profilingPointName, null, pp.xLabel)); + pp.getProfilingPointName(), new BoxPlot(pp.getProfilingPointName(), null, pp.getXLabel())); } - BoxPlot plot = plotMap.get(pp.profilingPointName); + BoxPlot plot = plotMap.get(pp.getProfilingPointName()); Set timestamps = new HashSet<>(); for (Entity e : asyncEntities.get(pp)) { ProfilingPointSummaryEntity pps = ProfilingPointSummaryEntity.fromEntity(e); if (pps == null) continue; - plot.addSeriesData(Long.toString(pps.startTime), pps.series, pps.globalStats); - timestamps.add(pps.startTime); + plot.addSeriesData(Long.toString(pps.getStartTime()), pps.getSeries(), pps.getGlobalStats()); + timestamps.add(pps.getStartTime()); } List timestampList = new ArrayList<>(timestamps); timestampList.sort(Comparator.reverseOrder()); -- cgit v1.2.3