summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorYoung Gyu Park <younggyu@google.com>2018-04-18 14:45:46 +0900
committerKeun Soo Yim <yim@google.com>2018-04-19 02:16:09 +0000
commit81a026062cd56132f145862720d3472f16384ac2 (patch)
tree940901ee9b3f185ef6d75938560a254fcf46fe19 /src/main
parentd32eb9559b034b40ea3745ee20dd23f4d9fec91d (diff)
downloaddashboard-81a026062cd56132f145862720d3472f16384ac2.tar.gz
Implementing suite test category.
Test: go/vts-web-staging/show_plan_release?plan=vts&type=suite&page=1 Bug: 78095215 Change-Id: I0f8eb37e6cba3942f5816a57869ed49e50123d92
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/android/vts/entity/TestSuiteResultEntity.java56
-rw-r--r--src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java6
-rw-r--r--src/main/webapp/WEB-INF/datastore-indexes.xml1
-rw-r--r--src/main/webapp/WEB-INF/jsp/show_suite_release.jsp29
4 files changed, 85 insertions, 7 deletions
diff --git a/src/main/java/com/android/vts/entity/TestSuiteResultEntity.java b/src/main/java/com/android/vts/entity/TestSuiteResultEntity.java
index 2e1d5e3..f82e114 100644
--- a/src/main/java/com/android/vts/entity/TestSuiteResultEntity.java
+++ b/src/main/java/com/android/vts/entity/TestSuiteResultEntity.java
@@ -27,8 +27,13 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
+import java.time.Instant;
import java.util.Date;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import static com.googlecode.objectify.ObjectifyService.ofy;
@@ -40,11 +45,12 @@ import static com.googlecode.objectify.ObjectifyService.ofy;
public class TestSuiteResultEntity {
public enum GROUP_TYPE {
- OTA, SIGNED, TOT
+ OTA,
+ SIGNED,
+ TOT
}
- @Parent
- Key<TestSuiteFileEntity> testSuiteFileEntityKey;
+ @Parent Key<TestSuiteFileEntity> testSuiteFileEntityKey;
/** Test Suite start time field */
@Id @Getter @Setter Long startTime;
@@ -146,11 +152,13 @@ public class TestSuiteResultEntity {
this.failedTestCaseCount = failedTestCaseCount;
int totalTestCaseCount = passedTestCaseCount + failedTestCaseCount;
- if ( totalTestCaseCount <= 0 ) {
+ if (totalTestCaseCount <= 0) {
this.passedTestCaseRatio = 0;
} else {
this.passedTestCaseRatio = passedTestCaseCount / totalTestCaseCount * 100;
}
+
+ this.groupType = this.getGroupType();
}
/** Saving function for the instance of this class */
@@ -162,4 +170,44 @@ public class TestSuiteResultEntity {
public List<? extends TestSuiteResultEntity> getTestSuitePlans() {
return ofy().load().type(this.getClass()).project("suitePlan").distinct(true).list();
}
+
+ private String getNormalizedVersion(String fingerprint) {
+ Map<String, Pattern> partternMap =
+ new HashMap<String, Pattern>() {
+ {
+ put(
+ "9",
+ Pattern.compile(
+ "(:9(\\.\\d\\.\\d|\\.\\d|)|:P\\w*/)",
+ Pattern.CASE_INSENSITIVE));
+ put(
+ "8.1",
+ Pattern.compile(
+ "(:8\\.1\\.\\d\\/|:O\\w+-MR1/)", Pattern.CASE_INSENSITIVE));
+ put(
+ "8",
+ Pattern.compile(
+ "(:8\\.0\\.\\d\\/|:O\\w*/)", Pattern.CASE_INSENSITIVE));
+ }
+ };
+
+ for (Map.Entry<String, Pattern> entry : partternMap.entrySet()) {
+ Matcher systemMatcher = entry.getValue().matcher(fingerprint);
+ if (systemMatcher.find()) {
+ return entry.getKey();
+ }
+ }
+ return "unknown-version-" + Instant.now().toEpochMilli();
+ }
+
+ public GROUP_TYPE getGroupType() {
+ if (this.getNormalizedVersion(this.buildSystemFingerprint)
+ != this.getNormalizedVersion(this.buildVendorFingerprint)) {
+ return GROUP_TYPE.OTA;
+ } else if (this.buildVendorFingerprint.endsWith("release-keys")) {
+ return GROUP_TYPE.SIGNED;
+ } else {
+ return GROUP_TYPE.TOT;
+ }
+ }
}
diff --git a/src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java b/src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java
index 69c75f1..b068b0c 100644
--- a/src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java
+++ b/src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java
@@ -285,6 +285,10 @@ public class ShowPlanReleaseServlet extends BaseServlet {
String PLAN_RELEASE_JSP = "WEB-INF/jsp/show_suite_release.jsp";
String testPlan = request.getParameter("plan");
+ String groupType =
+ request.getParameter("groupType") == null
+ ? "OTA"
+ : request.getParameter("groupType");
int page =
request.getParameter("page") == null
? 1
@@ -298,6 +302,7 @@ public class ShowPlanReleaseServlet extends BaseServlet {
ofy().load()
.type(TestSuiteResultEntity.class)
.filter("suitePlan", testPlan)
+ .filter("groupType", groupType)
.orderKey(true);
Pagination<TestSuiteResultEntity> testSuiteResultEntityPagination =
@@ -331,6 +336,7 @@ public class ShowPlanReleaseServlet extends BaseServlet {
request.setAttribute("page", page);
request.setAttribute("testType", "suite");
+ request.setAttribute("groupType", groupType);
request.setAttribute("plan", testPlan);
request.setAttribute("testSuiteResultEntityPagination", testSuiteResultEntityPagination);
RequestDispatcher dispatcher = request.getRequestDispatcher(PLAN_RELEASE_JSP);
diff --git a/src/main/webapp/WEB-INF/datastore-indexes.xml b/src/main/webapp/WEB-INF/datastore-indexes.xml
index 09aabb2..3d5a58f 100644
--- a/src/main/webapp/WEB-INF/datastore-indexes.xml
+++ b/src/main/webapp/WEB-INF/datastore-indexes.xml
@@ -108,6 +108,7 @@
</datastore-index>
<datastore-index kind="TestSuiteResultEntity" ancestor="false" source="manual">
+ <property name="groupType" direction="asc"/>
<property name="suitePlan" direction="asc"/>
<property name="__key__" direction="desc"/>
</datastore-index>
diff --git a/src/main/webapp/WEB-INF/jsp/show_suite_release.jsp b/src/main/webapp/WEB-INF/jsp/show_suite_release.jsp
index 9f438b1..55039f4 100644
--- a/src/main/webapp/WEB-INF/jsp/show_suite_release.jsp
+++ b/src/main/webapp/WEB-INF/jsp/show_suite_release.jsp
@@ -27,6 +27,11 @@
<link type='text/css' href='/css/test_results.css' rel='stylesheet'>
<script type='text/javascript'>
$(document).ready(function() {
+ $("li.tab").each(function( index ) {
+ $(this).click(function() {
+ window.open($(this).children().attr("href"), '_self');
+ });
+ });
});
</script>
<body>
@@ -38,6 +43,24 @@
</div>
</div>
+ <div class='row'>
+ <div class='col s12'>
+
+ <ul class="tabs">
+ <li class="tab col s6" id="otaTabLink">
+ <a class="${groupType == 'OTA' ? 'active' : 'inactive'}" href="${requestScope['javax.servlet.forward.servlet_path']}?plan=${plan}&type=${testType}&groupType=OTA">OTA</a>
+ </li>
+ <li class="tab col s6" id="signedTabLink">
+ <a class="${groupType == 'SIGNED' ? 'active' : 'inactive'}" href="${requestScope['javax.servlet.forward.servlet_path']}?plan=${plan}&type=${testType}&groupType=SIGNED">SIGNED</a>
+ </li>
+ <li class="tab col s6" id="totTabLink">
+ <a class="${groupType == 'TOT' ? 'active' : 'inactive'}" href="${requestScope['javax.servlet.forward.servlet_path']}?plan=${plan}&type=${testType}&groupType=TOT">TOT</a>
+ </li>
+ </ul>
+
+ </div>
+ </div>
+
<div class='row' id='test-suite-green-release-container'>
<div class="col s12">
@@ -117,7 +140,7 @@
<c:choose>
<c:when test="${testSuiteResultEntityPagination.minPageRange gt testSuiteResultEntityPagination.pageSize}">
<li class="waves-effect">
- <a href="${requestScope['javax.servlet.forward.servlet_path']}?plan=${plan}&type=${testType}&page=${testSuiteResultEntityPagination.minPageRange - 1}&nextPageToken=${testSuiteResultEntityPagination.previousPageCountToken}">
+ <a href="${requestScope['javax.servlet.forward.servlet_path']}?plan=${plan}&type=${testType}&groupType=${groupType}&page=${testSuiteResultEntityPagination.minPageRange - 1}&nextPageToken=${testSuiteResultEntityPagination.previousPageCountToken}">
<i class="material-icons">chevron_left</i>
</a>
</li>
@@ -128,7 +151,7 @@
</c:choose>
<c:forEach var="pageLoop" begin="${testSuiteResultEntityPagination.minPageRange}" end="${testSuiteResultEntityPagination.maxPageRange}">
<li class="waves-effect">
- <a href="${requestScope['javax.servlet.forward.servlet_path']}?plan=${plan}&type=${testType}&page=${pageLoop}<c:if test="${testSuiteResultEntityPagination.currentPageCountToken ne ''}">&nextPageToken=${testSuiteResultEntityPagination.currentPageCountToken}</c:if>">
+ <a href="${requestScope['javax.servlet.forward.servlet_path']}?plan=${plan}&type=${testType}&groupType=${groupType}&page=${pageLoop}<c:if test="${testSuiteResultEntityPagination.currentPageCountToken ne ''}">&nextPageToken=${testSuiteResultEntityPagination.currentPageCountToken}</c:if>">
<c:out value="${pageLoop}" />
</a>
</li>
@@ -136,7 +159,7 @@
<c:choose>
<c:when test="${testSuiteResultEntityPagination.maxPages gt testSuiteResultEntityPagination.pageSize}">
<li class="waves-effect">
- <a href="${requestScope['javax.servlet.forward.servlet_path']}?plan=${plan}&type=${testType}&page=${testSuiteResultEntityPagination.maxPageRange + 1}&nextPageToken=${testSuiteResultEntityPagination.nextPageCountToken}">
+ <a href="${requestScope['javax.servlet.forward.servlet_path']}?plan=${plan}&type=${testType}&groupType=${groupType}&page=${testSuiteResultEntityPagination.maxPageRange + 1}&nextPageToken=${testSuiteResultEntityPagination.nextPageCountToken}">
<i class="material-icons">chevron_right</i>
</a>
</li>