Return result message for the user who uploaded the proto message file
Test: go/vts-web-staging
Bug: 119160910
Change-Id: I8346cd80a7a74baec9f2d5a649f198dcf9ee0fec
diff --git a/src/main/java/com/android/vts/api/CoverageRestServlet.java b/src/main/java/com/android/vts/api/CoverageRestServlet.java
index 165db8d..aebd3e5 100644
--- a/src/main/java/com/android/vts/api/CoverageRestServlet.java
+++ b/src/main/java/com/android/vts/api/CoverageRestServlet.java
@@ -106,10 +106,8 @@
List<List<String>> allCoveredHalApiList = new ArrayList();
Key<TestPlanRunEntity> key = Key.create(urlSafeKey);
- System.out.println("urlSafekey => " + urlSafeKey);
TestPlanRunEntity testPlanRunEntity = ofy().load().key(key).safe();
- System.out.println("testPlanRunEntity => " + testPlanRunEntity);
for (Key<TestRunEntity> testRunKey : testPlanRunEntity.getTestRuns()) {
List<ApiCoverageEntity> apiCoverageEntityList =
ofy().load().type(ApiCoverageEntity.class).ancestor(testRunKey).list();
diff --git a/src/main/java/com/android/vts/api/DatastoreRestServlet.java b/src/main/java/com/android/vts/api/DatastoreRestServlet.java
index 5ddf18d..fb5ac65 100644
--- a/src/main/java/com/android/vts/api/DatastoreRestServlet.java
+++ b/src/main/java/com/android/vts/api/DatastoreRestServlet.java
@@ -87,6 +87,7 @@
return;
}
+ String resultMsg = "";
// Verify service account access token.
if (postMessage.hasAccessToken()) {
String accessToken = postMessage.getAccessToken();
@@ -109,15 +110,21 @@
}
response.setStatus(HttpServletResponse.SC_OK);
+ resultMsg = "Success!!";
} else {
log.warn("service_client_id didn't match!");
log.debug("SERVICE_CLIENT_ID => " + tokenInfo.getIssuedTo());
+ resultMsg = "Your SERVICE_CLIENT_ID is incorrect!";
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
}
} else {
log.error("postMessage do not contain any accessToken!");
+ resultMsg = "Your message do not have access token!";
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
}
+ response.setContentType("application/json");
+ response.setCharacterEncoding("UTF-8");
+ response.getWriter().write("{'result_msg': " + resultMsg + "}");
}
/**
@@ -446,13 +453,6 @@
Map<com.googlecode.objectify.Key<TestRunEntity>, TestRunEntity> testRunEntityMap =
ofy().load().keys(() -> testRunKeyList.iterator());
- testRunKeyList.forEach(
- (v) -> {
- log.debug("TestRunEntity key value => " + v);
- });
- log.debug("testRunEntityMap value => " + testRunEntityMap.values());
- log.debug("testRunEntityMap keySet => " + testRunEntityMap.keySet());
-
long passCount = 0;
long failCount = 0;
long startTimestamp = -1;