diff options
Diffstat (limited to 'src/main/java')
84 files changed, 0 insertions, 45599 deletions
diff --git a/src/main/java/com/android/vts/api/BaseApiServlet.java b/src/main/java/com/android/vts/api/BaseApiServlet.java deleted file mode 100644 index b7384a7..0000000 --- a/src/main/java/com/android/vts/api/BaseApiServlet.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2018 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.api; - -import com.google.apphosting.api.ApiProxy; -import java.util.Properties; -import java.util.logging.Logger; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletResponse; - -/** An abstract class to be subclassed to create API Servlet */ -public class BaseApiServlet extends HttpServlet { - - private static final Logger logger = Logger.getLogger(BaseApiServlet.class.getName()); - - /** System Configuration Property class */ - protected Properties systemConfigProp = new Properties(); - - /** Appengine server host name */ - protected String hostName; - - /** - * This variable is for maximum number of entities per transaction You can find the detail here - * (https://cloud.google.com/datastore/docs/concepts/limits) - */ - protected int MAX_ENTITY_SIZE_PER_TRANSACTION = 300; - - @Override - public void init(ServletConfig cfg) throws ServletException { - super.init(cfg); - - systemConfigProp = - Properties.class.cast(cfg.getServletContext().getAttribute("systemConfigProp")); - - this.MAX_ENTITY_SIZE_PER_TRANSACTION = - Integer.parseInt(systemConfigProp.getProperty("datastore.maxEntitySize")); - - ApiProxy.Environment env = ApiProxy.getCurrentEnvironment(); - hostName = - env.getAttributes() - .get("com.google.appengine.runtime.default_version_hostname") - .toString(); - } - - protected void setAccessControlHeaders(HttpServletResponse resp) { - resp.setHeader("Access-Control-Allow-Origin", hostName); - resp.setHeader("Access-Control-Allow-Methods", "GET, PUT, POST, OPTIONS, DELETE"); - resp.addHeader("Access-Control-Allow-Headers", "Content-Type"); - resp.addHeader("Access-Control-Max-Age", "86400"); - } -} diff --git a/src/main/java/com/android/vts/api/BigtableLegacyJsonServlet.java b/src/main/java/com/android/vts/api/BigtableLegacyJsonServlet.java deleted file mode 100644 index d331d4b..0000000 --- a/src/main/java/com/android/vts/api/BigtableLegacyJsonServlet.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.api; - -import com.android.vts.proto.VtsReportMessage.TestReportMessage; -import com.android.vts.servlet.BaseServlet; -import com.android.vts.util.DatastoreHelper; -import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; -import com.google.api.client.http.javanet.NetHttpTransport; -import com.google.api.client.json.jackson.JacksonFactory; -import com.google.api.services.oauth2.Oauth2; -import com.google.api.services.oauth2.model.Tokeninfo; -import com.google.protobuf.InvalidProtocolBufferException; -import java.io.BufferedReader; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.apache.commons.codec.binary.Base64; -import org.json.JSONException; -import org.json.JSONObject; - -/** REST endpoint for posting data JSON to the Dashboard. */ -@Deprecated -public class BigtableLegacyJsonServlet extends HttpServlet { - private static String SERVICE_CLIENT_ID; - private static final String SERVICE_NAME = "VTS Dashboard"; - private static final Logger logger = - Logger.getLogger(BigtableLegacyJsonServlet.class.getName()); - - /** System Configuration Property class */ - protected Properties systemConfigProp = new Properties(); - - @Override - public void init(ServletConfig cfg) throws ServletException { - super.init(cfg); - - try { - InputStream defaultInputStream = - BigtableLegacyJsonServlet.class - .getClassLoader() - .getResourceAsStream("config.properties"); - systemConfigProp.load(defaultInputStream); - - SERVICE_CLIENT_ID = systemConfigProp.getProperty("appengine.serviceClientID"); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) - throws IOException { - // Retrieve the params - String payload = new String(); - JSONObject payloadJson; - try { - String line = null; - BufferedReader reader = request.getReader(); - while ((line = reader.readLine()) != null) { - payload += line; - } - payloadJson = new JSONObject(payload); - } catch (IOException | JSONException e) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - logger.log(Level.WARNING, "Invalid JSON: " + payload); - return; - } - - // Verify service account access token. - boolean authorized = false; - if (payloadJson.has("accessToken")) { - String accessToken = payloadJson.getString("accessToken").trim(); - GoogleCredential credential = new GoogleCredential().setAccessToken(accessToken); - Oauth2 oauth2 = - new Oauth2.Builder(new NetHttpTransport(), new JacksonFactory(), credential) - .setApplicationName(SERVICE_NAME) - .build(); - Tokeninfo tokenInfo = oauth2.tokeninfo().setAccessToken(accessToken).execute(); - if (tokenInfo.getIssuedTo().equals(SERVICE_CLIENT_ID)) { - authorized = true; - } - } - - if (!authorized) { - response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); - return; - } - - // Parse the desired action and execute the command - try { - if (payloadJson.has("verb")) { - switch (payloadJson.getString("verb")) { - case "createTable": - logger.log(Level.INFO, "Deprecated verb: createTable."); - break; - case "insertRow": - insertData(payloadJson); - break; - default: - logger.log( - Level.WARNING, - "Invalid Datastore REST verb: " + payloadJson.getString("verb")); - throw new IOException("Unsupported POST verb."); - } - } - } catch (IOException e) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return; - } - response.setStatus(HttpServletResponse.SC_OK); - } - - /** - * Inserts a data into the Cloud Datastore - * - * @param payloadJson The JSON object representing the row to be inserted. Of the form: { - * (deprecated) 'tableName' : 'table', (deprecated) 'rowKey' : 'row', (deprecated) 'family' - * : 'family', (deprecated) 'qualifier' : 'qualifier', 'value' : 'value' } - * @throws IOException - */ - private void insertData(JSONObject payloadJson) throws IOException { - if (!payloadJson.has("value")) { - logger.log(Level.WARNING, "Missing attributes for datastore api insertRow()."); - return; - } - try { - byte[] value = Base64.decodeBase64(payloadJson.getString("value")); - TestReportMessage testReportMessage = TestReportMessage.parseFrom(value); - } catch (InvalidProtocolBufferException e) { - logger.log(Level.WARNING, "Invalid report posted to dashboard."); - } - } -} diff --git a/src/main/java/com/android/vts/api/CoverageRestServlet.java b/src/main/java/com/android/vts/api/CoverageRestServlet.java deleted file mode 100644 index aebd3e5..0000000 --- a/src/main/java/com/android/vts/api/CoverageRestServlet.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2018 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.api; - -import com.android.vts.entity.ApiCoverageEntity; -import com.android.vts.entity.CoverageEntity; -import com.android.vts.entity.TestCoverageStatusEntity; -import com.android.vts.entity.TestPlanRunEntity; -import com.android.vts.entity.TestRunEntity; -import com.google.gson.Gson; -import com.googlecode.objectify.Key; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -/** REST endpoint for posting test suite data to the Dashboard. */ -public class CoverageRestServlet extends BaseApiServlet { - - private static final Logger logger = Logger.getLogger(CoverageRestServlet.class.getName()); - - @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - String pathInfo = request.getPathInfo(); - String json = ""; - if (Objects.nonNull(pathInfo)) { - if (pathInfo.equalsIgnoreCase("/api/data")) { - String key = request.getParameter("key"); - json = apiCoverageData(key); - } else { - json = "{error: 'true', message: 'unexpected path!!!'}"; - logger.log(Level.INFO, "Path Info => " + pathInfo); - logger.log(Level.WARNING, "Unknown path access!"); - } - } else { - json = "{error: 'true', message: 'the path info is not existed!!!'}"; - } - - response.setStatus(HttpServletResponse.SC_OK); - response.setContentType("application/json"); - response.setCharacterEncoding("UTF-8"); - response.getWriter().write(json); - } - - private String apiCoverageData(String key) { - ApiCoverageEntity apiCoverageEntity = ApiCoverageEntity.getByUrlSafeKey(key); - String apiCoverageEntityJson = new Gson().toJson(apiCoverageEntity); - return apiCoverageEntityJson; - } - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) - throws IOException { - - String pathInfo = request.getPathInfo(); - String json = ""; - if (Objects.nonNull(pathInfo)) { - if (pathInfo.equalsIgnoreCase("/api/data")) { - String cmd = request.getParameter("cmd"); - String coverageId = request.getParameter("coverageId"); - String testName = request.getParameter("testName"); - String testRunId = request.getParameter("testRunId"); - json = postCoverageData(cmd, coverageId, testName, testRunId); - } else if (pathInfo.equalsIgnoreCase("/api/sum")) { - String urlSafeKey = request.getParameter("urlSafeKey"); - json = postCoverageDataSum(urlSafeKey); - } else { - json = "{error: 'true', message: 'unexpected path!!!'}"; - } - } else { - json = "{error: 'true', message: 'the path info is not existed!!!'}"; - } - - response.setStatus(HttpServletResponse.SC_OK); - response.setContentType("application/json"); - response.setCharacterEncoding("UTF-8"); - response.getWriter().write(json); - } - - private String postCoverageDataSum(String urlSafeKey) { - List<List<String>> allHalApiList = new ArrayList(); - List<List<String>> allCoveredHalApiList = new ArrayList(); - - Key<TestPlanRunEntity> key = Key.create(urlSafeKey); - TestPlanRunEntity testPlanRunEntity = ofy().load().key(key).safe(); - - for (Key<TestRunEntity> testRunKey : testPlanRunEntity.getTestRuns()) { - List<ApiCoverageEntity> apiCoverageEntityList = - ofy().load().type(ApiCoverageEntity.class).ancestor(testRunKey).list(); - for (ApiCoverageEntity apiCoverageEntity : apiCoverageEntityList) { - allHalApiList.add(apiCoverageEntity.getHalApi()); - allCoveredHalApiList.add(apiCoverageEntity.getCoveredHalApi()); - } - } - long totalHalApiNum = allHalApiList.stream().flatMap(Collection::stream).distinct().count(); - long totalCoveredHalApiNum = - allCoveredHalApiList.stream().flatMap(Collection::stream).distinct().count(); - if (totalHalApiNum > 0) { - testPlanRunEntity.setTotalApiCount(totalHalApiNum); - if (totalCoveredHalApiNum > 0) { - testPlanRunEntity.setCoveredApiCount(totalCoveredHalApiNum); - } - testPlanRunEntity.save(); - } - - Map<String, Long> halApiNumMap = - new HashMap<String, Long>() { - { - put("totalHalApiNum", totalHalApiNum); - put("totalCoveredHalApiNum", totalCoveredHalApiNum); - } - }; - String json = new Gson().toJson(halApiNumMap); - return json; - } - - /** - * The API to ignore the irrelevant code for calculating ratio - * - * @param cmd disable or enable command to ignore the code. - * @param coverageId the datastore ID for code coverage. - * @param testName the test name. - * @param testRunId the test run ID from datastore. - * @return success json. - */ - private String postCoverageData( - String cmd, String coverageId, String testName, String testRunId) { - - Boolean isIgnored = false; - if (cmd.equals("disable")) { - isIgnored = true; - } - CoverageEntity coverageEntity = CoverageEntity.findById(testName, testRunId, coverageId); - coverageEntity.setIsIgnored(isIgnored); - coverageEntity.save(); - - TestCoverageStatusEntity testCoverageStatusEntity = - TestCoverageStatusEntity.findById(testName); - Long newCoveredLineCount = - cmd.equals("disable") - ? testCoverageStatusEntity.getUpdatedCoveredLineCount() - - coverageEntity.getCoveredCount() - : testCoverageStatusEntity.getUpdatedCoveredLineCount() - + coverageEntity.getCoveredCount(); - Long newTotalLineCount = - cmd.equals("disable") - ? testCoverageStatusEntity.getUpdatedTotalLineCount() - - coverageEntity.getTotalCount() - : testCoverageStatusEntity.getUpdatedTotalLineCount() - + coverageEntity.getTotalCount(); - testCoverageStatusEntity.setUpdatedCoveredLineCount(newCoveredLineCount); - testCoverageStatusEntity.setUpdatedTotalLineCount(newTotalLineCount); - testCoverageStatusEntity.save(); - - String json = new Gson().toJson("Success!"); - return json; - } -} diff --git a/src/main/java/com/android/vts/api/DataRestServlet.java b/src/main/java/com/android/vts/api/DataRestServlet.java deleted file mode 100644 index 409818e..0000000 --- a/src/main/java/com/android/vts/api/DataRestServlet.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2018 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.api; - -import com.android.vts.entity.BranchEntity; -import com.android.vts.entity.TestCoverageStatusEntity; -import com.google.gson.Gson; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.List; -import java.util.Objects; -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.android.vts.entity.BuildTargetEntity; - -/** REST endpoint for getting all branch and buildFlavors information. */ -public class DataRestServlet extends BaseApiServlet { - - private static final Logger logger = Logger.getLogger(DataRestServlet.class.getName()); - - @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - String pathInfo = request.getPathInfo(); - String json = ""; - if (Objects.nonNull(pathInfo)) { - String schKey = - Objects.isNull(request.getParameter("schKey")) - ? "" - : request.getParameter("schKey"); - if (pathInfo.equalsIgnoreCase("/branch")) { - json = new Gson().toJson(BranchEntity.getByBranch(schKey)); - } else if (pathInfo.equalsIgnoreCase("/device")) { - json = new Gson().toJson(BuildTargetEntity.getByBuildTarget(schKey)); - } else if (pathInfo.startsWith("/code/coverage/status/")) { - List<TestCoverageStatusEntity> testCoverageStatusEntityList = - TestCoverageStatusEntity.getAllTestCoverage(); - if (pathInfo.endsWith("branch")) { - json = - new Gson() - .toJson( - TestCoverageStatusEntity.getBranchSet( - testCoverageStatusEntityList)); - } else { - json = - new Gson() - .toJson( - TestCoverageStatusEntity.getDeviceSet( - testCoverageStatusEntityList)); - } - } else { - json = "{error: 'true', message: 'unexpected path!!!'}"; - logger.log(Level.INFO, "Path Info => " + pathInfo); - logger.log(Level.WARNING, "Unknown path access!"); - } - } else { - json = "{error: 'true', message: 'the path info is not existed!!!'}"; - } - - response.setStatus(HttpServletResponse.SC_OK); - response.setContentType("application/json"); - response.setCharacterEncoding("UTF-8"); - response.getWriter().write(json); - } -} diff --git a/src/main/java/com/android/vts/api/DatastoreRestServlet.java b/src/main/java/com/android/vts/api/DatastoreRestServlet.java deleted file mode 100644 index fa0ae65..0000000 --- a/src/main/java/com/android/vts/api/DatastoreRestServlet.java +++ /dev/null @@ -1,556 +0,0 @@ -/* - * Copyright (c) 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.api; - -import com.android.vts.entity.ApiCoverageEntity; -import com.android.vts.entity.BranchEntity; -import com.android.vts.entity.BuildTargetEntity; -import com.android.vts.entity.CodeCoverageEntity; -import com.android.vts.entity.CoverageEntity; -import com.android.vts.entity.DashboardEntity; -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.HalApiEntity; -import com.android.vts.entity.ProfilingPointRunEntity; -import com.android.vts.entity.TestCaseRunEntity; -import com.android.vts.entity.TestEntity; -import com.android.vts.entity.TestPlanEntity; -import com.android.vts.entity.TestPlanRunEntity; -import com.android.vts.entity.TestRunEntity; -import com.android.vts.proto.VtsReportMessage; -import com.android.vts.proto.VtsReportMessage.DashboardPostMessage; -import com.android.vts.proto.VtsReportMessage.TestPlanReportMessage; -import com.android.vts.proto.VtsReportMessage.TestReportMessage; -import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; -import com.google.api.client.http.javanet.NetHttpTransport; -import com.google.api.client.json.jackson.JacksonFactory; -import com.google.api.services.oauth2.Oauth2; -import com.google.api.services.oauth2.model.Tokeninfo; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.google.appengine.api.datastore.Key; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.codec.binary.Base64; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -@Slf4j -/** REST endpoint for posting data to the Dashboard. */ -public class DatastoreRestServlet extends BaseApiServlet { - private static String SERVICE_CLIENT_ID; - private static final String SERVICE_NAME = "VTS Dashboard"; - - @Override - public void init(ServletConfig cfg) throws ServletException { - super.init(cfg); - - SERVICE_CLIENT_ID = this.systemConfigProp.getProperty("appengine.serviceClientID"); - } - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) - throws IOException { - // Retrieve the params - DashboardPostMessage postMessage; - try { - String payload = request.getReader().lines().collect(Collectors.joining()); - byte[] value = Base64.decodeBase64(payload); - postMessage = DashboardPostMessage.parseFrom(value); - } catch (IOException e) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - log.error("Invalid proto: " + e.getLocalizedMessage()); - return; - } - - String resultMsg = ""; - // Verify service account access token. - if (postMessage.hasAccessToken()) { - String accessToken = postMessage.getAccessToken(); - log.debug("accessToken => " + accessToken); - - GoogleCredential credential = new GoogleCredential().setAccessToken(accessToken); - Oauth2 oauth2 = - new Oauth2.Builder(new NetHttpTransport(), new JacksonFactory(), credential) - .setApplicationName(SERVICE_NAME) - .build(); - Tokeninfo tokenInfo = oauth2.tokeninfo().setAccessToken(accessToken).execute(); - if (tokenInfo.getIssuedTo().equals(SERVICE_CLIENT_ID)) { - for (TestReportMessage testReportMessage : postMessage.getTestReportList()) { - this.insertTestReport(testReportMessage); - } - - for (TestPlanReportMessage planReportMessage : - postMessage.getTestPlanReportList()) { - this.insertTestPlanReport(planReportMessage); - } - - 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 + "}"); - } - - /** - * Upload data from a test report message - * - * @param report The test report containing data to upload. - */ - private void insertTestReport(TestReportMessage report) { - - if (!report.hasStartTimestamp() - || !report.hasEndTimestamp() - || !report.hasTest() - || !report.hasHostInfo() - || !report.hasBuildInfo()) { - // missing information - log.error("Missing information in report !"); - return; - } - - List<TestEntity> testEntityList = new ArrayList<>(); - List<TestRunEntity> testRunEntityList = new ArrayList<>(); - List<BranchEntity> branchEntityList = new ArrayList<>(); - List<BuildTargetEntity> buildTargetEntityList = new ArrayList<>(); - List<CoverageEntity> coverageEntityList = new ArrayList<>(); - List<CodeCoverageEntity> codeCoverageEntityList = new ArrayList<>(); - List<DeviceInfoEntity> deviceInfoEntityList = new ArrayList<>(); - List<ProfilingPointRunEntity> profilingPointRunEntityList = new ArrayList<>(); - List<TestCaseRunEntity> testCaseRunEntityList = new ArrayList<>(); - List<ApiCoverageEntity> apiCoverageEntityList = new ArrayList<>(); - - List<?> allEntityList = - Arrays.asList( - testEntityList, - branchEntityList, - buildTargetEntityList, - coverageEntityList, - codeCoverageEntityList, - deviceInfoEntityList, - profilingPointRunEntityList, - testCaseRunEntityList, - apiCoverageEntityList, - testRunEntityList); - - long passCount = 0; - long failCount = 0; - long coveredLineCount = 0; - long totalLineCount = 0; - - Set<Key> buildTargetKeys = new HashSet<>(); - Set<Key> branchKeys = new HashSet<>(); - List<Key> profilingPointKeyList = new ArrayList<>(); - List<String> linkList = new ArrayList<>(); - - long startTimestamp = report.getStartTimestamp(); - long endTimestamp = report.getEndTimestamp(); - String testName = report.getTest().toStringUtf8(); - String testBuildId = report.getBuildInfo().getId().toStringUtf8(); - String hostName = report.getHostInfo().getHostname().toStringUtf8(); - - TestEntity testEntity = new TestEntity(testName); - - com.googlecode.objectify.Key testRunKey = - testEntity.getTestRunKey(report.getStartTimestamp()); - - testEntityList.add(testEntity); - - int testCaseRunEntityIndex = 0; - testCaseRunEntityList.add(new TestCaseRunEntity()); - // Process test cases - for (VtsReportMessage.TestCaseReportMessage testCase : report.getTestCaseList()) { - String testCaseName = testCase.getName().toStringUtf8(); - VtsReportMessage.TestCaseResult result = testCase.getTestResult(); - // Track global pass/fail counts - if (result == VtsReportMessage.TestCaseResult.TEST_CASE_RESULT_PASS) { - ++passCount; - } else if (result != VtsReportMessage.TestCaseResult.TEST_CASE_RESULT_SKIP) { - ++failCount; - } - if (testCase.getSystraceCount() > 0 - && testCase.getSystraceList().get(0).getUrlCount() > 0) { - String systraceLink = testCase.getSystraceList().get(0).getUrl(0).toStringUtf8(); - linkList.add(systraceLink); - } - - // Process coverage data for test case - for (VtsReportMessage.CoverageReportMessage coverage : testCase.getCoverageList()) { - CoverageEntity coverageEntity = - CoverageEntity.fromCoverageReport(testRunKey, testCaseName, coverage); - if (coverageEntity == null) { - log.warn("Invalid coverage report in test run " + testRunKey); - } else { - coveredLineCount += coverageEntity.getCoveredCount(); - totalLineCount += coverageEntity.getTotalCount(); - coverageEntityList.add(coverageEntity); - } - } - - // Process profiling data for test case - for (VtsReportMessage.ProfilingReportMessage profiling : testCase.getProfilingList()) { - ProfilingPointRunEntity profilingPointRunEntity = - ProfilingPointRunEntity.fromProfilingReport(testRunKey, profiling); - if (profilingPointRunEntity == null) { - log.warn("Invalid profiling report in test run " + testRunKey); - } else { - profilingPointRunEntityList.add(profilingPointRunEntity); - profilingPointKeyList.add(profilingPointRunEntity.getKey()); - testEntity.setHasProfilingData(true); - } - } - - TestCaseRunEntity testCaseRunEntity = testCaseRunEntityList.get(testCaseRunEntityIndex); - if (!testCaseRunEntity.addTestCase(testCaseName, result.getNumber())) { - testCaseRunEntity = new TestCaseRunEntity(); - testCaseRunEntity.addTestCase(testCaseName, result.getNumber()); - testCaseRunEntityList.add(testCaseRunEntity); - testCaseRunEntityIndex++; - } - } - - // Process device information - long testRunType = 0; - for (VtsReportMessage.AndroidDeviceInfoMessage device : report.getDeviceInfoList()) { - DeviceInfoEntity deviceInfoEntity = - DeviceInfoEntity.fromDeviceInfoMessage(testRunKey, device); - if (deviceInfoEntity == null) { - log.warn("Invalid device info in test run " + testRunKey); - } else { - // Run type on devices must be the same, else set to OTHER - TestRunEntity.TestRunType runType = - TestRunEntity.TestRunType.fromBuildId(deviceInfoEntity.getBuildId()); - if (runType == null) { - testRunType = TestRunEntity.TestRunType.OTHER.getNumber(); - } else { - testRunType = runType.getNumber(); - } - deviceInfoEntityList.add(deviceInfoEntity); - BuildTargetEntity target = new BuildTargetEntity(deviceInfoEntity.getBuildFlavor()); - if (buildTargetKeys.add(target.getKey())) { - buildTargetEntityList.add(target); - } - BranchEntity branch = new BranchEntity(deviceInfoEntity.getBranch()); - if (branchKeys.add(branch.getKey())) { - branchEntityList.add(branch); - } - } - } - - // Overall run type should be determined by the device builds unless test build is OTHER - if (testRunType == TestRunEntity.TestRunType.OTHER.getNumber()) { - testRunType = TestRunEntity.TestRunType.fromBuildId(testBuildId).getNumber(); - } else if (TestRunEntity.TestRunType.fromBuildId(testBuildId) - == TestRunEntity.TestRunType.OTHER) { - testRunType = TestRunEntity.TestRunType.OTHER.getNumber(); - } - - // Process global coverage data - for (VtsReportMessage.CoverageReportMessage coverage : report.getCoverageList()) { - CoverageEntity coverageEntity = - CoverageEntity.fromCoverageReport(testRunKey, new String(), coverage); - if (coverageEntity == null) { - log.warn("Invalid coverage report in test run " + testRunKey); - } else { - coveredLineCount += coverageEntity.getCoveredCount(); - totalLineCount += coverageEntity.getTotalCount(); - coverageEntityList.add(coverageEntity); - } - } - - // Process global API coverage data - for (VtsReportMessage.ApiCoverageReportMessage apiCoverage : report.getApiCoverageList()) { - VtsReportMessage.HalInterfaceMessage halInterfaceMessage = - apiCoverage.getHalInterface(); - List<String> halApiList = - apiCoverage - .getHalApiList() - .stream() - .map(h -> h.toStringUtf8()) - .collect(Collectors.toList()); - List<String> coveredHalApiList = - apiCoverage - .getCoveredHalApiList() - .stream() - .map(h -> h.toStringUtf8()) - .collect(Collectors.toList()); - ApiCoverageEntity apiCoverageEntity = - new ApiCoverageEntity( - testRunKey, - halInterfaceMessage.getHalPackageName().toStringUtf8(), - halInterfaceMessage.getHalVersionMajor(), - halInterfaceMessage.getHalVersionMinor(), - halInterfaceMessage.getHalInterfaceName().toStringUtf8(), - halApiList, - coveredHalApiList); - apiCoverageEntityList.add(apiCoverageEntity); - } - - // Process global profiling data - for (VtsReportMessage.ProfilingReportMessage profiling : report.getProfilingList()) { - ProfilingPointRunEntity profilingPointRunEntity = - ProfilingPointRunEntity.fromProfilingReport(testRunKey, profiling); - if (profilingPointRunEntity == null) { - log.warn("Invalid profiling report in test run " + testRunKey); - } else { - profilingPointRunEntityList.add(profilingPointRunEntity); - profilingPointKeyList.add(profilingPointRunEntity.getKey()); - testEntity.setHasProfilingData(true); - } - } - - // Process log data - for (VtsReportMessage.LogMessage log : report.getLogList()) { - if (log.hasUrl()) { - linkList.add(log.getUrl().toStringUtf8()); - } - } - // Process url resource - for (VtsReportMessage.UrlResourceMessage resource : report.getLinkResourceList()) { - if (resource.hasUrl()) { - linkList.add(resource.getUrl().toStringUtf8()); - } - } - - boolean hasCodeCoverage = totalLineCount > 0 && coveredLineCount >= 0; - TestRunEntity testRunEntity = - new TestRunEntity( - testEntity.getOldKey(), - testRunType, - startTimestamp, - endTimestamp, - testBuildId, - hostName, - passCount, - failCount, - hasCodeCoverage, - new ArrayList<>(), - linkList); - testRunEntityList.add(testRunEntity); - - CodeCoverageEntity codeCoverageEntity = - new CodeCoverageEntity( - testRunEntity.getId(), - testRunEntity.getKey(), - coveredLineCount, - totalLineCount); - codeCoverageEntityList.add(codeCoverageEntity); - - ofy().transact( - () -> { - List<Long> testCaseIds = new ArrayList<>(); - for (Object entity : allEntityList) { - if (entity instanceof List) { - List listEntity = (List) entity; - if (listEntity.size() > 0 - && listEntity.get(0) instanceof TestCaseRunEntity) { - Map< - com.googlecode.objectify.Key< - TestCaseRunEntity>, - TestCaseRunEntity> - testCaseRunEntityMap = - DashboardEntity.saveAll( - testCaseRunEntityList, - this - .MAX_ENTITY_SIZE_PER_TRANSACTION); - - testCaseIds = - testCaseRunEntityMap - .values() - .stream() - .map( - testCaseRunEntity -> - testCaseRunEntity.getId()) - .collect(Collectors.toList()); - } else if (listEntity.size() > 0 - && listEntity.get(0) instanceof TestRunEntity) { - testRunEntityList.get(0).setTestCaseIds(testCaseIds); - DashboardEntity.saveAll( - testRunEntityList, - this.MAX_ENTITY_SIZE_PER_TRANSACTION); - } else { - List<DashboardEntity> dashboardEntityList = - (List<DashboardEntity>) entity; - DashboardEntity.saveAll( - dashboardEntityList, - this.MAX_ENTITY_SIZE_PER_TRANSACTION); - } - } - } - }); - } - - /** - * Upload data from a test plan report message - * - * @param report The test plan report containing data to upload. - */ - private void insertTestPlanReport(TestPlanReportMessage report) { - List<DeviceInfoEntity> deviceInfoEntityList = new ArrayList<>(); - List<HalApiEntity> halApiEntityList = new ArrayList<>(); - - List allEntityList = Arrays.asList(deviceInfoEntityList, halApiEntityList); - - List<String> testModules = report.getTestModuleNameList(); - List<Long> testTimes = report.getTestModuleStartTimestampList(); - if (testModules.size() != testTimes.size() || !report.hasTestPlanName()) { - log.error("TestPlanReportMessage is missing information."); - return; - } - - String testPlanName = report.getTestPlanName(); - TestPlanEntity testPlanEntity = new TestPlanEntity(testPlanName); - List<com.googlecode.objectify.Key<TestRunEntity>> testRunKeyList = new ArrayList<>(); - for (int index = 0; index < testModules.size(); index++) { - String test = testModules.get(index); - long time = testTimes.get(index); - com.googlecode.objectify.Key testKey = - com.googlecode.objectify.Key.create(TestEntity.class, test); - com.googlecode.objectify.Key testRunKey = - com.googlecode.objectify.Key.create(testKey, TestRunEntity.class, time); - testRunKeyList.add(testRunKey); - } - - Map<com.googlecode.objectify.Key<TestRunEntity>, TestRunEntity> testRunEntityMap = - ofy().load().keys(() -> testRunKeyList.iterator()); - - long passCount = 0; - long failCount = 0; - long startTimestamp = -1; - long endTimestamp = -1; - String testBuildId = null; - long testType = -1; - Set<DeviceInfoEntity> deviceInfoEntitySet = new HashSet<>(); - for (TestRunEntity testRunEntity : testRunEntityMap.values()) { - passCount += testRunEntity.getPassCount(); - failCount += testRunEntity.getFailCount(); - if (startTimestamp < 0 || testRunEntity.getStartTimestamp() < startTimestamp) { - startTimestamp = testRunEntity.getStartTimestamp(); - } - if (endTimestamp < 0 || testRunEntity.getEndTimestamp() > endTimestamp) { - endTimestamp = testRunEntity.getEndTimestamp(); - } - testType = testRunEntity.getType(); - testBuildId = testRunEntity.getTestBuildId(); - - List<DeviceInfoEntity> deviceInfoEntityListWithTestRunKey = - ofy().load() - .type(DeviceInfoEntity.class) - .ancestor(testRunEntity.getOfyKey()) - .list(); - - for (DeviceInfoEntity deviceInfoEntity : deviceInfoEntityListWithTestRunKey) { - deviceInfoEntitySet.add(deviceInfoEntity); - } - } - - if (startTimestamp < 0 || testBuildId == null || testType == -1) { - log.debug("startTimestamp => " + startTimestamp); - log.debug("testBuildId => " + testBuildId); - log.debug("type => " + testType); - log.error("Couldn't infer test run information from runs."); - return; - } - - TestPlanRunEntity testPlanRunEntity = - new TestPlanRunEntity( - testPlanEntity.getKey(), - testPlanName, - testType, - startTimestamp, - endTimestamp, - testBuildId, - passCount, - failCount, - 0L, - 0L, - testRunKeyList); - - // Create the device infos. - for (DeviceInfoEntity device : deviceInfoEntitySet) { - deviceInfoEntityList.add(device.copyWithParent(testPlanRunEntity.getOfyKey())); - } - - // Process global HAL API coverage data - for (VtsReportMessage.ApiCoverageReportMessage apiCoverage : report.getHalApiReportList()) { - VtsReportMessage.HalInterfaceMessage halInterfaceMessage = - apiCoverage.getHalInterface(); - List<String> halApiList = - apiCoverage - .getHalApiList() - .stream() - .map(h -> h.toStringUtf8()) - .collect(Collectors.toList()); - List<String> coveredHalApiList = - apiCoverage - .getCoveredHalApiList() - .stream() - .map(h -> h.toStringUtf8()) - .collect(Collectors.toList()); - HalApiEntity halApiEntity = - new HalApiEntity( - testPlanRunEntity.getOfyKey(), - halInterfaceMessage.getHalReleaseLevel().toStringUtf8(), - halInterfaceMessage.getHalPackageName().toStringUtf8(), - halInterfaceMessage.getHalVersionMajor(), - halInterfaceMessage.getHalVersionMinor(), - halInterfaceMessage.getHalInterfaceName().toStringUtf8(), - halApiList, - coveredHalApiList); - halApiEntityList.add(halApiEntity); - } - - ofy().transact( - () -> { - testPlanEntity.save(); - testPlanRunEntity.save(); - for (Object entity : allEntityList) { - List<DashboardEntity> dashboardEntityList = - (List<DashboardEntity>) entity; - Map<com.googlecode.objectify.Key<DashboardEntity>, DashboardEntity> - mapInfo = - DashboardEntity.saveAll( - dashboardEntityList, - this.MAX_ENTITY_SIZE_PER_TRANSACTION); - } - }); - - // Add the task to calculate total number API list. - testPlanRunEntity.addCoverageApiTask(); - } -} diff --git a/src/main/java/com/android/vts/api/TestAcknowledgmentRestServlet.java b/src/main/java/com/android/vts/api/TestAcknowledgmentRestServlet.java deleted file mode 100644 index 309c3e2..0000000 --- a/src/main/java/com/android/vts/api/TestAcknowledgmentRestServlet.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.api; - -import com.android.vts.entity.TestAcknowledgmentEntity; -import com.android.vts.util.DatastoreHelper; -import com.google.appengine.api.datastore.DatastoreFailureException; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.DatastoreTimeoutException; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.datastore.Transaction; -import com.google.appengine.api.users.User; -import com.google.appengine.api.users.UserService; -import com.google.appengine.api.users.UserServiceFactory; -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.ConcurrentModificationException; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** Servlet for handling requests to fetch test acknowledgments. */ -public class TestAcknowledgmentRestServlet extends HttpServlet { - protected static final Logger logger = - Logger.getLogger(TestAcknowledgmentRestServlet.class.getName()); - - /** Read all test acknowledgments. */ - @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - - Query ackQuery = new Query(TestAcknowledgmentEntity.KIND); - List<JsonObject> testAcks = new ArrayList<>(); - for (Entity ackEntity : - datastore.prepare(ackQuery).asIterable(DatastoreHelper.getLargeBatchOptions())) { - TestAcknowledgmentEntity ack = TestAcknowledgmentEntity.fromEntity(ackEntity); - if (ack == null) continue; - testAcks.add(ack.toJson()); - } - response.setContentType("application/json"); - PrintWriter writer = response.getWriter(); - writer.print(new Gson().toJson(testAcks)); - writer.flush(); - } - - /** Create a test acknowledgment. */ - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) - throws IOException { - UserService userService = UserServiceFactory.getUserService(); - if (!userService.isUserAdmin()) { - response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); - return; - } - User currentUser = userService.getCurrentUser(); - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - - StringBuilder sb = new StringBuilder(); - BufferedReader br = new BufferedReader(request.getReader()); - String str; - while ((str = br.readLine()) != null) { - sb.append(str); - } - JsonObject json; - try { - json = new JsonParser().parse(sb.toString()).getAsJsonObject(); - } catch (IllegalStateException e) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return; - } - TestAcknowledgmentEntity ack = TestAcknowledgmentEntity.fromJson(currentUser, json); - Transaction txn = datastore.beginTransaction(); - try { - Key key = datastore.put(ack.toEntity()); - txn.commit(); - - response.setContentType("application/json"); - PrintWriter writer = response.getWriter(); - writer.print(new Gson().toJson(KeyFactory.keyToString(key))); - writer.flush(); - } catch (ConcurrentModificationException - | DatastoreFailureException - | DatastoreTimeoutException e) { - txn.rollback(); - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return; - } finally { - if (txn.isActive()) { - logger.log(Level.WARNING, "Transaction rollback forced acknowledgment post."); - txn.rollback(); - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return; - } - } - response.setStatus(HttpServletResponse.SC_OK); - } - - /** Remove a test acknowledgment. */ - @Override - public void doDelete(HttpServletRequest request, HttpServletResponse response) - throws IOException { - UserService userService = UserServiceFactory.getUserService(); - if (!userService.isUserAdmin()) { - response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); - return; - } - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - String stringKey = request.getPathInfo(); - if (stringKey == null) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return; - } - if (stringKey.startsWith("/")) { - stringKey = stringKey.substring(1); - } - Key key = KeyFactory.stringToKey(stringKey); - if (!key.getKind().equals(TestAcknowledgmentEntity.KIND)) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return; - } - datastore.delete(key); - response.setStatus(HttpServletResponse.SC_OK); - } -} diff --git a/src/main/java/com/android/vts/api/TestDataForDevServlet.java b/src/main/java/com/android/vts/api/TestDataForDevServlet.java deleted file mode 100644 index 2ed387b..0000000 --- a/src/main/java/com/android/vts/api/TestDataForDevServlet.java +++ /dev/null @@ -1,676 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.api; - -import com.android.vts.entity.BranchEntity; -import com.android.vts.entity.BuildTargetEntity; -import com.android.vts.entity.CodeCoverageEntity; -import com.android.vts.entity.CoverageEntity; -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.ProfilingPointRunEntity; -import com.android.vts.entity.TestCaseRunEntity; -import com.android.vts.entity.TestEntity; -import com.android.vts.entity.TestPlanEntity; -import com.android.vts.entity.TestPlanRunEntity; -import com.android.vts.entity.TestRunEntity; -import com.android.vts.entity.TestStatusEntity; -import com.android.vts.entity.TestStatusEntity.TestCaseReference; -import com.android.vts.entity.TestSuiteFileEntity; -import com.android.vts.entity.TestSuiteResultEntity; -import com.google.appengine.api.datastore.DatastoreFailureException; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.DatastoreTimeoutException; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.EntityNotFoundException; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.datastore.Transaction; -import com.google.appengine.api.users.User; -import com.google.appengine.api.users.UserService; -import com.google.appengine.api.users.UserServiceFactory; -import com.google.appengine.api.utils.SystemProperty; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.nio.file.FileSystems; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.time.Instant; -import java.time.temporal.ChronoUnit; -import java.util.Arrays; -import java.util.ArrayList; -import java.util.ConcurrentModificationException; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Random; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.IntStream; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** Servlet for handling requests to add mock data in datastore. */ -public class TestDataForDevServlet extends HttpServlet { - protected static final Logger logger = Logger.getLogger(TestDataForDevServlet.class.getName()); - - /** Google Cloud Storage project's default directory name for suite test result files */ - private static String GCS_SUITE_TEST_FOLDER_NAME; - - /** datastore instance to save the test data into datastore through datastore library. */ - private DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - /** - * Gson is a Java library that can be used to convert Java Objects into their JSON - * representation. It can also be used to convert a JSON string to an equivalent Java object. - */ - private Gson gson = new GsonBuilder().create(); - - /** System Configuration Property class */ - protected Properties systemConfigProp = new Properties(); - - @Override - public void init(ServletConfig cfg) throws ServletException { - super.init(cfg); - - try { - InputStream defaultInputStream = - TestDataForDevServlet.class - .getClassLoader() - .getResourceAsStream("config.properties"); - systemConfigProp.load(defaultInputStream); - - GCS_SUITE_TEST_FOLDER_NAME = systemConfigProp.getProperty("gcs.suiteTestFolderName"); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * TestReportData class for mapping test-report-data.json. This internal class's each fields - * will be automatically mapped to test-report-data.json file through Gson - */ - private class TestReportDataObject { - private List<Test> testList; - - private class Test { - private List<TestRun> testRunList; - - private class TestRun { - private String testName; - private int type; - private long startTimestamp; - private long endTimestamp; - private String testBuildId; - private String hostName; - private long passCount; - private long failCount; - private boolean hasCoverage; - private long coveredLineCount; - private long totalLineCount; - private List<Long> testCaseIds; - private List<Long> failingTestcaseIds; - private List<Integer> failingTestcaseOffsets; - private List<String> links; - - private List<Coverage> coverageList; - private List<Profiling> profilingList; - private List<TestCaseRun> testCaseRunList; - private List<DeviceInfo> deviceInfoList; - private List<BuildTarget> buildTargetList; - private List<Branch> branchList; - - private class Coverage { - private String group; - private long coveredLineCount; - private long totalLineCount; - private String filePath; - private String projectName; - private String projectVersion; - private List<Long> lineCoverage; - } - - private class Profiling { - private String name; - private int type; - private int regressionMode; - private List<String> labels; - private List<Long> values; - private String xLabel; - private String yLabel; - private List<String> options; - } - - private class TestCaseRun { - private List<String> testCaseNames; - private List<Integer> results; - } - - private class DeviceInfo { - private String branch; - private String product; - private String buildFlavor; - private String buildId; - private String abiBitness; - private String abiName; - } - - private class BuildTarget { - private String targetName; - } - - private class Branch { - private String branchName; - } - } - } - - @Override - public String toString() { - return "(" + testList + ")"; - } - } - - private class TestPlanReportDataObject { - private List<TestPlan> testPlanList; - - private class TestPlan { - - private String testPlanName; - private List<String> testModules; - private List<Long> testTimes; - } - - @Override - public String toString() { - return "(" + testPlanList + ")"; - } - } - - private Map<String, Object> generateSuiteTestData( - HttpServletRequest request, HttpServletResponse response) { - Map<String, Object> resultMap = new HashMap<>(); - String fileSeparator = FileSystems.getDefault().getSeparator(); - Random rand = new Random(); - List<String> branchList = Arrays.asList("master", "oc_mr", "oc"); - List<String> targetList = - Arrays.asList( - "sailfish-userdebug", - "marlin-userdebug", - "taimen-userdebug", - "walleye-userdebug", - "aosp_arm_a-userdebug"); - branchList.forEach( - branch -> - targetList.forEach( - target -> - IntStream.range(0, 10) - .forEach( - idx -> { - String year = - String.format( - "%04d", 2010 + idx); - String month = - String.format( - "%02d", - rand.nextInt(12)); - String day = - String.format( - "%02d", - rand.nextInt(30)); - String fileName = - String.format( - "%02d%02d%02d.bin", - rand.nextInt(23) + 1, - rand.nextInt(59) + 1, - rand.nextInt(59) + 1); - - List<String> pathList = - Arrays.asList( - GCS_SUITE_TEST_FOLDER_NAME - == "" - ? "suite_result" - : GCS_SUITE_TEST_FOLDER_NAME, - year, - month, - day, - fileName); - - Path pathInfo = - Paths.get( - String.join( - fileSeparator, - pathList)); - - TestSuiteFileEntity - newTestSuiteFileEntity = - new TestSuiteFileEntity( - pathInfo - .toString()); - - com.googlecode.objectify.Key< - TestSuiteFileEntity> - testSuiteFileParent = - com.googlecode.objectify - .Key.create( - TestSuiteFileEntity - .class, - newTestSuiteFileEntity - .getFilePath()); - - - TestSuiteResultEntity - testSuiteResultEntity = - new TestSuiteResultEntity( - testSuiteFileParent, - Instant.now() - .minus( - rand - .nextInt( - 100), - ChronoUnit - .DAYS) - .getEpochSecond(), - Instant.now() - .minus( - rand - .nextInt( - 100), - ChronoUnit - .DAYS) - .getEpochSecond(), - 1, - idx / 2 == 0 - ? false - : true, - pathInfo - .toString(), - idx / 2 == 0 - ? "/error/infra/log" - : "", - "Test Place Name -" - + idx, - "Suite Test Plan", - "Suite Version " - + idx, - "Suite Test Name", - "Suite Build Number " - + idx, - rand.nextInt(), - rand.nextInt(), - branch, - target, - Long.toString( - Math - .abs( - rand - .nextLong())), - "Build System Fingerprint " - + idx, - "Build Vendor Fingerprint " - + idx, - rand.nextInt(), - rand.nextInt()); - - testSuiteResultEntity.save(newTestSuiteFileEntity); - }))); - resultMap.put("result", "successfully generated!"); - return resultMap; - } - - @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - String requestUri = request.getRequestURI(); - String requestArgs = request.getQueryString(); - - Map<String, Object> resultMap = new HashMap<>(); - String pathInfo = requestUri.replace("/api/test_data/", ""); - switch (pathInfo) { - case "suite": - resultMap = this.generateSuiteTestData(request, response); - break; - default: - throw new IllegalArgumentException("Invalid path info of URL"); - } - - String json = new Gson().toJson(resultMap); - response.setStatus(HttpServletResponse.SC_OK); - response.setContentType("application/json"); - response.setCharacterEncoding("UTF-8"); - response.getWriter().write(json); - } - - /** Add mock data to local dev datastore. */ - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) - throws IOException { - if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Production) { - response.setStatus(HttpServletResponse.SC_NOT_ACCEPTABLE); - return; - } - - UserService userService = UserServiceFactory.getUserService(); - User currentUser = userService.getCurrentUser(); - - String pathInfo = request.getPathInfo(); - String[] pathParts = pathInfo.split("/"); - if (pathParts.length > 1) { - // Read the json output - Reader postJsonReader = new InputStreamReader(request.getInputStream()); - Gson gson = new GsonBuilder().create(); - - String testType = pathParts[1]; - if (testType.equalsIgnoreCase("report")) { - TestReportDataObject trdObj = - gson.fromJson(postJsonReader, TestReportDataObject.class); - logger.log(Level.INFO, "trdObj => " + trdObj); - trdObj.testList.forEach( - test -> { - test.testRunList.forEach( - testRun -> { - TestEntity testEntity = new TestEntity(testRun.testName); - - Key testRunKey = - KeyFactory.createKey( - testEntity.getOldKey(), - TestRunEntity.KIND, - testRun.startTimestamp); - - List<TestCaseReference> failingTestCases = - new ArrayList<>(); - for (int idx = 0; - idx < testRun.failingTestcaseIds.size(); - idx++) { - failingTestCases.add( - new TestCaseReference( - testRun.failingTestcaseIds.get(idx), - testRun.failingTestcaseOffsets.get( - idx))); - } - - TestStatusEntity testStatusEntity = - new TestStatusEntity( - testRun.testName, - testRun.startTimestamp, - (int) testRun.passCount, - failingTestCases.size(), - failingTestCases); - datastore.put(testStatusEntity.toEntity()); - - testRun.coverageList.forEach( - testRunCoverage -> { - CoverageEntity coverageEntity = - new CoverageEntity( - testRunKey, - testRunCoverage.group, - testRunCoverage - .coveredLineCount, - testRunCoverage.totalLineCount, - testRunCoverage.filePath, - testRunCoverage.projectName, - testRunCoverage.projectVersion, - testRunCoverage.lineCoverage); - datastore.put(coverageEntity.toEntity()); - }); - - testRun.profilingList.forEach( - testRunProfile -> { - ProfilingPointRunEntity profilingEntity = - new ProfilingPointRunEntity( - testRunKey, - testRunProfile.name, - testRunProfile.type, - testRunProfile.regressionMode, - testRunProfile.labels, - testRunProfile.values, - testRunProfile.xLabel, - testRunProfile.yLabel, - testRunProfile.options); - datastore.put(profilingEntity.toEntity()); - }); - - TestCaseRunEntity testCaseEntity = new TestCaseRunEntity(); - testRun.testCaseRunList.forEach( - testCaseRun -> { - for (int idx = 0; - idx < testCaseRun.testCaseNames.size(); - idx++) { - testCaseEntity.addTestCase( - testCaseRun.testCaseNames.get(idx), - testCaseRun.results.get(idx)); - } - }); - datastore.put(testCaseEntity.toEntity()); - - testRun.deviceInfoList.forEach( - deviceInfo -> { - DeviceInfoEntity deviceInfoEntity = - new DeviceInfoEntity( - testRunKey, - deviceInfo.branch, - deviceInfo.product, - deviceInfo.buildFlavor, - deviceInfo.buildId, - deviceInfo.abiBitness, - deviceInfo.abiName); - ; - datastore.put(deviceInfoEntity.toEntity()); - }); - - testRun.buildTargetList.forEach( - buildTarget -> { - BuildTargetEntity buildTargetEntity = - new BuildTargetEntity( - buildTarget.targetName); - buildTargetEntity.save(); - }); - - testRun.branchList.forEach( - branch -> { - BranchEntity branchEntity = - new BranchEntity(branch.branchName); - branchEntity.save(); - }); - - boolean hasCodeCoverage = - testRun.totalLineCount > 0 - && testRun.coveredLineCount >= 0; - TestRunEntity testRunEntity = - new TestRunEntity( - testEntity.getOldKey(), - testRun.type, - testRun.startTimestamp, - testRun.endTimestamp, - testRun.testBuildId, - testRun.hostName, - testRun.passCount, - testRun.failCount, - hasCodeCoverage, - testRun.testCaseIds, - testRun.links); - datastore.put(testRunEntity.toEntity()); - - CodeCoverageEntity codeCoverageEntity = - new CodeCoverageEntity( - testRunEntity.getKey(), - testRun.coveredLineCount, - testRun.totalLineCount); - datastore.put(codeCoverageEntity.toEntity()); - - Entity newTestEntity = testEntity.toEntity(); - - Transaction txn = datastore.beginTransaction(); - try { - // Check if test already exists in the datastore - try { - Entity oldTest = - datastore.get(testEntity.getOldKey()); - TestEntity oldTestEntity = - TestEntity.fromEntity(oldTest); - if (oldTestEntity == null - || !oldTestEntity.equals(testEntity)) { - datastore.put(newTestEntity); - } - } catch (EntityNotFoundException e) { - datastore.put(newTestEntity); - } - txn.commit(); - - } catch (ConcurrentModificationException - | DatastoreFailureException - | DatastoreTimeoutException e) { - logger.log( - Level.WARNING, - "Retrying test run insert: " - + newTestEntity.getKey()); - } finally { - if (txn.isActive()) { - logger.log( - Level.WARNING, - "Transaction rollback forced for run: " - + testRunEntity.getKey()); - txn.rollback(); - } - } - }); - }); - } else { - TestPlanReportDataObject tprdObj = - gson.fromJson(postJsonReader, TestPlanReportDataObject.class); - tprdObj.testPlanList.forEach( - testPlan -> { - Entity testPlanEntity = - new TestPlanEntity(testPlan.testPlanName).toEntity(); - List<Key> testRunKeys = new ArrayList<>(); - for (int idx = 0; idx < testPlan.testModules.size(); idx++) { - String test = testPlan.testModules.get(idx); - long time = testPlan.testTimes.get(idx); - Key parentKey = KeyFactory.createKey(TestEntity.KIND, test); - Key testRunKey = - KeyFactory.createKey(parentKey, TestRunEntity.KIND, time); - testRunKeys.add(testRunKey); - } - Map<Key, Entity> testRuns = datastore.get(testRunKeys); - long passCount = 0; - long failCount = 0; - long startTimestamp = -1; - long endTimestamp = -1; - String testBuildId = null; - long type = 0; - Set<DeviceInfoEntity> devices = new HashSet<>(); - for (Key testRunKey : testRuns.keySet()) { - TestRunEntity testRun = - TestRunEntity.fromEntity(testRuns.get(testRunKey)); - if (testRun == null) { - continue; // not a valid test run - } - passCount += testRun.getPassCount(); - failCount += testRun.getFailCount(); - if (startTimestamp < 0 || testRunKey.getId() < startTimestamp) { - startTimestamp = testRunKey.getId(); - } - if (endTimestamp < 0 || testRun.getEndTimestamp() > endTimestamp) { - endTimestamp = testRun.getEndTimestamp(); - } - type = testRun.getType(); - testBuildId = testRun.getTestBuildId(); - Query deviceInfoQuery = - new Query(DeviceInfoEntity.KIND).setAncestor(testRunKey); - for (Entity deviceInfoEntity : - datastore.prepare(deviceInfoQuery).asIterable()) { - DeviceInfoEntity device = - DeviceInfoEntity.fromEntity(deviceInfoEntity); - if (device == null) { - continue; // invalid entity - } - devices.add(device); - } - } - if (startTimestamp < 0 || testBuildId == null || type == 0) { - logger.log( - Level.WARNING, - "Couldn't infer test run information from runs."); - return; - } - TestPlanRunEntity testPlanRun = - new TestPlanRunEntity( - testPlanEntity.getKey(), - testPlan.testPlanName, - type, - startTimestamp, - endTimestamp, - testBuildId, - passCount, - failCount, - 0L, - 0L, - testRunKeys); - - // Create the device infos. - for (DeviceInfoEntity device : devices) { - datastore.put( - device.copyWithParent(testPlanRun.getOfyKey()).toEntity()); - } - datastore.put(testPlanRun.toEntity()); - - Transaction txn = datastore.beginTransaction(); - try { - // Check if test already exists in the database - try { - datastore.get(testPlanEntity.getKey()); - } catch (EntityNotFoundException e) { - datastore.put(testPlanEntity); - } - txn.commit(); - } catch (ConcurrentModificationException - | DatastoreFailureException - | DatastoreTimeoutException e) { - logger.log( - Level.WARNING, - "Retrying test plan insert: " + testPlanEntity.getKey()); - } finally { - if (txn.isActive()) { - logger.log( - Level.WARNING, - "Transaction rollback forced for plan run: " - + testPlanRun.key); - txn.rollback(); - } - } - }); - } - } else { - logger.log(Level.WARNING, "URL path parameter is omitted!"); - } - - response.setStatus(HttpServletResponse.SC_OK); - } -} diff --git a/src/main/java/com/android/vts/api/TestRunRestServlet.java b/src/main/java/com/android/vts/api/TestRunRestServlet.java deleted file mode 100644 index 90fd3f9..0000000 --- a/src/main/java/com/android/vts/api/TestRunRestServlet.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.api; - -import com.android.vts.entity.TestCaseRunEntity; -import com.android.vts.entity.TestEntity; -import com.android.vts.entity.TestRunEntity; -import com.android.vts.util.TestRunDetails; -import com.google.gson.Gson; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.logging.Logger; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -/** Servlet for handling requests to fetch test case results. */ -public class TestRunRestServlet extends BaseApiServlet { - private static final String LATEST = "latest"; - protected static final Logger logger = Logger.getLogger(TestRunRestServlet.class.getName()); - - /** - * Get the test case results for the specified run of the specified test. - * - * @param test The test whose test cases to get. - * @param timeString The string representation of the test run timestamp (in microseconds). - * @return A TestRunDetails object with the test case details for the specified run. - */ - private TestRunDetails getTestRunDetails(String test, String timeString) { - long timestamp; - try { - timestamp = Long.parseLong(timeString); - if (timestamp <= 0) throw new NumberFormatException(); - timestamp = timestamp > 0 ? timestamp : null; - } catch (NumberFormatException e) { - return null; - } - - TestRunEntity testRunEntity = TestRunEntity.getByTestNameId(test, timestamp); - - return getTestRunDetails(testRunEntity); - } - - /** - * Get the test case results for the latest run of the specified test. - * - * @param testName The test whose test cases to get. - * @return A TestRunDetails object with the test case details for the latest run. - */ - private TestRunDetails getLatestTestRunDetails(String testName) { - com.googlecode.objectify.Key testKey = - com.googlecode.objectify.Key.create( - TestEntity.class, testName); - - TestRunEntity testRun = ofy().load().type(TestRunEntity.class).ancestor(testKey) - .filter("type", 2).orderKey(true).first().now(); - - if (testRun == null) return null; - - return getTestRunDetails(testRun); - } - - /** - * Get TestRunDetails instance from codeCoverageEntity instance. - * - * @param testRunEntity The TestRunEntity to access testCaseId. - * @return A TestRunDetails object with the test case details for the latest run. - */ - private TestRunDetails getTestRunDetails(TestRunEntity testRunEntity) { - TestRunDetails details = new TestRunDetails(); - List<com.googlecode.objectify.Key<TestCaseRunEntity>> testCaseKeyList = new ArrayList<>(); - if ( Objects.isNull(testRunEntity.getTestCaseIds()) ) { - return details; - } else { - for (long testCaseId : testRunEntity.getTestCaseIds()) { - testCaseKeyList.add( - com.googlecode.objectify.Key.create(TestCaseRunEntity.class, testCaseId)); - } - Map<com.googlecode.objectify.Key<TestCaseRunEntity>, TestCaseRunEntity> - testCaseRunEntityKeyMap = ofy().load().keys(() -> testCaseKeyList.iterator()); - testCaseRunEntityKeyMap.forEach((key, value) -> details.addTestCase(value)); - } - return details; - } - - /** - * Get the test case details for a test run. - * - * Expected format: (1) /api/test_run?test=[test name]×tamp=[timestamp] to the details - * for a specific run, or (2) /api/test_run?test=[test name]×tamp=latest -- the details for - * the latest test run. - */ - @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - String test = request.getParameter("test"); - String timeString = request.getParameter("timestamp"); - TestRunDetails details = null; - - if (timeString != null && timeString.equals(LATEST)) { - details = getLatestTestRunDetails(test); - } else if (timeString != null) { - details = getTestRunDetails(test, timeString); - } - - if (details == null) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - } else { - response.setStatus(HttpServletResponse.SC_OK); - response.setContentType("application/json"); - PrintWriter writer = response.getWriter(); - writer.print(new Gson().toJson(details.toJson())); - writer.flush(); - } - } -} diff --git a/src/main/java/com/android/vts/api/TestSuiteResultRestServlet.java b/src/main/java/com/android/vts/api/TestSuiteResultRestServlet.java deleted file mode 100644 index 38be2c0..0000000 --- a/src/main/java/com/android/vts/api/TestSuiteResultRestServlet.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2018 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.api; - -import com.android.vts.entity.TestSuiteFileEntity; -import com.android.vts.entity.TestSuiteResultEntity; -import com.android.vts.proto.TestSuiteResultMessageProto; -import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; -import com.google.api.client.http.javanet.NetHttpTransport; -import com.google.api.client.json.jackson.JacksonFactory; -import com.google.api.services.oauth2.Oauth2; -import com.google.api.services.oauth2.model.Tokeninfo; -import com.google.gson.Gson; -import com.googlecode.objectify.Key; -import org.apache.commons.codec.binary.Base64; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Collectors; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; - -/** REST endpoint for posting test suite data to the Dashboard. */ -public class TestSuiteResultRestServlet extends BaseApiServlet { - private static String SERVICE_CLIENT_ID; - private static final String SERVICE_NAME = "VTS Dashboard"; - private static final Logger logger = - Logger.getLogger(TestSuiteResultRestServlet.class.getName()); - - @Override - public void init(ServletConfig cfg) throws ServletException { - super.init(cfg); - - SERVICE_CLIENT_ID = systemConfigProp.getProperty("appengine.serviceClientID"); - } - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) - throws IOException { - // Retrieve the params - TestSuiteResultMessageProto.TestSuiteResultMessage testSuiteResultMessage; - try { - String payload = request.getReader().lines().collect(Collectors.joining()); - byte[] value = Base64.decodeBase64(payload); - testSuiteResultMessage = - TestSuiteResultMessageProto.TestSuiteResultMessage.parseFrom(value); - } catch (IOException e) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - logger.log(Level.WARNING, "Invalid proto: " + e.getLocalizedMessage()); - return; - } - - Map<String, Object> resultMap = new HashMap<>(); - // Verify service account access token. - if (testSuiteResultMessage.hasAccessToken()) { - String accessToken = testSuiteResultMessage.getAccessToken(); - logger.log(Level.INFO, "accessToken => " + accessToken); - GoogleCredential credential = new GoogleCredential().setAccessToken(accessToken); - Oauth2 oauth2 = - new Oauth2.Builder(new NetHttpTransport(), new JacksonFactory(), credential) - .setApplicationName(SERVICE_NAME) - .build(); - Tokeninfo tokenInfo = oauth2.tokeninfo().setAccessToken(accessToken).execute(); - - if (tokenInfo.getIssuedTo().equals(SERVICE_CLIENT_ID)) { - String filePath = "suite_result/2019/04/06/132343.bin"; - Key<TestSuiteFileEntity> testSuiteFileParent = - Key.create(TestSuiteFileEntity.class, filePath); - TestSuiteFileEntity newTestSuiteFileEntity = new TestSuiteFileEntity(filePath); - TestSuiteResultEntity testSuiteResultEntity = - new TestSuiteResultEntity( - testSuiteFileParent, - testSuiteResultMessage.getStartTime(), - testSuiteResultMessage.getEndTime(), - testSuiteResultMessage.getTestType(), - testSuiteResultMessage.getBootSuccess(), - testSuiteResultMessage.getResultPath(), - testSuiteResultMessage.getInfraLogPath(), - testSuiteResultMessage.getHostName(), - testSuiteResultMessage.getSuitePlan(), - testSuiteResultMessage.getSuiteVersion(), - testSuiteResultMessage.getSuiteName(), - testSuiteResultMessage.getSuiteBuildNumber(), - testSuiteResultMessage.getModulesDone(), - testSuiteResultMessage.getModulesTotal(), - testSuiteResultMessage.getBranch(), - testSuiteResultMessage.getTarget(), - testSuiteResultMessage.getBuildId(), - testSuiteResultMessage.getBuildSystemFingerprint(), - testSuiteResultMessage.getBuildVendorFingerprint(), - testSuiteResultMessage.getPassedTestCaseCount(), - testSuiteResultMessage.getFailedTestCaseCount()); - - testSuiteResultEntity.save(newTestSuiteFileEntity); - resultMap.put("result", "successfully saved!"); - } else { - logger.log(Level.WARNING, "service_client_id didn't match!"); - logger.log(Level.INFO, "SERVICE_CLIENT_ID => " + tokenInfo.getIssuedTo()); - resultMap.put("result", "Wrong Service Client ID!"); - } - } else { - logger.log(Level.WARNING, "postMessage do not contain any accessToken!"); - resultMap.put("result", "Access Token Missing!"); - } - String json = new Gson().toJson(resultMap); - response.setStatus(HttpServletResponse.SC_OK); - response.setContentType("application/json"); - response.setCharacterEncoding("UTF-8"); - response.getWriter().write(json); - } -} diff --git a/src/main/java/com/android/vts/api/UserFavoriteRestServlet.java b/src/main/java/com/android/vts/api/UserFavoriteRestServlet.java deleted file mode 100644 index 30fd649..0000000 --- a/src/main/java/com/android/vts/api/UserFavoriteRestServlet.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.api; - -import com.android.vts.entity.TestEntity; -import com.android.vts.entity.UserFavoriteEntity; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.EntityNotFoundException; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.datastore.Query.CompositeFilterOperator; -import com.google.appengine.api.datastore.Query.Filter; -import com.google.appengine.api.datastore.Query.FilterOperator; -import com.google.appengine.api.datastore.Query.FilterPredicate; -import com.google.appengine.api.datastore.Transaction; -import com.google.appengine.api.users.User; -import com.google.appengine.api.users.UserService; -import com.google.appengine.api.users.UserServiceFactory; -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** Servlet for handling requests to add or remove subscriptions. */ -public class UserFavoriteRestServlet extends BaseApiServlet { - protected static final Logger logger = - Logger.getLogger(UserFavoriteRestServlet.class.getName()); - - /** - * Add a new favorite entity. - * - * @param user The user for which to add a favorite. - * @param test The name of the test. - * @param muteNotifications True if the subscriber has muted notifications, false otherwise. - * @param response The servlet response object. - * @return a json object with the generated key to the new favorite entity. - * @throws IOException - */ - private static JsonObject addFavorite( - User user, String test, boolean muteNotifications, HttpServletResponse response) - throws IOException { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - Key addedTestKey = KeyFactory.createKey(TestEntity.KIND, test); - // Filter the tests that exist from the set of tests to add - try { - datastore.get(addedTestKey); - } catch (EntityNotFoundException e) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return null; - } - - Filter userFilter = - new FilterPredicate(UserFavoriteEntity.USER, FilterOperator.EQUAL, user); - Filter testFilter = - new FilterPredicate( - UserFavoriteEntity.TEST_KEY, FilterOperator.EQUAL, addedTestKey); - Query q = - new Query(UserFavoriteEntity.KIND) - .setFilter(CompositeFilterOperator.and(userFilter, testFilter)) - .setKeysOnly(); - - Key favoriteKey = null; - - Transaction txn = datastore.beginTransaction(); - try { - for (Entity e : datastore.prepare(q).asIterable()) { - favoriteKey = e.getKey(); - break; - } - if (favoriteKey == null) { - UserFavoriteEntity favorite = - new UserFavoriteEntity(user, addedTestKey, muteNotifications); - Entity entity = favorite.toEntity(); - datastore.put(entity); - favoriteKey = entity.getKey(); - } - txn.commit(); - } finally { - if (txn.isActive()) { - logger.log( - Level.WARNING, - "Transaction rollback forced for favorite creation: " + test); - txn.rollback(); - } - } - JsonObject json = new JsonObject(); - json.add("key", new JsonPrimitive(KeyFactory.keyToString(favoriteKey))); - return json; - } - - /** - * @param user The user for which to add a favorite. - * @param favoriteKey The database key to the favorite entity to update. - * @param muteNotifications True if the subscriber has muted notifications, false otherwise. - * @param response The servlet response object. - * @return a json object with the generated key to the new favorite entity. - * @throws IOException - */ - private static JsonObject updateFavorite( - User user, Key favoriteKey, boolean muteNotifications, HttpServletResponse response) - throws IOException { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - Entity favoriteEntity; - try { - favoriteEntity = datastore.get(favoriteKey); - } catch (EntityNotFoundException e) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return null; - } - UserFavoriteEntity favorite = UserFavoriteEntity.fromEntity(favoriteEntity); - if (favorite.user.getUserId() == user.getUserId()) { - response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); - return null; - } - if (favorite.muteNotifications != muteNotifications) { - Transaction txn = datastore.beginTransaction(); - try { - favorite.muteNotifications = muteNotifications; - datastore.put(favorite.toEntity()); - txn.commit(); - } finally { - if (txn.isActive()) { - logger.log( - Level.WARNING, - "Transaction rollback forced for favorite update: " + favoriteKey); - txn.rollback(); - } - } - } - JsonObject json = new JsonObject(); - json.add("key", new JsonPrimitive(KeyFactory.keyToString(favoriteKey))); - return json; - } - - /** Add a test to the user's favorites. */ - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) - throws IOException { - UserService userService = UserServiceFactory.getUserService(); - User currentUser = userService.getCurrentUser(); - - boolean muteNotifications = false; - if (request.getParameter(UserFavoriteEntity.MUTE_NOTIFICATIONS) != null) { - muteNotifications = - Boolean.parseBoolean( - request.getParameter(UserFavoriteEntity.MUTE_NOTIFICATIONS)); - } - - String userFavoritesKeyString = request.getParameter("userFavoritesKey"); - String testName = request.getParameter("testName"); - - JsonObject returnData = null; - if (userFavoritesKeyString != null) { - Key userFavoritesKey = KeyFactory.stringToKey(userFavoritesKeyString); - returnData = updateFavorite(currentUser, userFavoritesKey, muteNotifications, response); - } else if (testName != null) { - returnData = addFavorite(currentUser, testName, muteNotifications, response); - } - - if (returnData != null) { - response.setContentType("application/json"); - PrintWriter writer = response.getWriter(); - writer.print(new Gson().toJson(returnData)); - writer.flush(); - } - } - - /** Remove a test from the user's favorites. */ - @Override - public void doDelete(HttpServletRequest request, HttpServletResponse response) - throws IOException { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - String stringKey = request.getPathInfo(); - if (stringKey == null) { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return; - } - if (stringKey.startsWith("/")) { - stringKey = stringKey.substring(1); - } - datastore.delete(KeyFactory.stringToKey(stringKey)); - response.setStatus(HttpServletResponse.SC_OK); - } -} diff --git a/src/main/java/com/android/vts/config/ObjectifyListener.java b/src/main/java/com/android/vts/config/ObjectifyListener.java deleted file mode 100644 index 02e0215..0000000 --- a/src/main/java/com/android/vts/config/ObjectifyListener.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.config; - -import com.android.vts.entity.ApiCoverageEntity; -import com.android.vts.entity.BranchEntity; -import com.android.vts.entity.BuildTargetEntity; -import com.android.vts.entity.ApiCoverageExcludedEntity; -import com.android.vts.entity.CodeCoverageEntity; -import com.android.vts.entity.CoverageEntity; -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.HalApiEntity; -import com.android.vts.entity.ProfilingPointEntity; -import com.android.vts.entity.ProfilingPointRunEntity; -import com.android.vts.entity.ProfilingPointSummaryEntity; -import com.android.vts.entity.RoleEntity; -import com.android.vts.entity.TestAcknowledgmentEntity; -import com.android.vts.entity.TestCaseRunEntity; -import com.android.vts.entity.TestCoverageStatusEntity; -import com.android.vts.entity.TestEntity; -import com.android.vts.entity.TestPlanEntity; -import com.android.vts.entity.TestPlanRunEntity; -import com.android.vts.entity.TestRunEntity; -import com.android.vts.entity.TestStatusEntity; -import com.android.vts.entity.TestSuiteFileEntity; -import com.android.vts.entity.TestSuiteResultEntity; -import com.android.vts.entity.UserEntity; -import com.google.api.client.extensions.appengine.datastore.AppEngineDataStoreFactory; -import com.google.api.services.sheets.v4.SheetsScopes; -import com.googlecode.objectify.ObjectifyService; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Optional; -import java.util.function.Supplier; -import java.util.stream.Stream; -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.annotation.WebListener; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** The @WebListener annotation for registering a class as a listener of a web application. */ -@WebListener -/** - * Initializing Objectify Service at the container start up before any web components like servlet - * get initialized. - */ -public class ObjectifyListener implements ServletContextListener { - - private static final Logger logger = Logger.getLogger(ObjectifyListener.class.getName()); - - - /** Global instance of the DataStoreFactory. */ - private static final AppEngineDataStoreFactory DATA_STORE_FACTORY = - AppEngineDataStoreFactory.getDefaultInstance(); - - /** Global instance of the scopes. */ - private static final List<String> GOOGLE_API_SCOPES = - Collections.singletonList(SheetsScopes.SPREADSHEETS_READONLY); - - /** - * Receives notification that the web application initialization process is starting. This - * function will register Entity classes for objectify. - */ - @Override - public void contextInitialized(ServletContextEvent servletContextEvent) { - ObjectifyService.init(); - ObjectifyService.register(BranchEntity.class); - ObjectifyService.register(BuildTargetEntity.class); - - ObjectifyService.register(HalApiEntity.class); - ObjectifyService.register(ApiCoverageEntity.class); - ObjectifyService.register(ApiCoverageExcludedEntity.class); - ObjectifyService.register(CodeCoverageEntity.class); - ObjectifyService.register(CoverageEntity.class); - ObjectifyService.register(DeviceInfoEntity.class); - ObjectifyService.register(TestCoverageStatusEntity.class); - - ObjectifyService.register(ProfilingPointEntity.class); - ObjectifyService.register(ProfilingPointRunEntity.class); - ObjectifyService.register(ProfilingPointSummaryEntity.class); - - ObjectifyService.register(TestEntity.class); - ObjectifyService.register(TestPlanEntity.class); - ObjectifyService.register(TestPlanRunEntity.class); - ObjectifyService.register(TestRunEntity.class); - ObjectifyService.register(TestCaseRunEntity.class); - ObjectifyService.register(TestStatusEntity.class); - ObjectifyService.register(TestSuiteFileEntity.class); - ObjectifyService.register(TestSuiteResultEntity.class); - ObjectifyService.register(TestAcknowledgmentEntity.class); - ObjectifyService.register(RoleEntity.class); - ObjectifyService.register(UserEntity.class); - ObjectifyService.begin(); - logger.log(Level.INFO, "Value Initialized from context."); - - Properties systemConfigProp = new Properties(); - - try { - InputStream defaultInputStream = - ObjectifyListener.class - .getClassLoader() - .getResourceAsStream("config.properties"); - - systemConfigProp.load(defaultInputStream); - - servletContextEvent - .getServletContext() - .setAttribute("systemConfigProp", systemConfigProp); - servletContextEvent - .getServletContext() - .setAttribute("dataStoreFactory", DATA_STORE_FACTORY); - servletContextEvent - .getServletContext() - .setAttribute("googleApiScopes", GOOGLE_API_SCOPES); - - String roleList = systemConfigProp.getProperty("user.roleList"); - Supplier<Stream<String>> streamSupplier = () -> Arrays.stream(roleList.split(",")); - this.createRoles(streamSupplier.get()); - - String adminEmail = systemConfigProp.getProperty("user.adminEmail"); - if (adminEmail.isEmpty()) { - logger.log(Level.WARNING, "Admin email is not properly set. Check config file"); - } else { - String adminName = systemConfigProp.getProperty("user.adminName"); - String adminCompany = systemConfigProp.getProperty("user.adminCompany"); - Optional<String> roleName = - streamSupplier.get().filter(r -> r.equals("admin")).findFirst(); - this.createAdminUser(adminEmail, adminName, adminCompany, roleName.orElse("admin")); - } - } catch (FileNotFoundException e) { - logger.log(Level.SEVERE, e.getMessage()); - } catch (IOException e) { - logger.log(Level.SEVERE, e.getMessage()); - } - } - - /** Receives notification that the ServletContext is about to be shut down. */ - @Override - public void contextDestroyed(ServletContextEvent servletContextEvent) { - ServletContext servletContext = servletContextEvent.getServletContext(); - logger.log(Level.INFO, "Value deleted from context."); - } - - private void createRoles(Stream<String> roleStream) { - roleStream - .map(role -> role.trim()) - .forEach( - roleName -> { - RoleEntity roleEntity = new RoleEntity(roleName); - roleEntity.save(); - }); - } - - private void createAdminUser(String email, String name, String company, String role) { - Optional<UserEntity> adminUserEntityOptional = - Optional.ofNullable(UserEntity.getAdminUser(email)); - if (adminUserEntityOptional.isPresent()) { - logger.log(Level.INFO, "The user is already registered."); - } else { - UserEntity userEntity = new UserEntity(email, name, company, role); - userEntity.setIsAdmin(true); - userEntity.save(); - logger.log(Level.INFO, "The user is saved successfully."); - } - } -} diff --git a/src/main/java/com/android/vts/config/ObjectifyWebFilter.java b/src/main/java/com/android/vts/config/ObjectifyWebFilter.java deleted file mode 100644 index 3813d0b..0000000 --- a/src/main/java/com/android/vts/config/ObjectifyWebFilter.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.config; - -import com.googlecode.objectify.ObjectifyFilter; - -import javax.servlet.annotation.WebFilter; - -/** Annotation used to declare a servlet filter. */ -@WebFilter(urlPatterns = {"/*"}) -/** - * Servlet filter for objectify library. Objectify requires a filter to clean up any thread-local - * transaction contexts and pending asynchronous operations that remain at the end of a request. - */ -public class ObjectifyWebFilter extends ObjectifyFilter {} diff --git a/src/main/java/com/android/vts/entity/ApiCoverageEntity.java b/src/main/java/com/android/vts/entity/ApiCoverageEntity.java deleted file mode 100644 index 9c74032..0000000 --- a/src/main/java/com/android/vts/entity/ApiCoverageEntity.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.googlecode.objectify.Key; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Entity; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Index; -import com.googlecode.objectify.annotation.Parent; -import java.util.Date; -import java.util.List; -import java.util.UUID; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** Entity Class for ApiCoverageEntity */ -@Cache -@Entity(name = "ApiCoverage") -@EqualsAndHashCode(of = "id") -@NoArgsConstructor -@JsonAutoDetect(fieldVisibility = Visibility.ANY) -@JsonIgnoreProperties({"id", "parent"}) -public class ApiCoverageEntity implements DashboardEntity { - - /** ApiCoverageEntity id field */ - @Id @Getter @Setter String id; - - @Parent @Getter Key<?> parent; - - /** HAL package name. e.g. android.hardware.foo. */ - @Index @Getter @Setter String halPackageName; - - /** HAL (major) version. e.g. 1. */ - @Index @Getter @Setter int halMajorVersion; - - /** HAL (minor) version. e.g. 0. */ - @Index @Getter @Setter int halMinorVersion; - - /** HAL interface name. e.g. IFoo. */ - @Index @Getter @Setter String halInterfaceName; - - /** List of HAL API */ - @Getter @Setter List<String> halApi; - - /** List of HAL covered API */ - @Getter @Setter List<String> coveredHalApi; - - /** When this record was created or updated */ - @Index Date updated; - - /** Constructor function for ApiCoverageEntity Class */ - public ApiCoverageEntity( - com.google.appengine.api.datastore.Key testRunKey, - String halPackageName, - int halVersionMajor, - int halVersionMinor, - String halInterfaceName, - List<String> halApi, - List<String> coveredHalApi) { - this.id = UUID.randomUUID().toString(); - this.parent = getParentKey(testRunKey); - - this.halPackageName = halPackageName; - this.halMajorVersion = halVersionMajor; - this.halMinorVersion = halVersionMinor; - this.halInterfaceName = halInterfaceName; - this.halApi = halApi; - this.coveredHalApi = coveredHalApi; - this.updated = new Date(); - } - - /** Constructor function for ApiCoverageEntity Class with objectify Key. */ - public ApiCoverageEntity( - Key testRunKey, - String halPackageName, - int halVersionMajor, - int halVersionMinor, - String halInterfaceName, - List<String> halApi, - List<String> coveredHalApi) { - this.id = UUID.randomUUID().toString(); - this.parent = testRunKey; - - this.halPackageName = halPackageName; - this.halMajorVersion = halVersionMajor; - this.halMinorVersion = halVersionMinor; - this.halInterfaceName = halInterfaceName; - this.halApi = halApi; - this.coveredHalApi = coveredHalApi; - this.updated = new Date(); - } - - /** Get objectify Key from datastore Key type */ - private Key getParentKey(com.google.appengine.api.datastore.Key testRunKey) { - Key testParentKey = Key.create(TestEntity.class, testRunKey.getParent().getName()); - return Key.create(testParentKey, TestRunEntity.class, testRunKey.getId()); - } - - /** Get UrlSafeKey from ApiCoverageEntity Information */ - public String getUrlSafeKey() { - Key uuidKey = Key.create(this.parent, ApiCoverageEntity.class, this.id); - return uuidKey.toUrlSafe(); - } - - /** Saving function for the instance of this class */ - @Override - public Key<ApiCoverageEntity> save() { - this.id = UUID.randomUUID().toString(); - this.updated = new Date(); - return ofy().save().entity(this).now(); - } - - /** Get List of ApiCoverageEntity by HAL interface name */ - public static ApiCoverageEntity getByUrlSafeKey(String urlSafeKey) { - return ofy().load() - .type(ApiCoverageEntity.class) - .filterKey(com.google.cloud.datastore.Key.fromUrlSafe(urlSafeKey)) - .first() - .now(); - } - - /** Get List of ApiCoverageEntity by HAL interface name */ - public static List<ApiCoverageEntity> getByInterfaceNameList(String halInterfaceName) { - return ofy().load() - .type(ApiCoverageEntity.class) - .filter("halInterfaceName", halInterfaceName) - .list(); - } - - /** Get List of ApiCoverageEntity by HAL package name */ - public static List<ApiCoverageEntity> getByPackageNameList(String packageName) { - return ofy().load() - .type(ApiCoverageEntity.class) - .filter("halPackageName", packageName) - .list(); - } -} diff --git a/src/main/java/com/android/vts/entity/ApiCoverageExcludedEntity.java b/src/main/java/com/android/vts/entity/ApiCoverageExcludedEntity.java deleted file mode 100644 index 61bd6a7..0000000 --- a/src/main/java/com/android/vts/entity/ApiCoverageExcludedEntity.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.googlecode.objectify.Key; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Entity; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Index; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.util.Date; -import java.util.List; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -/** - * This entity class contain the excluded API information. And this information will be used to - * calculate more precise the ratio of API coverage. - */ -@Cache -@Entity(name = "ApiCoverageExcluded") -@EqualsAndHashCode(of = "id") -@NoArgsConstructor -@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) -@JsonIgnoreProperties({"id", "parent"}) -public class ApiCoverageExcludedEntity implements DashboardEntity { - - /** ApiCoverageEntity id field */ - @Id @Getter @Setter private String id; - - /** Package name. e.g. android.hardware.foo. */ - @Index @Getter @Setter private String packageName; - - /** Major Version. e.g. 1, 2. */ - @Getter @Setter private int majorVersion; - - /** Minor Version. e.g. 0. */ - @Getter @Setter private int minorVersion; - - /** Interface name. e.g. IFoo. */ - @Index @Getter @Setter private String interfaceName; - - /** API Name */ - @Index @Getter @Setter private String apiName; - - /** The reason comment for the excluded API */ - @Getter @Setter private String comment; - - /** When this record was created or updated */ - @Index @Getter @Setter private Date updated; - - /** Constructor function for ApiCoverageExcludedEntity Class */ - public ApiCoverageExcludedEntity( - String packageName, - String version, - String interfaceName, - String apiName, - String comment) { - this.id = this.getObjectifyId(); - this.packageName = packageName; - this.interfaceName = interfaceName; - this.apiName = apiName; - this.comment = comment; - this.updated = new Date(); - - this.setVersions(version); - } - - /** Setting major and minor version from version string */ - private void setVersions(String version) { - String[] versionArray = version.split("[.]"); - if (versionArray.length == 0) { - this.majorVersion = 0; - this.minorVersion = 0; - } else if (versionArray.length == 1) { - this.majorVersion = Integer.parseInt(versionArray[0]); - this.minorVersion = 0; - } else { - this.majorVersion = Integer.parseInt(versionArray[0]); - this.minorVersion = Integer.parseInt(versionArray[1]); - } - } - - /** Getting objectify ID from the entity information */ - private String getObjectifyId() { - return this.packageName - + "." - + this.majorVersion - + "." - + this.minorVersion - + "." - + this.interfaceName - + "." - + this.apiName; - } - - /** Getting key from the entity */ - public Key<ApiCoverageExcludedEntity> getKey() { - return Key.create(ApiCoverageExcludedEntity.class, this.getObjectifyId()); - } - - /** Saving function for the instance of this class */ - @Override - public Key<ApiCoverageExcludedEntity> save() { - return ofy().save().entity(this).now(); - } - - /** Get All Key List of ApiCoverageExcludedEntity */ - public static List<Key<ApiCoverageExcludedEntity>> getAllKeyList() { - return ofy().load().type(ApiCoverageExcludedEntity.class).keys().list(); - } - -} diff --git a/src/main/java/com/android/vts/entity/BranchEntity.java b/src/main/java/com/android/vts/entity/BranchEntity.java deleted file mode 100644 index 1c9ea52..0000000 --- a/src/main/java/com/android/vts/entity/BranchEntity.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Id; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Collectors; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -@com.googlecode.objectify.annotation.Entity(name = "Branch") -@Cache -@Data -@NoArgsConstructor -/** Entity describing a branch. */ -public class BranchEntity implements DashboardEntity { - protected static final Logger logger = Logger.getLogger(BranchEntity.class.getName()); - - public static final String KIND = "Branch"; // The entity kind. - - @Id private String name; - - /** - * Create a BranchEntity object. - * - * @param branchName The name of the branch. - */ - public BranchEntity(String branchName) { - this.name = branchName; - } - - public Key getKey() { - return KeyFactory.createKey(KIND, this.name); - } - - /** find by branch name */ - public static List<String> getByBranch(String branchName) { - if (branchName.equals("*")) { - return ofy().load() - .type(BranchEntity.class) - .limit(100) - .list() - .stream() - .map(b -> b.name) - .collect(Collectors.toList()); - } else { - com.googlecode.objectify.Key startKey = - com.googlecode.objectify.Key.create(BranchEntity.class, branchName); - - int lastPosition = branchName.length() - 1; - int lastCharValue = branchName.charAt(lastPosition); - String nextChar = String.valueOf((char) (lastCharValue + 1)); - - String nextBranchName = branchName.substring(0, lastPosition) + nextChar; - com.googlecode.objectify.Key endKey = - com.googlecode.objectify.Key.create(BranchEntity.class, nextBranchName); - return ofy().load() - .type(BranchEntity.class) - .filterKey(">=", startKey) - .filterKey("<", endKey) - .list() - .stream() - .map(b -> b.name) - .collect(Collectors.toList()); - } - } - - /** Saving function for the instance of this class */ - @Override - public com.googlecode.objectify.Key<BranchEntity> save() { - return ofy().save().entity(this).now(); - } - - /** - * Convert an Entity object to a BranchEntity. - * - * @param e The entity to process. - * @return BranchEntity object with the properties from e, or null if incompatible. - */ - public static BranchEntity fromEntity(Entity e) { - if (!e.getKind().equals(KIND) || e.getKey().getName() == null) { - logger.log(Level.WARNING, "Missing branch attributes in entity: " + e.toString()); - return null; - } - String branchName = e.getKey().getName(); - return new BranchEntity(branchName); - } -} diff --git a/src/main/java/com/android/vts/entity/BuildTargetEntity.java b/src/main/java/com/android/vts/entity/BuildTargetEntity.java deleted file mode 100644 index 4180213..0000000 --- a/src/main/java/com/android/vts/entity/BuildTargetEntity.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Id; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Collectors; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -@com.googlecode.objectify.annotation.Entity(name = "BuildTarget") -@Cache -@Data -@NoArgsConstructor -/** Entity describing a build target. */ -public class BuildTargetEntity implements DashboardEntity { - protected static final Logger logger = Logger.getLogger(BuildTargetEntity.class.getName()); - - public static final String KIND = "BuildTarget"; // The entity kind. - - @Id private String name; - - /** - * Create a BuildTargetEntity object. - * - * @param targetName The name of the build target. - */ - public BuildTargetEntity(String targetName) { - this.name = targetName; - } - - public Key getKey() { - return KeyFactory.createKey(KIND, this.name); - } - /** Saving function for the instance of this class */ - @Override - public com.googlecode.objectify.Key<BuildTargetEntity> save() { - return ofy().save().entity(this).now(); - } - - /** find by Build Target Name */ - public static List<String> getByBuildTarget(String buildTargetName) { - if (buildTargetName.equals("*")) { - return ofy().load() - .type(BuildTargetEntity.class) - .limit(100) - .list() - .stream() - .map(b -> b.name) - .collect(Collectors.toList()); - } else { - com.googlecode.objectify.Key startKey = - com.googlecode.objectify.Key.create(BuildTargetEntity.class, buildTargetName); - - int lastPosition = buildTargetName.length() - 1; - int lastCharValue = buildTargetName.charAt(lastPosition); - String nextChar = String.valueOf((char) (lastCharValue + 1)); - - String nextBuildTargetName = buildTargetName.substring(0, lastPosition) + nextChar; - com.googlecode.objectify.Key endKey = - com.googlecode.objectify.Key.create( - BuildTargetEntity.class, nextBuildTargetName); - return ofy().load() - .type(BuildTargetEntity.class) - .filterKey(">=", startKey) - .filterKey("<", endKey) - .list() - .stream() - .map(b -> b.name) - .collect(Collectors.toList()); - } - } - - /** - * Convert an Entity object to a BuildTargetEntity. - * - * @param e The entity to process. - * @return BuildTargetEntity object with the properties from e, or null if incompatible. - */ - public static BuildTargetEntity fromEntity(Entity e) { - if (!e.getKind().equals(KIND) || e.getKey().getName() == null) { - logger.log(Level.WARNING, "Missing build target attributes in entity: " + e.toString()); - return null; - } - String targetName = e.getKey().getName(); - return new BuildTargetEntity(targetName); - } -} diff --git a/src/main/java/com/android/vts/entity/CodeCoverageEntity.java b/src/main/java/com/android/vts/entity/CodeCoverageEntity.java deleted file mode 100644 index 2a46b1f..0000000 --- a/src/main/java/com/android/vts/entity/CodeCoverageEntity.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.google.appengine.api.datastore.KeyFactory; -import com.googlecode.objectify.Key; - -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Entity; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Index; -import com.googlecode.objectify.annotation.Parent; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.util.Date; -import java.util.logging.Logger; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -/** Entity Class for CodeCoverageEntity */ -@Cache -@Entity(name = "CodeCoverage") -@EqualsAndHashCode(of = "id") -@NoArgsConstructor -@JsonAutoDetect(fieldVisibility = Visibility.ANY) -@JsonIgnoreProperties({"id", "parent"}) -public class CodeCoverageEntity implements DashboardEntity { - protected static final Logger logger = Logger.getLogger(CodeCoverageEntity.class.getName()); - - public static final String KIND = "CodeCoverage"; - - public static final String COVERED_LINE_COUNT = "coveredLineCount"; - public static final String TOTAL_LINE_COUNT = "totalLineCount"; - - /** CodeCoverageEntity id field */ - @Id @Getter @Setter Long id; - - @Parent @Getter Key<?> parent; - - @Index @Getter @Setter private long coveredLineCount; - - @Index @Getter @Setter private long totalLineCount; - - /** When this record was created or updated */ - @Index Date updated; - - /** Constructor function for ApiCoverageEntity Class */ - public CodeCoverageEntity( - com.google.appengine.api.datastore.Key testRunKey, - long coveredLineCount, - long totalLineCount) { - - this.parent = getParentKey(testRunKey); - - this.coveredLineCount = coveredLineCount; - this.totalLineCount = totalLineCount; - } - - /** Constructor function for ApiCoverageEntity Class */ - public CodeCoverageEntity( - long id, - com.google.appengine.api.datastore.Key testRunKey, - long coveredLineCount, - long totalLineCount) { - this.id = id; - - this.parent = getParentKey(testRunKey); - - this.coveredLineCount = coveredLineCount; - this.totalLineCount = totalLineCount; - } - - /** Constructor function for ApiCoverageEntity Class with objectify key*/ - public CodeCoverageEntity(Key testRunKey, long coveredLineCount, long totalLineCount) { - this.parent = testRunKey; - this.coveredLineCount = coveredLineCount; - this.totalLineCount = totalLineCount; - } - - /** Get objectify Key from datastore Key type */ - private Key getParentKey(com.google.appengine.api.datastore.Key testRunKey) { - Key testParentKey = Key.create(TestEntity.class, testRunKey.getParent().getName()); - return Key.create(testParentKey, TestRunEntity.class, testRunKey.getId()); - } - - /** Get UrlSafeKey from ApiCoverageEntity Information */ - public String getUrlSafeKey() { - Key uuidKey = Key.create(this.parent, CodeCoverageEntity.class, this.id); - return uuidKey.toUrlSafe(); - } - - /** Saving function for the instance of this class */ - @Override - public Key<CodeCoverageEntity> save() { - this.id = this.getParent().getId(); - this.updated = new Date(); - return ofy().save().entity(this).now(); - } - - public com.google.appengine.api.datastore.Entity toEntity() { - com.google.appengine.api.datastore.Key testKey = - KeyFactory.createKey(TestEntity.KIND, this.getParent().getParent().getName()); - com.google.appengine.api.datastore.Key testRunKey = - KeyFactory.createKey(testKey, TestRunEntity.KIND, this.getParent().getId()); - com.google.appengine.api.datastore.Key codeCoverageKey = - KeyFactory.createKey(testRunKey, KIND, this.getParent().getId()); - - com.google.appengine.api.datastore.Entity codeCoverageEntity = - new com.google.appengine.api.datastore.Entity(codeCoverageKey); - codeCoverageEntity.setProperty(COVERED_LINE_COUNT, this.coveredLineCount); - codeCoverageEntity.setProperty(TOTAL_LINE_COUNT, this.totalLineCount); - codeCoverageEntity.setIndexedProperty("updated", new Date()); - return codeCoverageEntity; - } -} diff --git a/src/main/java/com/android/vts/entity/CodeCoverageFileEntity.java b/src/main/java/com/android/vts/entity/CodeCoverageFileEntity.java deleted file mode 100644 index fe4e8a0..0000000 --- a/src/main/java/com/android/vts/entity/CodeCoverageFileEntity.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.googlecode.objectify.Key; - -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Entity; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Index; -import com.googlecode.objectify.annotation.Parent; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.util.List; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -/** Entity Class for CodeCoverageFile */ -@Cache -@Entity(name = "CodeCoverageFile") -@EqualsAndHashCode(of = "id") -@NoArgsConstructor -public class CodeCoverageFileEntity implements DashboardEntity { - - /** CodeCoverageFileEntity testName field */ - @Id @Getter @Setter Long id; - - @Parent - @Getter @Setter private Key<?> coverageParent; - - /** CodeCoverageFileEntity filePath field */ - @Getter @Setter String filePath; - - /** CodeCoverageFileEntity group field */ - @Getter @Setter String group; - - /** CodeCoverageFileEntity lineCoverage field */ - @Getter @Setter List<Long> lineCoverage; - - /** CodeCoverageFileEntity coveredCount field */ - @Getter @Setter long coveredCount; - - /** CodeCoverageFileEntity totalCount field */ - @Getter @Setter long totalCount; - - /** CodeCoverageFileEntity projectName field */ - @Getter @Setter String projectName; - - /** CodeCoverageFileEntity projectVersion field */ - @Getter @Setter String projectVersion; - - /** CodeCoverageFileEntity isIgnored field */ - @Index - @Getter @Setter Boolean isIgnored; - - /** Constructor function for CodeCoverageFileEntity Class */ - public CodeCoverageFileEntity( - long id, - Key<?> coverageParent, - String filePath, - String group, - List<Long> lineCoverage, - long coveredCount, - long totalCount, - String projectName, - String projectVersion) { - this.id = id; - this.coverageParent = coverageParent; - this.filePath = filePath; - this.group = group; - this.lineCoverage = lineCoverage; - this.coveredCount = coveredCount; - this.totalCount = totalCount; - this.projectName = projectName; - this.projectVersion = projectVersion; - } - - /** Saving function for the instance of this class */ - @Override - public Key<CodeCoverageFileEntity> save() { - this.isIgnored = false; - return ofy().save().entity(this).now(); - } -} diff --git a/src/main/java/com/android/vts/entity/CoverageEntity.java b/src/main/java/com/android/vts/entity/CoverageEntity.java deleted file mode 100644 index 50d2f4e..0000000 --- a/src/main/java/com/android/vts/entity/CoverageEntity.java +++ /dev/null @@ -1,312 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -import com.android.vts.proto.VtsReportMessage.CoverageReportMessage; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Ignore; -import com.googlecode.objectify.annotation.Index; -import com.googlecode.objectify.annotation.Parent; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Objects; -import java.util.Properties; -import java.util.logging.Level; -import java.util.logging.Logger; -import lombok.Data; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@com.googlecode.objectify.annotation.Entity(name = "Coverage") -@Cache -@Data -@NoArgsConstructor -/** Object describing coverage data gathered for a file. */ -public class CoverageEntity implements DashboardEntity { - - protected static final Logger logger = Logger.getLogger(CoverageEntity.class.getName()); - - public static final String KIND = "Coverage"; - - public static String GERRIT_URI; - - // Property keys - public static final String GROUP = "group"; - public static final String COVERED_LINE_COUNT = "coveredCount"; - public static final String TOTAL_LINE_COUNT = "totalCount"; - public static final String FILE_PATH = "filePath"; - public static final String PROJECT_NAME = "projectName"; - public static final String PROJECT_VERSION = "projectVersion"; - public static final String LINE_COVERAGE = "lineCoverage"; - - @Ignore @Getter @Setter private Key parentKey; - - @Id @Getter @Setter private Long id; - - @Parent @Getter @Setter private com.googlecode.objectify.Key<?> testParent; - - @Index @Getter @Setter private String group; - - @Getter @Setter private long coveredCount; - - @Getter @Setter private long totalCount; - - @Index @Getter @Setter private String filePath; - - @Getter @Setter private String projectName; - - @Getter @Setter private String projectVersion; - - @Getter @Setter private List<Long> lineCoverage; - - /** CoverageEntity isIgnored field */ - @Index @Getter @Setter Boolean isIgnored; - - /** - * Create a CoverageEntity object for a file. - * - * @param parentKey The key to the parent TestRunEntity object in the database. - * @param group The group within the test run describing the coverage. - * @param coveredLineCount The total number of covered lines in the file. - * @param totalLineCount The total number of uncovered executable lines in the file. - * @param filePath The path to the file. - * @param projectName The name of the git project. - * @param projectVersion The commit hash of the project at the time the test was executed. - * @param lineCoverage List of coverage counts per executable line in the file. - */ - public CoverageEntity( - Key parentKey, - String group, - long coveredLineCount, - long totalLineCount, - String filePath, - String projectName, - String projectVersion, - List<Long> lineCoverage) { - this.parentKey = parentKey; - this.group = group; - this.coveredCount = coveredLineCount; - this.totalCount = totalLineCount; - this.filePath = filePath; - this.projectName = projectName; - this.projectVersion = projectVersion; - this.lineCoverage = lineCoverage; - } - - /** - * Create a CoverageEntity object for a file. - * - * @param testParent The objectify key to the parent TestRunEntity object in the database. - * @param group The group within the test run describing the coverage. - * @param coveredLineCount The total number of covered lines in the file. - * @param totalLineCount The total number of uncovered executable lines in the file. - * @param filePath The path to the file. - * @param projectName The name of the git project. - * @param projectVersion The commit hash of the project at the time the test was executed. - * @param lineCoverage List of coverage counts per executable line in the file. - */ - public CoverageEntity( - com.googlecode.objectify.Key testParent, - String group, - long coveredLineCount, - long totalLineCount, - String filePath, - String projectName, - String projectVersion, - List<Long> lineCoverage) { - this.testParent = testParent; - this.group = group; - this.coveredCount = coveredLineCount; - this.totalCount = totalLineCount; - this.filePath = filePath; - this.projectName = projectName; - this.projectVersion = projectVersion; - this.lineCoverage = lineCoverage; - } - - /** find coverage entity by ID */ - public static CoverageEntity findById(String testName, String testRunId, String id) { - com.googlecode.objectify.Key testKey = - com.googlecode.objectify.Key.create(TestEntity.class, testName); - com.googlecode.objectify.Key testRunKey = - com.googlecode.objectify.Key.create( - testKey, TestRunEntity.class, Long.parseLong(testRunId)); - return ofy().load() - .type(CoverageEntity.class) - .parent(testRunKey) - .id(Long.parseLong(id)) - .now(); - } - - public static void setPropertyValues(Properties newSystemConfigProp) { - GERRIT_URI = newSystemConfigProp.getProperty("gerrit.uri"); - } - - /** Saving function for the instance of this class */ - @Override - public com.googlecode.objectify.Key<CoverageEntity> save() { - return ofy().save().entity(this).now(); - } - - /** Get percentage from calculating coveredCount and totalCount values */ - public Double getPercentage() { - return Math.round(coveredCount * 10000d / totalCount) / 100d; - } - - /** Get Gerrit Url function from the attributes of this class */ - public String getGerritUrl() throws UnsupportedEncodingException { - String gerritPath = - GERRIT_URI - + "/projects/" - + URLEncoder.encode(projectName, "UTF-8") - + "/commits/" - + URLEncoder.encode(projectVersion, "UTF-8") - + "/files/" - + URLEncoder.encode(filePath, "UTF-8") - + "/content"; - return gerritPath; - } - - /* Comparator for sorting the list by isIgnored field */ - public static Comparator<CoverageEntity> isIgnoredComparator = - new Comparator<CoverageEntity>() { - - public int compare(CoverageEntity coverageEntity1, CoverageEntity coverageEntity2) { - Boolean isIgnored1 = - Objects.isNull(coverageEntity1.getIsIgnored()) - ? false - : coverageEntity1.getIsIgnored(); - Boolean isIgnored2 = - Objects.isNull(coverageEntity2.getIsIgnored()) - ? false - : coverageEntity2.getIsIgnored(); - - // ascending order - return isIgnored1.compareTo(isIgnored2); - } - }; - - public Entity toEntity() { - Entity coverageEntity = new Entity(KIND, parentKey); - coverageEntity.setProperty(GROUP, group); - coverageEntity.setUnindexedProperty(COVERED_LINE_COUNT, coveredCount); - coverageEntity.setUnindexedProperty(TOTAL_LINE_COUNT, totalCount); - coverageEntity.setProperty(FILE_PATH, filePath); - coverageEntity.setUnindexedProperty(PROJECT_NAME, projectName); - coverageEntity.setUnindexedProperty(PROJECT_VERSION, projectVersion); - if (lineCoverage != null && lineCoverage.size() > 0) { - coverageEntity.setUnindexedProperty(LINE_COVERAGE, lineCoverage); - } - return coverageEntity; - } - - /** - * Convert an Entity object to a CoverageEntity. - * - * @param e The entity to process. - * @return CoverageEntity object with the properties from e, or null if incompatible. - */ - @SuppressWarnings("unchecked") - public static CoverageEntity fromEntity(Entity e) { - if (!e.getKind().equals(KIND) - || !e.hasProperty(GROUP) - || !e.hasProperty(COVERED_LINE_COUNT) - || !e.hasProperty(TOTAL_LINE_COUNT) - || !e.hasProperty(FILE_PATH) - || !e.hasProperty(PROJECT_NAME) - || !e.hasProperty(PROJECT_VERSION)) { - logger.log(Level.WARNING, "Missing coverage attributes in entity: " + e.toString()); - return null; - } - try { - String group = (String) e.getProperty(GROUP); - long coveredLineCount = (long) e.getProperty(COVERED_LINE_COUNT); - long totalLineCount = (long) e.getProperty(TOTAL_LINE_COUNT); - String filePath = (String) e.getProperty(FILE_PATH); - String projectName = (String) e.getProperty(PROJECT_NAME); - String projectVersion = (String) e.getProperty(PROJECT_VERSION); - List<Long> lineCoverage; - if (e.hasProperty(LINE_COVERAGE)) { - lineCoverage = (List<Long>) e.getProperty(LINE_COVERAGE); - } else { - lineCoverage = new ArrayList<>(); - } - return new CoverageEntity( - e.getKey().getParent(), - group, - coveredLineCount, - totalLineCount, - filePath, - projectName, - projectVersion, - lineCoverage); - } catch (ClassCastException exception) { - // Invalid contents or null values - logger.log(Level.WARNING, "Error parsing coverage entity.", exception); - } - return null; - } - - /** - * Convert a coverage report to a CoverageEntity. - * - * @param parentKey The ancestor key for the coverage entity. - * @param group The group to display the coverage report with. - * @param coverage The coverage report containing coverage data. - * @return The CoverageEntity for the coverage report message, or null if not compatible. - */ - public static CoverageEntity fromCoverageReport( - com.googlecode.objectify.Key parentKey, String group, CoverageReportMessage coverage) { - if (!coverage.hasFilePath() - || !coverage.hasProjectName() - || !coverage.hasRevision() - || !coverage.hasTotalLineCount() - || !coverage.hasCoveredLineCount()) { - return null; // invalid coverage report; - } - long coveredLineCount = coverage.getCoveredLineCount(); - long totalLineCount = coverage.getTotalLineCount(); - String filePath = coverage.getFilePath().toStringUtf8(); - String projectName = coverage.getProjectName().toStringUtf8(); - String projectVersion = coverage.getRevision().toStringUtf8(); - List<Long> lineCoverage = null; - if (coverage.getLineCoverageVectorCount() > 0) { - lineCoverage = new ArrayList<>(); - for (long count : coverage.getLineCoverageVectorList()) { - lineCoverage.add(count); - } - } - return new CoverageEntity( - parentKey, - group, - coveredLineCount, - totalLineCount, - filePath, - projectName, - projectVersion, - lineCoverage); - } -} diff --git a/src/main/java/com/android/vts/entity/DashboardEntity.java b/src/main/java/com/android/vts/entity/DashboardEntity.java deleted file mode 100644 index a42c1eb..0000000 --- a/src/main/java/com/android/vts/entity/DashboardEntity.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.google.common.collect.Lists; -import com.googlecode.objectify.Key; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -/** Interface for interacting with VTS Dashboard entities in Cloud Datastore. */ -public interface DashboardEntity extends Serializable { - /** - * Save the Entity to the datastore. - * - * @return The saved entity's key value. - */ - <T> Key<T> save(); - - /** Save List of entity through objectify entities method. */ - static <T> Map<Key<T>, T> saveAll(List<T> entityList, int maxEntitySize) { - return ofy().transact( - () -> { - List<List<T>> partitionedList = - Lists.partition(entityList, maxEntitySize); - return partitionedList - .stream() - .map( - subEntityList -> - ofy().save().entities(subEntityList).now()) - .flatMap(m -> m.entrySet().stream()) - .collect( - Collectors.toMap( - entry -> entry.getKey(), - entry -> entry.getValue())); - }); - } -} diff --git a/src/main/java/com/android/vts/entity/DeviceInfoEntity.java b/src/main/java/com/android/vts/entity/DeviceInfoEntity.java deleted file mode 100644 index 2b98355..0000000 --- a/src/main/java/com/android/vts/entity/DeviceInfoEntity.java +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.memcache.MemcacheService; -import com.google.appengine.api.memcache.MemcacheServiceFactory; -import com.google.apphosting.api.ApiProxy; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Ignore; -import com.googlecode.objectify.annotation.Index; -import com.googlecode.objectify.annotation.Parent; -import java.util.List; -import java.util.Objects; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Collectors; - -import lombok.Data; -import lombok.NoArgsConstructor; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -@com.googlecode.objectify.annotation.Entity(name = "DeviceInfo") -@Cache -@Data -@NoArgsConstructor -/** Class describing a device used for a test run. */ -public class DeviceInfoEntity implements DashboardEntity { - protected static final Logger logger = Logger.getLogger(DeviceInfoEntity.class.getName()); - - /** This is the instance of App Engine memcache service java library */ - private static MemcacheService syncCache = MemcacheServiceFactory.getMemcacheService(); - - public static final String KIND = "DeviceInfo"; - - // Property keys - public static final String BRANCH = "branch"; - public static final String PRODUCT = "product"; - public static final String BUILD_FLAVOR = "buildFlavor"; - public static final String BUILD_ID = "buildId"; - public static final String ABI_BITNESS = "abiBitness"; - public static final String ABI_NAME = "abiName"; - - @Ignore - private Key parentKey; - - /** ID field using start timestamp */ - @Id private Long id; - - /** parent field based on Test and TestRun key */ - @Parent - private com.googlecode.objectify.Key<?> parent; - - @Index - private String branch; - - @Index - private String product; - - @Index - private String buildFlavor; - - @Index - private String buildId; - - private String abiBitness; - - private String abiName; - - /** - * Create a DeviceInfoEntity object. - * - * @param parentKey The key for the parent entity in the database. - * @param branch The build branch. - * @param product The device product. - * @param buildFlavor The device build flavor. - * @param buildID The device build ID. - * @param abiBitness The abi bitness of the device. - * @param abiName The name of the abi. - */ - public DeviceInfoEntity( - Key parentKey, - String branch, - String product, - String buildFlavor, - String buildID, - String abiBitness, - String abiName) { - this.parentKey = parentKey; - this.branch = branch; - this.product = product; - this.buildFlavor = buildFlavor; - this.buildId = buildID; - this.abiBitness = abiBitness; - this.abiName = abiName; - } - - /** - * Create a DeviceInfoEntity object with objectify Key - * - * @param parent The objectify key for the parent entity in the database. - * @param branch The build branch. - * @param product The device product. - * @param buildFlavor The device build flavor. - * @param buildID The device build ID. - * @param abiBitness The abi bitness of the device. - * @param abiName The name of the abi. - */ - public DeviceInfoEntity( - com.googlecode.objectify.Key parent, - String branch, - String product, - String buildFlavor, - String buildID, - String abiBitness, - String abiName) { - this.parent = parent; - this.branch = branch; - this.product = product; - this.buildFlavor = buildFlavor; - this.buildId = buildID; - this.abiBitness = abiBitness; - this.abiName = abiName; - } - - /** - * Get All Branch List from DeviceInfoEntity - */ - public static List<String> getAllBranches() { - try { - List<String> branchList = (List<String>) syncCache.get("branchList"); - if (Objects.isNull(branchList)) { - branchList = - ofy().load() - .type(DeviceInfoEntity.class) - .project("branch") - .distinct(true) - .list() - .stream() - .map(device -> device.branch) - .collect(Collectors.toList()); - syncCache.put("branchList", branchList); - } - return branchList; - } catch (ApiProxy.CallNotFoundException e) { - return ofy().load() - .type(DeviceInfoEntity.class) - .project("branch") - .distinct(true) - .list() - .stream() - .map(device -> device.branch) - .collect(Collectors.toList()); - } - } - - /** - * Get All BuildFlavors List from DeviceInfoEntity - */ - public static List<String> getAllBuildFlavors() { - try { - List<String> buildFlavorList = (List<String>) syncCache.get("buildFlavorList"); - if (Objects.isNull(buildFlavorList)) { - buildFlavorList = - ofy().load() - .type(DeviceInfoEntity.class) - .project("buildFlavor") - .distinct(true) - .list() - .stream() - .map(device -> device.buildFlavor) - .collect(Collectors.toList()); - syncCache.put("buildFlavorList", buildFlavorList); - } - return buildFlavorList; - } catch (ApiProxy.CallNotFoundException e) { - return ofy().load() - .type(DeviceInfoEntity.class) - .project("buildFlavor") - .distinct(true) - .list() - .stream() - .map(device -> device.buildFlavor) - .collect(Collectors.toList()); - } - } - - /** Saving function for the instance of this class */ - public com.googlecode.objectify.Key<DeviceInfoEntity> save() { - return ofy().save().entity(this).now(); - } - - public Entity toEntity() { - Entity deviceEntity = new Entity(KIND, this.parentKey); - deviceEntity.setProperty(BRANCH, this.branch.toLowerCase()); - deviceEntity.setProperty(PRODUCT, this.product.toLowerCase()); - deviceEntity.setProperty(BUILD_FLAVOR, this.buildFlavor.toLowerCase()); - deviceEntity.setProperty(BUILD_ID, this.buildId.toLowerCase()); - if (this.abiBitness != null && this.abiName != null) { - deviceEntity.setUnindexedProperty(ABI_BITNESS, this.abiBitness.toLowerCase()); - deviceEntity.setUnindexedProperty(ABI_NAME, this.abiName.toLowerCase()); - } - - return deviceEntity; - } - - /** - * Convert an Entity object to a DeviceInfoEntity. - * - * @param e The entity to process. - * @return DeviceInfoEntity object with the properties from e, or null if incompatible. - */ - public static DeviceInfoEntity fromEntity(Entity e) { - if (!e.getKind().equals(KIND) || !e.hasProperty(BRANCH) || !e.hasProperty(PRODUCT) - || !e.hasProperty(BUILD_FLAVOR) || !e.hasProperty(BUILD_ID) - || !e.hasProperty(ABI_BITNESS) || !e.hasProperty(ABI_NAME)) { - logger.log(Level.WARNING, "Missing device info attributes in entity: " + e.toString()); - return null; - } - try { - Key parentKey = e.getKey().getParent(); - String branch = (String) e.getProperty(BRANCH); - String product = (String) e.getProperty(PRODUCT); - String buildFlavor = (String) e.getProperty(BUILD_FLAVOR); - String buildId = (String) e.getProperty(BUILD_ID); - String abiBitness = null; - String abiName = null; - if (e.hasProperty(ABI_BITNESS) && e.hasProperty(ABI_NAME)) { - abiBitness = (String) e.getProperty(ABI_BITNESS); - abiName = (String) e.getProperty(ABI_NAME); - } - return new DeviceInfoEntity( - parentKey, branch, product, buildFlavor, buildId, abiBitness, abiName); - } catch (ClassCastException exception) { - // Invalid cast - logger.log(Level.WARNING, "Error parsing device info entity.", exception); - } - return null; - } - - /** - * Convert a device info message to a DeviceInfoEntity. - * - * @param parent The ancestor key for the device entity. - * @param device The device info report describing the target Android device. - * @return The DeviceInfoEntity for the target device, or null if incompatible - */ - public static DeviceInfoEntity fromDeviceInfoMessage( - com.googlecode.objectify.Key parent, AndroidDeviceInfoMessage device) { - if (!device.hasBuildAlias() || !device.hasBuildFlavor() || !device.hasProductVariant() - || !device.hasBuildId()) { - return null; - } - String branch = device.getBuildAlias().toStringUtf8(); - String buildFlavor = device.getBuildFlavor().toStringUtf8(); - String product = device.getProductVariant().toStringUtf8(); - String buildId = device.getBuildId().toStringUtf8(); - String abiBitness = device.getAbiBitness().toStringUtf8(); - String abiName = device.getAbiName().toStringUtf8(); - return new DeviceInfoEntity( - parent, branch, product, buildFlavor, buildId, abiBitness, abiName); - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof DeviceInfoEntity)) { - return false; - } - DeviceInfoEntity device2 = (DeviceInfoEntity) obj; - if (!this.branch.equals(device2.branch) || !this.product.equals(device2.product) - || !this.buildFlavor.equals(device2.buildFlavor) - || !this.buildId.equals(device2.buildId)) { - return false; - } - return true; - } - - @Override - public int hashCode() { - String deviceId = this.branch + this.product + this.buildFlavor + this.buildId; - return deviceId.hashCode(); - } - - /** - * Create a copy of the device info under a near parent. - * - * @param parentKey The new parent key. - * @return A copy of the DeviceInfoEntity with the specified parent. - */ - public DeviceInfoEntity copyWithParent(com.googlecode.objectify.Key parentKey) { - return new DeviceInfoEntity(parentKey, this.branch, this.product, this.buildFlavor, - this.buildId, this.abiBitness, this.abiName); - } - - /** - * Create a string representation of the device build information. - * @return A String fingerprint of the format: branch/buildFlavor (build ID) - */ - public String getFingerprint() { - return this.branch + "/" + this.buildFlavor + " (" + this.buildId + ")"; - } -} diff --git a/src/main/java/com/android/vts/entity/HalApiEntity.java b/src/main/java/com/android/vts/entity/HalApiEntity.java deleted file mode 100644 index 16b5d10..0000000 --- a/src/main/java/com/android/vts/entity/HalApiEntity.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.googlecode.objectify.Key; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Entity; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Index; -import com.googlecode.objectify.annotation.Parent; -import java.util.Date; -import java.util.List; -import java.util.UUID; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** Entity Class for HalApiEntity */ -@Cache -@Entity(name = "HalApiEntity") -@EqualsAndHashCode(of = "id") -@NoArgsConstructor -@JsonAutoDetect(fieldVisibility = Visibility.ANY) -@JsonIgnoreProperties({"id", "parent"}) -public class HalApiEntity implements DashboardEntity { - - /** HalApiEntity id field */ - @Id @Getter @Setter String id; - - @Parent @Getter Key<?> parent; - - /** HAL Api Release Level. e.g. */ - @Index @Getter @Setter String halApiReleaseLevel; - - /** HAL package name. e.g. android.hardware.foo. */ - @Index @Getter @Setter String halPackageName; - - /** HAL (major) version. e.g. 1. */ - @Index @Getter @Setter int halMajorVersion; - - /** HAL (minor) version. e.g. 0. */ - @Index @Getter @Setter int halMinorVersion; - - /** HAL interface name. e.g. IFoo. */ - @Index @Getter @Setter String halInterfaceName; - - /** List of HAL API */ - @Getter @Setter List<String> halApi; - - /** List of HAL covered API */ - @Getter @Setter List<String> coveredHalApi; - - /** When this record was created or updated */ - @Index Date updated; - - /** Constructor function for HalApiEntity Class */ - public HalApiEntity( - com.googlecode.objectify.Key testRunKey, - String halApiReleaseLevel, - String halPackageName, - int halMajorVersion, - int halMinorVersion, - String halInterfaceName, - List<String> halApi, - List<String> coveredHalApi) { - - this.id = UUID.randomUUID().toString(); - this.parent = testRunKey; - - this.halApiReleaseLevel = halApiReleaseLevel; - this.halPackageName = halPackageName; - this.halMajorVersion = halMajorVersion; - this.halMinorVersion = halMinorVersion; - this.halInterfaceName = halInterfaceName; - this.halApi = halApi; - this.coveredHalApi = coveredHalApi; - this.updated = new Date(); - } - - /** Saving function for the instance of this class */ - @Override - public Key<HalApiEntity> save() { - return ofy().save().entity(this).now(); - } -} diff --git a/src/main/java/com/android/vts/entity/ProfilingPointEntity.java b/src/main/java/com/android/vts/entity/ProfilingPointEntity.java deleted file mode 100644 index 9e2cae6..0000000 --- a/src/main/java/com/android/vts/entity/ProfilingPointEntity.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode; -import com.android.vts.proto.VtsReportMessage.VtsProfilingType; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Ignore; -import com.googlecode.objectify.annotation.Index; -import java.util.Date; -import java.util.logging.Level; -import java.util.logging.Logger; -import lombok.Data; -import lombok.NoArgsConstructor; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -@com.googlecode.objectify.annotation.Entity(name = "ProfilingPoint") -@Cache -@Data -@NoArgsConstructor -/** Entity describing a profiling point. */ -public class ProfilingPointEntity implements DashboardEntity { - protected static final Logger logger = Logger.getLogger(ProfilingPointEntity.class.getName()); - protected static final String DELIMITER = "#"; - - public static final String KIND = "ProfilingPoint"; - - // Property keys - public static final String TEST_NAME = "testName"; - public static final String PROFILING_POINT_NAME = "profilingPointName"; - public static final String TYPE = "type"; - public static final String REGRESSION_MODE = "regressionMode"; - public static final String X_LABEL = "xLabel"; - public static final String Y_LABEL = "yLabel"; - - @Ignore - private Key key; - - /** ProfilingPointEntity testName field */ - @Id - private String name; - - /** ProfilingPointEntity profilingPointName field */ - @Index - private String profilingPointName; - - /** ProfilingPointEntity testName field */ - @Index - private String testName; - - /** ProfilingPointEntity type field */ - private int type; - - /** ProfilingPointEntity regressionMode field */ - private int regressionMode; - - /** ProfilingPointEntity xLabel field */ - private String xLabel; - - /** ProfilingPointEntity xLabel field */ - private String yLabel; - - /** - * When this record was created or updated - */ - @Index - Date updated; - - /** - * Create a ProfilingPointEntity object. - * - * @param testName The name of test containing the profiling point. - * @param profilingPointName The name of the profiling point. - * @param type The (number) type of the profiling point data. - * @param regressionMode The (number) mode to use for detecting regression. - * @param xLabel The x axis label. - * @param yLabel The y axis label. - */ - public ProfilingPointEntity( - String testName, - String profilingPointName, - int type, - int regressionMode, - String xLabel, - String yLabel) { - this.key = createKey(testName, profilingPointName); - this.testName = testName; - this.profilingPointName = profilingPointName; - this.type = type; - this.regressionMode = regressionMode; - this.xLabel = xLabel; - this.yLabel = yLabel; - this.updated = new Date(); - } - - /** - * Get VtsProfilingType from int value. - * - * @return VtsProfilingType class. - */ - public VtsProfilingType getVtsProfilingType(int type) { - return VtsProfilingType.forNumber(type); - } - - /** - * Get VtsProfilingRegressionMode from int value. - * - * @return VtsProfilingType class. - */ - public VtsProfilingRegressionMode getVtsProfilingRegressionMode(int regressionMode) { - return VtsProfilingRegressionMode.forNumber(regressionMode); - } - - /** - * Create a key for a ProfilingPointEntity. - * - * @param testName The name of test containing the profiling point. - * @param profilingPointName The name of the profiling point. - * @return a Key object for the ProfilingEntity in the database. - */ - public static Key createKey(String testName, String profilingPointName) { - return KeyFactory.createKey(KIND, testName + DELIMITER + profilingPointName); - } - - /** Saving function for the instance of this class */ - @Override - public com.googlecode.objectify.Key<ProfilingPointEntity> save() { - return ofy().save().entity(this).now(); - } - - public Entity toEntity() { - Entity profilingPoint = new Entity(key); - profilingPoint.setIndexedProperty(TEST_NAME, this.testName); - profilingPoint.setIndexedProperty(PROFILING_POINT_NAME, this.profilingPointName); - profilingPoint.setUnindexedProperty(TYPE, this.type); - profilingPoint.setUnindexedProperty(REGRESSION_MODE, this.regressionMode); - profilingPoint.setUnindexedProperty(X_LABEL, this.xLabel); - profilingPoint.setUnindexedProperty(Y_LABEL, this.yLabel); - - return profilingPoint; - } - - /** - * Convert an Entity object to a ProfilingPointEntity. - * - * @param e The entity to process. - * @return ProfilingPointEntity object with the properties from e, or null if incompatible. - */ - @SuppressWarnings("unchecked") - public static ProfilingPointEntity fromEntity(Entity e) { - if (!e.getKind().equals(KIND) - || e.getKey().getName() == null - || !e.hasProperty(TEST_NAME) - || !e.hasProperty(PROFILING_POINT_NAME) - || !e.hasProperty(TYPE) - || !e.hasProperty(REGRESSION_MODE) - || !e.hasProperty(X_LABEL) - || !e.hasProperty(Y_LABEL)) { - logger.log( - Level.WARNING, "Missing profiling point attributes in entity: " + e.toString()); - return null; - } - try { - String testName = (String) e.getProperty(TEST_NAME); - String profilingPointName = (String) e.getProperty(PROFILING_POINT_NAME); - int type = (int) (long) e.getProperty(TYPE); - int regressionMode = (int) (long) e.getProperty(REGRESSION_MODE); - String xLabel = (String) e.getProperty(X_LABEL); - String yLabel = (String) e.getProperty(Y_LABEL); - - return new ProfilingPointEntity( - testName, profilingPointName, type, regressionMode, xLabel, yLabel); - } catch (ClassCastException exception) { - // Invalid cast - logger.log(Level.WARNING, "Error parsing profiling point entity.", exception); - } - return null; - } -} diff --git a/src/main/java/com/android/vts/entity/ProfilingPointRunEntity.java b/src/main/java/com/android/vts/entity/ProfilingPointRunEntity.java deleted file mode 100644 index 124b61d..0000000 --- a/src/main/java/com/android/vts/entity/ProfilingPointRunEntity.java +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.android.vts.proto.VtsReportMessage.ProfilingReportMessage; -import com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode; -import com.android.vts.proto.VtsReportMessage.VtsProfilingType; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.common.collect.Lists; -import com.google.protobuf.ByteString; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Ignore; -import com.googlecode.objectify.annotation.Index; -import com.googlecode.objectify.annotation.Parent; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Objects; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.extern.log4j.Log4j2; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -@com.googlecode.objectify.annotation.Entity(name = "ProfilingPointRun") -@Cache -@Data -@NoArgsConstructor -@Log4j2 -/** Entity describing a profiling point execution. */ -public class ProfilingPointRunEntity implements DashboardEntity { - - public static final String KIND = "ProfilingPointRun"; - - // Property keys - public static final String TYPE = "type"; - public static final String REGRESSION_MODE = "regressionMode"; - public static final String LABELS = "labels"; - public static final String VALUES = "values"; - public static final String X_LABEL = "xLabel"; - public static final String Y_LABEL = "yLabel"; - public static final String OPTIONS = "options"; - - /** This value will set the limit size of values array field */ - public static final int VALUE_SIZE_LIMIT = 50000; - - @Ignore - private Key key; - - /** ID field using profilingPointName */ - @Id - private String name; - - /** parent field based on Test and TestRun key */ - @Parent - private com.googlecode.objectify.Key<?> parent; - - /** VtsProfilingType in ProfilingPointRunEntity class */ - private int type; - - /** VtsProfilingType in ProfilingPointRunEntity class */ - private int regressionMode; - - /** list of label name */ - private List<String> labels; - - /** list of values */ - private List<Long> values; - - /** X axis label name */ - private String xLabel; - - /** Y axis label name */ - private String yLabel; - - /** Test Suite file name field */ - private List<String> options; - - /** When this record was created or updated */ - @Index Date updated; - - /** - * Create a ProfilingPointRunEntity object. - * - * @param parentKey The Key object for the parent TestRunEntity in datastore. - * @param name The name of the profiling point. - * @param type The (number) type of the profiling point data. - * @param regressionMode The (number) mode to use for detecting regression. - * @param labels List of data labels, or null if the data is unlabeled. - * @param values List of data values. - * @param xLabel The x axis label. - * @param yLabel The y axis label. - * @param options The list of key=value options for the profiling point run. - */ - public ProfilingPointRunEntity( - Key parentKey, - String name, - int type, - int regressionMode, - List<String> labels, - List<Long> values, - String xLabel, - String yLabel, - List<String> options) { - this.key = KeyFactory.createKey(parentKey, KIND, name); - this.name = name; - this.type = type; - this.regressionMode = regressionMode; - this.labels = labels == null ? null : new ArrayList<>(labels); - this.values = new ArrayList<>(values); - this.xLabel = xLabel; - this.yLabel = yLabel; - this.options = options; - this.updated = new Date(); - } - - - /** - * Create a ProfilingPointRunEntity object. - * - * @param parent The objectify Key for the parent TestRunEntity in datastore. - * @param name The name of the profiling point. - * @param type The (number) type of the profiling point data. - * @param regressionMode The (number) mode to use for detecting regression. - * @param labels List of data labels, or null if the data is unlabeled. - * @param values List of data values. - * @param xLabel The x axis label. - * @param yLabel The y axis label. - * @param options The list of key=value options for the profiling point run. - */ - public ProfilingPointRunEntity( - com.googlecode.objectify.Key parent, - String name, - int type, - int regressionMode, - List<String> labels, - List<Long> values, - String xLabel, - String yLabel, - List<String> options) { - this.parent = parent; - this.name = name; - this.type = type; - this.regressionMode = regressionMode; - this.labels = labels == null ? null : new ArrayList<>(labels); - this.values = new ArrayList<>(values); - this.xLabel = xLabel; - this.yLabel = yLabel; - this.options = options; - this.updated = new Date(); - } - - /** - * Get VtsProfilingType from int value. - * - * @return VtsProfilingType class. - */ - public VtsProfilingType getVtsProfilingType(int type) { - return VtsProfilingType.forNumber(type); - } - - /** - * Get VtsProfilingRegressionMode from int value. - * - * @return VtsProfilingType class. - */ - public VtsProfilingRegressionMode getVtsProfilingRegressionMode(int regressionMode) { - return VtsProfilingRegressionMode.forNumber(regressionMode); - } - - /** - * Save multi rows function when the record exceed the limit which is 1MB. - * - * @return ProfilingPointRunEntity's key value. - */ - public com.googlecode.objectify.Key<ProfilingPointRunEntity> saveMultiRow() { - if (this.getValues().size() > VALUE_SIZE_LIMIT) { - - List<List<Long>> partitionedValueList = - Lists.partition(this.getValues(), VALUE_SIZE_LIMIT); - int partitionedValueListSize = partitionedValueList.size(); - - List<List<String>> partitionedLabelList = new ArrayList<>(); - if (Objects.nonNull(this.getLabels()) && this.getLabels().size() > VALUE_SIZE_LIMIT) { - partitionedLabelList = Lists.partition(this.getLabels(), VALUE_SIZE_LIMIT); - } - - com.googlecode.objectify.Key<ProfilingPointRunEntity> profilingPointRunEntityKey = null; - if (partitionedValueListSize < VALUE_SIZE_LIMIT) { - for (int index = 0; index < partitionedValueListSize; index++) { - if (index > 0) { - this.values.addAll(partitionedValueList.get(index)); - if (index < partitionedLabelList.size()) { - this.labels.addAll(partitionedLabelList.get(index)); - } - } else { - this.values = partitionedValueList.get(index); - if (index < partitionedLabelList.size()) { - this.labels = partitionedLabelList.get(index); - } - } - profilingPointRunEntityKey = ofy().save().entity(this).now(); - } - } - return profilingPointRunEntityKey; - } else { - return ofy().save().entity(this).now(); - } - } - - /** Saving function for the instance of this class */ - @Override - public com.googlecode.objectify.Key<ProfilingPointRunEntity> save() { - return ofy().save().entity(this).now(); - } - - public Entity toEntity() { - Entity profilingRun = new Entity(this.key); - profilingRun.setUnindexedProperty(TYPE, this.type); - profilingRun.setUnindexedProperty(REGRESSION_MODE, this.regressionMode); - if (this.labels != null) { - profilingRun.setUnindexedProperty(LABELS, this.labels); - } - profilingRun.setUnindexedProperty(VALUES, this.values); - profilingRun.setUnindexedProperty(X_LABEL, this.xLabel); - profilingRun.setUnindexedProperty(Y_LABEL, this.yLabel); - if (this.options != null) { - profilingRun.setUnindexedProperty(OPTIONS, this.options); - } - - return profilingRun; - } - - /** - * Convert an Entity object to a ProflilingPointRunEntity. - * - * @param e The entity to process. - * @return ProfilingPointRunEntity object with the properties from e, or null if incompatible. - */ - @SuppressWarnings("unchecked") - public static ProfilingPointRunEntity fromEntity(Entity e) { - if (!e.getKind().equals(KIND) - || e.getKey().getName() == null - || !e.hasProperty(TYPE) - || !e.hasProperty(REGRESSION_MODE) - || !e.hasProperty(VALUES) - || !e.hasProperty(X_LABEL) - || !e.hasProperty(Y_LABEL)) { - log.error("Missing profiling point attributes in entity: " + e.toString()); - return null; - } - try { - Key parentKey = e.getParent(); - String name = e.getKey().getName(); - int type = (int) (long) e.getProperty(TYPE); - int regressionMode = (int) (long) e.getProperty(REGRESSION_MODE); - List<Long> values = (List<Long>) e.getProperty(VALUES); - String xLabel = (String) e.getProperty(X_LABEL); - String yLabel = (String) e.getProperty(Y_LABEL); - List<String> labels = null; - if (e.hasProperty(LABELS)) { - labels = (List<String>) e.getProperty(LABELS); - } - List<String> options = null; - if (e.hasProperty(OPTIONS)) { - options = (List<String>) e.getProperty(OPTIONS); - } - return new ProfilingPointRunEntity( - parentKey, name, type, regressionMode, labels, values, xLabel, yLabel, options); - } catch (ClassCastException exception) { - // Invalid cast - log.warn("Error parsing profiling point run entity.", exception); - } - return null; - } - - /** - * Convert a coverage report to a CoverageEntity. - * - * @param parent The ancestor objectify key for the coverage entity. - * @param profilingReport The profiling report containing profiling data. - * @return The ProfilingPointRunEntity for the profiling report message, or null if incompatible - */ - public static ProfilingPointRunEntity fromProfilingReport( - com.googlecode.objectify.Key parent, ProfilingReportMessage profilingReport) { - if (!profilingReport.hasName() - || !profilingReport.hasType() - || profilingReport.getType() == VtsProfilingType.UNKNOWN_VTS_PROFILING_TYPE - || !profilingReport.hasRegressionMode() - || !profilingReport.hasXAxisLabel() - || !profilingReport.hasYAxisLabel()) { - return null; // invalid profiling report; - } - String name = profilingReport.getName().toStringUtf8(); - VtsProfilingType type = profilingReport.getType(); - VtsProfilingRegressionMode regressionMode = profilingReport.getRegressionMode(); - String xLabel = profilingReport.getXAxisLabel().toStringUtf8(); - String yLabel = profilingReport.getYAxisLabel().toStringUtf8(); - List<Long> values; - List<String> labels = null; - switch (type) { - case VTS_PROFILING_TYPE_TIMESTAMP: - if (!profilingReport.hasStartTimestamp() - || !profilingReport.hasEndTimestamp() - || profilingReport.getEndTimestamp() - < profilingReport.getStartTimestamp()) { - return null; // missing timestamp - } - long value = - profilingReport.getEndTimestamp() - profilingReport.getStartTimestamp(); - values = new ArrayList<>(); - values.add(value); - break; - case VTS_PROFILING_TYPE_LABELED_VECTOR: - if (profilingReport.getValueCount() != profilingReport.getLabelCount()) { - return null; // jagged data - } - labels = new ArrayList<>(); - for (ByteString label : profilingReport.getLabelList()) { - labels.add(label.toStringUtf8()); - } - values = profilingReport.getValueList(); - break; - case VTS_PROFILING_TYPE_UNLABELED_VECTOR: - values = profilingReport.getValueList(); - break; - default: // should never happen - return null; - } - if (values.size() > VALUE_SIZE_LIMIT) { - values = values.subList(0, VALUE_SIZE_LIMIT); - } - List<String> options = null; - if (profilingReport.getOptionsCount() > 0) { - options = new ArrayList<>(); - for (ByteString optionBytes : profilingReport.getOptionsList()) { - options.add(optionBytes.toStringUtf8()); - } - } - return new ProfilingPointRunEntity( - parent, - name, - type.getNumber(), - regressionMode.getNumber(), - labels, - values, - xLabel, - yLabel, - options); - } -} diff --git a/src/main/java/com/android/vts/entity/ProfilingPointSummaryEntity.java b/src/main/java/com/android/vts/entity/ProfilingPointSummaryEntity.java deleted file mode 100644 index e4a1911..0000000 --- a/src/main/java/com/android/vts/entity/ProfilingPointSummaryEntity.java +++ /dev/null @@ -1,371 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode; -import com.android.vts.util.StatSummary; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Ignore; -import com.googlecode.objectify.annotation.Index; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; -import lombok.Data; -import lombok.NoArgsConstructor; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -@com.googlecode.objectify.annotation.Entity(name = "ProfilingPointSummary") -@Cache -@Data -@NoArgsConstructor -/** Entity describing a profiling point summary. */ -public class ProfilingPointSummaryEntity implements DashboardEntity { - protected static final Logger logger = - Logger.getLogger(ProfilingPointSummaryEntity.class.getName()); - protected static final String DELIMITER = "#"; - - public static final String KIND = "ProfilingPointSummary"; - public static final String ALL = "ALL"; - - // Property keys - public static final String START_TIME = "startTime"; - public static final String MEAN = "mean"; - public static final String SUMSQ = "sumSq"; - public static final String MIN = "min"; - public static final String MAX = "max"; - public static final String LABELS = "labels"; - public static final String LABEL_MEANS = "labelMeans"; - public static final String LABEL_SUMSQS = "labelSumSqs"; - public static final String LABEL_MINS = "labelMins"; - public static final String LABEL_MAXES = "labelMaxes"; - public static final String LABEL_COUNTS = "labelCounts"; - public static final String COUNT = "count"; - public static final String BRANCH = "branch"; - public static final String BUILD_FLAVOR = "buildFlavor"; - public static final String SERIES = "series"; - - @Ignore - private Key key; - - /** ID field */ - @Id private String name; - - /** branch field */ - @Index private String branch; - - /** build field */ - @Index private String buildFlavor; - - /** total count */ - @Index private int count; - - /** For each label count field */ - @Index private List<String> labelCounts; - - /** Maximum value for each label */ - private List<Integer> labelMaxes; - - /** Mean value for each label */ - private List<Integer> labelMeans; - - /** Minimum value for each label */ - private List<Integer> labelMins; - - /** Label name for each label point */ - private List<String> labels; - - /** Summation for sequence for each label */ - private List<Integer> labelSumSqs; - - /** Maximum value for total */ - private Long max; - - /** Mean value for total */ - private Long mean; - - /** Minimum value for total */ - private Long min; - - /** The list of series */ - private String series; - - /** The start time field of the test */ - private Long startTime; - - /** The summation of sequences */ - private Long sumSq; - - @Ignore private StatSummary globalStats; - - @Ignore private Map<String, StatSummary> labelStats; - - /* - public final StatSummary globalStats; - public final List<String> labels; - public final Map<String, StatSummary> labelStats; - public final String branch; - public final String buildFlavor; - public final String series; - public final long startTime; - */ - - /** - * Create a ProfilingPointSummaryEntity object. - * - * @param parentKey The Key object for the parent TestRunEntity in the database. - * @param globalStats The StatSummary object recording global statistics about the profiling - * point. - * @param labels The list of data labels. - * @param labelStats The map from data label to StatSummary object for the label. - * @param branch The branch. - * @param buildFlavor The device build flavor. - * @param series The string describing the profiling point series (e.g. binder or passthrough). - * @param startTime The timestamp indicating the beginning of the summary. - */ - public ProfilingPointSummaryEntity( - Key parentKey, - StatSummary globalStats, - List<String> labels, - Map<String, StatSummary> labelStats, - String branch, - String buildFlavor, - String series, - long startTime) { - this.globalStats = globalStats; - this.labels = labels; - this.labelStats = labelStats; - this.buildFlavor = buildFlavor == null ? ALL : buildFlavor; - this.branch = branch == null ? ALL : branch; - this.series = series == null ? "" : series; - this.startTime = startTime; - this.key = createKey(parentKey, this.branch, this.buildFlavor, this.series, this.startTime); - } - - /** - * Create a new ProfilingPointSummaryEntity object. - * - * @param parentKey The Key object for the parent TestRunEntity in the database. - * @param branch The branch. - * @param buildFlavor The buildFlavor name. - * @param series The string describing the profiling point series (e.g. binder or passthrough). - * @param startTime The timestamp indicating the beginning of the summary. - */ - public ProfilingPointSummaryEntity( - Key parentKey, String branch, String buildFlavor, String series, long startTime) { - this( - parentKey, - new StatSummary(null, VtsProfilingRegressionMode.UNKNOWN_REGRESSION_MODE), - new ArrayList<>(), - new HashMap<>(), - branch, - buildFlavor, - series, - startTime); - } - - /** - * Create a key for a ProfilingPointSummaryEntity. - * - * @param parentKey The Key object for the parent TestRunEntity in the database. - * @param branch The branch. - * @param buildFlavor The device build flavor. - * @param series The string describing the profiling point series (e.g. binder or passthrough). - * @param startTime The timestamp indicating the beginning of the summary. - * @return a Key object for the ProfilingPointSummaryEntity in the database. - */ - public static Key createKey( - Key parentKey, String branch, String buildFlavor, String series, long startTime) { - StringBuilder sb = new StringBuilder(); - sb.append(branch); - sb.append(DELIMITER); - sb.append(buildFlavor); - sb.append(DELIMITER); - sb.append(series); - sb.append(DELIMITER); - sb.append(startTime); - return KeyFactory.createKey(parentKey, KIND, sb.toString()); - } - - /** - * Updates the profiling summary with the data from a new profiling report. - * - * @param profilingRun The profiling point run entity object containing profiling data. - */ - public void update(ProfilingPointRunEntity profilingRun) { - if (profilingRun.getLabels() != null - && profilingRun.getLabels().size() == profilingRun.getValues().size()) { - for (int i = 0; i < profilingRun.getLabels().size(); i++) { - String label = profilingRun.getLabels().get(i); - if (!this.labelStats.containsKey(label)) { - VtsProfilingRegressionMode vtsProfilingRegressionMode = - profilingRun.getVtsProfilingRegressionMode( - profilingRun.getRegressionMode()); - StatSummary summary = new StatSummary(label, vtsProfilingRegressionMode); - this.labelStats.put(label, summary); - } - StatSummary summary = this.labelStats.get(label); - summary.updateStats(profilingRun.getValues().get(i)); - } - this.labels.clear(); - this.labels.addAll(profilingRun.getLabels()); - } - for (long value : profilingRun.getValues()) { - this.globalStats.updateStats(value); - } - } - - /** Saving function for the instance of this class */ - @Override - public com.googlecode.objectify.Key<ProfilingPointSummaryEntity> save() { - return ofy().save().entity(this).now(); - } - - public Entity toEntity() { - Entity profilingSummary; - profilingSummary = new Entity(this.key); - profilingSummary.setUnindexedProperty(MEAN, this.globalStats.getMean()); - profilingSummary.setUnindexedProperty(SUMSQ, this.globalStats.getSumSq()); - profilingSummary.setUnindexedProperty(MIN, this.globalStats.getMin()); - profilingSummary.setUnindexedProperty(MAX, this.globalStats.getMax()); - profilingSummary.setUnindexedProperty(COUNT, this.globalStats.getCount()); - profilingSummary.setIndexedProperty(START_TIME, this.startTime); - profilingSummary.setIndexedProperty(BRANCH, this.branch); - profilingSummary.setIndexedProperty(BUILD_FLAVOR, this.buildFlavor); - profilingSummary.setIndexedProperty(SERIES, this.series); - if (this.labels.size() != 0) { - List<Double> labelMeans = new ArrayList<>(); - List<Double> labelSumsqs = new ArrayList<>(); - List<Double> labelMins = new ArrayList<>(); - List<Double> labelMaxes = new ArrayList<>(); - List<Long> labelCounts = new ArrayList<>(); - for (String label : this.labels) { - if (!this.labelStats.containsKey(label)) continue; - StatSummary labelStat = this.labelStats.get(label); - labelMeans.add(labelStat.getMean()); - labelSumsqs.add(labelStat.getSumSq()); - labelMins.add(labelStat.getMin()); - labelMaxes.add(labelStat.getMax()); - labelCounts.add(new Long(labelStat.getCount())); - } - profilingSummary.setUnindexedProperty(LABELS, this.labels); - profilingSummary.setUnindexedProperty(LABEL_MEANS, labelMeans); - profilingSummary.setUnindexedProperty(LABEL_SUMSQS, labelSumsqs); - profilingSummary.setUnindexedProperty(LABEL_MINS, labelMins); - profilingSummary.setUnindexedProperty(LABEL_MAXES, labelMaxes); - profilingSummary.setUnindexedProperty(LABEL_COUNTS, labelCounts); - } - - return profilingSummary; - } - - /** - * Convert an Entity object to a ProfilingPointSummaryEntity. - * - * @param e The entity to process. - * @return ProfilingPointSummaryEntity object with the properties from e, or null if - * incompatible. - */ - @SuppressWarnings("unchecked") - public static ProfilingPointSummaryEntity fromEntity(Entity e) { - if (!e.getKind().equals(KIND) - || !e.hasProperty(MEAN) - || !e.hasProperty(SUMSQ) - || !e.hasProperty(MIN) - || !e.hasProperty(MAX) - || !e.hasProperty(COUNT) - || !e.hasProperty(START_TIME) - || !e.hasProperty(BRANCH) - || !e.hasProperty(BUILD_FLAVOR) - || !e.hasProperty(SERIES)) { - logger.log( - Level.WARNING, "Missing profiling point attributes in entity: " + e.toString()); - return null; - } - try { - Key parentKey = e.getParent(); - double mean = (double) e.getProperty(MEAN); - double sumsq = (double) e.getProperty(SUMSQ); - double min = (double) e.getProperty(MIN); - double max = (double) e.getProperty(MAX); - int count = (int) (long) e.getProperty(COUNT); - StatSummary globalStats = - new StatSummary( - null, - min, - max, - mean, - sumsq, - count, - VtsProfilingRegressionMode.UNKNOWN_REGRESSION_MODE); - Map<String, StatSummary> labelStats = new HashMap<>(); - List<String> labels = new ArrayList<>(); - if (e.hasProperty(LABELS)) { - labels = (List<String>) e.getProperty(LABELS); - List<Double> labelMeans = (List<Double>) e.getProperty(LABEL_MEANS); - List<Double> labelSumsqs = (List<Double>) e.getProperty(LABEL_SUMSQS); - List<Double> labelMins = (List<Double>) e.getProperty(LABEL_MINS); - List<Double> labelMaxes = (List<Double>) e.getProperty(LABEL_MAXES); - List<Long> labelCounts = (List<Long>) e.getProperty(LABEL_COUNTS); - if (labels.size() != labelMeans.size() - || labels.size() != labelSumsqs.size() - || labels.size() != labelMins.size() - || labels.size() != labelMaxes.size() - || labels.size() != labelCounts.size()) { - logger.log(Level.WARNING, "Jagged label information for entity: " + e.getKey()); - return null; - } - for (int i = 0; i < labels.size(); ++i) { - StatSummary labelStat = - new StatSummary( - labels.get(i), - labelMins.get(i), - labelMaxes.get(i), - labelMeans.get(i), - labelSumsqs.get(i), - labelCounts.get(i).intValue(), - VtsProfilingRegressionMode.UNKNOWN_REGRESSION_MODE); - labelStats.put(labels.get(i), labelStat); - } - } - String branch = (String) e.getProperty(BRANCH); - String buildFlavor = (String) e.getProperty(BUILD_FLAVOR); - String series = (String) e.getProperty(SERIES); - long startTime = (long) e.getProperty(START_TIME); - return new ProfilingPointSummaryEntity( - parentKey, - globalStats, - labels, - labelStats, - branch, - buildFlavor, - series, - startTime); - } catch (ClassCastException exception) { - // Invalid cast - logger.log(Level.WARNING, "Error parsing profiling point summary entity.", exception); - } - return null; - } -} diff --git a/src/main/java/com/android/vts/entity/RoleEntity.java b/src/main/java/com/android/vts/entity/RoleEntity.java deleted file mode 100644 index 508a9ca..0000000 --- a/src/main/java/com/android/vts/entity/RoleEntity.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.android.vts.entity; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -import com.googlecode.objectify.Key; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Entity; -import com.googlecode.objectify.annotation.Id; -import java.util.Date; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; - -@Cache -@Entity -@EqualsAndHashCode(of = "role") -@NoArgsConstructor -public class RoleEntity implements DashboardEntity { - - private static final long serialVersionUID = 1L; - - @Id private String role; - - /** When this record was created or updated */ - @Getter Date updated; - - /** Construction function for UserEntity Class */ - public RoleEntity(String roleName) { - this.role = roleName; - } - - /** Get role by email */ - public static RoleEntity getRole(String role) { - return ofy().load().type(RoleEntity.class).id(role).now(); - } - - /** Saving function for the instance of this class */ - @Override - public Key<RoleEntity> save() { - this.updated = new Date(); - return ofy().save().entity(this).now(); - } -} diff --git a/src/main/java/com/android/vts/entity/TestAcknowledgmentEntity.java b/src/main/java/com/android/vts/entity/TestAcknowledgmentEntity.java deleted file mode 100644 index a594f85..0000000 --- a/src/main/java/com/android/vts/entity/TestAcknowledgmentEntity.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Text; -import com.google.appengine.api.users.User; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.google.gson.reflect.TypeToken; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Ignore; -import com.googlecode.objectify.annotation.Index; -import lombok.Data; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.logging.Logger; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -@com.googlecode.objectify.annotation.Entity(name = "TestAcknowledgment") -@Cache -@Data -/** Entity describing a test failure acknowledgment. */ -public class TestAcknowledgmentEntity implements DashboardEntity { - protected static final Logger logger = - Logger.getLogger(TestAcknowledgmentEntity.class.getName()); - - public static final String KIND = "TestAcknowledgment"; - public static final String KEY = "key"; - public static final String TEST_KEY = "testKey"; - public static final String TEST_NAME = "testName"; - public static final String USER_OBJ = "userObj"; - public static final String CREATED = "created"; - public static final String BRANCHES = "branches"; - public static final String DEVICES = "devices"; - public static final String TEST_CASE_NAMES = "testCaseNames"; - public static final String NOTE = "note"; - - @Ignore private final Key key; - @Ignore public final Key test; - @Ignore public final User userObj; - - @Id private Long id; - - private com.googlecode.objectify.Key testKey; - private Set<String> branches; - private Set<String> devices; - private Set<String> testCaseNames; - private String note; - private String user; - - @Index private final long created; - - /** - * Create a AcknowledgmentEntity object. - * - * @param key The key of the AcknowledgmentEntity in the database. - * @param created The timestamp when the entity was created (in microseconds). - * @param test The key of the test. - * @param userObj The user who created or last modified the entity. - * @param branches The list of branch names for which the acknowledgment applies (or null if - * all). - * @param devices The list of device build flavors for which the acknowledgment applies (or null - * if all). - * @param testCaseNames The list of test case names known to fail (or null if all). - * @param note A text blob with details about the failure (or null if all). - */ - private TestAcknowledgmentEntity( - Key key, - long created, - Key test, - User userObj, - List<String> branches, - List<String> devices, - List<String> testCaseNames, - Text note) { - this.test = test; - this.userObj = userObj; - if (branches != null) this.branches = new HashSet(branches); - else this.branches = new HashSet<>(); - - if (devices != null) this.devices = new HashSet(devices); - else this.devices = new HashSet<>(); - - if (testCaseNames != null) this.testCaseNames = new HashSet(testCaseNames); - else this.testCaseNames = new HashSet<>(); - - if (note != null) this.note = note.getValue(); - else this.note = null; - - this.key = key; - this.created = created; - } - - /** - * Create a AcknowledgmentEntity object. - * - * @param test The key of the test. - * @param userObj The user who created or last modified the entity. - * @param branches The list of branch names for which the acknowledgment applies (or null if - * all). - * @param devices The list of device build flavors for which the acknowledgment applies (or null - * if all). - * @param testCaseNames The list of test case names known to fail (or null if all). - * @param note A text blob with details about the failure (or null if all). - */ - public TestAcknowledgmentEntity( - Key test, - User userObj, - List<String> branches, - List<String> devices, - List<String> testCaseNames, - Text note) { - this(null, -1, test, userObj, branches, devices, testCaseNames, note); - } - - /** Saving function for the instance of this class */ - @Override - public com.googlecode.objectify.Key<TestAcknowledgmentEntity> save() { - return ofy().save().entity(this).now(); - } - - public Entity toEntity() { - Entity ackEntity; - if (this.key == null) ackEntity = new Entity(KIND); - else ackEntity = new Entity(key); - - ackEntity.setProperty(TEST_KEY, this.test); - ackEntity.setProperty(USER_OBJ, this.userObj); - - long created = this.created; - if (created < 0) created = TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()); - ackEntity.setProperty(CREATED, created); - - if (this.branches != null && this.branches.size() > 0) - ackEntity.setUnindexedProperty(BRANCHES, new ArrayList<>(this.branches)); - - if (this.devices != null && this.devices.size() > 0) - ackEntity.setUnindexedProperty(DEVICES, new ArrayList<>(this.devices)); - - if (this.testCaseNames != null && this.testCaseNames.size() > 0) - ackEntity.setUnindexedProperty(TEST_CASE_NAMES, new ArrayList<>(this.testCaseNames)); - - if (this.note != null) ackEntity.setUnindexedProperty(NOTE, new Text(this.note)); - return ackEntity; - } - - /** - * Convert an Entity object to a TestAcknowledgmentEntity. - * - * @param e The entity to process. - * @return TestEntity object with the properties from e processed, or null if incompatible. - */ - @SuppressWarnings("unchecked") - public static TestAcknowledgmentEntity fromEntity(Entity e) { - if (!e.getKind().equals(KIND) - || !e.hasProperty(TEST_KEY) - || !e.hasProperty(USER_OBJ) - || !e.hasProperty(CREATED)) { - logger.log( - Level.WARNING, "Missing attributes in acknowledgment entity: " + e.toString()); - return null; - } - try { - Key test = (Key) e.getProperty(TEST_KEY); - User user = (User) e.getProperty(USER_OBJ); - long created = (long) e.getProperty(CREATED); - - List<String> branches; - if (e.hasProperty(BRANCHES)) branches = (List<String>) e.getProperty(BRANCHES); - else branches = null; - - List<String> devices; - if (e.hasProperty(DEVICES)) devices = (List<String>) e.getProperty(DEVICES); - else devices = null; - - List<String> testCaseNames; - if (e.hasProperty(TEST_CASE_NAMES)) - testCaseNames = (List<String>) e.getProperty(TEST_CASE_NAMES); - else testCaseNames = null; - - Text note = null; - if (e.hasProperty(NOTE)) note = (Text) e.getProperty(NOTE); - return new TestAcknowledgmentEntity( - e.getKey(), created, test, user, branches, devices, testCaseNames, note); - } catch (ClassCastException exception) { - logger.log(Level.WARNING, "Corrupted data in entity: " + e.getKey()); - return null; - } - } - - /** - * Convert a JSON object to a TestAcknowledgmentEntity. - * - * @param user The user requesting the conversion. - * @param json The json object to convert. - * @return TestAcknowledgmentEntity with the data from the json object. - */ - public static TestAcknowledgmentEntity fromJson(User user, JsonObject json) { - try { - if (!json.has(TEST_NAME)) return null; - String testName = json.get(TEST_NAME).getAsString(); - Key testKey = KeyFactory.createKey(TestEntity.KIND, testName); - List<String> branches = null; - - Type listType = new TypeToken<List<String>>() {}.getType(); - if (json.has(BRANCHES)) { - branches = new Gson().fromJson(json.get(BRANCHES), listType); - } - - List<String> devices = null; - if (json.has(DEVICES)) { - devices = new Gson().fromJson(json.get(DEVICES), listType); - } - - List<String> testCaseNames = null; - if (json.has(TEST_CASE_NAMES)) { - testCaseNames = new Gson().fromJson(json.get(TEST_CASE_NAMES), listType); - } - - Text note = null; - if (json.has(NOTE)) { - note = new Text(json.get(NOTE).getAsString()); - } - - Key key = null; - if (json.has(KEY)) { - key = KeyFactory.stringToKey(json.get(KEY).getAsString()); - } - return new TestAcknowledgmentEntity( - key, -1l, testKey, user, branches, devices, testCaseNames, note); - } catch (ClassCastException | IllegalStateException e) { - return null; - } - } - - /** - * Convert the entity to a json object. - * - * @return The entity serialized in JSON format. - */ - public JsonObject toJson() { - JsonObject json = new JsonObject(); - json.add(KEY, new JsonPrimitive(KeyFactory.keyToString(this.key))); - json.add(TEST_NAME, new JsonPrimitive(this.test.getName())); - json.add(USER_OBJ, new JsonPrimitive(this.userObj.getEmail())); - json.add(CREATED, new JsonPrimitive(this.created)); - - List<JsonElement> branches = new ArrayList<>(); - if (this.branches != null) { - for (String branch : this.branches) { - branches.add(new JsonPrimitive(branch)); - } - } - json.add(BRANCHES, new Gson().toJsonTree(branches)); - - List<JsonElement> devices = new ArrayList<>(); - if (this.devices != null) { - for (String device : this.devices) { - devices.add(new JsonPrimitive(device)); - } - } - json.add(DEVICES, new Gson().toJsonTree(devices)); - - List<JsonElement> testCaseNames = new ArrayList<>(); - if (this.testCaseNames != null) { - for (String testCaseName : this.testCaseNames) { - testCaseNames.add(new JsonPrimitive(testCaseName)); - } - } - json.add(TEST_CASE_NAMES, new Gson().toJsonTree(testCaseNames)); - - String note = ""; - if (this.note != null) note = this.note; - json.add(NOTE, new JsonPrimitive(note)); - return json; - } -} diff --git a/src/main/java/com/android/vts/entity/TestCaseRunEntity.java b/src/main/java/com/android/vts/entity/TestCaseRunEntity.java deleted file mode 100644 index 85a6c43..0000000 --- a/src/main/java/com/android/vts/entity/TestCaseRunEntity.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.KeyFactory; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Ignore; -import com.googlecode.objectify.annotation.OnLoad; -import java.util.ArrayList; -import java.util.List; -import lombok.Data; -import lombok.extern.slf4j.Slf4j; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -@com.googlecode.objectify.annotation.Entity(name = "TestCaseRun") -@Cache -@Data -@Slf4j -/** Entity describing the execution of a test case. */ -public class TestCaseRunEntity implements DashboardEntity { - - public static final String KIND = "TestCaseRun"; - - // Property keys - public static final String TEST_CASE_NAME = "testCaseName"; - public static final String RESULT = "result"; - public static final String TEST_CASE_NAMES = "testCaseNames"; - public static final String RESULTS = "results"; - public static final String SYSTRACE_URL = "systraceUrl"; - - // Maximum number of test cases in the entity. - private static final int SIZE_LIMIT = 500; - - @Id - private Long id; - - private List<Integer> results; - - private List<String> testCaseNames; - - @Ignore - public final List<TestCase> testCases; - - @Ignore - private String systraceUrl; - - /** - * Class describing an individual test case run. - */ - public static class TestCase { - public final long parentId; - public final int offset; - public final String name; - public final int result; - - /** - * Create a test case run. - * @param parentId The ID of the TestCaseRunEntity containing the test case. - * @param offset The offset of the TestCase into the TestCaseRunEntity. - * @param name The name of the test case. - * @param result The result of the test case. - */ - public TestCase(long parentId, int offset, String name, int result) { - this.parentId = parentId; - this.offset = offset; - this.name = name; - this.result = result; - } - } - - /** - * Create a TestCaseRunEntity. - */ - public TestCaseRunEntity() { - this.results = new ArrayList<>(); - this.testCaseNames = new ArrayList<>(); - this.testCases = new ArrayList<>(); - this.systraceUrl = null; - } - - /** - * Create a TestCaseRunEntity with the specified id. - * @param id The entity id. - */ - public TestCaseRunEntity(long id) { - this.id = id; - this.results = new ArrayList<>(); - this.testCaseNames = new ArrayList<>(); - this.testCases = new ArrayList<>(); - this.systraceUrl = null; - } - - /** - * Determine if the TestCaseRunEntity is full. - * @return True if the entity is full, false otherwise. - */ - public boolean isFull() { - return this.testCases.size() >= SIZE_LIMIT; - } - - /** - * Set the systrace url. - * @param url The systrace url, or null. - */ - private void setSystraceUrl(String url) { - this.systraceUrl = url; - } - - /** - * Get the systrace url. - * returns The systrace url, or null. - */ - public String getSystraceUrl() { - return this.systraceUrl; - } - - /** - * Called after the POJO is populated with data through objecitfy library - */ - @OnLoad - private void onLoad() { - if (testCaseNames.size() == results.size()) { - for (int index = 0; index < testCaseNames.size(); index++) { - String name = testCaseNames.get(index); - int result = results.get(index).intValue(); - this.testCases.add(new TestCase(this.id, this.testCases.size(), name, result)); - } - } - } - - /** - * Add a test case to the test case run entity. - * @param name The name of the test case. - * @param result The result of the test case. - * @return true if added, false otherwise. - */ - public boolean addTestCase(String name, int result) { - if (this.isFull()) { - return false; - } else { - this.testCaseNames.add(name); - this.results.add(result); - return true; - } - } - - /** Saving function for the instance of this class */ - @Override - public com.googlecode.objectify.Key<TestCaseRunEntity> save() { - return ofy().save().entity(this).now(); - } - - public Entity toEntity() { - Entity testCaseRunEntity; - if (this.id >= 0) { - testCaseRunEntity = new Entity(KeyFactory.createKey(KIND, id)); - } else { - testCaseRunEntity = new Entity(KIND); - } - - if (this.testCases.size() > 0) { - List<String> testCaseNames = new ArrayList<>(); - List<Integer> results = new ArrayList<>(); - for (TestCase testCase : this.testCases) { - testCaseNames.add(testCase.name); - results.add(testCase.result); - } - testCaseRunEntity.setUnindexedProperty(TEST_CASE_NAMES, testCaseNames); - testCaseRunEntity.setUnindexedProperty(RESULTS, results); - } - if (systraceUrl != null) { - testCaseRunEntity.setUnindexedProperty(SYSTRACE_URL, this.systraceUrl); - } - - return testCaseRunEntity; - } - - /** - * Convert an Entity object to a TestCaseRunEntity. - * - * @param e The entity to process. - * @return TestCaseRunEntity object with the properties from e, or null if incompatible. - */ - @SuppressWarnings("unchecked") - public static TestCaseRunEntity fromEntity(Entity e) { - if (!e.getKind().equals(KIND)) { - log.warn("Wrong kind: " + e.getKey()); - return null; - } - try { - TestCaseRunEntity testCaseRun = new TestCaseRunEntity(e.getKey().getId()); - if (e.hasProperty(TEST_CASE_NAMES) && e.hasProperty(RESULTS)) { - List<String> testCaseNames = (List<String>) e.getProperty(TEST_CASE_NAMES); - List<Long> results = (List<Long>) e.getProperty(RESULTS); - if (testCaseNames.size() == results.size()) { - for (int i = 0; i < testCaseNames.size(); i++) { - testCaseRun.addTestCase(testCaseNames.get(i), results.get(i).intValue()); - } - } - } - if (e.hasProperty(TEST_CASE_NAME) && e.hasProperty(RESULT)) { - testCaseRun.addTestCase( - (String) e.getProperty(TEST_CASE_NAME), (int) (long) e.getProperty(RESULT)); - } - if (e.hasProperty(SYSTRACE_URL)) { - String systraceUrl = (String) e.getProperty(SYSTRACE_URL); - testCaseRun.setSystraceUrl(systraceUrl); - } - return testCaseRun; - } catch (ClassCastException exception) { - // Invalid cast - log.warn("Error parsing test case run entity.", exception); - } - return null; - } -} diff --git a/src/main/java/com/android/vts/entity/TestCoverageStatusEntity.java b/src/main/java/com/android/vts/entity/TestCoverageStatusEntity.java deleted file mode 100644 index 1156cc7..0000000 --- a/src/main/java/com/android/vts/entity/TestCoverageStatusEntity.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -import com.google.appengine.api.datastore.Entity; -import com.googlecode.objectify.Key; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Index; -import java.util.Collection; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Collectors; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@com.googlecode.objectify.annotation.Entity(name = "TestCoverageStatus") -@EqualsAndHashCode(of = "testName") -@Cache -@NoArgsConstructor -/** Entity describing test coverage status. */ -public class TestCoverageStatusEntity implements DashboardEntity { - - protected static final Logger logger = - Logger.getLogger(TestCoverageStatusEntity.class.getName()); - - public static final String KIND = "TestCoverageStatus"; - - // Property keys - public static final String TOTAL_LINE_COUNT = "totalLineCount"; - public static final String COVERED_LINE_COUNT = "coveredLineCount"; - public static final String UPDATED_TIMESTAMP = "updatedTimestamp"; - public static final String DEVICE_INFO_ID = "deviceInfoId"; - - /** TestCoverageStatusEntity name field */ - @Id @Getter @Setter String testName; - - /** TestCoverageStatusEntity coveredLineCount field */ - @Index @Getter @Setter long coveredLineCount; - - /** TestCoverageStatusEntity totalLineCount field */ - @Index @Getter @Setter long totalLineCount; - - /** TestCoverageStatusEntity updatedTimestamp field */ - @Index @Getter @Setter long updatedTimestamp; - - /** TestCoverageStatusEntity DeviceInfo Entity ID reference field */ - @Index @Getter @Setter long deviceInfoId; - - /** TestCoverageStatusEntity updatedCoveredLineCount field */ - @Index @Getter @Setter long updatedCoveredLineCount; - - /** TestCoverageStatusEntity updatedTotalLineCount field */ - @Index @Getter @Setter long updatedTotalLineCount; - - /** TestCoverageStatusEntity updatedDate field */ - @Index @Getter @Setter Date updatedDate; - - /** - * Create a TestCoverageStatusEntity object with status metadata. - * - * @param testName The name of the test. - * @param timestamp The timestamp indicating the most recent test run event in the test state. - * @param coveredLineCount The number of lines covered. - * @param totalLineCount The total number of lines. - */ - public TestCoverageStatusEntity( - String testName, - long timestamp, - long coveredLineCount, - long totalLineCount, - long deviceInfoId) { - this.testName = testName; - this.updatedTimestamp = timestamp; - this.coveredLineCount = coveredLineCount; - this.totalLineCount = totalLineCount; - this.deviceInfoId = deviceInfoId; - } - - /** find TestCoverageStatus entity by ID */ - public static TestCoverageStatusEntity findById(String testName) { - return ofy().load().type(TestCoverageStatusEntity.class).id(testName).now(); - } - - /** Get all TestCoverageStatusEntity List */ - public static Map<String, TestCoverageStatusEntity> getTestCoverageStatusMap() { - List<TestCoverageStatusEntity> testCoverageStatusEntityList = getAllTestCoverage(); - - Map<String, TestCoverageStatusEntity> testCoverageStatusMap = - testCoverageStatusEntityList.stream() - .collect(Collectors.toMap(t -> t.getTestName(), t -> t)); - return testCoverageStatusMap; - } - - /** Get all DeviceInfoEntity List by TestCoverageStatusEntities' key list */ - public static List<Key<DeviceInfoEntity>> getDeviceInfoEntityKeyList( - List<TestCoverageStatusEntity> testCoverageStatusEntityList) { - return testCoverageStatusEntityList - .stream() - .map( - testCoverageStatusEntity -> { - com.googlecode.objectify.Key testKey = - com.googlecode.objectify.Key.create( - TestEntity.class, - testCoverageStatusEntity.getTestName()); - com.googlecode.objectify.Key testRunKey = - com.googlecode.objectify.Key.create( - testKey, - TestRunEntity.class, - testCoverageStatusEntity.getUpdatedTimestamp()); - return com.googlecode.objectify.Key.create( - testRunKey, - DeviceInfoEntity.class, - testCoverageStatusEntity.getDeviceInfoId()); - }) - .collect(Collectors.toList()); - } - - /** Get all TestCoverageStatusEntity List */ - public static List<TestCoverageStatusEntity> getAllTestCoverage() { - return ofy().load().type(TestCoverageStatusEntity.class).list(); - } - - /** Get all TestCoverageStatusEntities' Branch List */ - public static Set<String> getBranchSet( - List<TestCoverageStatusEntity> testCoverageStatusEntityList) { - List<com.googlecode.objectify.Key<DeviceInfoEntity>> deviceInfoEntityKeyList = - getDeviceInfoEntityKeyList(testCoverageStatusEntityList); - - Collection<DeviceInfoEntity> deviceInfoEntityList = - ofy().load().keys(() -> deviceInfoEntityKeyList.iterator()).values(); - - Set<String> branchSet = - deviceInfoEntityList - .stream() - .map(deviceInfoEntity -> deviceInfoEntity.getBranch()) - .collect(Collectors.toSet()); - return branchSet; - } - - /** Get all TestCoverageStatusEntities' Device List */ - public static Set<String> getDeviceSet( - List<TestCoverageStatusEntity> testCoverageStatusEntityList) { - List<com.googlecode.objectify.Key<DeviceInfoEntity>> deviceInfoEntityKeyList = - getDeviceInfoEntityKeyList(testCoverageStatusEntityList); - - Collection<DeviceInfoEntity> deviceInfoEntityList = - ofy().load().keys(() -> deviceInfoEntityKeyList.iterator()).values(); - - Set<String> deviceSet = - deviceInfoEntityList - .stream() - .map(deviceInfoEntity -> deviceInfoEntity.getBuildFlavor()) - .collect(Collectors.toSet()); - return deviceSet; - } - - /** TestRunEntity function to get the related TestRunEntity from id value */ - public TestRunEntity getTestRunEntity() { - com.googlecode.objectify.Key testKey = - com.googlecode.objectify.Key.create(TestEntity.class, this.testName); - return ofy().load() - .type(TestRunEntity.class) - .parent(testKey) - .id(this.updatedTimestamp) - .now(); - } - - /** Saving function for the instance of this class */ - @Override - public Key<TestCoverageStatusEntity> save() { - this.updatedDate = new Date(); - return ofy().save().entity(this).now(); - } - - public Entity toEntity() { - Entity testEntity = new Entity(KIND, this.testName); - testEntity.setProperty(UPDATED_TIMESTAMP, this.updatedTimestamp); - testEntity.setProperty(COVERED_LINE_COUNT, this.coveredLineCount); - testEntity.setProperty(TOTAL_LINE_COUNT, this.totalLineCount); - return testEntity; - } - - /** - * Convert an Entity object to a TestCoverageStatusEntity. - * - * @param e The entity to process. - * @return TestCoverageStatusEntity object with the properties from e processed, or null if - * incompatible. - */ - @SuppressWarnings("unchecked") - public static TestCoverageStatusEntity fromEntity(Entity e) { - if (!e.getKind().equals(KIND) - || e.getKey().getName() == null - || !e.hasProperty(UPDATED_TIMESTAMP) - || !e.hasProperty(COVERED_LINE_COUNT) - || !e.hasProperty(TOTAL_LINE_COUNT) - || !e.hasProperty(DEVICE_INFO_ID)) { - logger.log(Level.WARNING, "Missing test attributes in entity: " + e.toString()); - return null; - } - String testName = e.getKey().getName(); - long timestamp = 0; - long coveredLineCount = -1; - long totalLineCount = -1; - long deviceInfoId = 0; - try { - timestamp = (long) e.getProperty(UPDATED_TIMESTAMP); - coveredLineCount = (Long) e.getProperty(COVERED_LINE_COUNT); - totalLineCount = (Long) e.getProperty(TOTAL_LINE_COUNT); - deviceInfoId = (Long) e.getProperty(DEVICE_INFO_ID); - } catch (ClassCastException exception) { - // Invalid contents or null values - logger.log(Level.WARNING, "Error parsing test entity.", exception); - return null; - } - return new TestCoverageStatusEntity( - testName, timestamp, coveredLineCount, totalLineCount, deviceInfoId); - } -} diff --git a/src/main/java/com/android/vts/entity/TestEntity.java b/src/main/java/com/android/vts/entity/TestEntity.java deleted file mode 100644 index 4df7fb0..0000000 --- a/src/main/java/com/android/vts/entity/TestEntity.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Entity; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Index; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Collectors; -import lombok.Data; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Entity(name = "Test") -@Cache -@Data -@NoArgsConstructor -/** Entity describing test metadata. */ -public class TestEntity implements DashboardEntity { - protected static final Logger logger = Logger.getLogger(TestEntity.class.getName()); - - public static final String KIND = "Test"; - public static final String HAS_PROFILING_DATA = "hasProfilingData"; - - @Id - @Getter - @Setter - private String testName; - - @Index - @Getter - @Setter - private boolean hasProfilingData; - - /** - * Create a TestEntity object. - * - * @param testName The name of the test. - * @param hasProfilingData True if the test includes profiling data. - */ - public TestEntity(String testName, boolean hasProfilingData) { - this.testName = testName; - this.hasProfilingData = hasProfilingData; - } - - /** - * Create a TestEntity object. - * - * @param testName The name of the test. - */ - public TestEntity(String testName) { - this(testName, false); - } - - /** Saving function for the instance of this class */ - @Override - public com.googlecode.objectify.Key<TestEntity> save() { - return ofy().save().entity(this).now(); - } - - public com.google.appengine.api.datastore.Entity toEntity() { - com.google.appengine.api.datastore.Entity testEntity = new com.google.appengine.api.datastore.Entity(this.getOldKey()); - testEntity.setProperty(HAS_PROFILING_DATA, this.hasProfilingData); - return testEntity; - } - - /** - * Get objectify TestRun Entity's key. - * - * @param startTimestamp test start timestamp - */ - public com.googlecode.objectify.Key getTestRunKey(long startTimestamp) { - com.googlecode.objectify.Key testKey = - com.googlecode.objectify.Key.create(TestEntity.class, this.getTestName()); - com.googlecode.objectify.Key testRunKey = - com.googlecode.objectify.Key.create(testKey, TestRunEntity.class, startTimestamp); - return testRunKey; - } - - /** - * Get key info from appengine based library. - */ - public Key getOldKey() { - return KeyFactory.createKey(KIND, testName); - } - - public static List<String> getAllTestNames() { - List<TestEntity> testEntityList = getAllTest(); - - List<String> allTestNames = testEntityList.stream() - .map(te -> te.getTestName()).collect(Collectors.toList()); - return allTestNames; - } - - public static List<TestEntity> getAllTest() { - return ofy().load().type(TestEntity.class).list(); - } - - @Override - public boolean equals(Object obj) { - if (obj == null || !TestEntity.class.isAssignableFrom(obj.getClass())) { - return false; - } - TestEntity test2 = (TestEntity) obj; - return ( - this.testName.equals(test2.testName) && - this.hasProfilingData == test2.hasProfilingData); - } - - /** - * Convert an Entity object to a TestEntity. - * - * @param e The entity to process. - * @return TestEntity object with the properties from e processed, or null if incompatible. - */ - @SuppressWarnings("unchecked") - public static TestEntity fromEntity(com.google.appengine.api.datastore.Entity e) { - if (!e.getKind().equals(KIND) || e.getKey().getName() == null) { - logger.log(Level.WARNING, "Missing test attributes in entity: " + e.toString()); - return null; - } - String testName = e.getKey().getName(); - boolean hasProfilingData = false; - if (e.hasProperty(HAS_PROFILING_DATA)) { - hasProfilingData = (boolean) e.getProperty(HAS_PROFILING_DATA); - } - return new TestEntity(testName, hasProfilingData); - } -} diff --git a/src/main/java/com/android/vts/entity/TestPlanEntity.java b/src/main/java/com/android/vts/entity/TestPlanEntity.java deleted file mode 100644 index 590db46..0000000 --- a/src/main/java/com/android/vts/entity/TestPlanEntity.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -import com.google.appengine.api.datastore.Entity; -import com.googlecode.objectify.Key; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Id; -import java.util.logging.Level; -import java.util.logging.Logger; -import lombok.Data; -import lombok.NoArgsConstructor; - -@com.googlecode.objectify.annotation.Entity(name = "TestPlan") -@Cache -@Data -@NoArgsConstructor -/** Entity describing test plan metadata. */ -public class TestPlanEntity implements DashboardEntity { - protected static final Logger logger = Logger.getLogger(TestPlanEntity.class.getName()); - - public static final String KIND = "TestPlan"; - - // Property keys - public static final String TEST_PLAN_NAME = "testPlanName"; - - @Id - public String testPlanName; - - /** - * Create a TestPlanEntity object. - * - * @param testPlanName The name of the test plan. - */ - public TestPlanEntity(String testPlanName) { - this.testPlanName = testPlanName; - } - - public Entity toEntity() { - Entity planEntity = new Entity(KIND, this.testPlanName); - return planEntity; - } - - public Key getKey() { - Key key = Key.create(TestPlanEntity.class, this.testPlanName); - return key; - } - - /** - * Convert an Entity object to a TestEntity. - * - * @param e The entity to process. - * @return TestEntity object with the properties from e processed, or null if incompatible. - */ - @SuppressWarnings("unchecked") - public static TestPlanEntity fromEntity(Entity e) { - if (!e.getKind().equals(KIND) || e.getKey().getName() == null - || !e.hasProperty(TEST_PLAN_NAME)) { - logger.log(Level.WARNING, "Missing test plan attributes in entity: " + e.toString()); - return null; - } - String testPlanName = e.getKey().getName(); - return new TestPlanEntity(testPlanName); - } - - /** Saving function for the instance of this class */ - @Override - public com.googlecode.objectify.Key<TestPlanEntity> save() { - return ofy().save().entity(this).now(); - } -} diff --git a/src/main/java/com/android/vts/entity/TestPlanRunEntity.java b/src/main/java/com/android/vts/entity/TestPlanRunEntity.java deleted file mode 100644 index de2e505..0000000 --- a/src/main/java/com/android/vts/entity/TestPlanRunEntity.java +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.taskqueue.Queue; -import com.google.appengine.api.taskqueue.QueueFactory; -import com.google.appengine.api.taskqueue.TaskOptions; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Ignore; -import com.googlecode.objectify.annotation.Index; -import com.googlecode.objectify.annotation.Parent; -import java.util.Date; -import java.util.List; -import java.util.Objects; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Collectors; -import lombok.Data; -import lombok.NoArgsConstructor; - -@com.googlecode.objectify.annotation.Entity(name = "TestPlanRun") -@Cache -@Data -@NoArgsConstructor -/** Entity describing test plan run information. */ -public class TestPlanRunEntity implements DashboardEntity { - - protected static final Logger logger = Logger.getLogger(TestPlanRunEntity.class.getName()); - - private final String QUEUE_NAME = "coverageApiQueue"; - - public static final String KIND = "TestPlanRun"; - - private static final String COVERAGE_API_URL = "/api/coverage/api/sum"; - - // Property keys - public static final String TEST_PLAN_NAME = "testPlanName"; - public static final String TYPE = "type"; - public static final String START_TIMESTAMP = "startTimestamp"; - public static final String END_TIMESTAMP = "endTimestamp"; - public static final String TEST_BUILD_ID = "testBuildId"; - public static final String PASS_COUNT = "passCount"; - public static final String FAIL_COUNT = "failCount"; - public static final String TOTAL_API_COUNT = "totalApiCount"; - public static final String TOTAL_COVERED_API_COUNT = "coveredApiCount"; - public static final String TEST_RUNS = "testRuns"; - - @Ignore public Key key; - - @Id private Long id; - - @Parent private com.googlecode.objectify.Key<TestPlanEntity> parent; - - @Index private String testPlanName; - - @Index private long type; - - @Index private long startTimestamp; - - @Index private long endTimestamp; - - @Index private String testBuildId; - - @Index private long passCount; - - @Index private long failCount; - - @Index private long totalApiCount; - - @Index private long coveredApiCount; - - @Ignore private List<Key> oldTestRuns; - - private List<com.googlecode.objectify.Key<TestRunEntity>> testRuns; - - /** When this record was created or updated */ - @Index Date updated; - - /** - * Create a TestPlanRunEntity object describing a test plan run. - * - * @param testPlanKey The key for the parent entity in the database. - * @param type The test run type (e.g. presubmit, postsubmit, other) - * @param startTimestamp The time in microseconds when the test plan run started. - * @param endTimestamp The time in microseconds when the test plan run ended. - * @param testBuildId The build ID of the VTS test build. - * @param passCount The number of passing test cases in the run. - * @param failCount The number of failing test cases in the run. - * @param testRuns A list of keys to the TestRunEntity objects for the plan run run. - */ - public TestPlanRunEntity( - Key testPlanKey, - String testPlanName, - long type, - long startTimestamp, - long endTimestamp, - String testBuildId, - long passCount, - long failCount, - long totalApiCount, - long coveredApiCount, - List<Key> testRuns) { - this.id = startTimestamp; - this.key = KeyFactory.createKey(testPlanKey, KIND, startTimestamp); - this.testPlanName = testPlanName; - this.type = type; - this.startTimestamp = startTimestamp; - this.endTimestamp = endTimestamp; - this.testBuildId = testBuildId; - this.passCount = passCount; - this.failCount = failCount; - this.totalApiCount = totalApiCount; - this.coveredApiCount = coveredApiCount; - this.oldTestRuns = testRuns; - this.testRuns = - testRuns.stream() - .map( - testRun -> { - com.googlecode.objectify.Key testParentKey = - com.googlecode.objectify.Key.create( - TestEntity.class, - testRun.getParent().getName()); - return com.googlecode.objectify.Key.create( - testParentKey, TestRunEntity.class, testRun.getId()); - }) - .collect(Collectors.toList()); - } - - /** - * Create a TestPlanRunEntity object describing a test plan run. - * - * @param testPlanKey The key for the parent entity in the database. - * @param type The test run type (e.g. presubmit, postsubmit, other) - * @param startTimestamp The time in microseconds when the test plan run started. - * @param endTimestamp The time in microseconds when the test plan run ended. - * @param testBuildId The build ID of the VTS test build. - * @param passCount The number of passing test cases in the run. - * @param failCount The number of failing test cases in the run. - * @param testRuns A list of keys to the TestRunEntity objects for the plan run run. - */ - public TestPlanRunEntity( - com.googlecode.objectify.Key<TestPlanEntity> testPlanKey, - String testPlanName, - long type, - long startTimestamp, - long endTimestamp, - String testBuildId, - long passCount, - long failCount, - long totalApiCount, - long coveredApiCount, - List<com.googlecode.objectify.Key<TestRunEntity>> testRuns) { - this.id = startTimestamp; - this.parent = testPlanKey; - this.testPlanName = testPlanName; - this.type = type; - this.startTimestamp = startTimestamp; - this.endTimestamp = endTimestamp; - this.testBuildId = testBuildId; - this.passCount = passCount; - this.failCount = failCount; - this.totalApiCount = totalApiCount; - this.coveredApiCount = coveredApiCount; - this.testRuns = testRuns; - } - - public Entity toEntity() { - Entity planRun = new Entity(this.key); - planRun.setProperty(TEST_PLAN_NAME, this.testPlanName); - planRun.setProperty(TYPE, this.type); - planRun.setProperty(START_TIMESTAMP, this.startTimestamp); - planRun.setProperty(END_TIMESTAMP, this.endTimestamp); - planRun.setProperty(TEST_BUILD_ID, this.testBuildId.toLowerCase()); - planRun.setProperty(PASS_COUNT, this.passCount); - planRun.setProperty(FAIL_COUNT, this.failCount); - if (this.oldTestRuns != null && this.oldTestRuns.size() > 0) { - planRun.setUnindexedProperty(TEST_RUNS, this.oldTestRuns); - } - return planRun; - } - - /** Saving function for the instance of this class */ - @Override - public com.googlecode.objectify.Key<TestPlanRunEntity> save() { - this.updated = new Date(); - return ofy().save().entity(this).now(); - } - - /** Get UrlSafeKey from this class */ - public String getUrlSafeKey() { - return this.getOfyKey().toUrlSafe(); - } - - /** Add a task to calculate the total number of coverage API */ - public void addCoverageApiTask() { - if (Objects.isNull(this.testRuns)) { - logger.log(Level.WARNING, "testRuns is null so adding task to the queue is skipped!"); - } else { - Queue queue = QueueFactory.getQueue(QUEUE_NAME); - queue.add( - TaskOptions.Builder.withUrl(COVERAGE_API_URL) - .param("urlSafeKey", this.getUrlSafeKey()) - .method(TaskOptions.Method.POST)); - } - } - - /** - * Get key info from appengine based library. - * - * @param parentKey parent key. - */ - public Key getOldKey(Key parentKey) { - return KeyFactory.createKey(parentKey, KIND, startTimestamp); - } - - /** Get key info from objecitfy library. */ - public com.googlecode.objectify.Key getOfyKey() { - return com.googlecode.objectify.Key.create( - this.parent, TestPlanRunEntity.class, this.startTimestamp); - } - - /** - * Convert an Entity object to a TestPlanRunEntity. - * - * @param e The entity to process. - * @return TestPlanRunEntity object with the properties from e processed, or null if - * incompatible. - */ - @SuppressWarnings("unchecked") - public static TestPlanRunEntity fromEntity(Entity e) { - if (!e.getKind().equals(KIND) - || !e.hasProperty(TEST_PLAN_NAME) - || !e.hasProperty(TYPE) - || !e.hasProperty(START_TIMESTAMP) - || !e.hasProperty(END_TIMESTAMP) - || !e.hasProperty(TEST_BUILD_ID) - || !e.hasProperty(PASS_COUNT) - || !e.hasProperty(FAIL_COUNT) - || !e.hasProperty(TEST_RUNS)) { - logger.log(Level.WARNING, "Missing test run attributes in entity: " + e.toString()); - return null; - } - try { - String testPlanName = (String) e.getProperty(TEST_PLAN_NAME); - long type = (long) e.getProperty(TYPE); - long startTimestamp = (long) e.getProperty(START_TIMESTAMP); - long endTimestamp = (long) e.getProperty(END_TIMESTAMP); - String testBuildId = (String) e.getProperty(TEST_BUILD_ID); - long passCount = (long) e.getProperty(PASS_COUNT); - long failCount = (long) e.getProperty(FAIL_COUNT); - - long totalApiCount = - e.hasProperty(TOTAL_API_COUNT) ? (long) e.getProperty(TOTAL_API_COUNT) : 0L; - long coveredApiCount = - e.hasProperty(TOTAL_COVERED_API_COUNT) - ? (long) e.getProperty(TOTAL_COVERED_API_COUNT) - : 0L; - List<Key> oldTestRuns = (List<Key>) e.getProperty(TEST_RUNS); - return new TestPlanRunEntity( - e.getKey().getParent(), - testPlanName, - type, - startTimestamp, - endTimestamp, - testBuildId, - passCount, - failCount, - totalApiCount, - coveredApiCount, - oldTestRuns); - } catch (ClassCastException exception) { - // Invalid cast - logger.log(Level.WARNING, "Error parsing test plan run entity.", exception); - } - return null; - } - - public JsonObject toJson() { - JsonObject json = new JsonObject(); - json.add(TEST_PLAN_NAME, new JsonPrimitive(this.testPlanName)); - json.add(TEST_BUILD_ID, new JsonPrimitive(this.testBuildId)); - json.add(PASS_COUNT, new JsonPrimitive(this.passCount)); - json.add(FAIL_COUNT, new JsonPrimitive(this.failCount)); - json.add(START_TIMESTAMP, new JsonPrimitive(this.startTimestamp)); - json.add(END_TIMESTAMP, new JsonPrimitive(this.endTimestamp)); - return json; - } -} diff --git a/src/main/java/com/android/vts/entity/TestRunEntity.java b/src/main/java/com/android/vts/entity/TestRunEntity.java deleted file mode 100644 index 0d5f1ec..0000000 --- a/src/main/java/com/android/vts/entity/TestRunEntity.java +++ /dev/null @@ -1,497 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -import com.android.vts.util.TimeUtil; -import com.android.vts.util.UrlUtil; -import com.android.vts.util.UrlUtil.LinkDisplay; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Ignore; -import com.googlecode.objectify.annotation.Index; -import com.googlecode.objectify.annotation.OnLoad; -import com.googlecode.objectify.annotation.Parent; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.function.Supplier; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Stream; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.apache.commons.lang3.math.NumberUtils; - -@com.googlecode.objectify.annotation.Entity(name = "TestRun") -@Cache -@NoArgsConstructor -/** Entity describing test run information. */ -public class TestRunEntity implements DashboardEntity { - protected static final Logger logger = Logger.getLogger(TestRunEntity.class.getName()); - - /** Enum for classifying test run types. */ - public enum TestRunType { - OTHER(0), - PRESUBMIT(1), - POSTSUBMIT(2); - - private final int value; - - private TestRunType(int value) { - this.value = value; - } - - /** - * Get the ordinal representation of the type. - * - * @return The value associated with the test run type. - */ - public int getNumber() { - return value; - } - - /** - * Convert an ordinal value to a TestRunType. - * - * @param value The orginal value to parse. - * @return a TestRunType value. - */ - public static TestRunType fromNumber(int value) { - if (value == 1) { - return TestRunType.PRESUBMIT; - } else if (value == 2) { - return TestRunType.POSTSUBMIT; - } else { - return TestRunType.OTHER; - } - } - - /** - * Determine the test run type based on the build ID. - * - * <p>Postsubmit runs are expected to have integer build IDs, while presubmit runs are - * integers prefixed by the character P. All other runs (e.g. local builds) are classified - * as OTHER. - * - * @param buildId The build ID. - * @return the TestRunType. - */ - public static TestRunType fromBuildId(String buildId) { - if (buildId.toLowerCase().startsWith("p")) { - if (NumberUtils.isParsable(buildId.substring(1))) { - return TestRunType.PRESUBMIT; - } else { - return TestRunType.OTHER; - } - } else if (NumberUtils.isParsable(buildId)) { - return TestRunType.POSTSUBMIT; - } else { - return TestRunType.OTHER; - } - } - } - - public static final String KIND = "TestRun"; - - // Property keys - public static final String TEST_NAME = "testName"; - public static final String TYPE = "type"; - public static final String START_TIMESTAMP = "startTimestamp"; - public static final String END_TIMESTAMP = "endTimestamp"; - public static final String TEST_BUILD_ID = "testBuildId"; - public static final String HOST_NAME = "hostName"; - public static final String PASS_COUNT = "passCount"; - public static final String FAIL_COUNT = "failCount"; - public static final String HAS_CODE_COVERAGE = "hasCodeCoverage"; - public static final String HAS_COVERAGE = "hasCoverage"; - public static final String TEST_CASE_IDS = "testCaseIds"; - public static final String LOG_LINKS = "logLinks"; - public static final String API_COVERAGE_KEY_LIST = "apiCoverageKeyList"; - public static final String TOTAL_API_COUNT = "totalApiCount"; - public static final String COVERED_API_COUNT = "coveredApiCount"; - - @Ignore private Key key; - - @Id @Getter @Setter private Long id; - - @Parent @Getter @Setter private com.googlecode.objectify.Key<?> testRunParent; - - @Index @Getter @Setter private long type; - - @Index @Getter @Setter private long startTimestamp; - - @Index @Getter @Setter private long endTimestamp; - - @Index @Getter @Setter private String testBuildId; - - @Index @Getter @Setter private String testName; - - @Index @Getter @Setter private String hostName; - - @Index @Getter @Setter private long passCount; - - @Index @Getter @Setter private long failCount; - - @Index private boolean hasCoverage; - - @Index @Getter @Setter private boolean hasCodeCoverage; - - @Ignore private com.googlecode.objectify.Key<CodeCoverageEntity> codeCoverageEntityKey; - - @Index @Getter @Setter private long coveredLineCount; - - @Index @Getter @Setter private long totalLineCount; - - @Getter @Setter private List<Long> testCaseIds; - - @Getter @Setter private List<String> logLinks; - - /** - * Create a TestRunEntity object describing a test run. - * - * @param parentKey The key to the parent TestEntity. - * @param type The test run type (e.g. presubmit, postsubmit, other) - * @param startTimestamp The time in microseconds when the test run started. - * @param endTimestamp The time in microseconds when the test run ended. - * @param testBuildId The build ID of the VTS test build. - * @param hostName The name of host machine. - * @param passCount The number of passing test cases in the run. - * @param failCount The number of failing test cases in the run. - */ - public TestRunEntity( - Key parentKey, - long type, - long startTimestamp, - long endTimestamp, - String testBuildId, - String hostName, - long passCount, - long failCount, - boolean hasCodeCoverage, - List<Long> testCaseIds, - List<String> logLinks) { - this.id = startTimestamp; - this.key = KeyFactory.createKey(parentKey, KIND, startTimestamp); - this.type = type; - this.startTimestamp = startTimestamp; - this.endTimestamp = endTimestamp; - this.testBuildId = testBuildId; - this.hostName = hostName; - this.passCount = passCount; - this.failCount = failCount; - this.hasCodeCoverage = hasCodeCoverage; - this.testName = parentKey.getName(); - this.testCaseIds = testCaseIds; - this.logLinks = logLinks; - - this.testRunParent = com.googlecode.objectify.Key.create(TestEntity.class, testName); - this.codeCoverageEntityKey = getCodeCoverageEntityKey(); - } - - /** - * Called after the POJO is populated with data through objecitfy library - */ - @OnLoad - private void onLoad() { - if (Objects.isNull(this.hasCodeCoverage)) { - this.hasCodeCoverage = this.hasCoverage; - this.save(); - } - } - - public Entity toEntity() { - Entity testRunEntity = new Entity(this.key); - testRunEntity.setProperty(TEST_NAME, this.testName); - testRunEntity.setProperty(TYPE, this.type); - testRunEntity.setProperty(START_TIMESTAMP, this.startTimestamp); - testRunEntity.setUnindexedProperty(END_TIMESTAMP, this.endTimestamp); - testRunEntity.setProperty(TEST_BUILD_ID, this.testBuildId.toLowerCase()); - testRunEntity.setProperty(HOST_NAME, this.hostName.toLowerCase()); - testRunEntity.setProperty(PASS_COUNT, this.passCount); - testRunEntity.setProperty(FAIL_COUNT, this.failCount); - testRunEntity.setProperty(HAS_CODE_COVERAGE, this.hasCodeCoverage); - testRunEntity.setUnindexedProperty(TEST_CASE_IDS, this.testCaseIds); - if (this.logLinks != null && this.logLinks.size() > 0) { - testRunEntity.setUnindexedProperty(LOG_LINKS, this.logLinks); - } - return testRunEntity; - } - - /** Saving function for the instance of this class */ - @Override - public com.googlecode.objectify.Key<TestRunEntity> save() { - return ofy().save().entity(this).now(); - } - - /** - * Get key info from appengine based library. - */ - public Key getKey() { - Key parentKey = KeyFactory.createKey(TestEntity.KIND, testName); - return KeyFactory.createKey(parentKey, KIND, startTimestamp); - } - - /** Getter hasCodeCoverage value */ - public boolean getHasCodeCoverage() { - return this.hasCodeCoverage; - } - - /** Getter DateTime string from startTimestamp */ - public String getStartDateTime() { - return TimeUtil.getDateTimeString(this.startTimestamp); - } - - /** Getter DateTime string from startTimestamp */ - public String getEndDateTime() { - return TimeUtil.getDateTimeString(this.endTimestamp); - } - - /** find TestRun entity by ID and test name */ - public static TestRunEntity getByTestNameId(String testName, long id) { - com.googlecode.objectify.Key testKey = - com.googlecode.objectify.Key.create(TestEntity.class, testName); - return ofy().load().type(TestRunEntity.class).parent(testKey).id(id).now(); - } - - /** Get CodeCoverageEntity Key to generate Key by combining key info */ - private com.googlecode.objectify.Key getCodeCoverageEntityKey() { - com.googlecode.objectify.Key testRunKey = this.getOfyKey(); - return com.googlecode.objectify.Key.create( - testRunKey, CodeCoverageEntity.class, this.startTimestamp); - } - - /** Get ApiCoverageEntity Key from the parent key */ - public com.googlecode.objectify.Key getOfyKey() { - com.googlecode.objectify.Key testKey = - com.googlecode.objectify.Key.create( - TestEntity.class, this.testName); - com.googlecode.objectify.Key testRunKey = - com.googlecode.objectify.Key.create( - testKey, TestRunEntity.class, this.startTimestamp); - return testRunKey; - } - - /** Get ApiCoverageEntity from key info */ - public Optional<List<ApiCoverageEntity>> getApiCoverageEntityList() { - com.googlecode.objectify.Key testRunKey = this.getOfyKey(); - List<ApiCoverageEntity> apiCoverageEntityList = - ofy().load().type(ApiCoverageEntity.class).ancestor(testRunKey).list(); - return Optional.ofNullable(apiCoverageEntityList); - } - - /** - * Get CodeCoverageEntity instance from codeCoverageEntityKey value. - */ - public CodeCoverageEntity getCodeCoverageEntity() { - if (this.hasCodeCoverage) { - CodeCoverageEntity codeCoverageEntity = - ofy().load() - .type(CodeCoverageEntity.class) - .filterKey(this.codeCoverageEntityKey) - .first() - .now(); - if (Objects.isNull(codeCoverageEntity)) { - codeCoverageEntity = - new CodeCoverageEntity( - this.getKey(), coveredLineCount, totalLineCount); - codeCoverageEntity.save(); - return codeCoverageEntity; - } else { - return codeCoverageEntity; - } - } else { - logger.log( - Level.WARNING, - "The hasCodeCoverage value is false. Please check the code coverage entity key"); - return null; - } - } - - /** - * Convert an Entity object to a TestRunEntity. - * - * @param e The entity to process. - * @return TestRunEntity object with the properties from e processed, or null if incompatible. - */ - @SuppressWarnings("unchecked") - public static TestRunEntity fromEntity(Entity e) { - if (!e.getKind().equals(KIND) - || !e.hasProperty(TYPE) - || !e.hasProperty(START_TIMESTAMP) - || !e.hasProperty(END_TIMESTAMP) - || !e.hasProperty(TEST_BUILD_ID) - || !e.hasProperty(HOST_NAME) - || !e.hasProperty(PASS_COUNT) - || !e.hasProperty(FAIL_COUNT)) { - logger.log(Level.WARNING, "Missing test run attributes in entity: " + e.toString()); - return null; - } - try { - long type = (long) e.getProperty(TYPE); - long startTimestamp = (long) e.getProperty(START_TIMESTAMP); - long endTimestamp = (long) e.getProperty(END_TIMESTAMP); - String testBuildId = (String) e.getProperty(TEST_BUILD_ID); - String hostName = (String) e.getProperty(HOST_NAME); - long passCount = (long) e.getProperty(PASS_COUNT); - long failCount = (long) e.getProperty(FAIL_COUNT); - boolean hasCodeCoverage = false; - if (e.hasProperty(HAS_CODE_COVERAGE)) { - hasCodeCoverage = (boolean) e.getProperty(HAS_CODE_COVERAGE); - } else { - hasCodeCoverage = (boolean) e.getProperty(HAS_COVERAGE); - } - List<Long> testCaseIds = (List<Long>) e.getProperty(TEST_CASE_IDS); - if (Objects.isNull(testCaseIds)) { - testCaseIds = new ArrayList<>(); - } - List<String> links = new ArrayList<>(); - if (e.hasProperty(LOG_LINKS)) { - links = (List<String>) e.getProperty(LOG_LINKS); - } - return new TestRunEntity( - e.getKey().getParent(), - type, - startTimestamp, - endTimestamp, - testBuildId, - hostName, - passCount, - failCount, - hasCodeCoverage, - testCaseIds, - links); - } catch (ClassCastException exception) { - // Invalid cast - logger.log(Level.WARNING, "Error parsing test run entity.", exception); - } - return null; - } - - /** Get JsonFormat logLinks */ - public JsonElement getJsonLogLinks() { - List<String> logLinks = this.getLogLinks(); - List<JsonElement> links = new ArrayList<>(); - if (logLinks != null && logLinks.size() > 0) { - for (String rawUrl : logLinks) { - UrlUtil.LinkDisplay validatedLink = UrlUtil.processUrl(rawUrl); - if (validatedLink == null) { - logger.log(Level.WARNING, "Invalid logging URL : " + rawUrl); - continue; - } - String[] logInfo = new String[] {validatedLink.name, validatedLink.url}; - links.add(new Gson().toJsonTree(logInfo)); - } - } - return new Gson().toJsonTree(links); - } - - public JsonObject toJson() { - Map<String, TestCoverageStatusEntity> testCoverageStatusMap = TestCoverageStatusEntity - .getTestCoverageStatusMap(); - - JsonObject json = new JsonObject(); - json.add(TEST_NAME, new JsonPrimitive(this.testName)); - json.add(TEST_BUILD_ID, new JsonPrimitive(this.testBuildId)); - json.add(HOST_NAME, new JsonPrimitive(this.hostName)); - json.add(PASS_COUNT, new JsonPrimitive(this.passCount)); - json.add(FAIL_COUNT, new JsonPrimitive(this.failCount)); - json.add(START_TIMESTAMP, new JsonPrimitive(this.startTimestamp)); - json.add(END_TIMESTAMP, new JsonPrimitive(this.endTimestamp)); - - // Overwrite the coverage value with newly update value from user decision - if (this.hasCodeCoverage) { - CodeCoverageEntity codeCoverageEntity = this.getCodeCoverageEntity(); - if (testCoverageStatusMap.containsKey(this.testName)) { - TestCoverageStatusEntity testCoverageStatusEntity = - testCoverageStatusMap.get(this.testName); - - if (testCoverageStatusEntity.getUpdatedCoveredLineCount() > 0) { - codeCoverageEntity.setCoveredLineCount( - testCoverageStatusEntity.getUpdatedCoveredLineCount()); - } - if (testCoverageStatusEntity.getUpdatedTotalLineCount() > 0) { - codeCoverageEntity.setTotalLineCount( - testCoverageStatusEntity.getUpdatedTotalLineCount()); - } - } - - long totalLineCount = codeCoverageEntity.getTotalLineCount(); - long coveredLineCount = codeCoverageEntity.getCoveredLineCount(); - if (totalLineCount > 0 && coveredLineCount >= 0) { - json.add(CodeCoverageEntity.COVERED_LINE_COUNT, new JsonPrimitive(coveredLineCount)); - json.add(CodeCoverageEntity.TOTAL_LINE_COUNT, new JsonPrimitive(totalLineCount)); - } - } - - Optional<List<ApiCoverageEntity>> apiCoverageEntityOptionList = - this.getApiCoverageEntityList(); - if (apiCoverageEntityOptionList.isPresent()) { - List<ApiCoverageEntity> apiCoverageEntityList = apiCoverageEntityOptionList.get(); - Supplier<Stream<ApiCoverageEntity>> apiCoverageStreamSupplier = - () -> apiCoverageEntityList.stream(); - int totalHalApi = - apiCoverageStreamSupplier.get().mapToInt(data -> data.getHalApi().size()).sum(); - if (totalHalApi > 0) { - int coveredHalApi = - apiCoverageStreamSupplier - .get() - .mapToInt(data -> data.getCoveredHalApi().size()) - .sum(); - JsonArray apiCoverageKeyArray = - apiCoverageStreamSupplier - .get() - .map(data -> new JsonPrimitive(data.getUrlSafeKey())) - .collect(JsonArray::new, JsonArray::add, JsonArray::addAll); - - json.add(API_COVERAGE_KEY_LIST, apiCoverageKeyArray); - json.add(COVERED_API_COUNT, new JsonPrimitive(coveredHalApi)); - json.add(TOTAL_API_COUNT, new JsonPrimitive(totalHalApi)); - } - } - - List<String> logLinks = this.getLogLinks(); - if (logLinks != null && logLinks.size() > 0) { - List<JsonElement> links = new ArrayList<>(); - for (String rawUrl : logLinks) { - LinkDisplay validatedLink = UrlUtil.processUrl(rawUrl); - if (validatedLink == null) { - logger.log(Level.WARNING, "Invalid logging URL : " + rawUrl); - continue; - } - String[] logInfo = new String[] {validatedLink.name, validatedLink.url}; - links.add(new Gson().toJsonTree(logInfo)); - } - if (links.size() > 0) { - json.add(this.LOG_LINKS, new Gson().toJsonTree(links)); - } - } - return json; - } -} diff --git a/src/main/java/com/android/vts/entity/TestStatusEntity.java b/src/main/java/com/android/vts/entity/TestStatusEntity.java deleted file mode 100644 index b703c64..0000000 --- a/src/main/java/com/android/vts/entity/TestStatusEntity.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.android.vts.entity.TestCaseRunEntity.TestCase; -import com.google.appengine.api.datastore.Entity; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Ignore; -import com.googlecode.objectify.annotation.Index; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; -import lombok.Data; -import lombok.NoArgsConstructor; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -@com.googlecode.objectify.annotation.Entity(name = "TestStatus") -@Cache -@Data -@NoArgsConstructor -/** Entity describing test status. */ -public class TestStatusEntity implements DashboardEntity { - protected static final Logger logger = Logger.getLogger(TestStatusEntity.class.getName()); - - public static final String KIND = "TestStatus"; - - // Property keys - public static final String PASS_COUNT = "passCount"; - public static final String FAIL_COUNT = "failCount"; - public static final String UPDATED_TIMESTAMP = "updatedTimestamp"; - - protected static final String FAILING_IDS = "failingTestcaseIds"; - protected static final String FAILING_OFFSETS = "failingTestcaseOffsets"; - - /** ID field */ - @Id private String testName; - - /** Failing Testcase ID List field */ - private List<Long> failingTestcaseIds; - - /** Failing Testcase Offsets List field */ - private List<Integer> failingTestcaseOffsets; - - /** pass count field */ - @Index private int passCount; - - /** fail count field */ - @Index private int failCount; - - /** updated timestamp field */ - @Index private long updatedTimestamp; - - @Ignore private List<TestCaseReference> failingTestCases; - - /** Object representing a reference to a test case. */ - public static class TestCaseReference { - public final long parentId; - public final int offset; - - /** - * Create a test case reference. - * - * @param parentId The ID of the TestCaseRunEntity containing the test case. - * @param offset The offset of the test case into the TestCaseRunEntity. - */ - public TestCaseReference(long parentId, int offset) { - this.parentId = parentId; - this.offset = offset; - } - - /** - * Create a test case reference. - * - * @param testCase The TestCase to reference. - */ - public TestCaseReference(TestCase testCase) { - this(testCase.parentId, testCase.offset); - } - } - - /** - * Create a TestEntity object with status metadata. - * - * @param testName The name of the test. - * @param timestamp The timestamp indicating the most recent test run event in the test state. - * @param passCount The number of tests passing up to the timestamp specified. - * @param failCount The number of tests failing up to the timestamp specified. - * @param failingTestCases The TestCaseReferences of the last observed failing test cases. - */ - public TestStatusEntity( - String testName, - long timestamp, - int passCount, - int failCount, - List<TestCaseReference> failingTestCases) { - this.testName = testName; - this.updatedTimestamp = timestamp; - this.passCount = passCount; - this.failCount = failCount; - this.failingTestCases = failingTestCases; - } - - /** - * Create a TestEntity object without metadata. - * - * @param testName The name of the test. - */ - public TestStatusEntity(String testName) { - this(testName, 0, -1, -1, new ArrayList<TestCaseReference>()); - } - - /** Saving function for the instance of this class */ - @Override - public com.googlecode.objectify.Key<TestStatusEntity> save() { - return ofy().save().entity(this).now(); - } - - public Entity toEntity() { - Entity testEntity = new Entity(KIND, this.testName); - if (this.updatedTimestamp >= 0 && this.passCount >= 0 && this.failCount >= 0) { - testEntity.setProperty(UPDATED_TIMESTAMP, this.updatedTimestamp); - testEntity.setProperty(PASS_COUNT, this.passCount); - testEntity.setProperty(FAIL_COUNT, this.failCount); - if (this.failingTestCases.size() > 0) { - List<Long> failingTestcaseIds = new ArrayList<>(); - List<Integer> failingTestcaseOffsets = new ArrayList<>(); - for (TestCaseReference testCase : this.failingTestCases) { - failingTestcaseIds.add(testCase.parentId); - failingTestcaseOffsets.add(testCase.offset); - } - testEntity.setUnindexedProperty(FAILING_IDS, failingTestcaseIds); - testEntity.setUnindexedProperty(FAILING_OFFSETS, failingTestcaseOffsets); - } - } - return testEntity; - } - - /** - * Convert an Entity object to a TestEntity. - * - * @param e The entity to process. - * @return TestEntity object with the properties from e processed, or null if incompatible. - */ - @SuppressWarnings("unchecked") - public static TestStatusEntity fromEntity(Entity e) { - if (!e.getKind().equals(KIND) || e.getKey().getName() == null) { - logger.log(Level.WARNING, "Missing test attributes in entity: " + e.toString()); - return null; - } - String testName = e.getKey().getName(); - long timestamp = 0; - int passCount = -1; - int failCount = -1; - List<TestCaseReference> failingTestCases = new ArrayList<>(); - try { - if (e.hasProperty(UPDATED_TIMESTAMP)) { - timestamp = (long) e.getProperty(UPDATED_TIMESTAMP); - } - if (e.hasProperty(PASS_COUNT)) { - passCount = ((Long) e.getProperty(PASS_COUNT)).intValue(); - } - if (e.hasProperty(FAIL_COUNT)) { - failCount = ((Long) e.getProperty(FAIL_COUNT)).intValue(); - } - if (e.hasProperty(FAILING_IDS) && e.hasProperty(FAILING_OFFSETS)) { - List<Long> ids = (List<Long>) e.getProperty(FAILING_IDS); - List<Long> offsets = (List<Long>) e.getProperty(FAILING_OFFSETS); - if (ids.size() == offsets.size()) { - for (int i = 0; i < ids.size(); i++) { - failingTestCases.add( - new TestCaseReference(ids.get(i), offsets.get(i).intValue())); - } - } - } - } catch (ClassCastException exception) { - // Invalid contents or null values - logger.log(Level.WARNING, "Error parsing test entity.", exception); - } - return new TestStatusEntity(testName, timestamp, passCount, failCount, failingTestCases); - } -} diff --git a/src/main/java/com/android/vts/entity/TestSuiteFileEntity.java b/src/main/java/com/android/vts/entity/TestSuiteFileEntity.java deleted file mode 100644 index c68f2ec..0000000 --- a/src/main/java/com/android/vts/entity/TestSuiteFileEntity.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.googlecode.objectify.Key; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Entity; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Index; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Date; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -/** Entity Class for Suite Test File Info */ -@Cache -@Entity -@EqualsAndHashCode(of = "id") -@NoArgsConstructor -public class TestSuiteFileEntity implements DashboardEntity { - - /** Test Suite full file path field */ - @Id @Getter @Setter String filePath; - - /** Test Suite year field in the filePath */ - @Index @Getter @Setter int year; - - /** Test Suite month field in the filePath */ - @Index @Getter @Setter int month; - - /** Test Suite day field in the filePath */ - @Index @Getter @Setter int day; - - /** Test Suite file name field */ - @Index @Getter @Setter String fileName; - - /** When this record was created or updated */ - @Index @Getter Date updated; - - /** Construction function for TestSuiteResultEntity Class */ - public TestSuiteFileEntity(String filePath) { - this.filePath = filePath; - Path pathInfo = Paths.get(filePath); - if (pathInfo.getNameCount() > 3) { - this.year = Integer.valueOf(pathInfo.getName(1).toString()); - this.month = Integer.valueOf(pathInfo.getName(2).toString()); - this.day = Integer.valueOf(pathInfo.getName(3).toString()); - this.fileName = pathInfo.getFileName().toString(); - } - } - - /** Saving function for the instance of this class */ - @Override - public Key<TestSuiteFileEntity> save() { - this.updated = new Date(); - return ofy().save().entity(this).now(); - } -} diff --git a/src/main/java/com/android/vts/entity/TestSuiteResultEntity.java b/src/main/java/com/android/vts/entity/TestSuiteResultEntity.java deleted file mode 100644 index 95ba5c8..0000000 --- a/src/main/java/com/android/vts/entity/TestSuiteResultEntity.java +++ /dev/null @@ -1,555 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.google.common.base.Strings; -import com.googlecode.objectify.Key; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Entity; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Ignore; -import com.googlecode.objectify.annotation.Index; -import com.googlecode.objectify.annotation.Parent; -import java.util.logging.Level; -import java.util.logging.Logger; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.text.StrSubstitutor; -import org.apache.http.NameValuePair; -import org.apache.http.ParseException; -import org.apache.http.client.utils.URIUtils; -import org.apache.http.client.utils.URLEncodedUtils; -import org.apache.http.message.BasicNameValuePair; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.math.BigDecimal; -import java.net.URI; -import java.net.URISyntaxException; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import java.util.stream.Stream; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -/** Embeded TestType Class for determining testType and search function */ -@Index -@NoArgsConstructor -class TestTypeIndex { - - /** Embeded TOT field, search field name "testTypeIndex.TOT" */ - private Boolean TOT; - - /** Embeded OTA field, search field name "testTypeIndex.OTA" */ - private Boolean OTA; - - /** Embeded SIGNED field, search field name "testTypeIndex.SIGNED" */ - private Boolean SIGNED; - - /** Maximum bit size */ - @Ignore private int bitSize = 6; - - @Ignore - private List<Integer> totTypeList = this.getTypeList(TestSuiteResultEntity.TestType.TOT.value); - - @Ignore - private List<Integer> otaTypeList = this.getTypeList(TestSuiteResultEntity.TestType.OTA.value); - - @Ignore - private List<Integer> signedTypeList = - this.getTypeList(TestSuiteResultEntity.TestType.SIGNED.value); - - /** Retrieving the list of integers for each category type */ - private List<Integer> getTypeList(int typeNum) { - return IntStream.range(0, (1 << (bitSize - 1))) - .filter(i -> (i & typeNum) > 0) - .boxed() - .collect(Collectors.toList()); - } - - public TestTypeIndex(int testType) { - if (totTypeList.contains(testType)) { - this.TOT = true; - } else { - this.TOT = false; - } - - if (otaTypeList.contains(testType)) { - this.OTA = true; - } else { - this.OTA = false; - } - - if (signedTypeList.contains(testType)) { - this.SIGNED = true; - } else { - this.SIGNED = false; - } - } -} - -/** Entity Class for saving Test Log Summary */ -@Cache -@Entity -@EqualsAndHashCode(of = "id") -@NoArgsConstructor -public class TestSuiteResultEntity implements DashboardEntity { - - private static final Logger logger = Logger.getLogger(TestSuiteResultEntity.class.getName()); - - /** Bug Tracking System Property class */ - private static Properties bugTrackingSystemProp = new Properties(); - - /** System Configuration Property class */ - private static Properties systemConfigProp = new Properties(); - - public enum TestType { - UNKNOWN(0), - TOT(1), - OTA(1 << 1), - SIGNED(1 << 2), - PRESUBMIT(1 << 3), - MANUAL(1 << 5); - - public int value; - - TestType(int value) { - this.value = value; - } - - public int value() { - return value; - } - } - - @Parent @Getter Key<TestSuiteFileEntity> testSuiteFileEntityKey; - - /** Test Suite start time field */ - @Id @Getter @Setter Long startTime; - - /** Test Suite end time field */ - @Getter @Setter Long endTime; - - /** Test Suite test type field */ - @Getter @Setter int testType; - - /** Embeded test type field */ - @Index @Getter @Setter TestTypeIndex testTypeIndex; - - /** Test Suite bootup error field */ - @Getter @Setter Boolean bootSuccess; - - /** Test Suite result path field */ - @Getter @Setter String resultPath; - - /** Test Suite infra log path field */ - @Getter @Setter String infraLogPath; - - /** Test Suite device name field */ - @Index @Getter @Setter String deviceName; - - /** Test Suite host name field */ - @Index @Getter @Setter String hostName; - - /** Test Suite plan field */ - @Index @Getter @Setter String suitePlan; - - /** Test Suite version field */ - @Getter @Setter String suiteVersion; - - /** Test Suite name field */ - @Getter @Setter String suiteName; - - /** Test Suite build number field */ - @Getter @Setter String suiteBuildNumber; - - /** Test Suite test finished module count field */ - @Getter @Setter int modulesDone; - - /** Test Suite total number of module field */ - @Getter @Setter int modulesTotal; - - /** Test Suite branch field */ - @Index @Getter @Setter String branch; - - /** Test Suite build target field */ - @Index @Getter @Setter String target; - - /** Test Suite build ID field */ - @Index @Getter @Setter String buildId; - - /** Test Suite system fingerprint field */ - @Getter @Setter String buildSystemFingerprint; - - /** Test Suite vendor fingerprint field */ - @Getter @Setter String buildVendorFingerprint; - - /** Test Suite test count for success field */ - @Index @Getter @Setter int passedTestCaseCount; - - /** Test Suite test count for failure field */ - @Index @Getter @Setter int failedTestCaseCount; - - /** Test Suite ratio of success to find candidate build */ - @Index @Getter @Setter float passedTestCaseRatio; - - /** When this record was created or updated */ - @Index @Getter Date updated; - - /** Construction function for TestSuiteResultEntity Class */ - public TestSuiteResultEntity( - Key<TestSuiteFileEntity> testSuiteFileEntityKey, - Long startTime, - Long endTime, - int testType, - Boolean bootSuccess, - String resultPath, - String infraLogPath, - String hostName, - String suitePlan, - String suiteVersion, - String suiteName, - String suiteBuildNumber, - int modulesDone, - int modulesTotal, - String branch, - String target, - String buildId, - String buildSystemFingerprint, - String buildVendorFingerprint, - int passedTestCaseCount, - int failedTestCaseCount) { - this.testSuiteFileEntityKey = testSuiteFileEntityKey; - this.startTime = startTime; - this.endTime = endTime; - this.bootSuccess = bootSuccess; - this.resultPath = resultPath; - this.infraLogPath = infraLogPath; - this.hostName = hostName; - this.suitePlan = suitePlan; - this.suiteVersion = suiteVersion; - this.suiteName = suiteName; - this.suiteBuildNumber = suiteBuildNumber; - this.modulesDone = modulesDone; - this.modulesTotal = modulesTotal; - this.branch = branch; - this.target = target; - this.buildId = buildId; - this.buildSystemFingerprint = buildSystemFingerprint; - this.buildVendorFingerprint = buildVendorFingerprint; - this.passedTestCaseCount = passedTestCaseCount; - this.failedTestCaseCount = failedTestCaseCount; - - BigDecimal totalTestCaseCount = new BigDecimal(passedTestCaseCount + failedTestCaseCount); - if (totalTestCaseCount.intValue() <= 0) { - this.passedTestCaseRatio = 0; - } else { - BigDecimal passedTestCaseCountDecimal = new BigDecimal(passedTestCaseCount); - BigDecimal result = - passedTestCaseCountDecimal.divide( - totalTestCaseCount, 10, BigDecimal.ROUND_FLOOR); - this.passedTestCaseRatio = result.floatValue() * 100; - } - - if (!this.buildVendorFingerprint.isEmpty()) { - this.deviceName = this.getDeviceNameFromVendorFpt(); - } - - this.testType = this.getSuiteResultTestType(testType); - this.testTypeIndex = new TestTypeIndex(this.testType); - } - - /** Saving function for the instance of this class */ - public void save(TestSuiteFileEntity newTestSuiteFileEntity) { - List<String> checkList = - Arrays.asList( - this.hostName, - this.suitePlan, - this.suiteName, - this.suiteBuildNumber, - this.branch, - this.target, - this.buildId); - boolean isAllTrue = checkList.stream().allMatch(val -> Strings.isNullOrEmpty(val)); - - if (isAllTrue) { - logger.log(Level.WARNING, "There is null or empty string among required fields!"); - } else { - this.updated = new Date(); - ofy().transact(() -> { - newTestSuiteFileEntity.save(); - ofy().save().entity(this).now(); - }); - } - } - - /** Saving function for the instance of this class */ - @Override - public Key<TestSuiteResultEntity> save() { - return ofy().save().entity(this).now(); - } - - public static void setPropertyValues(Properties newSystemConfigProp) { - systemConfigProp = newSystemConfigProp; - bugTrackingSystemProp = getBugTrackingSystemProp(newSystemConfigProp); - } - - private static Properties getBugTrackingSystemProp(Properties newSystemConfigProp) { - Properties newBugTrackingSystemProp = new Properties(); - try { - String bugTrackingSystem = newSystemConfigProp.getProperty("bug.tracking.system"); - - if (!bugTrackingSystem.isEmpty()) { - InputStream btsInputStream = - TestSuiteResultEntity.class - .getClassLoader() - .getResourceAsStream( - "bug_tracking_system/" - + bugTrackingSystem - + "/config.properties"); - newBugTrackingSystemProp.load(btsInputStream); - } - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - return newBugTrackingSystemProp; - } - } - - public static List<TestSuiteResultEntity> getTestSuitePlans() { - return ofy().load() - .type(TestSuiteResultEntity.class) - .project("suitePlan") - .distinct(true) - .list(); - } - - public static List<TestSuiteResultEntity> getBranchDistinctList() { - return ofy().load() - .type(TestSuiteResultEntity.class) - .project("branch") - .distinct(true) - .list(); - } - - public static List<TestSuiteResultEntity> getBuildIdDistinctList() { - return ofy().load() - .type(TestSuiteResultEntity.class) - .project("buildId") - .distinct(true) - .list(); - } - - public static List<TestSuiteResultEntity> getTargetDistinctList() { - return ofy().load() - .type(TestSuiteResultEntity.class) - .project("target") - .distinct(true) - .list(); - } - - public static List<TestSuiteResultEntity> getHostNameDistinctList() { - return ofy().load() - .type(TestSuiteResultEntity.class) - .project("hostName") - .distinct(true) - .list(); - } - - public String getDeviceNameFromVendorFpt() { - String deviceName = - Stream.of(this.buildVendorFingerprint.split("/")).skip(1).findFirst().orElse(""); - return deviceName; - } - - public String getScreenResultLogPath() { - String gcsBucketName = systemConfigProp.getProperty("gcs.bucketName"); - return resultPath.replace("gs://" + gcsBucketName + "/", ""); - } - - public String getScreenInfraLogPath() { - String gcsInfraLogBucketName = systemConfigProp.getProperty("gcs.infraLogBucketName"); - return infraLogPath.replace("gs://" + gcsInfraLogBucketName + "/", ""); - } - - 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"; - } - - public int getSuiteResultTestType(int testType) { - if (testType == TestType.UNKNOWN.value()) { - if (this.getNormalizedVersion(this.buildSystemFingerprint) - != this.getNormalizedVersion(this.buildVendorFingerprint)) { - return TestType.OTA.value(); - } else if (this.buildVendorFingerprint.endsWith("release-keys")) { - return TestType.SIGNED.value(); - } else { - return TestType.TOT.value(); - } - } else { - return testType; - } - } - - private String getLabInfraIssueDescription() throws IOException { - - String bugTrackingSystem = systemConfigProp.getProperty("bug.tracking.system"); - - String templateName = - bugTrackingSystemProp.getProperty( - bugTrackingSystem + ".labInfraIssue.template.name"); - - InputStream inputStream = - this.getClass() - .getClassLoader() - .getResourceAsStream( - "bug_tracking_system/" + bugTrackingSystem + "/" + templateName); - - String templateDescription = IOUtils.toString(inputStream, StandardCharsets.UTF_8.name()); - - Map<String, String> valuesMap = new HashMap<>(); - valuesMap.put("suiteBuildNumber", suiteBuildNumber); - valuesMap.put("buildId", buildId); - valuesMap.put("modulesDone", Integer.toString(modulesDone)); - valuesMap.put("modulesTotal", Integer.toString(modulesTotal)); - valuesMap.put("hostName", hostName); - valuesMap.put("resultPath", resultPath); - valuesMap.put("buildVendorFingerprint", buildVendorFingerprint); - valuesMap.put("buildSystemFingerprint", buildSystemFingerprint); - - StrSubstitutor sub = new StrSubstitutor(valuesMap); - String resolvedDescription = sub.replace(templateDescription); - - return resolvedDescription; - } - - private String getCrashSecurityDescription() throws IOException { - - String bugTrackingSystem = systemConfigProp.getProperty("bug.tracking.system"); - - String templateName = - bugTrackingSystemProp.getProperty( - bugTrackingSystem + ".crashSecurity.template.name"); - - InputStream inputStream = - this.getClass() - .getClassLoader() - .getResourceAsStream( - "bug_tracking_system/" + bugTrackingSystem + "/" + templateName); - - String templateDescription = IOUtils.toString(inputStream, StandardCharsets.UTF_8.name()); - - Map<String, String> valuesMap = new HashMap<>(); - valuesMap.put("suiteBuildNumber", suiteBuildNumber); - valuesMap.put("branch", branch); - valuesMap.put("target", target); - valuesMap.put("deviceName", deviceName); - valuesMap.put("buildId", buildId); - valuesMap.put("suiteName", suiteName); - valuesMap.put("suitePlan", suitePlan); - valuesMap.put("hostName", hostName); - valuesMap.put("resultPath", resultPath); - - StrSubstitutor sub = new StrSubstitutor(valuesMap); - String resolvedDescription = sub.replace(templateDescription); - - return resolvedDescription; - } - - public String getBuganizerLink() throws IOException, ParseException, URISyntaxException { - - String bugTrackingSystem = systemConfigProp.getProperty("bug.tracking.system"); - - List<NameValuePair> qparams = new ArrayList<NameValuePair>(); - if (!this.bootSuccess || (this.passedTestCaseCount == 0 && this.failedTestCaseCount == 0)) { - qparams.add( - new BasicNameValuePair( - "component", - this.bugTrackingSystemProp.getProperty( - bugTrackingSystem + ".labInfraIssue.component.id"))); - qparams.add( - new BasicNameValuePair( - "template", - this.bugTrackingSystemProp.getProperty( - bugTrackingSystem + ".labInfraIssue.template.id"))); - qparams.add(new BasicNameValuePair("description", this.getLabInfraIssueDescription())); - } else { - qparams.add( - new BasicNameValuePair( - "component", - this.bugTrackingSystemProp.getProperty( - bugTrackingSystem + ".crashSecurity.component.id"))); - qparams.add( - new BasicNameValuePair( - "template", - this.bugTrackingSystemProp.getProperty( - bugTrackingSystem + ".crashSecurity.template.id"))); - qparams.add(new BasicNameValuePair("description", this.getCrashSecurityDescription())); - } - - URI uri = - URIUtils.createURI( - this.bugTrackingSystemProp.getProperty(bugTrackingSystem + ".uri.scheme"), - this.bugTrackingSystemProp.getProperty(bugTrackingSystem + ".uri.host"), - -1, - this.bugTrackingSystemProp.getProperty(bugTrackingSystem + ".uri.path"), - URLEncodedUtils.format(qparams, StandardCharsets.UTF_8.name()), - null); - return uri.toString(); - } -} diff --git a/src/main/java/com/android/vts/entity/UserEntity.java b/src/main/java/com/android/vts/entity/UserEntity.java deleted file mode 100644 index 43b5edd..0000000 --- a/src/main/java/com/android/vts/entity/UserEntity.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.googlecode.objectify.Key; -import com.googlecode.objectify.Ref; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Entity; -import com.googlecode.objectify.annotation.Id; -import com.googlecode.objectify.annotation.Index; -import com.googlecode.objectify.annotation.Load; -import java.util.ArrayList; -import java.util.List; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import java.util.Date; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -/** Entity Class for User */ -@Cache -@Entity -@EqualsAndHashCode(of = "email") -@NoArgsConstructor -public class UserEntity implements DashboardEntity { - - /** User email field */ - @Id @Getter @Setter String email; - - /** User name field */ - @Getter @Setter String name; - - /** User name field */ - @Getter @Setter String company; - - /** User enable or disable field */ - @Index @Getter @Setter Boolean enable; - - /** User admin flag field */ - @Index @Getter @Setter Boolean isAdmin; - - /** When this record was created or updated */ - @Index @Getter Date updated; - - @Load - @Getter - List<Ref<RoleEntity>> roles = new ArrayList<>(); - - /** Constructor function for UserEntity Class */ - public UserEntity( - String email, - String name, - String company, - String roleName) { - - this.email = email; - this.name = name; - this.enable = true; - this.isAdmin = false; - this.company = company; - RoleEntity roleEntity = RoleEntity.getRole(roleName); - this.roles.add(Ref.create(roleEntity)); - } - - /** Saving function for the instance of this class */ - @Override - public Key<UserEntity> save() { - this.updated = new Date(); - return ofy().save().entity(this).now(); - } - - /** Get admin user list by admin email */ - public static UserEntity getAdminUser(String adminEmail) { - Key key = Key.create(UserEntity.class, adminEmail); - return ofy().load() - .type(UserEntity.class) - .filterKey(key) - .filter("enable", true) - .filter("isAdmin", true) - .first() - .now(); - } - - /** Get all admin user list */ - public static List<UserEntity> getAdminUserList() { - return ofy().load() - .type(UserEntity.class) - .filter("enable", true) - .filter("isAdmin", true) - .list(); - } - - /** Get normal user list */ - public static List<UserEntity> getUserList() { - return ofy().load() - .type(UserEntity.class) - .filter("enable", true) - .filter("isAdmin", false) - .list(); - } - - /** Get user by email */ - public static UserEntity getUser(String email) { - Key key = Key.create(UserEntity.class, email); - return ofy().load() - .type(UserEntity.class) - .filterKey(key) - .filter("enable", true) - .first() - .now(); - } -} diff --git a/src/main/java/com/android/vts/entity/UserFavoriteEntity.java b/src/main/java/com/android/vts/entity/UserFavoriteEntity.java deleted file mode 100644 index 2548042..0000000 --- a/src/main/java/com/android/vts/entity/UserFavoriteEntity.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.entity; - -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.users.User; -import com.googlecode.objectify.annotation.Cache; -import com.googlecode.objectify.annotation.Ignore; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -@Cache -@com.googlecode.objectify.annotation.Entity(name = "UserFavorite") -@EqualsAndHashCode(of = "email") -@NoArgsConstructor -/** Entity describing subscriptions between a user and a test. */ -public class UserFavoriteEntity implements DashboardEntity { - protected static final Logger logger = Logger.getLogger(UserFavoriteEntity.class.getName()); - - public static final String KIND = "UserFavorite"; - - // Property keys - public static final String USER = "user"; - public static final String TEST_KEY = "testKey"; - public static final String MUTE_NOTIFICATIONS = "muteNotifications"; - - @Ignore private Key key = null; - - @Ignore public User user = null; - - @Ignore public Key testKey = null; - - @Getter @Setter private com.googlecode.objectify.Key<TestEntity> test; - - @Getter @Setter private String userEmail; - - @Getter @Setter public boolean muteNotifications; - - /** - * Create a user favorite relationship. - * - * @param key The key of the entity in the database. - * @param user The User object for the subscribing user. - * @param testKey The key of the TestEntity object describing the test. - * @param muteNotifications True if the subscriber has muted notifications, false otherwise. - */ - private UserFavoriteEntity(Key key, User user, Key testKey, boolean muteNotifications) { - this.key = key; - this.user = user; - this.testKey = testKey; - this.muteNotifications = muteNotifications; - } - - /** - * Create a user favorite relationship. - * - * @param user The User object for the subscribing user. - * @param testKey The key of the TestEntity object describing the test. - * @param muteNotifications True if the subscriber has muted notifications, false otherwise. - */ - public UserFavoriteEntity(User user, Key testKey, boolean muteNotifications) { - this(null, user, testKey, muteNotifications); - } - - /** Saving function for the instance of this class */ - @Override - public com.googlecode.objectify.Key<UserFavoriteEntity> save() { - return ofy().save().entity(this).now(); - } - - public Entity toEntity() { - Entity favoriteEntity; - if (this.key != null) { - favoriteEntity = new Entity(key); - } else { - favoriteEntity = new Entity(KIND); - } - favoriteEntity.setProperty(USER, this.user); - favoriteEntity.setProperty(TEST_KEY, this.testKey); - favoriteEntity.setProperty(MUTE_NOTIFICATIONS, this.muteNotifications); - return favoriteEntity; - } - - /** - * Convert an Entity object to a UserFavoriteEntity. - * - * @param e The entity to process. - * @return UserFavoriteEntity object with the properties from e, or null if incompatible. - */ - public static UserFavoriteEntity fromEntity(Entity e) { - if (!e.getKind().equals(KIND) || !e.hasProperty(USER) || !e.hasProperty(TEST_KEY)) { - logger.log( - Level.WARNING, "Missing user favorite attributes in entity: " + e.toString()); - return null; - } - try { - User user = (User) e.getProperty(USER); - Key testKey = (Key) e.getProperty(TEST_KEY); - boolean muteNotifications = false; - if (e.hasProperty(MUTE_NOTIFICATIONS)) { - muteNotifications = (boolean) e.getProperty(MUTE_NOTIFICATIONS); - } - return new UserFavoriteEntity(e.getKey(), user, testKey, muteNotifications); - } catch (ClassCastException exception) { - // Invalid cast - logger.log(Level.WARNING, "Error parsing user favorite entity.", exception); - } - return null; - } -} diff --git a/src/main/java/com/android/vts/job/BaseJobServlet.java b/src/main/java/com/android/vts/job/BaseJobServlet.java deleted file mode 100644 index 18a1d24..0000000 --- a/src/main/java/com/android/vts/job/BaseJobServlet.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2018 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.job; - - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import java.util.Properties; - -/** - * An abstract class to be subclassed to create Job Servlet - */ -public abstract class BaseJobServlet extends HttpServlet { - - /** - * System Configuration Property class - */ - protected static Properties systemConfigProp = new Properties(); - - /** - * This variable is for maximum number of entities per transaction You can find the detail here - * (https://cloud.google.com/datastore/docs/concepts/limits) - */ - protected int MAX_ENTITY_SIZE_PER_TRANSACTION = 300; - - @Override - public void init(ServletConfig cfg) throws ServletException { - super.init(cfg); - - systemConfigProp = - Properties.class.cast(cfg.getServletContext().getAttribute("systemConfigProp")); - - this.MAX_ENTITY_SIZE_PER_TRANSACTION = - Integer.parseInt(systemConfigProp.getProperty("datastore.maxEntitySize")); - } -} diff --git a/src/main/java/com/android/vts/job/VtsAlertJobServlet.java b/src/main/java/com/android/vts/job/VtsAlertJobServlet.java deleted file mode 100644 index be23982..0000000 --- a/src/main/java/com/android/vts/job/VtsAlertJobServlet.java +++ /dev/null @@ -1,582 +0,0 @@ -/* - * Copyright (c) 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.job; - -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.TestAcknowledgmentEntity; -import com.android.vts.entity.TestCaseRunEntity; -import com.android.vts.entity.TestCaseRunEntity.TestCase; -import com.android.vts.entity.TestRunEntity; -import com.android.vts.entity.TestStatusEntity; -import com.android.vts.entity.TestStatusEntity.TestCaseReference; -import com.android.vts.proto.VtsReportMessage.TestCaseResult; -import com.android.vts.util.DatastoreHelper; -import com.android.vts.util.EmailHelper; -import com.android.vts.util.FilterUtil; -import com.android.vts.util.TimeUtil; -import com.google.appengine.api.datastore.DatastoreFailureException; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.DatastoreTimeoutException; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.EntityNotFoundException; -import com.google.appengine.api.datastore.FetchOptions; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.datastore.Query.Filter; -import com.google.appengine.api.datastore.Query.SortDirection; -import com.google.appengine.api.datastore.Transaction; -import com.google.appengine.api.taskqueue.Queue; -import com.google.appengine.api.taskqueue.QueueFactory; -import com.google.appengine.api.taskqueue.TaskOptions; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.ConcurrentModificationException; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.apache.commons.lang.StringUtils; - -/** Represents the notifications service which is automatically called on a fixed schedule. */ -public class VtsAlertJobServlet extends BaseJobServlet { - private static final String ALERT_JOB_URL = "/task/vts_alert_job"; - protected static final Logger logger = Logger.getLogger(VtsAlertJobServlet.class.getName()); - protected static final int MAX_RUN_COUNT = 1000; // maximum number of runs to query for - - /** - * Process the current test case failures for a test. - * - * @param status The TestStatusEntity object for the test. - * @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.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.getFailingTestCases()) { - gets.add(KeyFactory.createKey(TestCaseRunEntity.KIND, testCaseRef.parentId)); - } - if (gets.size() == 0) { - return failingTestcases; - } - Map<Key, Entity> testCaseMap = datastore.get(gets); - - for (TestCaseReference testCaseRef : status.getFailingTestCases()) { - Key key = KeyFactory.createKey(TestCaseRunEntity.KIND, testCaseRef.parentId); - if (!testCaseMap.containsKey(key)) { - continue; - } - Entity testCaseRun = testCaseMap.get(key); - TestCaseRunEntity testCaseRunEntity = TestCaseRunEntity.fromEntity(testCaseRun); - if (testCaseRunEntity.testCases.size() <= testCaseRef.offset) { - continue; - } - TestCase testCase = testCaseRunEntity.testCases.get(testCaseRef.offset); - failingTestcases.put(testCase.name, testCase); - } - return failingTestcases; - } - - /** - * Get the test acknowledgments for a test key. - * - * @param testKey The key to the test whose acknowledgments to fetch. - * @return A list of test acknowledgments. - */ - private static List<TestAcknowledgmentEntity> getTestCaseAcknowledgments(Key testKey) { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - - List<TestAcknowledgmentEntity> acks = new ArrayList<>(); - Filter testFilter = - new Query.FilterPredicate( - TestAcknowledgmentEntity.TEST_KEY, Query.FilterOperator.EQUAL, testKey); - Query q = new Query(TestAcknowledgmentEntity.KIND).setFilter(testFilter); - - for (Entity ackEntity : datastore.prepare(q).asIterable()) { - TestAcknowledgmentEntity ack = TestAcknowledgmentEntity.fromEntity(ackEntity); - if (ack == null) continue; - acks.add(ack); - } - return acks; - } - - /** - * Get the test runs for the test in the specified time window. - * - * <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. - * @param endTime The end time for the query. - * @return A list of test runs in the specified time window. - */ - private static List<TestRunEntity> getTestRuns(Key testKey, long startTime, long endTime) { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - Filter testTypeFilter = FilterUtil.getTestTypeFilter(false, true, false); - long delta = endTime - startTime; - delta = Math.min(delta, TimeUnit.DAYS.toMicros(1)); - Filter runFilter = - FilterUtil.getTimeFilter( - testKey, TestRunEntity.KIND, endTime - delta + 1, endTime, testTypeFilter); - - Query q = - new Query(TestRunEntity.KIND) - .setAncestor(testKey) - .setFilter(runFilter) - .addSort(Entity.KEY_RESERVED_PROPERTY, SortDirection.DESCENDING); - - List<TestRunEntity> testRuns = new ArrayList<>(); - for (Entity testRunEntity : - datastore.prepare(q).asIterable(FetchOptions.Builder.withLimit(MAX_RUN_COUNT))) { - TestRunEntity testRun = TestRunEntity.fromEntity(testRunEntity); - if (testRun == null) continue; - testRuns.add(testRun); - } - return testRuns; - } - - /** - * Separate the test cases which are acknowledged by the provided acknowledgments. - * - * @param testCases The list of test case names. - * @param devices The list of devices for a test run. - * @param acks The list of acknowledgments for the test. - * @return A list of acknowledged test case names that have been removed from the input test - * cases. - */ - public static Set<String> separateAcknowledged( - Set<String> testCases, - List<DeviceInfoEntity> devices, - List<TestAcknowledgmentEntity> acks) { - Set<String> acknowledged = new HashSet<>(); - for (TestAcknowledgmentEntity ack : acks) { - boolean allDevices = ack.getDevices() == null || ack.getDevices().size() == 0; - boolean allBranches = ack.getBranches() == null || ack.getBranches().size() == 0; - boolean isRelevant = allDevices && allBranches; - - // Determine if the acknowledgment is relevant to the devices. - if (!isRelevant) { - for (DeviceInfoEntity device : devices) { - boolean deviceAcknowledged = - allDevices || ack.getDevices().contains(device.getBuildFlavor()); - boolean branchAcknowledged = - allBranches || ack.getBranches().contains(device.getBranch()); - if (deviceAcknowledged && branchAcknowledged) isRelevant = true; - } - } - - if (isRelevant) { - // Separate the test cases - boolean allTestCases = - ack.getTestCaseNames() == null || ack.getTestCaseNames().size() == 0; - if (allTestCases) { - acknowledged.addAll(testCases); - testCases.removeAll(acknowledged); - } else { - for (String testCase : ack.getTestCaseNames()) { - if (testCases.contains(testCase)) { - acknowledged.add(testCase); - testCases.remove(testCase); - } - } - } - } - } - return acknowledged; - } - - /** - * Checks whether any new failures have occurred beginning since (and including) startTime. - * - * @param testRuns The list of test runs for which to update the status. - * @param link The string URL linking to the test's status table. - * @param failedTestCaseMap The map of test case names to TestCase for those failing in the last - * status update. - * @param emailAddresses The list of email addresses to send notifications to. - * @param messages The email Message queue. - * @returns latest TestStatusMessage or null if no update is available. - * @throws IOException - */ - public TestStatusEntity getTestStatus( - List<TestRunEntity> testRuns, - String link, - Map<String, TestCase> failedTestCaseMap, - List<TestAcknowledgmentEntity> testAcks, - List<String> emailAddresses, - List<Message> messages) - throws IOException { - if (testRuns.size() == 0) return null; - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - - TestRunEntity mostRecentRun = null; - Map<String, TestCaseResult> mostRecentTestCaseResults = new HashMap<>(); - Map<String, TestCase> testCaseBreakageMap = new HashMap<>(); - int passingTestcaseCount = 0; - List<TestCaseReference> failingTestCases = new ArrayList<>(); - Set<String> fixedTestcases = new HashSet<>(); - Set<String> newTestcaseFailures = new HashSet<>(); - Set<String> continuedTestcaseFailures = new HashSet<>(); - Set<String> skippedTestcaseFailures = new HashSet<>(); - Set<String> transientTestcaseFailures = new HashSet<>(); - - for (TestRunEntity testRun : testRuns) { - if (mostRecentRun == null) { - mostRecentRun = testRun; - } - List<Key> testCaseKeys = new ArrayList<>(); - for (long testCaseId : testRun.getTestCaseIds()) { - testCaseKeys.add(KeyFactory.createKey(TestCaseRunEntity.KIND, testCaseId)); - } - Map<Key, Entity> entityMap = datastore.get(testCaseKeys); - for (Key testCaseKey : testCaseKeys) { - if (!entityMap.containsKey(testCaseKey)) { - logger.log(Level.WARNING, "Test case entity missing: " + testCaseKey); - continue; - } - Entity testCaseRun = entityMap.get(testCaseKey); - TestCaseRunEntity testCaseRunEntity = TestCaseRunEntity.fromEntity(testCaseRun); - if (testCaseRunEntity == null) { - logger.log(Level.WARNING, "Invalid test case run: " + testCaseRun.getKey()); - continue; - } - for (TestCase testCase : testCaseRunEntity.testCases) { - String testCaseName = testCase.name; - TestCaseResult result = TestCaseResult.valueOf(testCase.result); - - if (mostRecentRun == testRun) { - mostRecentTestCaseResults.put(testCaseName, result); - } else { - if (!mostRecentTestCaseResults.containsKey(testCaseName)) { - // Deprecate notifications for tests that are not present on newer runs - continue; - } - TestCaseResult mostRecentRes = mostRecentTestCaseResults.get(testCaseName); - if (mostRecentRes == TestCaseResult.TEST_CASE_RESULT_SKIP) { - mostRecentTestCaseResults.put(testCaseName, result); - } else if (mostRecentRes == TestCaseResult.TEST_CASE_RESULT_PASS) { - // Test is passing now, witnessed a transient failure - if (result != TestCaseResult.TEST_CASE_RESULT_PASS - && result != TestCaseResult.TEST_CASE_RESULT_SKIP) { - transientTestcaseFailures.add(testCaseName); - } - } - } - - // Record test case breakages - if (result != TestCaseResult.TEST_CASE_RESULT_PASS - && result != TestCaseResult.TEST_CASE_RESULT_SKIP) { - testCaseBreakageMap.put(testCaseName, testCase); - } - } - } - } - - Set<String> buildIdList = new HashSet<>(); - List<DeviceInfoEntity> devices = new ArrayList<>(); - Query deviceQuery = new Query(DeviceInfoEntity.KIND).setAncestor(mostRecentRun.getKey()); - for (Entity device : datastore.prepare(deviceQuery).asIterable()) { - DeviceInfoEntity deviceEntity = DeviceInfoEntity.fromEntity(device); - if (deviceEntity == null) { - continue; - } - buildIdList.add(deviceEntity.getBuildId()); - devices.add(deviceEntity); - } - String footer = EmailHelper.getEmailFooter(mostRecentRun, devices, link); - String buildId = StringUtils.join(buildIdList, ","); - - for (String testCaseName : mostRecentTestCaseResults.keySet()) { - TestCaseResult mostRecentResult = mostRecentTestCaseResults.get(testCaseName); - boolean previouslyFailed = failedTestCaseMap.containsKey(testCaseName); - if (mostRecentResult == TestCaseResult.TEST_CASE_RESULT_SKIP) { - // persist previous status - if (previouslyFailed) { - skippedTestcaseFailures.add(testCaseName); - failingTestCases.add( - new TestCaseReference(failedTestCaseMap.get(testCaseName))); - } else { - ++passingTestcaseCount; - } - } else if (mostRecentResult == TestCaseResult.TEST_CASE_RESULT_PASS) { - ++passingTestcaseCount; - if (previouslyFailed && !transientTestcaseFailures.contains(testCaseName)) { - fixedTestcases.add(testCaseName); - } - } else { - if (!previouslyFailed) { - newTestcaseFailures.add(testCaseName); - failingTestCases.add( - new TestCaseReference(testCaseBreakageMap.get(testCaseName))); - } else { - continuedTestcaseFailures.add(testCaseName); - failingTestCases.add( - new TestCaseReference(failedTestCaseMap.get(testCaseName))); - } - } - } - - Set<String> acknowledgedFailures = - separateAcknowledged(newTestcaseFailures, devices, testAcks); - acknowledgedFailures.addAll( - separateAcknowledged(transientTestcaseFailures, devices, testAcks)); - acknowledgedFailures.addAll( - separateAcknowledged(continuedTestcaseFailures, devices, testAcks)); - - String summary = new String(); - if (newTestcaseFailures.size() + continuedTestcaseFailures.size() > 0) { - summary += "The following test cases failed in the latest test run:<br>"; - - // Add new test case failures to top of summary in bold font. - List<String> sortedNewTestcaseFailures = new ArrayList<>(newTestcaseFailures); - sortedNewTestcaseFailures.sort(Comparator.naturalOrder()); - for (String testcaseName : sortedNewTestcaseFailures) { - summary += "- " + "<b>" + testcaseName + "</b><br>"; - } - - // Add continued test case failures to summary. - List<String> sortedContinuedTestcaseFailures = - new ArrayList<>(continuedTestcaseFailures); - sortedContinuedTestcaseFailures.sort(Comparator.naturalOrder()); - for (String testcaseName : sortedContinuedTestcaseFailures) { - summary += "- " + testcaseName + "<br>"; - } - } - if (fixedTestcases.size() > 0) { - // Add fixed test cases to summary. - summary += "<br><br>The following test cases were fixed in the latest test run:<br>"; - List<String> sortedFixedTestcases = new ArrayList<>(fixedTestcases); - sortedFixedTestcases.sort(Comparator.naturalOrder()); - for (String testcaseName : sortedFixedTestcases) { - summary += "- <i>" + testcaseName + "</i><br>"; - } - } - if (transientTestcaseFailures.size() > 0) { - // Add transient test case failures to summary. - summary += "<br><br>The following transient test case failures occured:<br>"; - List<String> sortedTransientTestcaseFailures = - new ArrayList<>(transientTestcaseFailures); - sortedTransientTestcaseFailures.sort(Comparator.naturalOrder()); - for (String testcaseName : sortedTransientTestcaseFailures) { - summary += "- " + testcaseName + "<br>"; - } - } - if (skippedTestcaseFailures.size() > 0) { - // Add skipped test case failures to summary. - summary += "<br><br>The following test cases have not been run since failing:<br>"; - List<String> sortedSkippedTestcaseFailures = new ArrayList<>(skippedTestcaseFailures); - sortedSkippedTestcaseFailures.sort(Comparator.naturalOrder()); - for (String testcaseName : sortedSkippedTestcaseFailures) { - summary += "- " + testcaseName + "<br>"; - } - } - if (acknowledgedFailures.size() > 0) { - // Add acknowledged test case failures to summary. - List<String> sortedAcknowledgedFailures = new ArrayList<>(acknowledgedFailures); - sortedAcknowledgedFailures.sort(Comparator.naturalOrder()); - if (acknowledgedFailures.size() > 0) { - summary += - "<br><br>The following acknowledged test case failures continued to fail:<br>"; - for (String testcaseName : sortedAcknowledgedFailures) { - summary += "- " + testcaseName + "<br>"; - } - } - } - - String testName = mostRecentRun.getKey().getParent().getName(); - String uploadDateString = TimeUtil.getDateString(mostRecentRun.getStartTimestamp()); - String subject = "VTS Test Alert: " + testName + " @ " + uploadDateString; - if (newTestcaseFailures.size() > 0) { - String body = - "Hello,<br><br>New test case failure(s) in " - + testName - + " for device build ID(s): " - + buildId - + ".<br><br>" - + summary - + footer; - try { - messages.add(EmailHelper.composeEmail(emailAddresses, subject, body)); - } catch (MessagingException | UnsupportedEncodingException e) { - logger.log(Level.WARNING, "Error composing email : ", e); - } - } else if (continuedTestcaseFailures.size() > 0) { - String body = - "Hello,<br><br>Continuous test case failure(s) in " - + testName - + " for device build ID(s): " - + buildId - + ".<br><br>" - + summary - + footer; - try { - messages.add(EmailHelper.composeEmail(emailAddresses, subject, body)); - } catch (MessagingException | UnsupportedEncodingException e) { - logger.log(Level.WARNING, "Error composing email : ", e); - } - } else if (transientTestcaseFailures.size() > 0) { - String body = - "Hello,<br><br>Transient test case failure(s) in " - + testName - + " but tests all " - + "are passing in the latest device build(s): " - + buildId - + ".<br><br>" - + summary - + footer; - try { - messages.add(EmailHelper.composeEmail(emailAddresses, subject, body)); - } catch (MessagingException | UnsupportedEncodingException e) { - logger.log(Level.WARNING, "Error composing email : ", e); - } - } else if (fixedTestcases.size() > 0) { - String body = - "Hello,<br><br>All test cases passed in " - + testName - + " for device build ID(s): " - + buildId - + "!<br><br>" - + summary - + footer; - try { - messages.add(EmailHelper.composeEmail(emailAddresses, subject, body)); - } catch (MessagingException | UnsupportedEncodingException e) { - logger.log(Level.WARNING, "Error composing email : ", e); - } - } - return new TestStatusEntity( - testName, - mostRecentRun.getStartTimestamp(), - passingTestcaseCount, - failingTestCases.size(), - failingTestCases); - } - - /** - * Add a task to process test run data - * - * @param testRunKey The key of the test run whose data process. - */ - public static void addTask(Key testRunKey) { - Queue queue = QueueFactory.getDefaultQueue(); - String keyString = KeyFactory.keyToString(testRunKey); - queue.add( - TaskOptions.Builder.withUrl(ALERT_JOB_URL) - .param("runKey", keyString) - .method(TaskOptions.Method.POST)); - } - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) - throws IOException { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - String runKeyString = request.getParameter("runKey"); - - Key testRunKey; - try { - testRunKey = KeyFactory.stringToKey(runKeyString); - } catch (IllegalArgumentException e) { - logger.log(Level.WARNING, "Invalid key specified: " + runKeyString); - return; - } - String testName = testRunKey.getParent().getName(); - - TestStatusEntity status = null; - Key statusKey = KeyFactory.createKey(TestStatusEntity.KIND, testName); - try { - status = TestStatusEntity.fromEntity(datastore.get(statusKey)); - } catch (EntityNotFoundException e) { - // no existing status - } - if (status == null) { - status = new TestStatusEntity(testName); - } - if (status.getUpdatedTimestamp() >= testRunKey.getId()) { - // Another job has already updated the status first - return; - } - List<String> emails = EmailHelper.getSubscriberEmails(testRunKey.getParent()); - - StringBuffer fullUrl = request.getRequestURL(); - String baseUrl = fullUrl.substring(0, fullUrl.indexOf(request.getRequestURI())); - String link = - baseUrl + "/show_tree?testName=" + testName + "&endTime=" + testRunKey.getId(); - - List<Message> messageQueue = new ArrayList<>(); - Map<String, TestCase> failedTestcaseMap = getCurrentFailures(status); - List<TestAcknowledgmentEntity> testAcks = - getTestCaseAcknowledgments(testRunKey.getParent()); - List<TestRunEntity> testRuns = - getTestRuns( - testRunKey.getParent(), status.getUpdatedTimestamp(), testRunKey.getId()); - if (testRuns.size() == 0) return; - - TestStatusEntity newStatus = - getTestStatus(testRuns, link, failedTestcaseMap, testAcks, emails, messageQueue); - if (newStatus == null) { - // No changes to status - return; - } - - int retries = 0; - while (true) { - Transaction txn = datastore.beginTransaction(); - try { - try { - status = TestStatusEntity.fromEntity(datastore.get(statusKey)); - } catch (EntityNotFoundException e) { - // no status left - } - if (status == null - || status.getUpdatedTimestamp() >= newStatus.getUpdatedTimestamp()) { - txn.rollback(); - } else { // This update is most recent. - datastore.put(newStatus.toEntity()); - txn.commit(); - EmailHelper.sendAll(messageQueue); - } - break; - } catch (ConcurrentModificationException - | DatastoreFailureException - | DatastoreTimeoutException e) { - logger.log(Level.WARNING, "Retrying alert job insert: " + statusKey); - if (retries++ >= DatastoreHelper.MAX_WRITE_RETRIES) { - logger.log(Level.SEVERE, "Exceeded alert job retries: " + statusKey); - throw e; - } - } finally { - if (txn.isActive()) { - txn.rollback(); - } - } - } - } -} diff --git a/src/main/java/com/android/vts/job/VtsCoverageAlertJobServlet.java b/src/main/java/com/android/vts/job/VtsCoverageAlertJobServlet.java deleted file mode 100644 index b5453b7..0000000 --- a/src/main/java/com/android/vts/job/VtsCoverageAlertJobServlet.java +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.job; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -import com.android.vts.entity.CodeCoverageEntity; -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.TestCoverageStatusEntity; -import com.android.vts.entity.TestRunEntity; -import com.android.vts.util.EmailHelper; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.EntityNotFoundException; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.taskqueue.Queue; -import com.google.appengine.api.taskqueue.QueueFactory; -import com.google.appengine.api.taskqueue.TaskOptions; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.math.RoundingMode; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.apache.commons.lang.StringUtils; - -/** - * Coverage notification job. - */ -public class VtsCoverageAlertJobServlet extends BaseJobServlet { - - private static final String COVERAGE_ALERT_URL = "/task/vts_coverage_job"; - protected static final Logger logger = - Logger.getLogger(VtsCoverageAlertJobServlet.class.getName()); - protected static final double CHANGE_ALERT_THRESHOLD = 0.05; - protected static final double GOOD_THRESHOLD = 0.7; - protected static final double BAD_THRESHOLD = 0.3; - - protected static final DecimalFormat FORMATTER; - - /** Initialize the decimal formatter. */ - static { - FORMATTER = new DecimalFormat("#.#"); - FORMATTER.setRoundingMode(RoundingMode.HALF_UP); - } - - /** - * Gets a new coverage status and adds notification emails to the messages list. - * - * Send an email to notify subscribers in the event that a test goes up or down by more than 5%, - * becomes higher or lower than 70%, or becomes higher or lower than 30%. - * - * @param status The TestCoverageStatusEntity object for the test. - * @param testRunKey The key for TestRunEntity whose data to process and reflect in the state. - * @param link The string URL linking to the test's status table. - * @param emailAddresses The list of email addresses to send notifications to. - * @param messages The email Message queue. - * @returns TestCoverageStatusEntity or null if no update is available. - */ - public static TestCoverageStatusEntity getTestCoverageStatus( - TestCoverageStatusEntity status, - Key testRunKey, - String link, - List<String> emailAddresses, - List<Message> messages) - throws IOException { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - - String testName = status.getTestName(); - - double previousPct; - double coveragePct; - if (status == null || status.getTotalLineCount() <= 0 || status.getCoveredLineCount() < 0) { - previousPct = 0; - } else { - previousPct = ((double) status.getCoveredLineCount()) / status.getTotalLineCount(); - } - - Entity testRun; - try { - testRun = datastore.get(testRunKey); - } catch (EntityNotFoundException e) { - logger.log(Level.WARNING, "Test run not found: " + testRunKey); - return null; - } - - TestRunEntity testRunEntity = TestRunEntity.fromEntity(testRun); - if (testRunEntity == null || !testRunEntity.getHasCodeCoverage()) { - return null; - } - CodeCoverageEntity codeCoverageEntity = testRunEntity.getCodeCoverageEntity(); - - if (codeCoverageEntity.getTotalLineCount() <= 0 - || codeCoverageEntity.getCoveredLineCount() < 0) { - coveragePct = 0; - } else { - coveragePct = - ((double) codeCoverageEntity.getCoveredLineCount()) - / codeCoverageEntity.getTotalLineCount(); - } - - Set<String> buildIdList = new HashSet<>(); - Query deviceQuery = new Query(DeviceInfoEntity.KIND).setAncestor(testRun.getKey()); - List<DeviceInfoEntity> devices = new ArrayList<>(); - for (Entity device : datastore.prepare(deviceQuery).asIterable()) { - DeviceInfoEntity deviceEntity = DeviceInfoEntity.fromEntity(device); - if (deviceEntity == null) { - continue; - } - devices.add(deviceEntity); - buildIdList.add(deviceEntity.getBuildId()); - } - String deviceBuild = StringUtils.join(buildIdList, ", "); - String footer = EmailHelper.getEmailFooter(testRunEntity, devices, link); - - String subject = null; - String body = null; - String subjectSuffix = " @ " + deviceBuild; - if (coveragePct >= GOOD_THRESHOLD && previousPct < GOOD_THRESHOLD) { - // Coverage entered the good zone - subject = - "Congratulations! " - + testName - + " has exceeded " - + FORMATTER.format(GOOD_THRESHOLD * 100) - + "% coverage" - + subjectSuffix; - body = - "Hello,<br><br>The " - + testName - + " has achieved " - + FORMATTER.format(coveragePct * 100) - + "% code coverage on device build ID(s): " - + deviceBuild - + "." - + footer; - } else if (coveragePct < GOOD_THRESHOLD && previousPct >= GOOD_THRESHOLD) { - // Coverage dropped out of the good zone - subject = - "Warning! " - + testName - + " has dropped below " - + FORMATTER.format(GOOD_THRESHOLD * 100) - + "% coverage" - + subjectSuffix; - ; - body = - "Hello,<br><br>The test " - + testName - + " has dropped to " - + FORMATTER.format(coveragePct * 100) - + "% code coverage on device build ID(s): " - + deviceBuild - + "." - + footer; - } else if (coveragePct <= BAD_THRESHOLD && previousPct > BAD_THRESHOLD) { - // Coverage entered into the bad zone - subject = - "Warning! " - + testName - + " has dropped below " - + FORMATTER.format(BAD_THRESHOLD * 100) - + "% coverage" - + subjectSuffix; - body = - "Hello,<br><br>The test " - + testName - + " has dropped to " - + FORMATTER.format(coveragePct * 100) - + "% code coverage on device build ID(s): " - + deviceBuild - + "." - + footer; - } else if (coveragePct > BAD_THRESHOLD && previousPct <= BAD_THRESHOLD) { - // Coverage emerged from the bad zone - subject = - "Congratulations! " - + testName - + " has exceeded " - + FORMATTER.format(BAD_THRESHOLD * 100) - + "% coverage" - + subjectSuffix; - body = - "Hello,<br><br>The test " - + testName - + " has achived " - + FORMATTER.format(coveragePct * 100) - + "% code coverage on device build ID(s): " - + deviceBuild - + "." - + footer; - } else if (coveragePct - previousPct < -CHANGE_ALERT_THRESHOLD) { - // Send a coverage drop alert - subject = - "Warning! " - + testName - + "'s code coverage has decreased by more than " - + FORMATTER.format(CHANGE_ALERT_THRESHOLD * 100) - + "%" - + subjectSuffix; - body = - "Hello,<br><br>The test " - + testName - + " has dropped from " - + FORMATTER.format(previousPct * 100) - + "% code coverage to " - + FORMATTER.format(coveragePct * 100) - + "% code coverage on device build ID(s): " - + deviceBuild - + "." - + footer; - } else if (coveragePct - previousPct > CHANGE_ALERT_THRESHOLD) { - // Send a coverage improvement alert - subject = - testName - + "'s code coverage has increased by more than " - + FORMATTER.format(CHANGE_ALERT_THRESHOLD * 100) - + "%" - + subjectSuffix; - body = - "Hello,<br><br>The test " - + testName - + " has increased from " - + FORMATTER.format(previousPct * 100) - + "% code coverage to " - + FORMATTER.format(coveragePct * 100) - + "% code coverage on device build ID(s): " - + deviceBuild - + "." - + footer; - } - if (subject != null && body != null) { - try { - messages.add(EmailHelper.composeEmail(emailAddresses, subject, body)); - } catch (MessagingException | UnsupportedEncodingException e) { - logger.log(Level.WARNING, "Error composing email : ", e); - } - } - return new TestCoverageStatusEntity( - testName, - testRunEntity.getStartTimestamp(), - codeCoverageEntity.getCoveredLineCount(), - codeCoverageEntity.getTotalLineCount(), - devices.size() > 0 ? devices.get(0).getId() : 0); - } - - /** - * Add a task to process coverage data - * - * @param testRunKey The key of the test run whose data process. - */ - public static void addTask(Key testRunKey) { - Queue queue = QueueFactory.getDefaultQueue(); - String keyString = KeyFactory.keyToString(testRunKey); - queue.add( - TaskOptions.Builder.withUrl(COVERAGE_ALERT_URL) - .param("runKey", keyString) - .method(TaskOptions.Method.POST)); - } - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) - throws IOException { - String runKeyString = request.getParameter("runKey"); - - Key testRunKey; - try { - testRunKey = KeyFactory.stringToKey(runKeyString); - } catch (IllegalArgumentException e) { - logger.log(Level.WARNING, "Invalid key specified: " + runKeyString); - return; - } - String testName = testRunKey.getParent().getName(); - - TestCoverageStatusEntity status = ofy().load().type(TestCoverageStatusEntity.class).id(testName) - .now(); - if (status == null) { - status = new TestCoverageStatusEntity(testName, 0, -1, -1, 0); - } - - StringBuffer fullUrl = request.getRequestURL(); - String baseUrl = fullUrl.substring(0, fullUrl.indexOf(request.getRequestURI())); - String link = baseUrl + "/show_tree?testName=" + testName; - TestCoverageStatusEntity newStatus; - List<Message> messageQueue = new ArrayList<>(); - try { - List<String> emails = EmailHelper.getSubscriberEmails(testRunKey.getParent()); - newStatus = getTestCoverageStatus(status, testRunKey, link, emails, messageQueue); - } catch (IOException e) { - logger.log(Level.SEVERE, e.toString()); - return; - } - - if (newStatus == null) { - return; - } else { - if (status == null || status.getUpdatedTimestamp() < newStatus.getUpdatedTimestamp()) { - newStatus.save(); - EmailHelper.sendAll(messageQueue); - } - } - } -} diff --git a/src/main/java/com/android/vts/job/VtsInactivityJobServlet.java b/src/main/java/com/android/vts/job/VtsInactivityJobServlet.java deleted file mode 100644 index 031cdbb..0000000 --- a/src/main/java/com/android/vts/job/VtsInactivityJobServlet.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.job; - -import com.android.vts.entity.TestEntity; -import com.android.vts.entity.TestRunEntity; -import com.android.vts.entity.TestStatusEntity; -import com.android.vts.util.EmailHelper; -import com.android.vts.util.FilterUtil; -import com.android.vts.util.TaskQueueHelper; -import com.android.vts.util.TimeUtil; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.EntityNotFoundException; -import com.google.appengine.api.datastore.FetchOptions; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.datastore.Query.Filter; -import com.google.appengine.api.datastore.Query.SortDirection; -import com.google.appengine.api.taskqueue.Queue; -import com.google.appengine.api.taskqueue.QueueFactory; -import com.google.appengine.api.taskqueue.TaskOptions; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** Test inactivity notification job. */ -public class VtsInactivityJobServlet extends BaseJobServlet { - private static final String INACTIVITY_ALERT_URL = "/cron/vts_inactivity_job"; - protected static final Logger logger = - Logger.getLogger(VtsInactivityJobServlet.class.getName()); - - /** - * Compose an email if the test is inactive. - * - * @param test The TestStatusEntity document storing the test status. - * @param lastRunTime The timestamp in microseconds of the last test run for this test. - * @param link Fully specified link to the test's status page. - * @param emails The list of email addresses to send the email. - * @param messages The message list in which to insert the inactivity notification email. - * @return True if the test is inactive, false otherwise. - */ - private static boolean notifyIfInactive( - TestStatusEntity test, - long lastRunTime, - String link, - List<String> emails, - List<Message> messages) { - long now = TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()); - long diff = now - lastRunTime; - // Send an email daily to notify that the test hasn't been running. - // After 7 full days have passed, notifications will no longer be sent (i.e. the - // test is assumed to be deprecated). - if (diff >= TimeUnit.DAYS.toMicros(1) && diff < TimeUnit.DAYS.toMicros(8)) { - String uploadTimeString = TimeUtil.getDateTimeZoneString(lastRunTime); - String subject = "Warning! Inactive test: " + test.getTestName(); - String body = - "Hello,<br><br>Test \"" - + test.getTestName() - + "\" is inactive. " - + "No new data has been uploaded since " - + uploadTimeString - + "." - + EmailHelper.getEmailFooter(null, null, link); - try { - messages.add(EmailHelper.composeEmail(emails, subject, body)); - return true; - } catch (MessagingException | UnsupportedEncodingException e) { - logger.log(Level.WARNING, "Error composing email : ", e); - } - } - return false; - } - - /** - * Get the timestamp for the last test run for the specified test. - * - * @param testKey The parent key of the test runs to query for. - * @return The timestamp in microseconds of the last test run for the test, or -1 if none. - */ - private static long getLastRunTime(Key testKey) { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - Filter testTypeFilter = FilterUtil.getTestTypeFilter(false, true, false); - Query q = - new Query(TestRunEntity.KIND) - .setAncestor(testKey) - .setFilter(testTypeFilter) - .addSort(Entity.KEY_RESERVED_PROPERTY, SortDirection.DESCENDING) - .setKeysOnly(); - - long lastTestRun = -1; - for (Entity testRun : datastore.prepare(q).asIterable(FetchOptions.Builder.withLimit(1))) { - lastTestRun = testRun.getKey().getId(); - } - return lastTestRun; - } - - @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - Queue queue = QueueFactory.getDefaultQueue(); - Query q = new Query(TestStatusEntity.KIND).setKeysOnly(); - List<TaskOptions> tasks = new ArrayList<>(); - for (Entity status : datastore.prepare(q).asIterable()) { - TaskOptions task = - TaskOptions.Builder.withUrl(INACTIVITY_ALERT_URL) - .param("statusKey", KeyFactory.keyToString(status.getKey())) - .method(TaskOptions.Method.POST); - tasks.add(task); - } - TaskQueueHelper.addToQueue(queue, tasks); - } - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) - throws IOException { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - String statusKeyString = request.getParameter("statusKey"); - - Key statusKey; - try { - statusKey = KeyFactory.stringToKey(statusKeyString); - } catch (IllegalArgumentException e) { - logger.log(Level.WARNING, "Invalid key specified: " + statusKeyString); - return; - } - - TestStatusEntity status = null; - try { - status = TestStatusEntity.fromEntity(datastore.get(statusKey)); - } catch (EntityNotFoundException e) { - // no existing status - } - if (status == null) { - return; - } - 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.getTestName(); - - List<Message> messageQueue = new ArrayList<>(); - List<String> emails; - try { - emails = EmailHelper.getSubscriberEmails(testKey); - } catch (IOException e) { - logger.log(Level.SEVERE, e.toString()); - return; - } - notifyIfInactive(status, lastRunTime, link, emails, messageQueue); - if (messageQueue.size() > 0) { - EmailHelper.sendAll(messageQueue); - } - } -} diff --git a/src/main/java/com/android/vts/job/VtsPerformanceJobServlet.java b/src/main/java/com/android/vts/job/VtsPerformanceJobServlet.java deleted file mode 100644 index ebd5294..0000000 --- a/src/main/java/com/android/vts/job/VtsPerformanceJobServlet.java +++ /dev/null @@ -1,281 +0,0 @@ -/* - * Copyright (c) 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.job; - -import com.android.vts.entity.TestEntity; -import com.android.vts.util.EmailHelper; -import com.android.vts.util.PerformanceSummary; -import com.android.vts.util.PerformanceUtil; -import com.android.vts.util.ProfilingPointSummary; -import com.android.vts.util.StatSummary; -import com.android.vts.util.TaskQueueHelper; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.taskqueue.Queue; -import com.google.appengine.api.taskqueue.QueueFactory; -import com.google.appengine.api.taskqueue.TaskOptions; -import java.io.IOException; -import java.math.RoundingMode; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** Represents the notifications service which is automatically called on a fixed schedule. */ -public class VtsPerformanceJobServlet extends BaseJobServlet { - protected static final Logger logger = - Logger.getLogger(VtsPerformanceJobServlet.class.getName()); - - private static final String PERFORMANCE_JOB_URL = "/cron/vts_performance_job"; - private static final String MEAN = "Mean"; - private static final String MAX = "Max"; - private static final String MIN = "Min"; - private static final String MIN_DELTA = "ΔMin (%)"; - private static final String MAX_DELTA = "ΔMax (%)"; - private static final String HIGHER_IS_BETTER = - "Note: Higher values are better. Maximum is the best-case performance."; - private static final String LOWER_IS_BETTER = - "Note: Lower values are better. Minimum is the best-case performance."; - private static final String STD = "Std"; - private static final String SUBJECT_PREFIX = "Daily Performance Digest: "; - private static final String LAST_WEEK = "Last Week"; - private static final String LABEL_STYLE = "font-family: arial"; - private static final String SUBTEXT_STYLE = "font-family: arial; font-size: 12px"; - private static final String TABLE_STYLE = - "width: 100%; border-collapse: collapse; border: 1px solid black; font-size: 12px; font-family: arial;"; - private static final String SECTION_LABEL_STYLE = - "border: 1px solid black; border-bottom: none; background-color: lightgray;"; - private static final String COL_LABEL_STYLE = - "border: 1px solid black; border-bottom-width: 2px; border-top: 1px dotted gray; background-color: lightgray;"; - private static final String HEADER_COL_STYLE = - "border-top: 1px dotted gray; border-right: 2px solid black; text-align: right; background-color: lightgray;"; - private static final String INNER_CELL_STYLE = - "border-top: 1px dotted gray; border-right: 1px dotted gray; text-align: right;"; - private static final String OUTER_CELL_STYLE = - "border-top: 1px dotted gray; border-right: 2px solid black; text-align: right;"; - - private static final DecimalFormat FORMATTER; - - /** Initialize the decimal formatter. */ - static { - FORMATTER = new DecimalFormat("#.##"); - FORMATTER.setRoundingMode(RoundingMode.HALF_UP); - } - - /** - * Generates an HTML summary of the performance changes for the profiling results in the - * specified table. - * - * <p>Retrieves the past 24 hours of profiling data and compares it to the 24 hours that - * preceded it. Creates a table representation of the mean and standard deviation for each - * profiling point. When performance degrades, the cell is shaded red. - * - * @param testName The name of the test whose profiling data to summarize. - * @param perfSummaries List of PerformanceSummary objects for each profiling run (in reverse - * chronological order). - * @param labels List of string labels for use as the column headers. - * @returns An HTML string containing labeled table summaries. - */ - public static String getPerformanceSummary( - String testName, List<PerformanceSummary> perfSummaries, List<String> labels) { - if (perfSummaries.size() == 0) return ""; - PerformanceSummary now = perfSummaries.get(0); - String tableHTML = "<p style='" + LABEL_STYLE + "'><b>"; - tableHTML += testName + "</b></p>"; - for (String profilingPoint : now.getProfilingPointNames()) { - ProfilingPointSummary summary = now.getProfilingPointSummary(profilingPoint); - tableHTML += "<table cellpadding='2' style='" + TABLE_STYLE + "'>"; - - // Format header rows - String[] headerRows = new String[] {profilingPoint, summary.yLabel}; - int colspan = labels.size() * 4; - for (String content : headerRows) { - tableHTML += "<tr><td colspan='" + colspan + "'>" + content + "</td></tr>"; - } - - // Format section labels - tableHTML += "<tr>"; - for (int i = 0; i < labels.size(); i++) { - String content = labels.get(i); - tableHTML += "<th style='" + SECTION_LABEL_STYLE + "' "; - if (i == 0) tableHTML += "colspan='1'"; - else if (i == 1) tableHTML += "colspan='3'"; - else tableHTML += "colspan='4'"; - tableHTML += ">" + content + "</th>"; - } - tableHTML += "</tr>"; - - String deltaString; - String bestCaseString; - String subtext; - switch (now.getProfilingPointSummary(profilingPoint).getRegressionMode()) { - case VTS_REGRESSION_MODE_DECREASING: - deltaString = MAX_DELTA; - bestCaseString = MAX; - subtext = HIGHER_IS_BETTER; - break; - default: - deltaString = MIN_DELTA; - bestCaseString = MIN; - subtext = LOWER_IS_BETTER; - break; - } - - // Format column labels - tableHTML += "<tr>"; - for (int i = 0; i < labels.size(); i++) { - if (i > 1) { - tableHTML += "<th style='" + COL_LABEL_STYLE + "'>" + deltaString + "</th>"; - } - if (i == 0) { - tableHTML += "<th style='" + COL_LABEL_STYLE + "'>"; - tableHTML += summary.xLabel + "</th>"; - } else if (i > 0) { - tableHTML += "<th style='" + COL_LABEL_STYLE + "'>" + bestCaseString + "</th>"; - tableHTML += "<th style='" + COL_LABEL_STYLE + "'>" + MEAN + "</th>"; - tableHTML += "<th style='" + COL_LABEL_STYLE + "'>" + STD + "</th>"; - } - } - tableHTML += "</tr>"; - - // Populate data cells - for (StatSummary stats : summary) { - String label = stats.getLabel(); - tableHTML += "<tr><td style='" + HEADER_COL_STYLE + "'>" + label; - tableHTML += "</td><td style='" + INNER_CELL_STYLE + "'>"; - tableHTML += FORMATTER.format(stats.getBestCase()) + "</td>"; - tableHTML += "<td style='" + INNER_CELL_STYLE + "'>"; - tableHTML += FORMATTER.format(stats.getMean()) + "</td>"; - tableHTML += "<td style='" + OUTER_CELL_STYLE + "'>"; - if (stats.getCount() < 2) { - tableHTML += " - </td>"; - } else { - tableHTML += FORMATTER.format(stats.getStd()) + "</td>"; - } - for (int i = 1; i < perfSummaries.size(); i++) { - PerformanceSummary oldPerfSummary = perfSummaries.get(i); - if (oldPerfSummary.hasProfilingPoint(profilingPoint)) { - StatSummary baseline = - oldPerfSummary - .getProfilingPointSummary(profilingPoint) - .getStatSummary(label); - tableHTML += - PerformanceUtil.getBestCasePerformanceComparisonHTML( - baseline, - stats, - "", - "", - INNER_CELL_STYLE, - OUTER_CELL_STYLE); - } else tableHTML += "<td></td><td></td><td></td><td></td>"; - } - tableHTML += "</tr>"; - } - tableHTML += "</table>"; - tableHTML += "<i style='" + SUBTEXT_STYLE + "'>" + subtext + "</i><br><br>"; - } - return tableHTML; - } - - @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - Queue queue = QueueFactory.getDefaultQueue(); - Query q = new Query(TestEntity.KIND).setKeysOnly(); - List<TaskOptions> tasks = new ArrayList<>(); - for (Entity test : datastore.prepare(q).asIterable()) { - if (test.getKey().getName() == null) { - continue; - } - TaskOptions task = - TaskOptions.Builder.withUrl(PERFORMANCE_JOB_URL) - .param("testKey", KeyFactory.keyToString(test.getKey())) - .method(TaskOptions.Method.POST); - tasks.add(task); - } - TaskQueueHelper.addToQueue(queue, tasks); - } - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) - throws IOException { - String testKeyString = request.getParameter("testKey"); - Key testKey; - try { - testKey = KeyFactory.stringToKey(testKeyString); - } catch (IllegalArgumentException e) { - logger.log(Level.WARNING, "Invalid key specified: " + testKeyString); - return; - } - - long nowMicro = TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()); - - // Add today to the list of time intervals to analyze - List<PerformanceSummary> summaries = new ArrayList<>(); - PerformanceSummary today = - new PerformanceSummary(nowMicro - TimeUnit.DAYS.toMicros(1), nowMicro); - summaries.add(today); - - // Add yesterday as a baseline time interval for analysis - long oneDayAgo = nowMicro - TimeUnit.DAYS.toMicros(1); - PerformanceSummary yesterday = - new PerformanceSummary(oneDayAgo - TimeUnit.DAYS.toMicros(1), oneDayAgo); - summaries.add(yesterday); - - // Add last week as a baseline time interval for analysis - long oneWeek = TimeUnit.DAYS.toMicros(7); - long oneWeekAgo = nowMicro - oneWeek; - - String spanString = "<span class='date-label'>"; - String label = - spanString + TimeUnit.MICROSECONDS.toMillis(oneWeekAgo - oneWeek) + "</span>"; - label += " - " + spanString + TimeUnit.MICROSECONDS.toMillis(oneWeekAgo) + "</span>"; - PerformanceSummary lastWeek = - new PerformanceSummary(oneWeekAgo - oneWeek, oneWeekAgo, label); - summaries.add(lastWeek); - PerformanceUtil.updatePerformanceSummary( - testKey.getName(), oneWeekAgo - oneWeek, nowMicro, null, summaries); - - List<PerformanceSummary> nonEmptySummaries = new ArrayList<>(); - List<String> labels = new ArrayList<>(); - labels.add(""); - for (PerformanceSummary perfSummary : summaries) { - if (perfSummary.size() == 0) continue; - nonEmptySummaries.add(perfSummary); - labels.add(perfSummary.label); - } - String body = getPerformanceSummary(testKey.getName(), nonEmptySummaries, labels); - if (body == null || body.equals("")) { - return; - } - List<String> emails = EmailHelper.getSubscriberEmails(testKey); - if (emails.size() == 0) { - return; - } - String subject = SUBJECT_PREFIX + testKey.getName(); - EmailHelper.send(emails, subject, body); - } -} diff --git a/src/main/java/com/android/vts/job/VtsProfilingStatsJobServlet.java b/src/main/java/com/android/vts/job/VtsProfilingStatsJobServlet.java deleted file mode 100644 index 50f72e1..0000000 --- a/src/main/java/com/android/vts/job/VtsProfilingStatsJobServlet.java +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.job; - -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.ProfilingPointEntity; -import com.android.vts.entity.ProfilingPointRunEntity; -import com.android.vts.entity.ProfilingPointSummaryEntity; -import com.android.vts.util.DatastoreHelper; -import com.android.vts.util.PerformanceUtil; -import com.android.vts.util.TaskQueueHelper; -import com.android.vts.util.TimeUtil; -import com.google.appengine.api.datastore.DatastoreFailureException; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.DatastoreTimeoutException; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.EntityNotFoundException; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.datastore.Transaction; -import com.google.appengine.api.taskqueue.Queue; -import com.google.appengine.api.taskqueue.QueueFactory; -import com.google.appengine.api.taskqueue.TaskOptions; -import java.io.IOException; -import java.time.Instant; -import java.time.ZonedDateTime; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.ConcurrentModificationException; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** Represents the notifications service which is automatically called on a fixed schedule. */ -public class VtsProfilingStatsJobServlet extends BaseJobServlet { - protected static final Logger logger = - Logger.getLogger(VtsProfilingStatsJobServlet.class.getName()); - private static final String HIDL_HAL_OPTION = "hidl_hal_mode"; - private static final String[] splitKeysArray = new String[] {HIDL_HAL_OPTION}; - private static final Set<String> splitKeySet = new HashSet<>(Arrays.asList(splitKeysArray)); - - public static final String PROFILING_STATS_JOB_URL = "/task/vts_profiling_stats_job"; - public static final String PROFILING_POINT_KEY = "profilingPointKey"; - public static final String QUEUE = "profilingStatsQueue"; - - /** - * Round the date down to the start of the day (PST). - * - * @param time The time in microseconds. - * @return - */ - public static long getCanonicalTime(long time) { - long timeMillis = TimeUnit.MICROSECONDS.toMillis(time); - ZonedDateTime zdt = - ZonedDateTime.ofInstant(Instant.ofEpochMilli(timeMillis), TimeUtil.PT_ZONE); - return TimeUnit.SECONDS.toMicros( - zdt.withHour(0).withMinute(0).withSecond(0).toEpochSecond()); - } - - /** - * Add tasks to process profiling run data - * - * @param profilingPointKeys The list of keys of the profiling point runs whose data process. - */ - public static void addTasks(List<Key> profilingPointKeys) { - Queue queue = QueueFactory.getQueue(QUEUE); - List<TaskOptions> tasks = new ArrayList<>(); - for (Key key : profilingPointKeys) { - String keyString = KeyFactory.keyToString(key); - tasks.add( - TaskOptions.Builder.withUrl(PROFILING_STATS_JOB_URL) - .param(PROFILING_POINT_KEY, keyString) - .method(TaskOptions.Method.POST)); - } - TaskQueueHelper.addToQueue(queue, tasks); - } - - /** - * Update the profiling summaries with the information from a profiling point run. - * - * @param testKey The key to the TestEntity whose profiling data to analyze. - * @param profilingPointRun The profiling data to analyze. - * @param devices The list of devices used in the profiling run. - * @param time The canonical timestamp of the summary to update. - * @return true if the update succeeds, false otherwise. - */ - public static boolean updateSummaries( - Key testKey, - ProfilingPointRunEntity profilingPointRun, - List<DeviceInfoEntity> devices, - long time) { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - Transaction tx = datastore.beginTransaction(); - try { - List<Entity> puts = new ArrayList<>(); - - ProfilingPointEntity profilingPoint = - new ProfilingPointEntity( - testKey.getName(), - profilingPointRun.getName(), - profilingPointRun.getType(), - profilingPointRun.getRegressionMode(), - profilingPointRun.getXLabel(), - profilingPointRun.getYLabel()); - puts.add(profilingPoint.toEntity()); - - String option = PerformanceUtil.getOptionAlias(profilingPointRun, splitKeySet); - - Set<String> branches = new HashSet<>(); - Set<String> deviceNames = new HashSet<>(); - - branches.add(ProfilingPointSummaryEntity.ALL); - deviceNames.add(ProfilingPointSummaryEntity.ALL); - - for (DeviceInfoEntity d : devices) { - branches.add(d.getBranch()); - deviceNames.add(d.getBuildFlavor()); - } - - List<Key> summaryGets = new ArrayList<>(); - for (String branch : branches) { - for (String device : deviceNames) { - summaryGets.add( - ProfilingPointSummaryEntity.createKey( - profilingPoint.getKey(), branch, device, option, time)); - } - } - - Map<Key, Entity> summaries = datastore.get(tx, summaryGets); - Map<String, Map<String, ProfilingPointSummaryEntity>> summaryMap = new HashMap<>(); - for (Key key : summaries.keySet()) { - Entity e = summaries.get(key); - ProfilingPointSummaryEntity profilingPointSummary = - ProfilingPointSummaryEntity.fromEntity(e); - if (profilingPointSummary == null) { - logger.log(Level.WARNING, "Invalid profiling point summary: " + e.getKey()); - continue; - } - if (!summaryMap.containsKey(profilingPointSummary.getBranch())) { - summaryMap.put(profilingPointSummary.getBranch(), new HashMap<>()); - } - Map<String, ProfilingPointSummaryEntity> deviceMap = - summaryMap.get(profilingPointSummary.getBranch()); - deviceMap.put(profilingPointSummary.getBuildFlavor(), profilingPointSummary); - } - - Set<ProfilingPointSummaryEntity> modifiedEntities = new HashSet<>(); - - for (String branch : branches) { - if (!summaryMap.containsKey(branch)) { - summaryMap.put(branch, new HashMap<>()); - } - Map<String, ProfilingPointSummaryEntity> deviceMap = summaryMap.get(branch); - - for (String device : deviceNames) { - ProfilingPointSummaryEntity summary; - if (deviceMap.containsKey(device)) { - summary = deviceMap.get(device); - } else { - summary = - new ProfilingPointSummaryEntity( - profilingPoint.getKey(), branch, device, option, time); - deviceMap.put(device, summary); - } - summary.update(profilingPointRun); - modifiedEntities.add(summary); - } - } - - for (ProfilingPointSummaryEntity profilingPointSummary : modifiedEntities) { - puts.add(profilingPointSummary.toEntity()); - } - datastore.put(tx, puts); - tx.commit(); - } catch (ConcurrentModificationException - | DatastoreFailureException - | DatastoreTimeoutException e) { - return false; - } finally { - if (tx.isActive()) { - tx.rollback(); - logger.log( - Level.WARNING, - "Profiling stats job transaction still active: " - + profilingPointRun.getKey()); - return false; - } - } - return true; - } - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) - throws IOException { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - String profilingPointKeyString = request.getParameter(PROFILING_POINT_KEY); - - Key profilingPointRunKey; - try { - profilingPointRunKey = KeyFactory.stringToKey(profilingPointKeyString); - } catch (IllegalArgumentException e) { - logger.log(Level.WARNING, "Invalid key specified: " + profilingPointKeyString); - return; - } - Key testKey = profilingPointRunKey.getParent().getParent(); - - ProfilingPointRunEntity profilingPointRun = null; - try { - Entity profilingPointRunEntity = datastore.get(profilingPointRunKey); - profilingPointRun = ProfilingPointRunEntity.fromEntity(profilingPointRunEntity); - } catch (EntityNotFoundException e) { - // no run found - } - if (profilingPointRun == null) { - return; - } - - Query deviceQuery = - new Query(DeviceInfoEntity.KIND).setAncestor(profilingPointRunKey.getParent()); - - List<DeviceInfoEntity> devices = new ArrayList<>(); - for (Entity e : datastore.prepare(deviceQuery).asIterable()) { - DeviceInfoEntity deviceInfoEntity = DeviceInfoEntity.fromEntity(e); - if (e == null) continue; - devices.add(deviceInfoEntity); - } - - long canonicalTime = getCanonicalTime(profilingPointRunKey.getParent().getId()); - int retryCount = 0; - while (retryCount++ <= DatastoreHelper.MAX_WRITE_RETRIES) { - boolean result = updateSummaries(testKey, profilingPointRun, devices, canonicalTime); - if (!result) { - logger.log( - Level.WARNING, "Retrying profiling stats update: " + profilingPointRunKey); - continue; - } - break; - } - if (retryCount > DatastoreHelper.MAX_WRITE_RETRIES) { - logger.log(Level.SEVERE, "Could not update profiling stats: " + profilingPointRunKey); - } - } -} diff --git a/src/main/java/com/android/vts/job/VtsSpreadSheetSyncServlet.java b/src/main/java/com/android/vts/job/VtsSpreadSheetSyncServlet.java deleted file mode 100644 index 45726d9..0000000 --- a/src/main/java/com/android/vts/job/VtsSpreadSheetSyncServlet.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.job; - -import com.android.vts.entity.ApiCoverageExcludedEntity; -import com.android.vts.entity.DashboardEntity; -import com.google.api.client.auth.oauth2.Credential; -import com.google.api.client.extensions.appengine.datastore.AppEngineDataStoreFactory; -import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp; -import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver; -import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow; -import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets; -import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; -import com.google.api.client.http.javanet.NetHttpTransport; -import com.google.api.client.json.JsonFactory; -import com.google.api.client.json.jackson2.JacksonFactory; -import com.google.api.services.sheets.v4.Sheets; -import com.google.api.services.sheets.v4.model.ValueRange; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.security.GeneralSecurityException; -import java.util.ArrayList; -import java.util.List; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** Job to sync excluded API data in google spreadsheet with datastore's entity. */ -public class VtsSpreadSheetSyncServlet extends BaseJobServlet { - - protected static final Logger logger = - Logger.getLogger(VtsSpreadSheetSyncServlet.class.getName()); - - private static final String APPLICATION_NAME = "VTS Dashboard"; - private static final JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance(); - - private String CREDENTIALS_KEY_FILE = ""; - - /** GoogleClientSecrets for GoogleAuthorizationCodeFlow Builder */ - private GoogleClientSecrets clientSecrets; - - /** This is the ID of google spreadsheet. */ - private String SPREAD_SHEET_ID = ""; - - /** This is the range to read of google spreadsheet. */ - private String SPREAD_SHEET_RANGE = ""; - - @Override - public void init(ServletConfig servletConfig) throws ServletException { - super.init(servletConfig); - - try { - CREDENTIALS_KEY_FILE = systemConfigProp.getProperty("api.coverage.keyFile"); - SPREAD_SHEET_ID = systemConfigProp.getProperty("api.coverage.spreadSheetId"); - SPREAD_SHEET_RANGE = systemConfigProp.getProperty("api.coverage.spreadSheetRange"); - - InputStream keyFileInputStream = - this.getClass() - .getClassLoader() - .getResourceAsStream("keys/" + CREDENTIALS_KEY_FILE); - InputStreamReader keyFileStreamReader = new InputStreamReader(keyFileInputStream); - - this.clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, keyFileStreamReader); - } catch (IOException ioe) { - logger.log(Level.SEVERE, ioe.getMessage()); - } catch (Exception exception) { - logger.log(Level.SEVERE, exception.getMessage()); - } - } - - /** - * Creates an authorized Credential object. - * - * @param HTTP_TRANSPORT The network HTTP Transport. - * @param appEngineDataStoreFactory The credential will be persisted using the Google App Engine - * Data Store API. - * @param SCOPES Scopes are strings that enable access to particular resources, such as user - * data. - * @return An authorized Credential object. - * @throws IOException If the credentials.json file cannot be found. - */ - private Credential getCredentials( - final NetHttpTransport HTTP_TRANSPORT, - final AppEngineDataStoreFactory appEngineDataStoreFactory, - final List<String> SCOPES) - throws IOException { - - // Build flow and trigger user authorization request. - GoogleAuthorizationCodeFlow flow = - new GoogleAuthorizationCodeFlow.Builder( - HTTP_TRANSPORT, JSON_FACTORY, this.clientSecrets, SCOPES) - .setDataStoreFactory(appEngineDataStoreFactory) - .setAccessType("offline") - .build(); - LocalServerReceiver localServerReceiver = new LocalServerReceiver(); - return new AuthorizationCodeInstalledApp(flow, localServerReceiver).authorize("user"); - } - - @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - - try { - // Build a new authorized API client service. - final NetHttpTransport HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport(); - final AppEngineDataStoreFactory appEngineDataStoreFactory = - (AppEngineDataStoreFactory) - request.getServletContext().getAttribute("dataStoreFactory"); - final List<String> googleApiScopes = - (List<String>) request.getServletContext().getAttribute("googleApiScopes"); - - Sheets service = - new Sheets.Builder( - HTTP_TRANSPORT, - JSON_FACTORY, - getCredentials( - HTTP_TRANSPORT, - appEngineDataStoreFactory, - googleApiScopes)) - .setApplicationName(APPLICATION_NAME) - .build(); - - ValueRange valueRange = - service.spreadsheets() - .values() - .get(SPREAD_SHEET_ID, SPREAD_SHEET_RANGE) - .execute(); - - List<ApiCoverageExcludedEntity> apiCoverageExcludedEntities = new ArrayList<>(); - List<List<Object>> values = valueRange.getValues(); - if (values == null || values.isEmpty()) { - logger.log(Level.WARNING, "No data found in google spreadsheet."); - } else { - for (List row : values) { - ApiCoverageExcludedEntity apiCoverageExcludedEntity = - new ApiCoverageExcludedEntity( - row.get(0).toString(), - row.get(1).toString(), - row.get(2).toString(), - row.get(3).toString(), - row.get(4).toString()); - apiCoverageExcludedEntities.add(apiCoverageExcludedEntity); - } - } - - DashboardEntity.saveAll(apiCoverageExcludedEntities, MAX_ENTITY_SIZE_PER_TRANSACTION); - - } catch (GeneralSecurityException gse) { - logger.log(Level.SEVERE, gse.getMessage()); - } - } -} diff --git a/src/main/java/com/android/vts/job/VtsSuiteTestJobServlet.java b/src/main/java/com/android/vts/job/VtsSuiteTestJobServlet.java deleted file mode 100644 index 2aa34e4..0000000 --- a/src/main/java/com/android/vts/job/VtsSuiteTestJobServlet.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright (c) 2018 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.job; - -import com.android.vts.entity.TestSuiteFileEntity; -import com.android.vts.entity.TestSuiteResultEntity; -import com.android.vts.proto.TestSuiteResultMessageProto; -import com.android.vts.util.GcsHelper; -import com.android.vts.util.TaskQueueHelper; -import com.android.vts.util.TimeUtil; -import com.google.appengine.api.memcache.ErrorHandlers; -import com.google.appengine.api.memcache.MemcacheService; -import com.google.appengine.api.memcache.MemcacheServiceFactory; -import com.google.appengine.api.taskqueue.Queue; -import com.google.appengine.api.taskqueue.QueueFactory; -import com.google.appengine.api.taskqueue.TaskOptions; -import com.google.cloud.storage.Blob; -import com.google.cloud.storage.Bucket; -import com.google.cloud.storage.Storage; -import com.googlecode.objectify.Key; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.FileSystems; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Collectors; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -/** Suite Test result file processing job. */ -public class VtsSuiteTestJobServlet extends BaseJobServlet { - - private static final String SUITE_TEST_URL = "/cron/test_suite_report_gcs_monitor"; - - private static final String SERVICE_NAME = "VTS Dashboard"; - - private final Logger logger = Logger.getLogger(this.getClass().getName()); - - /** Google Cloud Storage project's key file to access the storage */ - private static String GCS_KEY_FILE; - /** Google Cloud Storage project's default bucket name for vtslab log files */ - private static String GCS_BUCKET_NAME; - /** Google Cloud Storage project's default directory name for suite test result files */ - private static String GCS_SUITE_TEST_FOLDER_NAME; - - public static final String QUEUE = "suiteTestQueue"; - - /** - * This is the key file to access vtslab-gcs project. It will allow the dashboard to have a full - * control of the bucket. - */ - private InputStream keyFileInputStream; - - /** This is the instance of java google storage library */ - private Storage storage; - - /** This is the instance of App Engine memcache service java library */ - private MemcacheService syncCache = MemcacheServiceFactory.getMemcacheService(); - - @Override - public void init(ServletConfig servletConfig) throws ServletException { - super.init(servletConfig); - - GCS_KEY_FILE = systemConfigProp.getProperty("gcs.keyFile"); - GCS_BUCKET_NAME = systemConfigProp.getProperty("gcs.bucketName"); - GCS_SUITE_TEST_FOLDER_NAME = systemConfigProp.getProperty("gcs.suiteTestFolderName"); - - this.keyFileInputStream = - this.getClass().getClassLoader().getResourceAsStream("keys/" + GCS_KEY_FILE); - - Optional<Storage> optionalStorage = GcsHelper.getStorage(this.keyFileInputStream); - if (optionalStorage.isPresent()) { - this.storage = optionalStorage.get(); - } else { - logger.log(Level.SEVERE, "Error on getting storage instance!"); - throw new ServletException("Creating storage instance exception!"); - } - syncCache.setErrorHandler(ErrorHandlers.getConsistentLogAndContinue(Level.INFO)); - } - - @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - - List<String> dateStringList = new ArrayList<>(); - - long currentMicroSecond = TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()); - - ZonedDateTime checkZonedDateTime = TimeUtil.getZonedDateTime(currentMicroSecond); - String checkDateString = - DateTimeFormatter.ofPattern(TimeUtil.DATE_FORMAT) - .format(checkZonedDateTime.minusMinutes(5)); - String todayDateString = TimeUtil.getDateString(currentMicroSecond); - if (!checkDateString.equals(todayDateString)) { - dateStringList.add(checkDateString); - logger.log(Level.INFO, "Yesterday is added to the process queue and processed!"); - } - dateStringList.add(todayDateString); - - for (String dateString : dateStringList) { - String[] dateArray = dateString.split("-"); - if (dateArray.length == 3) { - - Queue queue = QueueFactory.getQueue(QUEUE); - - List<TaskOptions> tasks = new ArrayList<>(); - - String fileSeparator = FileSystems.getDefault().getSeparator(); - - String year = dateArray[0]; - String month = dateArray[1]; - String day = dateArray[2]; - - List<String> pathList = Arrays.asList(GCS_SUITE_TEST_FOLDER_NAME, year, month, day); - Path pathInfo = Paths.get(String.join(fileSeparator, pathList)); - - List<TestSuiteFileEntity> testSuiteFileEntityList = - ofy().load() - .type(TestSuiteFileEntity.class) - .filter("year", Integer.parseInt(year)) - .filter("month", Integer.parseInt(month)) - .filter("day", Integer.parseInt(day)) - .list(); - - List<String> filePathList = - testSuiteFileEntityList - .stream() - .map(testSuiteFile -> testSuiteFile.getFilePath()) - .collect(Collectors.toList()); - - Bucket vtsReportBucket = this.storage.get(GCS_BUCKET_NAME); - - Storage.BlobListOption[] listOptions = - new Storage.BlobListOption[] { - Storage.BlobListOption.prefix(pathInfo.toString() + fileSeparator) - }; - - Iterable<Blob> blobIterable = vtsReportBucket.list(listOptions).iterateAll(); - Iterator<Blob> blobIterator = blobIterable.iterator(); - while (blobIterator.hasNext()) { - Blob blob = blobIterator.next(); - if (blob.isDirectory()) { - logger.log(Level.INFO, blob.getName() + " directory will be skipped!"); - } else { - if (filePathList.contains(blob.getName())) { - logger.log(Level.INFO, "filePathList contain => " + blob.getName()); - } else if (blob.getName().endsWith(fileSeparator)) { - logger.log(Level.INFO, blob.getName() + " endswith slash!"); - } else { - TaskOptions task = - TaskOptions.Builder.withUrl(SUITE_TEST_URL) - .param("filePath", blob.getName()) - .method(TaskOptions.Method.POST); - tasks.add(task); - } - } - } - TaskQueueHelper.addToQueue(queue, tasks); - } else { - throw new IllegalArgumentException( - todayDateString + " date string not in correct format"); - } - } - } - - @Override - public void doPost(HttpServletRequest request, HttpServletResponse response) - throws IOException { - - String filePath = request.getParameter("filePath"); - if (Objects.isNull(filePath)) { - logger.log(Level.WARNING, "filePath parameter is null!"); - } else { - logger.log(Level.INFO, "filePath parameter => " + filePath); - - Key<TestSuiteFileEntity> testSuiteFileEntityKey = - Key.create(TestSuiteFileEntity.class, filePath); - TestSuiteFileEntity testSuiteFileEntity = - ofy().load() - .type(TestSuiteFileEntity.class) - .filterKey(testSuiteFileEntityKey) - .first() - .now(); - - if (Objects.isNull(testSuiteFileEntity)) { - Blob blobFile = (Blob) this.syncCache.get(filePath); - if (Objects.isNull(blobFile)) { - Bucket vtsReportBucket = this.storage.get(GCS_BUCKET_NAME); - blobFile = vtsReportBucket.get(filePath); - this.syncCache.put(filePath, blobFile); - } - - if (blobFile.exists()) { - TestSuiteFileEntity newTestSuiteFileEntity = new TestSuiteFileEntity(filePath); - try { - TestSuiteResultMessageProto.TestSuiteResultMessage testSuiteResultMessage = - TestSuiteResultMessageProto.TestSuiteResultMessage.parseFrom( - blobFile.getContent()); - - TestSuiteResultEntity testSuiteResultEntity = - new TestSuiteResultEntity( - testSuiteFileEntityKey, - testSuiteResultMessage.getStartTime(), - testSuiteResultMessage.getEndTime(), - testSuiteResultMessage.getTestType(), - testSuiteResultMessage.getBootSuccess(), - testSuiteResultMessage.getResultPath(), - testSuiteResultMessage.getInfraLogPath(), - testSuiteResultMessage.getHostName(), - testSuiteResultMessage.getSuitePlan(), - testSuiteResultMessage.getSuiteVersion(), - testSuiteResultMessage.getSuiteName(), - testSuiteResultMessage.getSuiteBuildNumber(), - testSuiteResultMessage.getModulesDone(), - testSuiteResultMessage.getModulesTotal(), - testSuiteResultMessage.getBranch(), - testSuiteResultMessage.getTarget(), - testSuiteResultMessage.getBuildId(), - testSuiteResultMessage.getBuildSystemFingerprint(), - testSuiteResultMessage.getBuildVendorFingerprint(), - testSuiteResultMessage.getPassedTestCaseCount(), - testSuiteResultMessage.getFailedTestCaseCount()); - - testSuiteResultEntity.save(newTestSuiteFileEntity); - } catch (IOException e) { - ofy().delete().type(TestSuiteFileEntity.class).id(filePath).now(); - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - logger.log(Level.WARNING, "Invalid proto: " + e.getLocalizedMessage()); - } - } - } else { - logger.log(Level.INFO, "suite test found in datastore!"); - } - } - } -} diff --git a/src/main/java/com/android/vts/proto/TestSuiteResultMessageProto.java b/src/main/java/com/android/vts/proto/TestSuiteResultMessageProto.java deleted file mode 100644 index f152227..0000000 --- a/src/main/java/com/android/vts/proto/TestSuiteResultMessageProto.java +++ /dev/null @@ -1,4512 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: TestSuiteResultMessage.proto - -package com.android.vts.proto; - -public final class TestSuiteResultMessageProto { - private TestSuiteResultMessageProto() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - public interface TestSuiteResultMessageOrBuilder extends - // @@protoc_insertion_point(interface_extends:android.vts.TestSuiteResultMessage) - com.google.protobuf.MessageOrBuilder { - - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - boolean hasAccessToken(); - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - java.lang.String getAccessToken(); - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - com.google.protobuf.ByteString - getAccessTokenBytes(); - - /** - * <pre> - * GCS path to the corresponding result directory - * </pre> - * - * <code>optional string result_path = 2;</code> - */ - boolean hasResultPath(); - /** - * <pre> - * GCS path to the corresponding result directory - * </pre> - * - * <code>optional string result_path = 2;</code> - */ - java.lang.String getResultPath(); - /** - * <pre> - * GCS path to the corresponding result directory - * </pre> - * - * <code>optional string result_path = 2;</code> - */ - com.google.protobuf.ByteString - getResultPathBytes(); - - /** - * <pre> - * whether the device(s) booted-up successfully - * </pre> - * - * <code>optional bool boot_success = 3 [default = true];</code> - */ - boolean hasBootSuccess(); - /** - * <pre> - * whether the device(s) booted-up successfully - * </pre> - * - * <code>optional bool boot_success = 3 [default = true];</code> - */ - boolean getBootSuccess(); - - /** - * <pre> - * test suite build info - * </pre> - * - * <code>required string branch = 11;</code> - */ - boolean hasBranch(); - /** - * <pre> - * test suite build info - * </pre> - * - * <code>required string branch = 11;</code> - */ - java.lang.String getBranch(); - /** - * <pre> - * test suite build info - * </pre> - * - * <code>required string branch = 11;</code> - */ - com.google.protobuf.ByteString - getBranchBytes(); - - /** - * <code>required string target = 12;</code> - */ - boolean hasTarget(); - /** - * <code>required string target = 12;</code> - */ - java.lang.String getTarget(); - /** - * <code>required string target = 12;</code> - */ - com.google.protobuf.ByteString - getTargetBytes(); - - /** - * <code>required string build_id = 13;</code> - */ - boolean hasBuildId(); - /** - * <code>required string build_id = 13;</code> - */ - java.lang.String getBuildId(); - /** - * <code>required string build_id = 13;</code> - */ - com.google.protobuf.ByteString - getBuildIdBytes(); - - /** - * <pre> - * attributes of Result tag - * </pre> - * - * <code>optional string suite_plan = 21;</code> - */ - boolean hasSuitePlan(); - /** - * <pre> - * attributes of Result tag - * </pre> - * - * <code>optional string suite_plan = 21;</code> - */ - java.lang.String getSuitePlan(); - /** - * <pre> - * attributes of Result tag - * </pre> - * - * <code>optional string suite_plan = 21;</code> - */ - com.google.protobuf.ByteString - getSuitePlanBytes(); - - /** - * <code>optional string suite_version = 22;</code> - */ - boolean hasSuiteVersion(); - /** - * <code>optional string suite_version = 22;</code> - */ - java.lang.String getSuiteVersion(); - /** - * <code>optional string suite_version = 22;</code> - */ - com.google.protobuf.ByteString - getSuiteVersionBytes(); - - /** - * <code>optional string suite_build_number = 23;</code> - */ - boolean hasSuiteBuildNumber(); - /** - * <code>optional string suite_build_number = 23;</code> - */ - java.lang.String getSuiteBuildNumber(); - /** - * <code>optional string suite_build_number = 23;</code> - */ - com.google.protobuf.ByteString - getSuiteBuildNumberBytes(); - - /** - * <code>optional int64 start_time = 24;</code> - */ - boolean hasStartTime(); - /** - * <code>optional int64 start_time = 24;</code> - */ - long getStartTime(); - - /** - * <code>optional int64 end_time = 25;</code> - */ - boolean hasEndTime(); - /** - * <code>optional int64 end_time = 25;</code> - */ - long getEndTime(); - - /** - * <code>optional string host_name = 26;</code> - */ - boolean hasHostName(); - /** - * <code>optional string host_name = 26;</code> - */ - java.lang.String getHostName(); - /** - * <code>optional string host_name = 26;</code> - */ - com.google.protobuf.ByteString - getHostNameBytes(); - - /** - * <code>optional string suite_name = 27;</code> - */ - boolean hasSuiteName(); - /** - * <code>optional string suite_name = 27;</code> - */ - java.lang.String getSuiteName(); - /** - * <code>optional string suite_name = 27;</code> - */ - com.google.protobuf.ByteString - getSuiteNameBytes(); - - /** - * <pre> - * attributes of Build tag - * </pre> - * - * <code>optional string build_system_fingerprint = 31;</code> - */ - boolean hasBuildSystemFingerprint(); - /** - * <pre> - * attributes of Build tag - * </pre> - * - * <code>optional string build_system_fingerprint = 31;</code> - */ - java.lang.String getBuildSystemFingerprint(); - /** - * <pre> - * attributes of Build tag - * </pre> - * - * <code>optional string build_system_fingerprint = 31;</code> - */ - com.google.protobuf.ByteString - getBuildSystemFingerprintBytes(); - - /** - * <code>optional string build_vendor_fingerprint = 32;</code> - */ - boolean hasBuildVendorFingerprint(); - /** - * <code>optional string build_vendor_fingerprint = 32;</code> - */ - java.lang.String getBuildVendorFingerprint(); - /** - * <code>optional string build_vendor_fingerprint = 32;</code> - */ - com.google.protobuf.ByteString - getBuildVendorFingerprintBytes(); - - /** - * <code>optional int32 test_type = 33 [default = 0];</code> - */ - boolean hasTestType(); - /** - * <code>optional int32 test_type = 33 [default = 0];</code> - */ - int getTestType(); - - /** - * <pre> - * attributes of Summary tag - * </pre> - * - * <code>optional int32 passed_test_case_count = 41;</code> - */ - boolean hasPassedTestCaseCount(); - /** - * <pre> - * attributes of Summary tag - * </pre> - * - * <code>optional int32 passed_test_case_count = 41;</code> - */ - int getPassedTestCaseCount(); - - /** - * <code>optional int32 failed_test_case_count = 42;</code> - */ - boolean hasFailedTestCaseCount(); - /** - * <code>optional int32 failed_test_case_count = 42;</code> - */ - int getFailedTestCaseCount(); - - /** - * <code>optional int32 modules_done = 43;</code> - */ - boolean hasModulesDone(); - /** - * <code>optional int32 modules_done = 43;</code> - */ - int getModulesDone(); - - /** - * <code>optional int32 modules_total = 44;</code> - */ - boolean hasModulesTotal(); - /** - * <code>optional int32 modules_total = 44;</code> - */ - int getModulesTotal(); - - /** - * <pre> - * GCS path to the corresponding infra log file. - * </pre> - * - * <code>optional string infra_log_path = 51;</code> - */ - boolean hasInfraLogPath(); - /** - * <pre> - * GCS path to the corresponding infra log file. - * </pre> - * - * <code>optional string infra_log_path = 51;</code> - */ - java.lang.String getInfraLogPath(); - /** - * <pre> - * GCS path to the corresponding infra log file. - * </pre> - * - * <code>optional string infra_log_path = 51;</code> - */ - com.google.protobuf.ByteString - getInfraLogPathBytes(); - - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - java.util.List<java.lang.String> - getRepackedImagePathList(); - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - int getRepackedImagePathCount(); - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - java.lang.String getRepackedImagePath(int index); - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - com.google.protobuf.ByteString - getRepackedImagePathBytes(int index); - - /** - * <pre> - * Fetch info used to fetch and flash certain builds for retry_prompt command. - * </pre> - * - * <code>optional string vendor_build_id = 61;</code> - */ - boolean hasVendorBuildId(); - /** - * <pre> - * Fetch info used to fetch and flash certain builds for retry_prompt command. - * </pre> - * - * <code>optional string vendor_build_id = 61;</code> - */ - java.lang.String getVendorBuildId(); - /** - * <pre> - * Fetch info used to fetch and flash certain builds for retry_prompt command. - * </pre> - * - * <code>optional string vendor_build_id = 61;</code> - */ - com.google.protobuf.ByteString - getVendorBuildIdBytes(); - - /** - * <code>optional string gsi_build_id = 62;</code> - */ - boolean hasGsiBuildId(); - /** - * <code>optional string gsi_build_id = 62;</code> - */ - java.lang.String getGsiBuildId(); - /** - * <code>optional string gsi_build_id = 62;</code> - */ - com.google.protobuf.ByteString - getGsiBuildIdBytes(); - - /** - * <code>optional .android.test.lab.ScheduleConfigMessage schedule_config = 63 [deprecated = true];</code> - */ - @java.lang.Deprecated boolean hasScheduleConfig(); - /** - * <code>optional .android.test.lab.ScheduleConfigMessage schedule_config = 63 [deprecated = true];</code> - */ - @java.lang.Deprecated com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage getScheduleConfig(); - /** - * <code>optional .android.test.lab.ScheduleConfigMessage schedule_config = 63 [deprecated = true];</code> - */ - @java.lang.Deprecated com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessageOrBuilder getScheduleConfigOrBuilder(); - } - /** - * <pre> - * To specify the test results which are uploaded to vts dashboard. - * </pre> - * - * Protobuf type {@code android.vts.TestSuiteResultMessage} - */ - public static final class TestSuiteResultMessage extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:android.vts.TestSuiteResultMessage) - TestSuiteResultMessageOrBuilder { - // Use TestSuiteResultMessage.newBuilder() to construct. - private TestSuiteResultMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { - super(builder); - } - private TestSuiteResultMessage() { - accessToken_ = ""; - resultPath_ = ""; - bootSuccess_ = true; - branch_ = ""; - target_ = ""; - buildId_ = ""; - suitePlan_ = ""; - suiteVersion_ = ""; - suiteBuildNumber_ = ""; - startTime_ = 0L; - endTime_ = 0L; - hostName_ = ""; - suiteName_ = ""; - buildSystemFingerprint_ = ""; - buildVendorFingerprint_ = ""; - testType_ = 0; - passedTestCaseCount_ = 0; - failedTestCaseCount_ = 0; - modulesDone_ = 0; - modulesTotal_ = 0; - infraLogPath_ = ""; - repackedImagePath_ = com.google.protobuf.LazyStringArrayList.EMPTY; - vendorBuildId_ = ""; - gsiBuildId_ = ""; - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private TestSuiteResultMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - accessToken_ = bs; - break; - } - case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000002; - resultPath_ = bs; - break; - } - case 24: { - bitField0_ |= 0x00000004; - bootSuccess_ = input.readBool(); - break; - } - case 90: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000008; - branch_ = bs; - break; - } - case 98: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000010; - target_ = bs; - break; - } - case 106: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000020; - buildId_ = bs; - break; - } - case 170: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000040; - suitePlan_ = bs; - break; - } - case 178: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000080; - suiteVersion_ = bs; - break; - } - case 186: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000100; - suiteBuildNumber_ = bs; - break; - } - case 192: { - bitField0_ |= 0x00000200; - startTime_ = input.readInt64(); - break; - } - case 200: { - bitField0_ |= 0x00000400; - endTime_ = input.readInt64(); - break; - } - case 210: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000800; - hostName_ = bs; - break; - } - case 218: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00001000; - suiteName_ = bs; - break; - } - case 250: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00002000; - buildSystemFingerprint_ = bs; - break; - } - case 258: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00004000; - buildVendorFingerprint_ = bs; - break; - } - case 264: { - bitField0_ |= 0x00008000; - testType_ = input.readInt32(); - break; - } - case 328: { - bitField0_ |= 0x00010000; - passedTestCaseCount_ = input.readInt32(); - break; - } - case 336: { - bitField0_ |= 0x00020000; - failedTestCaseCount_ = input.readInt32(); - break; - } - case 344: { - bitField0_ |= 0x00040000; - modulesDone_ = input.readInt32(); - break; - } - case 352: { - bitField0_ |= 0x00080000; - modulesTotal_ = input.readInt32(); - break; - } - case 410: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00100000; - infraLogPath_ = bs; - break; - } - case 418: { - com.google.protobuf.ByteString bs = input.readBytes(); - if (!((mutable_bitField0_ & 0x00200000) == 0x00200000)) { - repackedImagePath_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00200000; - } - repackedImagePath_.add(bs); - break; - } - case 490: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00200000; - vendorBuildId_ = bs; - break; - } - case 498: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00400000; - gsiBuildId_ = bs; - break; - } - case 506: { - com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage.Builder subBuilder = null; - if (((bitField0_ & 0x00800000) == 0x00800000)) { - subBuilder = scheduleConfig_.toBuilder(); - } - scheduleConfig_ = input.readMessage(com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(scheduleConfig_); - scheduleConfig_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00800000; - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00200000) == 0x00200000)) { - repackedImagePath_ = repackedImagePath_.getUnmodifiableView(); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.TestSuiteResultMessageProto.internal_static_android_vts_TestSuiteResultMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.TestSuiteResultMessageProto.internal_static_android_vts_TestSuiteResultMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage.class, com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage.Builder.class); - } - - private int bitField0_; - public static final int ACCESS_TOKEN_FIELD_NUMBER = 1; - private volatile java.lang.Object accessToken_; - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public boolean hasAccessToken() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public java.lang.String getAccessToken() { - java.lang.Object ref = accessToken_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - accessToken_ = s; - } - return s; - } - } - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public com.google.protobuf.ByteString - getAccessTokenBytes() { - java.lang.Object ref = accessToken_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - accessToken_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int RESULT_PATH_FIELD_NUMBER = 2; - private volatile java.lang.Object resultPath_; - /** - * <pre> - * GCS path to the corresponding result directory - * </pre> - * - * <code>optional string result_path = 2;</code> - */ - public boolean hasResultPath() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * GCS path to the corresponding result directory - * </pre> - * - * <code>optional string result_path = 2;</code> - */ - public java.lang.String getResultPath() { - java.lang.Object ref = resultPath_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - resultPath_ = s; - } - return s; - } - } - /** - * <pre> - * GCS path to the corresponding result directory - * </pre> - * - * <code>optional string result_path = 2;</code> - */ - public com.google.protobuf.ByteString - getResultPathBytes() { - java.lang.Object ref = resultPath_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - resultPath_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int BOOT_SUCCESS_FIELD_NUMBER = 3; - private boolean bootSuccess_; - /** - * <pre> - * whether the device(s) booted-up successfully - * </pre> - * - * <code>optional bool boot_success = 3 [default = true];</code> - */ - public boolean hasBootSuccess() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * whether the device(s) booted-up successfully - * </pre> - * - * <code>optional bool boot_success = 3 [default = true];</code> - */ - public boolean getBootSuccess() { - return bootSuccess_; - } - - public static final int BRANCH_FIELD_NUMBER = 11; - private volatile java.lang.Object branch_; - /** - * <pre> - * test suite build info - * </pre> - * - * <code>required string branch = 11;</code> - */ - public boolean hasBranch() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <pre> - * test suite build info - * </pre> - * - * <code>required string branch = 11;</code> - */ - public java.lang.String getBranch() { - java.lang.Object ref = branch_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - branch_ = s; - } - return s; - } - } - /** - * <pre> - * test suite build info - * </pre> - * - * <code>required string branch = 11;</code> - */ - public com.google.protobuf.ByteString - getBranchBytes() { - java.lang.Object ref = branch_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - branch_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int TARGET_FIELD_NUMBER = 12; - private volatile java.lang.Object target_; - /** - * <code>required string target = 12;</code> - */ - public boolean hasTarget() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <code>required string target = 12;</code> - */ - public java.lang.String getTarget() { - java.lang.Object ref = target_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - target_ = s; - } - return s; - } - } - /** - * <code>required string target = 12;</code> - */ - public com.google.protobuf.ByteString - getTargetBytes() { - java.lang.Object ref = target_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - target_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int BUILD_ID_FIELD_NUMBER = 13; - private volatile java.lang.Object buildId_; - /** - * <code>required string build_id = 13;</code> - */ - public boolean hasBuildId() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - /** - * <code>required string build_id = 13;</code> - */ - public java.lang.String getBuildId() { - java.lang.Object ref = buildId_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - buildId_ = s; - } - return s; - } - } - /** - * <code>required string build_id = 13;</code> - */ - public com.google.protobuf.ByteString - getBuildIdBytes() { - java.lang.Object ref = buildId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - buildId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int SUITE_PLAN_FIELD_NUMBER = 21; - private volatile java.lang.Object suitePlan_; - /** - * <pre> - * attributes of Result tag - * </pre> - * - * <code>optional string suite_plan = 21;</code> - */ - public boolean hasSuitePlan() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - /** - * <pre> - * attributes of Result tag - * </pre> - * - * <code>optional string suite_plan = 21;</code> - */ - public java.lang.String getSuitePlan() { - java.lang.Object ref = suitePlan_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - suitePlan_ = s; - } - return s; - } - } - /** - * <pre> - * attributes of Result tag - * </pre> - * - * <code>optional string suite_plan = 21;</code> - */ - public com.google.protobuf.ByteString - getSuitePlanBytes() { - java.lang.Object ref = suitePlan_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - suitePlan_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int SUITE_VERSION_FIELD_NUMBER = 22; - private volatile java.lang.Object suiteVersion_; - /** - * <code>optional string suite_version = 22;</code> - */ - public boolean hasSuiteVersion() { - return ((bitField0_ & 0x00000080) == 0x00000080); - } - /** - * <code>optional string suite_version = 22;</code> - */ - public java.lang.String getSuiteVersion() { - java.lang.Object ref = suiteVersion_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - suiteVersion_ = s; - } - return s; - } - } - /** - * <code>optional string suite_version = 22;</code> - */ - public com.google.protobuf.ByteString - getSuiteVersionBytes() { - java.lang.Object ref = suiteVersion_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - suiteVersion_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int SUITE_BUILD_NUMBER_FIELD_NUMBER = 23; - private volatile java.lang.Object suiteBuildNumber_; - /** - * <code>optional string suite_build_number = 23;</code> - */ - public boolean hasSuiteBuildNumber() { - return ((bitField0_ & 0x00000100) == 0x00000100); - } - /** - * <code>optional string suite_build_number = 23;</code> - */ - public java.lang.String getSuiteBuildNumber() { - java.lang.Object ref = suiteBuildNumber_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - suiteBuildNumber_ = s; - } - return s; - } - } - /** - * <code>optional string suite_build_number = 23;</code> - */ - public com.google.protobuf.ByteString - getSuiteBuildNumberBytes() { - java.lang.Object ref = suiteBuildNumber_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - suiteBuildNumber_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int START_TIME_FIELD_NUMBER = 24; - private long startTime_; - /** - * <code>optional int64 start_time = 24;</code> - */ - public boolean hasStartTime() { - return ((bitField0_ & 0x00000200) == 0x00000200); - } - /** - * <code>optional int64 start_time = 24;</code> - */ - public long getStartTime() { - return startTime_; - } - - public static final int END_TIME_FIELD_NUMBER = 25; - private long endTime_; - /** - * <code>optional int64 end_time = 25;</code> - */ - public boolean hasEndTime() { - return ((bitField0_ & 0x00000400) == 0x00000400); - } - /** - * <code>optional int64 end_time = 25;</code> - */ - public long getEndTime() { - return endTime_; - } - - public static final int HOST_NAME_FIELD_NUMBER = 26; - private volatile java.lang.Object hostName_; - /** - * <code>optional string host_name = 26;</code> - */ - public boolean hasHostName() { - return ((bitField0_ & 0x00000800) == 0x00000800); - } - /** - * <code>optional string host_name = 26;</code> - */ - public java.lang.String getHostName() { - java.lang.Object ref = hostName_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - hostName_ = s; - } - return s; - } - } - /** - * <code>optional string host_name = 26;</code> - */ - public com.google.protobuf.ByteString - getHostNameBytes() { - java.lang.Object ref = hostName_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - hostName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int SUITE_NAME_FIELD_NUMBER = 27; - private volatile java.lang.Object suiteName_; - /** - * <code>optional string suite_name = 27;</code> - */ - public boolean hasSuiteName() { - return ((bitField0_ & 0x00001000) == 0x00001000); - } - /** - * <code>optional string suite_name = 27;</code> - */ - public java.lang.String getSuiteName() { - java.lang.Object ref = suiteName_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - suiteName_ = s; - } - return s; - } - } - /** - * <code>optional string suite_name = 27;</code> - */ - public com.google.protobuf.ByteString - getSuiteNameBytes() { - java.lang.Object ref = suiteName_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - suiteName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int BUILD_SYSTEM_FINGERPRINT_FIELD_NUMBER = 31; - private volatile java.lang.Object buildSystemFingerprint_; - /** - * <pre> - * attributes of Build tag - * </pre> - * - * <code>optional string build_system_fingerprint = 31;</code> - */ - public boolean hasBuildSystemFingerprint() { - return ((bitField0_ & 0x00002000) == 0x00002000); - } - /** - * <pre> - * attributes of Build tag - * </pre> - * - * <code>optional string build_system_fingerprint = 31;</code> - */ - public java.lang.String getBuildSystemFingerprint() { - java.lang.Object ref = buildSystemFingerprint_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - buildSystemFingerprint_ = s; - } - return s; - } - } - /** - * <pre> - * attributes of Build tag - * </pre> - * - * <code>optional string build_system_fingerprint = 31;</code> - */ - public com.google.protobuf.ByteString - getBuildSystemFingerprintBytes() { - java.lang.Object ref = buildSystemFingerprint_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - buildSystemFingerprint_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int BUILD_VENDOR_FINGERPRINT_FIELD_NUMBER = 32; - private volatile java.lang.Object buildVendorFingerprint_; - /** - * <code>optional string build_vendor_fingerprint = 32;</code> - */ - public boolean hasBuildVendorFingerprint() { - return ((bitField0_ & 0x00004000) == 0x00004000); - } - /** - * <code>optional string build_vendor_fingerprint = 32;</code> - */ - public java.lang.String getBuildVendorFingerprint() { - java.lang.Object ref = buildVendorFingerprint_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - buildVendorFingerprint_ = s; - } - return s; - } - } - /** - * <code>optional string build_vendor_fingerprint = 32;</code> - */ - public com.google.protobuf.ByteString - getBuildVendorFingerprintBytes() { - java.lang.Object ref = buildVendorFingerprint_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - buildVendorFingerprint_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int TEST_TYPE_FIELD_NUMBER = 33; - private int testType_; - /** - * <code>optional int32 test_type = 33 [default = 0];</code> - */ - public boolean hasTestType() { - return ((bitField0_ & 0x00008000) == 0x00008000); - } - /** - * <code>optional int32 test_type = 33 [default = 0];</code> - */ - public int getTestType() { - return testType_; - } - - public static final int PASSED_TEST_CASE_COUNT_FIELD_NUMBER = 41; - private int passedTestCaseCount_; - /** - * <pre> - * attributes of Summary tag - * </pre> - * - * <code>optional int32 passed_test_case_count = 41;</code> - */ - public boolean hasPassedTestCaseCount() { - return ((bitField0_ & 0x00010000) == 0x00010000); - } - /** - * <pre> - * attributes of Summary tag - * </pre> - * - * <code>optional int32 passed_test_case_count = 41;</code> - */ - public int getPassedTestCaseCount() { - return passedTestCaseCount_; - } - - public static final int FAILED_TEST_CASE_COUNT_FIELD_NUMBER = 42; - private int failedTestCaseCount_; - /** - * <code>optional int32 failed_test_case_count = 42;</code> - */ - public boolean hasFailedTestCaseCount() { - return ((bitField0_ & 0x00020000) == 0x00020000); - } - /** - * <code>optional int32 failed_test_case_count = 42;</code> - */ - public int getFailedTestCaseCount() { - return failedTestCaseCount_; - } - - public static final int MODULES_DONE_FIELD_NUMBER = 43; - private int modulesDone_; - /** - * <code>optional int32 modules_done = 43;</code> - */ - public boolean hasModulesDone() { - return ((bitField0_ & 0x00040000) == 0x00040000); - } - /** - * <code>optional int32 modules_done = 43;</code> - */ - public int getModulesDone() { - return modulesDone_; - } - - public static final int MODULES_TOTAL_FIELD_NUMBER = 44; - private int modulesTotal_; - /** - * <code>optional int32 modules_total = 44;</code> - */ - public boolean hasModulesTotal() { - return ((bitField0_ & 0x00080000) == 0x00080000); - } - /** - * <code>optional int32 modules_total = 44;</code> - */ - public int getModulesTotal() { - return modulesTotal_; - } - - public static final int INFRA_LOG_PATH_FIELD_NUMBER = 51; - private volatile java.lang.Object infraLogPath_; - /** - * <pre> - * GCS path to the corresponding infra log file. - * </pre> - * - * <code>optional string infra_log_path = 51;</code> - */ - public boolean hasInfraLogPath() { - return ((bitField0_ & 0x00100000) == 0x00100000); - } - /** - * <pre> - * GCS path to the corresponding infra log file. - * </pre> - * - * <code>optional string infra_log_path = 51;</code> - */ - public java.lang.String getInfraLogPath() { - java.lang.Object ref = infraLogPath_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - infraLogPath_ = s; - } - return s; - } - } - /** - * <pre> - * GCS path to the corresponding infra log file. - * </pre> - * - * <code>optional string infra_log_path = 51;</code> - */ - public com.google.protobuf.ByteString - getInfraLogPathBytes() { - java.lang.Object ref = infraLogPath_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - infraLogPath_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int REPACKED_IMAGE_PATH_FIELD_NUMBER = 52; - private com.google.protobuf.LazyStringList repackedImagePath_; - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - public com.google.protobuf.ProtocolStringList - getRepackedImagePathList() { - return repackedImagePath_; - } - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - public int getRepackedImagePathCount() { - return repackedImagePath_.size(); - } - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - public java.lang.String getRepackedImagePath(int index) { - return repackedImagePath_.get(index); - } - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - public com.google.protobuf.ByteString - getRepackedImagePathBytes(int index) { - return repackedImagePath_.getByteString(index); - } - - public static final int VENDOR_BUILD_ID_FIELD_NUMBER = 61; - private volatile java.lang.Object vendorBuildId_; - /** - * <pre> - * Fetch info used to fetch and flash certain builds for retry_prompt command. - * </pre> - * - * <code>optional string vendor_build_id = 61;</code> - */ - public boolean hasVendorBuildId() { - return ((bitField0_ & 0x00200000) == 0x00200000); - } - /** - * <pre> - * Fetch info used to fetch and flash certain builds for retry_prompt command. - * </pre> - * - * <code>optional string vendor_build_id = 61;</code> - */ - public java.lang.String getVendorBuildId() { - java.lang.Object ref = vendorBuildId_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - vendorBuildId_ = s; - } - return s; - } - } - /** - * <pre> - * Fetch info used to fetch and flash certain builds for retry_prompt command. - * </pre> - * - * <code>optional string vendor_build_id = 61;</code> - */ - public com.google.protobuf.ByteString - getVendorBuildIdBytes() { - java.lang.Object ref = vendorBuildId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - vendorBuildId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int GSI_BUILD_ID_FIELD_NUMBER = 62; - private volatile java.lang.Object gsiBuildId_; - /** - * <code>optional string gsi_build_id = 62;</code> - */ - public boolean hasGsiBuildId() { - return ((bitField0_ & 0x00400000) == 0x00400000); - } - /** - * <code>optional string gsi_build_id = 62;</code> - */ - public java.lang.String getGsiBuildId() { - java.lang.Object ref = gsiBuildId_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - gsiBuildId_ = s; - } - return s; - } - } - /** - * <code>optional string gsi_build_id = 62;</code> - */ - public com.google.protobuf.ByteString - getGsiBuildIdBytes() { - java.lang.Object ref = gsiBuildId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - gsiBuildId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int SCHEDULE_CONFIG_FIELD_NUMBER = 63; - private com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage scheduleConfig_; - /** - * <code>optional .android.test.lab.ScheduleConfigMessage schedule_config = 63 [deprecated = true];</code> - */ - @java.lang.Deprecated public boolean hasScheduleConfig() { - return ((bitField0_ & 0x00800000) == 0x00800000); - } - /** - * <code>optional .android.test.lab.ScheduleConfigMessage schedule_config = 63 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage getScheduleConfig() { - return scheduleConfig_ == null ? com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage.getDefaultInstance() : scheduleConfig_; - } - /** - * <code>optional .android.test.lab.ScheduleConfigMessage schedule_config = 63 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessageOrBuilder getScheduleConfigOrBuilder() { - return scheduleConfig_ == null ? com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage.getDefaultInstance() : scheduleConfig_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - if (!hasBranch()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasTarget()) { - memoizedIsInitialized = 0; - return false; - } - if (!hasBuildId()) { - memoizedIsInitialized = 0; - return false; - } - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, accessToken_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, resultPath_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBool(3, bootSuccess_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 11, branch_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 12, target_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 13, buildId_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 21, suitePlan_); - } - if (((bitField0_ & 0x00000080) == 0x00000080)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 22, suiteVersion_); - } - if (((bitField0_ & 0x00000100) == 0x00000100)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 23, suiteBuildNumber_); - } - if (((bitField0_ & 0x00000200) == 0x00000200)) { - output.writeInt64(24, startTime_); - } - if (((bitField0_ & 0x00000400) == 0x00000400)) { - output.writeInt64(25, endTime_); - } - if (((bitField0_ & 0x00000800) == 0x00000800)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 26, hostName_); - } - if (((bitField0_ & 0x00001000) == 0x00001000)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 27, suiteName_); - } - if (((bitField0_ & 0x00002000) == 0x00002000)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 31, buildSystemFingerprint_); - } - if (((bitField0_ & 0x00004000) == 0x00004000)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 32, buildVendorFingerprint_); - } - if (((bitField0_ & 0x00008000) == 0x00008000)) { - output.writeInt32(33, testType_); - } - if (((bitField0_ & 0x00010000) == 0x00010000)) { - output.writeInt32(41, passedTestCaseCount_); - } - if (((bitField0_ & 0x00020000) == 0x00020000)) { - output.writeInt32(42, failedTestCaseCount_); - } - if (((bitField0_ & 0x00040000) == 0x00040000)) { - output.writeInt32(43, modulesDone_); - } - if (((bitField0_ & 0x00080000) == 0x00080000)) { - output.writeInt32(44, modulesTotal_); - } - if (((bitField0_ & 0x00100000) == 0x00100000)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 51, infraLogPath_); - } - for (int i = 0; i < repackedImagePath_.size(); i++) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 52, repackedImagePath_.getRaw(i)); - } - if (((bitField0_ & 0x00200000) == 0x00200000)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 61, vendorBuildId_); - } - if (((bitField0_ & 0x00400000) == 0x00400000)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 62, gsiBuildId_); - } - if (((bitField0_ & 0x00800000) == 0x00800000)) { - output.writeMessage(63, getScheduleConfig()); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, accessToken_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, resultPath_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBoolSize(3, bootSuccess_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(11, branch_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(12, target_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(13, buildId_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(21, suitePlan_); - } - if (((bitField0_ & 0x00000080) == 0x00000080)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(22, suiteVersion_); - } - if (((bitField0_ & 0x00000100) == 0x00000100)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(23, suiteBuildNumber_); - } - if (((bitField0_ & 0x00000200) == 0x00000200)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(24, startTime_); - } - if (((bitField0_ & 0x00000400) == 0x00000400)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(25, endTime_); - } - if (((bitField0_ & 0x00000800) == 0x00000800)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(26, hostName_); - } - if (((bitField0_ & 0x00001000) == 0x00001000)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(27, suiteName_); - } - if (((bitField0_ & 0x00002000) == 0x00002000)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(31, buildSystemFingerprint_); - } - if (((bitField0_ & 0x00004000) == 0x00004000)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(32, buildVendorFingerprint_); - } - if (((bitField0_ & 0x00008000) == 0x00008000)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(33, testType_); - } - if (((bitField0_ & 0x00010000) == 0x00010000)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(41, passedTestCaseCount_); - } - if (((bitField0_ & 0x00020000) == 0x00020000)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(42, failedTestCaseCount_); - } - if (((bitField0_ & 0x00040000) == 0x00040000)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(43, modulesDone_); - } - if (((bitField0_ & 0x00080000) == 0x00080000)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(44, modulesTotal_); - } - if (((bitField0_ & 0x00100000) == 0x00100000)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(51, infraLogPath_); - } - { - int dataSize = 0; - for (int i = 0; i < repackedImagePath_.size(); i++) { - dataSize += computeStringSizeNoTag(repackedImagePath_.getRaw(i)); - } - size += dataSize; - size += 2 * getRepackedImagePathList().size(); - } - if (((bitField0_ & 0x00200000) == 0x00200000)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(61, vendorBuildId_); - } - if (((bitField0_ & 0x00400000) == 0x00400000)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(62, gsiBuildId_); - } - if (((bitField0_ & 0x00800000) == 0x00800000)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(63, getScheduleConfig()); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage)) { - return super.equals(obj); - } - com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage other = (com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage) obj; - - boolean result = true; - result = result && (hasAccessToken() == other.hasAccessToken()); - if (hasAccessToken()) { - result = result && getAccessToken() - .equals(other.getAccessToken()); - } - result = result && (hasResultPath() == other.hasResultPath()); - if (hasResultPath()) { - result = result && getResultPath() - .equals(other.getResultPath()); - } - result = result && (hasBootSuccess() == other.hasBootSuccess()); - if (hasBootSuccess()) { - result = result && (getBootSuccess() - == other.getBootSuccess()); - } - result = result && (hasBranch() == other.hasBranch()); - if (hasBranch()) { - result = result && getBranch() - .equals(other.getBranch()); - } - result = result && (hasTarget() == other.hasTarget()); - if (hasTarget()) { - result = result && getTarget() - .equals(other.getTarget()); - } - result = result && (hasBuildId() == other.hasBuildId()); - if (hasBuildId()) { - result = result && getBuildId() - .equals(other.getBuildId()); - } - result = result && (hasSuitePlan() == other.hasSuitePlan()); - if (hasSuitePlan()) { - result = result && getSuitePlan() - .equals(other.getSuitePlan()); - } - result = result && (hasSuiteVersion() == other.hasSuiteVersion()); - if (hasSuiteVersion()) { - result = result && getSuiteVersion() - .equals(other.getSuiteVersion()); - } - result = result && (hasSuiteBuildNumber() == other.hasSuiteBuildNumber()); - if (hasSuiteBuildNumber()) { - result = result && getSuiteBuildNumber() - .equals(other.getSuiteBuildNumber()); - } - result = result && (hasStartTime() == other.hasStartTime()); - if (hasStartTime()) { - result = result && (getStartTime() - == other.getStartTime()); - } - result = result && (hasEndTime() == other.hasEndTime()); - if (hasEndTime()) { - result = result && (getEndTime() - == other.getEndTime()); - } - result = result && (hasHostName() == other.hasHostName()); - if (hasHostName()) { - result = result && getHostName() - .equals(other.getHostName()); - } - result = result && (hasSuiteName() == other.hasSuiteName()); - if (hasSuiteName()) { - result = result && getSuiteName() - .equals(other.getSuiteName()); - } - result = result && (hasBuildSystemFingerprint() == other.hasBuildSystemFingerprint()); - if (hasBuildSystemFingerprint()) { - result = result && getBuildSystemFingerprint() - .equals(other.getBuildSystemFingerprint()); - } - result = result && (hasBuildVendorFingerprint() == other.hasBuildVendorFingerprint()); - if (hasBuildVendorFingerprint()) { - result = result && getBuildVendorFingerprint() - .equals(other.getBuildVendorFingerprint()); - } - result = result && (hasTestType() == other.hasTestType()); - if (hasTestType()) { - result = result && (getTestType() - == other.getTestType()); - } - result = result && (hasPassedTestCaseCount() == other.hasPassedTestCaseCount()); - if (hasPassedTestCaseCount()) { - result = result && (getPassedTestCaseCount() - == other.getPassedTestCaseCount()); - } - result = result && (hasFailedTestCaseCount() == other.hasFailedTestCaseCount()); - if (hasFailedTestCaseCount()) { - result = result && (getFailedTestCaseCount() - == other.getFailedTestCaseCount()); - } - result = result && (hasModulesDone() == other.hasModulesDone()); - if (hasModulesDone()) { - result = result && (getModulesDone() - == other.getModulesDone()); - } - result = result && (hasModulesTotal() == other.hasModulesTotal()); - if (hasModulesTotal()) { - result = result && (getModulesTotal() - == other.getModulesTotal()); - } - result = result && (hasInfraLogPath() == other.hasInfraLogPath()); - if (hasInfraLogPath()) { - result = result && getInfraLogPath() - .equals(other.getInfraLogPath()); - } - result = result && getRepackedImagePathList() - .equals(other.getRepackedImagePathList()); - result = result && (hasVendorBuildId() == other.hasVendorBuildId()); - if (hasVendorBuildId()) { - result = result && getVendorBuildId() - .equals(other.getVendorBuildId()); - } - result = result && (hasGsiBuildId() == other.hasGsiBuildId()); - if (hasGsiBuildId()) { - result = result && getGsiBuildId() - .equals(other.getGsiBuildId()); - } - result = result && (hasScheduleConfig() == other.hasScheduleConfig()); - if (hasScheduleConfig()) { - result = result && getScheduleConfig() - .equals(other.getScheduleConfig()); - } - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - if (hasAccessToken()) { - hash = (37 * hash) + ACCESS_TOKEN_FIELD_NUMBER; - hash = (53 * hash) + getAccessToken().hashCode(); - } - if (hasResultPath()) { - hash = (37 * hash) + RESULT_PATH_FIELD_NUMBER; - hash = (53 * hash) + getResultPath().hashCode(); - } - if (hasBootSuccess()) { - hash = (37 * hash) + BOOT_SUCCESS_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( - getBootSuccess()); - } - if (hasBranch()) { - hash = (37 * hash) + BRANCH_FIELD_NUMBER; - hash = (53 * hash) + getBranch().hashCode(); - } - if (hasTarget()) { - hash = (37 * hash) + TARGET_FIELD_NUMBER; - hash = (53 * hash) + getTarget().hashCode(); - } - if (hasBuildId()) { - hash = (37 * hash) + BUILD_ID_FIELD_NUMBER; - hash = (53 * hash) + getBuildId().hashCode(); - } - if (hasSuitePlan()) { - hash = (37 * hash) + SUITE_PLAN_FIELD_NUMBER; - hash = (53 * hash) + getSuitePlan().hashCode(); - } - if (hasSuiteVersion()) { - hash = (37 * hash) + SUITE_VERSION_FIELD_NUMBER; - hash = (53 * hash) + getSuiteVersion().hashCode(); - } - if (hasSuiteBuildNumber()) { - hash = (37 * hash) + SUITE_BUILD_NUMBER_FIELD_NUMBER; - hash = (53 * hash) + getSuiteBuildNumber().hashCode(); - } - if (hasStartTime()) { - hash = (37 * hash) + START_TIME_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getStartTime()); - } - if (hasEndTime()) { - hash = (37 * hash) + END_TIME_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getEndTime()); - } - if (hasHostName()) { - hash = (37 * hash) + HOST_NAME_FIELD_NUMBER; - hash = (53 * hash) + getHostName().hashCode(); - } - if (hasSuiteName()) { - hash = (37 * hash) + SUITE_NAME_FIELD_NUMBER; - hash = (53 * hash) + getSuiteName().hashCode(); - } - if (hasBuildSystemFingerprint()) { - hash = (37 * hash) + BUILD_SYSTEM_FINGERPRINT_FIELD_NUMBER; - hash = (53 * hash) + getBuildSystemFingerprint().hashCode(); - } - if (hasBuildVendorFingerprint()) { - hash = (37 * hash) + BUILD_VENDOR_FINGERPRINT_FIELD_NUMBER; - hash = (53 * hash) + getBuildVendorFingerprint().hashCode(); - } - if (hasTestType()) { - hash = (37 * hash) + TEST_TYPE_FIELD_NUMBER; - hash = (53 * hash) + getTestType(); - } - if (hasPassedTestCaseCount()) { - hash = (37 * hash) + PASSED_TEST_CASE_COUNT_FIELD_NUMBER; - hash = (53 * hash) + getPassedTestCaseCount(); - } - if (hasFailedTestCaseCount()) { - hash = (37 * hash) + FAILED_TEST_CASE_COUNT_FIELD_NUMBER; - hash = (53 * hash) + getFailedTestCaseCount(); - } - if (hasModulesDone()) { - hash = (37 * hash) + MODULES_DONE_FIELD_NUMBER; - hash = (53 * hash) + getModulesDone(); - } - if (hasModulesTotal()) { - hash = (37 * hash) + MODULES_TOTAL_FIELD_NUMBER; - hash = (53 * hash) + getModulesTotal(); - } - if (hasInfraLogPath()) { - hash = (37 * hash) + INFRA_LOG_PATH_FIELD_NUMBER; - hash = (53 * hash) + getInfraLogPath().hashCode(); - } - if (getRepackedImagePathCount() > 0) { - hash = (37 * hash) + REPACKED_IMAGE_PATH_FIELD_NUMBER; - hash = (53 * hash) + getRepackedImagePathList().hashCode(); - } - if (hasVendorBuildId()) { - hash = (37 * hash) + VENDOR_BUILD_ID_FIELD_NUMBER; - hash = (53 * hash) + getVendorBuildId().hashCode(); - } - if (hasGsiBuildId()) { - hash = (37 * hash) + GSI_BUILD_ID_FIELD_NUMBER; - hash = (53 * hash) + getGsiBuildId().hashCode(); - } - if (hasScheduleConfig()) { - hash = (37 * hash) + SCHEDULE_CONFIG_FIELD_NUMBER; - hash = (53 * hash) + getScheduleConfig().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * <pre> - * To specify the test results which are uploaded to vts dashboard. - * </pre> - * - * Protobuf type {@code android.vts.TestSuiteResultMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements - // @@protoc_insertion_point(builder_implements:android.vts.TestSuiteResultMessage) - com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.TestSuiteResultMessageProto.internal_static_android_vts_TestSuiteResultMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.TestSuiteResultMessageProto.internal_static_android_vts_TestSuiteResultMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage.class, com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage.Builder.class); - } - - // Construct using com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getScheduleConfigFieldBuilder(); - } - } - public Builder clear() { - super.clear(); - accessToken_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - resultPath_ = ""; - bitField0_ = (bitField0_ & ~0x00000002); - bootSuccess_ = true; - bitField0_ = (bitField0_ & ~0x00000004); - branch_ = ""; - bitField0_ = (bitField0_ & ~0x00000008); - target_ = ""; - bitField0_ = (bitField0_ & ~0x00000010); - buildId_ = ""; - bitField0_ = (bitField0_ & ~0x00000020); - suitePlan_ = ""; - bitField0_ = (bitField0_ & ~0x00000040); - suiteVersion_ = ""; - bitField0_ = (bitField0_ & ~0x00000080); - suiteBuildNumber_ = ""; - bitField0_ = (bitField0_ & ~0x00000100); - startTime_ = 0L; - bitField0_ = (bitField0_ & ~0x00000200); - endTime_ = 0L; - bitField0_ = (bitField0_ & ~0x00000400); - hostName_ = ""; - bitField0_ = (bitField0_ & ~0x00000800); - suiteName_ = ""; - bitField0_ = (bitField0_ & ~0x00001000); - buildSystemFingerprint_ = ""; - bitField0_ = (bitField0_ & ~0x00002000); - buildVendorFingerprint_ = ""; - bitField0_ = (bitField0_ & ~0x00004000); - testType_ = 0; - bitField0_ = (bitField0_ & ~0x00008000); - passedTestCaseCount_ = 0; - bitField0_ = (bitField0_ & ~0x00010000); - failedTestCaseCount_ = 0; - bitField0_ = (bitField0_ & ~0x00020000); - modulesDone_ = 0; - bitField0_ = (bitField0_ & ~0x00040000); - modulesTotal_ = 0; - bitField0_ = (bitField0_ & ~0x00080000); - infraLogPath_ = ""; - bitField0_ = (bitField0_ & ~0x00100000); - repackedImagePath_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00200000); - vendorBuildId_ = ""; - bitField0_ = (bitField0_ & ~0x00400000); - gsiBuildId_ = ""; - bitField0_ = (bitField0_ & ~0x00800000); - if (scheduleConfigBuilder_ == null) { - scheduleConfig_ = null; - } else { - scheduleConfigBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x01000000); - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.android.vts.proto.TestSuiteResultMessageProto.internal_static_android_vts_TestSuiteResultMessage_descriptor; - } - - public com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage getDefaultInstanceForType() { - return com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage.getDefaultInstance(); - } - - public com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage build() { - com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage buildPartial() { - com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage result = new com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.accessToken_ = accessToken_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.resultPath_ = resultPath_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.bootSuccess_ = bootSuccess_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.branch_ = branch_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.target_ = target_; - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { - to_bitField0_ |= 0x00000020; - } - result.buildId_ = buildId_; - if (((from_bitField0_ & 0x00000040) == 0x00000040)) { - to_bitField0_ |= 0x00000040; - } - result.suitePlan_ = suitePlan_; - if (((from_bitField0_ & 0x00000080) == 0x00000080)) { - to_bitField0_ |= 0x00000080; - } - result.suiteVersion_ = suiteVersion_; - if (((from_bitField0_ & 0x00000100) == 0x00000100)) { - to_bitField0_ |= 0x00000100; - } - result.suiteBuildNumber_ = suiteBuildNumber_; - if (((from_bitField0_ & 0x00000200) == 0x00000200)) { - to_bitField0_ |= 0x00000200; - } - result.startTime_ = startTime_; - if (((from_bitField0_ & 0x00000400) == 0x00000400)) { - to_bitField0_ |= 0x00000400; - } - result.endTime_ = endTime_; - if (((from_bitField0_ & 0x00000800) == 0x00000800)) { - to_bitField0_ |= 0x00000800; - } - result.hostName_ = hostName_; - if (((from_bitField0_ & 0x00001000) == 0x00001000)) { - to_bitField0_ |= 0x00001000; - } - result.suiteName_ = suiteName_; - if (((from_bitField0_ & 0x00002000) == 0x00002000)) { - to_bitField0_ |= 0x00002000; - } - result.buildSystemFingerprint_ = buildSystemFingerprint_; - if (((from_bitField0_ & 0x00004000) == 0x00004000)) { - to_bitField0_ |= 0x00004000; - } - result.buildVendorFingerprint_ = buildVendorFingerprint_; - if (((from_bitField0_ & 0x00008000) == 0x00008000)) { - to_bitField0_ |= 0x00008000; - } - result.testType_ = testType_; - if (((from_bitField0_ & 0x00010000) == 0x00010000)) { - to_bitField0_ |= 0x00010000; - } - result.passedTestCaseCount_ = passedTestCaseCount_; - if (((from_bitField0_ & 0x00020000) == 0x00020000)) { - to_bitField0_ |= 0x00020000; - } - result.failedTestCaseCount_ = failedTestCaseCount_; - if (((from_bitField0_ & 0x00040000) == 0x00040000)) { - to_bitField0_ |= 0x00040000; - } - result.modulesDone_ = modulesDone_; - if (((from_bitField0_ & 0x00080000) == 0x00080000)) { - to_bitField0_ |= 0x00080000; - } - result.modulesTotal_ = modulesTotal_; - if (((from_bitField0_ & 0x00100000) == 0x00100000)) { - to_bitField0_ |= 0x00100000; - } - result.infraLogPath_ = infraLogPath_; - if (((bitField0_ & 0x00200000) == 0x00200000)) { - repackedImagePath_ = repackedImagePath_.getUnmodifiableView(); - bitField0_ = (bitField0_ & ~0x00200000); - } - result.repackedImagePath_ = repackedImagePath_; - if (((from_bitField0_ & 0x00400000) == 0x00400000)) { - to_bitField0_ |= 0x00200000; - } - result.vendorBuildId_ = vendorBuildId_; - if (((from_bitField0_ & 0x00800000) == 0x00800000)) { - to_bitField0_ |= 0x00400000; - } - result.gsiBuildId_ = gsiBuildId_; - if (((from_bitField0_ & 0x01000000) == 0x01000000)) { - to_bitField0_ |= 0x00800000; - } - if (scheduleConfigBuilder_ == null) { - result.scheduleConfig_ = scheduleConfig_; - } else { - result.scheduleConfig_ = scheduleConfigBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage) { - return mergeFrom((com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage other) { - if (other == com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage.getDefaultInstance()) return this; - if (other.hasAccessToken()) { - bitField0_ |= 0x00000001; - accessToken_ = other.accessToken_; - onChanged(); - } - if (other.hasResultPath()) { - bitField0_ |= 0x00000002; - resultPath_ = other.resultPath_; - onChanged(); - } - if (other.hasBootSuccess()) { - setBootSuccess(other.getBootSuccess()); - } - if (other.hasBranch()) { - bitField0_ |= 0x00000008; - branch_ = other.branch_; - onChanged(); - } - if (other.hasTarget()) { - bitField0_ |= 0x00000010; - target_ = other.target_; - onChanged(); - } - if (other.hasBuildId()) { - bitField0_ |= 0x00000020; - buildId_ = other.buildId_; - onChanged(); - } - if (other.hasSuitePlan()) { - bitField0_ |= 0x00000040; - suitePlan_ = other.suitePlan_; - onChanged(); - } - if (other.hasSuiteVersion()) { - bitField0_ |= 0x00000080; - suiteVersion_ = other.suiteVersion_; - onChanged(); - } - if (other.hasSuiteBuildNumber()) { - bitField0_ |= 0x00000100; - suiteBuildNumber_ = other.suiteBuildNumber_; - onChanged(); - } - if (other.hasStartTime()) { - setStartTime(other.getStartTime()); - } - if (other.hasEndTime()) { - setEndTime(other.getEndTime()); - } - if (other.hasHostName()) { - bitField0_ |= 0x00000800; - hostName_ = other.hostName_; - onChanged(); - } - if (other.hasSuiteName()) { - bitField0_ |= 0x00001000; - suiteName_ = other.suiteName_; - onChanged(); - } - if (other.hasBuildSystemFingerprint()) { - bitField0_ |= 0x00002000; - buildSystemFingerprint_ = other.buildSystemFingerprint_; - onChanged(); - } - if (other.hasBuildVendorFingerprint()) { - bitField0_ |= 0x00004000; - buildVendorFingerprint_ = other.buildVendorFingerprint_; - onChanged(); - } - if (other.hasTestType()) { - setTestType(other.getTestType()); - } - if (other.hasPassedTestCaseCount()) { - setPassedTestCaseCount(other.getPassedTestCaseCount()); - } - if (other.hasFailedTestCaseCount()) { - setFailedTestCaseCount(other.getFailedTestCaseCount()); - } - if (other.hasModulesDone()) { - setModulesDone(other.getModulesDone()); - } - if (other.hasModulesTotal()) { - setModulesTotal(other.getModulesTotal()); - } - if (other.hasInfraLogPath()) { - bitField0_ |= 0x00100000; - infraLogPath_ = other.infraLogPath_; - onChanged(); - } - if (!other.repackedImagePath_.isEmpty()) { - if (repackedImagePath_.isEmpty()) { - repackedImagePath_ = other.repackedImagePath_; - bitField0_ = (bitField0_ & ~0x00200000); - } else { - ensureRepackedImagePathIsMutable(); - repackedImagePath_.addAll(other.repackedImagePath_); - } - onChanged(); - } - if (other.hasVendorBuildId()) { - bitField0_ |= 0x00400000; - vendorBuildId_ = other.vendorBuildId_; - onChanged(); - } - if (other.hasGsiBuildId()) { - bitField0_ |= 0x00800000; - gsiBuildId_ = other.gsiBuildId_; - onChanged(); - } - if (other.hasScheduleConfig()) { - mergeScheduleConfig(other.getScheduleConfig()); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - if (!hasBranch()) { - return false; - } - if (!hasTarget()) { - return false; - } - if (!hasBuildId()) { - return false; - } - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private java.lang.Object accessToken_ = ""; - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public boolean hasAccessToken() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public java.lang.String getAccessToken() { - java.lang.Object ref = accessToken_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - accessToken_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public com.google.protobuf.ByteString - getAccessTokenBytes() { - java.lang.Object ref = accessToken_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - accessToken_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public Builder setAccessToken( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - accessToken_ = value; - onChanged(); - return this; - } - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public Builder clearAccessToken() { - bitField0_ = (bitField0_ & ~0x00000001); - accessToken_ = getDefaultInstance().getAccessToken(); - onChanged(); - return this; - } - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public Builder setAccessTokenBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - accessToken_ = value; - onChanged(); - return this; - } - - private java.lang.Object resultPath_ = ""; - /** - * <pre> - * GCS path to the corresponding result directory - * </pre> - * - * <code>optional string result_path = 2;</code> - */ - public boolean hasResultPath() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * GCS path to the corresponding result directory - * </pre> - * - * <code>optional string result_path = 2;</code> - */ - public java.lang.String getResultPath() { - java.lang.Object ref = resultPath_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - resultPath_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <pre> - * GCS path to the corresponding result directory - * </pre> - * - * <code>optional string result_path = 2;</code> - */ - public com.google.protobuf.ByteString - getResultPathBytes() { - java.lang.Object ref = resultPath_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - resultPath_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <pre> - * GCS path to the corresponding result directory - * </pre> - * - * <code>optional string result_path = 2;</code> - */ - public Builder setResultPath( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - resultPath_ = value; - onChanged(); - return this; - } - /** - * <pre> - * GCS path to the corresponding result directory - * </pre> - * - * <code>optional string result_path = 2;</code> - */ - public Builder clearResultPath() { - bitField0_ = (bitField0_ & ~0x00000002); - resultPath_ = getDefaultInstance().getResultPath(); - onChanged(); - return this; - } - /** - * <pre> - * GCS path to the corresponding result directory - * </pre> - * - * <code>optional string result_path = 2;</code> - */ - public Builder setResultPathBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - resultPath_ = value; - onChanged(); - return this; - } - - private boolean bootSuccess_ = true; - /** - * <pre> - * whether the device(s) booted-up successfully - * </pre> - * - * <code>optional bool boot_success = 3 [default = true];</code> - */ - public boolean hasBootSuccess() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * whether the device(s) booted-up successfully - * </pre> - * - * <code>optional bool boot_success = 3 [default = true];</code> - */ - public boolean getBootSuccess() { - return bootSuccess_; - } - /** - * <pre> - * whether the device(s) booted-up successfully - * </pre> - * - * <code>optional bool boot_success = 3 [default = true];</code> - */ - public Builder setBootSuccess(boolean value) { - bitField0_ |= 0x00000004; - bootSuccess_ = value; - onChanged(); - return this; - } - /** - * <pre> - * whether the device(s) booted-up successfully - * </pre> - * - * <code>optional bool boot_success = 3 [default = true];</code> - */ - public Builder clearBootSuccess() { - bitField0_ = (bitField0_ & ~0x00000004); - bootSuccess_ = true; - onChanged(); - return this; - } - - private java.lang.Object branch_ = ""; - /** - * <pre> - * test suite build info - * </pre> - * - * <code>required string branch = 11;</code> - */ - public boolean hasBranch() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <pre> - * test suite build info - * </pre> - * - * <code>required string branch = 11;</code> - */ - public java.lang.String getBranch() { - java.lang.Object ref = branch_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - branch_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <pre> - * test suite build info - * </pre> - * - * <code>required string branch = 11;</code> - */ - public com.google.protobuf.ByteString - getBranchBytes() { - java.lang.Object ref = branch_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - branch_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <pre> - * test suite build info - * </pre> - * - * <code>required string branch = 11;</code> - */ - public Builder setBranch( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000008; - branch_ = value; - onChanged(); - return this; - } - /** - * <pre> - * test suite build info - * </pre> - * - * <code>required string branch = 11;</code> - */ - public Builder clearBranch() { - bitField0_ = (bitField0_ & ~0x00000008); - branch_ = getDefaultInstance().getBranch(); - onChanged(); - return this; - } - /** - * <pre> - * test suite build info - * </pre> - * - * <code>required string branch = 11;</code> - */ - public Builder setBranchBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000008; - branch_ = value; - onChanged(); - return this; - } - - private java.lang.Object target_ = ""; - /** - * <code>required string target = 12;</code> - */ - public boolean hasTarget() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <code>required string target = 12;</code> - */ - public java.lang.String getTarget() { - java.lang.Object ref = target_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - target_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <code>required string target = 12;</code> - */ - public com.google.protobuf.ByteString - getTargetBytes() { - java.lang.Object ref = target_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - target_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <code>required string target = 12;</code> - */ - public Builder setTarget( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000010; - target_ = value; - onChanged(); - return this; - } - /** - * <code>required string target = 12;</code> - */ - public Builder clearTarget() { - bitField0_ = (bitField0_ & ~0x00000010); - target_ = getDefaultInstance().getTarget(); - onChanged(); - return this; - } - /** - * <code>required string target = 12;</code> - */ - public Builder setTargetBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000010; - target_ = value; - onChanged(); - return this; - } - - private java.lang.Object buildId_ = ""; - /** - * <code>required string build_id = 13;</code> - */ - public boolean hasBuildId() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - /** - * <code>required string build_id = 13;</code> - */ - public java.lang.String getBuildId() { - java.lang.Object ref = buildId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - buildId_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <code>required string build_id = 13;</code> - */ - public com.google.protobuf.ByteString - getBuildIdBytes() { - java.lang.Object ref = buildId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - buildId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <code>required string build_id = 13;</code> - */ - public Builder setBuildId( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000020; - buildId_ = value; - onChanged(); - return this; - } - /** - * <code>required string build_id = 13;</code> - */ - public Builder clearBuildId() { - bitField0_ = (bitField0_ & ~0x00000020); - buildId_ = getDefaultInstance().getBuildId(); - onChanged(); - return this; - } - /** - * <code>required string build_id = 13;</code> - */ - public Builder setBuildIdBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000020; - buildId_ = value; - onChanged(); - return this; - } - - private java.lang.Object suitePlan_ = ""; - /** - * <pre> - * attributes of Result tag - * </pre> - * - * <code>optional string suite_plan = 21;</code> - */ - public boolean hasSuitePlan() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - /** - * <pre> - * attributes of Result tag - * </pre> - * - * <code>optional string suite_plan = 21;</code> - */ - public java.lang.String getSuitePlan() { - java.lang.Object ref = suitePlan_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - suitePlan_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <pre> - * attributes of Result tag - * </pre> - * - * <code>optional string suite_plan = 21;</code> - */ - public com.google.protobuf.ByteString - getSuitePlanBytes() { - java.lang.Object ref = suitePlan_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - suitePlan_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <pre> - * attributes of Result tag - * </pre> - * - * <code>optional string suite_plan = 21;</code> - */ - public Builder setSuitePlan( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000040; - suitePlan_ = value; - onChanged(); - return this; - } - /** - * <pre> - * attributes of Result tag - * </pre> - * - * <code>optional string suite_plan = 21;</code> - */ - public Builder clearSuitePlan() { - bitField0_ = (bitField0_ & ~0x00000040); - suitePlan_ = getDefaultInstance().getSuitePlan(); - onChanged(); - return this; - } - /** - * <pre> - * attributes of Result tag - * </pre> - * - * <code>optional string suite_plan = 21;</code> - */ - public Builder setSuitePlanBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000040; - suitePlan_ = value; - onChanged(); - return this; - } - - private java.lang.Object suiteVersion_ = ""; - /** - * <code>optional string suite_version = 22;</code> - */ - public boolean hasSuiteVersion() { - return ((bitField0_ & 0x00000080) == 0x00000080); - } - /** - * <code>optional string suite_version = 22;</code> - */ - public java.lang.String getSuiteVersion() { - java.lang.Object ref = suiteVersion_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - suiteVersion_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <code>optional string suite_version = 22;</code> - */ - public com.google.protobuf.ByteString - getSuiteVersionBytes() { - java.lang.Object ref = suiteVersion_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - suiteVersion_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <code>optional string suite_version = 22;</code> - */ - public Builder setSuiteVersion( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000080; - suiteVersion_ = value; - onChanged(); - return this; - } - /** - * <code>optional string suite_version = 22;</code> - */ - public Builder clearSuiteVersion() { - bitField0_ = (bitField0_ & ~0x00000080); - suiteVersion_ = getDefaultInstance().getSuiteVersion(); - onChanged(); - return this; - } - /** - * <code>optional string suite_version = 22;</code> - */ - public Builder setSuiteVersionBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000080; - suiteVersion_ = value; - onChanged(); - return this; - } - - private java.lang.Object suiteBuildNumber_ = ""; - /** - * <code>optional string suite_build_number = 23;</code> - */ - public boolean hasSuiteBuildNumber() { - return ((bitField0_ & 0x00000100) == 0x00000100); - } - /** - * <code>optional string suite_build_number = 23;</code> - */ - public java.lang.String getSuiteBuildNumber() { - java.lang.Object ref = suiteBuildNumber_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - suiteBuildNumber_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <code>optional string suite_build_number = 23;</code> - */ - public com.google.protobuf.ByteString - getSuiteBuildNumberBytes() { - java.lang.Object ref = suiteBuildNumber_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - suiteBuildNumber_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <code>optional string suite_build_number = 23;</code> - */ - public Builder setSuiteBuildNumber( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000100; - suiteBuildNumber_ = value; - onChanged(); - return this; - } - /** - * <code>optional string suite_build_number = 23;</code> - */ - public Builder clearSuiteBuildNumber() { - bitField0_ = (bitField0_ & ~0x00000100); - suiteBuildNumber_ = getDefaultInstance().getSuiteBuildNumber(); - onChanged(); - return this; - } - /** - * <code>optional string suite_build_number = 23;</code> - */ - public Builder setSuiteBuildNumberBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000100; - suiteBuildNumber_ = value; - onChanged(); - return this; - } - - private long startTime_ ; - /** - * <code>optional int64 start_time = 24;</code> - */ - public boolean hasStartTime() { - return ((bitField0_ & 0x00000200) == 0x00000200); - } - /** - * <code>optional int64 start_time = 24;</code> - */ - public long getStartTime() { - return startTime_; - } - /** - * <code>optional int64 start_time = 24;</code> - */ - public Builder setStartTime(long value) { - bitField0_ |= 0x00000200; - startTime_ = value; - onChanged(); - return this; - } - /** - * <code>optional int64 start_time = 24;</code> - */ - public Builder clearStartTime() { - bitField0_ = (bitField0_ & ~0x00000200); - startTime_ = 0L; - onChanged(); - return this; - } - - private long endTime_ ; - /** - * <code>optional int64 end_time = 25;</code> - */ - public boolean hasEndTime() { - return ((bitField0_ & 0x00000400) == 0x00000400); - } - /** - * <code>optional int64 end_time = 25;</code> - */ - public long getEndTime() { - return endTime_; - } - /** - * <code>optional int64 end_time = 25;</code> - */ - public Builder setEndTime(long value) { - bitField0_ |= 0x00000400; - endTime_ = value; - onChanged(); - return this; - } - /** - * <code>optional int64 end_time = 25;</code> - */ - public Builder clearEndTime() { - bitField0_ = (bitField0_ & ~0x00000400); - endTime_ = 0L; - onChanged(); - return this; - } - - private java.lang.Object hostName_ = ""; - /** - * <code>optional string host_name = 26;</code> - */ - public boolean hasHostName() { - return ((bitField0_ & 0x00000800) == 0x00000800); - } - /** - * <code>optional string host_name = 26;</code> - */ - public java.lang.String getHostName() { - java.lang.Object ref = hostName_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - hostName_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <code>optional string host_name = 26;</code> - */ - public com.google.protobuf.ByteString - getHostNameBytes() { - java.lang.Object ref = hostName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - hostName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <code>optional string host_name = 26;</code> - */ - public Builder setHostName( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000800; - hostName_ = value; - onChanged(); - return this; - } - /** - * <code>optional string host_name = 26;</code> - */ - public Builder clearHostName() { - bitField0_ = (bitField0_ & ~0x00000800); - hostName_ = getDefaultInstance().getHostName(); - onChanged(); - return this; - } - /** - * <code>optional string host_name = 26;</code> - */ - public Builder setHostNameBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000800; - hostName_ = value; - onChanged(); - return this; - } - - private java.lang.Object suiteName_ = ""; - /** - * <code>optional string suite_name = 27;</code> - */ - public boolean hasSuiteName() { - return ((bitField0_ & 0x00001000) == 0x00001000); - } - /** - * <code>optional string suite_name = 27;</code> - */ - public java.lang.String getSuiteName() { - java.lang.Object ref = suiteName_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - suiteName_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <code>optional string suite_name = 27;</code> - */ - public com.google.protobuf.ByteString - getSuiteNameBytes() { - java.lang.Object ref = suiteName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - suiteName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <code>optional string suite_name = 27;</code> - */ - public Builder setSuiteName( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00001000; - suiteName_ = value; - onChanged(); - return this; - } - /** - * <code>optional string suite_name = 27;</code> - */ - public Builder clearSuiteName() { - bitField0_ = (bitField0_ & ~0x00001000); - suiteName_ = getDefaultInstance().getSuiteName(); - onChanged(); - return this; - } - /** - * <code>optional string suite_name = 27;</code> - */ - public Builder setSuiteNameBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00001000; - suiteName_ = value; - onChanged(); - return this; - } - - private java.lang.Object buildSystemFingerprint_ = ""; - /** - * <pre> - * attributes of Build tag - * </pre> - * - * <code>optional string build_system_fingerprint = 31;</code> - */ - public boolean hasBuildSystemFingerprint() { - return ((bitField0_ & 0x00002000) == 0x00002000); - } - /** - * <pre> - * attributes of Build tag - * </pre> - * - * <code>optional string build_system_fingerprint = 31;</code> - */ - public java.lang.String getBuildSystemFingerprint() { - java.lang.Object ref = buildSystemFingerprint_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - buildSystemFingerprint_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <pre> - * attributes of Build tag - * </pre> - * - * <code>optional string build_system_fingerprint = 31;</code> - */ - public com.google.protobuf.ByteString - getBuildSystemFingerprintBytes() { - java.lang.Object ref = buildSystemFingerprint_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - buildSystemFingerprint_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <pre> - * attributes of Build tag - * </pre> - * - * <code>optional string build_system_fingerprint = 31;</code> - */ - public Builder setBuildSystemFingerprint( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00002000; - buildSystemFingerprint_ = value; - onChanged(); - return this; - } - /** - * <pre> - * attributes of Build tag - * </pre> - * - * <code>optional string build_system_fingerprint = 31;</code> - */ - public Builder clearBuildSystemFingerprint() { - bitField0_ = (bitField0_ & ~0x00002000); - buildSystemFingerprint_ = getDefaultInstance().getBuildSystemFingerprint(); - onChanged(); - return this; - } - /** - * <pre> - * attributes of Build tag - * </pre> - * - * <code>optional string build_system_fingerprint = 31;</code> - */ - public Builder setBuildSystemFingerprintBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00002000; - buildSystemFingerprint_ = value; - onChanged(); - return this; - } - - private java.lang.Object buildVendorFingerprint_ = ""; - /** - * <code>optional string build_vendor_fingerprint = 32;</code> - */ - public boolean hasBuildVendorFingerprint() { - return ((bitField0_ & 0x00004000) == 0x00004000); - } - /** - * <code>optional string build_vendor_fingerprint = 32;</code> - */ - public java.lang.String getBuildVendorFingerprint() { - java.lang.Object ref = buildVendorFingerprint_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - buildVendorFingerprint_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <code>optional string build_vendor_fingerprint = 32;</code> - */ - public com.google.protobuf.ByteString - getBuildVendorFingerprintBytes() { - java.lang.Object ref = buildVendorFingerprint_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - buildVendorFingerprint_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <code>optional string build_vendor_fingerprint = 32;</code> - */ - public Builder setBuildVendorFingerprint( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00004000; - buildVendorFingerprint_ = value; - onChanged(); - return this; - } - /** - * <code>optional string build_vendor_fingerprint = 32;</code> - */ - public Builder clearBuildVendorFingerprint() { - bitField0_ = (bitField0_ & ~0x00004000); - buildVendorFingerprint_ = getDefaultInstance().getBuildVendorFingerprint(); - onChanged(); - return this; - } - /** - * <code>optional string build_vendor_fingerprint = 32;</code> - */ - public Builder setBuildVendorFingerprintBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00004000; - buildVendorFingerprint_ = value; - onChanged(); - return this; - } - - private int testType_ ; - /** - * <code>optional int32 test_type = 33 [default = 0];</code> - */ - public boolean hasTestType() { - return ((bitField0_ & 0x00008000) == 0x00008000); - } - /** - * <code>optional int32 test_type = 33 [default = 0];</code> - */ - public int getTestType() { - return testType_; - } - /** - * <code>optional int32 test_type = 33 [default = 0];</code> - */ - public Builder setTestType(int value) { - bitField0_ |= 0x00008000; - testType_ = value; - onChanged(); - return this; - } - /** - * <code>optional int32 test_type = 33 [default = 0];</code> - */ - public Builder clearTestType() { - bitField0_ = (bitField0_ & ~0x00008000); - testType_ = 0; - onChanged(); - return this; - } - - private int passedTestCaseCount_ ; - /** - * <pre> - * attributes of Summary tag - * </pre> - * - * <code>optional int32 passed_test_case_count = 41;</code> - */ - public boolean hasPassedTestCaseCount() { - return ((bitField0_ & 0x00010000) == 0x00010000); - } - /** - * <pre> - * attributes of Summary tag - * </pre> - * - * <code>optional int32 passed_test_case_count = 41;</code> - */ - public int getPassedTestCaseCount() { - return passedTestCaseCount_; - } - /** - * <pre> - * attributes of Summary tag - * </pre> - * - * <code>optional int32 passed_test_case_count = 41;</code> - */ - public Builder setPassedTestCaseCount(int value) { - bitField0_ |= 0x00010000; - passedTestCaseCount_ = value; - onChanged(); - return this; - } - /** - * <pre> - * attributes of Summary tag - * </pre> - * - * <code>optional int32 passed_test_case_count = 41;</code> - */ - public Builder clearPassedTestCaseCount() { - bitField0_ = (bitField0_ & ~0x00010000); - passedTestCaseCount_ = 0; - onChanged(); - return this; - } - - private int failedTestCaseCount_ ; - /** - * <code>optional int32 failed_test_case_count = 42;</code> - */ - public boolean hasFailedTestCaseCount() { - return ((bitField0_ & 0x00020000) == 0x00020000); - } - /** - * <code>optional int32 failed_test_case_count = 42;</code> - */ - public int getFailedTestCaseCount() { - return failedTestCaseCount_; - } - /** - * <code>optional int32 failed_test_case_count = 42;</code> - */ - public Builder setFailedTestCaseCount(int value) { - bitField0_ |= 0x00020000; - failedTestCaseCount_ = value; - onChanged(); - return this; - } - /** - * <code>optional int32 failed_test_case_count = 42;</code> - */ - public Builder clearFailedTestCaseCount() { - bitField0_ = (bitField0_ & ~0x00020000); - failedTestCaseCount_ = 0; - onChanged(); - return this; - } - - private int modulesDone_ ; - /** - * <code>optional int32 modules_done = 43;</code> - */ - public boolean hasModulesDone() { - return ((bitField0_ & 0x00040000) == 0x00040000); - } - /** - * <code>optional int32 modules_done = 43;</code> - */ - public int getModulesDone() { - return modulesDone_; - } - /** - * <code>optional int32 modules_done = 43;</code> - */ - public Builder setModulesDone(int value) { - bitField0_ |= 0x00040000; - modulesDone_ = value; - onChanged(); - return this; - } - /** - * <code>optional int32 modules_done = 43;</code> - */ - public Builder clearModulesDone() { - bitField0_ = (bitField0_ & ~0x00040000); - modulesDone_ = 0; - onChanged(); - return this; - } - - private int modulesTotal_ ; - /** - * <code>optional int32 modules_total = 44;</code> - */ - public boolean hasModulesTotal() { - return ((bitField0_ & 0x00080000) == 0x00080000); - } - /** - * <code>optional int32 modules_total = 44;</code> - */ - public int getModulesTotal() { - return modulesTotal_; - } - /** - * <code>optional int32 modules_total = 44;</code> - */ - public Builder setModulesTotal(int value) { - bitField0_ |= 0x00080000; - modulesTotal_ = value; - onChanged(); - return this; - } - /** - * <code>optional int32 modules_total = 44;</code> - */ - public Builder clearModulesTotal() { - bitField0_ = (bitField0_ & ~0x00080000); - modulesTotal_ = 0; - onChanged(); - return this; - } - - private java.lang.Object infraLogPath_ = ""; - /** - * <pre> - * GCS path to the corresponding infra log file. - * </pre> - * - * <code>optional string infra_log_path = 51;</code> - */ - public boolean hasInfraLogPath() { - return ((bitField0_ & 0x00100000) == 0x00100000); - } - /** - * <pre> - * GCS path to the corresponding infra log file. - * </pre> - * - * <code>optional string infra_log_path = 51;</code> - */ - public java.lang.String getInfraLogPath() { - java.lang.Object ref = infraLogPath_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - infraLogPath_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <pre> - * GCS path to the corresponding infra log file. - * </pre> - * - * <code>optional string infra_log_path = 51;</code> - */ - public com.google.protobuf.ByteString - getInfraLogPathBytes() { - java.lang.Object ref = infraLogPath_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - infraLogPath_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <pre> - * GCS path to the corresponding infra log file. - * </pre> - * - * <code>optional string infra_log_path = 51;</code> - */ - public Builder setInfraLogPath( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00100000; - infraLogPath_ = value; - onChanged(); - return this; - } - /** - * <pre> - * GCS path to the corresponding infra log file. - * </pre> - * - * <code>optional string infra_log_path = 51;</code> - */ - public Builder clearInfraLogPath() { - bitField0_ = (bitField0_ & ~0x00100000); - infraLogPath_ = getDefaultInstance().getInfraLogPath(); - onChanged(); - return this; - } - /** - * <pre> - * GCS path to the corresponding infra log file. - * </pre> - * - * <code>optional string infra_log_path = 51;</code> - */ - public Builder setInfraLogPathBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00100000; - infraLogPath_ = value; - onChanged(); - return this; - } - - private com.google.protobuf.LazyStringList repackedImagePath_ = com.google.protobuf.LazyStringArrayList.EMPTY; - private void ensureRepackedImagePathIsMutable() { - if (!((bitField0_ & 0x00200000) == 0x00200000)) { - repackedImagePath_ = new com.google.protobuf.LazyStringArrayList(repackedImagePath_); - bitField0_ |= 0x00200000; - } - } - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - public com.google.protobuf.ProtocolStringList - getRepackedImagePathList() { - return repackedImagePath_.getUnmodifiableView(); - } - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - public int getRepackedImagePathCount() { - return repackedImagePath_.size(); - } - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - public java.lang.String getRepackedImagePath(int index) { - return repackedImagePath_.get(index); - } - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - public com.google.protobuf.ByteString - getRepackedImagePathBytes(int index) { - return repackedImagePath_.getByteString(index); - } - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - public Builder setRepackedImagePath( - int index, java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureRepackedImagePathIsMutable(); - repackedImagePath_.set(index, value); - onChanged(); - return this; - } - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - public Builder addRepackedImagePath( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureRepackedImagePathIsMutable(); - repackedImagePath_.add(value); - onChanged(); - return this; - } - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - public Builder addAllRepackedImagePath( - java.lang.Iterable<java.lang.String> values) { - ensureRepackedImagePathIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, repackedImagePath_); - onChanged(); - return this; - } - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - public Builder clearRepackedImagePath() { - repackedImagePath_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00200000); - onChanged(); - return this; - } - /** - * <pre> - * GCS path to the repacked device[+GSI] image set. - * </pre> - * - * <code>repeated string repacked_image_path = 52;</code> - */ - public Builder addRepackedImagePathBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureRepackedImagePathIsMutable(); - repackedImagePath_.add(value); - onChanged(); - return this; - } - - private java.lang.Object vendorBuildId_ = ""; - /** - * <pre> - * Fetch info used to fetch and flash certain builds for retry_prompt command. - * </pre> - * - * <code>optional string vendor_build_id = 61;</code> - */ - public boolean hasVendorBuildId() { - return ((bitField0_ & 0x00400000) == 0x00400000); - } - /** - * <pre> - * Fetch info used to fetch and flash certain builds for retry_prompt command. - * </pre> - * - * <code>optional string vendor_build_id = 61;</code> - */ - public java.lang.String getVendorBuildId() { - java.lang.Object ref = vendorBuildId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - vendorBuildId_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <pre> - * Fetch info used to fetch and flash certain builds for retry_prompt command. - * </pre> - * - * <code>optional string vendor_build_id = 61;</code> - */ - public com.google.protobuf.ByteString - getVendorBuildIdBytes() { - java.lang.Object ref = vendorBuildId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - vendorBuildId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <pre> - * Fetch info used to fetch and flash certain builds for retry_prompt command. - * </pre> - * - * <code>optional string vendor_build_id = 61;</code> - */ - public Builder setVendorBuildId( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00400000; - vendorBuildId_ = value; - onChanged(); - return this; - } - /** - * <pre> - * Fetch info used to fetch and flash certain builds for retry_prompt command. - * </pre> - * - * <code>optional string vendor_build_id = 61;</code> - */ - public Builder clearVendorBuildId() { - bitField0_ = (bitField0_ & ~0x00400000); - vendorBuildId_ = getDefaultInstance().getVendorBuildId(); - onChanged(); - return this; - } - /** - * <pre> - * Fetch info used to fetch and flash certain builds for retry_prompt command. - * </pre> - * - * <code>optional string vendor_build_id = 61;</code> - */ - public Builder setVendorBuildIdBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00400000; - vendorBuildId_ = value; - onChanged(); - return this; - } - - private java.lang.Object gsiBuildId_ = ""; - /** - * <code>optional string gsi_build_id = 62;</code> - */ - public boolean hasGsiBuildId() { - return ((bitField0_ & 0x00800000) == 0x00800000); - } - /** - * <code>optional string gsi_build_id = 62;</code> - */ - public java.lang.String getGsiBuildId() { - java.lang.Object ref = gsiBuildId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - gsiBuildId_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <code>optional string gsi_build_id = 62;</code> - */ - public com.google.protobuf.ByteString - getGsiBuildIdBytes() { - java.lang.Object ref = gsiBuildId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - gsiBuildId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <code>optional string gsi_build_id = 62;</code> - */ - public Builder setGsiBuildId( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00800000; - gsiBuildId_ = value; - onChanged(); - return this; - } - /** - * <code>optional string gsi_build_id = 62;</code> - */ - public Builder clearGsiBuildId() { - bitField0_ = (bitField0_ & ~0x00800000); - gsiBuildId_ = getDefaultInstance().getGsiBuildId(); - onChanged(); - return this; - } - /** - * <code>optional string gsi_build_id = 62;</code> - */ - public Builder setGsiBuildIdBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00800000; - gsiBuildId_ = value; - onChanged(); - return this; - } - - private com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage scheduleConfig_ = null; - private com.google.protobuf.SingleFieldBuilderV3< - com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage, com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage.Builder, com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessageOrBuilder> scheduleConfigBuilder_; - /** - * <code>optional .android.test.lab.ScheduleConfigMessage schedule_config = 63 [deprecated = true];</code> - */ - @java.lang.Deprecated public boolean hasScheduleConfig() { - return ((bitField0_ & 0x01000000) == 0x01000000); - } - /** - * <code>optional .android.test.lab.ScheduleConfigMessage schedule_config = 63 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage getScheduleConfig() { - if (scheduleConfigBuilder_ == null) { - return scheduleConfig_ == null ? com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage.getDefaultInstance() : scheduleConfig_; - } else { - return scheduleConfigBuilder_.getMessage(); - } - } - /** - * <code>optional .android.test.lab.ScheduleConfigMessage schedule_config = 63 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder setScheduleConfig(com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage value) { - if (scheduleConfigBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - scheduleConfig_ = value; - onChanged(); - } else { - scheduleConfigBuilder_.setMessage(value); - } - bitField0_ |= 0x01000000; - return this; - } - /** - * <code>optional .android.test.lab.ScheduleConfigMessage schedule_config = 63 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder setScheduleConfig( - com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage.Builder builderForValue) { - if (scheduleConfigBuilder_ == null) { - scheduleConfig_ = builderForValue.build(); - onChanged(); - } else { - scheduleConfigBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x01000000; - return this; - } - /** - * <code>optional .android.test.lab.ScheduleConfigMessage schedule_config = 63 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder mergeScheduleConfig(com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage value) { - if (scheduleConfigBuilder_ == null) { - if (((bitField0_ & 0x01000000) == 0x01000000) && - scheduleConfig_ != null && - scheduleConfig_ != com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage.getDefaultInstance()) { - scheduleConfig_ = - com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage.newBuilder(scheduleConfig_).mergeFrom(value).buildPartial(); - } else { - scheduleConfig_ = value; - } - onChanged(); - } else { - scheduleConfigBuilder_.mergeFrom(value); - } - bitField0_ |= 0x01000000; - return this; - } - /** - * <code>optional .android.test.lab.ScheduleConfigMessage schedule_config = 63 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder clearScheduleConfig() { - if (scheduleConfigBuilder_ == null) { - scheduleConfig_ = null; - onChanged(); - } else { - scheduleConfigBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x01000000); - return this; - } - /** - * <code>optional .android.test.lab.ScheduleConfigMessage schedule_config = 63 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage.Builder getScheduleConfigBuilder() { - bitField0_ |= 0x01000000; - onChanged(); - return getScheduleConfigFieldBuilder().getBuilder(); - } - /** - * <code>optional .android.test.lab.ScheduleConfigMessage schedule_config = 63 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessageOrBuilder getScheduleConfigOrBuilder() { - if (scheduleConfigBuilder_ != null) { - return scheduleConfigBuilder_.getMessageOrBuilder(); - } else { - return scheduleConfig_ == null ? - com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage.getDefaultInstance() : scheduleConfig_; - } - } - /** - * <code>optional .android.test.lab.ScheduleConfigMessage schedule_config = 63 [deprecated = true];</code> - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage, com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage.Builder, com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessageOrBuilder> - getScheduleConfigFieldBuilder() { - if (scheduleConfigBuilder_ == null) { - scheduleConfigBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage, com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessage.Builder, com.android.vts.proto.TestScheduleConfigMessageOuterClass.ScheduleConfigMessageOrBuilder>( - getScheduleConfig(), - getParentForChildren(), - isClean()); - scheduleConfig_ = null; - } - return scheduleConfigBuilder_; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:android.vts.TestSuiteResultMessage) - } - - // @@protoc_insertion_point(class_scope:android.vts.TestSuiteResultMessage) - private static final com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage(); - } - - public static com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - @java.lang.Deprecated public static final com.google.protobuf.Parser<TestSuiteResultMessage> - PARSER = new com.google.protobuf.AbstractParser<TestSuiteResultMessage>() { - public TestSuiteResultMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new TestSuiteResultMessage(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser<TestSuiteResultMessage> parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser<TestSuiteResultMessage> getParserForType() { - return PARSER; - } - - public com.android.vts.proto.TestSuiteResultMessageProto.TestSuiteResultMessage getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_android_vts_TestSuiteResultMessage_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_android_vts_TestSuiteResultMessage_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n\034TestSuiteResultMessage.proto\022\013android." + - "vts\032\037TestScheduleConfigMessage.proto\"\226\005\n" + - "\026TestSuiteResultMessage\022\024\n\014access_token\030" + - "\001 \001(\t\022\023\n\013result_path\030\002 \001(\t\022\032\n\014boot_succe" + - "ss\030\003 \001(\010:\004true\022\016\n\006branch\030\013 \002(\t\022\016\n\006target" + - "\030\014 \002(\t\022\020\n\010build_id\030\r \002(\t\022\022\n\nsuite_plan\030\025" + - " \001(\t\022\025\n\rsuite_version\030\026 \001(\t\022\032\n\022suite_bui" + - "ld_number\030\027 \001(\t\022\022\n\nstart_time\030\030 \001(\003\022\020\n\010e" + - "nd_time\030\031 \001(\003\022\021\n\thost_name\030\032 \001(\t\022\022\n\nsuit" + - "e_name\030\033 \001(\t\022 \n\030build_system_fingerprint", - "\030\037 \001(\t\022 \n\030build_vendor_fingerprint\030 \001(\t" + - "\022\024\n\ttest_type\030! \001(\005:\0010\022\036\n\026passed_test_ca" + - "se_count\030) \001(\005\022\036\n\026failed_test_case_count" + - "\030* \001(\005\022\024\n\014modules_done\030+ \001(\005\022\025\n\rmodules_" + - "total\030, \001(\005\022\026\n\016infra_log_path\0303 \001(\t\022\033\n\023r" + - "epacked_image_path\0304 \003(\t\022\027\n\017vendor_build" + - "_id\030= \001(\t\022\024\n\014gsi_build_id\030> \001(\t\022D\n\017sched" + - "ule_config\030? \001(\0132\'.android.test.lab.Sche" + - "duleConfigMessageB\002\030\001B6\n\025com.android.vts" + - ".protoB\033TestSuiteResultMessageProtoP\000" - }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - com.android.vts.proto.TestScheduleConfigMessageOuterClass.getDescriptor(), - }, assigner); - internal_static_android_vts_TestSuiteResultMessage_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_android_vts_TestSuiteResultMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_android_vts_TestSuiteResultMessage_descriptor, - new java.lang.String[] { "AccessToken", "ResultPath", "BootSuccess", "Branch", "Target", "BuildId", "SuitePlan", "SuiteVersion", "SuiteBuildNumber", "StartTime", "EndTime", "HostName", "SuiteName", "BuildSystemFingerprint", "BuildVendorFingerprint", "TestType", "PassedTestCaseCount", "FailedTestCaseCount", "ModulesDone", "ModulesTotal", "InfraLogPath", "RepackedImagePath", "VendorBuildId", "GsiBuildId", "ScheduleConfig", }); - com.android.vts.proto.TestScheduleConfigMessageOuterClass.getDescriptor(); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/src/main/java/com/android/vts/proto/VtsReportMessage.java b/src/main/java/com/android/vts/proto/VtsReportMessage.java deleted file mode 100644 index 84ed9b6..0000000 --- a/src/main/java/com/android/vts/proto/VtsReportMessage.java +++ /dev/null @@ -1,23382 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: proto/VtsReportMessage.proto - -package com.android.vts.proto; - -public final class VtsReportMessage { - private VtsReportMessage() {} - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistryLite registry) { - } - - public static void registerAllExtensions( - com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions( - (com.google.protobuf.ExtensionRegistryLite) registry); - } - /** - * <pre> - * To specify test case execution result. - * </pre> - * - * Protobuf enum {@code android.vts.TestCaseResult} - */ - public enum TestCaseResult - implements com.google.protobuf.ProtocolMessageEnum { - /** - * <code>UNKNOWN_RESULT = 0;</code> - */ - UNKNOWN_RESULT(0), - /** - * <code>TEST_CASE_RESULT_PASS = 1;</code> - */ - TEST_CASE_RESULT_PASS(1), - /** - * <code>TEST_CASE_RESULT_FAIL = 2;</code> - */ - TEST_CASE_RESULT_FAIL(2), - /** - * <code>TEST_CASE_RESULT_SKIP = 3;</code> - */ - TEST_CASE_RESULT_SKIP(3), - /** - * <code>TEST_CASE_RESULT_EXCEPTION = 4;</code> - */ - TEST_CASE_RESULT_EXCEPTION(4), - /** - * <code>TEST_CASE_RESULT_TIMEOUT = 5;</code> - */ - TEST_CASE_RESULT_TIMEOUT(5), - ; - - /** - * <code>UNKNOWN_RESULT = 0;</code> - */ - public static final int UNKNOWN_RESULT_VALUE = 0; - /** - * <code>TEST_CASE_RESULT_PASS = 1;</code> - */ - public static final int TEST_CASE_RESULT_PASS_VALUE = 1; - /** - * <code>TEST_CASE_RESULT_FAIL = 2;</code> - */ - public static final int TEST_CASE_RESULT_FAIL_VALUE = 2; - /** - * <code>TEST_CASE_RESULT_SKIP = 3;</code> - */ - public static final int TEST_CASE_RESULT_SKIP_VALUE = 3; - /** - * <code>TEST_CASE_RESULT_EXCEPTION = 4;</code> - */ - public static final int TEST_CASE_RESULT_EXCEPTION_VALUE = 4; - /** - * <code>TEST_CASE_RESULT_TIMEOUT = 5;</code> - */ - public static final int TEST_CASE_RESULT_TIMEOUT_VALUE = 5; - - - public final int getNumber() { - return value; - } - - /** - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static TestCaseResult valueOf(int value) { - return forNumber(value); - } - - public static TestCaseResult forNumber(int value) { - switch (value) { - case 0: return UNKNOWN_RESULT; - case 1: return TEST_CASE_RESULT_PASS; - case 2: return TEST_CASE_RESULT_FAIL; - case 3: return TEST_CASE_RESULT_SKIP; - case 4: return TEST_CASE_RESULT_EXCEPTION; - case 5: return TEST_CASE_RESULT_TIMEOUT; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap<TestCaseResult> - internalGetValueMap() { - return internalValueMap; - } - private static final com.google.protobuf.Internal.EnumLiteMap< - TestCaseResult> internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap<TestCaseResult>() { - public TestCaseResult findValueByNumber(int number) { - return TestCaseResult.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(ordinal()); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.getDescriptor().getEnumTypes().get(0); - } - - private static final TestCaseResult[] VALUES = values(); - - public static TestCaseResult valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private TestCaseResult(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:android.vts.TestCaseResult) - } - - /** - * <pre> - * To specify the VTS test type. - * </pre> - * - * Protobuf enum {@code android.vts.VtsTestType} - */ - public enum VtsTestType - implements com.google.protobuf.ProtocolMessageEnum { - /** - * <code>UNKNOWN_VTS_TESTTYPE = 0;</code> - */ - UNKNOWN_VTS_TESTTYPE(0), - /** - * <code>VTS_HOST_DRIVEN_STRUCTURAL = 1;</code> - */ - VTS_HOST_DRIVEN_STRUCTURAL(1), - /** - * <code>VTS_HOST_DRIVEN_FUZZING = 2;</code> - */ - VTS_HOST_DRIVEN_FUZZING(2), - /** - * <code>VTS_TARGET_SIDE_GTEST = 3;</code> - */ - VTS_TARGET_SIDE_GTEST(3), - /** - * <code>VTS_TARGET_SIDE_FUZZING = 4;</code> - */ - VTS_TARGET_SIDE_FUZZING(4), - ; - - /** - * <code>UNKNOWN_VTS_TESTTYPE = 0;</code> - */ - public static final int UNKNOWN_VTS_TESTTYPE_VALUE = 0; - /** - * <code>VTS_HOST_DRIVEN_STRUCTURAL = 1;</code> - */ - public static final int VTS_HOST_DRIVEN_STRUCTURAL_VALUE = 1; - /** - * <code>VTS_HOST_DRIVEN_FUZZING = 2;</code> - */ - public static final int VTS_HOST_DRIVEN_FUZZING_VALUE = 2; - /** - * <code>VTS_TARGET_SIDE_GTEST = 3;</code> - */ - public static final int VTS_TARGET_SIDE_GTEST_VALUE = 3; - /** - * <code>VTS_TARGET_SIDE_FUZZING = 4;</code> - */ - public static final int VTS_TARGET_SIDE_FUZZING_VALUE = 4; - - - public final int getNumber() { - return value; - } - - /** - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static VtsTestType valueOf(int value) { - return forNumber(value); - } - - public static VtsTestType forNumber(int value) { - switch (value) { - case 0: return UNKNOWN_VTS_TESTTYPE; - case 1: return VTS_HOST_DRIVEN_STRUCTURAL; - case 2: return VTS_HOST_DRIVEN_FUZZING; - case 3: return VTS_TARGET_SIDE_GTEST; - case 4: return VTS_TARGET_SIDE_FUZZING; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap<VtsTestType> - internalGetValueMap() { - return internalValueMap; - } - private static final com.google.protobuf.Internal.EnumLiteMap< - VtsTestType> internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap<VtsTestType>() { - public VtsTestType findValueByNumber(int number) { - return VtsTestType.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(ordinal()); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.getDescriptor().getEnumTypes().get(1); - } - - private static final VtsTestType[] VALUES = values(); - - public static VtsTestType valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private VtsTestType(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:android.vts.VtsTestType) - } - - /** - * Protobuf enum {@code android.vts.VtsProfilingRegressionMode} - */ - public enum VtsProfilingRegressionMode - implements com.google.protobuf.ProtocolMessageEnum { - /** - * <code>UNKNOWN_REGRESSION_MODE = 0;</code> - */ - UNKNOWN_REGRESSION_MODE(0), - /** - * <pre> - * disable analysis - * </pre> - * - * <code>VTS_REGRESSION_MODE_DISABLED = 1;</code> - */ - VTS_REGRESSION_MODE_DISABLED(1), - /** - * <pre> - * interpret increases in values as regression - * </pre> - * - * <code>VTS_REGRESSION_MODE_INCREASING = 2;</code> - */ - VTS_REGRESSION_MODE_INCREASING(2), - /** - * <pre> - * interpret decreases in values as regression - * </pre> - * - * <code>VTS_REGRESSION_MODE_DECREASING = 3;</code> - */ - VTS_REGRESSION_MODE_DECREASING(3), - ; - - /** - * <code>UNKNOWN_REGRESSION_MODE = 0;</code> - */ - public static final int UNKNOWN_REGRESSION_MODE_VALUE = 0; - /** - * <pre> - * disable analysis - * </pre> - * - * <code>VTS_REGRESSION_MODE_DISABLED = 1;</code> - */ - public static final int VTS_REGRESSION_MODE_DISABLED_VALUE = 1; - /** - * <pre> - * interpret increases in values as regression - * </pre> - * - * <code>VTS_REGRESSION_MODE_INCREASING = 2;</code> - */ - public static final int VTS_REGRESSION_MODE_INCREASING_VALUE = 2; - /** - * <pre> - * interpret decreases in values as regression - * </pre> - * - * <code>VTS_REGRESSION_MODE_DECREASING = 3;</code> - */ - public static final int VTS_REGRESSION_MODE_DECREASING_VALUE = 3; - - - public final int getNumber() { - return value; - } - - /** - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static VtsProfilingRegressionMode valueOf(int value) { - return forNumber(value); - } - - public static VtsProfilingRegressionMode forNumber(int value) { - switch (value) { - case 0: return UNKNOWN_REGRESSION_MODE; - case 1: return VTS_REGRESSION_MODE_DISABLED; - case 2: return VTS_REGRESSION_MODE_INCREASING; - case 3: return VTS_REGRESSION_MODE_DECREASING; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap<VtsProfilingRegressionMode> - internalGetValueMap() { - return internalValueMap; - } - private static final com.google.protobuf.Internal.EnumLiteMap< - VtsProfilingRegressionMode> internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap<VtsProfilingRegressionMode>() { - public VtsProfilingRegressionMode findValueByNumber(int number) { - return VtsProfilingRegressionMode.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(ordinal()); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.getDescriptor().getEnumTypes().get(2); - } - - private static final VtsProfilingRegressionMode[] VALUES = values(); - - public static VtsProfilingRegressionMode valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private VtsProfilingRegressionMode(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:android.vts.VtsProfilingRegressionMode) - } - - /** - * Protobuf enum {@code android.vts.VtsProfilingType} - */ - public enum VtsProfilingType - implements com.google.protobuf.ProtocolMessageEnum { - /** - * <code>UNKNOWN_VTS_PROFILING_TYPE = 0;</code> - */ - UNKNOWN_VTS_PROFILING_TYPE(0), - /** - * <pre> - * for one sample which measures the time between two profiling points. - * </pre> - * - * <code>VTS_PROFILING_TYPE_TIMESTAMP = 1;</code> - */ - VTS_PROFILING_TYPE_TIMESTAMP(1), - /** - * <pre> - * for multiple single-type samples with labels. - * </pre> - * - * <code>VTS_PROFILING_TYPE_LABELED_VECTOR = 2;</code> - */ - VTS_PROFILING_TYPE_LABELED_VECTOR(2), - /** - * <pre> - * for multiple single-type samples without labels. - * </pre> - * - * <code>VTS_PROFILING_TYPE_UNLABELED_VECTOR = 3;</code> - */ - VTS_PROFILING_TYPE_UNLABELED_VECTOR(3), - ; - - /** - * <code>UNKNOWN_VTS_PROFILING_TYPE = 0;</code> - */ - public static final int UNKNOWN_VTS_PROFILING_TYPE_VALUE = 0; - /** - * <pre> - * for one sample which measures the time between two profiling points. - * </pre> - * - * <code>VTS_PROFILING_TYPE_TIMESTAMP = 1;</code> - */ - public static final int VTS_PROFILING_TYPE_TIMESTAMP_VALUE = 1; - /** - * <pre> - * for multiple single-type samples with labels. - * </pre> - * - * <code>VTS_PROFILING_TYPE_LABELED_VECTOR = 2;</code> - */ - public static final int VTS_PROFILING_TYPE_LABELED_VECTOR_VALUE = 2; - /** - * <pre> - * for multiple single-type samples without labels. - * </pre> - * - * <code>VTS_PROFILING_TYPE_UNLABELED_VECTOR = 3;</code> - */ - public static final int VTS_PROFILING_TYPE_UNLABELED_VECTOR_VALUE = 3; - - - public final int getNumber() { - return value; - } - - /** - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static VtsProfilingType valueOf(int value) { - return forNumber(value); - } - - public static VtsProfilingType forNumber(int value) { - switch (value) { - case 0: return UNKNOWN_VTS_PROFILING_TYPE; - case 1: return VTS_PROFILING_TYPE_TIMESTAMP; - case 2: return VTS_PROFILING_TYPE_LABELED_VECTOR; - case 3: return VTS_PROFILING_TYPE_UNLABELED_VECTOR; - default: return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap<VtsProfilingType> - internalGetValueMap() { - return internalValueMap; - } - private static final com.google.protobuf.Internal.EnumLiteMap< - VtsProfilingType> internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap<VtsProfilingType>() { - public VtsProfilingType findValueByNumber(int number) { - return VtsProfilingType.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor - getValueDescriptor() { - return getDescriptor().getValues().get(ordinal()); - } - public final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptorForType() { - return getDescriptor(); - } - public static final com.google.protobuf.Descriptors.EnumDescriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.getDescriptor().getEnumTypes().get(3); - } - - private static final VtsProfilingType[] VALUES = values(); - - public static VtsProfilingType valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException( - "EnumValueDescriptor is not for this type."); - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private VtsProfilingType(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:android.vts.VtsProfilingType) - } - - public interface AndroidDeviceInfoMessageOrBuilder extends - // @@protoc_insertion_point(interface_extends:android.vts.AndroidDeviceInfoMessage) - com.google.protobuf.MessageOrBuilder { - - /** - * <pre> - * product type (e.g., bullhead). - * </pre> - * - * <code>optional bytes product_type = 1;</code> - */ - boolean hasProductType(); - /** - * <pre> - * product type (e.g., bullhead). - * </pre> - * - * <code>optional bytes product_type = 1;</code> - */ - com.google.protobuf.ByteString getProductType(); - - /** - * <pre> - * product type variant (e.g., still bullhead or another name). - * </pre> - * - * <code>optional bytes product_variant = 2;</code> - */ - boolean hasProductVariant(); - /** - * <pre> - * product type variant (e.g., still bullhead or another name). - * </pre> - * - * <code>optional bytes product_variant = 2;</code> - */ - com.google.protobuf.ByteString getProductVariant(); - - /** - * <pre> - * build type (e.g., userdebug). - * </pre> - * - * <code>optional bytes build_flavor = 11;</code> - */ - boolean hasBuildFlavor(); - /** - * <pre> - * build type (e.g., userdebug). - * </pre> - * - * <code>optional bytes build_flavor = 11;</code> - */ - com.google.protobuf.ByteString getBuildFlavor(); - - /** - * <pre> - * Android Build ID. - * </pre> - * - * <code>optional bytes build_id = 12;</code> - */ - boolean hasBuildId(); - /** - * <pre> - * Android Build ID. - * </pre> - * - * <code>optional bytes build_id = 12;</code> - */ - com.google.protobuf.ByteString getBuildId(); - - /** - * <pre> - * branch name (e.g., master or nyc-dev). - * </pre> - * - * <code>optional bytes branch = 21;</code> - */ - boolean hasBranch(); - /** - * <pre> - * branch name (e.g., master or nyc-dev). - * </pre> - * - * <code>optional bytes branch = 21;</code> - */ - com.google.protobuf.ByteString getBranch(); - - /** - * <pre> - * build alias implies the branch name. - * </pre> - * - * <code>optional bytes build_alias = 22;</code> - */ - boolean hasBuildAlias(); - /** - * <pre> - * build alias implies the branch name. - * </pre> - * - * <code>optional bytes build_alias = 22;</code> - */ - com.google.protobuf.ByteString getBuildAlias(); - - /** - * <pre> - * API level - * </pre> - * - * <code>optional bytes api_level = 31;</code> - */ - boolean hasApiLevel(); - /** - * <pre> - * API level - * </pre> - * - * <code>optional bytes api_level = 31;</code> - */ - com.google.protobuf.ByteString getApiLevel(); - - /** - * <pre> - * ABI name that is current in use for the test - * </pre> - * - * <code>optional bytes abi_name = 51;</code> - */ - boolean hasAbiName(); - /** - * <pre> - * ABI name that is current in use for the test - * </pre> - * - * <code>optional bytes abi_name = 51;</code> - */ - com.google.protobuf.ByteString getAbiName(); - - /** - * <pre> - * ABI bitness that is current in use for the test. Example: '32', '64', - * </pre> - * - * <code>optional bytes abi_bitness = 52;</code> - */ - boolean hasAbiBitness(); - /** - * <pre> - * ABI bitness that is current in use for the test. Example: '32', '64', - * </pre> - * - * <code>optional bytes abi_bitness = 52;</code> - */ - com.google.protobuf.ByteString getAbiBitness(); - - /** - * <pre> - * Device USB serial number - * </pre> - * - * <code>optional bytes serial = 101;</code> - */ - boolean hasSerial(); - /** - * <pre> - * Device USB serial number - * </pre> - * - * <code>optional bytes serial = 101;</code> - */ - com.google.protobuf.ByteString getSerial(); - } - /** - * <pre> - * To specify a call flow event. - * </pre> - * - * Protobuf type {@code android.vts.AndroidDeviceInfoMessage} - */ - public static final class AndroidDeviceInfoMessage extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:android.vts.AndroidDeviceInfoMessage) - AndroidDeviceInfoMessageOrBuilder { - // Use AndroidDeviceInfoMessage.newBuilder() to construct. - private AndroidDeviceInfoMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { - super(builder); - } - private AndroidDeviceInfoMessage() { - productType_ = com.google.protobuf.ByteString.EMPTY; - productVariant_ = com.google.protobuf.ByteString.EMPTY; - buildFlavor_ = com.google.protobuf.ByteString.EMPTY; - buildId_ = com.google.protobuf.ByteString.EMPTY; - branch_ = com.google.protobuf.ByteString.EMPTY; - buildAlias_ = com.google.protobuf.ByteString.EMPTY; - apiLevel_ = com.google.protobuf.ByteString.EMPTY; - abiName_ = com.google.protobuf.ByteString.EMPTY; - abiBitness_ = com.google.protobuf.ByteString.EMPTY; - serial_ = com.google.protobuf.ByteString.EMPTY; - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private AndroidDeviceInfoMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - productType_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - productVariant_ = input.readBytes(); - break; - } - case 90: { - bitField0_ |= 0x00000004; - buildFlavor_ = input.readBytes(); - break; - } - case 98: { - bitField0_ |= 0x00000008; - buildId_ = input.readBytes(); - break; - } - case 170: { - bitField0_ |= 0x00000010; - branch_ = input.readBytes(); - break; - } - case 178: { - bitField0_ |= 0x00000020; - buildAlias_ = input.readBytes(); - break; - } - case 250: { - bitField0_ |= 0x00000040; - apiLevel_ = input.readBytes(); - break; - } - case 410: { - bitField0_ |= 0x00000080; - abiName_ = input.readBytes(); - break; - } - case 418: { - bitField0_ |= 0x00000100; - abiBitness_ = input.readBytes(); - break; - } - case 810: { - bitField0_ |= 0x00000200; - serial_ = input.readBytes(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_AndroidDeviceInfoMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_AndroidDeviceInfoMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.class, com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.Builder.class); - } - - private int bitField0_; - public static final int PRODUCT_TYPE_FIELD_NUMBER = 1; - private com.google.protobuf.ByteString productType_; - /** - * <pre> - * product type (e.g., bullhead). - * </pre> - * - * <code>optional bytes product_type = 1;</code> - */ - public boolean hasProductType() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * product type (e.g., bullhead). - * </pre> - * - * <code>optional bytes product_type = 1;</code> - */ - public com.google.protobuf.ByteString getProductType() { - return productType_; - } - - public static final int PRODUCT_VARIANT_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString productVariant_; - /** - * <pre> - * product type variant (e.g., still bullhead or another name). - * </pre> - * - * <code>optional bytes product_variant = 2;</code> - */ - public boolean hasProductVariant() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * product type variant (e.g., still bullhead or another name). - * </pre> - * - * <code>optional bytes product_variant = 2;</code> - */ - public com.google.protobuf.ByteString getProductVariant() { - return productVariant_; - } - - public static final int BUILD_FLAVOR_FIELD_NUMBER = 11; - private com.google.protobuf.ByteString buildFlavor_; - /** - * <pre> - * build type (e.g., userdebug). - * </pre> - * - * <code>optional bytes build_flavor = 11;</code> - */ - public boolean hasBuildFlavor() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * build type (e.g., userdebug). - * </pre> - * - * <code>optional bytes build_flavor = 11;</code> - */ - public com.google.protobuf.ByteString getBuildFlavor() { - return buildFlavor_; - } - - public static final int BUILD_ID_FIELD_NUMBER = 12; - private com.google.protobuf.ByteString buildId_; - /** - * <pre> - * Android Build ID. - * </pre> - * - * <code>optional bytes build_id = 12;</code> - */ - public boolean hasBuildId() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <pre> - * Android Build ID. - * </pre> - * - * <code>optional bytes build_id = 12;</code> - */ - public com.google.protobuf.ByteString getBuildId() { - return buildId_; - } - - public static final int BRANCH_FIELD_NUMBER = 21; - private com.google.protobuf.ByteString branch_; - /** - * <pre> - * branch name (e.g., master or nyc-dev). - * </pre> - * - * <code>optional bytes branch = 21;</code> - */ - public boolean hasBranch() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <pre> - * branch name (e.g., master or nyc-dev). - * </pre> - * - * <code>optional bytes branch = 21;</code> - */ - public com.google.protobuf.ByteString getBranch() { - return branch_; - } - - public static final int BUILD_ALIAS_FIELD_NUMBER = 22; - private com.google.protobuf.ByteString buildAlias_; - /** - * <pre> - * build alias implies the branch name. - * </pre> - * - * <code>optional bytes build_alias = 22;</code> - */ - public boolean hasBuildAlias() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - /** - * <pre> - * build alias implies the branch name. - * </pre> - * - * <code>optional bytes build_alias = 22;</code> - */ - public com.google.protobuf.ByteString getBuildAlias() { - return buildAlias_; - } - - public static final int API_LEVEL_FIELD_NUMBER = 31; - private com.google.protobuf.ByteString apiLevel_; - /** - * <pre> - * API level - * </pre> - * - * <code>optional bytes api_level = 31;</code> - */ - public boolean hasApiLevel() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - /** - * <pre> - * API level - * </pre> - * - * <code>optional bytes api_level = 31;</code> - */ - public com.google.protobuf.ByteString getApiLevel() { - return apiLevel_; - } - - public static final int ABI_NAME_FIELD_NUMBER = 51; - private com.google.protobuf.ByteString abiName_; - /** - * <pre> - * ABI name that is current in use for the test - * </pre> - * - * <code>optional bytes abi_name = 51;</code> - */ - public boolean hasAbiName() { - return ((bitField0_ & 0x00000080) == 0x00000080); - } - /** - * <pre> - * ABI name that is current in use for the test - * </pre> - * - * <code>optional bytes abi_name = 51;</code> - */ - public com.google.protobuf.ByteString getAbiName() { - return abiName_; - } - - public static final int ABI_BITNESS_FIELD_NUMBER = 52; - private com.google.protobuf.ByteString abiBitness_; - /** - * <pre> - * ABI bitness that is current in use for the test. Example: '32', '64', - * </pre> - * - * <code>optional bytes abi_bitness = 52;</code> - */ - public boolean hasAbiBitness() { - return ((bitField0_ & 0x00000100) == 0x00000100); - } - /** - * <pre> - * ABI bitness that is current in use for the test. Example: '32', '64', - * </pre> - * - * <code>optional bytes abi_bitness = 52;</code> - */ - public com.google.protobuf.ByteString getAbiBitness() { - return abiBitness_; - } - - public static final int SERIAL_FIELD_NUMBER = 101; - private com.google.protobuf.ByteString serial_; - /** - * <pre> - * Device USB serial number - * </pre> - * - * <code>optional bytes serial = 101;</code> - */ - public boolean hasSerial() { - return ((bitField0_ & 0x00000200) == 0x00000200); - } - /** - * <pre> - * Device USB serial number - * </pre> - * - * <code>optional bytes serial = 101;</code> - */ - public com.google.protobuf.ByteString getSerial() { - return serial_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, productType_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, productVariant_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(11, buildFlavor_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBytes(12, buildId_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeBytes(21, branch_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - output.writeBytes(22, buildAlias_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - output.writeBytes(31, apiLevel_); - } - if (((bitField0_ & 0x00000080) == 0x00000080)) { - output.writeBytes(51, abiName_); - } - if (((bitField0_ & 0x00000100) == 0x00000100)) { - output.writeBytes(52, abiBitness_); - } - if (((bitField0_ & 0x00000200) == 0x00000200)) { - output.writeBytes(101, serial_); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, productType_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, productVariant_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(11, buildFlavor_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(12, buildId_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(21, branch_); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(22, buildAlias_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(31, apiLevel_); - } - if (((bitField0_ & 0x00000080) == 0x00000080)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(51, abiName_); - } - if (((bitField0_ & 0x00000100) == 0x00000100)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(52, abiBitness_); - } - if (((bitField0_ & 0x00000200) == 0x00000200)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(101, serial_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage)) { - return super.equals(obj); - } - com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage other = (com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage) obj; - - boolean result = true; - result = result && (hasProductType() == other.hasProductType()); - if (hasProductType()) { - result = result && getProductType() - .equals(other.getProductType()); - } - result = result && (hasProductVariant() == other.hasProductVariant()); - if (hasProductVariant()) { - result = result && getProductVariant() - .equals(other.getProductVariant()); - } - result = result && (hasBuildFlavor() == other.hasBuildFlavor()); - if (hasBuildFlavor()) { - result = result && getBuildFlavor() - .equals(other.getBuildFlavor()); - } - result = result && (hasBuildId() == other.hasBuildId()); - if (hasBuildId()) { - result = result && getBuildId() - .equals(other.getBuildId()); - } - result = result && (hasBranch() == other.hasBranch()); - if (hasBranch()) { - result = result && getBranch() - .equals(other.getBranch()); - } - result = result && (hasBuildAlias() == other.hasBuildAlias()); - if (hasBuildAlias()) { - result = result && getBuildAlias() - .equals(other.getBuildAlias()); - } - result = result && (hasApiLevel() == other.hasApiLevel()); - if (hasApiLevel()) { - result = result && getApiLevel() - .equals(other.getApiLevel()); - } - result = result && (hasAbiName() == other.hasAbiName()); - if (hasAbiName()) { - result = result && getAbiName() - .equals(other.getAbiName()); - } - result = result && (hasAbiBitness() == other.hasAbiBitness()); - if (hasAbiBitness()) { - result = result && getAbiBitness() - .equals(other.getAbiBitness()); - } - result = result && (hasSerial() == other.hasSerial()); - if (hasSerial()) { - result = result && getSerial() - .equals(other.getSerial()); - } - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - if (hasProductType()) { - hash = (37 * hash) + PRODUCT_TYPE_FIELD_NUMBER; - hash = (53 * hash) + getProductType().hashCode(); - } - if (hasProductVariant()) { - hash = (37 * hash) + PRODUCT_VARIANT_FIELD_NUMBER; - hash = (53 * hash) + getProductVariant().hashCode(); - } - if (hasBuildFlavor()) { - hash = (37 * hash) + BUILD_FLAVOR_FIELD_NUMBER; - hash = (53 * hash) + getBuildFlavor().hashCode(); - } - if (hasBuildId()) { - hash = (37 * hash) + BUILD_ID_FIELD_NUMBER; - hash = (53 * hash) + getBuildId().hashCode(); - } - if (hasBranch()) { - hash = (37 * hash) + BRANCH_FIELD_NUMBER; - hash = (53 * hash) + getBranch().hashCode(); - } - if (hasBuildAlias()) { - hash = (37 * hash) + BUILD_ALIAS_FIELD_NUMBER; - hash = (53 * hash) + getBuildAlias().hashCode(); - } - if (hasApiLevel()) { - hash = (37 * hash) + API_LEVEL_FIELD_NUMBER; - hash = (53 * hash) + getApiLevel().hashCode(); - } - if (hasAbiName()) { - hash = (37 * hash) + ABI_NAME_FIELD_NUMBER; - hash = (53 * hash) + getAbiName().hashCode(); - } - if (hasAbiBitness()) { - hash = (37 * hash) + ABI_BITNESS_FIELD_NUMBER; - hash = (53 * hash) + getAbiBitness().hashCode(); - } - if (hasSerial()) { - hash = (37 * hash) + SERIAL_FIELD_NUMBER; - hash = (53 * hash) + getSerial().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * <pre> - * To specify a call flow event. - * </pre> - * - * Protobuf type {@code android.vts.AndroidDeviceInfoMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements - // @@protoc_insertion_point(builder_implements:android.vts.AndroidDeviceInfoMessage) - com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_AndroidDeviceInfoMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_AndroidDeviceInfoMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.class, com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.Builder.class); - } - - // Construct using com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - productType_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - productVariant_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000002); - buildFlavor_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - buildId_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000008); - branch_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000010); - buildAlias_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000020); - apiLevel_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000040); - abiName_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000080); - abiBitness_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000100); - serial_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000200); - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_AndroidDeviceInfoMessage_descriptor; - } - - public com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage getDefaultInstanceForType() { - return com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.getDefaultInstance(); - } - - public com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage build() { - com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage buildPartial() { - com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage result = new com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.productType_ = productType_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.productVariant_ = productVariant_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.buildFlavor_ = buildFlavor_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.buildId_ = buildId_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.branch_ = branch_; - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { - to_bitField0_ |= 0x00000020; - } - result.buildAlias_ = buildAlias_; - if (((from_bitField0_ & 0x00000040) == 0x00000040)) { - to_bitField0_ |= 0x00000040; - } - result.apiLevel_ = apiLevel_; - if (((from_bitField0_ & 0x00000080) == 0x00000080)) { - to_bitField0_ |= 0x00000080; - } - result.abiName_ = abiName_; - if (((from_bitField0_ & 0x00000100) == 0x00000100)) { - to_bitField0_ |= 0x00000100; - } - result.abiBitness_ = abiBitness_; - if (((from_bitField0_ & 0x00000200) == 0x00000200)) { - to_bitField0_ |= 0x00000200; - } - result.serial_ = serial_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage) { - return mergeFrom((com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage other) { - if (other == com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.getDefaultInstance()) return this; - if (other.hasProductType()) { - setProductType(other.getProductType()); - } - if (other.hasProductVariant()) { - setProductVariant(other.getProductVariant()); - } - if (other.hasBuildFlavor()) { - setBuildFlavor(other.getBuildFlavor()); - } - if (other.hasBuildId()) { - setBuildId(other.getBuildId()); - } - if (other.hasBranch()) { - setBranch(other.getBranch()); - } - if (other.hasBuildAlias()) { - setBuildAlias(other.getBuildAlias()); - } - if (other.hasApiLevel()) { - setApiLevel(other.getApiLevel()); - } - if (other.hasAbiName()) { - setAbiName(other.getAbiName()); - } - if (other.hasAbiBitness()) { - setAbiBitness(other.getAbiBitness()); - } - if (other.hasSerial()) { - setSerial(other.getSerial()); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private com.google.protobuf.ByteString productType_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * product type (e.g., bullhead). - * </pre> - * - * <code>optional bytes product_type = 1;</code> - */ - public boolean hasProductType() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * product type (e.g., bullhead). - * </pre> - * - * <code>optional bytes product_type = 1;</code> - */ - public com.google.protobuf.ByteString getProductType() { - return productType_; - } - /** - * <pre> - * product type (e.g., bullhead). - * </pre> - * - * <code>optional bytes product_type = 1;</code> - */ - public Builder setProductType(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - productType_ = value; - onChanged(); - return this; - } - /** - * <pre> - * product type (e.g., bullhead). - * </pre> - * - * <code>optional bytes product_type = 1;</code> - */ - public Builder clearProductType() { - bitField0_ = (bitField0_ & ~0x00000001); - productType_ = getDefaultInstance().getProductType(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString productVariant_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * product type variant (e.g., still bullhead or another name). - * </pre> - * - * <code>optional bytes product_variant = 2;</code> - */ - public boolean hasProductVariant() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * product type variant (e.g., still bullhead or another name). - * </pre> - * - * <code>optional bytes product_variant = 2;</code> - */ - public com.google.protobuf.ByteString getProductVariant() { - return productVariant_; - } - /** - * <pre> - * product type variant (e.g., still bullhead or another name). - * </pre> - * - * <code>optional bytes product_variant = 2;</code> - */ - public Builder setProductVariant(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - productVariant_ = value; - onChanged(); - return this; - } - /** - * <pre> - * product type variant (e.g., still bullhead or another name). - * </pre> - * - * <code>optional bytes product_variant = 2;</code> - */ - public Builder clearProductVariant() { - bitField0_ = (bitField0_ & ~0x00000002); - productVariant_ = getDefaultInstance().getProductVariant(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString buildFlavor_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * build type (e.g., userdebug). - * </pre> - * - * <code>optional bytes build_flavor = 11;</code> - */ - public boolean hasBuildFlavor() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * build type (e.g., userdebug). - * </pre> - * - * <code>optional bytes build_flavor = 11;</code> - */ - public com.google.protobuf.ByteString getBuildFlavor() { - return buildFlavor_; - } - /** - * <pre> - * build type (e.g., userdebug). - * </pre> - * - * <code>optional bytes build_flavor = 11;</code> - */ - public Builder setBuildFlavor(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - buildFlavor_ = value; - onChanged(); - return this; - } - /** - * <pre> - * build type (e.g., userdebug). - * </pre> - * - * <code>optional bytes build_flavor = 11;</code> - */ - public Builder clearBuildFlavor() { - bitField0_ = (bitField0_ & ~0x00000004); - buildFlavor_ = getDefaultInstance().getBuildFlavor(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString buildId_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * Android Build ID. - * </pre> - * - * <code>optional bytes build_id = 12;</code> - */ - public boolean hasBuildId() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <pre> - * Android Build ID. - * </pre> - * - * <code>optional bytes build_id = 12;</code> - */ - public com.google.protobuf.ByteString getBuildId() { - return buildId_; - } - /** - * <pre> - * Android Build ID. - * </pre> - * - * <code>optional bytes build_id = 12;</code> - */ - public Builder setBuildId(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000008; - buildId_ = value; - onChanged(); - return this; - } - /** - * <pre> - * Android Build ID. - * </pre> - * - * <code>optional bytes build_id = 12;</code> - */ - public Builder clearBuildId() { - bitField0_ = (bitField0_ & ~0x00000008); - buildId_ = getDefaultInstance().getBuildId(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString branch_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * branch name (e.g., master or nyc-dev). - * </pre> - * - * <code>optional bytes branch = 21;</code> - */ - public boolean hasBranch() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <pre> - * branch name (e.g., master or nyc-dev). - * </pre> - * - * <code>optional bytes branch = 21;</code> - */ - public com.google.protobuf.ByteString getBranch() { - return branch_; - } - /** - * <pre> - * branch name (e.g., master or nyc-dev). - * </pre> - * - * <code>optional bytes branch = 21;</code> - */ - public Builder setBranch(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000010; - branch_ = value; - onChanged(); - return this; - } - /** - * <pre> - * branch name (e.g., master or nyc-dev). - * </pre> - * - * <code>optional bytes branch = 21;</code> - */ - public Builder clearBranch() { - bitField0_ = (bitField0_ & ~0x00000010); - branch_ = getDefaultInstance().getBranch(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString buildAlias_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * build alias implies the branch name. - * </pre> - * - * <code>optional bytes build_alias = 22;</code> - */ - public boolean hasBuildAlias() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - /** - * <pre> - * build alias implies the branch name. - * </pre> - * - * <code>optional bytes build_alias = 22;</code> - */ - public com.google.protobuf.ByteString getBuildAlias() { - return buildAlias_; - } - /** - * <pre> - * build alias implies the branch name. - * </pre> - * - * <code>optional bytes build_alias = 22;</code> - */ - public Builder setBuildAlias(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000020; - buildAlias_ = value; - onChanged(); - return this; - } - /** - * <pre> - * build alias implies the branch name. - * </pre> - * - * <code>optional bytes build_alias = 22;</code> - */ - public Builder clearBuildAlias() { - bitField0_ = (bitField0_ & ~0x00000020); - buildAlias_ = getDefaultInstance().getBuildAlias(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString apiLevel_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * API level - * </pre> - * - * <code>optional bytes api_level = 31;</code> - */ - public boolean hasApiLevel() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - /** - * <pre> - * API level - * </pre> - * - * <code>optional bytes api_level = 31;</code> - */ - public com.google.protobuf.ByteString getApiLevel() { - return apiLevel_; - } - /** - * <pre> - * API level - * </pre> - * - * <code>optional bytes api_level = 31;</code> - */ - public Builder setApiLevel(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000040; - apiLevel_ = value; - onChanged(); - return this; - } - /** - * <pre> - * API level - * </pre> - * - * <code>optional bytes api_level = 31;</code> - */ - public Builder clearApiLevel() { - bitField0_ = (bitField0_ & ~0x00000040); - apiLevel_ = getDefaultInstance().getApiLevel(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString abiName_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * ABI name that is current in use for the test - * </pre> - * - * <code>optional bytes abi_name = 51;</code> - */ - public boolean hasAbiName() { - return ((bitField0_ & 0x00000080) == 0x00000080); - } - /** - * <pre> - * ABI name that is current in use for the test - * </pre> - * - * <code>optional bytes abi_name = 51;</code> - */ - public com.google.protobuf.ByteString getAbiName() { - return abiName_; - } - /** - * <pre> - * ABI name that is current in use for the test - * </pre> - * - * <code>optional bytes abi_name = 51;</code> - */ - public Builder setAbiName(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000080; - abiName_ = value; - onChanged(); - return this; - } - /** - * <pre> - * ABI name that is current in use for the test - * </pre> - * - * <code>optional bytes abi_name = 51;</code> - */ - public Builder clearAbiName() { - bitField0_ = (bitField0_ & ~0x00000080); - abiName_ = getDefaultInstance().getAbiName(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString abiBitness_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * ABI bitness that is current in use for the test. Example: '32', '64', - * </pre> - * - * <code>optional bytes abi_bitness = 52;</code> - */ - public boolean hasAbiBitness() { - return ((bitField0_ & 0x00000100) == 0x00000100); - } - /** - * <pre> - * ABI bitness that is current in use for the test. Example: '32', '64', - * </pre> - * - * <code>optional bytes abi_bitness = 52;</code> - */ - public com.google.protobuf.ByteString getAbiBitness() { - return abiBitness_; - } - /** - * <pre> - * ABI bitness that is current in use for the test. Example: '32', '64', - * </pre> - * - * <code>optional bytes abi_bitness = 52;</code> - */ - public Builder setAbiBitness(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000100; - abiBitness_ = value; - onChanged(); - return this; - } - /** - * <pre> - * ABI bitness that is current in use for the test. Example: '32', '64', - * </pre> - * - * <code>optional bytes abi_bitness = 52;</code> - */ - public Builder clearAbiBitness() { - bitField0_ = (bitField0_ & ~0x00000100); - abiBitness_ = getDefaultInstance().getAbiBitness(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString serial_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * Device USB serial number - * </pre> - * - * <code>optional bytes serial = 101;</code> - */ - public boolean hasSerial() { - return ((bitField0_ & 0x00000200) == 0x00000200); - } - /** - * <pre> - * Device USB serial number - * </pre> - * - * <code>optional bytes serial = 101;</code> - */ - public com.google.protobuf.ByteString getSerial() { - return serial_; - } - /** - * <pre> - * Device USB serial number - * </pre> - * - * <code>optional bytes serial = 101;</code> - */ - public Builder setSerial(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000200; - serial_ = value; - onChanged(); - return this; - } - /** - * <pre> - * Device USB serial number - * </pre> - * - * <code>optional bytes serial = 101;</code> - */ - public Builder clearSerial() { - bitField0_ = (bitField0_ & ~0x00000200); - serial_ = getDefaultInstance().getSerial(); - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:android.vts.AndroidDeviceInfoMessage) - } - - // @@protoc_insertion_point(class_scope:android.vts.AndroidDeviceInfoMessage) - private static final com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage(); - } - - public static com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - @java.lang.Deprecated public static final com.google.protobuf.Parser<AndroidDeviceInfoMessage> - PARSER = new com.google.protobuf.AbstractParser<AndroidDeviceInfoMessage>() { - public AndroidDeviceInfoMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new AndroidDeviceInfoMessage(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser<AndroidDeviceInfoMessage> parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser<AndroidDeviceInfoMessage> getParserForType() { - return PARSER; - } - - public com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface AndroidBuildInfoOrBuilder extends - // @@protoc_insertion_point(interface_extends:android.vts.AndroidBuildInfo) - com.google.protobuf.MessageOrBuilder { - - /** - * <pre> - * build ID. - * </pre> - * - * <code>optional bytes id = 1;</code> - */ - boolean hasId(); - /** - * <pre> - * build ID. - * </pre> - * - * <code>optional bytes id = 1;</code> - */ - com.google.protobuf.ByteString getId(); - - /** - * <pre> - * device name (e.g., bullhead). - * </pre> - * - * <code>optional bytes name = 11;</code> - */ - boolean hasName(); - /** - * <pre> - * device name (e.g., bullhead). - * </pre> - * - * <code>optional bytes name = 11;</code> - */ - com.google.protobuf.ByteString getName(); - - /** - * <pre> - * build type (e.g., userdebug) - * </pre> - * - * <code>optional bytes build_type = 12;</code> - */ - boolean hasBuildType(); - /** - * <pre> - * build type (e.g., userdebug) - * </pre> - * - * <code>optional bytes build_type = 12;</code> - */ - com.google.protobuf.ByteString getBuildType(); - - /** - * <pre> - * branch name (e.g., master or nyc-dev) - * </pre> - * - * <code>optional bytes branch = 13;</code> - */ - boolean hasBranch(); - /** - * <pre> - * branch name (e.g., master or nyc-dev) - * </pre> - * - * <code>optional bytes branch = 13;</code> - */ - com.google.protobuf.ByteString getBranch(); - - /** - * <pre> - * indicates the latest commit information of each branch (e.g., xml format). - * </pre> - * - * <code>optional bytes build_summary = 21;</code> - */ - boolean hasBuildSummary(); - /** - * <pre> - * indicates the latest commit information of each branch (e.g., xml format). - * </pre> - * - * <code>optional bytes build_summary = 21;</code> - */ - com.google.protobuf.ByteString getBuildSummary(); - } - /** - * <pre> - * To specify build info. - * </pre> - * - * Protobuf type {@code android.vts.AndroidBuildInfo} - */ - public static final class AndroidBuildInfo extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:android.vts.AndroidBuildInfo) - AndroidBuildInfoOrBuilder { - // Use AndroidBuildInfo.newBuilder() to construct. - private AndroidBuildInfo(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { - super(builder); - } - private AndroidBuildInfo() { - id_ = com.google.protobuf.ByteString.EMPTY; - name_ = com.google.protobuf.ByteString.EMPTY; - buildType_ = com.google.protobuf.ByteString.EMPTY; - branch_ = com.google.protobuf.ByteString.EMPTY; - buildSummary_ = com.google.protobuf.ByteString.EMPTY; - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private AndroidBuildInfo( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - id_ = input.readBytes(); - break; - } - case 90: { - bitField0_ |= 0x00000002; - name_ = input.readBytes(); - break; - } - case 98: { - bitField0_ |= 0x00000004; - buildType_ = input.readBytes(); - break; - } - case 106: { - bitField0_ |= 0x00000008; - branch_ = input.readBytes(); - break; - } - case 170: { - bitField0_ |= 0x00000010; - buildSummary_ = input.readBytes(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_AndroidBuildInfo_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_AndroidBuildInfo_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.class, com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.Builder.class); - } - - private int bitField0_; - public static final int ID_FIELD_NUMBER = 1; - private com.google.protobuf.ByteString id_; - /** - * <pre> - * build ID. - * </pre> - * - * <code>optional bytes id = 1;</code> - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * build ID. - * </pre> - * - * <code>optional bytes id = 1;</code> - */ - public com.google.protobuf.ByteString getId() { - return id_; - } - - public static final int NAME_FIELD_NUMBER = 11; - private com.google.protobuf.ByteString name_; - /** - * <pre> - * device name (e.g., bullhead). - * </pre> - * - * <code>optional bytes name = 11;</code> - */ - public boolean hasName() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * device name (e.g., bullhead). - * </pre> - * - * <code>optional bytes name = 11;</code> - */ - public com.google.protobuf.ByteString getName() { - return name_; - } - - public static final int BUILD_TYPE_FIELD_NUMBER = 12; - private com.google.protobuf.ByteString buildType_; - /** - * <pre> - * build type (e.g., userdebug) - * </pre> - * - * <code>optional bytes build_type = 12;</code> - */ - public boolean hasBuildType() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * build type (e.g., userdebug) - * </pre> - * - * <code>optional bytes build_type = 12;</code> - */ - public com.google.protobuf.ByteString getBuildType() { - return buildType_; - } - - public static final int BRANCH_FIELD_NUMBER = 13; - private com.google.protobuf.ByteString branch_; - /** - * <pre> - * branch name (e.g., master or nyc-dev) - * </pre> - * - * <code>optional bytes branch = 13;</code> - */ - public boolean hasBranch() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <pre> - * branch name (e.g., master or nyc-dev) - * </pre> - * - * <code>optional bytes branch = 13;</code> - */ - public com.google.protobuf.ByteString getBranch() { - return branch_; - } - - public static final int BUILD_SUMMARY_FIELD_NUMBER = 21; - private com.google.protobuf.ByteString buildSummary_; - /** - * <pre> - * indicates the latest commit information of each branch (e.g., xml format). - * </pre> - * - * <code>optional bytes build_summary = 21;</code> - */ - public boolean hasBuildSummary() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <pre> - * indicates the latest commit information of each branch (e.g., xml format). - * </pre> - * - * <code>optional bytes build_summary = 21;</code> - */ - public com.google.protobuf.ByteString getBuildSummary() { - return buildSummary_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(11, name_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(12, buildType_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBytes(13, branch_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeBytes(21, buildSummary_); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, id_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(11, name_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(12, buildType_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(13, branch_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(21, buildSummary_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.android.vts.proto.VtsReportMessage.AndroidBuildInfo)) { - return super.equals(obj); - } - com.android.vts.proto.VtsReportMessage.AndroidBuildInfo other = (com.android.vts.proto.VtsReportMessage.AndroidBuildInfo) obj; - - boolean result = true; - result = result && (hasId() == other.hasId()); - if (hasId()) { - result = result && getId() - .equals(other.getId()); - } - result = result && (hasName() == other.hasName()); - if (hasName()) { - result = result && getName() - .equals(other.getName()); - } - result = result && (hasBuildType() == other.hasBuildType()); - if (hasBuildType()) { - result = result && getBuildType() - .equals(other.getBuildType()); - } - result = result && (hasBranch() == other.hasBranch()); - if (hasBranch()) { - result = result && getBranch() - .equals(other.getBranch()); - } - result = result && (hasBuildSummary() == other.hasBuildSummary()); - if (hasBuildSummary()) { - result = result && getBuildSummary() - .equals(other.getBuildSummary()); - } - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - if (hasId()) { - hash = (37 * hash) + ID_FIELD_NUMBER; - hash = (53 * hash) + getId().hashCode(); - } - if (hasName()) { - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - } - if (hasBuildType()) { - hash = (37 * hash) + BUILD_TYPE_FIELD_NUMBER; - hash = (53 * hash) + getBuildType().hashCode(); - } - if (hasBranch()) { - hash = (37 * hash) + BRANCH_FIELD_NUMBER; - hash = (53 * hash) + getBranch().hashCode(); - } - if (hasBuildSummary()) { - hash = (37 * hash) + BUILD_SUMMARY_FIELD_NUMBER; - hash = (53 * hash) + getBuildSummary().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.android.vts.proto.VtsReportMessage.AndroidBuildInfo parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.AndroidBuildInfo parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.AndroidBuildInfo parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.AndroidBuildInfo parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.AndroidBuildInfo parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.AndroidBuildInfo parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.AndroidBuildInfo parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.AndroidBuildInfo parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.AndroidBuildInfo parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.AndroidBuildInfo parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.android.vts.proto.VtsReportMessage.AndroidBuildInfo prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * <pre> - * To specify build info. - * </pre> - * - * Protobuf type {@code android.vts.AndroidBuildInfo} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements - // @@protoc_insertion_point(builder_implements:android.vts.AndroidBuildInfo) - com.android.vts.proto.VtsReportMessage.AndroidBuildInfoOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_AndroidBuildInfo_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_AndroidBuildInfo_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.class, com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.Builder.class); - } - - // Construct using com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - id_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - name_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000002); - buildType_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - branch_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000008); - buildSummary_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000010); - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_AndroidBuildInfo_descriptor; - } - - public com.android.vts.proto.VtsReportMessage.AndroidBuildInfo getDefaultInstanceForType() { - return com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.getDefaultInstance(); - } - - public com.android.vts.proto.VtsReportMessage.AndroidBuildInfo build() { - com.android.vts.proto.VtsReportMessage.AndroidBuildInfo result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.android.vts.proto.VtsReportMessage.AndroidBuildInfo buildPartial() { - com.android.vts.proto.VtsReportMessage.AndroidBuildInfo result = new com.android.vts.proto.VtsReportMessage.AndroidBuildInfo(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.id_ = id_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.name_ = name_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.buildType_ = buildType_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.branch_ = branch_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.buildSummary_ = buildSummary_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.android.vts.proto.VtsReportMessage.AndroidBuildInfo) { - return mergeFrom((com.android.vts.proto.VtsReportMessage.AndroidBuildInfo)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.android.vts.proto.VtsReportMessage.AndroidBuildInfo other) { - if (other == com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.getDefaultInstance()) return this; - if (other.hasId()) { - setId(other.getId()); - } - if (other.hasName()) { - setName(other.getName()); - } - if (other.hasBuildType()) { - setBuildType(other.getBuildType()); - } - if (other.hasBranch()) { - setBranch(other.getBranch()); - } - if (other.hasBuildSummary()) { - setBuildSummary(other.getBuildSummary()); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.android.vts.proto.VtsReportMessage.AndroidBuildInfo parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.android.vts.proto.VtsReportMessage.AndroidBuildInfo) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private com.google.protobuf.ByteString id_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * build ID. - * </pre> - * - * <code>optional bytes id = 1;</code> - */ - public boolean hasId() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * build ID. - * </pre> - * - * <code>optional bytes id = 1;</code> - */ - public com.google.protobuf.ByteString getId() { - return id_; - } - /** - * <pre> - * build ID. - * </pre> - * - * <code>optional bytes id = 1;</code> - */ - public Builder setId(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - id_ = value; - onChanged(); - return this; - } - /** - * <pre> - * build ID. - * </pre> - * - * <code>optional bytes id = 1;</code> - */ - public Builder clearId() { - bitField0_ = (bitField0_ & ~0x00000001); - id_ = getDefaultInstance().getId(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString name_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * device name (e.g., bullhead). - * </pre> - * - * <code>optional bytes name = 11;</code> - */ - public boolean hasName() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * device name (e.g., bullhead). - * </pre> - * - * <code>optional bytes name = 11;</code> - */ - public com.google.protobuf.ByteString getName() { - return name_; - } - /** - * <pre> - * device name (e.g., bullhead). - * </pre> - * - * <code>optional bytes name = 11;</code> - */ - public Builder setName(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - name_ = value; - onChanged(); - return this; - } - /** - * <pre> - * device name (e.g., bullhead). - * </pre> - * - * <code>optional bytes name = 11;</code> - */ - public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000002); - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString buildType_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * build type (e.g., userdebug) - * </pre> - * - * <code>optional bytes build_type = 12;</code> - */ - public boolean hasBuildType() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * build type (e.g., userdebug) - * </pre> - * - * <code>optional bytes build_type = 12;</code> - */ - public com.google.protobuf.ByteString getBuildType() { - return buildType_; - } - /** - * <pre> - * build type (e.g., userdebug) - * </pre> - * - * <code>optional bytes build_type = 12;</code> - */ - public Builder setBuildType(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - buildType_ = value; - onChanged(); - return this; - } - /** - * <pre> - * build type (e.g., userdebug) - * </pre> - * - * <code>optional bytes build_type = 12;</code> - */ - public Builder clearBuildType() { - bitField0_ = (bitField0_ & ~0x00000004); - buildType_ = getDefaultInstance().getBuildType(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString branch_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * branch name (e.g., master or nyc-dev) - * </pre> - * - * <code>optional bytes branch = 13;</code> - */ - public boolean hasBranch() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <pre> - * branch name (e.g., master or nyc-dev) - * </pre> - * - * <code>optional bytes branch = 13;</code> - */ - public com.google.protobuf.ByteString getBranch() { - return branch_; - } - /** - * <pre> - * branch name (e.g., master or nyc-dev) - * </pre> - * - * <code>optional bytes branch = 13;</code> - */ - public Builder setBranch(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000008; - branch_ = value; - onChanged(); - return this; - } - /** - * <pre> - * branch name (e.g., master or nyc-dev) - * </pre> - * - * <code>optional bytes branch = 13;</code> - */ - public Builder clearBranch() { - bitField0_ = (bitField0_ & ~0x00000008); - branch_ = getDefaultInstance().getBranch(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString buildSummary_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * indicates the latest commit information of each branch (e.g., xml format). - * </pre> - * - * <code>optional bytes build_summary = 21;</code> - */ - public boolean hasBuildSummary() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <pre> - * indicates the latest commit information of each branch (e.g., xml format). - * </pre> - * - * <code>optional bytes build_summary = 21;</code> - */ - public com.google.protobuf.ByteString getBuildSummary() { - return buildSummary_; - } - /** - * <pre> - * indicates the latest commit information of each branch (e.g., xml format). - * </pre> - * - * <code>optional bytes build_summary = 21;</code> - */ - public Builder setBuildSummary(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000010; - buildSummary_ = value; - onChanged(); - return this; - } - /** - * <pre> - * indicates the latest commit information of each branch (e.g., xml format). - * </pre> - * - * <code>optional bytes build_summary = 21;</code> - */ - public Builder clearBuildSummary() { - bitField0_ = (bitField0_ & ~0x00000010); - buildSummary_ = getDefaultInstance().getBuildSummary(); - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:android.vts.AndroidBuildInfo) - } - - // @@protoc_insertion_point(class_scope:android.vts.AndroidBuildInfo) - private static final com.android.vts.proto.VtsReportMessage.AndroidBuildInfo DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.android.vts.proto.VtsReportMessage.AndroidBuildInfo(); - } - - public static com.android.vts.proto.VtsReportMessage.AndroidBuildInfo getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - @java.lang.Deprecated public static final com.google.protobuf.Parser<AndroidBuildInfo> - PARSER = new com.google.protobuf.AbstractParser<AndroidBuildInfo>() { - public AndroidBuildInfo parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new AndroidBuildInfo(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser<AndroidBuildInfo> parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser<AndroidBuildInfo> getParserForType() { - return PARSER; - } - - public com.android.vts.proto.VtsReportMessage.AndroidBuildInfo getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface VtsHostInfoOrBuilder extends - // @@protoc_insertion_point(interface_extends:android.vts.VtsHostInfo) - com.google.protobuf.MessageOrBuilder { - - /** - * <pre> - * the host name (i.e., full domain name). - * </pre> - * - * <code>optional bytes hostname = 1;</code> - */ - boolean hasHostname(); - /** - * <pre> - * the host name (i.e., full domain name). - * </pre> - * - * <code>optional bytes hostname = 1;</code> - */ - com.google.protobuf.ByteString getHostname(); - } - /** - * <pre> - * To specify the information about a host node. - * </pre> - * - * Protobuf type {@code android.vts.VtsHostInfo} - */ - public static final class VtsHostInfo extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:android.vts.VtsHostInfo) - VtsHostInfoOrBuilder { - // Use VtsHostInfo.newBuilder() to construct. - private VtsHostInfo(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { - super(builder); - } - private VtsHostInfo() { - hostname_ = com.google.protobuf.ByteString.EMPTY; - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private VtsHostInfo( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - hostname_ = input.readBytes(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_VtsHostInfo_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_VtsHostInfo_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.VtsHostInfo.class, com.android.vts.proto.VtsReportMessage.VtsHostInfo.Builder.class); - } - - private int bitField0_; - public static final int HOSTNAME_FIELD_NUMBER = 1; - private com.google.protobuf.ByteString hostname_; - /** - * <pre> - * the host name (i.e., full domain name). - * </pre> - * - * <code>optional bytes hostname = 1;</code> - */ - public boolean hasHostname() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * the host name (i.e., full domain name). - * </pre> - * - * <code>optional bytes hostname = 1;</code> - */ - public com.google.protobuf.ByteString getHostname() { - return hostname_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, hostname_); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, hostname_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.android.vts.proto.VtsReportMessage.VtsHostInfo)) { - return super.equals(obj); - } - com.android.vts.proto.VtsReportMessage.VtsHostInfo other = (com.android.vts.proto.VtsReportMessage.VtsHostInfo) obj; - - boolean result = true; - result = result && (hasHostname() == other.hasHostname()); - if (hasHostname()) { - result = result && getHostname() - .equals(other.getHostname()); - } - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - if (hasHostname()) { - hash = (37 * hash) + HOSTNAME_FIELD_NUMBER; - hash = (53 * hash) + getHostname().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.android.vts.proto.VtsReportMessage.VtsHostInfo parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.VtsHostInfo parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.VtsHostInfo parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.VtsHostInfo parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.VtsHostInfo parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.VtsHostInfo parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.VtsHostInfo parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.VtsHostInfo parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.VtsHostInfo parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.VtsHostInfo parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.android.vts.proto.VtsReportMessage.VtsHostInfo prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * <pre> - * To specify the information about a host node. - * </pre> - * - * Protobuf type {@code android.vts.VtsHostInfo} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements - // @@protoc_insertion_point(builder_implements:android.vts.VtsHostInfo) - com.android.vts.proto.VtsReportMessage.VtsHostInfoOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_VtsHostInfo_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_VtsHostInfo_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.VtsHostInfo.class, com.android.vts.proto.VtsReportMessage.VtsHostInfo.Builder.class); - } - - // Construct using com.android.vts.proto.VtsReportMessage.VtsHostInfo.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - hostname_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_VtsHostInfo_descriptor; - } - - public com.android.vts.proto.VtsReportMessage.VtsHostInfo getDefaultInstanceForType() { - return com.android.vts.proto.VtsReportMessage.VtsHostInfo.getDefaultInstance(); - } - - public com.android.vts.proto.VtsReportMessage.VtsHostInfo build() { - com.android.vts.proto.VtsReportMessage.VtsHostInfo result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.android.vts.proto.VtsReportMessage.VtsHostInfo buildPartial() { - com.android.vts.proto.VtsReportMessage.VtsHostInfo result = new com.android.vts.proto.VtsReportMessage.VtsHostInfo(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.hostname_ = hostname_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.android.vts.proto.VtsReportMessage.VtsHostInfo) { - return mergeFrom((com.android.vts.proto.VtsReportMessage.VtsHostInfo)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.android.vts.proto.VtsReportMessage.VtsHostInfo other) { - if (other == com.android.vts.proto.VtsReportMessage.VtsHostInfo.getDefaultInstance()) return this; - if (other.hasHostname()) { - setHostname(other.getHostname()); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.android.vts.proto.VtsReportMessage.VtsHostInfo parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.android.vts.proto.VtsReportMessage.VtsHostInfo) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private com.google.protobuf.ByteString hostname_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * the host name (i.e., full domain name). - * </pre> - * - * <code>optional bytes hostname = 1;</code> - */ - public boolean hasHostname() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * the host name (i.e., full domain name). - * </pre> - * - * <code>optional bytes hostname = 1;</code> - */ - public com.google.protobuf.ByteString getHostname() { - return hostname_; - } - /** - * <pre> - * the host name (i.e., full domain name). - * </pre> - * - * <code>optional bytes hostname = 1;</code> - */ - public Builder setHostname(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - hostname_ = value; - onChanged(); - return this; - } - /** - * <pre> - * the host name (i.e., full domain name). - * </pre> - * - * <code>optional bytes hostname = 1;</code> - */ - public Builder clearHostname() { - bitField0_ = (bitField0_ & ~0x00000001); - hostname_ = getDefaultInstance().getHostname(); - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:android.vts.VtsHostInfo) - } - - // @@protoc_insertion_point(class_scope:android.vts.VtsHostInfo) - private static final com.android.vts.proto.VtsReportMessage.VtsHostInfo DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.android.vts.proto.VtsReportMessage.VtsHostInfo(); - } - - public static com.android.vts.proto.VtsReportMessage.VtsHostInfo getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - @java.lang.Deprecated public static final com.google.protobuf.Parser<VtsHostInfo> - PARSER = new com.google.protobuf.AbstractParser<VtsHostInfo>() { - public VtsHostInfo parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new VtsHostInfo(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser<VtsHostInfo> parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser<VtsHostInfo> getParserForType() { - return PARSER; - } - - public com.android.vts.proto.VtsReportMessage.VtsHostInfo getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface TestCaseReportMessageOrBuilder extends - // @@protoc_insertion_point(interface_extends:android.vts.TestCaseReportMessage) - com.google.protobuf.MessageOrBuilder { - - /** - * <pre> - * the test case name. - * </pre> - * - * <code>optional bytes name = 1;</code> - */ - boolean hasName(); - /** - * <pre> - * the test case name. - * </pre> - * - * <code>optional bytes name = 1;</code> - */ - com.google.protobuf.ByteString getName(); - - /** - * <pre> - * the test result. - * </pre> - * - * <code>optional .android.vts.TestCaseResult test_result = 11;</code> - */ - boolean hasTestResult(); - /** - * <pre> - * the test result. - * </pre> - * - * <code>optional .android.vts.TestCaseResult test_result = 11;</code> - */ - com.android.vts.proto.VtsReportMessage.TestCaseResult getTestResult(); - - /** - * <pre> - * execution start and end time stamp. - * </pre> - * - * <code>optional int64 start_timestamp = 21;</code> - */ - boolean hasStartTimestamp(); - /** - * <pre> - * execution start and end time stamp. - * </pre> - * - * <code>optional int64 start_timestamp = 21;</code> - */ - long getStartTimestamp(); - - /** - * <code>optional int64 end_timestamp = 22;</code> - */ - boolean hasEndTimestamp(); - /** - * <code>optional int64 end_timestamp = 22;</code> - */ - long getEndTimestamp(); - - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - java.util.List<com.android.vts.proto.VtsReportMessage.CoverageReportMessage> - getCoverageList(); - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - com.android.vts.proto.VtsReportMessage.CoverageReportMessage getCoverage(int index); - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - int getCoverageCount(); - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - java.util.List<? extends com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder> - getCoverageOrBuilderList(); - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder getCoverageOrBuilder( - int index); - - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - java.util.List<com.android.vts.proto.VtsReportMessage.ProfilingReportMessage> - getProfilingList(); - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage getProfiling(int index); - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - int getProfilingCount(); - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - java.util.List<? extends com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder> - getProfilingOrBuilderList(); - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder getProfilingOrBuilder( - int index); - - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated java.util.List<com.android.vts.proto.VtsReportMessage.SystraceReportMessage> - getSystraceList(); - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated com.android.vts.proto.VtsReportMessage.SystraceReportMessage getSystrace(int index); - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated int getSystraceCount(); - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated java.util.List<? extends com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder> - getSystraceOrBuilderList(); - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder getSystraceOrBuilder( - int index); - - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - java.util.List<com.android.vts.proto.VtsReportMessage.LogMessage> - getLogList(); - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - com.android.vts.proto.VtsReportMessage.LogMessage getLog(int index); - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - int getLogCount(); - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - java.util.List<? extends com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder> - getLogOrBuilderList(); - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder getLogOrBuilder( - int index); - } - /** - * <pre> - * To specify a test case execution report. - * </pre> - * - * Protobuf type {@code android.vts.TestCaseReportMessage} - */ - public static final class TestCaseReportMessage extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:android.vts.TestCaseReportMessage) - TestCaseReportMessageOrBuilder { - // Use TestCaseReportMessage.newBuilder() to construct. - private TestCaseReportMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { - super(builder); - } - private TestCaseReportMessage() { - name_ = com.google.protobuf.ByteString.EMPTY; - testResult_ = 0; - startTimestamp_ = 0L; - endTimestamp_ = 0L; - coverage_ = java.util.Collections.emptyList(); - profiling_ = java.util.Collections.emptyList(); - systrace_ = java.util.Collections.emptyList(); - log_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private TestCaseReportMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - name_ = input.readBytes(); - break; - } - case 88: { - int rawValue = input.readEnum(); - com.android.vts.proto.VtsReportMessage.TestCaseResult value = com.android.vts.proto.VtsReportMessage.TestCaseResult.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(11, rawValue); - } else { - bitField0_ |= 0x00000002; - testResult_ = rawValue; - } - break; - } - case 168: { - bitField0_ |= 0x00000004; - startTimestamp_ = input.readInt64(); - break; - } - case 176: { - bitField0_ |= 0x00000008; - endTimestamp_ = input.readInt64(); - break; - } - case 250: { - if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) { - coverage_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.CoverageReportMessage>(); - mutable_bitField0_ |= 0x00000010; - } - coverage_.add( - input.readMessage(com.android.vts.proto.VtsReportMessage.CoverageReportMessage.PARSER, extensionRegistry)); - break; - } - case 330: { - if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { - profiling_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.ProfilingReportMessage>(); - mutable_bitField0_ |= 0x00000020; - } - profiling_.add( - input.readMessage(com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.PARSER, extensionRegistry)); - break; - } - case 338: { - if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) { - systrace_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.SystraceReportMessage>(); - mutable_bitField0_ |= 0x00000040; - } - systrace_.add( - input.readMessage(com.android.vts.proto.VtsReportMessage.SystraceReportMessage.PARSER, extensionRegistry)); - break; - } - case 810: { - if (!((mutable_bitField0_ & 0x00000080) == 0x00000080)) { - log_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.LogMessage>(); - mutable_bitField0_ |= 0x00000080; - } - log_.add( - input.readMessage(com.android.vts.proto.VtsReportMessage.LogMessage.PARSER, extensionRegistry)); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { - coverage_ = java.util.Collections.unmodifiableList(coverage_); - } - if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { - profiling_ = java.util.Collections.unmodifiableList(profiling_); - } - if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) { - systrace_ = java.util.Collections.unmodifiableList(systrace_); - } - if (((mutable_bitField0_ & 0x00000080) == 0x00000080)) { - log_ = java.util.Collections.unmodifiableList(log_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_TestCaseReportMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_TestCaseReportMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.class, com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.Builder.class); - } - - private int bitField0_; - public static final int NAME_FIELD_NUMBER = 1; - private com.google.protobuf.ByteString name_; - /** - * <pre> - * the test case name. - * </pre> - * - * <code>optional bytes name = 1;</code> - */ - public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * the test case name. - * </pre> - * - * <code>optional bytes name = 1;</code> - */ - public com.google.protobuf.ByteString getName() { - return name_; - } - - public static final int TEST_RESULT_FIELD_NUMBER = 11; - private int testResult_; - /** - * <pre> - * the test result. - * </pre> - * - * <code>optional .android.vts.TestCaseResult test_result = 11;</code> - */ - public boolean hasTestResult() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * the test result. - * </pre> - * - * <code>optional .android.vts.TestCaseResult test_result = 11;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestCaseResult getTestResult() { - com.android.vts.proto.VtsReportMessage.TestCaseResult result = com.android.vts.proto.VtsReportMessage.TestCaseResult.valueOf(testResult_); - return result == null ? com.android.vts.proto.VtsReportMessage.TestCaseResult.UNKNOWN_RESULT : result; - } - - public static final int START_TIMESTAMP_FIELD_NUMBER = 21; - private long startTimestamp_; - /** - * <pre> - * execution start and end time stamp. - * </pre> - * - * <code>optional int64 start_timestamp = 21;</code> - */ - public boolean hasStartTimestamp() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * execution start and end time stamp. - * </pre> - * - * <code>optional int64 start_timestamp = 21;</code> - */ - public long getStartTimestamp() { - return startTimestamp_; - } - - public static final int END_TIMESTAMP_FIELD_NUMBER = 22; - private long endTimestamp_; - /** - * <code>optional int64 end_timestamp = 22;</code> - */ - public boolean hasEndTimestamp() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <code>optional int64 end_timestamp = 22;</code> - */ - public long getEndTimestamp() { - return endTimestamp_; - } - - public static final int COVERAGE_FIELD_NUMBER = 31; - private java.util.List<com.android.vts.proto.VtsReportMessage.CoverageReportMessage> coverage_; - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.CoverageReportMessage> getCoverageList() { - return coverage_; - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder> - getCoverageOrBuilderList() { - return coverage_; - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public int getCoverageCount() { - return coverage_.size(); - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public com.android.vts.proto.VtsReportMessage.CoverageReportMessage getCoverage(int index) { - return coverage_.get(index); - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder getCoverageOrBuilder( - int index) { - return coverage_.get(index); - } - - public static final int PROFILING_FIELD_NUMBER = 41; - private java.util.List<com.android.vts.proto.VtsReportMessage.ProfilingReportMessage> profiling_; - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.ProfilingReportMessage> getProfilingList() { - return profiling_; - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder> - getProfilingOrBuilderList() { - return profiling_; - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public int getProfilingCount() { - return profiling_.size(); - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessage getProfiling(int index) { - return profiling_.get(index); - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder getProfilingOrBuilder( - int index) { - return profiling_.get(index); - } - - public static final int SYSTRACE_FIELD_NUMBER = 42; - private java.util.List<com.android.vts.proto.VtsReportMessage.SystraceReportMessage> systrace_; - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public java.util.List<com.android.vts.proto.VtsReportMessage.SystraceReportMessage> getSystraceList() { - return systrace_; - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public java.util.List<? extends com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder> - getSystraceOrBuilderList() { - return systrace_; - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public int getSystraceCount() { - return systrace_.size(); - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.VtsReportMessage.SystraceReportMessage getSystrace(int index) { - return systrace_.get(index); - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder getSystraceOrBuilder( - int index) { - return systrace_.get(index); - } - - public static final int LOG_FIELD_NUMBER = 101; - private java.util.List<com.android.vts.proto.VtsReportMessage.LogMessage> log_; - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.LogMessage> getLogList() { - return log_; - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder> - getLogOrBuilderList() { - return log_; - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public int getLogCount() { - return log_.size(); - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public com.android.vts.proto.VtsReportMessage.LogMessage getLog(int index) { - return log_.get(index); - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder getLogOrBuilder( - int index) { - return log_.get(index); - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, name_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeEnum(11, testResult_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt64(21, startTimestamp_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeInt64(22, endTimestamp_); - } - for (int i = 0; i < coverage_.size(); i++) { - output.writeMessage(31, coverage_.get(i)); - } - for (int i = 0; i < profiling_.size(); i++) { - output.writeMessage(41, profiling_.get(i)); - } - for (int i = 0; i < systrace_.size(); i++) { - output.writeMessage(42, systrace_.get(i)); - } - for (int i = 0; i < log_.size(); i++) { - output.writeMessage(101, log_.get(i)); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, name_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(11, testResult_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(21, startTimestamp_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(22, endTimestamp_); - } - for (int i = 0; i < coverage_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(31, coverage_.get(i)); - } - for (int i = 0; i < profiling_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(41, profiling_.get(i)); - } - for (int i = 0; i < systrace_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(42, systrace_.get(i)); - } - for (int i = 0; i < log_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(101, log_.get(i)); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.android.vts.proto.VtsReportMessage.TestCaseReportMessage)) { - return super.equals(obj); - } - com.android.vts.proto.VtsReportMessage.TestCaseReportMessage other = (com.android.vts.proto.VtsReportMessage.TestCaseReportMessage) obj; - - boolean result = true; - result = result && (hasName() == other.hasName()); - if (hasName()) { - result = result && getName() - .equals(other.getName()); - } - result = result && (hasTestResult() == other.hasTestResult()); - if (hasTestResult()) { - result = result && testResult_ == other.testResult_; - } - result = result && (hasStartTimestamp() == other.hasStartTimestamp()); - if (hasStartTimestamp()) { - result = result && (getStartTimestamp() - == other.getStartTimestamp()); - } - result = result && (hasEndTimestamp() == other.hasEndTimestamp()); - if (hasEndTimestamp()) { - result = result && (getEndTimestamp() - == other.getEndTimestamp()); - } - result = result && getCoverageList() - .equals(other.getCoverageList()); - result = result && getProfilingList() - .equals(other.getProfilingList()); - result = result && getSystraceList() - .equals(other.getSystraceList()); - result = result && getLogList() - .equals(other.getLogList()); - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - if (hasName()) { - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - } - if (hasTestResult()) { - hash = (37 * hash) + TEST_RESULT_FIELD_NUMBER; - hash = (53 * hash) + testResult_; - } - if (hasStartTimestamp()) { - hash = (37 * hash) + START_TIMESTAMP_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getStartTimestamp()); - } - if (hasEndTimestamp()) { - hash = (37 * hash) + END_TIMESTAMP_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getEndTimestamp()); - } - if (getCoverageCount() > 0) { - hash = (37 * hash) + COVERAGE_FIELD_NUMBER; - hash = (53 * hash) + getCoverageList().hashCode(); - } - if (getProfilingCount() > 0) { - hash = (37 * hash) + PROFILING_FIELD_NUMBER; - hash = (53 * hash) + getProfilingList().hashCode(); - } - if (getSystraceCount() > 0) { - hash = (37 * hash) + SYSTRACE_FIELD_NUMBER; - hash = (53 * hash) + getSystraceList().hashCode(); - } - if (getLogCount() > 0) { - hash = (37 * hash) + LOG_FIELD_NUMBER; - hash = (53 * hash) + getLogList().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.android.vts.proto.VtsReportMessage.TestCaseReportMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.TestCaseReportMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.TestCaseReportMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.TestCaseReportMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.TestCaseReportMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.TestCaseReportMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.TestCaseReportMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.TestCaseReportMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.TestCaseReportMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.TestCaseReportMessage parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.android.vts.proto.VtsReportMessage.TestCaseReportMessage prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * <pre> - * To specify a test case execution report. - * </pre> - * - * Protobuf type {@code android.vts.TestCaseReportMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements - // @@protoc_insertion_point(builder_implements:android.vts.TestCaseReportMessage) - com.android.vts.proto.VtsReportMessage.TestCaseReportMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_TestCaseReportMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_TestCaseReportMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.class, com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.Builder.class); - } - - // Construct using com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getCoverageFieldBuilder(); - getProfilingFieldBuilder(); - getSystraceFieldBuilder(); - getLogFieldBuilder(); - } - } - public Builder clear() { - super.clear(); - name_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - testResult_ = 0; - bitField0_ = (bitField0_ & ~0x00000002); - startTimestamp_ = 0L; - bitField0_ = (bitField0_ & ~0x00000004); - endTimestamp_ = 0L; - bitField0_ = (bitField0_ & ~0x00000008); - if (coverageBuilder_ == null) { - coverage_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); - } else { - coverageBuilder_.clear(); - } - if (profilingBuilder_ == null) { - profiling_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - } else { - profilingBuilder_.clear(); - } - if (systraceBuilder_ == null) { - systrace_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000040); - } else { - systraceBuilder_.clear(); - } - if (logBuilder_ == null) { - log_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000080); - } else { - logBuilder_.clear(); - } - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_TestCaseReportMessage_descriptor; - } - - public com.android.vts.proto.VtsReportMessage.TestCaseReportMessage getDefaultInstanceForType() { - return com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.getDefaultInstance(); - } - - public com.android.vts.proto.VtsReportMessage.TestCaseReportMessage build() { - com.android.vts.proto.VtsReportMessage.TestCaseReportMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.android.vts.proto.VtsReportMessage.TestCaseReportMessage buildPartial() { - com.android.vts.proto.VtsReportMessage.TestCaseReportMessage result = new com.android.vts.proto.VtsReportMessage.TestCaseReportMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.name_ = name_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.testResult_ = testResult_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.startTimestamp_ = startTimestamp_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.endTimestamp_ = endTimestamp_; - if (coverageBuilder_ == null) { - if (((bitField0_ & 0x00000010) == 0x00000010)) { - coverage_ = java.util.Collections.unmodifiableList(coverage_); - bitField0_ = (bitField0_ & ~0x00000010); - } - result.coverage_ = coverage_; - } else { - result.coverage_ = coverageBuilder_.build(); - } - if (profilingBuilder_ == null) { - if (((bitField0_ & 0x00000020) == 0x00000020)) { - profiling_ = java.util.Collections.unmodifiableList(profiling_); - bitField0_ = (bitField0_ & ~0x00000020); - } - result.profiling_ = profiling_; - } else { - result.profiling_ = profilingBuilder_.build(); - } - if (systraceBuilder_ == null) { - if (((bitField0_ & 0x00000040) == 0x00000040)) { - systrace_ = java.util.Collections.unmodifiableList(systrace_); - bitField0_ = (bitField0_ & ~0x00000040); - } - result.systrace_ = systrace_; - } else { - result.systrace_ = systraceBuilder_.build(); - } - if (logBuilder_ == null) { - if (((bitField0_ & 0x00000080) == 0x00000080)) { - log_ = java.util.Collections.unmodifiableList(log_); - bitField0_ = (bitField0_ & ~0x00000080); - } - result.log_ = log_; - } else { - result.log_ = logBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.android.vts.proto.VtsReportMessage.TestCaseReportMessage) { - return mergeFrom((com.android.vts.proto.VtsReportMessage.TestCaseReportMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.android.vts.proto.VtsReportMessage.TestCaseReportMessage other) { - if (other == com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.getDefaultInstance()) return this; - if (other.hasName()) { - setName(other.getName()); - } - if (other.hasTestResult()) { - setTestResult(other.getTestResult()); - } - if (other.hasStartTimestamp()) { - setStartTimestamp(other.getStartTimestamp()); - } - if (other.hasEndTimestamp()) { - setEndTimestamp(other.getEndTimestamp()); - } - if (coverageBuilder_ == null) { - if (!other.coverage_.isEmpty()) { - if (coverage_.isEmpty()) { - coverage_ = other.coverage_; - bitField0_ = (bitField0_ & ~0x00000010); - } else { - ensureCoverageIsMutable(); - coverage_.addAll(other.coverage_); - } - onChanged(); - } - } else { - if (!other.coverage_.isEmpty()) { - if (coverageBuilder_.isEmpty()) { - coverageBuilder_.dispose(); - coverageBuilder_ = null; - coverage_ = other.coverage_; - bitField0_ = (bitField0_ & ~0x00000010); - coverageBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getCoverageFieldBuilder() : null; - } else { - coverageBuilder_.addAllMessages(other.coverage_); - } - } - } - if (profilingBuilder_ == null) { - if (!other.profiling_.isEmpty()) { - if (profiling_.isEmpty()) { - profiling_ = other.profiling_; - bitField0_ = (bitField0_ & ~0x00000020); - } else { - ensureProfilingIsMutable(); - profiling_.addAll(other.profiling_); - } - onChanged(); - } - } else { - if (!other.profiling_.isEmpty()) { - if (profilingBuilder_.isEmpty()) { - profilingBuilder_.dispose(); - profilingBuilder_ = null; - profiling_ = other.profiling_; - bitField0_ = (bitField0_ & ~0x00000020); - profilingBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getProfilingFieldBuilder() : null; - } else { - profilingBuilder_.addAllMessages(other.profiling_); - } - } - } - if (systraceBuilder_ == null) { - if (!other.systrace_.isEmpty()) { - if (systrace_.isEmpty()) { - systrace_ = other.systrace_; - bitField0_ = (bitField0_ & ~0x00000040); - } else { - ensureSystraceIsMutable(); - systrace_.addAll(other.systrace_); - } - onChanged(); - } - } else { - if (!other.systrace_.isEmpty()) { - if (systraceBuilder_.isEmpty()) { - systraceBuilder_.dispose(); - systraceBuilder_ = null; - systrace_ = other.systrace_; - bitField0_ = (bitField0_ & ~0x00000040); - systraceBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getSystraceFieldBuilder() : null; - } else { - systraceBuilder_.addAllMessages(other.systrace_); - } - } - } - if (logBuilder_ == null) { - if (!other.log_.isEmpty()) { - if (log_.isEmpty()) { - log_ = other.log_; - bitField0_ = (bitField0_ & ~0x00000080); - } else { - ensureLogIsMutable(); - log_.addAll(other.log_); - } - onChanged(); - } - } else { - if (!other.log_.isEmpty()) { - if (logBuilder_.isEmpty()) { - logBuilder_.dispose(); - logBuilder_ = null; - log_ = other.log_; - bitField0_ = (bitField0_ & ~0x00000080); - logBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getLogFieldBuilder() : null; - } else { - logBuilder_.addAllMessages(other.log_); - } - } - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.android.vts.proto.VtsReportMessage.TestCaseReportMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.android.vts.proto.VtsReportMessage.TestCaseReportMessage) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private com.google.protobuf.ByteString name_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * the test case name. - * </pre> - * - * <code>optional bytes name = 1;</code> - */ - public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * the test case name. - * </pre> - * - * <code>optional bytes name = 1;</code> - */ - public com.google.protobuf.ByteString getName() { - return name_; - } - /** - * <pre> - * the test case name. - * </pre> - * - * <code>optional bytes name = 1;</code> - */ - public Builder setName(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - name_ = value; - onChanged(); - return this; - } - /** - * <pre> - * the test case name. - * </pre> - * - * <code>optional bytes name = 1;</code> - */ - public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000001); - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - - private int testResult_ = 0; - /** - * <pre> - * the test result. - * </pre> - * - * <code>optional .android.vts.TestCaseResult test_result = 11;</code> - */ - public boolean hasTestResult() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * the test result. - * </pre> - * - * <code>optional .android.vts.TestCaseResult test_result = 11;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestCaseResult getTestResult() { - com.android.vts.proto.VtsReportMessage.TestCaseResult result = com.android.vts.proto.VtsReportMessage.TestCaseResult.valueOf(testResult_); - return result == null ? com.android.vts.proto.VtsReportMessage.TestCaseResult.UNKNOWN_RESULT : result; - } - /** - * <pre> - * the test result. - * </pre> - * - * <code>optional .android.vts.TestCaseResult test_result = 11;</code> - */ - public Builder setTestResult(com.android.vts.proto.VtsReportMessage.TestCaseResult value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - testResult_ = value.getNumber(); - onChanged(); - return this; - } - /** - * <pre> - * the test result. - * </pre> - * - * <code>optional .android.vts.TestCaseResult test_result = 11;</code> - */ - public Builder clearTestResult() { - bitField0_ = (bitField0_ & ~0x00000002); - testResult_ = 0; - onChanged(); - return this; - } - - private long startTimestamp_ ; - /** - * <pre> - * execution start and end time stamp. - * </pre> - * - * <code>optional int64 start_timestamp = 21;</code> - */ - public boolean hasStartTimestamp() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * execution start and end time stamp. - * </pre> - * - * <code>optional int64 start_timestamp = 21;</code> - */ - public long getStartTimestamp() { - return startTimestamp_; - } - /** - * <pre> - * execution start and end time stamp. - * </pre> - * - * <code>optional int64 start_timestamp = 21;</code> - */ - public Builder setStartTimestamp(long value) { - bitField0_ |= 0x00000004; - startTimestamp_ = value; - onChanged(); - return this; - } - /** - * <pre> - * execution start and end time stamp. - * </pre> - * - * <code>optional int64 start_timestamp = 21;</code> - */ - public Builder clearStartTimestamp() { - bitField0_ = (bitField0_ & ~0x00000004); - startTimestamp_ = 0L; - onChanged(); - return this; - } - - private long endTimestamp_ ; - /** - * <code>optional int64 end_timestamp = 22;</code> - */ - public boolean hasEndTimestamp() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <code>optional int64 end_timestamp = 22;</code> - */ - public long getEndTimestamp() { - return endTimestamp_; - } - /** - * <code>optional int64 end_timestamp = 22;</code> - */ - public Builder setEndTimestamp(long value) { - bitField0_ |= 0x00000008; - endTimestamp_ = value; - onChanged(); - return this; - } - /** - * <code>optional int64 end_timestamp = 22;</code> - */ - public Builder clearEndTimestamp() { - bitField0_ = (bitField0_ & ~0x00000008); - endTimestamp_ = 0L; - onChanged(); - return this; - } - - private java.util.List<com.android.vts.proto.VtsReportMessage.CoverageReportMessage> coverage_ = - java.util.Collections.emptyList(); - private void ensureCoverageIsMutable() { - if (!((bitField0_ & 0x00000010) == 0x00000010)) { - coverage_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.CoverageReportMessage>(coverage_); - bitField0_ |= 0x00000010; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.CoverageReportMessage, com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder, com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder> coverageBuilder_; - - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.CoverageReportMessage> getCoverageList() { - if (coverageBuilder_ == null) { - return java.util.Collections.unmodifiableList(coverage_); - } else { - return coverageBuilder_.getMessageList(); - } - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public int getCoverageCount() { - if (coverageBuilder_ == null) { - return coverage_.size(); - } else { - return coverageBuilder_.getCount(); - } - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public com.android.vts.proto.VtsReportMessage.CoverageReportMessage getCoverage(int index) { - if (coverageBuilder_ == null) { - return coverage_.get(index); - } else { - return coverageBuilder_.getMessage(index); - } - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public Builder setCoverage( - int index, com.android.vts.proto.VtsReportMessage.CoverageReportMessage value) { - if (coverageBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCoverageIsMutable(); - coverage_.set(index, value); - onChanged(); - } else { - coverageBuilder_.setMessage(index, value); - } - return this; - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public Builder setCoverage( - int index, com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder builderForValue) { - if (coverageBuilder_ == null) { - ensureCoverageIsMutable(); - coverage_.set(index, builderForValue.build()); - onChanged(); - } else { - coverageBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public Builder addCoverage(com.android.vts.proto.VtsReportMessage.CoverageReportMessage value) { - if (coverageBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCoverageIsMutable(); - coverage_.add(value); - onChanged(); - } else { - coverageBuilder_.addMessage(value); - } - return this; - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public Builder addCoverage( - int index, com.android.vts.proto.VtsReportMessage.CoverageReportMessage value) { - if (coverageBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCoverageIsMutable(); - coverage_.add(index, value); - onChanged(); - } else { - coverageBuilder_.addMessage(index, value); - } - return this; - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public Builder addCoverage( - com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder builderForValue) { - if (coverageBuilder_ == null) { - ensureCoverageIsMutable(); - coverage_.add(builderForValue.build()); - onChanged(); - } else { - coverageBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public Builder addCoverage( - int index, com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder builderForValue) { - if (coverageBuilder_ == null) { - ensureCoverageIsMutable(); - coverage_.add(index, builderForValue.build()); - onChanged(); - } else { - coverageBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public Builder addAllCoverage( - java.lang.Iterable<? extends com.android.vts.proto.VtsReportMessage.CoverageReportMessage> values) { - if (coverageBuilder_ == null) { - ensureCoverageIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, coverage_); - onChanged(); - } else { - coverageBuilder_.addAllMessages(values); - } - return this; - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public Builder clearCoverage() { - if (coverageBuilder_ == null) { - coverage_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); - onChanged(); - } else { - coverageBuilder_.clear(); - } - return this; - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public Builder removeCoverage(int index) { - if (coverageBuilder_ == null) { - ensureCoverageIsMutable(); - coverage_.remove(index); - onChanged(); - } else { - coverageBuilder_.remove(index); - } - return this; - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder getCoverageBuilder( - int index) { - return getCoverageFieldBuilder().getBuilder(index); - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder getCoverageOrBuilder( - int index) { - if (coverageBuilder_ == null) { - return coverage_.get(index); } else { - return coverageBuilder_.getMessageOrBuilder(index); - } - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder> - getCoverageOrBuilderList() { - if (coverageBuilder_ != null) { - return coverageBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(coverage_); - } - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder addCoverageBuilder() { - return getCoverageFieldBuilder().addBuilder( - com.android.vts.proto.VtsReportMessage.CoverageReportMessage.getDefaultInstance()); - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder addCoverageBuilder( - int index) { - return getCoverageFieldBuilder().addBuilder( - index, com.android.vts.proto.VtsReportMessage.CoverageReportMessage.getDefaultInstance()); - } - /** - * <pre> - * coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 31;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder> - getCoverageBuilderList() { - return getCoverageFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.CoverageReportMessage, com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder, com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder> - getCoverageFieldBuilder() { - if (coverageBuilder_ == null) { - coverageBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.CoverageReportMessage, com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder, com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder>( - coverage_, - ((bitField0_ & 0x00000010) == 0x00000010), - getParentForChildren(), - isClean()); - coverage_ = null; - } - return coverageBuilder_; - } - - private java.util.List<com.android.vts.proto.VtsReportMessage.ProfilingReportMessage> profiling_ = - java.util.Collections.emptyList(); - private void ensureProfilingIsMutable() { - if (!((bitField0_ & 0x00000020) == 0x00000020)) { - profiling_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.ProfilingReportMessage>(profiling_); - bitField0_ |= 0x00000020; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder, com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder> profilingBuilder_; - - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.ProfilingReportMessage> getProfilingList() { - if (profilingBuilder_ == null) { - return java.util.Collections.unmodifiableList(profiling_); - } else { - return profilingBuilder_.getMessageList(); - } - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public int getProfilingCount() { - if (profilingBuilder_ == null) { - return profiling_.size(); - } else { - return profilingBuilder_.getCount(); - } - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessage getProfiling(int index) { - if (profilingBuilder_ == null) { - return profiling_.get(index); - } else { - return profilingBuilder_.getMessage(index); - } - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public Builder setProfiling( - int index, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage value) { - if (profilingBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureProfilingIsMutable(); - profiling_.set(index, value); - onChanged(); - } else { - profilingBuilder_.setMessage(index, value); - } - return this; - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public Builder setProfiling( - int index, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder builderForValue) { - if (profilingBuilder_ == null) { - ensureProfilingIsMutable(); - profiling_.set(index, builderForValue.build()); - onChanged(); - } else { - profilingBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public Builder addProfiling(com.android.vts.proto.VtsReportMessage.ProfilingReportMessage value) { - if (profilingBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureProfilingIsMutable(); - profiling_.add(value); - onChanged(); - } else { - profilingBuilder_.addMessage(value); - } - return this; - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public Builder addProfiling( - int index, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage value) { - if (profilingBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureProfilingIsMutable(); - profiling_.add(index, value); - onChanged(); - } else { - profilingBuilder_.addMessage(index, value); - } - return this; - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public Builder addProfiling( - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder builderForValue) { - if (profilingBuilder_ == null) { - ensureProfilingIsMutable(); - profiling_.add(builderForValue.build()); - onChanged(); - } else { - profilingBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public Builder addProfiling( - int index, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder builderForValue) { - if (profilingBuilder_ == null) { - ensureProfilingIsMutable(); - profiling_.add(index, builderForValue.build()); - onChanged(); - } else { - profilingBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public Builder addAllProfiling( - java.lang.Iterable<? extends com.android.vts.proto.VtsReportMessage.ProfilingReportMessage> values) { - if (profilingBuilder_ == null) { - ensureProfilingIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, profiling_); - onChanged(); - } else { - profilingBuilder_.addAllMessages(values); - } - return this; - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public Builder clearProfiling() { - if (profilingBuilder_ == null) { - profiling_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - onChanged(); - } else { - profilingBuilder_.clear(); - } - return this; - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public Builder removeProfiling(int index) { - if (profilingBuilder_ == null) { - ensureProfilingIsMutable(); - profiling_.remove(index); - onChanged(); - } else { - profilingBuilder_.remove(index); - } - return this; - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder getProfilingBuilder( - int index) { - return getProfilingFieldBuilder().getBuilder(index); - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder getProfilingOrBuilder( - int index) { - if (profilingBuilder_ == null) { - return profiling_.get(index); } else { - return profilingBuilder_.getMessageOrBuilder(index); - } - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder> - getProfilingOrBuilderList() { - if (profilingBuilder_ != null) { - return profilingBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(profiling_); - } - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder addProfilingBuilder() { - return getProfilingFieldBuilder().addBuilder( - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.getDefaultInstance()); - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder addProfilingBuilder( - int index) { - return getProfilingFieldBuilder().addBuilder( - index, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.getDefaultInstance()); - } - /** - * <pre> - * profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 41;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder> - getProfilingBuilderList() { - return getProfilingFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder, com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder> - getProfilingFieldBuilder() { - if (profilingBuilder_ == null) { - profilingBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder, com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder>( - profiling_, - ((bitField0_ & 0x00000020) == 0x00000020), - getParentForChildren(), - isClean()); - profiling_ = null; - } - return profilingBuilder_; - } - - private java.util.List<com.android.vts.proto.VtsReportMessage.SystraceReportMessage> systrace_ = - java.util.Collections.emptyList(); - private void ensureSystraceIsMutable() { - if (!((bitField0_ & 0x00000040) == 0x00000040)) { - systrace_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.SystraceReportMessage>(systrace_); - bitField0_ |= 0x00000040; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.SystraceReportMessage, com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder, com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder> systraceBuilder_; - - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public java.util.List<com.android.vts.proto.VtsReportMessage.SystraceReportMessage> getSystraceList() { - if (systraceBuilder_ == null) { - return java.util.Collections.unmodifiableList(systrace_); - } else { - return systraceBuilder_.getMessageList(); - } - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public int getSystraceCount() { - if (systraceBuilder_ == null) { - return systrace_.size(); - } else { - return systraceBuilder_.getCount(); - } - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.VtsReportMessage.SystraceReportMessage getSystrace(int index) { - if (systraceBuilder_ == null) { - return systrace_.get(index); - } else { - return systraceBuilder_.getMessage(index); - } - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder setSystrace( - int index, com.android.vts.proto.VtsReportMessage.SystraceReportMessage value) { - if (systraceBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSystraceIsMutable(); - systrace_.set(index, value); - onChanged(); - } else { - systraceBuilder_.setMessage(index, value); - } - return this; - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder setSystrace( - int index, com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder builderForValue) { - if (systraceBuilder_ == null) { - ensureSystraceIsMutable(); - systrace_.set(index, builderForValue.build()); - onChanged(); - } else { - systraceBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder addSystrace(com.android.vts.proto.VtsReportMessage.SystraceReportMessage value) { - if (systraceBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSystraceIsMutable(); - systrace_.add(value); - onChanged(); - } else { - systraceBuilder_.addMessage(value); - } - return this; - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder addSystrace( - int index, com.android.vts.proto.VtsReportMessage.SystraceReportMessage value) { - if (systraceBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSystraceIsMutable(); - systrace_.add(index, value); - onChanged(); - } else { - systraceBuilder_.addMessage(index, value); - } - return this; - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder addSystrace( - com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder builderForValue) { - if (systraceBuilder_ == null) { - ensureSystraceIsMutable(); - systrace_.add(builderForValue.build()); - onChanged(); - } else { - systraceBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder addSystrace( - int index, com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder builderForValue) { - if (systraceBuilder_ == null) { - ensureSystraceIsMutable(); - systrace_.add(index, builderForValue.build()); - onChanged(); - } else { - systraceBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder addAllSystrace( - java.lang.Iterable<? extends com.android.vts.proto.VtsReportMessage.SystraceReportMessage> values) { - if (systraceBuilder_ == null) { - ensureSystraceIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, systrace_); - onChanged(); - } else { - systraceBuilder_.addAllMessages(values); - } - return this; - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder clearSystrace() { - if (systraceBuilder_ == null) { - systrace_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000040); - onChanged(); - } else { - systraceBuilder_.clear(); - } - return this; - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder removeSystrace(int index) { - if (systraceBuilder_ == null) { - ensureSystraceIsMutable(); - systrace_.remove(index); - onChanged(); - } else { - systraceBuilder_.remove(index); - } - return this; - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder getSystraceBuilder( - int index) { - return getSystraceFieldBuilder().getBuilder(index); - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder getSystraceOrBuilder( - int index) { - if (systraceBuilder_ == null) { - return systrace_.get(index); } else { - return systraceBuilder_.getMessageOrBuilder(index); - } - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public java.util.List<? extends com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder> - getSystraceOrBuilderList() { - if (systraceBuilder_ != null) { - return systraceBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(systrace_); - } - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder addSystraceBuilder() { - return getSystraceFieldBuilder().addBuilder( - com.android.vts.proto.VtsReportMessage.SystraceReportMessage.getDefaultInstance()); - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder addSystraceBuilder( - int index) { - return getSystraceFieldBuilder().addBuilder( - index, com.android.vts.proto.VtsReportMessage.SystraceReportMessage.getDefaultInstance()); - } - /** - * <pre> - * systrace report message per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 42 [deprecated = true];</code> - */ - @java.lang.Deprecated public java.util.List<com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder> - getSystraceBuilderList() { - return getSystraceFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.SystraceReportMessage, com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder, com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder> - getSystraceFieldBuilder() { - if (systraceBuilder_ == null) { - systraceBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.SystraceReportMessage, com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder, com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder>( - systrace_, - ((bitField0_ & 0x00000040) == 0x00000040), - getParentForChildren(), - isClean()); - systrace_ = null; - } - return systraceBuilder_; - } - - private java.util.List<com.android.vts.proto.VtsReportMessage.LogMessage> log_ = - java.util.Collections.emptyList(); - private void ensureLogIsMutable() { - if (!((bitField0_ & 0x00000080) == 0x00000080)) { - log_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.LogMessage>(log_); - bitField0_ |= 0x00000080; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.LogMessage, com.android.vts.proto.VtsReportMessage.LogMessage.Builder, com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder> logBuilder_; - - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.LogMessage> getLogList() { - if (logBuilder_ == null) { - return java.util.Collections.unmodifiableList(log_); - } else { - return logBuilder_.getMessageList(); - } - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public int getLogCount() { - if (logBuilder_ == null) { - return log_.size(); - } else { - return logBuilder_.getCount(); - } - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public com.android.vts.proto.VtsReportMessage.LogMessage getLog(int index) { - if (logBuilder_ == null) { - return log_.get(index); - } else { - return logBuilder_.getMessage(index); - } - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public Builder setLog( - int index, com.android.vts.proto.VtsReportMessage.LogMessage value) { - if (logBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureLogIsMutable(); - log_.set(index, value); - onChanged(); - } else { - logBuilder_.setMessage(index, value); - } - return this; - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public Builder setLog( - int index, com.android.vts.proto.VtsReportMessage.LogMessage.Builder builderForValue) { - if (logBuilder_ == null) { - ensureLogIsMutable(); - log_.set(index, builderForValue.build()); - onChanged(); - } else { - logBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public Builder addLog(com.android.vts.proto.VtsReportMessage.LogMessage value) { - if (logBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureLogIsMutable(); - log_.add(value); - onChanged(); - } else { - logBuilder_.addMessage(value); - } - return this; - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public Builder addLog( - int index, com.android.vts.proto.VtsReportMessage.LogMessage value) { - if (logBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureLogIsMutable(); - log_.add(index, value); - onChanged(); - } else { - logBuilder_.addMessage(index, value); - } - return this; - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public Builder addLog( - com.android.vts.proto.VtsReportMessage.LogMessage.Builder builderForValue) { - if (logBuilder_ == null) { - ensureLogIsMutable(); - log_.add(builderForValue.build()); - onChanged(); - } else { - logBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public Builder addLog( - int index, com.android.vts.proto.VtsReportMessage.LogMessage.Builder builderForValue) { - if (logBuilder_ == null) { - ensureLogIsMutable(); - log_.add(index, builderForValue.build()); - onChanged(); - } else { - logBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public Builder addAllLog( - java.lang.Iterable<? extends com.android.vts.proto.VtsReportMessage.LogMessage> values) { - if (logBuilder_ == null) { - ensureLogIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, log_); - onChanged(); - } else { - logBuilder_.addAllMessages(values); - } - return this; - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public Builder clearLog() { - if (logBuilder_ == null) { - log_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000080); - onChanged(); - } else { - logBuilder_.clear(); - } - return this; - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public Builder removeLog(int index) { - if (logBuilder_ == null) { - ensureLogIsMutable(); - log_.remove(index); - onChanged(); - } else { - logBuilder_.remove(index); - } - return this; - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public com.android.vts.proto.VtsReportMessage.LogMessage.Builder getLogBuilder( - int index) { - return getLogFieldBuilder().getBuilder(index); - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder getLogOrBuilder( - int index) { - if (logBuilder_ == null) { - return log_.get(index); } else { - return logBuilder_.getMessageOrBuilder(index); - } - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder> - getLogOrBuilderList() { - if (logBuilder_ != null) { - return logBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(log_); - } - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public com.android.vts.proto.VtsReportMessage.LogMessage.Builder addLogBuilder() { - return getLogFieldBuilder().addBuilder( - com.android.vts.proto.VtsReportMessage.LogMessage.getDefaultInstance()); - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public com.android.vts.proto.VtsReportMessage.LogMessage.Builder addLogBuilder( - int index) { - return getLogFieldBuilder().addBuilder( - index, com.android.vts.proto.VtsReportMessage.LogMessage.getDefaultInstance()); - } - /** - * <pre> - * log for each test case. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 101;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.LogMessage.Builder> - getLogBuilderList() { - return getLogFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.LogMessage, com.android.vts.proto.VtsReportMessage.LogMessage.Builder, com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder> - getLogFieldBuilder() { - if (logBuilder_ == null) { - logBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.LogMessage, com.android.vts.proto.VtsReportMessage.LogMessage.Builder, com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder>( - log_, - ((bitField0_ & 0x00000080) == 0x00000080), - getParentForChildren(), - isClean()); - log_ = null; - } - return logBuilder_; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:android.vts.TestCaseReportMessage) - } - - // @@protoc_insertion_point(class_scope:android.vts.TestCaseReportMessage) - private static final com.android.vts.proto.VtsReportMessage.TestCaseReportMessage DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.android.vts.proto.VtsReportMessage.TestCaseReportMessage(); - } - - public static com.android.vts.proto.VtsReportMessage.TestCaseReportMessage getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - @java.lang.Deprecated public static final com.google.protobuf.Parser<TestCaseReportMessage> - PARSER = new com.google.protobuf.AbstractParser<TestCaseReportMessage>() { - public TestCaseReportMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new TestCaseReportMessage(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser<TestCaseReportMessage> parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser<TestCaseReportMessage> getParserForType() { - return PARSER; - } - - public com.android.vts.proto.VtsReportMessage.TestCaseReportMessage getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface ProfilingReportMessageOrBuilder extends - // @@protoc_insertion_point(interface_extends:android.vts.ProfilingReportMessage) - com.google.protobuf.MessageOrBuilder { - - /** - * <pre> - * the instrumentation point name. - * </pre> - * - * <code>optional bytes name = 1;</code> - */ - boolean hasName(); - /** - * <pre> - * the instrumentation point name. - * </pre> - * - * <code>optional bytes name = 1;</code> - */ - com.google.protobuf.ByteString getName(); - - /** - * <code>optional .android.vts.VtsProfilingType type = 2;</code> - */ - boolean hasType(); - /** - * <code>optional .android.vts.VtsProfilingType type = 2;</code> - */ - com.android.vts.proto.VtsReportMessage.VtsProfilingType getType(); - - /** - * <code>optional .android.vts.VtsProfilingRegressionMode regression_mode = 3;</code> - */ - boolean hasRegressionMode(); - /** - * <code>optional .android.vts.VtsProfilingRegressionMode regression_mode = 3;</code> - */ - com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode getRegressionMode(); - - /** - * <pre> - * profiling start and end time stamp (for performance). - * </pre> - * - * <code>optional int64 start_timestamp = 11;</code> - */ - boolean hasStartTimestamp(); - /** - * <pre> - * profiling start and end time stamp (for performance). - * </pre> - * - * <code>optional int64 start_timestamp = 11;</code> - */ - long getStartTimestamp(); - - /** - * <code>optional int64 end_timestamp = 12;</code> - */ - boolean hasEndTimestamp(); - /** - * <code>optional int64 end_timestamp = 12;</code> - */ - long getEndTimestamp(); - - /** - * <code>repeated bytes label = 21;</code> - */ - java.util.List<com.google.protobuf.ByteString> getLabelList(); - /** - * <code>repeated bytes label = 21;</code> - */ - int getLabelCount(); - /** - * <code>repeated bytes label = 21;</code> - */ - com.google.protobuf.ByteString getLabel(int index); - - /** - * <code>repeated int64 value = 22;</code> - */ - java.util.List<java.lang.Long> getValueList(); - /** - * <code>repeated int64 value = 22;</code> - */ - int getValueCount(); - /** - * <code>repeated int64 value = 22;</code> - */ - long getValue(int index); - - /** - * <pre> - * x-axis and y-axis title labels when displaying the data as a graph - * </pre> - * - * <code>optional bytes x_axis_label = 31;</code> - */ - boolean hasXAxisLabel(); - /** - * <pre> - * x-axis and y-axis title labels when displaying the data as a graph - * </pre> - * - * <code>optional bytes x_axis_label = 31;</code> - */ - com.google.protobuf.ByteString getXAxisLabel(); - - /** - * <code>optional bytes y_axis_label = 32;</code> - */ - boolean hasYAxisLabel(); - /** - * <code>optional bytes y_axis_label = 32;</code> - */ - com.google.protobuf.ByteString getYAxisLabel(); - - /** - * <pre> - * a list of strings where each string has the form of 'key=value'. - * used to tell certain properties of the data (e.g., passthrough vs. - * binderized). - * </pre> - * - * <code>repeated bytes options = 41;</code> - */ - java.util.List<com.google.protobuf.ByteString> getOptionsList(); - /** - * <pre> - * a list of strings where each string has the form of 'key=value'. - * used to tell certain properties of the data (e.g., passthrough vs. - * binderized). - * </pre> - * - * <code>repeated bytes options = 41;</code> - */ - int getOptionsCount(); - /** - * <pre> - * a list of strings where each string has the form of 'key=value'. - * used to tell certain properties of the data (e.g., passthrough vs. - * binderized). - * </pre> - * - * <code>repeated bytes options = 41;</code> - */ - com.google.protobuf.ByteString getOptions(int index); - } - /** - * <pre> - * To specify a profiling report. - * </pre> - * - * Protobuf type {@code android.vts.ProfilingReportMessage} - */ - public static final class ProfilingReportMessage extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:android.vts.ProfilingReportMessage) - ProfilingReportMessageOrBuilder { - // Use ProfilingReportMessage.newBuilder() to construct. - private ProfilingReportMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { - super(builder); - } - private ProfilingReportMessage() { - name_ = com.google.protobuf.ByteString.EMPTY; - type_ = 0; - regressionMode_ = 0; - startTimestamp_ = 0L; - endTimestamp_ = 0L; - label_ = java.util.Collections.emptyList(); - value_ = java.util.Collections.emptyList(); - xAxisLabel_ = com.google.protobuf.ByteString.EMPTY; - yAxisLabel_ = com.google.protobuf.ByteString.EMPTY; - options_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private ProfilingReportMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - name_ = input.readBytes(); - break; - } - case 16: { - int rawValue = input.readEnum(); - com.android.vts.proto.VtsReportMessage.VtsProfilingType value = com.android.vts.proto.VtsReportMessage.VtsProfilingType.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(2, rawValue); - } else { - bitField0_ |= 0x00000002; - type_ = rawValue; - } - break; - } - case 24: { - int rawValue = input.readEnum(); - com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode value = com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(3, rawValue); - } else { - bitField0_ |= 0x00000004; - regressionMode_ = rawValue; - } - break; - } - case 88: { - bitField0_ |= 0x00000008; - startTimestamp_ = input.readInt64(); - break; - } - case 96: { - bitField0_ |= 0x00000010; - endTimestamp_ = input.readInt64(); - break; - } - case 170: { - if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { - label_ = new java.util.ArrayList<com.google.protobuf.ByteString>(); - mutable_bitField0_ |= 0x00000020; - } - label_.add(input.readBytes()); - break; - } - case 176: { - if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) { - value_ = new java.util.ArrayList<java.lang.Long>(); - mutable_bitField0_ |= 0x00000040; - } - value_.add(input.readInt64()); - break; - } - case 178: { - int length = input.readRawVarint32(); - int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00000040) == 0x00000040) && input.getBytesUntilLimit() > 0) { - value_ = new java.util.ArrayList<java.lang.Long>(); - mutable_bitField0_ |= 0x00000040; - } - while (input.getBytesUntilLimit() > 0) { - value_.add(input.readInt64()); - } - input.popLimit(limit); - break; - } - case 250: { - bitField0_ |= 0x00000020; - xAxisLabel_ = input.readBytes(); - break; - } - case 258: { - bitField0_ |= 0x00000040; - yAxisLabel_ = input.readBytes(); - break; - } - case 330: { - if (!((mutable_bitField0_ & 0x00000200) == 0x00000200)) { - options_ = new java.util.ArrayList<com.google.protobuf.ByteString>(); - mutable_bitField0_ |= 0x00000200; - } - options_.add(input.readBytes()); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { - label_ = java.util.Collections.unmodifiableList(label_); - } - if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) { - value_ = java.util.Collections.unmodifiableList(value_); - } - if (((mutable_bitField0_ & 0x00000200) == 0x00000200)) { - options_ = java.util.Collections.unmodifiableList(options_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_ProfilingReportMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_ProfilingReportMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.class, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder.class); - } - - private int bitField0_; - public static final int NAME_FIELD_NUMBER = 1; - private com.google.protobuf.ByteString name_; - /** - * <pre> - * the instrumentation point name. - * </pre> - * - * <code>optional bytes name = 1;</code> - */ - public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * the instrumentation point name. - * </pre> - * - * <code>optional bytes name = 1;</code> - */ - public com.google.protobuf.ByteString getName() { - return name_; - } - - public static final int TYPE_FIELD_NUMBER = 2; - private int type_; - /** - * <code>optional .android.vts.VtsProfilingType type = 2;</code> - */ - public boolean hasType() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <code>optional .android.vts.VtsProfilingType type = 2;</code> - */ - public com.android.vts.proto.VtsReportMessage.VtsProfilingType getType() { - com.android.vts.proto.VtsReportMessage.VtsProfilingType result = com.android.vts.proto.VtsReportMessage.VtsProfilingType.valueOf(type_); - return result == null ? com.android.vts.proto.VtsReportMessage.VtsProfilingType.UNKNOWN_VTS_PROFILING_TYPE : result; - } - - public static final int REGRESSION_MODE_FIELD_NUMBER = 3; - private int regressionMode_; - /** - * <code>optional .android.vts.VtsProfilingRegressionMode regression_mode = 3;</code> - */ - public boolean hasRegressionMode() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <code>optional .android.vts.VtsProfilingRegressionMode regression_mode = 3;</code> - */ - public com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode getRegressionMode() { - com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode result = com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode.valueOf(regressionMode_); - return result == null ? com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode.UNKNOWN_REGRESSION_MODE : result; - } - - public static final int START_TIMESTAMP_FIELD_NUMBER = 11; - private long startTimestamp_; - /** - * <pre> - * profiling start and end time stamp (for performance). - * </pre> - * - * <code>optional int64 start_timestamp = 11;</code> - */ - public boolean hasStartTimestamp() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <pre> - * profiling start and end time stamp (for performance). - * </pre> - * - * <code>optional int64 start_timestamp = 11;</code> - */ - public long getStartTimestamp() { - return startTimestamp_; - } - - public static final int END_TIMESTAMP_FIELD_NUMBER = 12; - private long endTimestamp_; - /** - * <code>optional int64 end_timestamp = 12;</code> - */ - public boolean hasEndTimestamp() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <code>optional int64 end_timestamp = 12;</code> - */ - public long getEndTimestamp() { - return endTimestamp_; - } - - public static final int LABEL_FIELD_NUMBER = 21; - private java.util.List<com.google.protobuf.ByteString> label_; - /** - * <code>repeated bytes label = 21;</code> - */ - public java.util.List<com.google.protobuf.ByteString> - getLabelList() { - return label_; - } - /** - * <code>repeated bytes label = 21;</code> - */ - public int getLabelCount() { - return label_.size(); - } - /** - * <code>repeated bytes label = 21;</code> - */ - public com.google.protobuf.ByteString getLabel(int index) { - return label_.get(index); - } - - public static final int VALUE_FIELD_NUMBER = 22; - private java.util.List<java.lang.Long> value_; - /** - * <code>repeated int64 value = 22;</code> - */ - public java.util.List<java.lang.Long> - getValueList() { - return value_; - } - /** - * <code>repeated int64 value = 22;</code> - */ - public int getValueCount() { - return value_.size(); - } - /** - * <code>repeated int64 value = 22;</code> - */ - public long getValue(int index) { - return value_.get(index); - } - - public static final int X_AXIS_LABEL_FIELD_NUMBER = 31; - private com.google.protobuf.ByteString xAxisLabel_; - /** - * <pre> - * x-axis and y-axis title labels when displaying the data as a graph - * </pre> - * - * <code>optional bytes x_axis_label = 31;</code> - */ - public boolean hasXAxisLabel() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - /** - * <pre> - * x-axis and y-axis title labels when displaying the data as a graph - * </pre> - * - * <code>optional bytes x_axis_label = 31;</code> - */ - public com.google.protobuf.ByteString getXAxisLabel() { - return xAxisLabel_; - } - - public static final int Y_AXIS_LABEL_FIELD_NUMBER = 32; - private com.google.protobuf.ByteString yAxisLabel_; - /** - * <code>optional bytes y_axis_label = 32;</code> - */ - public boolean hasYAxisLabel() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - /** - * <code>optional bytes y_axis_label = 32;</code> - */ - public com.google.protobuf.ByteString getYAxisLabel() { - return yAxisLabel_; - } - - public static final int OPTIONS_FIELD_NUMBER = 41; - private java.util.List<com.google.protobuf.ByteString> options_; - /** - * <pre> - * a list of strings where each string has the form of 'key=value'. - * used to tell certain properties of the data (e.g., passthrough vs. - * binderized). - * </pre> - * - * <code>repeated bytes options = 41;</code> - */ - public java.util.List<com.google.protobuf.ByteString> - getOptionsList() { - return options_; - } - /** - * <pre> - * a list of strings where each string has the form of 'key=value'. - * used to tell certain properties of the data (e.g., passthrough vs. - * binderized). - * </pre> - * - * <code>repeated bytes options = 41;</code> - */ - public int getOptionsCount() { - return options_.size(); - } - /** - * <pre> - * a list of strings where each string has the form of 'key=value'. - * used to tell certain properties of the data (e.g., passthrough vs. - * binderized). - * </pre> - * - * <code>repeated bytes options = 41;</code> - */ - public com.google.protobuf.ByteString getOptions(int index) { - return options_.get(index); - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, name_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeEnum(2, type_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeEnum(3, regressionMode_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeInt64(11, startTimestamp_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeInt64(12, endTimestamp_); - } - for (int i = 0; i < label_.size(); i++) { - output.writeBytes(21, label_.get(i)); - } - for (int i = 0; i < value_.size(); i++) { - output.writeInt64(22, value_.get(i)); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - output.writeBytes(31, xAxisLabel_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - output.writeBytes(32, yAxisLabel_); - } - for (int i = 0; i < options_.size(); i++) { - output.writeBytes(41, options_.get(i)); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, name_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(2, type_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(3, regressionMode_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(11, startTimestamp_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(12, endTimestamp_); - } - { - int dataSize = 0; - for (int i = 0; i < label_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeBytesSizeNoTag(label_.get(i)); - } - size += dataSize; - size += 2 * getLabelList().size(); - } - { - int dataSize = 0; - for (int i = 0; i < value_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeInt64SizeNoTag(value_.get(i)); - } - size += dataSize; - size += 2 * getValueList().size(); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(31, xAxisLabel_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(32, yAxisLabel_); - } - { - int dataSize = 0; - for (int i = 0; i < options_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeBytesSizeNoTag(options_.get(i)); - } - size += dataSize; - size += 2 * getOptionsList().size(); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.android.vts.proto.VtsReportMessage.ProfilingReportMessage)) { - return super.equals(obj); - } - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage other = (com.android.vts.proto.VtsReportMessage.ProfilingReportMessage) obj; - - boolean result = true; - result = result && (hasName() == other.hasName()); - if (hasName()) { - result = result && getName() - .equals(other.getName()); - } - result = result && (hasType() == other.hasType()); - if (hasType()) { - result = result && type_ == other.type_; - } - result = result && (hasRegressionMode() == other.hasRegressionMode()); - if (hasRegressionMode()) { - result = result && regressionMode_ == other.regressionMode_; - } - result = result && (hasStartTimestamp() == other.hasStartTimestamp()); - if (hasStartTimestamp()) { - result = result && (getStartTimestamp() - == other.getStartTimestamp()); - } - result = result && (hasEndTimestamp() == other.hasEndTimestamp()); - if (hasEndTimestamp()) { - result = result && (getEndTimestamp() - == other.getEndTimestamp()); - } - result = result && getLabelList() - .equals(other.getLabelList()); - result = result && getValueList() - .equals(other.getValueList()); - result = result && (hasXAxisLabel() == other.hasXAxisLabel()); - if (hasXAxisLabel()) { - result = result && getXAxisLabel() - .equals(other.getXAxisLabel()); - } - result = result && (hasYAxisLabel() == other.hasYAxisLabel()); - if (hasYAxisLabel()) { - result = result && getYAxisLabel() - .equals(other.getYAxisLabel()); - } - result = result && getOptionsList() - .equals(other.getOptionsList()); - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - if (hasName()) { - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - } - if (hasType()) { - hash = (37 * hash) + TYPE_FIELD_NUMBER; - hash = (53 * hash) + type_; - } - if (hasRegressionMode()) { - hash = (37 * hash) + REGRESSION_MODE_FIELD_NUMBER; - hash = (53 * hash) + regressionMode_; - } - if (hasStartTimestamp()) { - hash = (37 * hash) + START_TIMESTAMP_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getStartTimestamp()); - } - if (hasEndTimestamp()) { - hash = (37 * hash) + END_TIMESTAMP_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getEndTimestamp()); - } - if (getLabelCount() > 0) { - hash = (37 * hash) + LABEL_FIELD_NUMBER; - hash = (53 * hash) + getLabelList().hashCode(); - } - if (getValueCount() > 0) { - hash = (37 * hash) + VALUE_FIELD_NUMBER; - hash = (53 * hash) + getValueList().hashCode(); - } - if (hasXAxisLabel()) { - hash = (37 * hash) + X_AXIS_LABEL_FIELD_NUMBER; - hash = (53 * hash) + getXAxisLabel().hashCode(); - } - if (hasYAxisLabel()) { - hash = (37 * hash) + Y_AXIS_LABEL_FIELD_NUMBER; - hash = (53 * hash) + getYAxisLabel().hashCode(); - } - if (getOptionsCount() > 0) { - hash = (37 * hash) + OPTIONS_FIELD_NUMBER; - hash = (53 * hash) + getOptionsList().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.android.vts.proto.VtsReportMessage.ProfilingReportMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.ProfilingReportMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.ProfilingReportMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.ProfilingReportMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.ProfilingReportMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.ProfilingReportMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.ProfilingReportMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.ProfilingReportMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.ProfilingReportMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.ProfilingReportMessage parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.android.vts.proto.VtsReportMessage.ProfilingReportMessage prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * <pre> - * To specify a profiling report. - * </pre> - * - * Protobuf type {@code android.vts.ProfilingReportMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements - // @@protoc_insertion_point(builder_implements:android.vts.ProfilingReportMessage) - com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_ProfilingReportMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_ProfilingReportMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.class, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder.class); - } - - // Construct using com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - name_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - type_ = 0; - bitField0_ = (bitField0_ & ~0x00000002); - regressionMode_ = 0; - bitField0_ = (bitField0_ & ~0x00000004); - startTimestamp_ = 0L; - bitField0_ = (bitField0_ & ~0x00000008); - endTimestamp_ = 0L; - bitField0_ = (bitField0_ & ~0x00000010); - label_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - value_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000040); - xAxisLabel_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000080); - yAxisLabel_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000100); - options_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000200); - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_ProfilingReportMessage_descriptor; - } - - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessage getDefaultInstanceForType() { - return com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.getDefaultInstance(); - } - - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessage build() { - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessage buildPartial() { - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage result = new com.android.vts.proto.VtsReportMessage.ProfilingReportMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.name_ = name_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.type_ = type_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.regressionMode_ = regressionMode_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.startTimestamp_ = startTimestamp_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.endTimestamp_ = endTimestamp_; - if (((bitField0_ & 0x00000020) == 0x00000020)) { - label_ = java.util.Collections.unmodifiableList(label_); - bitField0_ = (bitField0_ & ~0x00000020); - } - result.label_ = label_; - if (((bitField0_ & 0x00000040) == 0x00000040)) { - value_ = java.util.Collections.unmodifiableList(value_); - bitField0_ = (bitField0_ & ~0x00000040); - } - result.value_ = value_; - if (((from_bitField0_ & 0x00000080) == 0x00000080)) { - to_bitField0_ |= 0x00000020; - } - result.xAxisLabel_ = xAxisLabel_; - if (((from_bitField0_ & 0x00000100) == 0x00000100)) { - to_bitField0_ |= 0x00000040; - } - result.yAxisLabel_ = yAxisLabel_; - if (((bitField0_ & 0x00000200) == 0x00000200)) { - options_ = java.util.Collections.unmodifiableList(options_); - bitField0_ = (bitField0_ & ~0x00000200); - } - result.options_ = options_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.android.vts.proto.VtsReportMessage.ProfilingReportMessage) { - return mergeFrom((com.android.vts.proto.VtsReportMessage.ProfilingReportMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.android.vts.proto.VtsReportMessage.ProfilingReportMessage other) { - if (other == com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.getDefaultInstance()) return this; - if (other.hasName()) { - setName(other.getName()); - } - if (other.hasType()) { - setType(other.getType()); - } - if (other.hasRegressionMode()) { - setRegressionMode(other.getRegressionMode()); - } - if (other.hasStartTimestamp()) { - setStartTimestamp(other.getStartTimestamp()); - } - if (other.hasEndTimestamp()) { - setEndTimestamp(other.getEndTimestamp()); - } - if (!other.label_.isEmpty()) { - if (label_.isEmpty()) { - label_ = other.label_; - bitField0_ = (bitField0_ & ~0x00000020); - } else { - ensureLabelIsMutable(); - label_.addAll(other.label_); - } - onChanged(); - } - if (!other.value_.isEmpty()) { - if (value_.isEmpty()) { - value_ = other.value_; - bitField0_ = (bitField0_ & ~0x00000040); - } else { - ensureValueIsMutable(); - value_.addAll(other.value_); - } - onChanged(); - } - if (other.hasXAxisLabel()) { - setXAxisLabel(other.getXAxisLabel()); - } - if (other.hasYAxisLabel()) { - setYAxisLabel(other.getYAxisLabel()); - } - if (!other.options_.isEmpty()) { - if (options_.isEmpty()) { - options_ = other.options_; - bitField0_ = (bitField0_ & ~0x00000200); - } else { - ensureOptionsIsMutable(); - options_.addAll(other.options_); - } - onChanged(); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.android.vts.proto.VtsReportMessage.ProfilingReportMessage) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private com.google.protobuf.ByteString name_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * the instrumentation point name. - * </pre> - * - * <code>optional bytes name = 1;</code> - */ - public boolean hasName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * the instrumentation point name. - * </pre> - * - * <code>optional bytes name = 1;</code> - */ - public com.google.protobuf.ByteString getName() { - return name_; - } - /** - * <pre> - * the instrumentation point name. - * </pre> - * - * <code>optional bytes name = 1;</code> - */ - public Builder setName(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - name_ = value; - onChanged(); - return this; - } - /** - * <pre> - * the instrumentation point name. - * </pre> - * - * <code>optional bytes name = 1;</code> - */ - public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000001); - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - - private int type_ = 0; - /** - * <code>optional .android.vts.VtsProfilingType type = 2;</code> - */ - public boolean hasType() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <code>optional .android.vts.VtsProfilingType type = 2;</code> - */ - public com.android.vts.proto.VtsReportMessage.VtsProfilingType getType() { - com.android.vts.proto.VtsReportMessage.VtsProfilingType result = com.android.vts.proto.VtsReportMessage.VtsProfilingType.valueOf(type_); - return result == null ? com.android.vts.proto.VtsReportMessage.VtsProfilingType.UNKNOWN_VTS_PROFILING_TYPE : result; - } - /** - * <code>optional .android.vts.VtsProfilingType type = 2;</code> - */ - public Builder setType(com.android.vts.proto.VtsReportMessage.VtsProfilingType value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - type_ = value.getNumber(); - onChanged(); - return this; - } - /** - * <code>optional .android.vts.VtsProfilingType type = 2;</code> - */ - public Builder clearType() { - bitField0_ = (bitField0_ & ~0x00000002); - type_ = 0; - onChanged(); - return this; - } - - private int regressionMode_ = 0; - /** - * <code>optional .android.vts.VtsProfilingRegressionMode regression_mode = 3;</code> - */ - public boolean hasRegressionMode() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <code>optional .android.vts.VtsProfilingRegressionMode regression_mode = 3;</code> - */ - public com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode getRegressionMode() { - com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode result = com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode.valueOf(regressionMode_); - return result == null ? com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode.UNKNOWN_REGRESSION_MODE : result; - } - /** - * <code>optional .android.vts.VtsProfilingRegressionMode regression_mode = 3;</code> - */ - public Builder setRegressionMode(com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - regressionMode_ = value.getNumber(); - onChanged(); - return this; - } - /** - * <code>optional .android.vts.VtsProfilingRegressionMode regression_mode = 3;</code> - */ - public Builder clearRegressionMode() { - bitField0_ = (bitField0_ & ~0x00000004); - regressionMode_ = 0; - onChanged(); - return this; - } - - private long startTimestamp_ ; - /** - * <pre> - * profiling start and end time stamp (for performance). - * </pre> - * - * <code>optional int64 start_timestamp = 11;</code> - */ - public boolean hasStartTimestamp() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <pre> - * profiling start and end time stamp (for performance). - * </pre> - * - * <code>optional int64 start_timestamp = 11;</code> - */ - public long getStartTimestamp() { - return startTimestamp_; - } - /** - * <pre> - * profiling start and end time stamp (for performance). - * </pre> - * - * <code>optional int64 start_timestamp = 11;</code> - */ - public Builder setStartTimestamp(long value) { - bitField0_ |= 0x00000008; - startTimestamp_ = value; - onChanged(); - return this; - } - /** - * <pre> - * profiling start and end time stamp (for performance). - * </pre> - * - * <code>optional int64 start_timestamp = 11;</code> - */ - public Builder clearStartTimestamp() { - bitField0_ = (bitField0_ & ~0x00000008); - startTimestamp_ = 0L; - onChanged(); - return this; - } - - private long endTimestamp_ ; - /** - * <code>optional int64 end_timestamp = 12;</code> - */ - public boolean hasEndTimestamp() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <code>optional int64 end_timestamp = 12;</code> - */ - public long getEndTimestamp() { - return endTimestamp_; - } - /** - * <code>optional int64 end_timestamp = 12;</code> - */ - public Builder setEndTimestamp(long value) { - bitField0_ |= 0x00000010; - endTimestamp_ = value; - onChanged(); - return this; - } - /** - * <code>optional int64 end_timestamp = 12;</code> - */ - public Builder clearEndTimestamp() { - bitField0_ = (bitField0_ & ~0x00000010); - endTimestamp_ = 0L; - onChanged(); - return this; - } - - private java.util.List<com.google.protobuf.ByteString> label_ = java.util.Collections.emptyList(); - private void ensureLabelIsMutable() { - if (!((bitField0_ & 0x00000020) == 0x00000020)) { - label_ = new java.util.ArrayList<com.google.protobuf.ByteString>(label_); - bitField0_ |= 0x00000020; - } - } - /** - * <code>repeated bytes label = 21;</code> - */ - public java.util.List<com.google.protobuf.ByteString> - getLabelList() { - return java.util.Collections.unmodifiableList(label_); - } - /** - * <code>repeated bytes label = 21;</code> - */ - public int getLabelCount() { - return label_.size(); - } - /** - * <code>repeated bytes label = 21;</code> - */ - public com.google.protobuf.ByteString getLabel(int index) { - return label_.get(index); - } - /** - * <code>repeated bytes label = 21;</code> - */ - public Builder setLabel( - int index, com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureLabelIsMutable(); - label_.set(index, value); - onChanged(); - return this; - } - /** - * <code>repeated bytes label = 21;</code> - */ - public Builder addLabel(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureLabelIsMutable(); - label_.add(value); - onChanged(); - return this; - } - /** - * <code>repeated bytes label = 21;</code> - */ - public Builder addAllLabel( - java.lang.Iterable<? extends com.google.protobuf.ByteString> values) { - ensureLabelIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, label_); - onChanged(); - return this; - } - /** - * <code>repeated bytes label = 21;</code> - */ - public Builder clearLabel() { - label_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - onChanged(); - return this; - } - - private java.util.List<java.lang.Long> value_ = java.util.Collections.emptyList(); - private void ensureValueIsMutable() { - if (!((bitField0_ & 0x00000040) == 0x00000040)) { - value_ = new java.util.ArrayList<java.lang.Long>(value_); - bitField0_ |= 0x00000040; - } - } - /** - * <code>repeated int64 value = 22;</code> - */ - public java.util.List<java.lang.Long> - getValueList() { - return java.util.Collections.unmodifiableList(value_); - } - /** - * <code>repeated int64 value = 22;</code> - */ - public int getValueCount() { - return value_.size(); - } - /** - * <code>repeated int64 value = 22;</code> - */ - public long getValue(int index) { - return value_.get(index); - } - /** - * <code>repeated int64 value = 22;</code> - */ - public Builder setValue( - int index, long value) { - ensureValueIsMutable(); - value_.set(index, value); - onChanged(); - return this; - } - /** - * <code>repeated int64 value = 22;</code> - */ - public Builder addValue(long value) { - ensureValueIsMutable(); - value_.add(value); - onChanged(); - return this; - } - /** - * <code>repeated int64 value = 22;</code> - */ - public Builder addAllValue( - java.lang.Iterable<? extends java.lang.Long> values) { - ensureValueIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, value_); - onChanged(); - return this; - } - /** - * <code>repeated int64 value = 22;</code> - */ - public Builder clearValue() { - value_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000040); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString xAxisLabel_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * x-axis and y-axis title labels when displaying the data as a graph - * </pre> - * - * <code>optional bytes x_axis_label = 31;</code> - */ - public boolean hasXAxisLabel() { - return ((bitField0_ & 0x00000080) == 0x00000080); - } - /** - * <pre> - * x-axis and y-axis title labels when displaying the data as a graph - * </pre> - * - * <code>optional bytes x_axis_label = 31;</code> - */ - public com.google.protobuf.ByteString getXAxisLabel() { - return xAxisLabel_; - } - /** - * <pre> - * x-axis and y-axis title labels when displaying the data as a graph - * </pre> - * - * <code>optional bytes x_axis_label = 31;</code> - */ - public Builder setXAxisLabel(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000080; - xAxisLabel_ = value; - onChanged(); - return this; - } - /** - * <pre> - * x-axis and y-axis title labels when displaying the data as a graph - * </pre> - * - * <code>optional bytes x_axis_label = 31;</code> - */ - public Builder clearXAxisLabel() { - bitField0_ = (bitField0_ & ~0x00000080); - xAxisLabel_ = getDefaultInstance().getXAxisLabel(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString yAxisLabel_ = com.google.protobuf.ByteString.EMPTY; - /** - * <code>optional bytes y_axis_label = 32;</code> - */ - public boolean hasYAxisLabel() { - return ((bitField0_ & 0x00000100) == 0x00000100); - } - /** - * <code>optional bytes y_axis_label = 32;</code> - */ - public com.google.protobuf.ByteString getYAxisLabel() { - return yAxisLabel_; - } - /** - * <code>optional bytes y_axis_label = 32;</code> - */ - public Builder setYAxisLabel(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000100; - yAxisLabel_ = value; - onChanged(); - return this; - } - /** - * <code>optional bytes y_axis_label = 32;</code> - */ - public Builder clearYAxisLabel() { - bitField0_ = (bitField0_ & ~0x00000100); - yAxisLabel_ = getDefaultInstance().getYAxisLabel(); - onChanged(); - return this; - } - - private java.util.List<com.google.protobuf.ByteString> options_ = java.util.Collections.emptyList(); - private void ensureOptionsIsMutable() { - if (!((bitField0_ & 0x00000200) == 0x00000200)) { - options_ = new java.util.ArrayList<com.google.protobuf.ByteString>(options_); - bitField0_ |= 0x00000200; - } - } - /** - * <pre> - * a list of strings where each string has the form of 'key=value'. - * used to tell certain properties of the data (e.g., passthrough vs. - * binderized). - * </pre> - * - * <code>repeated bytes options = 41;</code> - */ - public java.util.List<com.google.protobuf.ByteString> - getOptionsList() { - return java.util.Collections.unmodifiableList(options_); - } - /** - * <pre> - * a list of strings where each string has the form of 'key=value'. - * used to tell certain properties of the data (e.g., passthrough vs. - * binderized). - * </pre> - * - * <code>repeated bytes options = 41;</code> - */ - public int getOptionsCount() { - return options_.size(); - } - /** - * <pre> - * a list of strings where each string has the form of 'key=value'. - * used to tell certain properties of the data (e.g., passthrough vs. - * binderized). - * </pre> - * - * <code>repeated bytes options = 41;</code> - */ - public com.google.protobuf.ByteString getOptions(int index) { - return options_.get(index); - } - /** - * <pre> - * a list of strings where each string has the form of 'key=value'. - * used to tell certain properties of the data (e.g., passthrough vs. - * binderized). - * </pre> - * - * <code>repeated bytes options = 41;</code> - */ - public Builder setOptions( - int index, com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureOptionsIsMutable(); - options_.set(index, value); - onChanged(); - return this; - } - /** - * <pre> - * a list of strings where each string has the form of 'key=value'. - * used to tell certain properties of the data (e.g., passthrough vs. - * binderized). - * </pre> - * - * <code>repeated bytes options = 41;</code> - */ - public Builder addOptions(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureOptionsIsMutable(); - options_.add(value); - onChanged(); - return this; - } - /** - * <pre> - * a list of strings where each string has the form of 'key=value'. - * used to tell certain properties of the data (e.g., passthrough vs. - * binderized). - * </pre> - * - * <code>repeated bytes options = 41;</code> - */ - public Builder addAllOptions( - java.lang.Iterable<? extends com.google.protobuf.ByteString> values) { - ensureOptionsIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, options_); - onChanged(); - return this; - } - /** - * <pre> - * a list of strings where each string has the form of 'key=value'. - * used to tell certain properties of the data (e.g., passthrough vs. - * binderized). - * </pre> - * - * <code>repeated bytes options = 41;</code> - */ - public Builder clearOptions() { - options_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000200); - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:android.vts.ProfilingReportMessage) - } - - // @@protoc_insertion_point(class_scope:android.vts.ProfilingReportMessage) - private static final com.android.vts.proto.VtsReportMessage.ProfilingReportMessage DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.android.vts.proto.VtsReportMessage.ProfilingReportMessage(); - } - - public static com.android.vts.proto.VtsReportMessage.ProfilingReportMessage getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - @java.lang.Deprecated public static final com.google.protobuf.Parser<ProfilingReportMessage> - PARSER = new com.google.protobuf.AbstractParser<ProfilingReportMessage>() { - public ProfilingReportMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new ProfilingReportMessage(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser<ProfilingReportMessage> parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser<ProfilingReportMessage> getParserForType() { - return PARSER; - } - - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessage getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface SystraceReportMessageOrBuilder extends - // @@protoc_insertion_point(interface_extends:android.vts.SystraceReportMessage) - com.google.protobuf.MessageOrBuilder { - - /** - * <pre> - * the target process name used by systrace - * </pre> - * - * <code>optional bytes process_name = 1;</code> - */ - boolean hasProcessName(); - /** - * <pre> - * the target process name used by systrace - * </pre> - * - * <code>optional bytes process_name = 1;</code> - */ - com.google.protobuf.ByteString getProcessName(); - - /** - * <pre> - * the produced html report - * </pre> - * - * <code>repeated bytes html = 11;</code> - */ - java.util.List<com.google.protobuf.ByteString> getHtmlList(); - /** - * <pre> - * the produced html report - * </pre> - * - * <code>repeated bytes html = 11;</code> - */ - int getHtmlCount(); - /** - * <pre> - * the produced html report - * </pre> - * - * <code>repeated bytes html = 11;</code> - */ - com.google.protobuf.ByteString getHtml(int index); - - /** - * <pre> - * URLs of the produced html reports - * </pre> - * - * <code>repeated bytes url = 21;</code> - */ - java.util.List<com.google.protobuf.ByteString> getUrlList(); - /** - * <pre> - * URLs of the produced html reports - * </pre> - * - * <code>repeated bytes url = 21;</code> - */ - int getUrlCount(); - /** - * <pre> - * URLs of the produced html reports - * </pre> - * - * <code>repeated bytes url = 21;</code> - */ - com.google.protobuf.ByteString getUrl(int index); - } - /** - * <pre> - * To specify a systrace report. - * </pre> - * - * Protobuf type {@code android.vts.SystraceReportMessage} - */ - public static final class SystraceReportMessage extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:android.vts.SystraceReportMessage) - SystraceReportMessageOrBuilder { - // Use SystraceReportMessage.newBuilder() to construct. - private SystraceReportMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { - super(builder); - } - private SystraceReportMessage() { - processName_ = com.google.protobuf.ByteString.EMPTY; - html_ = java.util.Collections.emptyList(); - url_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private SystraceReportMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - processName_ = input.readBytes(); - break; - } - case 90: { - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - html_ = new java.util.ArrayList<com.google.protobuf.ByteString>(); - mutable_bitField0_ |= 0x00000002; - } - html_.add(input.readBytes()); - break; - } - case 170: { - if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - url_ = new java.util.ArrayList<com.google.protobuf.ByteString>(); - mutable_bitField0_ |= 0x00000004; - } - url_.add(input.readBytes()); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - html_ = java.util.Collections.unmodifiableList(html_); - } - if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - url_ = java.util.Collections.unmodifiableList(url_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_SystraceReportMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_SystraceReportMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.SystraceReportMessage.class, com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder.class); - } - - private int bitField0_; - public static final int PROCESS_NAME_FIELD_NUMBER = 1; - private com.google.protobuf.ByteString processName_; - /** - * <pre> - * the target process name used by systrace - * </pre> - * - * <code>optional bytes process_name = 1;</code> - */ - public boolean hasProcessName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * the target process name used by systrace - * </pre> - * - * <code>optional bytes process_name = 1;</code> - */ - public com.google.protobuf.ByteString getProcessName() { - return processName_; - } - - public static final int HTML_FIELD_NUMBER = 11; - private java.util.List<com.google.protobuf.ByteString> html_; - /** - * <pre> - * the produced html report - * </pre> - * - * <code>repeated bytes html = 11;</code> - */ - public java.util.List<com.google.protobuf.ByteString> - getHtmlList() { - return html_; - } - /** - * <pre> - * the produced html report - * </pre> - * - * <code>repeated bytes html = 11;</code> - */ - public int getHtmlCount() { - return html_.size(); - } - /** - * <pre> - * the produced html report - * </pre> - * - * <code>repeated bytes html = 11;</code> - */ - public com.google.protobuf.ByteString getHtml(int index) { - return html_.get(index); - } - - public static final int URL_FIELD_NUMBER = 21; - private java.util.List<com.google.protobuf.ByteString> url_; - /** - * <pre> - * URLs of the produced html reports - * </pre> - * - * <code>repeated bytes url = 21;</code> - */ - public java.util.List<com.google.protobuf.ByteString> - getUrlList() { - return url_; - } - /** - * <pre> - * URLs of the produced html reports - * </pre> - * - * <code>repeated bytes url = 21;</code> - */ - public int getUrlCount() { - return url_.size(); - } - /** - * <pre> - * URLs of the produced html reports - * </pre> - * - * <code>repeated bytes url = 21;</code> - */ - public com.google.protobuf.ByteString getUrl(int index) { - return url_.get(index); - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, processName_); - } - for (int i = 0; i < html_.size(); i++) { - output.writeBytes(11, html_.get(i)); - } - for (int i = 0; i < url_.size(); i++) { - output.writeBytes(21, url_.get(i)); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, processName_); - } - { - int dataSize = 0; - for (int i = 0; i < html_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeBytesSizeNoTag(html_.get(i)); - } - size += dataSize; - size += 1 * getHtmlList().size(); - } - { - int dataSize = 0; - for (int i = 0; i < url_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeBytesSizeNoTag(url_.get(i)); - } - size += dataSize; - size += 2 * getUrlList().size(); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.android.vts.proto.VtsReportMessage.SystraceReportMessage)) { - return super.equals(obj); - } - com.android.vts.proto.VtsReportMessage.SystraceReportMessage other = (com.android.vts.proto.VtsReportMessage.SystraceReportMessage) obj; - - boolean result = true; - result = result && (hasProcessName() == other.hasProcessName()); - if (hasProcessName()) { - result = result && getProcessName() - .equals(other.getProcessName()); - } - result = result && getHtmlList() - .equals(other.getHtmlList()); - result = result && getUrlList() - .equals(other.getUrlList()); - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - if (hasProcessName()) { - hash = (37 * hash) + PROCESS_NAME_FIELD_NUMBER; - hash = (53 * hash) + getProcessName().hashCode(); - } - if (getHtmlCount() > 0) { - hash = (37 * hash) + HTML_FIELD_NUMBER; - hash = (53 * hash) + getHtmlList().hashCode(); - } - if (getUrlCount() > 0) { - hash = (37 * hash) + URL_FIELD_NUMBER; - hash = (53 * hash) + getUrlList().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.android.vts.proto.VtsReportMessage.SystraceReportMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.SystraceReportMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.SystraceReportMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.SystraceReportMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.SystraceReportMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.SystraceReportMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.SystraceReportMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.SystraceReportMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.SystraceReportMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.SystraceReportMessage parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.android.vts.proto.VtsReportMessage.SystraceReportMessage prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * <pre> - * To specify a systrace report. - * </pre> - * - * Protobuf type {@code android.vts.SystraceReportMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements - // @@protoc_insertion_point(builder_implements:android.vts.SystraceReportMessage) - com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_SystraceReportMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_SystraceReportMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.SystraceReportMessage.class, com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder.class); - } - - // Construct using com.android.vts.proto.VtsReportMessage.SystraceReportMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - processName_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - html_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - url_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_SystraceReportMessage_descriptor; - } - - public com.android.vts.proto.VtsReportMessage.SystraceReportMessage getDefaultInstanceForType() { - return com.android.vts.proto.VtsReportMessage.SystraceReportMessage.getDefaultInstance(); - } - - public com.android.vts.proto.VtsReportMessage.SystraceReportMessage build() { - com.android.vts.proto.VtsReportMessage.SystraceReportMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.android.vts.proto.VtsReportMessage.SystraceReportMessage buildPartial() { - com.android.vts.proto.VtsReportMessage.SystraceReportMessage result = new com.android.vts.proto.VtsReportMessage.SystraceReportMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.processName_ = processName_; - if (((bitField0_ & 0x00000002) == 0x00000002)) { - html_ = java.util.Collections.unmodifiableList(html_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.html_ = html_; - if (((bitField0_ & 0x00000004) == 0x00000004)) { - url_ = java.util.Collections.unmodifiableList(url_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.url_ = url_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.android.vts.proto.VtsReportMessage.SystraceReportMessage) { - return mergeFrom((com.android.vts.proto.VtsReportMessage.SystraceReportMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.android.vts.proto.VtsReportMessage.SystraceReportMessage other) { - if (other == com.android.vts.proto.VtsReportMessage.SystraceReportMessage.getDefaultInstance()) return this; - if (other.hasProcessName()) { - setProcessName(other.getProcessName()); - } - if (!other.html_.isEmpty()) { - if (html_.isEmpty()) { - html_ = other.html_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureHtmlIsMutable(); - html_.addAll(other.html_); - } - onChanged(); - } - if (!other.url_.isEmpty()) { - if (url_.isEmpty()) { - url_ = other.url_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureUrlIsMutable(); - url_.addAll(other.url_); - } - onChanged(); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.android.vts.proto.VtsReportMessage.SystraceReportMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.android.vts.proto.VtsReportMessage.SystraceReportMessage) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private com.google.protobuf.ByteString processName_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * the target process name used by systrace - * </pre> - * - * <code>optional bytes process_name = 1;</code> - */ - public boolean hasProcessName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * the target process name used by systrace - * </pre> - * - * <code>optional bytes process_name = 1;</code> - */ - public com.google.protobuf.ByteString getProcessName() { - return processName_; - } - /** - * <pre> - * the target process name used by systrace - * </pre> - * - * <code>optional bytes process_name = 1;</code> - */ - public Builder setProcessName(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - processName_ = value; - onChanged(); - return this; - } - /** - * <pre> - * the target process name used by systrace - * </pre> - * - * <code>optional bytes process_name = 1;</code> - */ - public Builder clearProcessName() { - bitField0_ = (bitField0_ & ~0x00000001); - processName_ = getDefaultInstance().getProcessName(); - onChanged(); - return this; - } - - private java.util.List<com.google.protobuf.ByteString> html_ = java.util.Collections.emptyList(); - private void ensureHtmlIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - html_ = new java.util.ArrayList<com.google.protobuf.ByteString>(html_); - bitField0_ |= 0x00000002; - } - } - /** - * <pre> - * the produced html report - * </pre> - * - * <code>repeated bytes html = 11;</code> - */ - public java.util.List<com.google.protobuf.ByteString> - getHtmlList() { - return java.util.Collections.unmodifiableList(html_); - } - /** - * <pre> - * the produced html report - * </pre> - * - * <code>repeated bytes html = 11;</code> - */ - public int getHtmlCount() { - return html_.size(); - } - /** - * <pre> - * the produced html report - * </pre> - * - * <code>repeated bytes html = 11;</code> - */ - public com.google.protobuf.ByteString getHtml(int index) { - return html_.get(index); - } - /** - * <pre> - * the produced html report - * </pre> - * - * <code>repeated bytes html = 11;</code> - */ - public Builder setHtml( - int index, com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureHtmlIsMutable(); - html_.set(index, value); - onChanged(); - return this; - } - /** - * <pre> - * the produced html report - * </pre> - * - * <code>repeated bytes html = 11;</code> - */ - public Builder addHtml(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureHtmlIsMutable(); - html_.add(value); - onChanged(); - return this; - } - /** - * <pre> - * the produced html report - * </pre> - * - * <code>repeated bytes html = 11;</code> - */ - public Builder addAllHtml( - java.lang.Iterable<? extends com.google.protobuf.ByteString> values) { - ensureHtmlIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, html_); - onChanged(); - return this; - } - /** - * <pre> - * the produced html report - * </pre> - * - * <code>repeated bytes html = 11;</code> - */ - public Builder clearHtml() { - html_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - return this; - } - - private java.util.List<com.google.protobuf.ByteString> url_ = java.util.Collections.emptyList(); - private void ensureUrlIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - url_ = new java.util.ArrayList<com.google.protobuf.ByteString>(url_); - bitField0_ |= 0x00000004; - } - } - /** - * <pre> - * URLs of the produced html reports - * </pre> - * - * <code>repeated bytes url = 21;</code> - */ - public java.util.List<com.google.protobuf.ByteString> - getUrlList() { - return java.util.Collections.unmodifiableList(url_); - } - /** - * <pre> - * URLs of the produced html reports - * </pre> - * - * <code>repeated bytes url = 21;</code> - */ - public int getUrlCount() { - return url_.size(); - } - /** - * <pre> - * URLs of the produced html reports - * </pre> - * - * <code>repeated bytes url = 21;</code> - */ - public com.google.protobuf.ByteString getUrl(int index) { - return url_.get(index); - } - /** - * <pre> - * URLs of the produced html reports - * </pre> - * - * <code>repeated bytes url = 21;</code> - */ - public Builder setUrl( - int index, com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureUrlIsMutable(); - url_.set(index, value); - onChanged(); - return this; - } - /** - * <pre> - * URLs of the produced html reports - * </pre> - * - * <code>repeated bytes url = 21;</code> - */ - public Builder addUrl(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureUrlIsMutable(); - url_.add(value); - onChanged(); - return this; - } - /** - * <pre> - * URLs of the produced html reports - * </pre> - * - * <code>repeated bytes url = 21;</code> - */ - public Builder addAllUrl( - java.lang.Iterable<? extends com.google.protobuf.ByteString> values) { - ensureUrlIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, url_); - onChanged(); - return this; - } - /** - * <pre> - * URLs of the produced html reports - * </pre> - * - * <code>repeated bytes url = 21;</code> - */ - public Builder clearUrl() { - url_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:android.vts.SystraceReportMessage) - } - - // @@protoc_insertion_point(class_scope:android.vts.SystraceReportMessage) - private static final com.android.vts.proto.VtsReportMessage.SystraceReportMessage DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.android.vts.proto.VtsReportMessage.SystraceReportMessage(); - } - - public static com.android.vts.proto.VtsReportMessage.SystraceReportMessage getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - @java.lang.Deprecated public static final com.google.protobuf.Parser<SystraceReportMessage> - PARSER = new com.google.protobuf.AbstractParser<SystraceReportMessage>() { - public SystraceReportMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new SystraceReportMessage(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser<SystraceReportMessage> parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser<SystraceReportMessage> getParserForType() { - return PARSER; - } - - public com.android.vts.proto.VtsReportMessage.SystraceReportMessage getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface CoverageReportMessageOrBuilder extends - // @@protoc_insertion_point(interface_extends:android.vts.CoverageReportMessage) - com.google.protobuf.MessageOrBuilder { - - /** - * <pre> - * the path to the source file from the project root. - * </pre> - * - * <code>optional bytes file_path = 11;</code> - */ - boolean hasFilePath(); - /** - * <pre> - * the path to the source file from the project root. - * </pre> - * - * <code>optional bytes file_path = 11;</code> - */ - com.google.protobuf.ByteString getFilePath(); - - /** - * <pre> - * the name of the project where the file can be found - * </pre> - * - * <code>optional bytes project_name = 12;</code> - */ - boolean hasProjectName(); - /** - * <pre> - * the name of the project where the file can be found - * </pre> - * - * <code>optional bytes project_name = 12;</code> - */ - com.google.protobuf.ByteString getProjectName(); - - /** - * <pre> - * the commit ID identifying the code revision - * </pre> - * - * <code>optional bytes revision = 13;</code> - */ - boolean hasRevision(); - /** - * <pre> - * the commit ID identifying the code revision - * </pre> - * - * <code>optional bytes revision = 13;</code> - */ - com.google.protobuf.ByteString getRevision(); - - /** - * <pre> - * i-th element gives the number of times i-th line is executed. - * </pre> - * - * <code>repeated int64 line_coverage_vector = 23;</code> - */ - java.util.List<java.lang.Long> getLineCoverageVectorList(); - /** - * <pre> - * i-th element gives the number of times i-th line is executed. - * </pre> - * - * <code>repeated int64 line_coverage_vector = 23;</code> - */ - int getLineCoverageVectorCount(); - /** - * <pre> - * i-th element gives the number of times i-th line is executed. - * </pre> - * - * <code>repeated int64 line_coverage_vector = 23;</code> - */ - long getLineCoverageVector(int index); - - /** - * <pre> - * the number of source code lines that are instrumented for code coverage - * measurement. - * </pre> - * - * <code>optional int32 total_line_count = 101;</code> - */ - boolean hasTotalLineCount(); - /** - * <pre> - * the number of source code lines that are instrumented for code coverage - * measurement. - * </pre> - * - * <code>optional int32 total_line_count = 101;</code> - */ - int getTotalLineCount(); - - /** - * <pre> - * the number of source code lines that are executed. - * </pre> - * - * <code>optional int32 covered_line_count = 102;</code> - */ - boolean hasCoveredLineCount(); - /** - * <pre> - * the number of source code lines that are executed. - * </pre> - * - * <code>optional int32 covered_line_count = 102;</code> - */ - int getCoveredLineCount(); - - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * the directory path of a source file. - * </pre> - * - * <code>optional bytes dir_path = 1 [deprecated = true];</code> - */ - @java.lang.Deprecated boolean hasDirPath(); - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * the directory path of a source file. - * </pre> - * - * <code>optional bytes dir_path = 1 [deprecated = true];</code> - */ - @java.lang.Deprecated com.google.protobuf.ByteString getDirPath(); - - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * the name of the source file. - * </pre> - * - * <code>optional bytes file_name = 2 [deprecated = true];</code> - */ - @java.lang.Deprecated boolean hasFileName(); - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * the name of the source file. - * </pre> - * - * <code>optional bytes file_name = 2 [deprecated = true];</code> - */ - @java.lang.Deprecated com.google.protobuf.ByteString getFileName(); - - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * produced html report. - * </pre> - * - * <code>optional bytes html = 3 [deprecated = true];</code> - */ - @java.lang.Deprecated boolean hasHtml(); - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * produced html report. - * </pre> - * - * <code>optional bytes html = 3 [deprecated = true];</code> - */ - @java.lang.Deprecated com.google.protobuf.ByteString getHtml(); - } - /** - * <pre> - * To specify a coverage report. - * </pre> - * - * Protobuf type {@code android.vts.CoverageReportMessage} - */ - public static final class CoverageReportMessage extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:android.vts.CoverageReportMessage) - CoverageReportMessageOrBuilder { - // Use CoverageReportMessage.newBuilder() to construct. - private CoverageReportMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { - super(builder); - } - private CoverageReportMessage() { - filePath_ = com.google.protobuf.ByteString.EMPTY; - projectName_ = com.google.protobuf.ByteString.EMPTY; - revision_ = com.google.protobuf.ByteString.EMPTY; - lineCoverageVector_ = java.util.Collections.emptyList(); - totalLineCount_ = 0; - coveredLineCount_ = 0; - dirPath_ = com.google.protobuf.ByteString.EMPTY; - fileName_ = com.google.protobuf.ByteString.EMPTY; - html_ = com.google.protobuf.ByteString.EMPTY; - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private CoverageReportMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000020; - dirPath_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000040; - fileName_ = input.readBytes(); - break; - } - case 26: { - bitField0_ |= 0x00000080; - html_ = input.readBytes(); - break; - } - case 90: { - bitField0_ |= 0x00000001; - filePath_ = input.readBytes(); - break; - } - case 98: { - bitField0_ |= 0x00000002; - projectName_ = input.readBytes(); - break; - } - case 106: { - bitField0_ |= 0x00000004; - revision_ = input.readBytes(); - break; - } - case 184: { - if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - lineCoverageVector_ = new java.util.ArrayList<java.lang.Long>(); - mutable_bitField0_ |= 0x00000008; - } - lineCoverageVector_.add(input.readInt64()); - break; - } - case 186: { - int length = input.readRawVarint32(); - int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00000008) == 0x00000008) && input.getBytesUntilLimit() > 0) { - lineCoverageVector_ = new java.util.ArrayList<java.lang.Long>(); - mutable_bitField0_ |= 0x00000008; - } - while (input.getBytesUntilLimit() > 0) { - lineCoverageVector_.add(input.readInt64()); - } - input.popLimit(limit); - break; - } - case 808: { - bitField0_ |= 0x00000008; - totalLineCount_ = input.readInt32(); - break; - } - case 816: { - bitField0_ |= 0x00000010; - coveredLineCount_ = input.readInt32(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - lineCoverageVector_ = java.util.Collections.unmodifiableList(lineCoverageVector_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_CoverageReportMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_CoverageReportMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.CoverageReportMessage.class, com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder.class); - } - - private int bitField0_; - public static final int FILE_PATH_FIELD_NUMBER = 11; - private com.google.protobuf.ByteString filePath_; - /** - * <pre> - * the path to the source file from the project root. - * </pre> - * - * <code>optional bytes file_path = 11;</code> - */ - public boolean hasFilePath() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * the path to the source file from the project root. - * </pre> - * - * <code>optional bytes file_path = 11;</code> - */ - public com.google.protobuf.ByteString getFilePath() { - return filePath_; - } - - public static final int PROJECT_NAME_FIELD_NUMBER = 12; - private com.google.protobuf.ByteString projectName_; - /** - * <pre> - * the name of the project where the file can be found - * </pre> - * - * <code>optional bytes project_name = 12;</code> - */ - public boolean hasProjectName() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * the name of the project where the file can be found - * </pre> - * - * <code>optional bytes project_name = 12;</code> - */ - public com.google.protobuf.ByteString getProjectName() { - return projectName_; - } - - public static final int REVISION_FIELD_NUMBER = 13; - private com.google.protobuf.ByteString revision_; - /** - * <pre> - * the commit ID identifying the code revision - * </pre> - * - * <code>optional bytes revision = 13;</code> - */ - public boolean hasRevision() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * the commit ID identifying the code revision - * </pre> - * - * <code>optional bytes revision = 13;</code> - */ - public com.google.protobuf.ByteString getRevision() { - return revision_; - } - - public static final int LINE_COVERAGE_VECTOR_FIELD_NUMBER = 23; - private java.util.List<java.lang.Long> lineCoverageVector_; - /** - * <pre> - * i-th element gives the number of times i-th line is executed. - * </pre> - * - * <code>repeated int64 line_coverage_vector = 23;</code> - */ - public java.util.List<java.lang.Long> - getLineCoverageVectorList() { - return lineCoverageVector_; - } - /** - * <pre> - * i-th element gives the number of times i-th line is executed. - * </pre> - * - * <code>repeated int64 line_coverage_vector = 23;</code> - */ - public int getLineCoverageVectorCount() { - return lineCoverageVector_.size(); - } - /** - * <pre> - * i-th element gives the number of times i-th line is executed. - * </pre> - * - * <code>repeated int64 line_coverage_vector = 23;</code> - */ - public long getLineCoverageVector(int index) { - return lineCoverageVector_.get(index); - } - - public static final int TOTAL_LINE_COUNT_FIELD_NUMBER = 101; - private int totalLineCount_; - /** - * <pre> - * the number of source code lines that are instrumented for code coverage - * measurement. - * </pre> - * - * <code>optional int32 total_line_count = 101;</code> - */ - public boolean hasTotalLineCount() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <pre> - * the number of source code lines that are instrumented for code coverage - * measurement. - * </pre> - * - * <code>optional int32 total_line_count = 101;</code> - */ - public int getTotalLineCount() { - return totalLineCount_; - } - - public static final int COVERED_LINE_COUNT_FIELD_NUMBER = 102; - private int coveredLineCount_; - /** - * <pre> - * the number of source code lines that are executed. - * </pre> - * - * <code>optional int32 covered_line_count = 102;</code> - */ - public boolean hasCoveredLineCount() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <pre> - * the number of source code lines that are executed. - * </pre> - * - * <code>optional int32 covered_line_count = 102;</code> - */ - public int getCoveredLineCount() { - return coveredLineCount_; - } - - public static final int DIR_PATH_FIELD_NUMBER = 1; - private com.google.protobuf.ByteString dirPath_; - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * the directory path of a source file. - * </pre> - * - * <code>optional bytes dir_path = 1 [deprecated = true];</code> - */ - @java.lang.Deprecated public boolean hasDirPath() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * the directory path of a source file. - * </pre> - * - * <code>optional bytes dir_path = 1 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.google.protobuf.ByteString getDirPath() { - return dirPath_; - } - - public static final int FILE_NAME_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString fileName_; - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * the name of the source file. - * </pre> - * - * <code>optional bytes file_name = 2 [deprecated = true];</code> - */ - @java.lang.Deprecated public boolean hasFileName() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * the name of the source file. - * </pre> - * - * <code>optional bytes file_name = 2 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.google.protobuf.ByteString getFileName() { - return fileName_; - } - - public static final int HTML_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString html_; - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * produced html report. - * </pre> - * - * <code>optional bytes html = 3 [deprecated = true];</code> - */ - @java.lang.Deprecated public boolean hasHtml() { - return ((bitField0_ & 0x00000080) == 0x00000080); - } - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * produced html report. - * </pre> - * - * <code>optional bytes html = 3 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.google.protobuf.ByteString getHtml() { - return html_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (((bitField0_ & 0x00000020) == 0x00000020)) { - output.writeBytes(1, dirPath_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - output.writeBytes(2, fileName_); - } - if (((bitField0_ & 0x00000080) == 0x00000080)) { - output.writeBytes(3, html_); - } - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(11, filePath_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(12, projectName_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(13, revision_); - } - for (int i = 0; i < lineCoverageVector_.size(); i++) { - output.writeInt64(23, lineCoverageVector_.get(i)); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeInt32(101, totalLineCount_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeInt32(102, coveredLineCount_); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000020) == 0x00000020)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, dirPath_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, fileName_); - } - if (((bitField0_ & 0x00000080) == 0x00000080)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, html_); - } - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(11, filePath_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(12, projectName_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(13, revision_); - } - { - int dataSize = 0; - for (int i = 0; i < lineCoverageVector_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeInt64SizeNoTag(lineCoverageVector_.get(i)); - } - size += dataSize; - size += 2 * getLineCoverageVectorList().size(); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(101, totalLineCount_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(102, coveredLineCount_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.android.vts.proto.VtsReportMessage.CoverageReportMessage)) { - return super.equals(obj); - } - com.android.vts.proto.VtsReportMessage.CoverageReportMessage other = (com.android.vts.proto.VtsReportMessage.CoverageReportMessage) obj; - - boolean result = true; - result = result && (hasFilePath() == other.hasFilePath()); - if (hasFilePath()) { - result = result && getFilePath() - .equals(other.getFilePath()); - } - result = result && (hasProjectName() == other.hasProjectName()); - if (hasProjectName()) { - result = result && getProjectName() - .equals(other.getProjectName()); - } - result = result && (hasRevision() == other.hasRevision()); - if (hasRevision()) { - result = result && getRevision() - .equals(other.getRevision()); - } - result = result && getLineCoverageVectorList() - .equals(other.getLineCoverageVectorList()); - result = result && (hasTotalLineCount() == other.hasTotalLineCount()); - if (hasTotalLineCount()) { - result = result && (getTotalLineCount() - == other.getTotalLineCount()); - } - result = result && (hasCoveredLineCount() == other.hasCoveredLineCount()); - if (hasCoveredLineCount()) { - result = result && (getCoveredLineCount() - == other.getCoveredLineCount()); - } - result = result && (hasDirPath() == other.hasDirPath()); - if (hasDirPath()) { - result = result && getDirPath() - .equals(other.getDirPath()); - } - result = result && (hasFileName() == other.hasFileName()); - if (hasFileName()) { - result = result && getFileName() - .equals(other.getFileName()); - } - result = result && (hasHtml() == other.hasHtml()); - if (hasHtml()) { - result = result && getHtml() - .equals(other.getHtml()); - } - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - if (hasFilePath()) { - hash = (37 * hash) + FILE_PATH_FIELD_NUMBER; - hash = (53 * hash) + getFilePath().hashCode(); - } - if (hasProjectName()) { - hash = (37 * hash) + PROJECT_NAME_FIELD_NUMBER; - hash = (53 * hash) + getProjectName().hashCode(); - } - if (hasRevision()) { - hash = (37 * hash) + REVISION_FIELD_NUMBER; - hash = (53 * hash) + getRevision().hashCode(); - } - if (getLineCoverageVectorCount() > 0) { - hash = (37 * hash) + LINE_COVERAGE_VECTOR_FIELD_NUMBER; - hash = (53 * hash) + getLineCoverageVectorList().hashCode(); - } - if (hasTotalLineCount()) { - hash = (37 * hash) + TOTAL_LINE_COUNT_FIELD_NUMBER; - hash = (53 * hash) + getTotalLineCount(); - } - if (hasCoveredLineCount()) { - hash = (37 * hash) + COVERED_LINE_COUNT_FIELD_NUMBER; - hash = (53 * hash) + getCoveredLineCount(); - } - if (hasDirPath()) { - hash = (37 * hash) + DIR_PATH_FIELD_NUMBER; - hash = (53 * hash) + getDirPath().hashCode(); - } - if (hasFileName()) { - hash = (37 * hash) + FILE_NAME_FIELD_NUMBER; - hash = (53 * hash) + getFileName().hashCode(); - } - if (hasHtml()) { - hash = (37 * hash) + HTML_FIELD_NUMBER; - hash = (53 * hash) + getHtml().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.android.vts.proto.VtsReportMessage.CoverageReportMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.CoverageReportMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.CoverageReportMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.CoverageReportMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.CoverageReportMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.CoverageReportMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.CoverageReportMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.CoverageReportMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.CoverageReportMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.CoverageReportMessage parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.android.vts.proto.VtsReportMessage.CoverageReportMessage prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * <pre> - * To specify a coverage report. - * </pre> - * - * Protobuf type {@code android.vts.CoverageReportMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements - // @@protoc_insertion_point(builder_implements:android.vts.CoverageReportMessage) - com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_CoverageReportMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_CoverageReportMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.CoverageReportMessage.class, com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder.class); - } - - // Construct using com.android.vts.proto.VtsReportMessage.CoverageReportMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - filePath_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - projectName_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000002); - revision_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - lineCoverageVector_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - totalLineCount_ = 0; - bitField0_ = (bitField0_ & ~0x00000010); - coveredLineCount_ = 0; - bitField0_ = (bitField0_ & ~0x00000020); - dirPath_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000040); - fileName_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000080); - html_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000100); - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_CoverageReportMessage_descriptor; - } - - public com.android.vts.proto.VtsReportMessage.CoverageReportMessage getDefaultInstanceForType() { - return com.android.vts.proto.VtsReportMessage.CoverageReportMessage.getDefaultInstance(); - } - - public com.android.vts.proto.VtsReportMessage.CoverageReportMessage build() { - com.android.vts.proto.VtsReportMessage.CoverageReportMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.android.vts.proto.VtsReportMessage.CoverageReportMessage buildPartial() { - com.android.vts.proto.VtsReportMessage.CoverageReportMessage result = new com.android.vts.proto.VtsReportMessage.CoverageReportMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.filePath_ = filePath_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.projectName_ = projectName_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.revision_ = revision_; - if (((bitField0_ & 0x00000008) == 0x00000008)) { - lineCoverageVector_ = java.util.Collections.unmodifiableList(lineCoverageVector_); - bitField0_ = (bitField0_ & ~0x00000008); - } - result.lineCoverageVector_ = lineCoverageVector_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000008; - } - result.totalLineCount_ = totalLineCount_; - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { - to_bitField0_ |= 0x00000010; - } - result.coveredLineCount_ = coveredLineCount_; - if (((from_bitField0_ & 0x00000040) == 0x00000040)) { - to_bitField0_ |= 0x00000020; - } - result.dirPath_ = dirPath_; - if (((from_bitField0_ & 0x00000080) == 0x00000080)) { - to_bitField0_ |= 0x00000040; - } - result.fileName_ = fileName_; - if (((from_bitField0_ & 0x00000100) == 0x00000100)) { - to_bitField0_ |= 0x00000080; - } - result.html_ = html_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.android.vts.proto.VtsReportMessage.CoverageReportMessage) { - return mergeFrom((com.android.vts.proto.VtsReportMessage.CoverageReportMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.android.vts.proto.VtsReportMessage.CoverageReportMessage other) { - if (other == com.android.vts.proto.VtsReportMessage.CoverageReportMessage.getDefaultInstance()) return this; - if (other.hasFilePath()) { - setFilePath(other.getFilePath()); - } - if (other.hasProjectName()) { - setProjectName(other.getProjectName()); - } - if (other.hasRevision()) { - setRevision(other.getRevision()); - } - if (!other.lineCoverageVector_.isEmpty()) { - if (lineCoverageVector_.isEmpty()) { - lineCoverageVector_ = other.lineCoverageVector_; - bitField0_ = (bitField0_ & ~0x00000008); - } else { - ensureLineCoverageVectorIsMutable(); - lineCoverageVector_.addAll(other.lineCoverageVector_); - } - onChanged(); - } - if (other.hasTotalLineCount()) { - setTotalLineCount(other.getTotalLineCount()); - } - if (other.hasCoveredLineCount()) { - setCoveredLineCount(other.getCoveredLineCount()); - } - if (other.hasDirPath()) { - setDirPath(other.getDirPath()); - } - if (other.hasFileName()) { - setFileName(other.getFileName()); - } - if (other.hasHtml()) { - setHtml(other.getHtml()); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.android.vts.proto.VtsReportMessage.CoverageReportMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.android.vts.proto.VtsReportMessage.CoverageReportMessage) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private com.google.protobuf.ByteString filePath_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * the path to the source file from the project root. - * </pre> - * - * <code>optional bytes file_path = 11;</code> - */ - public boolean hasFilePath() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * the path to the source file from the project root. - * </pre> - * - * <code>optional bytes file_path = 11;</code> - */ - public com.google.protobuf.ByteString getFilePath() { - return filePath_; - } - /** - * <pre> - * the path to the source file from the project root. - * </pre> - * - * <code>optional bytes file_path = 11;</code> - */ - public Builder setFilePath(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - filePath_ = value; - onChanged(); - return this; - } - /** - * <pre> - * the path to the source file from the project root. - * </pre> - * - * <code>optional bytes file_path = 11;</code> - */ - public Builder clearFilePath() { - bitField0_ = (bitField0_ & ~0x00000001); - filePath_ = getDefaultInstance().getFilePath(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString projectName_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * the name of the project where the file can be found - * </pre> - * - * <code>optional bytes project_name = 12;</code> - */ - public boolean hasProjectName() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * the name of the project where the file can be found - * </pre> - * - * <code>optional bytes project_name = 12;</code> - */ - public com.google.protobuf.ByteString getProjectName() { - return projectName_; - } - /** - * <pre> - * the name of the project where the file can be found - * </pre> - * - * <code>optional bytes project_name = 12;</code> - */ - public Builder setProjectName(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - projectName_ = value; - onChanged(); - return this; - } - /** - * <pre> - * the name of the project where the file can be found - * </pre> - * - * <code>optional bytes project_name = 12;</code> - */ - public Builder clearProjectName() { - bitField0_ = (bitField0_ & ~0x00000002); - projectName_ = getDefaultInstance().getProjectName(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString revision_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * the commit ID identifying the code revision - * </pre> - * - * <code>optional bytes revision = 13;</code> - */ - public boolean hasRevision() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * the commit ID identifying the code revision - * </pre> - * - * <code>optional bytes revision = 13;</code> - */ - public com.google.protobuf.ByteString getRevision() { - return revision_; - } - /** - * <pre> - * the commit ID identifying the code revision - * </pre> - * - * <code>optional bytes revision = 13;</code> - */ - public Builder setRevision(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - revision_ = value; - onChanged(); - return this; - } - /** - * <pre> - * the commit ID identifying the code revision - * </pre> - * - * <code>optional bytes revision = 13;</code> - */ - public Builder clearRevision() { - bitField0_ = (bitField0_ & ~0x00000004); - revision_ = getDefaultInstance().getRevision(); - onChanged(); - return this; - } - - private java.util.List<java.lang.Long> lineCoverageVector_ = java.util.Collections.emptyList(); - private void ensureLineCoverageVectorIsMutable() { - if (!((bitField0_ & 0x00000008) == 0x00000008)) { - lineCoverageVector_ = new java.util.ArrayList<java.lang.Long>(lineCoverageVector_); - bitField0_ |= 0x00000008; - } - } - /** - * <pre> - * i-th element gives the number of times i-th line is executed. - * </pre> - * - * <code>repeated int64 line_coverage_vector = 23;</code> - */ - public java.util.List<java.lang.Long> - getLineCoverageVectorList() { - return java.util.Collections.unmodifiableList(lineCoverageVector_); - } - /** - * <pre> - * i-th element gives the number of times i-th line is executed. - * </pre> - * - * <code>repeated int64 line_coverage_vector = 23;</code> - */ - public int getLineCoverageVectorCount() { - return lineCoverageVector_.size(); - } - /** - * <pre> - * i-th element gives the number of times i-th line is executed. - * </pre> - * - * <code>repeated int64 line_coverage_vector = 23;</code> - */ - public long getLineCoverageVector(int index) { - return lineCoverageVector_.get(index); - } - /** - * <pre> - * i-th element gives the number of times i-th line is executed. - * </pre> - * - * <code>repeated int64 line_coverage_vector = 23;</code> - */ - public Builder setLineCoverageVector( - int index, long value) { - ensureLineCoverageVectorIsMutable(); - lineCoverageVector_.set(index, value); - onChanged(); - return this; - } - /** - * <pre> - * i-th element gives the number of times i-th line is executed. - * </pre> - * - * <code>repeated int64 line_coverage_vector = 23;</code> - */ - public Builder addLineCoverageVector(long value) { - ensureLineCoverageVectorIsMutable(); - lineCoverageVector_.add(value); - onChanged(); - return this; - } - /** - * <pre> - * i-th element gives the number of times i-th line is executed. - * </pre> - * - * <code>repeated int64 line_coverage_vector = 23;</code> - */ - public Builder addAllLineCoverageVector( - java.lang.Iterable<? extends java.lang.Long> values) { - ensureLineCoverageVectorIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, lineCoverageVector_); - onChanged(); - return this; - } - /** - * <pre> - * i-th element gives the number of times i-th line is executed. - * </pre> - * - * <code>repeated int64 line_coverage_vector = 23;</code> - */ - public Builder clearLineCoverageVector() { - lineCoverageVector_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - onChanged(); - return this; - } - - private int totalLineCount_ ; - /** - * <pre> - * the number of source code lines that are instrumented for code coverage - * measurement. - * </pre> - * - * <code>optional int32 total_line_count = 101;</code> - */ - public boolean hasTotalLineCount() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <pre> - * the number of source code lines that are instrumented for code coverage - * measurement. - * </pre> - * - * <code>optional int32 total_line_count = 101;</code> - */ - public int getTotalLineCount() { - return totalLineCount_; - } - /** - * <pre> - * the number of source code lines that are instrumented for code coverage - * measurement. - * </pre> - * - * <code>optional int32 total_line_count = 101;</code> - */ - public Builder setTotalLineCount(int value) { - bitField0_ |= 0x00000010; - totalLineCount_ = value; - onChanged(); - return this; - } - /** - * <pre> - * the number of source code lines that are instrumented for code coverage - * measurement. - * </pre> - * - * <code>optional int32 total_line_count = 101;</code> - */ - public Builder clearTotalLineCount() { - bitField0_ = (bitField0_ & ~0x00000010); - totalLineCount_ = 0; - onChanged(); - return this; - } - - private int coveredLineCount_ ; - /** - * <pre> - * the number of source code lines that are executed. - * </pre> - * - * <code>optional int32 covered_line_count = 102;</code> - */ - public boolean hasCoveredLineCount() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - /** - * <pre> - * the number of source code lines that are executed. - * </pre> - * - * <code>optional int32 covered_line_count = 102;</code> - */ - public int getCoveredLineCount() { - return coveredLineCount_; - } - /** - * <pre> - * the number of source code lines that are executed. - * </pre> - * - * <code>optional int32 covered_line_count = 102;</code> - */ - public Builder setCoveredLineCount(int value) { - bitField0_ |= 0x00000020; - coveredLineCount_ = value; - onChanged(); - return this; - } - /** - * <pre> - * the number of source code lines that are executed. - * </pre> - * - * <code>optional int32 covered_line_count = 102;</code> - */ - public Builder clearCoveredLineCount() { - bitField0_ = (bitField0_ & ~0x00000020); - coveredLineCount_ = 0; - onChanged(); - return this; - } - - private com.google.protobuf.ByteString dirPath_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * the directory path of a source file. - * </pre> - * - * <code>optional bytes dir_path = 1 [deprecated = true];</code> - */ - @java.lang.Deprecated public boolean hasDirPath() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * the directory path of a source file. - * </pre> - * - * <code>optional bytes dir_path = 1 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.google.protobuf.ByteString getDirPath() { - return dirPath_; - } - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * the directory path of a source file. - * </pre> - * - * <code>optional bytes dir_path = 1 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder setDirPath(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000040; - dirPath_ = value; - onChanged(); - return this; - } - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * the directory path of a source file. - * </pre> - * - * <code>optional bytes dir_path = 1 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder clearDirPath() { - bitField0_ = (bitField0_ & ~0x00000040); - dirPath_ = getDefaultInstance().getDirPath(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString fileName_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * the name of the source file. - * </pre> - * - * <code>optional bytes file_name = 2 [deprecated = true];</code> - */ - @java.lang.Deprecated public boolean hasFileName() { - return ((bitField0_ & 0x00000080) == 0x00000080); - } - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * the name of the source file. - * </pre> - * - * <code>optional bytes file_name = 2 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.google.protobuf.ByteString getFileName() { - return fileName_; - } - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * the name of the source file. - * </pre> - * - * <code>optional bytes file_name = 2 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder setFileName(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000080; - fileName_ = value; - onChanged(); - return this; - } - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * the name of the source file. - * </pre> - * - * <code>optional bytes file_name = 2 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder clearFileName() { - bitField0_ = (bitField0_ & ~0x00000080); - fileName_ = getDefaultInstance().getFileName(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString html_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * produced html report. - * </pre> - * - * <code>optional bytes html = 3 [deprecated = true];</code> - */ - @java.lang.Deprecated public boolean hasHtml() { - return ((bitField0_ & 0x00000100) == 0x00000100); - } - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * produced html report. - * </pre> - * - * <code>optional bytes html = 3 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.google.protobuf.ByteString getHtml() { - return html_; - } - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * produced html report. - * </pre> - * - * <code>optional bytes html = 3 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder setHtml(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000100; - html_ = value; - onChanged(); - return this; - } - /** - * <pre> - * TODO(ryanjcampbell@) delete deprecated field - * produced html report. - * </pre> - * - * <code>optional bytes html = 3 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder clearHtml() { - bitField0_ = (bitField0_ & ~0x00000100); - html_ = getDefaultInstance().getHtml(); - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:android.vts.CoverageReportMessage) - } - - // @@protoc_insertion_point(class_scope:android.vts.CoverageReportMessage) - private static final com.android.vts.proto.VtsReportMessage.CoverageReportMessage DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.android.vts.proto.VtsReportMessage.CoverageReportMessage(); - } - - public static com.android.vts.proto.VtsReportMessage.CoverageReportMessage getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - @java.lang.Deprecated public static final com.google.protobuf.Parser<CoverageReportMessage> - PARSER = new com.google.protobuf.AbstractParser<CoverageReportMessage>() { - public CoverageReportMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new CoverageReportMessage(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser<CoverageReportMessage> parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser<CoverageReportMessage> getParserForType() { - return PARSER; - } - - public com.android.vts.proto.VtsReportMessage.CoverageReportMessage getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface HalInterfaceMessageOrBuilder extends - // @@protoc_insertion_point(interface_extends:android.vts.HalInterfaceMessage) - com.google.protobuf.MessageOrBuilder { - - /** - * <pre> - * HAL package name. e.g. android.hardware.foo. - * </pre> - * - * <code>optional bytes hal_package_name = 1;</code> - */ - boolean hasHalPackageName(); - /** - * <pre> - * HAL package name. e.g. android.hardware.foo. - * </pre> - * - * <code>optional bytes hal_package_name = 1;</code> - */ - com.google.protobuf.ByteString getHalPackageName(); - - /** - * <pre> - * HAL (major) version. e.g. 1. - * </pre> - * - * <code>optional int32 hal_version_major = 2;</code> - */ - boolean hasHalVersionMajor(); - /** - * <pre> - * HAL (major) version. e.g. 1. - * </pre> - * - * <code>optional int32 hal_version_major = 2;</code> - */ - int getHalVersionMajor(); - - /** - * <pre> - * HAL (minor) version. e.g. 0. - * </pre> - * - * <code>optional int32 hal_version_minor = 3;</code> - */ - boolean hasHalVersionMinor(); - /** - * <pre> - * HAL (minor) version. e.g. 0. - * </pre> - * - * <code>optional int32 hal_version_minor = 3;</code> - */ - int getHalVersionMinor(); - - /** - * <pre> - * HAL interface name. e.g. IFoo. - * </pre> - * - * <code>optional bytes hal_interface_name = 4;</code> - */ - boolean hasHalInterfaceName(); - /** - * <pre> - * HAL interface name. e.g. IFoo. - * </pre> - * - * <code>optional bytes hal_interface_name = 4;</code> - */ - com.google.protobuf.ByteString getHalInterfaceName(); - - /** - * <pre> - * HAL release level (e.g. "current", "27", "28") - * </pre> - * - * <code>optional bytes hal_release_level = 5;</code> - */ - boolean hasHalReleaseLevel(); - /** - * <pre> - * HAL release level (e.g. "current", "27", "28") - * </pre> - * - * <code>optional bytes hal_release_level = 5;</code> - */ - com.google.protobuf.ByteString getHalReleaseLevel(); - } - /** - * <pre> - * Information for a HAL interface. - * </pre> - * - * Protobuf type {@code android.vts.HalInterfaceMessage} - */ - public static final class HalInterfaceMessage extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:android.vts.HalInterfaceMessage) - HalInterfaceMessageOrBuilder { - // Use HalInterfaceMessage.newBuilder() to construct. - private HalInterfaceMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { - super(builder); - } - private HalInterfaceMessage() { - halPackageName_ = com.google.protobuf.ByteString.EMPTY; - halVersionMajor_ = 0; - halVersionMinor_ = 0; - halInterfaceName_ = com.google.protobuf.ByteString.EMPTY; - halReleaseLevel_ = com.google.protobuf.ByteString.EMPTY; - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private HalInterfaceMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - halPackageName_ = input.readBytes(); - break; - } - case 16: { - bitField0_ |= 0x00000002; - halVersionMajor_ = input.readInt32(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - halVersionMinor_ = input.readInt32(); - break; - } - case 34: { - bitField0_ |= 0x00000008; - halInterfaceName_ = input.readBytes(); - break; - } - case 42: { - bitField0_ |= 0x00000010; - halReleaseLevel_ = input.readBytes(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_HalInterfaceMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_HalInterfaceMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.class, com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.Builder.class); - } - - private int bitField0_; - public static final int HAL_PACKAGE_NAME_FIELD_NUMBER = 1; - private com.google.protobuf.ByteString halPackageName_; - /** - * <pre> - * HAL package name. e.g. android.hardware.foo. - * </pre> - * - * <code>optional bytes hal_package_name = 1;</code> - */ - public boolean hasHalPackageName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * HAL package name. e.g. android.hardware.foo. - * </pre> - * - * <code>optional bytes hal_package_name = 1;</code> - */ - public com.google.protobuf.ByteString getHalPackageName() { - return halPackageName_; - } - - public static final int HAL_VERSION_MAJOR_FIELD_NUMBER = 2; - private int halVersionMajor_; - /** - * <pre> - * HAL (major) version. e.g. 1. - * </pre> - * - * <code>optional int32 hal_version_major = 2;</code> - */ - public boolean hasHalVersionMajor() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * HAL (major) version. e.g. 1. - * </pre> - * - * <code>optional int32 hal_version_major = 2;</code> - */ - public int getHalVersionMajor() { - return halVersionMajor_; - } - - public static final int HAL_VERSION_MINOR_FIELD_NUMBER = 3; - private int halVersionMinor_; - /** - * <pre> - * HAL (minor) version. e.g. 0. - * </pre> - * - * <code>optional int32 hal_version_minor = 3;</code> - */ - public boolean hasHalVersionMinor() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * HAL (minor) version. e.g. 0. - * </pre> - * - * <code>optional int32 hal_version_minor = 3;</code> - */ - public int getHalVersionMinor() { - return halVersionMinor_; - } - - public static final int HAL_INTERFACE_NAME_FIELD_NUMBER = 4; - private com.google.protobuf.ByteString halInterfaceName_; - /** - * <pre> - * HAL interface name. e.g. IFoo. - * </pre> - * - * <code>optional bytes hal_interface_name = 4;</code> - */ - public boolean hasHalInterfaceName() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <pre> - * HAL interface name. e.g. IFoo. - * </pre> - * - * <code>optional bytes hal_interface_name = 4;</code> - */ - public com.google.protobuf.ByteString getHalInterfaceName() { - return halInterfaceName_; - } - - public static final int HAL_RELEASE_LEVEL_FIELD_NUMBER = 5; - private com.google.protobuf.ByteString halReleaseLevel_; - /** - * <pre> - * HAL release level (e.g. "current", "27", "28") - * </pre> - * - * <code>optional bytes hal_release_level = 5;</code> - */ - public boolean hasHalReleaseLevel() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <pre> - * HAL release level (e.g. "current", "27", "28") - * </pre> - * - * <code>optional bytes hal_release_level = 5;</code> - */ - public com.google.protobuf.ByteString getHalReleaseLevel() { - return halReleaseLevel_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, halPackageName_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeInt32(2, halVersionMajor_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeInt32(3, halVersionMinor_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBytes(4, halInterfaceName_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeBytes(5, halReleaseLevel_); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, halPackageName_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(2, halVersionMajor_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeInt32Size(3, halVersionMinor_); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(4, halInterfaceName_); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(5, halReleaseLevel_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.android.vts.proto.VtsReportMessage.HalInterfaceMessage)) { - return super.equals(obj); - } - com.android.vts.proto.VtsReportMessage.HalInterfaceMessage other = (com.android.vts.proto.VtsReportMessage.HalInterfaceMessage) obj; - - boolean result = true; - result = result && (hasHalPackageName() == other.hasHalPackageName()); - if (hasHalPackageName()) { - result = result && getHalPackageName() - .equals(other.getHalPackageName()); - } - result = result && (hasHalVersionMajor() == other.hasHalVersionMajor()); - if (hasHalVersionMajor()) { - result = result && (getHalVersionMajor() - == other.getHalVersionMajor()); - } - result = result && (hasHalVersionMinor() == other.hasHalVersionMinor()); - if (hasHalVersionMinor()) { - result = result && (getHalVersionMinor() - == other.getHalVersionMinor()); - } - result = result && (hasHalInterfaceName() == other.hasHalInterfaceName()); - if (hasHalInterfaceName()) { - result = result && getHalInterfaceName() - .equals(other.getHalInterfaceName()); - } - result = result && (hasHalReleaseLevel() == other.hasHalReleaseLevel()); - if (hasHalReleaseLevel()) { - result = result && getHalReleaseLevel() - .equals(other.getHalReleaseLevel()); - } - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - if (hasHalPackageName()) { - hash = (37 * hash) + HAL_PACKAGE_NAME_FIELD_NUMBER; - hash = (53 * hash) + getHalPackageName().hashCode(); - } - if (hasHalVersionMajor()) { - hash = (37 * hash) + HAL_VERSION_MAJOR_FIELD_NUMBER; - hash = (53 * hash) + getHalVersionMajor(); - } - if (hasHalVersionMinor()) { - hash = (37 * hash) + HAL_VERSION_MINOR_FIELD_NUMBER; - hash = (53 * hash) + getHalVersionMinor(); - } - if (hasHalInterfaceName()) { - hash = (37 * hash) + HAL_INTERFACE_NAME_FIELD_NUMBER; - hash = (53 * hash) + getHalInterfaceName().hashCode(); - } - if (hasHalReleaseLevel()) { - hash = (37 * hash) + HAL_RELEASE_LEVEL_FIELD_NUMBER; - hash = (53 * hash) + getHalReleaseLevel().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.android.vts.proto.VtsReportMessage.HalInterfaceMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.HalInterfaceMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.HalInterfaceMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.HalInterfaceMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.HalInterfaceMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.HalInterfaceMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.HalInterfaceMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.HalInterfaceMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.HalInterfaceMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.HalInterfaceMessage parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.android.vts.proto.VtsReportMessage.HalInterfaceMessage prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * <pre> - * Information for a HAL interface. - * </pre> - * - * Protobuf type {@code android.vts.HalInterfaceMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements - // @@protoc_insertion_point(builder_implements:android.vts.HalInterfaceMessage) - com.android.vts.proto.VtsReportMessage.HalInterfaceMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_HalInterfaceMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_HalInterfaceMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.class, com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.Builder.class); - } - - // Construct using com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - halPackageName_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - halVersionMajor_ = 0; - bitField0_ = (bitField0_ & ~0x00000002); - halVersionMinor_ = 0; - bitField0_ = (bitField0_ & ~0x00000004); - halInterfaceName_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000008); - halReleaseLevel_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000010); - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_HalInterfaceMessage_descriptor; - } - - public com.android.vts.proto.VtsReportMessage.HalInterfaceMessage getDefaultInstanceForType() { - return com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.getDefaultInstance(); - } - - public com.android.vts.proto.VtsReportMessage.HalInterfaceMessage build() { - com.android.vts.proto.VtsReportMessage.HalInterfaceMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.android.vts.proto.VtsReportMessage.HalInterfaceMessage buildPartial() { - com.android.vts.proto.VtsReportMessage.HalInterfaceMessage result = new com.android.vts.proto.VtsReportMessage.HalInterfaceMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.halPackageName_ = halPackageName_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.halVersionMajor_ = halVersionMajor_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.halVersionMinor_ = halVersionMinor_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { - to_bitField0_ |= 0x00000008; - } - result.halInterfaceName_ = halInterfaceName_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000010; - } - result.halReleaseLevel_ = halReleaseLevel_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.android.vts.proto.VtsReportMessage.HalInterfaceMessage) { - return mergeFrom((com.android.vts.proto.VtsReportMessage.HalInterfaceMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.android.vts.proto.VtsReportMessage.HalInterfaceMessage other) { - if (other == com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.getDefaultInstance()) return this; - if (other.hasHalPackageName()) { - setHalPackageName(other.getHalPackageName()); - } - if (other.hasHalVersionMajor()) { - setHalVersionMajor(other.getHalVersionMajor()); - } - if (other.hasHalVersionMinor()) { - setHalVersionMinor(other.getHalVersionMinor()); - } - if (other.hasHalInterfaceName()) { - setHalInterfaceName(other.getHalInterfaceName()); - } - if (other.hasHalReleaseLevel()) { - setHalReleaseLevel(other.getHalReleaseLevel()); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.android.vts.proto.VtsReportMessage.HalInterfaceMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.android.vts.proto.VtsReportMessage.HalInterfaceMessage) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private com.google.protobuf.ByteString halPackageName_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * HAL package name. e.g. android.hardware.foo. - * </pre> - * - * <code>optional bytes hal_package_name = 1;</code> - */ - public boolean hasHalPackageName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * HAL package name. e.g. android.hardware.foo. - * </pre> - * - * <code>optional bytes hal_package_name = 1;</code> - */ - public com.google.protobuf.ByteString getHalPackageName() { - return halPackageName_; - } - /** - * <pre> - * HAL package name. e.g. android.hardware.foo. - * </pre> - * - * <code>optional bytes hal_package_name = 1;</code> - */ - public Builder setHalPackageName(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - halPackageName_ = value; - onChanged(); - return this; - } - /** - * <pre> - * HAL package name. e.g. android.hardware.foo. - * </pre> - * - * <code>optional bytes hal_package_name = 1;</code> - */ - public Builder clearHalPackageName() { - bitField0_ = (bitField0_ & ~0x00000001); - halPackageName_ = getDefaultInstance().getHalPackageName(); - onChanged(); - return this; - } - - private int halVersionMajor_ ; - /** - * <pre> - * HAL (major) version. e.g. 1. - * </pre> - * - * <code>optional int32 hal_version_major = 2;</code> - */ - public boolean hasHalVersionMajor() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * HAL (major) version. e.g. 1. - * </pre> - * - * <code>optional int32 hal_version_major = 2;</code> - */ - public int getHalVersionMajor() { - return halVersionMajor_; - } - /** - * <pre> - * HAL (major) version. e.g. 1. - * </pre> - * - * <code>optional int32 hal_version_major = 2;</code> - */ - public Builder setHalVersionMajor(int value) { - bitField0_ |= 0x00000002; - halVersionMajor_ = value; - onChanged(); - return this; - } - /** - * <pre> - * HAL (major) version. e.g. 1. - * </pre> - * - * <code>optional int32 hal_version_major = 2;</code> - */ - public Builder clearHalVersionMajor() { - bitField0_ = (bitField0_ & ~0x00000002); - halVersionMajor_ = 0; - onChanged(); - return this; - } - - private int halVersionMinor_ ; - /** - * <pre> - * HAL (minor) version. e.g. 0. - * </pre> - * - * <code>optional int32 hal_version_minor = 3;</code> - */ - public boolean hasHalVersionMinor() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * HAL (minor) version. e.g. 0. - * </pre> - * - * <code>optional int32 hal_version_minor = 3;</code> - */ - public int getHalVersionMinor() { - return halVersionMinor_; - } - /** - * <pre> - * HAL (minor) version. e.g. 0. - * </pre> - * - * <code>optional int32 hal_version_minor = 3;</code> - */ - public Builder setHalVersionMinor(int value) { - bitField0_ |= 0x00000004; - halVersionMinor_ = value; - onChanged(); - return this; - } - /** - * <pre> - * HAL (minor) version. e.g. 0. - * </pre> - * - * <code>optional int32 hal_version_minor = 3;</code> - */ - public Builder clearHalVersionMinor() { - bitField0_ = (bitField0_ & ~0x00000004); - halVersionMinor_ = 0; - onChanged(); - return this; - } - - private com.google.protobuf.ByteString halInterfaceName_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * HAL interface name. e.g. IFoo. - * </pre> - * - * <code>optional bytes hal_interface_name = 4;</code> - */ - public boolean hasHalInterfaceName() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <pre> - * HAL interface name. e.g. IFoo. - * </pre> - * - * <code>optional bytes hal_interface_name = 4;</code> - */ - public com.google.protobuf.ByteString getHalInterfaceName() { - return halInterfaceName_; - } - /** - * <pre> - * HAL interface name. e.g. IFoo. - * </pre> - * - * <code>optional bytes hal_interface_name = 4;</code> - */ - public Builder setHalInterfaceName(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000008; - halInterfaceName_ = value; - onChanged(); - return this; - } - /** - * <pre> - * HAL interface name. e.g. IFoo. - * </pre> - * - * <code>optional bytes hal_interface_name = 4;</code> - */ - public Builder clearHalInterfaceName() { - bitField0_ = (bitField0_ & ~0x00000008); - halInterfaceName_ = getDefaultInstance().getHalInterfaceName(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString halReleaseLevel_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * HAL release level (e.g. "current", "27", "28") - * </pre> - * - * <code>optional bytes hal_release_level = 5;</code> - */ - public boolean hasHalReleaseLevel() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <pre> - * HAL release level (e.g. "current", "27", "28") - * </pre> - * - * <code>optional bytes hal_release_level = 5;</code> - */ - public com.google.protobuf.ByteString getHalReleaseLevel() { - return halReleaseLevel_; - } - /** - * <pre> - * HAL release level (e.g. "current", "27", "28") - * </pre> - * - * <code>optional bytes hal_release_level = 5;</code> - */ - public Builder setHalReleaseLevel(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000010; - halReleaseLevel_ = value; - onChanged(); - return this; - } - /** - * <pre> - * HAL release level (e.g. "current", "27", "28") - * </pre> - * - * <code>optional bytes hal_release_level = 5;</code> - */ - public Builder clearHalReleaseLevel() { - bitField0_ = (bitField0_ & ~0x00000010); - halReleaseLevel_ = getDefaultInstance().getHalReleaseLevel(); - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:android.vts.HalInterfaceMessage) - } - - // @@protoc_insertion_point(class_scope:android.vts.HalInterfaceMessage) - private static final com.android.vts.proto.VtsReportMessage.HalInterfaceMessage DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.android.vts.proto.VtsReportMessage.HalInterfaceMessage(); - } - - public static com.android.vts.proto.VtsReportMessage.HalInterfaceMessage getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - @java.lang.Deprecated public static final com.google.protobuf.Parser<HalInterfaceMessage> - PARSER = new com.google.protobuf.AbstractParser<HalInterfaceMessage>() { - public HalInterfaceMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new HalInterfaceMessage(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser<HalInterfaceMessage> parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser<HalInterfaceMessage> getParserForType() { - return PARSER; - } - - public com.android.vts.proto.VtsReportMessage.HalInterfaceMessage getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface ApiCoverageReportMessageOrBuilder extends - // @@protoc_insertion_point(interface_extends:android.vts.ApiCoverageReportMessage) - com.google.protobuf.MessageOrBuilder { - - /** - * <pre> - * Hal interface info. - * </pre> - * - * <code>optional .android.vts.HalInterfaceMessage hal_interface = 1;</code> - */ - boolean hasHalInterface(); - /** - * <pre> - * Hal interface info. - * </pre> - * - * <code>optional .android.vts.HalInterfaceMessage hal_interface = 1;</code> - */ - com.android.vts.proto.VtsReportMessage.HalInterfaceMessage getHalInterface(); - /** - * <pre> - * Hal interface info. - * </pre> - * - * <code>optional .android.vts.HalInterfaceMessage hal_interface = 1;</code> - */ - com.android.vts.proto.VtsReportMessage.HalInterfaceMessageOrBuilder getHalInterfaceOrBuilder(); - - /** - * <pre> - * APIs provided by the HAL with given package, version and interface name. - * </pre> - * - * <code>repeated bytes hal_api = 11;</code> - */ - java.util.List<com.google.protobuf.ByteString> getHalApiList(); - /** - * <pre> - * APIs provided by the HAL with given package, version and interface name. - * </pre> - * - * <code>repeated bytes hal_api = 11;</code> - */ - int getHalApiCount(); - /** - * <pre> - * APIs provided by the HAL with given package, version and interface name. - * </pre> - * - * <code>repeated bytes hal_api = 11;</code> - */ - com.google.protobuf.ByteString getHalApi(int index); - - /** - * <pre> - * APIs covered by the test. - * </pre> - * - * <code>repeated bytes covered_hal_api = 12;</code> - */ - java.util.List<com.google.protobuf.ByteString> getCoveredHalApiList(); - /** - * <pre> - * APIs covered by the test. - * </pre> - * - * <code>repeated bytes covered_hal_api = 12;</code> - */ - int getCoveredHalApiCount(); - /** - * <pre> - * APIs covered by the test. - * </pre> - * - * <code>repeated bytes covered_hal_api = 12;</code> - */ - com.google.protobuf.ByteString getCoveredHalApi(int index); - } - /** - * <pre> - * To specify a API coverage report. Currently only for HAL API coverage. - * </pre> - * - * Protobuf type {@code android.vts.ApiCoverageReportMessage} - */ - public static final class ApiCoverageReportMessage extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:android.vts.ApiCoverageReportMessage) - ApiCoverageReportMessageOrBuilder { - // Use ApiCoverageReportMessage.newBuilder() to construct. - private ApiCoverageReportMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { - super(builder); - } - private ApiCoverageReportMessage() { - halApi_ = java.util.Collections.emptyList(); - coveredHalApi_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private ApiCoverageReportMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.Builder subBuilder = null; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - subBuilder = halInterface_.toBuilder(); - } - halInterface_ = input.readMessage(com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(halInterface_); - halInterface_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000001; - break; - } - case 90: { - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - halApi_ = new java.util.ArrayList<com.google.protobuf.ByteString>(); - mutable_bitField0_ |= 0x00000002; - } - halApi_.add(input.readBytes()); - break; - } - case 98: { - if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - coveredHalApi_ = new java.util.ArrayList<com.google.protobuf.ByteString>(); - mutable_bitField0_ |= 0x00000004; - } - coveredHalApi_.add(input.readBytes()); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - halApi_ = java.util.Collections.unmodifiableList(halApi_); - } - if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - coveredHalApi_ = java.util.Collections.unmodifiableList(coveredHalApi_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_ApiCoverageReportMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_ApiCoverageReportMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.class, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder.class); - } - - private int bitField0_; - public static final int HAL_INTERFACE_FIELD_NUMBER = 1; - private com.android.vts.proto.VtsReportMessage.HalInterfaceMessage halInterface_; - /** - * <pre> - * Hal interface info. - * </pre> - * - * <code>optional .android.vts.HalInterfaceMessage hal_interface = 1;</code> - */ - public boolean hasHalInterface() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * Hal interface info. - * </pre> - * - * <code>optional .android.vts.HalInterfaceMessage hal_interface = 1;</code> - */ - public com.android.vts.proto.VtsReportMessage.HalInterfaceMessage getHalInterface() { - return halInterface_ == null ? com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.getDefaultInstance() : halInterface_; - } - /** - * <pre> - * Hal interface info. - * </pre> - * - * <code>optional .android.vts.HalInterfaceMessage hal_interface = 1;</code> - */ - public com.android.vts.proto.VtsReportMessage.HalInterfaceMessageOrBuilder getHalInterfaceOrBuilder() { - return halInterface_ == null ? com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.getDefaultInstance() : halInterface_; - } - - public static final int HAL_API_FIELD_NUMBER = 11; - private java.util.List<com.google.protobuf.ByteString> halApi_; - /** - * <pre> - * APIs provided by the HAL with given package, version and interface name. - * </pre> - * - * <code>repeated bytes hal_api = 11;</code> - */ - public java.util.List<com.google.protobuf.ByteString> - getHalApiList() { - return halApi_; - } - /** - * <pre> - * APIs provided by the HAL with given package, version and interface name. - * </pre> - * - * <code>repeated bytes hal_api = 11;</code> - */ - public int getHalApiCount() { - return halApi_.size(); - } - /** - * <pre> - * APIs provided by the HAL with given package, version and interface name. - * </pre> - * - * <code>repeated bytes hal_api = 11;</code> - */ - public com.google.protobuf.ByteString getHalApi(int index) { - return halApi_.get(index); - } - - public static final int COVERED_HAL_API_FIELD_NUMBER = 12; - private java.util.List<com.google.protobuf.ByteString> coveredHalApi_; - /** - * <pre> - * APIs covered by the test. - * </pre> - * - * <code>repeated bytes covered_hal_api = 12;</code> - */ - public java.util.List<com.google.protobuf.ByteString> - getCoveredHalApiList() { - return coveredHalApi_; - } - /** - * <pre> - * APIs covered by the test. - * </pre> - * - * <code>repeated bytes covered_hal_api = 12;</code> - */ - public int getCoveredHalApiCount() { - return coveredHalApi_.size(); - } - /** - * <pre> - * APIs covered by the test. - * </pre> - * - * <code>repeated bytes covered_hal_api = 12;</code> - */ - public com.google.protobuf.ByteString getCoveredHalApi(int index) { - return coveredHalApi_.get(index); - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, getHalInterface()); - } - for (int i = 0; i < halApi_.size(); i++) { - output.writeBytes(11, halApi_.get(i)); - } - for (int i = 0; i < coveredHalApi_.size(); i++) { - output.writeBytes(12, coveredHalApi_.get(i)); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, getHalInterface()); - } - { - int dataSize = 0; - for (int i = 0; i < halApi_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeBytesSizeNoTag(halApi_.get(i)); - } - size += dataSize; - size += 1 * getHalApiList().size(); - } - { - int dataSize = 0; - for (int i = 0; i < coveredHalApi_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeBytesSizeNoTag(coveredHalApi_.get(i)); - } - size += dataSize; - size += 1 * getCoveredHalApiList().size(); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage)) { - return super.equals(obj); - } - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage other = (com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage) obj; - - boolean result = true; - result = result && (hasHalInterface() == other.hasHalInterface()); - if (hasHalInterface()) { - result = result && getHalInterface() - .equals(other.getHalInterface()); - } - result = result && getHalApiList() - .equals(other.getHalApiList()); - result = result && getCoveredHalApiList() - .equals(other.getCoveredHalApiList()); - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - if (hasHalInterface()) { - hash = (37 * hash) + HAL_INTERFACE_FIELD_NUMBER; - hash = (53 * hash) + getHalInterface().hashCode(); - } - if (getHalApiCount() > 0) { - hash = (37 * hash) + HAL_API_FIELD_NUMBER; - hash = (53 * hash) + getHalApiList().hashCode(); - } - if (getCoveredHalApiCount() > 0) { - hash = (37 * hash) + COVERED_HAL_API_FIELD_NUMBER; - hash = (53 * hash) + getCoveredHalApiList().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * <pre> - * To specify a API coverage report. Currently only for HAL API coverage. - * </pre> - * - * Protobuf type {@code android.vts.ApiCoverageReportMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements - // @@protoc_insertion_point(builder_implements:android.vts.ApiCoverageReportMessage) - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_ApiCoverageReportMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_ApiCoverageReportMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.class, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder.class); - } - - // Construct using com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getHalInterfaceFieldBuilder(); - } - } - public Builder clear() { - super.clear(); - if (halInterfaceBuilder_ == null) { - halInterface_ = null; - } else { - halInterfaceBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - halApi_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - coveredHalApi_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_ApiCoverageReportMessage_descriptor; - } - - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage getDefaultInstanceForType() { - return com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.getDefaultInstance(); - } - - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage build() { - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage buildPartial() { - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage result = new com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - if (halInterfaceBuilder_ == null) { - result.halInterface_ = halInterface_; - } else { - result.halInterface_ = halInterfaceBuilder_.build(); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - halApi_ = java.util.Collections.unmodifiableList(halApi_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.halApi_ = halApi_; - if (((bitField0_ & 0x00000004) == 0x00000004)) { - coveredHalApi_ = java.util.Collections.unmodifiableList(coveredHalApi_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.coveredHalApi_ = coveredHalApi_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage) { - return mergeFrom((com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage other) { - if (other == com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.getDefaultInstance()) return this; - if (other.hasHalInterface()) { - mergeHalInterface(other.getHalInterface()); - } - if (!other.halApi_.isEmpty()) { - if (halApi_.isEmpty()) { - halApi_ = other.halApi_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureHalApiIsMutable(); - halApi_.addAll(other.halApi_); - } - onChanged(); - } - if (!other.coveredHalApi_.isEmpty()) { - if (coveredHalApi_.isEmpty()) { - coveredHalApi_ = other.coveredHalApi_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureCoveredHalApiIsMutable(); - coveredHalApi_.addAll(other.coveredHalApi_); - } - onChanged(); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private com.android.vts.proto.VtsReportMessage.HalInterfaceMessage halInterface_ = null; - private com.google.protobuf.SingleFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.HalInterfaceMessage, com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.Builder, com.android.vts.proto.VtsReportMessage.HalInterfaceMessageOrBuilder> halInterfaceBuilder_; - /** - * <pre> - * Hal interface info. - * </pre> - * - * <code>optional .android.vts.HalInterfaceMessage hal_interface = 1;</code> - */ - public boolean hasHalInterface() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * Hal interface info. - * </pre> - * - * <code>optional .android.vts.HalInterfaceMessage hal_interface = 1;</code> - */ - public com.android.vts.proto.VtsReportMessage.HalInterfaceMessage getHalInterface() { - if (halInterfaceBuilder_ == null) { - return halInterface_ == null ? com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.getDefaultInstance() : halInterface_; - } else { - return halInterfaceBuilder_.getMessage(); - } - } - /** - * <pre> - * Hal interface info. - * </pre> - * - * <code>optional .android.vts.HalInterfaceMessage hal_interface = 1;</code> - */ - public Builder setHalInterface(com.android.vts.proto.VtsReportMessage.HalInterfaceMessage value) { - if (halInterfaceBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - halInterface_ = value; - onChanged(); - } else { - halInterfaceBuilder_.setMessage(value); - } - bitField0_ |= 0x00000001; - return this; - } - /** - * <pre> - * Hal interface info. - * </pre> - * - * <code>optional .android.vts.HalInterfaceMessage hal_interface = 1;</code> - */ - public Builder setHalInterface( - com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.Builder builderForValue) { - if (halInterfaceBuilder_ == null) { - halInterface_ = builderForValue.build(); - onChanged(); - } else { - halInterfaceBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000001; - return this; - } - /** - * <pre> - * Hal interface info. - * </pre> - * - * <code>optional .android.vts.HalInterfaceMessage hal_interface = 1;</code> - */ - public Builder mergeHalInterface(com.android.vts.proto.VtsReportMessage.HalInterfaceMessage value) { - if (halInterfaceBuilder_ == null) { - if (((bitField0_ & 0x00000001) == 0x00000001) && - halInterface_ != null && - halInterface_ != com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.getDefaultInstance()) { - halInterface_ = - com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.newBuilder(halInterface_).mergeFrom(value).buildPartial(); - } else { - halInterface_ = value; - } - onChanged(); - } else { - halInterfaceBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000001; - return this; - } - /** - * <pre> - * Hal interface info. - * </pre> - * - * <code>optional .android.vts.HalInterfaceMessage hal_interface = 1;</code> - */ - public Builder clearHalInterface() { - if (halInterfaceBuilder_ == null) { - halInterface_ = null; - onChanged(); - } else { - halInterfaceBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - /** - * <pre> - * Hal interface info. - * </pre> - * - * <code>optional .android.vts.HalInterfaceMessage hal_interface = 1;</code> - */ - public com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.Builder getHalInterfaceBuilder() { - bitField0_ |= 0x00000001; - onChanged(); - return getHalInterfaceFieldBuilder().getBuilder(); - } - /** - * <pre> - * Hal interface info. - * </pre> - * - * <code>optional .android.vts.HalInterfaceMessage hal_interface = 1;</code> - */ - public com.android.vts.proto.VtsReportMessage.HalInterfaceMessageOrBuilder getHalInterfaceOrBuilder() { - if (halInterfaceBuilder_ != null) { - return halInterfaceBuilder_.getMessageOrBuilder(); - } else { - return halInterface_ == null ? - com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.getDefaultInstance() : halInterface_; - } - } - /** - * <pre> - * Hal interface info. - * </pre> - * - * <code>optional .android.vts.HalInterfaceMessage hal_interface = 1;</code> - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.HalInterfaceMessage, com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.Builder, com.android.vts.proto.VtsReportMessage.HalInterfaceMessageOrBuilder> - getHalInterfaceFieldBuilder() { - if (halInterfaceBuilder_ == null) { - halInterfaceBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.HalInterfaceMessage, com.android.vts.proto.VtsReportMessage.HalInterfaceMessage.Builder, com.android.vts.proto.VtsReportMessage.HalInterfaceMessageOrBuilder>( - getHalInterface(), - getParentForChildren(), - isClean()); - halInterface_ = null; - } - return halInterfaceBuilder_; - } - - private java.util.List<com.google.protobuf.ByteString> halApi_ = java.util.Collections.emptyList(); - private void ensureHalApiIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - halApi_ = new java.util.ArrayList<com.google.protobuf.ByteString>(halApi_); - bitField0_ |= 0x00000002; - } - } - /** - * <pre> - * APIs provided by the HAL with given package, version and interface name. - * </pre> - * - * <code>repeated bytes hal_api = 11;</code> - */ - public java.util.List<com.google.protobuf.ByteString> - getHalApiList() { - return java.util.Collections.unmodifiableList(halApi_); - } - /** - * <pre> - * APIs provided by the HAL with given package, version and interface name. - * </pre> - * - * <code>repeated bytes hal_api = 11;</code> - */ - public int getHalApiCount() { - return halApi_.size(); - } - /** - * <pre> - * APIs provided by the HAL with given package, version and interface name. - * </pre> - * - * <code>repeated bytes hal_api = 11;</code> - */ - public com.google.protobuf.ByteString getHalApi(int index) { - return halApi_.get(index); - } - /** - * <pre> - * APIs provided by the HAL with given package, version and interface name. - * </pre> - * - * <code>repeated bytes hal_api = 11;</code> - */ - public Builder setHalApi( - int index, com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureHalApiIsMutable(); - halApi_.set(index, value); - onChanged(); - return this; - } - /** - * <pre> - * APIs provided by the HAL with given package, version and interface name. - * </pre> - * - * <code>repeated bytes hal_api = 11;</code> - */ - public Builder addHalApi(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureHalApiIsMutable(); - halApi_.add(value); - onChanged(); - return this; - } - /** - * <pre> - * APIs provided by the HAL with given package, version and interface name. - * </pre> - * - * <code>repeated bytes hal_api = 11;</code> - */ - public Builder addAllHalApi( - java.lang.Iterable<? extends com.google.protobuf.ByteString> values) { - ensureHalApiIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, halApi_); - onChanged(); - return this; - } - /** - * <pre> - * APIs provided by the HAL with given package, version and interface name. - * </pre> - * - * <code>repeated bytes hal_api = 11;</code> - */ - public Builder clearHalApi() { - halApi_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - return this; - } - - private java.util.List<com.google.protobuf.ByteString> coveredHalApi_ = java.util.Collections.emptyList(); - private void ensureCoveredHalApiIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - coveredHalApi_ = new java.util.ArrayList<com.google.protobuf.ByteString>(coveredHalApi_); - bitField0_ |= 0x00000004; - } - } - /** - * <pre> - * APIs covered by the test. - * </pre> - * - * <code>repeated bytes covered_hal_api = 12;</code> - */ - public java.util.List<com.google.protobuf.ByteString> - getCoveredHalApiList() { - return java.util.Collections.unmodifiableList(coveredHalApi_); - } - /** - * <pre> - * APIs covered by the test. - * </pre> - * - * <code>repeated bytes covered_hal_api = 12;</code> - */ - public int getCoveredHalApiCount() { - return coveredHalApi_.size(); - } - /** - * <pre> - * APIs covered by the test. - * </pre> - * - * <code>repeated bytes covered_hal_api = 12;</code> - */ - public com.google.protobuf.ByteString getCoveredHalApi(int index) { - return coveredHalApi_.get(index); - } - /** - * <pre> - * APIs covered by the test. - * </pre> - * - * <code>repeated bytes covered_hal_api = 12;</code> - */ - public Builder setCoveredHalApi( - int index, com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureCoveredHalApiIsMutable(); - coveredHalApi_.set(index, value); - onChanged(); - return this; - } - /** - * <pre> - * APIs covered by the test. - * </pre> - * - * <code>repeated bytes covered_hal_api = 12;</code> - */ - public Builder addCoveredHalApi(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureCoveredHalApiIsMutable(); - coveredHalApi_.add(value); - onChanged(); - return this; - } - /** - * <pre> - * APIs covered by the test. - * </pre> - * - * <code>repeated bytes covered_hal_api = 12;</code> - */ - public Builder addAllCoveredHalApi( - java.lang.Iterable<? extends com.google.protobuf.ByteString> values) { - ensureCoveredHalApiIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, coveredHalApi_); - onChanged(); - return this; - } - /** - * <pre> - * APIs covered by the test. - * </pre> - * - * <code>repeated bytes covered_hal_api = 12;</code> - */ - public Builder clearCoveredHalApi() { - coveredHalApi_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:android.vts.ApiCoverageReportMessage) - } - - // @@protoc_insertion_point(class_scope:android.vts.ApiCoverageReportMessage) - private static final com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage(); - } - - public static com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - @java.lang.Deprecated public static final com.google.protobuf.Parser<ApiCoverageReportMessage> - PARSER = new com.google.protobuf.AbstractParser<ApiCoverageReportMessage>() { - public ApiCoverageReportMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new ApiCoverageReportMessage(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser<ApiCoverageReportMessage> parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser<ApiCoverageReportMessage> getParserForType() { - return PARSER; - } - - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface LogMessageOrBuilder extends - // @@protoc_insertion_point(interface_extends:android.vts.LogMessage) - com.google.protobuf.MessageOrBuilder { - - /** - * <pre> - * URL of a produced log file (e.g., stdout, stderr). - * </pre> - * - * <code>optional bytes url = 1;</code> - */ - boolean hasUrl(); - /** - * <pre> - * URL of a produced log file (e.g., stdout, stderr). - * </pre> - * - * <code>optional bytes url = 1;</code> - */ - com.google.protobuf.ByteString getUrl(); - - /** - * <pre> - * Name of a log file. - * </pre> - * - * <code>optional bytes name = 2;</code> - */ - boolean hasName(); - /** - * <pre> - * Name of a log file. - * </pre> - * - * <code>optional bytes name = 2;</code> - */ - com.google.protobuf.ByteString getName(); - - /** - * <pre> - * Content of log. Caution: do not put too much log in protobuf message, - * as BigTable for example recommends < 10 MB for each record cell. - * </pre> - * - * <code>optional bytes content = 3;</code> - */ - boolean hasContent(); - /** - * <pre> - * Content of log. Caution: do not put too much log in protobuf message, - * as BigTable for example recommends < 10 MB for each record cell. - * </pre> - * - * <code>optional bytes content = 3;</code> - */ - com.google.protobuf.ByteString getContent(); - } - /** - * <pre> - * To specify log report. This can be used either for per-test-module - * log message or per-test-case log message. - * </pre> - * - * Protobuf type {@code android.vts.LogMessage} - */ - public static final class LogMessage extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:android.vts.LogMessage) - LogMessageOrBuilder { - // Use LogMessage.newBuilder() to construct. - private LogMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { - super(builder); - } - private LogMessage() { - url_ = com.google.protobuf.ByteString.EMPTY; - name_ = com.google.protobuf.ByteString.EMPTY; - content_ = com.google.protobuf.ByteString.EMPTY; - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private LogMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - url_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - name_ = input.readBytes(); - break; - } - case 26: { - bitField0_ |= 0x00000004; - content_ = input.readBytes(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_LogMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_LogMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.LogMessage.class, com.android.vts.proto.VtsReportMessage.LogMessage.Builder.class); - } - - private int bitField0_; - public static final int URL_FIELD_NUMBER = 1; - private com.google.protobuf.ByteString url_; - /** - * <pre> - * URL of a produced log file (e.g., stdout, stderr). - * </pre> - * - * <code>optional bytes url = 1;</code> - */ - public boolean hasUrl() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * URL of a produced log file (e.g., stdout, stderr). - * </pre> - * - * <code>optional bytes url = 1;</code> - */ - public com.google.protobuf.ByteString getUrl() { - return url_; - } - - public static final int NAME_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString name_; - /** - * <pre> - * Name of a log file. - * </pre> - * - * <code>optional bytes name = 2;</code> - */ - public boolean hasName() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * Name of a log file. - * </pre> - * - * <code>optional bytes name = 2;</code> - */ - public com.google.protobuf.ByteString getName() { - return name_; - } - - public static final int CONTENT_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString content_; - /** - * <pre> - * Content of log. Caution: do not put too much log in protobuf message, - * as BigTable for example recommends < 10 MB for each record cell. - * </pre> - * - * <code>optional bytes content = 3;</code> - */ - public boolean hasContent() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * Content of log. Caution: do not put too much log in protobuf message, - * as BigTable for example recommends < 10 MB for each record cell. - * </pre> - * - * <code>optional bytes content = 3;</code> - */ - public com.google.protobuf.ByteString getContent() { - return content_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, url_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, name_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, content_); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, url_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, name_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, content_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.android.vts.proto.VtsReportMessage.LogMessage)) { - return super.equals(obj); - } - com.android.vts.proto.VtsReportMessage.LogMessage other = (com.android.vts.proto.VtsReportMessage.LogMessage) obj; - - boolean result = true; - result = result && (hasUrl() == other.hasUrl()); - if (hasUrl()) { - result = result && getUrl() - .equals(other.getUrl()); - } - result = result && (hasName() == other.hasName()); - if (hasName()) { - result = result && getName() - .equals(other.getName()); - } - result = result && (hasContent() == other.hasContent()); - if (hasContent()) { - result = result && getContent() - .equals(other.getContent()); - } - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - if (hasUrl()) { - hash = (37 * hash) + URL_FIELD_NUMBER; - hash = (53 * hash) + getUrl().hashCode(); - } - if (hasName()) { - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - } - if (hasContent()) { - hash = (37 * hash) + CONTENT_FIELD_NUMBER; - hash = (53 * hash) + getContent().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.android.vts.proto.VtsReportMessage.LogMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.LogMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.LogMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.LogMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.LogMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.LogMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.LogMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.LogMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.LogMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.LogMessage parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.android.vts.proto.VtsReportMessage.LogMessage prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * <pre> - * To specify log report. This can be used either for per-test-module - * log message or per-test-case log message. - * </pre> - * - * Protobuf type {@code android.vts.LogMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements - // @@protoc_insertion_point(builder_implements:android.vts.LogMessage) - com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_LogMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_LogMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.LogMessage.class, com.android.vts.proto.VtsReportMessage.LogMessage.Builder.class); - } - - // Construct using com.android.vts.proto.VtsReportMessage.LogMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - url_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - name_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000002); - content_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_LogMessage_descriptor; - } - - public com.android.vts.proto.VtsReportMessage.LogMessage getDefaultInstanceForType() { - return com.android.vts.proto.VtsReportMessage.LogMessage.getDefaultInstance(); - } - - public com.android.vts.proto.VtsReportMessage.LogMessage build() { - com.android.vts.proto.VtsReportMessage.LogMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.android.vts.proto.VtsReportMessage.LogMessage buildPartial() { - com.android.vts.proto.VtsReportMessage.LogMessage result = new com.android.vts.proto.VtsReportMessage.LogMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.url_ = url_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.name_ = name_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.content_ = content_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.android.vts.proto.VtsReportMessage.LogMessage) { - return mergeFrom((com.android.vts.proto.VtsReportMessage.LogMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.android.vts.proto.VtsReportMessage.LogMessage other) { - if (other == com.android.vts.proto.VtsReportMessage.LogMessage.getDefaultInstance()) return this; - if (other.hasUrl()) { - setUrl(other.getUrl()); - } - if (other.hasName()) { - setName(other.getName()); - } - if (other.hasContent()) { - setContent(other.getContent()); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.android.vts.proto.VtsReportMessage.LogMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.android.vts.proto.VtsReportMessage.LogMessage) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private com.google.protobuf.ByteString url_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * URL of a produced log file (e.g., stdout, stderr). - * </pre> - * - * <code>optional bytes url = 1;</code> - */ - public boolean hasUrl() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * URL of a produced log file (e.g., stdout, stderr). - * </pre> - * - * <code>optional bytes url = 1;</code> - */ - public com.google.protobuf.ByteString getUrl() { - return url_; - } - /** - * <pre> - * URL of a produced log file (e.g., stdout, stderr). - * </pre> - * - * <code>optional bytes url = 1;</code> - */ - public Builder setUrl(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - url_ = value; - onChanged(); - return this; - } - /** - * <pre> - * URL of a produced log file (e.g., stdout, stderr). - * </pre> - * - * <code>optional bytes url = 1;</code> - */ - public Builder clearUrl() { - bitField0_ = (bitField0_ & ~0x00000001); - url_ = getDefaultInstance().getUrl(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString name_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * Name of a log file. - * </pre> - * - * <code>optional bytes name = 2;</code> - */ - public boolean hasName() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * Name of a log file. - * </pre> - * - * <code>optional bytes name = 2;</code> - */ - public com.google.protobuf.ByteString getName() { - return name_; - } - /** - * <pre> - * Name of a log file. - * </pre> - * - * <code>optional bytes name = 2;</code> - */ - public Builder setName(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - name_ = value; - onChanged(); - return this; - } - /** - * <pre> - * Name of a log file. - * </pre> - * - * <code>optional bytes name = 2;</code> - */ - public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000002); - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString content_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * Content of log. Caution: do not put too much log in protobuf message, - * as BigTable for example recommends < 10 MB for each record cell. - * </pre> - * - * <code>optional bytes content = 3;</code> - */ - public boolean hasContent() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * Content of log. Caution: do not put too much log in protobuf message, - * as BigTable for example recommends < 10 MB for each record cell. - * </pre> - * - * <code>optional bytes content = 3;</code> - */ - public com.google.protobuf.ByteString getContent() { - return content_; - } - /** - * <pre> - * Content of log. Caution: do not put too much log in protobuf message, - * as BigTable for example recommends < 10 MB for each record cell. - * </pre> - * - * <code>optional bytes content = 3;</code> - */ - public Builder setContent(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - content_ = value; - onChanged(); - return this; - } - /** - * <pre> - * Content of log. Caution: do not put too much log in protobuf message, - * as BigTable for example recommends < 10 MB for each record cell. - * </pre> - * - * <code>optional bytes content = 3;</code> - */ - public Builder clearContent() { - bitField0_ = (bitField0_ & ~0x00000004); - content_ = getDefaultInstance().getContent(); - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:android.vts.LogMessage) - } - - // @@protoc_insertion_point(class_scope:android.vts.LogMessage) - private static final com.android.vts.proto.VtsReportMessage.LogMessage DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.android.vts.proto.VtsReportMessage.LogMessage(); - } - - public static com.android.vts.proto.VtsReportMessage.LogMessage getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - @java.lang.Deprecated public static final com.google.protobuf.Parser<LogMessage> - PARSER = new com.google.protobuf.AbstractParser<LogMessage>() { - public LogMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new LogMessage(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser<LogMessage> parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser<LogMessage> getParserForType() { - return PARSER; - } - - public com.android.vts.proto.VtsReportMessage.LogMessage getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface UrlResourceMessageOrBuilder extends - // @@protoc_insertion_point(interface_extends:android.vts.UrlResourceMessage) - com.google.protobuf.MessageOrBuilder { - - /** - * <pre> - * URL of a resource file. - * </pre> - * - * <code>optional bytes url = 1;</code> - */ - boolean hasUrl(); - /** - * <pre> - * URL of a resource file. - * </pre> - * - * <code>optional bytes url = 1;</code> - */ - com.google.protobuf.ByteString getUrl(); - - /** - * <pre> - * Name of a resource file representing its type and does not have to be - * the same as the exact file name. - * </pre> - * - * <code>optional bytes name = 2;</code> - */ - boolean hasName(); - /** - * <pre> - * Name of a resource file representing its type and does not have to be - * the same as the exact file name. - * </pre> - * - * <code>optional bytes name = 2;</code> - */ - com.google.protobuf.ByteString getName(); - - /** - * <pre> - * Raw content of a resource file. Used if the file is small. - * </pre> - * - * <code>optional bytes content = 3;</code> - */ - boolean hasContent(); - /** - * <pre> - * Raw content of a resource file. Used if the file is small. - * </pre> - * - * <code>optional bytes content = 3;</code> - */ - com.google.protobuf.ByteString getContent(); - } - /** - * <pre> - * To specify a resource object (reachable via a URL or contained in the - * message). This can be used to store a log file or an XML (or HTML) report - * file kept in a Google Cloud Storage (GCS) bucket or partner's network file - * system, or hosted by a HTTP server. - * </pre> - * - * Protobuf type {@code android.vts.UrlResourceMessage} - */ - public static final class UrlResourceMessage extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:android.vts.UrlResourceMessage) - UrlResourceMessageOrBuilder { - // Use UrlResourceMessage.newBuilder() to construct. - private UrlResourceMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { - super(builder); - } - private UrlResourceMessage() { - url_ = com.google.protobuf.ByteString.EMPTY; - name_ = com.google.protobuf.ByteString.EMPTY; - content_ = com.google.protobuf.ByteString.EMPTY; - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private UrlResourceMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - url_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - name_ = input.readBytes(); - break; - } - case 26: { - bitField0_ |= 0x00000004; - content_ = input.readBytes(); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_UrlResourceMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_UrlResourceMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.UrlResourceMessage.class, com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder.class); - } - - private int bitField0_; - public static final int URL_FIELD_NUMBER = 1; - private com.google.protobuf.ByteString url_; - /** - * <pre> - * URL of a resource file. - * </pre> - * - * <code>optional bytes url = 1;</code> - */ - public boolean hasUrl() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * URL of a resource file. - * </pre> - * - * <code>optional bytes url = 1;</code> - */ - public com.google.protobuf.ByteString getUrl() { - return url_; - } - - public static final int NAME_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString name_; - /** - * <pre> - * Name of a resource file representing its type and does not have to be - * the same as the exact file name. - * </pre> - * - * <code>optional bytes name = 2;</code> - */ - public boolean hasName() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * Name of a resource file representing its type and does not have to be - * the same as the exact file name. - * </pre> - * - * <code>optional bytes name = 2;</code> - */ - public com.google.protobuf.ByteString getName() { - return name_; - } - - public static final int CONTENT_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString content_; - /** - * <pre> - * Raw content of a resource file. Used if the file is small. - * </pre> - * - * <code>optional bytes content = 3;</code> - */ - public boolean hasContent() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * Raw content of a resource file. Used if the file is small. - * </pre> - * - * <code>optional bytes content = 3;</code> - */ - public com.google.protobuf.ByteString getContent() { - return content_; - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, url_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, name_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, content_); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, url_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, name_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, content_); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.android.vts.proto.VtsReportMessage.UrlResourceMessage)) { - return super.equals(obj); - } - com.android.vts.proto.VtsReportMessage.UrlResourceMessage other = (com.android.vts.proto.VtsReportMessage.UrlResourceMessage) obj; - - boolean result = true; - result = result && (hasUrl() == other.hasUrl()); - if (hasUrl()) { - result = result && getUrl() - .equals(other.getUrl()); - } - result = result && (hasName() == other.hasName()); - if (hasName()) { - result = result && getName() - .equals(other.getName()); - } - result = result && (hasContent() == other.hasContent()); - if (hasContent()) { - result = result && getContent() - .equals(other.getContent()); - } - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - if (hasUrl()) { - hash = (37 * hash) + URL_FIELD_NUMBER; - hash = (53 * hash) + getUrl().hashCode(); - } - if (hasName()) { - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - } - if (hasContent()) { - hash = (37 * hash) + CONTENT_FIELD_NUMBER; - hash = (53 * hash) + getContent().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.android.vts.proto.VtsReportMessage.UrlResourceMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.UrlResourceMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.UrlResourceMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.UrlResourceMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.UrlResourceMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.UrlResourceMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.UrlResourceMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.UrlResourceMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.UrlResourceMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.UrlResourceMessage parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.android.vts.proto.VtsReportMessage.UrlResourceMessage prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * <pre> - * To specify a resource object (reachable via a URL or contained in the - * message). This can be used to store a log file or an XML (or HTML) report - * file kept in a Google Cloud Storage (GCS) bucket or partner's network file - * system, or hosted by a HTTP server. - * </pre> - * - * Protobuf type {@code android.vts.UrlResourceMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements - // @@protoc_insertion_point(builder_implements:android.vts.UrlResourceMessage) - com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_UrlResourceMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_UrlResourceMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.UrlResourceMessage.class, com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder.class); - } - - // Construct using com.android.vts.proto.VtsReportMessage.UrlResourceMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - } - } - public Builder clear() { - super.clear(); - url_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - name_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000002); - content_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000004); - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_UrlResourceMessage_descriptor; - } - - public com.android.vts.proto.VtsReportMessage.UrlResourceMessage getDefaultInstanceForType() { - return com.android.vts.proto.VtsReportMessage.UrlResourceMessage.getDefaultInstance(); - } - - public com.android.vts.proto.VtsReportMessage.UrlResourceMessage build() { - com.android.vts.proto.VtsReportMessage.UrlResourceMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.android.vts.proto.VtsReportMessage.UrlResourceMessage buildPartial() { - com.android.vts.proto.VtsReportMessage.UrlResourceMessage result = new com.android.vts.proto.VtsReportMessage.UrlResourceMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.url_ = url_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.name_ = name_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.content_ = content_; - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.android.vts.proto.VtsReportMessage.UrlResourceMessage) { - return mergeFrom((com.android.vts.proto.VtsReportMessage.UrlResourceMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.android.vts.proto.VtsReportMessage.UrlResourceMessage other) { - if (other == com.android.vts.proto.VtsReportMessage.UrlResourceMessage.getDefaultInstance()) return this; - if (other.hasUrl()) { - setUrl(other.getUrl()); - } - if (other.hasName()) { - setName(other.getName()); - } - if (other.hasContent()) { - setContent(other.getContent()); - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.android.vts.proto.VtsReportMessage.UrlResourceMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.android.vts.proto.VtsReportMessage.UrlResourceMessage) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private com.google.protobuf.ByteString url_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * URL of a resource file. - * </pre> - * - * <code>optional bytes url = 1;</code> - */ - public boolean hasUrl() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * URL of a resource file. - * </pre> - * - * <code>optional bytes url = 1;</code> - */ - public com.google.protobuf.ByteString getUrl() { - return url_; - } - /** - * <pre> - * URL of a resource file. - * </pre> - * - * <code>optional bytes url = 1;</code> - */ - public Builder setUrl(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - url_ = value; - onChanged(); - return this; - } - /** - * <pre> - * URL of a resource file. - * </pre> - * - * <code>optional bytes url = 1;</code> - */ - public Builder clearUrl() { - bitField0_ = (bitField0_ & ~0x00000001); - url_ = getDefaultInstance().getUrl(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString name_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * Name of a resource file representing its type and does not have to be - * the same as the exact file name. - * </pre> - * - * <code>optional bytes name = 2;</code> - */ - public boolean hasName() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * Name of a resource file representing its type and does not have to be - * the same as the exact file name. - * </pre> - * - * <code>optional bytes name = 2;</code> - */ - public com.google.protobuf.ByteString getName() { - return name_; - } - /** - * <pre> - * Name of a resource file representing its type and does not have to be - * the same as the exact file name. - * </pre> - * - * <code>optional bytes name = 2;</code> - */ - public Builder setName(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - name_ = value; - onChanged(); - return this; - } - /** - * <pre> - * Name of a resource file representing its type and does not have to be - * the same as the exact file name. - * </pre> - * - * <code>optional bytes name = 2;</code> - */ - public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000002); - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString content_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * Raw content of a resource file. Used if the file is small. - * </pre> - * - * <code>optional bytes content = 3;</code> - */ - public boolean hasContent() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * Raw content of a resource file. Used if the file is small. - * </pre> - * - * <code>optional bytes content = 3;</code> - */ - public com.google.protobuf.ByteString getContent() { - return content_; - } - /** - * <pre> - * Raw content of a resource file. Used if the file is small. - * </pre> - * - * <code>optional bytes content = 3;</code> - */ - public Builder setContent(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - content_ = value; - onChanged(); - return this; - } - /** - * <pre> - * Raw content of a resource file. Used if the file is small. - * </pre> - * - * <code>optional bytes content = 3;</code> - */ - public Builder clearContent() { - bitField0_ = (bitField0_ & ~0x00000004); - content_ = getDefaultInstance().getContent(); - onChanged(); - return this; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:android.vts.UrlResourceMessage) - } - - // @@protoc_insertion_point(class_scope:android.vts.UrlResourceMessage) - private static final com.android.vts.proto.VtsReportMessage.UrlResourceMessage DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.android.vts.proto.VtsReportMessage.UrlResourceMessage(); - } - - public static com.android.vts.proto.VtsReportMessage.UrlResourceMessage getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - @java.lang.Deprecated public static final com.google.protobuf.Parser<UrlResourceMessage> - PARSER = new com.google.protobuf.AbstractParser<UrlResourceMessage>() { - public UrlResourceMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new UrlResourceMessage(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser<UrlResourceMessage> parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser<UrlResourceMessage> getParserForType() { - return PARSER; - } - - public com.android.vts.proto.VtsReportMessage.UrlResourceMessage getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface TestReportMessageOrBuilder extends - // @@protoc_insertion_point(interface_extends:android.vts.TestReportMessage) - com.google.protobuf.MessageOrBuilder { - - /** - * <pre> - * The test suite name. - * </pre> - * - * <code>optional bytes test_suite = 1 [deprecated = true];</code> - */ - @java.lang.Deprecated boolean hasTestSuite(); - /** - * <pre> - * The test suite name. - * </pre> - * - * <code>optional bytes test_suite = 1 [deprecated = true];</code> - */ - @java.lang.Deprecated com.google.protobuf.ByteString getTestSuite(); - - /** - * <pre> - * The test name. - * </pre> - * - * <code>optional bytes test = 2;</code> - */ - boolean hasTest(); - /** - * <pre> - * The test name. - * </pre> - * - * <code>optional bytes test = 2;</code> - */ - com.google.protobuf.ByteString getTest(); - - /** - * <pre> - * The test type - * </pre> - * - * <code>optional .android.vts.VtsTestType test_type = 3;</code> - */ - boolean hasTestType(); - /** - * <pre> - * The test type - * </pre> - * - * <code>optional .android.vts.VtsTestType test_type = 3;</code> - */ - com.android.vts.proto.VtsReportMessage.VtsTestType getTestType(); - - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - java.util.List<com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage> - getDeviceInfoList(); - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage getDeviceInfo(int index); - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - int getDeviceInfoCount(); - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - java.util.List<? extends com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessageOrBuilder> - getDeviceInfoOrBuilderList(); - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessageOrBuilder getDeviceInfoOrBuilder( - int index); - - /** - * <pre> - * Build info - * </pre> - * - * <code>optional .android.vts.AndroidBuildInfo build_info = 5;</code> - */ - boolean hasBuildInfo(); - /** - * <pre> - * Build info - * </pre> - * - * <code>optional .android.vts.AndroidBuildInfo build_info = 5;</code> - */ - com.android.vts.proto.VtsReportMessage.AndroidBuildInfo getBuildInfo(); - /** - * <pre> - * Build info - * </pre> - * - * <code>optional .android.vts.AndroidBuildInfo build_info = 5;</code> - */ - com.android.vts.proto.VtsReportMessage.AndroidBuildInfoOrBuilder getBuildInfoOrBuilder(); - - /** - * <pre> - * Email addresses of subscribers to the test results - * </pre> - * - * <code>repeated bytes subscriber_email = 6;</code> - */ - java.util.List<com.google.protobuf.ByteString> getSubscriberEmailList(); - /** - * <pre> - * Email addresses of subscribers to the test results - * </pre> - * - * <code>repeated bytes subscriber_email = 6;</code> - */ - int getSubscriberEmailCount(); - /** - * <pre> - * Email addresses of subscribers to the test results - * </pre> - * - * <code>repeated bytes subscriber_email = 6;</code> - */ - com.google.protobuf.ByteString getSubscriberEmail(int index); - - /** - * <pre> - * Info about the host computer - * </pre> - * - * <code>optional .android.vts.VtsHostInfo host_info = 7;</code> - */ - boolean hasHostInfo(); - /** - * <pre> - * Info about the host computer - * </pre> - * - * <code>optional .android.vts.VtsHostInfo host_info = 7;</code> - */ - com.android.vts.proto.VtsReportMessage.VtsHostInfo getHostInfo(); - /** - * <pre> - * Info about the host computer - * </pre> - * - * <code>optional .android.vts.VtsHostInfo host_info = 7;</code> - */ - com.android.vts.proto.VtsReportMessage.VtsHostInfoOrBuilder getHostInfoOrBuilder(); - - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - java.util.List<com.android.vts.proto.VtsReportMessage.TestCaseReportMessage> - getTestCaseList(); - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - com.android.vts.proto.VtsReportMessage.TestCaseReportMessage getTestCase(int index); - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - int getTestCaseCount(); - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - java.util.List<? extends com.android.vts.proto.VtsReportMessage.TestCaseReportMessageOrBuilder> - getTestCaseOrBuilderList(); - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - com.android.vts.proto.VtsReportMessage.TestCaseReportMessageOrBuilder getTestCaseOrBuilder( - int index); - - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - java.util.List<com.android.vts.proto.VtsReportMessage.ProfilingReportMessage> - getProfilingList(); - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage getProfiling(int index); - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - int getProfilingCount(); - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - java.util.List<? extends com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder> - getProfilingOrBuilderList(); - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder getProfilingOrBuilder( - int index); - - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated java.util.List<com.android.vts.proto.VtsReportMessage.SystraceReportMessage> - getSystraceList(); - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated com.android.vts.proto.VtsReportMessage.SystraceReportMessage getSystrace(int index); - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated int getSystraceCount(); - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated java.util.List<? extends com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder> - getSystraceOrBuilderList(); - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder getSystraceOrBuilder( - int index); - - /** - * <pre> - * Execution start and end time stamp. - * </pre> - * - * <code>optional int64 start_timestamp = 101;</code> - */ - boolean hasStartTimestamp(); - /** - * <pre> - * Execution start and end time stamp. - * </pre> - * - * <code>optional int64 start_timestamp = 101;</code> - */ - long getStartTimestamp(); - - /** - * <code>optional int64 end_timestamp = 102;</code> - */ - boolean hasEndTimestamp(); - /** - * <code>optional int64 end_timestamp = 102;</code> - */ - long getEndTimestamp(); - - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - java.util.List<com.android.vts.proto.VtsReportMessage.CoverageReportMessage> - getCoverageList(); - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - com.android.vts.proto.VtsReportMessage.CoverageReportMessage getCoverage(int index); - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - int getCoverageCount(); - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - java.util.List<? extends com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder> - getCoverageOrBuilderList(); - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder getCoverageOrBuilder( - int index); - - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - java.util.List<com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage> - getApiCoverageList(); - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage getApiCoverage(int index); - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - int getApiCoverageCount(); - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - java.util.List<? extends com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder> - getApiCoverageOrBuilderList(); - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder getApiCoverageOrBuilder( - int index); - - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - java.util.List<com.android.vts.proto.VtsReportMessage.LogMessage> - getLogList(); - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - com.android.vts.proto.VtsReportMessage.LogMessage getLog(int index); - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - int getLogCount(); - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - java.util.List<? extends com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder> - getLogOrBuilderList(); - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder getLogOrBuilder( - int index); - - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - java.util.List<com.android.vts.proto.VtsReportMessage.UrlResourceMessage> - getLinkResourceList(); - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - com.android.vts.proto.VtsReportMessage.UrlResourceMessage getLinkResource(int index); - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - int getLinkResourceCount(); - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - java.util.List<? extends com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder> - getLinkResourceOrBuilderList(); - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder getLinkResourceOrBuilder( - int index); - } - /** - * <pre> - * To specify a test execution report. - * </pre> - * - * Protobuf type {@code android.vts.TestReportMessage} - */ - public static final class TestReportMessage extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:android.vts.TestReportMessage) - TestReportMessageOrBuilder { - // Use TestReportMessage.newBuilder() to construct. - private TestReportMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { - super(builder); - } - private TestReportMessage() { - testSuite_ = com.google.protobuf.ByteString.EMPTY; - test_ = com.google.protobuf.ByteString.EMPTY; - testType_ = 0; - deviceInfo_ = java.util.Collections.emptyList(); - subscriberEmail_ = java.util.Collections.emptyList(); - testCase_ = java.util.Collections.emptyList(); - profiling_ = java.util.Collections.emptyList(); - systrace_ = java.util.Collections.emptyList(); - startTimestamp_ = 0L; - endTimestamp_ = 0L; - coverage_ = java.util.Collections.emptyList(); - apiCoverage_ = java.util.Collections.emptyList(); - log_ = java.util.Collections.emptyList(); - linkResource_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private TestReportMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - testSuite_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - test_ = input.readBytes(); - break; - } - case 24: { - int rawValue = input.readEnum(); - com.android.vts.proto.VtsReportMessage.VtsTestType value = com.android.vts.proto.VtsReportMessage.VtsTestType.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(3, rawValue); - } else { - bitField0_ |= 0x00000004; - testType_ = rawValue; - } - break; - } - case 34: { - if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - deviceInfo_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage>(); - mutable_bitField0_ |= 0x00000008; - } - deviceInfo_.add( - input.readMessage(com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.PARSER, extensionRegistry)); - break; - } - case 42: { - com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.Builder subBuilder = null; - if (((bitField0_ & 0x00000008) == 0x00000008)) { - subBuilder = buildInfo_.toBuilder(); - } - buildInfo_ = input.readMessage(com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(buildInfo_); - buildInfo_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000008; - break; - } - case 50: { - if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { - subscriberEmail_ = new java.util.ArrayList<com.google.protobuf.ByteString>(); - mutable_bitField0_ |= 0x00000020; - } - subscriberEmail_.add(input.readBytes()); - break; - } - case 58: { - com.android.vts.proto.VtsReportMessage.VtsHostInfo.Builder subBuilder = null; - if (((bitField0_ & 0x00000010) == 0x00000010)) { - subBuilder = hostInfo_.toBuilder(); - } - hostInfo_ = input.readMessage(com.android.vts.proto.VtsReportMessage.VtsHostInfo.PARSER, extensionRegistry); - if (subBuilder != null) { - subBuilder.mergeFrom(hostInfo_); - hostInfo_ = subBuilder.buildPartial(); - } - bitField0_ |= 0x00000010; - break; - } - case 90: { - if (!((mutable_bitField0_ & 0x00000080) == 0x00000080)) { - testCase_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.TestCaseReportMessage>(); - mutable_bitField0_ |= 0x00000080; - } - testCase_.add( - input.readMessage(com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.PARSER, extensionRegistry)); - break; - } - case 170: { - if (!((mutable_bitField0_ & 0x00000100) == 0x00000100)) { - profiling_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.ProfilingReportMessage>(); - mutable_bitField0_ |= 0x00000100; - } - profiling_.add( - input.readMessage(com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.PARSER, extensionRegistry)); - break; - } - case 178: { - if (!((mutable_bitField0_ & 0x00000200) == 0x00000200)) { - systrace_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.SystraceReportMessage>(); - mutable_bitField0_ |= 0x00000200; - } - systrace_.add( - input.readMessage(com.android.vts.proto.VtsReportMessage.SystraceReportMessage.PARSER, extensionRegistry)); - break; - } - case 808: { - bitField0_ |= 0x00000020; - startTimestamp_ = input.readInt64(); - break; - } - case 816: { - bitField0_ |= 0x00000040; - endTimestamp_ = input.readInt64(); - break; - } - case 826: { - if (!((mutable_bitField0_ & 0x00001000) == 0x00001000)) { - coverage_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.CoverageReportMessage>(); - mutable_bitField0_ |= 0x00001000; - } - coverage_.add( - input.readMessage(com.android.vts.proto.VtsReportMessage.CoverageReportMessage.PARSER, extensionRegistry)); - break; - } - case 834: { - if (!((mutable_bitField0_ & 0x00002000) == 0x00002000)) { - apiCoverage_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage>(); - mutable_bitField0_ |= 0x00002000; - } - apiCoverage_.add( - input.readMessage(com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.PARSER, extensionRegistry)); - break; - } - case 8010: { - if (!((mutable_bitField0_ & 0x00004000) == 0x00004000)) { - log_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.LogMessage>(); - mutable_bitField0_ |= 0x00004000; - } - log_.add( - input.readMessage(com.android.vts.proto.VtsReportMessage.LogMessage.PARSER, extensionRegistry)); - break; - } - case 8090: { - if (!((mutable_bitField0_ & 0x00008000) == 0x00008000)) { - linkResource_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.UrlResourceMessage>(); - mutable_bitField0_ |= 0x00008000; - } - linkResource_.add( - input.readMessage(com.android.vts.proto.VtsReportMessage.UrlResourceMessage.PARSER, extensionRegistry)); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - deviceInfo_ = java.util.Collections.unmodifiableList(deviceInfo_); - } - if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { - subscriberEmail_ = java.util.Collections.unmodifiableList(subscriberEmail_); - } - if (((mutable_bitField0_ & 0x00000080) == 0x00000080)) { - testCase_ = java.util.Collections.unmodifiableList(testCase_); - } - if (((mutable_bitField0_ & 0x00000100) == 0x00000100)) { - profiling_ = java.util.Collections.unmodifiableList(profiling_); - } - if (((mutable_bitField0_ & 0x00000200) == 0x00000200)) { - systrace_ = java.util.Collections.unmodifiableList(systrace_); - } - if (((mutable_bitField0_ & 0x00001000) == 0x00001000)) { - coverage_ = java.util.Collections.unmodifiableList(coverage_); - } - if (((mutable_bitField0_ & 0x00002000) == 0x00002000)) { - apiCoverage_ = java.util.Collections.unmodifiableList(apiCoverage_); - } - if (((mutable_bitField0_ & 0x00004000) == 0x00004000)) { - log_ = java.util.Collections.unmodifiableList(log_); - } - if (((mutable_bitField0_ & 0x00008000) == 0x00008000)) { - linkResource_ = java.util.Collections.unmodifiableList(linkResource_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_TestReportMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_TestReportMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.TestReportMessage.class, com.android.vts.proto.VtsReportMessage.TestReportMessage.Builder.class); - } - - private int bitField0_; - public static final int TEST_SUITE_FIELD_NUMBER = 1; - private com.google.protobuf.ByteString testSuite_; - /** - * <pre> - * The test suite name. - * </pre> - * - * <code>optional bytes test_suite = 1 [deprecated = true];</code> - */ - @java.lang.Deprecated public boolean hasTestSuite() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * The test suite name. - * </pre> - * - * <code>optional bytes test_suite = 1 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.google.protobuf.ByteString getTestSuite() { - return testSuite_; - } - - public static final int TEST_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString test_; - /** - * <pre> - * The test name. - * </pre> - * - * <code>optional bytes test = 2;</code> - */ - public boolean hasTest() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * The test name. - * </pre> - * - * <code>optional bytes test = 2;</code> - */ - public com.google.protobuf.ByteString getTest() { - return test_; - } - - public static final int TEST_TYPE_FIELD_NUMBER = 3; - private int testType_; - /** - * <pre> - * The test type - * </pre> - * - * <code>optional .android.vts.VtsTestType test_type = 3;</code> - */ - public boolean hasTestType() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * The test type - * </pre> - * - * <code>optional .android.vts.VtsTestType test_type = 3;</code> - */ - public com.android.vts.proto.VtsReportMessage.VtsTestType getTestType() { - com.android.vts.proto.VtsReportMessage.VtsTestType result = com.android.vts.proto.VtsReportMessage.VtsTestType.valueOf(testType_); - return result == null ? com.android.vts.proto.VtsReportMessage.VtsTestType.UNKNOWN_VTS_TESTTYPE : result; - } - - public static final int DEVICE_INFO_FIELD_NUMBER = 4; - private java.util.List<com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage> deviceInfo_; - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage> getDeviceInfoList() { - return deviceInfo_; - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessageOrBuilder> - getDeviceInfoOrBuilderList() { - return deviceInfo_; - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public int getDeviceInfoCount() { - return deviceInfo_.size(); - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage getDeviceInfo(int index) { - return deviceInfo_.get(index); - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessageOrBuilder getDeviceInfoOrBuilder( - int index) { - return deviceInfo_.get(index); - } - - public static final int BUILD_INFO_FIELD_NUMBER = 5; - private com.android.vts.proto.VtsReportMessage.AndroidBuildInfo buildInfo_; - /** - * <pre> - * Build info - * </pre> - * - * <code>optional .android.vts.AndroidBuildInfo build_info = 5;</code> - */ - public boolean hasBuildInfo() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * <pre> - * Build info - * </pre> - * - * <code>optional .android.vts.AndroidBuildInfo build_info = 5;</code> - */ - public com.android.vts.proto.VtsReportMessage.AndroidBuildInfo getBuildInfo() { - return buildInfo_ == null ? com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.getDefaultInstance() : buildInfo_; - } - /** - * <pre> - * Build info - * </pre> - * - * <code>optional .android.vts.AndroidBuildInfo build_info = 5;</code> - */ - public com.android.vts.proto.VtsReportMessage.AndroidBuildInfoOrBuilder getBuildInfoOrBuilder() { - return buildInfo_ == null ? com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.getDefaultInstance() : buildInfo_; - } - - public static final int SUBSCRIBER_EMAIL_FIELD_NUMBER = 6; - private java.util.List<com.google.protobuf.ByteString> subscriberEmail_; - /** - * <pre> - * Email addresses of subscribers to the test results - * </pre> - * - * <code>repeated bytes subscriber_email = 6;</code> - */ - public java.util.List<com.google.protobuf.ByteString> - getSubscriberEmailList() { - return subscriberEmail_; - } - /** - * <pre> - * Email addresses of subscribers to the test results - * </pre> - * - * <code>repeated bytes subscriber_email = 6;</code> - */ - public int getSubscriberEmailCount() { - return subscriberEmail_.size(); - } - /** - * <pre> - * Email addresses of subscribers to the test results - * </pre> - * - * <code>repeated bytes subscriber_email = 6;</code> - */ - public com.google.protobuf.ByteString getSubscriberEmail(int index) { - return subscriberEmail_.get(index); - } - - public static final int HOST_INFO_FIELD_NUMBER = 7; - private com.android.vts.proto.VtsReportMessage.VtsHostInfo hostInfo_; - /** - * <pre> - * Info about the host computer - * </pre> - * - * <code>optional .android.vts.VtsHostInfo host_info = 7;</code> - */ - public boolean hasHostInfo() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <pre> - * Info about the host computer - * </pre> - * - * <code>optional .android.vts.VtsHostInfo host_info = 7;</code> - */ - public com.android.vts.proto.VtsReportMessage.VtsHostInfo getHostInfo() { - return hostInfo_ == null ? com.android.vts.proto.VtsReportMessage.VtsHostInfo.getDefaultInstance() : hostInfo_; - } - /** - * <pre> - * Info about the host computer - * </pre> - * - * <code>optional .android.vts.VtsHostInfo host_info = 7;</code> - */ - public com.android.vts.proto.VtsReportMessage.VtsHostInfoOrBuilder getHostInfoOrBuilder() { - return hostInfo_ == null ? com.android.vts.proto.VtsReportMessage.VtsHostInfo.getDefaultInstance() : hostInfo_; - } - - public static final int TEST_CASE_FIELD_NUMBER = 11; - private java.util.List<com.android.vts.proto.VtsReportMessage.TestCaseReportMessage> testCase_; - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.TestCaseReportMessage> getTestCaseList() { - return testCase_; - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.TestCaseReportMessageOrBuilder> - getTestCaseOrBuilderList() { - return testCase_; - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public int getTestCaseCount() { - return testCase_.size(); - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestCaseReportMessage getTestCase(int index) { - return testCase_.get(index); - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestCaseReportMessageOrBuilder getTestCaseOrBuilder( - int index) { - return testCase_.get(index); - } - - public static final int PROFILING_FIELD_NUMBER = 21; - private java.util.List<com.android.vts.proto.VtsReportMessage.ProfilingReportMessage> profiling_; - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.ProfilingReportMessage> getProfilingList() { - return profiling_; - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder> - getProfilingOrBuilderList() { - return profiling_; - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public int getProfilingCount() { - return profiling_.size(); - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessage getProfiling(int index) { - return profiling_.get(index); - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder getProfilingOrBuilder( - int index) { - return profiling_.get(index); - } - - public static final int SYSTRACE_FIELD_NUMBER = 22; - private java.util.List<com.android.vts.proto.VtsReportMessage.SystraceReportMessage> systrace_; - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public java.util.List<com.android.vts.proto.VtsReportMessage.SystraceReportMessage> getSystraceList() { - return systrace_; - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public java.util.List<? extends com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder> - getSystraceOrBuilderList() { - return systrace_; - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public int getSystraceCount() { - return systrace_.size(); - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.VtsReportMessage.SystraceReportMessage getSystrace(int index) { - return systrace_.get(index); - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder getSystraceOrBuilder( - int index) { - return systrace_.get(index); - } - - public static final int START_TIMESTAMP_FIELD_NUMBER = 101; - private long startTimestamp_; - /** - * <pre> - * Execution start and end time stamp. - * </pre> - * - * <code>optional int64 start_timestamp = 101;</code> - */ - public boolean hasStartTimestamp() { - return ((bitField0_ & 0x00000020) == 0x00000020); - } - /** - * <pre> - * Execution start and end time stamp. - * </pre> - * - * <code>optional int64 start_timestamp = 101;</code> - */ - public long getStartTimestamp() { - return startTimestamp_; - } - - public static final int END_TIMESTAMP_FIELD_NUMBER = 102; - private long endTimestamp_; - /** - * <code>optional int64 end_timestamp = 102;</code> - */ - public boolean hasEndTimestamp() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - /** - * <code>optional int64 end_timestamp = 102;</code> - */ - public long getEndTimestamp() { - return endTimestamp_; - } - - public static final int COVERAGE_FIELD_NUMBER = 103; - private java.util.List<com.android.vts.proto.VtsReportMessage.CoverageReportMessage> coverage_; - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.CoverageReportMessage> getCoverageList() { - return coverage_; - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder> - getCoverageOrBuilderList() { - return coverage_; - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public int getCoverageCount() { - return coverage_.size(); - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public com.android.vts.proto.VtsReportMessage.CoverageReportMessage getCoverage(int index) { - return coverage_.get(index); - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder getCoverageOrBuilder( - int index) { - return coverage_.get(index); - } - - public static final int API_COVERAGE_FIELD_NUMBER = 104; - private java.util.List<com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage> apiCoverage_; - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage> getApiCoverageList() { - return apiCoverage_; - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder> - getApiCoverageOrBuilderList() { - return apiCoverage_; - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public int getApiCoverageCount() { - return apiCoverage_.size(); - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage getApiCoverage(int index) { - return apiCoverage_.get(index); - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder getApiCoverageOrBuilder( - int index) { - return apiCoverage_.get(index); - } - - public static final int LOG_FIELD_NUMBER = 1001; - private java.util.List<com.android.vts.proto.VtsReportMessage.LogMessage> log_; - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.LogMessage> getLogList() { - return log_; - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder> - getLogOrBuilderList() { - return log_; - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public int getLogCount() { - return log_.size(); - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public com.android.vts.proto.VtsReportMessage.LogMessage getLog(int index) { - return log_.get(index); - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder getLogOrBuilder( - int index) { - return log_.get(index); - } - - public static final int LINK_RESOURCE_FIELD_NUMBER = 1011; - private java.util.List<com.android.vts.proto.VtsReportMessage.UrlResourceMessage> linkResource_; - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.UrlResourceMessage> getLinkResourceList() { - return linkResource_; - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder> - getLinkResourceOrBuilderList() { - return linkResource_; - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public int getLinkResourceCount() { - return linkResource_.size(); - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public com.android.vts.proto.VtsReportMessage.UrlResourceMessage getLinkResource(int index) { - return linkResource_.get(index); - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder getLinkResourceOrBuilder( - int index) { - return linkResource_.get(index); - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeBytes(1, testSuite_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeBytes(2, test_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeEnum(3, testType_); - } - for (int i = 0; i < deviceInfo_.size(); i++) { - output.writeMessage(4, deviceInfo_.get(i)); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeMessage(5, getBuildInfo()); - } - for (int i = 0; i < subscriberEmail_.size(); i++) { - output.writeBytes(6, subscriberEmail_.get(i)); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - output.writeMessage(7, getHostInfo()); - } - for (int i = 0; i < testCase_.size(); i++) { - output.writeMessage(11, testCase_.get(i)); - } - for (int i = 0; i < profiling_.size(); i++) { - output.writeMessage(21, profiling_.get(i)); - } - for (int i = 0; i < systrace_.size(); i++) { - output.writeMessage(22, systrace_.get(i)); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - output.writeInt64(101, startTimestamp_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - output.writeInt64(102, endTimestamp_); - } - for (int i = 0; i < coverage_.size(); i++) { - output.writeMessage(103, coverage_.get(i)); - } - for (int i = 0; i < apiCoverage_.size(); i++) { - output.writeMessage(104, apiCoverage_.get(i)); - } - for (int i = 0; i < log_.size(); i++) { - output.writeMessage(1001, log_.get(i)); - } - for (int i = 0; i < linkResource_.size(); i++) { - output.writeMessage(1011, linkResource_.get(i)); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(1, testSuite_); - } - if (((bitField0_ & 0x00000002) == 0x00000002)) { - size += com.google.protobuf.CodedOutputStream - .computeBytesSize(2, test_); - } - if (((bitField0_ & 0x00000004) == 0x00000004)) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(3, testType_); - } - for (int i = 0; i < deviceInfo_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(4, deviceInfo_.get(i)); - } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(5, getBuildInfo()); - } - { - int dataSize = 0; - for (int i = 0; i < subscriberEmail_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeBytesSizeNoTag(subscriberEmail_.get(i)); - } - size += dataSize; - size += 1 * getSubscriberEmailList().size(); - } - if (((bitField0_ & 0x00000010) == 0x00000010)) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(7, getHostInfo()); - } - for (int i = 0; i < testCase_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(11, testCase_.get(i)); - } - for (int i = 0; i < profiling_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(21, profiling_.get(i)); - } - for (int i = 0; i < systrace_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(22, systrace_.get(i)); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(101, startTimestamp_); - } - if (((bitField0_ & 0x00000040) == 0x00000040)) { - size += com.google.protobuf.CodedOutputStream - .computeInt64Size(102, endTimestamp_); - } - for (int i = 0; i < coverage_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(103, coverage_.get(i)); - } - for (int i = 0; i < apiCoverage_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(104, apiCoverage_.get(i)); - } - for (int i = 0; i < log_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1001, log_.get(i)); - } - for (int i = 0; i < linkResource_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1011, linkResource_.get(i)); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.android.vts.proto.VtsReportMessage.TestReportMessage)) { - return super.equals(obj); - } - com.android.vts.proto.VtsReportMessage.TestReportMessage other = (com.android.vts.proto.VtsReportMessage.TestReportMessage) obj; - - boolean result = true; - result = result && (hasTestSuite() == other.hasTestSuite()); - if (hasTestSuite()) { - result = result && getTestSuite() - .equals(other.getTestSuite()); - } - result = result && (hasTest() == other.hasTest()); - if (hasTest()) { - result = result && getTest() - .equals(other.getTest()); - } - result = result && (hasTestType() == other.hasTestType()); - if (hasTestType()) { - result = result && testType_ == other.testType_; - } - result = result && getDeviceInfoList() - .equals(other.getDeviceInfoList()); - result = result && (hasBuildInfo() == other.hasBuildInfo()); - if (hasBuildInfo()) { - result = result && getBuildInfo() - .equals(other.getBuildInfo()); - } - result = result && getSubscriberEmailList() - .equals(other.getSubscriberEmailList()); - result = result && (hasHostInfo() == other.hasHostInfo()); - if (hasHostInfo()) { - result = result && getHostInfo() - .equals(other.getHostInfo()); - } - result = result && getTestCaseList() - .equals(other.getTestCaseList()); - result = result && getProfilingList() - .equals(other.getProfilingList()); - result = result && getSystraceList() - .equals(other.getSystraceList()); - result = result && (hasStartTimestamp() == other.hasStartTimestamp()); - if (hasStartTimestamp()) { - result = result && (getStartTimestamp() - == other.getStartTimestamp()); - } - result = result && (hasEndTimestamp() == other.hasEndTimestamp()); - if (hasEndTimestamp()) { - result = result && (getEndTimestamp() - == other.getEndTimestamp()); - } - result = result && getCoverageList() - .equals(other.getCoverageList()); - result = result && getApiCoverageList() - .equals(other.getApiCoverageList()); - result = result && getLogList() - .equals(other.getLogList()); - result = result && getLinkResourceList() - .equals(other.getLinkResourceList()); - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - if (hasTestSuite()) { - hash = (37 * hash) + TEST_SUITE_FIELD_NUMBER; - hash = (53 * hash) + getTestSuite().hashCode(); - } - if (hasTest()) { - hash = (37 * hash) + TEST_FIELD_NUMBER; - hash = (53 * hash) + getTest().hashCode(); - } - if (hasTestType()) { - hash = (37 * hash) + TEST_TYPE_FIELD_NUMBER; - hash = (53 * hash) + testType_; - } - if (getDeviceInfoCount() > 0) { - hash = (37 * hash) + DEVICE_INFO_FIELD_NUMBER; - hash = (53 * hash) + getDeviceInfoList().hashCode(); - } - if (hasBuildInfo()) { - hash = (37 * hash) + BUILD_INFO_FIELD_NUMBER; - hash = (53 * hash) + getBuildInfo().hashCode(); - } - if (getSubscriberEmailCount() > 0) { - hash = (37 * hash) + SUBSCRIBER_EMAIL_FIELD_NUMBER; - hash = (53 * hash) + getSubscriberEmailList().hashCode(); - } - if (hasHostInfo()) { - hash = (37 * hash) + HOST_INFO_FIELD_NUMBER; - hash = (53 * hash) + getHostInfo().hashCode(); - } - if (getTestCaseCount() > 0) { - hash = (37 * hash) + TEST_CASE_FIELD_NUMBER; - hash = (53 * hash) + getTestCaseList().hashCode(); - } - if (getProfilingCount() > 0) { - hash = (37 * hash) + PROFILING_FIELD_NUMBER; - hash = (53 * hash) + getProfilingList().hashCode(); - } - if (getSystraceCount() > 0) { - hash = (37 * hash) + SYSTRACE_FIELD_NUMBER; - hash = (53 * hash) + getSystraceList().hashCode(); - } - if (hasStartTimestamp()) { - hash = (37 * hash) + START_TIMESTAMP_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getStartTimestamp()); - } - if (hasEndTimestamp()) { - hash = (37 * hash) + END_TIMESTAMP_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong( - getEndTimestamp()); - } - if (getCoverageCount() > 0) { - hash = (37 * hash) + COVERAGE_FIELD_NUMBER; - hash = (53 * hash) + getCoverageList().hashCode(); - } - if (getApiCoverageCount() > 0) { - hash = (37 * hash) + API_COVERAGE_FIELD_NUMBER; - hash = (53 * hash) + getApiCoverageList().hashCode(); - } - if (getLogCount() > 0) { - hash = (37 * hash) + LOG_FIELD_NUMBER; - hash = (53 * hash) + getLogList().hashCode(); - } - if (getLinkResourceCount() > 0) { - hash = (37 * hash) + LINK_RESOURCE_FIELD_NUMBER; - hash = (53 * hash) + getLinkResourceList().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.android.vts.proto.VtsReportMessage.TestReportMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.TestReportMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.TestReportMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.TestReportMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.TestReportMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.TestReportMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.TestReportMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.TestReportMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.TestReportMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.TestReportMessage parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.android.vts.proto.VtsReportMessage.TestReportMessage prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * <pre> - * To specify a test execution report. - * </pre> - * - * Protobuf type {@code android.vts.TestReportMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements - // @@protoc_insertion_point(builder_implements:android.vts.TestReportMessage) - com.android.vts.proto.VtsReportMessage.TestReportMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_TestReportMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_TestReportMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.TestReportMessage.class, com.android.vts.proto.VtsReportMessage.TestReportMessage.Builder.class); - } - - // Construct using com.android.vts.proto.VtsReportMessage.TestReportMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getDeviceInfoFieldBuilder(); - getBuildInfoFieldBuilder(); - getHostInfoFieldBuilder(); - getTestCaseFieldBuilder(); - getProfilingFieldBuilder(); - getSystraceFieldBuilder(); - getCoverageFieldBuilder(); - getApiCoverageFieldBuilder(); - getLogFieldBuilder(); - getLinkResourceFieldBuilder(); - } - } - public Builder clear() { - super.clear(); - testSuite_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - test_ = com.google.protobuf.ByteString.EMPTY; - bitField0_ = (bitField0_ & ~0x00000002); - testType_ = 0; - bitField0_ = (bitField0_ & ~0x00000004); - if (deviceInfoBuilder_ == null) { - deviceInfo_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - } else { - deviceInfoBuilder_.clear(); - } - if (buildInfoBuilder_ == null) { - buildInfo_ = null; - } else { - buildInfoBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000010); - subscriberEmail_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - if (hostInfoBuilder_ == null) { - hostInfo_ = null; - } else { - hostInfoBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000040); - if (testCaseBuilder_ == null) { - testCase_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000080); - } else { - testCaseBuilder_.clear(); - } - if (profilingBuilder_ == null) { - profiling_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000100); - } else { - profilingBuilder_.clear(); - } - if (systraceBuilder_ == null) { - systrace_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000200); - } else { - systraceBuilder_.clear(); - } - startTimestamp_ = 0L; - bitField0_ = (bitField0_ & ~0x00000400); - endTimestamp_ = 0L; - bitField0_ = (bitField0_ & ~0x00000800); - if (coverageBuilder_ == null) { - coverage_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00001000); - } else { - coverageBuilder_.clear(); - } - if (apiCoverageBuilder_ == null) { - apiCoverage_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00002000); - } else { - apiCoverageBuilder_.clear(); - } - if (logBuilder_ == null) { - log_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00004000); - } else { - logBuilder_.clear(); - } - if (linkResourceBuilder_ == null) { - linkResource_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00008000); - } else { - linkResourceBuilder_.clear(); - } - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_TestReportMessage_descriptor; - } - - public com.android.vts.proto.VtsReportMessage.TestReportMessage getDefaultInstanceForType() { - return com.android.vts.proto.VtsReportMessage.TestReportMessage.getDefaultInstance(); - } - - public com.android.vts.proto.VtsReportMessage.TestReportMessage build() { - com.android.vts.proto.VtsReportMessage.TestReportMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.android.vts.proto.VtsReportMessage.TestReportMessage buildPartial() { - com.android.vts.proto.VtsReportMessage.TestReportMessage result = new com.android.vts.proto.VtsReportMessage.TestReportMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.testSuite_ = testSuite_; - if (((from_bitField0_ & 0x00000002) == 0x00000002)) { - to_bitField0_ |= 0x00000002; - } - result.test_ = test_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000004; - } - result.testType_ = testType_; - if (deviceInfoBuilder_ == null) { - if (((bitField0_ & 0x00000008) == 0x00000008)) { - deviceInfo_ = java.util.Collections.unmodifiableList(deviceInfo_); - bitField0_ = (bitField0_ & ~0x00000008); - } - result.deviceInfo_ = deviceInfo_; - } else { - result.deviceInfo_ = deviceInfoBuilder_.build(); - } - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { - to_bitField0_ |= 0x00000008; - } - if (buildInfoBuilder_ == null) { - result.buildInfo_ = buildInfo_; - } else { - result.buildInfo_ = buildInfoBuilder_.build(); - } - if (((bitField0_ & 0x00000020) == 0x00000020)) { - subscriberEmail_ = java.util.Collections.unmodifiableList(subscriberEmail_); - bitField0_ = (bitField0_ & ~0x00000020); - } - result.subscriberEmail_ = subscriberEmail_; - if (((from_bitField0_ & 0x00000040) == 0x00000040)) { - to_bitField0_ |= 0x00000010; - } - if (hostInfoBuilder_ == null) { - result.hostInfo_ = hostInfo_; - } else { - result.hostInfo_ = hostInfoBuilder_.build(); - } - if (testCaseBuilder_ == null) { - if (((bitField0_ & 0x00000080) == 0x00000080)) { - testCase_ = java.util.Collections.unmodifiableList(testCase_); - bitField0_ = (bitField0_ & ~0x00000080); - } - result.testCase_ = testCase_; - } else { - result.testCase_ = testCaseBuilder_.build(); - } - if (profilingBuilder_ == null) { - if (((bitField0_ & 0x00000100) == 0x00000100)) { - profiling_ = java.util.Collections.unmodifiableList(profiling_); - bitField0_ = (bitField0_ & ~0x00000100); - } - result.profiling_ = profiling_; - } else { - result.profiling_ = profilingBuilder_.build(); - } - if (systraceBuilder_ == null) { - if (((bitField0_ & 0x00000200) == 0x00000200)) { - systrace_ = java.util.Collections.unmodifiableList(systrace_); - bitField0_ = (bitField0_ & ~0x00000200); - } - result.systrace_ = systrace_; - } else { - result.systrace_ = systraceBuilder_.build(); - } - if (((from_bitField0_ & 0x00000400) == 0x00000400)) { - to_bitField0_ |= 0x00000020; - } - result.startTimestamp_ = startTimestamp_; - if (((from_bitField0_ & 0x00000800) == 0x00000800)) { - to_bitField0_ |= 0x00000040; - } - result.endTimestamp_ = endTimestamp_; - if (coverageBuilder_ == null) { - if (((bitField0_ & 0x00001000) == 0x00001000)) { - coverage_ = java.util.Collections.unmodifiableList(coverage_); - bitField0_ = (bitField0_ & ~0x00001000); - } - result.coverage_ = coverage_; - } else { - result.coverage_ = coverageBuilder_.build(); - } - if (apiCoverageBuilder_ == null) { - if (((bitField0_ & 0x00002000) == 0x00002000)) { - apiCoverage_ = java.util.Collections.unmodifiableList(apiCoverage_); - bitField0_ = (bitField0_ & ~0x00002000); - } - result.apiCoverage_ = apiCoverage_; - } else { - result.apiCoverage_ = apiCoverageBuilder_.build(); - } - if (logBuilder_ == null) { - if (((bitField0_ & 0x00004000) == 0x00004000)) { - log_ = java.util.Collections.unmodifiableList(log_); - bitField0_ = (bitField0_ & ~0x00004000); - } - result.log_ = log_; - } else { - result.log_ = logBuilder_.build(); - } - if (linkResourceBuilder_ == null) { - if (((bitField0_ & 0x00008000) == 0x00008000)) { - linkResource_ = java.util.Collections.unmodifiableList(linkResource_); - bitField0_ = (bitField0_ & ~0x00008000); - } - result.linkResource_ = linkResource_; - } else { - result.linkResource_ = linkResourceBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.android.vts.proto.VtsReportMessage.TestReportMessage) { - return mergeFrom((com.android.vts.proto.VtsReportMessage.TestReportMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.android.vts.proto.VtsReportMessage.TestReportMessage other) { - if (other == com.android.vts.proto.VtsReportMessage.TestReportMessage.getDefaultInstance()) return this; - if (other.hasTestSuite()) { - setTestSuite(other.getTestSuite()); - } - if (other.hasTest()) { - setTest(other.getTest()); - } - if (other.hasTestType()) { - setTestType(other.getTestType()); - } - if (deviceInfoBuilder_ == null) { - if (!other.deviceInfo_.isEmpty()) { - if (deviceInfo_.isEmpty()) { - deviceInfo_ = other.deviceInfo_; - bitField0_ = (bitField0_ & ~0x00000008); - } else { - ensureDeviceInfoIsMutable(); - deviceInfo_.addAll(other.deviceInfo_); - } - onChanged(); - } - } else { - if (!other.deviceInfo_.isEmpty()) { - if (deviceInfoBuilder_.isEmpty()) { - deviceInfoBuilder_.dispose(); - deviceInfoBuilder_ = null; - deviceInfo_ = other.deviceInfo_; - bitField0_ = (bitField0_ & ~0x00000008); - deviceInfoBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getDeviceInfoFieldBuilder() : null; - } else { - deviceInfoBuilder_.addAllMessages(other.deviceInfo_); - } - } - } - if (other.hasBuildInfo()) { - mergeBuildInfo(other.getBuildInfo()); - } - if (!other.subscriberEmail_.isEmpty()) { - if (subscriberEmail_.isEmpty()) { - subscriberEmail_ = other.subscriberEmail_; - bitField0_ = (bitField0_ & ~0x00000020); - } else { - ensureSubscriberEmailIsMutable(); - subscriberEmail_.addAll(other.subscriberEmail_); - } - onChanged(); - } - if (other.hasHostInfo()) { - mergeHostInfo(other.getHostInfo()); - } - if (testCaseBuilder_ == null) { - if (!other.testCase_.isEmpty()) { - if (testCase_.isEmpty()) { - testCase_ = other.testCase_; - bitField0_ = (bitField0_ & ~0x00000080); - } else { - ensureTestCaseIsMutable(); - testCase_.addAll(other.testCase_); - } - onChanged(); - } - } else { - if (!other.testCase_.isEmpty()) { - if (testCaseBuilder_.isEmpty()) { - testCaseBuilder_.dispose(); - testCaseBuilder_ = null; - testCase_ = other.testCase_; - bitField0_ = (bitField0_ & ~0x00000080); - testCaseBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getTestCaseFieldBuilder() : null; - } else { - testCaseBuilder_.addAllMessages(other.testCase_); - } - } - } - if (profilingBuilder_ == null) { - if (!other.profiling_.isEmpty()) { - if (profiling_.isEmpty()) { - profiling_ = other.profiling_; - bitField0_ = (bitField0_ & ~0x00000100); - } else { - ensureProfilingIsMutable(); - profiling_.addAll(other.profiling_); - } - onChanged(); - } - } else { - if (!other.profiling_.isEmpty()) { - if (profilingBuilder_.isEmpty()) { - profilingBuilder_.dispose(); - profilingBuilder_ = null; - profiling_ = other.profiling_; - bitField0_ = (bitField0_ & ~0x00000100); - profilingBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getProfilingFieldBuilder() : null; - } else { - profilingBuilder_.addAllMessages(other.profiling_); - } - } - } - if (systraceBuilder_ == null) { - if (!other.systrace_.isEmpty()) { - if (systrace_.isEmpty()) { - systrace_ = other.systrace_; - bitField0_ = (bitField0_ & ~0x00000200); - } else { - ensureSystraceIsMutable(); - systrace_.addAll(other.systrace_); - } - onChanged(); - } - } else { - if (!other.systrace_.isEmpty()) { - if (systraceBuilder_.isEmpty()) { - systraceBuilder_.dispose(); - systraceBuilder_ = null; - systrace_ = other.systrace_; - bitField0_ = (bitField0_ & ~0x00000200); - systraceBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getSystraceFieldBuilder() : null; - } else { - systraceBuilder_.addAllMessages(other.systrace_); - } - } - } - if (other.hasStartTimestamp()) { - setStartTimestamp(other.getStartTimestamp()); - } - if (other.hasEndTimestamp()) { - setEndTimestamp(other.getEndTimestamp()); - } - if (coverageBuilder_ == null) { - if (!other.coverage_.isEmpty()) { - if (coverage_.isEmpty()) { - coverage_ = other.coverage_; - bitField0_ = (bitField0_ & ~0x00001000); - } else { - ensureCoverageIsMutable(); - coverage_.addAll(other.coverage_); - } - onChanged(); - } - } else { - if (!other.coverage_.isEmpty()) { - if (coverageBuilder_.isEmpty()) { - coverageBuilder_.dispose(); - coverageBuilder_ = null; - coverage_ = other.coverage_; - bitField0_ = (bitField0_ & ~0x00001000); - coverageBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getCoverageFieldBuilder() : null; - } else { - coverageBuilder_.addAllMessages(other.coverage_); - } - } - } - if (apiCoverageBuilder_ == null) { - if (!other.apiCoverage_.isEmpty()) { - if (apiCoverage_.isEmpty()) { - apiCoverage_ = other.apiCoverage_; - bitField0_ = (bitField0_ & ~0x00002000); - } else { - ensureApiCoverageIsMutable(); - apiCoverage_.addAll(other.apiCoverage_); - } - onChanged(); - } - } else { - if (!other.apiCoverage_.isEmpty()) { - if (apiCoverageBuilder_.isEmpty()) { - apiCoverageBuilder_.dispose(); - apiCoverageBuilder_ = null; - apiCoverage_ = other.apiCoverage_; - bitField0_ = (bitField0_ & ~0x00002000); - apiCoverageBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getApiCoverageFieldBuilder() : null; - } else { - apiCoverageBuilder_.addAllMessages(other.apiCoverage_); - } - } - } - if (logBuilder_ == null) { - if (!other.log_.isEmpty()) { - if (log_.isEmpty()) { - log_ = other.log_; - bitField0_ = (bitField0_ & ~0x00004000); - } else { - ensureLogIsMutable(); - log_.addAll(other.log_); - } - onChanged(); - } - } else { - if (!other.log_.isEmpty()) { - if (logBuilder_.isEmpty()) { - logBuilder_.dispose(); - logBuilder_ = null; - log_ = other.log_; - bitField0_ = (bitField0_ & ~0x00004000); - logBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getLogFieldBuilder() : null; - } else { - logBuilder_.addAllMessages(other.log_); - } - } - } - if (linkResourceBuilder_ == null) { - if (!other.linkResource_.isEmpty()) { - if (linkResource_.isEmpty()) { - linkResource_ = other.linkResource_; - bitField0_ = (bitField0_ & ~0x00008000); - } else { - ensureLinkResourceIsMutable(); - linkResource_.addAll(other.linkResource_); - } - onChanged(); - } - } else { - if (!other.linkResource_.isEmpty()) { - if (linkResourceBuilder_.isEmpty()) { - linkResourceBuilder_.dispose(); - linkResourceBuilder_ = null; - linkResource_ = other.linkResource_; - bitField0_ = (bitField0_ & ~0x00008000); - linkResourceBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getLinkResourceFieldBuilder() : null; - } else { - linkResourceBuilder_.addAllMessages(other.linkResource_); - } - } - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.android.vts.proto.VtsReportMessage.TestReportMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.android.vts.proto.VtsReportMessage.TestReportMessage) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private com.google.protobuf.ByteString testSuite_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * The test suite name. - * </pre> - * - * <code>optional bytes test_suite = 1 [deprecated = true];</code> - */ - @java.lang.Deprecated public boolean hasTestSuite() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * The test suite name. - * </pre> - * - * <code>optional bytes test_suite = 1 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.google.protobuf.ByteString getTestSuite() { - return testSuite_; - } - /** - * <pre> - * The test suite name. - * </pre> - * - * <code>optional bytes test_suite = 1 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder setTestSuite(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - testSuite_ = value; - onChanged(); - return this; - } - /** - * <pre> - * The test suite name. - * </pre> - * - * <code>optional bytes test_suite = 1 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder clearTestSuite() { - bitField0_ = (bitField0_ & ~0x00000001); - testSuite_ = getDefaultInstance().getTestSuite(); - onChanged(); - return this; - } - - private com.google.protobuf.ByteString test_ = com.google.protobuf.ByteString.EMPTY; - /** - * <pre> - * The test name. - * </pre> - * - * <code>optional bytes test = 2;</code> - */ - public boolean hasTest() { - return ((bitField0_ & 0x00000002) == 0x00000002); - } - /** - * <pre> - * The test name. - * </pre> - * - * <code>optional bytes test = 2;</code> - */ - public com.google.protobuf.ByteString getTest() { - return test_; - } - /** - * <pre> - * The test name. - * </pre> - * - * <code>optional bytes test = 2;</code> - */ - public Builder setTest(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000002; - test_ = value; - onChanged(); - return this; - } - /** - * <pre> - * The test name. - * </pre> - * - * <code>optional bytes test = 2;</code> - */ - public Builder clearTest() { - bitField0_ = (bitField0_ & ~0x00000002); - test_ = getDefaultInstance().getTest(); - onChanged(); - return this; - } - - private int testType_ = 0; - /** - * <pre> - * The test type - * </pre> - * - * <code>optional .android.vts.VtsTestType test_type = 3;</code> - */ - public boolean hasTestType() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * The test type - * </pre> - * - * <code>optional .android.vts.VtsTestType test_type = 3;</code> - */ - public com.android.vts.proto.VtsReportMessage.VtsTestType getTestType() { - com.android.vts.proto.VtsReportMessage.VtsTestType result = com.android.vts.proto.VtsReportMessage.VtsTestType.valueOf(testType_); - return result == null ? com.android.vts.proto.VtsReportMessage.VtsTestType.UNKNOWN_VTS_TESTTYPE : result; - } - /** - * <pre> - * The test type - * </pre> - * - * <code>optional .android.vts.VtsTestType test_type = 3;</code> - */ - public Builder setTestType(com.android.vts.proto.VtsReportMessage.VtsTestType value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - testType_ = value.getNumber(); - onChanged(); - return this; - } - /** - * <pre> - * The test type - * </pre> - * - * <code>optional .android.vts.VtsTestType test_type = 3;</code> - */ - public Builder clearTestType() { - bitField0_ = (bitField0_ & ~0x00000004); - testType_ = 0; - onChanged(); - return this; - } - - private java.util.List<com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage> deviceInfo_ = - java.util.Collections.emptyList(); - private void ensureDeviceInfoIsMutable() { - if (!((bitField0_ & 0x00000008) == 0x00000008)) { - deviceInfo_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage>(deviceInfo_); - bitField0_ |= 0x00000008; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage, com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.Builder, com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessageOrBuilder> deviceInfoBuilder_; - - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage> getDeviceInfoList() { - if (deviceInfoBuilder_ == null) { - return java.util.Collections.unmodifiableList(deviceInfo_); - } else { - return deviceInfoBuilder_.getMessageList(); - } - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public int getDeviceInfoCount() { - if (deviceInfoBuilder_ == null) { - return deviceInfo_.size(); - } else { - return deviceInfoBuilder_.getCount(); - } - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage getDeviceInfo(int index) { - if (deviceInfoBuilder_ == null) { - return deviceInfo_.get(index); - } else { - return deviceInfoBuilder_.getMessage(index); - } - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public Builder setDeviceInfo( - int index, com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage value) { - if (deviceInfoBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeviceInfoIsMutable(); - deviceInfo_.set(index, value); - onChanged(); - } else { - deviceInfoBuilder_.setMessage(index, value); - } - return this; - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public Builder setDeviceInfo( - int index, com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.Builder builderForValue) { - if (deviceInfoBuilder_ == null) { - ensureDeviceInfoIsMutable(); - deviceInfo_.set(index, builderForValue.build()); - onChanged(); - } else { - deviceInfoBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public Builder addDeviceInfo(com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage value) { - if (deviceInfoBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeviceInfoIsMutable(); - deviceInfo_.add(value); - onChanged(); - } else { - deviceInfoBuilder_.addMessage(value); - } - return this; - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public Builder addDeviceInfo( - int index, com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage value) { - if (deviceInfoBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeviceInfoIsMutable(); - deviceInfo_.add(index, value); - onChanged(); - } else { - deviceInfoBuilder_.addMessage(index, value); - } - return this; - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public Builder addDeviceInfo( - com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.Builder builderForValue) { - if (deviceInfoBuilder_ == null) { - ensureDeviceInfoIsMutable(); - deviceInfo_.add(builderForValue.build()); - onChanged(); - } else { - deviceInfoBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public Builder addDeviceInfo( - int index, com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.Builder builderForValue) { - if (deviceInfoBuilder_ == null) { - ensureDeviceInfoIsMutable(); - deviceInfo_.add(index, builderForValue.build()); - onChanged(); - } else { - deviceInfoBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public Builder addAllDeviceInfo( - java.lang.Iterable<? extends com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage> values) { - if (deviceInfoBuilder_ == null) { - ensureDeviceInfoIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, deviceInfo_); - onChanged(); - } else { - deviceInfoBuilder_.addAllMessages(values); - } - return this; - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public Builder clearDeviceInfo() { - if (deviceInfoBuilder_ == null) { - deviceInfo_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - onChanged(); - } else { - deviceInfoBuilder_.clear(); - } - return this; - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public Builder removeDeviceInfo(int index) { - if (deviceInfoBuilder_ == null) { - ensureDeviceInfoIsMutable(); - deviceInfo_.remove(index); - onChanged(); - } else { - deviceInfoBuilder_.remove(index); - } - return this; - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.Builder getDeviceInfoBuilder( - int index) { - return getDeviceInfoFieldBuilder().getBuilder(index); - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessageOrBuilder getDeviceInfoOrBuilder( - int index) { - if (deviceInfoBuilder_ == null) { - return deviceInfo_.get(index); } else { - return deviceInfoBuilder_.getMessageOrBuilder(index); - } - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessageOrBuilder> - getDeviceInfoOrBuilderList() { - if (deviceInfoBuilder_ != null) { - return deviceInfoBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(deviceInfo_); - } - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.Builder addDeviceInfoBuilder() { - return getDeviceInfoFieldBuilder().addBuilder( - com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.getDefaultInstance()); - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.Builder addDeviceInfoBuilder( - int index) { - return getDeviceInfoFieldBuilder().addBuilder( - index, com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.getDefaultInstance()); - } - /** - * <pre> - * Target device info - * </pre> - * - * <code>repeated .android.vts.AndroidDeviceInfoMessage device_info = 4;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.Builder> - getDeviceInfoBuilderList() { - return getDeviceInfoFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage, com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.Builder, com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessageOrBuilder> - getDeviceInfoFieldBuilder() { - if (deviceInfoBuilder_ == null) { - deviceInfoBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage, com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage.Builder, com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessageOrBuilder>( - deviceInfo_, - ((bitField0_ & 0x00000008) == 0x00000008), - getParentForChildren(), - isClean()); - deviceInfo_ = null; - } - return deviceInfoBuilder_; - } - - private com.android.vts.proto.VtsReportMessage.AndroidBuildInfo buildInfo_ = null; - private com.google.protobuf.SingleFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.AndroidBuildInfo, com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.Builder, com.android.vts.proto.VtsReportMessage.AndroidBuildInfoOrBuilder> buildInfoBuilder_; - /** - * <pre> - * Build info - * </pre> - * - * <code>optional .android.vts.AndroidBuildInfo build_info = 5;</code> - */ - public boolean hasBuildInfo() { - return ((bitField0_ & 0x00000010) == 0x00000010); - } - /** - * <pre> - * Build info - * </pre> - * - * <code>optional .android.vts.AndroidBuildInfo build_info = 5;</code> - */ - public com.android.vts.proto.VtsReportMessage.AndroidBuildInfo getBuildInfo() { - if (buildInfoBuilder_ == null) { - return buildInfo_ == null ? com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.getDefaultInstance() : buildInfo_; - } else { - return buildInfoBuilder_.getMessage(); - } - } - /** - * <pre> - * Build info - * </pre> - * - * <code>optional .android.vts.AndroidBuildInfo build_info = 5;</code> - */ - public Builder setBuildInfo(com.android.vts.proto.VtsReportMessage.AndroidBuildInfo value) { - if (buildInfoBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - buildInfo_ = value; - onChanged(); - } else { - buildInfoBuilder_.setMessage(value); - } - bitField0_ |= 0x00000010; - return this; - } - /** - * <pre> - * Build info - * </pre> - * - * <code>optional .android.vts.AndroidBuildInfo build_info = 5;</code> - */ - public Builder setBuildInfo( - com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.Builder builderForValue) { - if (buildInfoBuilder_ == null) { - buildInfo_ = builderForValue.build(); - onChanged(); - } else { - buildInfoBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000010; - return this; - } - /** - * <pre> - * Build info - * </pre> - * - * <code>optional .android.vts.AndroidBuildInfo build_info = 5;</code> - */ - public Builder mergeBuildInfo(com.android.vts.proto.VtsReportMessage.AndroidBuildInfo value) { - if (buildInfoBuilder_ == null) { - if (((bitField0_ & 0x00000010) == 0x00000010) && - buildInfo_ != null && - buildInfo_ != com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.getDefaultInstance()) { - buildInfo_ = - com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.newBuilder(buildInfo_).mergeFrom(value).buildPartial(); - } else { - buildInfo_ = value; - } - onChanged(); - } else { - buildInfoBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000010; - return this; - } - /** - * <pre> - * Build info - * </pre> - * - * <code>optional .android.vts.AndroidBuildInfo build_info = 5;</code> - */ - public Builder clearBuildInfo() { - if (buildInfoBuilder_ == null) { - buildInfo_ = null; - onChanged(); - } else { - buildInfoBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000010); - return this; - } - /** - * <pre> - * Build info - * </pre> - * - * <code>optional .android.vts.AndroidBuildInfo build_info = 5;</code> - */ - public com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.Builder getBuildInfoBuilder() { - bitField0_ |= 0x00000010; - onChanged(); - return getBuildInfoFieldBuilder().getBuilder(); - } - /** - * <pre> - * Build info - * </pre> - * - * <code>optional .android.vts.AndroidBuildInfo build_info = 5;</code> - */ - public com.android.vts.proto.VtsReportMessage.AndroidBuildInfoOrBuilder getBuildInfoOrBuilder() { - if (buildInfoBuilder_ != null) { - return buildInfoBuilder_.getMessageOrBuilder(); - } else { - return buildInfo_ == null ? - com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.getDefaultInstance() : buildInfo_; - } - } - /** - * <pre> - * Build info - * </pre> - * - * <code>optional .android.vts.AndroidBuildInfo build_info = 5;</code> - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.AndroidBuildInfo, com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.Builder, com.android.vts.proto.VtsReportMessage.AndroidBuildInfoOrBuilder> - getBuildInfoFieldBuilder() { - if (buildInfoBuilder_ == null) { - buildInfoBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.AndroidBuildInfo, com.android.vts.proto.VtsReportMessage.AndroidBuildInfo.Builder, com.android.vts.proto.VtsReportMessage.AndroidBuildInfoOrBuilder>( - getBuildInfo(), - getParentForChildren(), - isClean()); - buildInfo_ = null; - } - return buildInfoBuilder_; - } - - private java.util.List<com.google.protobuf.ByteString> subscriberEmail_ = java.util.Collections.emptyList(); - private void ensureSubscriberEmailIsMutable() { - if (!((bitField0_ & 0x00000020) == 0x00000020)) { - subscriberEmail_ = new java.util.ArrayList<com.google.protobuf.ByteString>(subscriberEmail_); - bitField0_ |= 0x00000020; - } - } - /** - * <pre> - * Email addresses of subscribers to the test results - * </pre> - * - * <code>repeated bytes subscriber_email = 6;</code> - */ - public java.util.List<com.google.protobuf.ByteString> - getSubscriberEmailList() { - return java.util.Collections.unmodifiableList(subscriberEmail_); - } - /** - * <pre> - * Email addresses of subscribers to the test results - * </pre> - * - * <code>repeated bytes subscriber_email = 6;</code> - */ - public int getSubscriberEmailCount() { - return subscriberEmail_.size(); - } - /** - * <pre> - * Email addresses of subscribers to the test results - * </pre> - * - * <code>repeated bytes subscriber_email = 6;</code> - */ - public com.google.protobuf.ByteString getSubscriberEmail(int index) { - return subscriberEmail_.get(index); - } - /** - * <pre> - * Email addresses of subscribers to the test results - * </pre> - * - * <code>repeated bytes subscriber_email = 6;</code> - */ - public Builder setSubscriberEmail( - int index, com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureSubscriberEmailIsMutable(); - subscriberEmail_.set(index, value); - onChanged(); - return this; - } - /** - * <pre> - * Email addresses of subscribers to the test results - * </pre> - * - * <code>repeated bytes subscriber_email = 6;</code> - */ - public Builder addSubscriberEmail(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureSubscriberEmailIsMutable(); - subscriberEmail_.add(value); - onChanged(); - return this; - } - /** - * <pre> - * Email addresses of subscribers to the test results - * </pre> - * - * <code>repeated bytes subscriber_email = 6;</code> - */ - public Builder addAllSubscriberEmail( - java.lang.Iterable<? extends com.google.protobuf.ByteString> values) { - ensureSubscriberEmailIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, subscriberEmail_); - onChanged(); - return this; - } - /** - * <pre> - * Email addresses of subscribers to the test results - * </pre> - * - * <code>repeated bytes subscriber_email = 6;</code> - */ - public Builder clearSubscriberEmail() { - subscriberEmail_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); - onChanged(); - return this; - } - - private com.android.vts.proto.VtsReportMessage.VtsHostInfo hostInfo_ = null; - private com.google.protobuf.SingleFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.VtsHostInfo, com.android.vts.proto.VtsReportMessage.VtsHostInfo.Builder, com.android.vts.proto.VtsReportMessage.VtsHostInfoOrBuilder> hostInfoBuilder_; - /** - * <pre> - * Info about the host computer - * </pre> - * - * <code>optional .android.vts.VtsHostInfo host_info = 7;</code> - */ - public boolean hasHostInfo() { - return ((bitField0_ & 0x00000040) == 0x00000040); - } - /** - * <pre> - * Info about the host computer - * </pre> - * - * <code>optional .android.vts.VtsHostInfo host_info = 7;</code> - */ - public com.android.vts.proto.VtsReportMessage.VtsHostInfo getHostInfo() { - if (hostInfoBuilder_ == null) { - return hostInfo_ == null ? com.android.vts.proto.VtsReportMessage.VtsHostInfo.getDefaultInstance() : hostInfo_; - } else { - return hostInfoBuilder_.getMessage(); - } - } - /** - * <pre> - * Info about the host computer - * </pre> - * - * <code>optional .android.vts.VtsHostInfo host_info = 7;</code> - */ - public Builder setHostInfo(com.android.vts.proto.VtsReportMessage.VtsHostInfo value) { - if (hostInfoBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - hostInfo_ = value; - onChanged(); - } else { - hostInfoBuilder_.setMessage(value); - } - bitField0_ |= 0x00000040; - return this; - } - /** - * <pre> - * Info about the host computer - * </pre> - * - * <code>optional .android.vts.VtsHostInfo host_info = 7;</code> - */ - public Builder setHostInfo( - com.android.vts.proto.VtsReportMessage.VtsHostInfo.Builder builderForValue) { - if (hostInfoBuilder_ == null) { - hostInfo_ = builderForValue.build(); - onChanged(); - } else { - hostInfoBuilder_.setMessage(builderForValue.build()); - } - bitField0_ |= 0x00000040; - return this; - } - /** - * <pre> - * Info about the host computer - * </pre> - * - * <code>optional .android.vts.VtsHostInfo host_info = 7;</code> - */ - public Builder mergeHostInfo(com.android.vts.proto.VtsReportMessage.VtsHostInfo value) { - if (hostInfoBuilder_ == null) { - if (((bitField0_ & 0x00000040) == 0x00000040) && - hostInfo_ != null && - hostInfo_ != com.android.vts.proto.VtsReportMessage.VtsHostInfo.getDefaultInstance()) { - hostInfo_ = - com.android.vts.proto.VtsReportMessage.VtsHostInfo.newBuilder(hostInfo_).mergeFrom(value).buildPartial(); - } else { - hostInfo_ = value; - } - onChanged(); - } else { - hostInfoBuilder_.mergeFrom(value); - } - bitField0_ |= 0x00000040; - return this; - } - /** - * <pre> - * Info about the host computer - * </pre> - * - * <code>optional .android.vts.VtsHostInfo host_info = 7;</code> - */ - public Builder clearHostInfo() { - if (hostInfoBuilder_ == null) { - hostInfo_ = null; - onChanged(); - } else { - hostInfoBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000040); - return this; - } - /** - * <pre> - * Info about the host computer - * </pre> - * - * <code>optional .android.vts.VtsHostInfo host_info = 7;</code> - */ - public com.android.vts.proto.VtsReportMessage.VtsHostInfo.Builder getHostInfoBuilder() { - bitField0_ |= 0x00000040; - onChanged(); - return getHostInfoFieldBuilder().getBuilder(); - } - /** - * <pre> - * Info about the host computer - * </pre> - * - * <code>optional .android.vts.VtsHostInfo host_info = 7;</code> - */ - public com.android.vts.proto.VtsReportMessage.VtsHostInfoOrBuilder getHostInfoOrBuilder() { - if (hostInfoBuilder_ != null) { - return hostInfoBuilder_.getMessageOrBuilder(); - } else { - return hostInfo_ == null ? - com.android.vts.proto.VtsReportMessage.VtsHostInfo.getDefaultInstance() : hostInfo_; - } - } - /** - * <pre> - * Info about the host computer - * </pre> - * - * <code>optional .android.vts.VtsHostInfo host_info = 7;</code> - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.VtsHostInfo, com.android.vts.proto.VtsReportMessage.VtsHostInfo.Builder, com.android.vts.proto.VtsReportMessage.VtsHostInfoOrBuilder> - getHostInfoFieldBuilder() { - if (hostInfoBuilder_ == null) { - hostInfoBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.VtsHostInfo, com.android.vts.proto.VtsReportMessage.VtsHostInfo.Builder, com.android.vts.proto.VtsReportMessage.VtsHostInfoOrBuilder>( - getHostInfo(), - getParentForChildren(), - isClean()); - hostInfo_ = null; - } - return hostInfoBuilder_; - } - - private java.util.List<com.android.vts.proto.VtsReportMessage.TestCaseReportMessage> testCase_ = - java.util.Collections.emptyList(); - private void ensureTestCaseIsMutable() { - if (!((bitField0_ & 0x00000080) == 0x00000080)) { - testCase_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.TestCaseReportMessage>(testCase_); - bitField0_ |= 0x00000080; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.TestCaseReportMessage, com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.Builder, com.android.vts.proto.VtsReportMessage.TestCaseReportMessageOrBuilder> testCaseBuilder_; - - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.TestCaseReportMessage> getTestCaseList() { - if (testCaseBuilder_ == null) { - return java.util.Collections.unmodifiableList(testCase_); - } else { - return testCaseBuilder_.getMessageList(); - } - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public int getTestCaseCount() { - if (testCaseBuilder_ == null) { - return testCase_.size(); - } else { - return testCaseBuilder_.getCount(); - } - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestCaseReportMessage getTestCase(int index) { - if (testCaseBuilder_ == null) { - return testCase_.get(index); - } else { - return testCaseBuilder_.getMessage(index); - } - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public Builder setTestCase( - int index, com.android.vts.proto.VtsReportMessage.TestCaseReportMessage value) { - if (testCaseBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTestCaseIsMutable(); - testCase_.set(index, value); - onChanged(); - } else { - testCaseBuilder_.setMessage(index, value); - } - return this; - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public Builder setTestCase( - int index, com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.Builder builderForValue) { - if (testCaseBuilder_ == null) { - ensureTestCaseIsMutable(); - testCase_.set(index, builderForValue.build()); - onChanged(); - } else { - testCaseBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public Builder addTestCase(com.android.vts.proto.VtsReportMessage.TestCaseReportMessage value) { - if (testCaseBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTestCaseIsMutable(); - testCase_.add(value); - onChanged(); - } else { - testCaseBuilder_.addMessage(value); - } - return this; - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public Builder addTestCase( - int index, com.android.vts.proto.VtsReportMessage.TestCaseReportMessage value) { - if (testCaseBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTestCaseIsMutable(); - testCase_.add(index, value); - onChanged(); - } else { - testCaseBuilder_.addMessage(index, value); - } - return this; - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public Builder addTestCase( - com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.Builder builderForValue) { - if (testCaseBuilder_ == null) { - ensureTestCaseIsMutable(); - testCase_.add(builderForValue.build()); - onChanged(); - } else { - testCaseBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public Builder addTestCase( - int index, com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.Builder builderForValue) { - if (testCaseBuilder_ == null) { - ensureTestCaseIsMutable(); - testCase_.add(index, builderForValue.build()); - onChanged(); - } else { - testCaseBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public Builder addAllTestCase( - java.lang.Iterable<? extends com.android.vts.proto.VtsReportMessage.TestCaseReportMessage> values) { - if (testCaseBuilder_ == null) { - ensureTestCaseIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, testCase_); - onChanged(); - } else { - testCaseBuilder_.addAllMessages(values); - } - return this; - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public Builder clearTestCase() { - if (testCaseBuilder_ == null) { - testCase_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000080); - onChanged(); - } else { - testCaseBuilder_.clear(); - } - return this; - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public Builder removeTestCase(int index) { - if (testCaseBuilder_ == null) { - ensureTestCaseIsMutable(); - testCase_.remove(index); - onChanged(); - } else { - testCaseBuilder_.remove(index); - } - return this; - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.Builder getTestCaseBuilder( - int index) { - return getTestCaseFieldBuilder().getBuilder(index); - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestCaseReportMessageOrBuilder getTestCaseOrBuilder( - int index) { - if (testCaseBuilder_ == null) { - return testCase_.get(index); } else { - return testCaseBuilder_.getMessageOrBuilder(index); - } - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.TestCaseReportMessageOrBuilder> - getTestCaseOrBuilderList() { - if (testCaseBuilder_ != null) { - return testCaseBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(testCase_); - } - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.Builder addTestCaseBuilder() { - return getTestCaseFieldBuilder().addBuilder( - com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.getDefaultInstance()); - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.Builder addTestCaseBuilder( - int index) { - return getTestCaseFieldBuilder().addBuilder( - index, com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.getDefaultInstance()); - } - /** - * <pre> - * Test case reports - * </pre> - * - * <code>repeated .android.vts.TestCaseReportMessage test_case = 11;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.Builder> - getTestCaseBuilderList() { - return getTestCaseFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.TestCaseReportMessage, com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.Builder, com.android.vts.proto.VtsReportMessage.TestCaseReportMessageOrBuilder> - getTestCaseFieldBuilder() { - if (testCaseBuilder_ == null) { - testCaseBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.TestCaseReportMessage, com.android.vts.proto.VtsReportMessage.TestCaseReportMessage.Builder, com.android.vts.proto.VtsReportMessage.TestCaseReportMessageOrBuilder>( - testCase_, - ((bitField0_ & 0x00000080) == 0x00000080), - getParentForChildren(), - isClean()); - testCase_ = null; - } - return testCaseBuilder_; - } - - private java.util.List<com.android.vts.proto.VtsReportMessage.ProfilingReportMessage> profiling_ = - java.util.Collections.emptyList(); - private void ensureProfilingIsMutable() { - if (!((bitField0_ & 0x00000100) == 0x00000100)) { - profiling_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.ProfilingReportMessage>(profiling_); - bitField0_ |= 0x00000100; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder, com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder> profilingBuilder_; - - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.ProfilingReportMessage> getProfilingList() { - if (profilingBuilder_ == null) { - return java.util.Collections.unmodifiableList(profiling_); - } else { - return profilingBuilder_.getMessageList(); - } - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public int getProfilingCount() { - if (profilingBuilder_ == null) { - return profiling_.size(); - } else { - return profilingBuilder_.getCount(); - } - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessage getProfiling(int index) { - if (profilingBuilder_ == null) { - return profiling_.get(index); - } else { - return profilingBuilder_.getMessage(index); - } - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public Builder setProfiling( - int index, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage value) { - if (profilingBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureProfilingIsMutable(); - profiling_.set(index, value); - onChanged(); - } else { - profilingBuilder_.setMessage(index, value); - } - return this; - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public Builder setProfiling( - int index, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder builderForValue) { - if (profilingBuilder_ == null) { - ensureProfilingIsMutable(); - profiling_.set(index, builderForValue.build()); - onChanged(); - } else { - profilingBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public Builder addProfiling(com.android.vts.proto.VtsReportMessage.ProfilingReportMessage value) { - if (profilingBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureProfilingIsMutable(); - profiling_.add(value); - onChanged(); - } else { - profilingBuilder_.addMessage(value); - } - return this; - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public Builder addProfiling( - int index, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage value) { - if (profilingBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureProfilingIsMutable(); - profiling_.add(index, value); - onChanged(); - } else { - profilingBuilder_.addMessage(index, value); - } - return this; - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public Builder addProfiling( - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder builderForValue) { - if (profilingBuilder_ == null) { - ensureProfilingIsMutable(); - profiling_.add(builderForValue.build()); - onChanged(); - } else { - profilingBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public Builder addProfiling( - int index, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder builderForValue) { - if (profilingBuilder_ == null) { - ensureProfilingIsMutable(); - profiling_.add(index, builderForValue.build()); - onChanged(); - } else { - profilingBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public Builder addAllProfiling( - java.lang.Iterable<? extends com.android.vts.proto.VtsReportMessage.ProfilingReportMessage> values) { - if (profilingBuilder_ == null) { - ensureProfilingIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, profiling_); - onChanged(); - } else { - profilingBuilder_.addAllMessages(values); - } - return this; - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public Builder clearProfiling() { - if (profilingBuilder_ == null) { - profiling_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000100); - onChanged(); - } else { - profilingBuilder_.clear(); - } - return this; - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public Builder removeProfiling(int index) { - if (profilingBuilder_ == null) { - ensureProfilingIsMutable(); - profiling_.remove(index); - onChanged(); - } else { - profilingBuilder_.remove(index); - } - return this; - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder getProfilingBuilder( - int index) { - return getProfilingFieldBuilder().getBuilder(index); - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder getProfilingOrBuilder( - int index) { - if (profilingBuilder_ == null) { - return profiling_.get(index); } else { - return profilingBuilder_.getMessageOrBuilder(index); - } - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder> - getProfilingOrBuilderList() { - if (profilingBuilder_ != null) { - return profilingBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(profiling_); - } - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder addProfilingBuilder() { - return getProfilingFieldBuilder().addBuilder( - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.getDefaultInstance()); - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder addProfilingBuilder( - int index) { - return getProfilingFieldBuilder().addBuilder( - index, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.getDefaultInstance()); - } - /** - * <pre> - * Profiling reports - * </pre> - * - * <code>repeated .android.vts.ProfilingReportMessage profiling = 21;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder> - getProfilingBuilderList() { - return getProfilingFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder, com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder> - getProfilingFieldBuilder() { - if (profilingBuilder_ == null) { - profilingBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.ProfilingReportMessage, com.android.vts.proto.VtsReportMessage.ProfilingReportMessage.Builder, com.android.vts.proto.VtsReportMessage.ProfilingReportMessageOrBuilder>( - profiling_, - ((bitField0_ & 0x00000100) == 0x00000100), - getParentForChildren(), - isClean()); - profiling_ = null; - } - return profilingBuilder_; - } - - private java.util.List<com.android.vts.proto.VtsReportMessage.SystraceReportMessage> systrace_ = - java.util.Collections.emptyList(); - private void ensureSystraceIsMutable() { - if (!((bitField0_ & 0x00000200) == 0x00000200)) { - systrace_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.SystraceReportMessage>(systrace_); - bitField0_ |= 0x00000200; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.SystraceReportMessage, com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder, com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder> systraceBuilder_; - - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public java.util.List<com.android.vts.proto.VtsReportMessage.SystraceReportMessage> getSystraceList() { - if (systraceBuilder_ == null) { - return java.util.Collections.unmodifiableList(systrace_); - } else { - return systraceBuilder_.getMessageList(); - } - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public int getSystraceCount() { - if (systraceBuilder_ == null) { - return systrace_.size(); - } else { - return systraceBuilder_.getCount(); - } - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.VtsReportMessage.SystraceReportMessage getSystrace(int index) { - if (systraceBuilder_ == null) { - return systrace_.get(index); - } else { - return systraceBuilder_.getMessage(index); - } - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder setSystrace( - int index, com.android.vts.proto.VtsReportMessage.SystraceReportMessage value) { - if (systraceBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSystraceIsMutable(); - systrace_.set(index, value); - onChanged(); - } else { - systraceBuilder_.setMessage(index, value); - } - return this; - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder setSystrace( - int index, com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder builderForValue) { - if (systraceBuilder_ == null) { - ensureSystraceIsMutable(); - systrace_.set(index, builderForValue.build()); - onChanged(); - } else { - systraceBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder addSystrace(com.android.vts.proto.VtsReportMessage.SystraceReportMessage value) { - if (systraceBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSystraceIsMutable(); - systrace_.add(value); - onChanged(); - } else { - systraceBuilder_.addMessage(value); - } - return this; - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder addSystrace( - int index, com.android.vts.proto.VtsReportMessage.SystraceReportMessage value) { - if (systraceBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureSystraceIsMutable(); - systrace_.add(index, value); - onChanged(); - } else { - systraceBuilder_.addMessage(index, value); - } - return this; - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder addSystrace( - com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder builderForValue) { - if (systraceBuilder_ == null) { - ensureSystraceIsMutable(); - systrace_.add(builderForValue.build()); - onChanged(); - } else { - systraceBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder addSystrace( - int index, com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder builderForValue) { - if (systraceBuilder_ == null) { - ensureSystraceIsMutable(); - systrace_.add(index, builderForValue.build()); - onChanged(); - } else { - systraceBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder addAllSystrace( - java.lang.Iterable<? extends com.android.vts.proto.VtsReportMessage.SystraceReportMessage> values) { - if (systraceBuilder_ == null) { - ensureSystraceIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, systrace_); - onChanged(); - } else { - systraceBuilder_.addAllMessages(values); - } - return this; - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder clearSystrace() { - if (systraceBuilder_ == null) { - systrace_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000200); - onChanged(); - } else { - systraceBuilder_.clear(); - } - return this; - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public Builder removeSystrace(int index) { - if (systraceBuilder_ == null) { - ensureSystraceIsMutable(); - systrace_.remove(index); - onChanged(); - } else { - systraceBuilder_.remove(index); - } - return this; - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder getSystraceBuilder( - int index) { - return getSystraceFieldBuilder().getBuilder(index); - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder getSystraceOrBuilder( - int index) { - if (systraceBuilder_ == null) { - return systrace_.get(index); } else { - return systraceBuilder_.getMessageOrBuilder(index); - } - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public java.util.List<? extends com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder> - getSystraceOrBuilderList() { - if (systraceBuilder_ != null) { - return systraceBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(systrace_); - } - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder addSystraceBuilder() { - return getSystraceFieldBuilder().addBuilder( - com.android.vts.proto.VtsReportMessage.SystraceReportMessage.getDefaultInstance()); - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder addSystraceBuilder( - int index) { - return getSystraceFieldBuilder().addBuilder( - index, com.android.vts.proto.VtsReportMessage.SystraceReportMessage.getDefaultInstance()); - } - /** - * <pre> - * Systrace report per file - * </pre> - * - * <code>repeated .android.vts.SystraceReportMessage systrace = 22 [deprecated = true];</code> - */ - @java.lang.Deprecated public java.util.List<com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder> - getSystraceBuilderList() { - return getSystraceFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.SystraceReportMessage, com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder, com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder> - getSystraceFieldBuilder() { - if (systraceBuilder_ == null) { - systraceBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.SystraceReportMessage, com.android.vts.proto.VtsReportMessage.SystraceReportMessage.Builder, com.android.vts.proto.VtsReportMessage.SystraceReportMessageOrBuilder>( - systrace_, - ((bitField0_ & 0x00000200) == 0x00000200), - getParentForChildren(), - isClean()); - systrace_ = null; - } - return systraceBuilder_; - } - - private long startTimestamp_ ; - /** - * <pre> - * Execution start and end time stamp. - * </pre> - * - * <code>optional int64 start_timestamp = 101;</code> - */ - public boolean hasStartTimestamp() { - return ((bitField0_ & 0x00000400) == 0x00000400); - } - /** - * <pre> - * Execution start and end time stamp. - * </pre> - * - * <code>optional int64 start_timestamp = 101;</code> - */ - public long getStartTimestamp() { - return startTimestamp_; - } - /** - * <pre> - * Execution start and end time stamp. - * </pre> - * - * <code>optional int64 start_timestamp = 101;</code> - */ - public Builder setStartTimestamp(long value) { - bitField0_ |= 0x00000400; - startTimestamp_ = value; - onChanged(); - return this; - } - /** - * <pre> - * Execution start and end time stamp. - * </pre> - * - * <code>optional int64 start_timestamp = 101;</code> - */ - public Builder clearStartTimestamp() { - bitField0_ = (bitField0_ & ~0x00000400); - startTimestamp_ = 0L; - onChanged(); - return this; - } - - private long endTimestamp_ ; - /** - * <code>optional int64 end_timestamp = 102;</code> - */ - public boolean hasEndTimestamp() { - return ((bitField0_ & 0x00000800) == 0x00000800); - } - /** - * <code>optional int64 end_timestamp = 102;</code> - */ - public long getEndTimestamp() { - return endTimestamp_; - } - /** - * <code>optional int64 end_timestamp = 102;</code> - */ - public Builder setEndTimestamp(long value) { - bitField0_ |= 0x00000800; - endTimestamp_ = value; - onChanged(); - return this; - } - /** - * <code>optional int64 end_timestamp = 102;</code> - */ - public Builder clearEndTimestamp() { - bitField0_ = (bitField0_ & ~0x00000800); - endTimestamp_ = 0L; - onChanged(); - return this; - } - - private java.util.List<com.android.vts.proto.VtsReportMessage.CoverageReportMessage> coverage_ = - java.util.Collections.emptyList(); - private void ensureCoverageIsMutable() { - if (!((bitField0_ & 0x00001000) == 0x00001000)) { - coverage_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.CoverageReportMessage>(coverage_); - bitField0_ |= 0x00001000; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.CoverageReportMessage, com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder, com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder> coverageBuilder_; - - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.CoverageReportMessage> getCoverageList() { - if (coverageBuilder_ == null) { - return java.util.Collections.unmodifiableList(coverage_); - } else { - return coverageBuilder_.getMessageList(); - } - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public int getCoverageCount() { - if (coverageBuilder_ == null) { - return coverage_.size(); - } else { - return coverageBuilder_.getCount(); - } - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public com.android.vts.proto.VtsReportMessage.CoverageReportMessage getCoverage(int index) { - if (coverageBuilder_ == null) { - return coverage_.get(index); - } else { - return coverageBuilder_.getMessage(index); - } - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public Builder setCoverage( - int index, com.android.vts.proto.VtsReportMessage.CoverageReportMessage value) { - if (coverageBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCoverageIsMutable(); - coverage_.set(index, value); - onChanged(); - } else { - coverageBuilder_.setMessage(index, value); - } - return this; - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public Builder setCoverage( - int index, com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder builderForValue) { - if (coverageBuilder_ == null) { - ensureCoverageIsMutable(); - coverage_.set(index, builderForValue.build()); - onChanged(); - } else { - coverageBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public Builder addCoverage(com.android.vts.proto.VtsReportMessage.CoverageReportMessage value) { - if (coverageBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCoverageIsMutable(); - coverage_.add(value); - onChanged(); - } else { - coverageBuilder_.addMessage(value); - } - return this; - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public Builder addCoverage( - int index, com.android.vts.proto.VtsReportMessage.CoverageReportMessage value) { - if (coverageBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCoverageIsMutable(); - coverage_.add(index, value); - onChanged(); - } else { - coverageBuilder_.addMessage(index, value); - } - return this; - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public Builder addCoverage( - com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder builderForValue) { - if (coverageBuilder_ == null) { - ensureCoverageIsMutable(); - coverage_.add(builderForValue.build()); - onChanged(); - } else { - coverageBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public Builder addCoverage( - int index, com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder builderForValue) { - if (coverageBuilder_ == null) { - ensureCoverageIsMutable(); - coverage_.add(index, builderForValue.build()); - onChanged(); - } else { - coverageBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public Builder addAllCoverage( - java.lang.Iterable<? extends com.android.vts.proto.VtsReportMessage.CoverageReportMessage> values) { - if (coverageBuilder_ == null) { - ensureCoverageIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, coverage_); - onChanged(); - } else { - coverageBuilder_.addAllMessages(values); - } - return this; - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public Builder clearCoverage() { - if (coverageBuilder_ == null) { - coverage_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00001000); - onChanged(); - } else { - coverageBuilder_.clear(); - } - return this; - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public Builder removeCoverage(int index) { - if (coverageBuilder_ == null) { - ensureCoverageIsMutable(); - coverage_.remove(index); - onChanged(); - } else { - coverageBuilder_.remove(index); - } - return this; - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder getCoverageBuilder( - int index) { - return getCoverageFieldBuilder().getBuilder(index); - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder getCoverageOrBuilder( - int index) { - if (coverageBuilder_ == null) { - return coverage_.get(index); } else { - return coverageBuilder_.getMessageOrBuilder(index); - } - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder> - getCoverageOrBuilderList() { - if (coverageBuilder_ != null) { - return coverageBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(coverage_); - } - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder addCoverageBuilder() { - return getCoverageFieldBuilder().addBuilder( - com.android.vts.proto.VtsReportMessage.CoverageReportMessage.getDefaultInstance()); - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder addCoverageBuilder( - int index) { - return getCoverageFieldBuilder().addBuilder( - index, com.android.vts.proto.VtsReportMessage.CoverageReportMessage.getDefaultInstance()); - } - /** - * <pre> - * Coverage report per file - * </pre> - * - * <code>repeated .android.vts.CoverageReportMessage coverage = 103;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder> - getCoverageBuilderList() { - return getCoverageFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.CoverageReportMessage, com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder, com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder> - getCoverageFieldBuilder() { - if (coverageBuilder_ == null) { - coverageBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.CoverageReportMessage, com.android.vts.proto.VtsReportMessage.CoverageReportMessage.Builder, com.android.vts.proto.VtsReportMessage.CoverageReportMessageOrBuilder>( - coverage_, - ((bitField0_ & 0x00001000) == 0x00001000), - getParentForChildren(), - isClean()); - coverage_ = null; - } - return coverageBuilder_; - } - - private java.util.List<com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage> apiCoverage_ = - java.util.Collections.emptyList(); - private void ensureApiCoverageIsMutable() { - if (!((bitField0_ & 0x00002000) == 0x00002000)) { - apiCoverage_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage>(apiCoverage_); - bitField0_ |= 0x00002000; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder> apiCoverageBuilder_; - - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage> getApiCoverageList() { - if (apiCoverageBuilder_ == null) { - return java.util.Collections.unmodifiableList(apiCoverage_); - } else { - return apiCoverageBuilder_.getMessageList(); - } - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public int getApiCoverageCount() { - if (apiCoverageBuilder_ == null) { - return apiCoverage_.size(); - } else { - return apiCoverageBuilder_.getCount(); - } - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage getApiCoverage(int index) { - if (apiCoverageBuilder_ == null) { - return apiCoverage_.get(index); - } else { - return apiCoverageBuilder_.getMessage(index); - } - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public Builder setApiCoverage( - int index, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage value) { - if (apiCoverageBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureApiCoverageIsMutable(); - apiCoverage_.set(index, value); - onChanged(); - } else { - apiCoverageBuilder_.setMessage(index, value); - } - return this; - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public Builder setApiCoverage( - int index, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder builderForValue) { - if (apiCoverageBuilder_ == null) { - ensureApiCoverageIsMutable(); - apiCoverage_.set(index, builderForValue.build()); - onChanged(); - } else { - apiCoverageBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public Builder addApiCoverage(com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage value) { - if (apiCoverageBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureApiCoverageIsMutable(); - apiCoverage_.add(value); - onChanged(); - } else { - apiCoverageBuilder_.addMessage(value); - } - return this; - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public Builder addApiCoverage( - int index, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage value) { - if (apiCoverageBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureApiCoverageIsMutable(); - apiCoverage_.add(index, value); - onChanged(); - } else { - apiCoverageBuilder_.addMessage(index, value); - } - return this; - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public Builder addApiCoverage( - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder builderForValue) { - if (apiCoverageBuilder_ == null) { - ensureApiCoverageIsMutable(); - apiCoverage_.add(builderForValue.build()); - onChanged(); - } else { - apiCoverageBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public Builder addApiCoverage( - int index, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder builderForValue) { - if (apiCoverageBuilder_ == null) { - ensureApiCoverageIsMutable(); - apiCoverage_.add(index, builderForValue.build()); - onChanged(); - } else { - apiCoverageBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public Builder addAllApiCoverage( - java.lang.Iterable<? extends com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage> values) { - if (apiCoverageBuilder_ == null) { - ensureApiCoverageIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, apiCoverage_); - onChanged(); - } else { - apiCoverageBuilder_.addAllMessages(values); - } - return this; - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public Builder clearApiCoverage() { - if (apiCoverageBuilder_ == null) { - apiCoverage_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00002000); - onChanged(); - } else { - apiCoverageBuilder_.clear(); - } - return this; - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public Builder removeApiCoverage(int index) { - if (apiCoverageBuilder_ == null) { - ensureApiCoverageIsMutable(); - apiCoverage_.remove(index); - onChanged(); - } else { - apiCoverageBuilder_.remove(index); - } - return this; - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder getApiCoverageBuilder( - int index) { - return getApiCoverageFieldBuilder().getBuilder(index); - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder getApiCoverageOrBuilder( - int index) { - if (apiCoverageBuilder_ == null) { - return apiCoverage_.get(index); } else { - return apiCoverageBuilder_.getMessageOrBuilder(index); - } - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder> - getApiCoverageOrBuilderList() { - if (apiCoverageBuilder_ != null) { - return apiCoverageBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(apiCoverage_); - } - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder addApiCoverageBuilder() { - return getApiCoverageFieldBuilder().addBuilder( - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.getDefaultInstance()); - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder addApiCoverageBuilder( - int index) { - return getApiCoverageFieldBuilder().addBuilder( - index, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.getDefaultInstance()); - } - /** - * <pre> - * API coverage report for each HAL interface. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage api_coverage = 104;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder> - getApiCoverageBuilderList() { - return getApiCoverageFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder> - getApiCoverageFieldBuilder() { - if (apiCoverageBuilder_ == null) { - apiCoverageBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder>( - apiCoverage_, - ((bitField0_ & 0x00002000) == 0x00002000), - getParentForChildren(), - isClean()); - apiCoverage_ = null; - } - return apiCoverageBuilder_; - } - - private java.util.List<com.android.vts.proto.VtsReportMessage.LogMessage> log_ = - java.util.Collections.emptyList(); - private void ensureLogIsMutable() { - if (!((bitField0_ & 0x00004000) == 0x00004000)) { - log_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.LogMessage>(log_); - bitField0_ |= 0x00004000; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.LogMessage, com.android.vts.proto.VtsReportMessage.LogMessage.Builder, com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder> logBuilder_; - - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.LogMessage> getLogList() { - if (logBuilder_ == null) { - return java.util.Collections.unmodifiableList(log_); - } else { - return logBuilder_.getMessageList(); - } - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public int getLogCount() { - if (logBuilder_ == null) { - return log_.size(); - } else { - return logBuilder_.getCount(); - } - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public com.android.vts.proto.VtsReportMessage.LogMessage getLog(int index) { - if (logBuilder_ == null) { - return log_.get(index); - } else { - return logBuilder_.getMessage(index); - } - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public Builder setLog( - int index, com.android.vts.proto.VtsReportMessage.LogMessage value) { - if (logBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureLogIsMutable(); - log_.set(index, value); - onChanged(); - } else { - logBuilder_.setMessage(index, value); - } - return this; - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public Builder setLog( - int index, com.android.vts.proto.VtsReportMessage.LogMessage.Builder builderForValue) { - if (logBuilder_ == null) { - ensureLogIsMutable(); - log_.set(index, builderForValue.build()); - onChanged(); - } else { - logBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public Builder addLog(com.android.vts.proto.VtsReportMessage.LogMessage value) { - if (logBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureLogIsMutable(); - log_.add(value); - onChanged(); - } else { - logBuilder_.addMessage(value); - } - return this; - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public Builder addLog( - int index, com.android.vts.proto.VtsReportMessage.LogMessage value) { - if (logBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureLogIsMutable(); - log_.add(index, value); - onChanged(); - } else { - logBuilder_.addMessage(index, value); - } - return this; - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public Builder addLog( - com.android.vts.proto.VtsReportMessage.LogMessage.Builder builderForValue) { - if (logBuilder_ == null) { - ensureLogIsMutable(); - log_.add(builderForValue.build()); - onChanged(); - } else { - logBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public Builder addLog( - int index, com.android.vts.proto.VtsReportMessage.LogMessage.Builder builderForValue) { - if (logBuilder_ == null) { - ensureLogIsMutable(); - log_.add(index, builderForValue.build()); - onChanged(); - } else { - logBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public Builder addAllLog( - java.lang.Iterable<? extends com.android.vts.proto.VtsReportMessage.LogMessage> values) { - if (logBuilder_ == null) { - ensureLogIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, log_); - onChanged(); - } else { - logBuilder_.addAllMessages(values); - } - return this; - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public Builder clearLog() { - if (logBuilder_ == null) { - log_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00004000); - onChanged(); - } else { - logBuilder_.clear(); - } - return this; - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public Builder removeLog(int index) { - if (logBuilder_ == null) { - ensureLogIsMutable(); - log_.remove(index); - onChanged(); - } else { - logBuilder_.remove(index); - } - return this; - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public com.android.vts.proto.VtsReportMessage.LogMessage.Builder getLogBuilder( - int index) { - return getLogFieldBuilder().getBuilder(index); - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder getLogOrBuilder( - int index) { - if (logBuilder_ == null) { - return log_.get(index); } else { - return logBuilder_.getMessageOrBuilder(index); - } - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder> - getLogOrBuilderList() { - if (logBuilder_ != null) { - return logBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(log_); - } - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public com.android.vts.proto.VtsReportMessage.LogMessage.Builder addLogBuilder() { - return getLogFieldBuilder().addBuilder( - com.android.vts.proto.VtsReportMessage.LogMessage.getDefaultInstance()); - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public com.android.vts.proto.VtsReportMessage.LogMessage.Builder addLogBuilder( - int index) { - return getLogFieldBuilder().addBuilder( - index, com.android.vts.proto.VtsReportMessage.LogMessage.getDefaultInstance()); - } - /** - * <pre> - * Log for a test module. May contain multiple logs such as logcat, host log, - * etc. - * </pre> - * - * <code>repeated .android.vts.LogMessage log = 1001;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.LogMessage.Builder> - getLogBuilderList() { - return getLogFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.LogMessage, com.android.vts.proto.VtsReportMessage.LogMessage.Builder, com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder> - getLogFieldBuilder() { - if (logBuilder_ == null) { - logBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.LogMessage, com.android.vts.proto.VtsReportMessage.LogMessage.Builder, com.android.vts.proto.VtsReportMessage.LogMessageOrBuilder>( - log_, - ((bitField0_ & 0x00004000) == 0x00004000), - getParentForChildren(), - isClean()); - log_ = null; - } - return logBuilder_; - } - - private java.util.List<com.android.vts.proto.VtsReportMessage.UrlResourceMessage> linkResource_ = - java.util.Collections.emptyList(); - private void ensureLinkResourceIsMutable() { - if (!((bitField0_ & 0x00008000) == 0x00008000)) { - linkResource_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.UrlResourceMessage>(linkResource_); - bitField0_ |= 0x00008000; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.UrlResourceMessage, com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder, com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder> linkResourceBuilder_; - - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.UrlResourceMessage> getLinkResourceList() { - if (linkResourceBuilder_ == null) { - return java.util.Collections.unmodifiableList(linkResource_); - } else { - return linkResourceBuilder_.getMessageList(); - } - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public int getLinkResourceCount() { - if (linkResourceBuilder_ == null) { - return linkResource_.size(); - } else { - return linkResourceBuilder_.getCount(); - } - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public com.android.vts.proto.VtsReportMessage.UrlResourceMessage getLinkResource(int index) { - if (linkResourceBuilder_ == null) { - return linkResource_.get(index); - } else { - return linkResourceBuilder_.getMessage(index); - } - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public Builder setLinkResource( - int index, com.android.vts.proto.VtsReportMessage.UrlResourceMessage value) { - if (linkResourceBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureLinkResourceIsMutable(); - linkResource_.set(index, value); - onChanged(); - } else { - linkResourceBuilder_.setMessage(index, value); - } - return this; - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public Builder setLinkResource( - int index, com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder builderForValue) { - if (linkResourceBuilder_ == null) { - ensureLinkResourceIsMutable(); - linkResource_.set(index, builderForValue.build()); - onChanged(); - } else { - linkResourceBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public Builder addLinkResource(com.android.vts.proto.VtsReportMessage.UrlResourceMessage value) { - if (linkResourceBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureLinkResourceIsMutable(); - linkResource_.add(value); - onChanged(); - } else { - linkResourceBuilder_.addMessage(value); - } - return this; - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public Builder addLinkResource( - int index, com.android.vts.proto.VtsReportMessage.UrlResourceMessage value) { - if (linkResourceBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureLinkResourceIsMutable(); - linkResource_.add(index, value); - onChanged(); - } else { - linkResourceBuilder_.addMessage(index, value); - } - return this; - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public Builder addLinkResource( - com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder builderForValue) { - if (linkResourceBuilder_ == null) { - ensureLinkResourceIsMutable(); - linkResource_.add(builderForValue.build()); - onChanged(); - } else { - linkResourceBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public Builder addLinkResource( - int index, com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder builderForValue) { - if (linkResourceBuilder_ == null) { - ensureLinkResourceIsMutable(); - linkResource_.add(index, builderForValue.build()); - onChanged(); - } else { - linkResourceBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public Builder addAllLinkResource( - java.lang.Iterable<? extends com.android.vts.proto.VtsReportMessage.UrlResourceMessage> values) { - if (linkResourceBuilder_ == null) { - ensureLinkResourceIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, linkResource_); - onChanged(); - } else { - linkResourceBuilder_.addAllMessages(values); - } - return this; - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public Builder clearLinkResource() { - if (linkResourceBuilder_ == null) { - linkResource_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00008000); - onChanged(); - } else { - linkResourceBuilder_.clear(); - } - return this; - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public Builder removeLinkResource(int index) { - if (linkResourceBuilder_ == null) { - ensureLinkResourceIsMutable(); - linkResource_.remove(index); - onChanged(); - } else { - linkResourceBuilder_.remove(index); - } - return this; - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder getLinkResourceBuilder( - int index) { - return getLinkResourceFieldBuilder().getBuilder(index); - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder getLinkResourceOrBuilder( - int index) { - if (linkResourceBuilder_ == null) { - return linkResource_.get(index); } else { - return linkResourceBuilder_.getMessageOrBuilder(index); - } - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder> - getLinkResourceOrBuilderList() { - if (linkResourceBuilder_ != null) { - return linkResourceBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(linkResource_); - } - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder addLinkResourceBuilder() { - return getLinkResourceFieldBuilder().addBuilder( - com.android.vts.proto.VtsReportMessage.UrlResourceMessage.getDefaultInstance()); - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder addLinkResourceBuilder( - int index) { - return getLinkResourceFieldBuilder().addBuilder( - index, com.android.vts.proto.VtsReportMessage.UrlResourceMessage.getDefaultInstance()); - } - /** - * <pre> - * URL links for the test run. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage link_resource = 1011;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder> - getLinkResourceBuilderList() { - return getLinkResourceFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.UrlResourceMessage, com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder, com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder> - getLinkResourceFieldBuilder() { - if (linkResourceBuilder_ == null) { - linkResourceBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.UrlResourceMessage, com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder, com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder>( - linkResource_, - ((bitField0_ & 0x00008000) == 0x00008000), - getParentForChildren(), - isClean()); - linkResource_ = null; - } - return linkResourceBuilder_; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:android.vts.TestReportMessage) - } - - // @@protoc_insertion_point(class_scope:android.vts.TestReportMessage) - private static final com.android.vts.proto.VtsReportMessage.TestReportMessage DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.android.vts.proto.VtsReportMessage.TestReportMessage(); - } - - public static com.android.vts.proto.VtsReportMessage.TestReportMessage getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - @java.lang.Deprecated public static final com.google.protobuf.Parser<TestReportMessage> - PARSER = new com.google.protobuf.AbstractParser<TestReportMessage>() { - public TestReportMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new TestReportMessage(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser<TestReportMessage> parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser<TestReportMessage> getParserForType() { - return PARSER; - } - - public com.android.vts.proto.VtsReportMessage.TestReportMessage getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface TestPlanReportMessageOrBuilder extends - // @@protoc_insertion_point(interface_extends:android.vts.TestPlanReportMessage) - com.google.protobuf.MessageOrBuilder { - - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - java.util.List<java.lang.String> - getTestModuleNameList(); - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - int getTestModuleNameCount(); - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - java.lang.String getTestModuleName(int index); - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - com.google.protobuf.ByteString - getTestModuleNameBytes(int index); - - /** - * <code>repeated int64 test_module_start_timestamp = 12;</code> - */ - java.util.List<java.lang.Long> getTestModuleStartTimestampList(); - /** - * <code>repeated int64 test_module_start_timestamp = 12;</code> - */ - int getTestModuleStartTimestampCount(); - /** - * <code>repeated int64 test_module_start_timestamp = 12;</code> - */ - long getTestModuleStartTimestamp(int index); - - /** - * <pre> - * The test plan name. - * </pre> - * - * <code>optional string test_plan_name = 21;</code> - */ - boolean hasTestPlanName(); - /** - * <pre> - * The test plan name. - * </pre> - * - * <code>optional string test_plan_name = 21;</code> - */ - java.lang.String getTestPlanName(); - /** - * <pre> - * The test plan name. - * </pre> - * - * <code>optional string test_plan_name = 21;</code> - */ - com.google.protobuf.ByteString - getTestPlanNameBytes(); - - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - java.util.List<com.android.vts.proto.VtsReportMessage.UrlResourceMessage> - getPartnerReportList(); - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - com.android.vts.proto.VtsReportMessage.UrlResourceMessage getPartnerReport(int index); - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - int getPartnerReportCount(); - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - java.util.List<? extends com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder> - getPartnerReportOrBuilderList(); - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder getPartnerReportOrBuilder( - int index); - - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - java.util.List<com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage> - getHalApiReportList(); - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage getHalApiReport(int index); - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - int getHalApiReportCount(); - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - java.util.List<? extends com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder> - getHalApiReportOrBuilderList(); - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder getHalApiReportOrBuilder( - int index); - } - /** - * <pre> - * To specify a test execution report. - * </pre> - * - * Protobuf type {@code android.vts.TestPlanReportMessage} - */ - public static final class TestPlanReportMessage extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:android.vts.TestPlanReportMessage) - TestPlanReportMessageOrBuilder { - // Use TestPlanReportMessage.newBuilder() to construct. - private TestPlanReportMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { - super(builder); - } - private TestPlanReportMessage() { - testModuleName_ = com.google.protobuf.LazyStringArrayList.EMPTY; - testModuleStartTimestamp_ = java.util.Collections.emptyList(); - testPlanName_ = ""; - partnerReport_ = java.util.Collections.emptyList(); - halApiReport_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private TestPlanReportMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 90: { - com.google.protobuf.ByteString bs = input.readBytes(); - if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - testModuleName_ = new com.google.protobuf.LazyStringArrayList(); - mutable_bitField0_ |= 0x00000001; - } - testModuleName_.add(bs); - break; - } - case 96: { - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - testModuleStartTimestamp_ = new java.util.ArrayList<java.lang.Long>(); - mutable_bitField0_ |= 0x00000002; - } - testModuleStartTimestamp_.add(input.readInt64()); - break; - } - case 98: { - int length = input.readRawVarint32(); - int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002) && input.getBytesUntilLimit() > 0) { - testModuleStartTimestamp_ = new java.util.ArrayList<java.lang.Long>(); - mutable_bitField0_ |= 0x00000002; - } - while (input.getBytesUntilLimit() > 0) { - testModuleStartTimestamp_.add(input.readInt64()); - } - input.popLimit(limit); - break; - } - case 170: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - testPlanName_ = bs; - break; - } - case 250: { - if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - partnerReport_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.UrlResourceMessage>(); - mutable_bitField0_ |= 0x00000008; - } - partnerReport_.add( - input.readMessage(com.android.vts.proto.VtsReportMessage.UrlResourceMessage.PARSER, extensionRegistry)); - break; - } - case 330: { - if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) { - halApiReport_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage>(); - mutable_bitField0_ |= 0x00000010; - } - halApiReport_.add( - input.readMessage(com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.PARSER, extensionRegistry)); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - testModuleName_ = testModuleName_.getUnmodifiableView(); - } - if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - testModuleStartTimestamp_ = java.util.Collections.unmodifiableList(testModuleStartTimestamp_); - } - if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - partnerReport_ = java.util.Collections.unmodifiableList(partnerReport_); - } - if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { - halApiReport_ = java.util.Collections.unmodifiableList(halApiReport_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_TestPlanReportMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_TestPlanReportMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.class, com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.Builder.class); - } - - private int bitField0_; - public static final int TEST_MODULE_NAME_FIELD_NUMBER = 11; - private com.google.protobuf.LazyStringList testModuleName_; - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - public com.google.protobuf.ProtocolStringList - getTestModuleNameList() { - return testModuleName_; - } - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - public int getTestModuleNameCount() { - return testModuleName_.size(); - } - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - public java.lang.String getTestModuleName(int index) { - return testModuleName_.get(index); - } - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - public com.google.protobuf.ByteString - getTestModuleNameBytes(int index) { - return testModuleName_.getByteString(index); - } - - public static final int TEST_MODULE_START_TIMESTAMP_FIELD_NUMBER = 12; - private java.util.List<java.lang.Long> testModuleStartTimestamp_; - /** - * <code>repeated int64 test_module_start_timestamp = 12;</code> - */ - public java.util.List<java.lang.Long> - getTestModuleStartTimestampList() { - return testModuleStartTimestamp_; - } - /** - * <code>repeated int64 test_module_start_timestamp = 12;</code> - */ - public int getTestModuleStartTimestampCount() { - return testModuleStartTimestamp_.size(); - } - /** - * <code>repeated int64 test_module_start_timestamp = 12;</code> - */ - public long getTestModuleStartTimestamp(int index) { - return testModuleStartTimestamp_.get(index); - } - - public static final int TEST_PLAN_NAME_FIELD_NUMBER = 21; - private volatile java.lang.Object testPlanName_; - /** - * <pre> - * The test plan name. - * </pre> - * - * <code>optional string test_plan_name = 21;</code> - */ - public boolean hasTestPlanName() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * The test plan name. - * </pre> - * - * <code>optional string test_plan_name = 21;</code> - */ - public java.lang.String getTestPlanName() { - java.lang.Object ref = testPlanName_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - testPlanName_ = s; - } - return s; - } - } - /** - * <pre> - * The test plan name. - * </pre> - * - * <code>optional string test_plan_name = 21;</code> - */ - public com.google.protobuf.ByteString - getTestPlanNameBytes() { - java.lang.Object ref = testPlanName_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - testPlanName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int PARTNER_REPORT_FIELD_NUMBER = 31; - private java.util.List<com.android.vts.proto.VtsReportMessage.UrlResourceMessage> partnerReport_; - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.UrlResourceMessage> getPartnerReportList() { - return partnerReport_; - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder> - getPartnerReportOrBuilderList() { - return partnerReport_; - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public int getPartnerReportCount() { - return partnerReport_.size(); - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public com.android.vts.proto.VtsReportMessage.UrlResourceMessage getPartnerReport(int index) { - return partnerReport_.get(index); - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder getPartnerReportOrBuilder( - int index) { - return partnerReport_.get(index); - } - - public static final int HAL_API_REPORT_FIELD_NUMBER = 41; - private java.util.List<com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage> halApiReport_; - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage> getHalApiReportList() { - return halApiReport_; - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder> - getHalApiReportOrBuilderList() { - return halApiReport_; - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public int getHalApiReportCount() { - return halApiReport_.size(); - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage getHalApiReport(int index) { - return halApiReport_.get(index); - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder getHalApiReportOrBuilder( - int index) { - return halApiReport_.get(index); - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - for (int i = 0; i < testModuleName_.size(); i++) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 11, testModuleName_.getRaw(i)); - } - for (int i = 0; i < testModuleStartTimestamp_.size(); i++) { - output.writeInt64(12, testModuleStartTimestamp_.get(i)); - } - if (((bitField0_ & 0x00000001) == 0x00000001)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 21, testPlanName_); - } - for (int i = 0; i < partnerReport_.size(); i++) { - output.writeMessage(31, partnerReport_.get(i)); - } - for (int i = 0; i < halApiReport_.size(); i++) { - output.writeMessage(41, halApiReport_.get(i)); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - { - int dataSize = 0; - for (int i = 0; i < testModuleName_.size(); i++) { - dataSize += computeStringSizeNoTag(testModuleName_.getRaw(i)); - } - size += dataSize; - size += 1 * getTestModuleNameList().size(); - } - { - int dataSize = 0; - for (int i = 0; i < testModuleStartTimestamp_.size(); i++) { - dataSize += com.google.protobuf.CodedOutputStream - .computeInt64SizeNoTag(testModuleStartTimestamp_.get(i)); - } - size += dataSize; - size += 1 * getTestModuleStartTimestampList().size(); - } - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(21, testPlanName_); - } - for (int i = 0; i < partnerReport_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(31, partnerReport_.get(i)); - } - for (int i = 0; i < halApiReport_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(41, halApiReport_.get(i)); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.android.vts.proto.VtsReportMessage.TestPlanReportMessage)) { - return super.equals(obj); - } - com.android.vts.proto.VtsReportMessage.TestPlanReportMessage other = (com.android.vts.proto.VtsReportMessage.TestPlanReportMessage) obj; - - boolean result = true; - result = result && getTestModuleNameList() - .equals(other.getTestModuleNameList()); - result = result && getTestModuleStartTimestampList() - .equals(other.getTestModuleStartTimestampList()); - result = result && (hasTestPlanName() == other.hasTestPlanName()); - if (hasTestPlanName()) { - result = result && getTestPlanName() - .equals(other.getTestPlanName()); - } - result = result && getPartnerReportList() - .equals(other.getPartnerReportList()); - result = result && getHalApiReportList() - .equals(other.getHalApiReportList()); - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - if (getTestModuleNameCount() > 0) { - hash = (37 * hash) + TEST_MODULE_NAME_FIELD_NUMBER; - hash = (53 * hash) + getTestModuleNameList().hashCode(); - } - if (getTestModuleStartTimestampCount() > 0) { - hash = (37 * hash) + TEST_MODULE_START_TIMESTAMP_FIELD_NUMBER; - hash = (53 * hash) + getTestModuleStartTimestampList().hashCode(); - } - if (hasTestPlanName()) { - hash = (37 * hash) + TEST_PLAN_NAME_FIELD_NUMBER; - hash = (53 * hash) + getTestPlanName().hashCode(); - } - if (getPartnerReportCount() > 0) { - hash = (37 * hash) + PARTNER_REPORT_FIELD_NUMBER; - hash = (53 * hash) + getPartnerReportList().hashCode(); - } - if (getHalApiReportCount() > 0) { - hash = (37 * hash) + HAL_API_REPORT_FIELD_NUMBER; - hash = (53 * hash) + getHalApiReportList().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.android.vts.proto.VtsReportMessage.TestPlanReportMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.TestPlanReportMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.TestPlanReportMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.TestPlanReportMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.TestPlanReportMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.TestPlanReportMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.TestPlanReportMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.TestPlanReportMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.TestPlanReportMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.TestPlanReportMessage parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.android.vts.proto.VtsReportMessage.TestPlanReportMessage prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * <pre> - * To specify a test execution report. - * </pre> - * - * Protobuf type {@code android.vts.TestPlanReportMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements - // @@protoc_insertion_point(builder_implements:android.vts.TestPlanReportMessage) - com.android.vts.proto.VtsReportMessage.TestPlanReportMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_TestPlanReportMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_TestPlanReportMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.class, com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.Builder.class); - } - - // Construct using com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getPartnerReportFieldBuilder(); - getHalApiReportFieldBuilder(); - } - } - public Builder clear() { - super.clear(); - testModuleName_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - testModuleStartTimestamp_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - testPlanName_ = ""; - bitField0_ = (bitField0_ & ~0x00000004); - if (partnerReportBuilder_ == null) { - partnerReport_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - } else { - partnerReportBuilder_.clear(); - } - if (halApiReportBuilder_ == null) { - halApiReport_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); - } else { - halApiReportBuilder_.clear(); - } - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_TestPlanReportMessage_descriptor; - } - - public com.android.vts.proto.VtsReportMessage.TestPlanReportMessage getDefaultInstanceForType() { - return com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.getDefaultInstance(); - } - - public com.android.vts.proto.VtsReportMessage.TestPlanReportMessage build() { - com.android.vts.proto.VtsReportMessage.TestPlanReportMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.android.vts.proto.VtsReportMessage.TestPlanReportMessage buildPartial() { - com.android.vts.proto.VtsReportMessage.TestPlanReportMessage result = new com.android.vts.proto.VtsReportMessage.TestPlanReportMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - testModuleName_ = testModuleName_.getUnmodifiableView(); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.testModuleName_ = testModuleName_; - if (((bitField0_ & 0x00000002) == 0x00000002)) { - testModuleStartTimestamp_ = java.util.Collections.unmodifiableList(testModuleStartTimestamp_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.testModuleStartTimestamp_ = testModuleStartTimestamp_; - if (((from_bitField0_ & 0x00000004) == 0x00000004)) { - to_bitField0_ |= 0x00000001; - } - result.testPlanName_ = testPlanName_; - if (partnerReportBuilder_ == null) { - if (((bitField0_ & 0x00000008) == 0x00000008)) { - partnerReport_ = java.util.Collections.unmodifiableList(partnerReport_); - bitField0_ = (bitField0_ & ~0x00000008); - } - result.partnerReport_ = partnerReport_; - } else { - result.partnerReport_ = partnerReportBuilder_.build(); - } - if (halApiReportBuilder_ == null) { - if (((bitField0_ & 0x00000010) == 0x00000010)) { - halApiReport_ = java.util.Collections.unmodifiableList(halApiReport_); - bitField0_ = (bitField0_ & ~0x00000010); - } - result.halApiReport_ = halApiReport_; - } else { - result.halApiReport_ = halApiReportBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.android.vts.proto.VtsReportMessage.TestPlanReportMessage) { - return mergeFrom((com.android.vts.proto.VtsReportMessage.TestPlanReportMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.android.vts.proto.VtsReportMessage.TestPlanReportMessage other) { - if (other == com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.getDefaultInstance()) return this; - if (!other.testModuleName_.isEmpty()) { - if (testModuleName_.isEmpty()) { - testModuleName_ = other.testModuleName_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureTestModuleNameIsMutable(); - testModuleName_.addAll(other.testModuleName_); - } - onChanged(); - } - if (!other.testModuleStartTimestamp_.isEmpty()) { - if (testModuleStartTimestamp_.isEmpty()) { - testModuleStartTimestamp_ = other.testModuleStartTimestamp_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureTestModuleStartTimestampIsMutable(); - testModuleStartTimestamp_.addAll(other.testModuleStartTimestamp_); - } - onChanged(); - } - if (other.hasTestPlanName()) { - bitField0_ |= 0x00000004; - testPlanName_ = other.testPlanName_; - onChanged(); - } - if (partnerReportBuilder_ == null) { - if (!other.partnerReport_.isEmpty()) { - if (partnerReport_.isEmpty()) { - partnerReport_ = other.partnerReport_; - bitField0_ = (bitField0_ & ~0x00000008); - } else { - ensurePartnerReportIsMutable(); - partnerReport_.addAll(other.partnerReport_); - } - onChanged(); - } - } else { - if (!other.partnerReport_.isEmpty()) { - if (partnerReportBuilder_.isEmpty()) { - partnerReportBuilder_.dispose(); - partnerReportBuilder_ = null; - partnerReport_ = other.partnerReport_; - bitField0_ = (bitField0_ & ~0x00000008); - partnerReportBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getPartnerReportFieldBuilder() : null; - } else { - partnerReportBuilder_.addAllMessages(other.partnerReport_); - } - } - } - if (halApiReportBuilder_ == null) { - if (!other.halApiReport_.isEmpty()) { - if (halApiReport_.isEmpty()) { - halApiReport_ = other.halApiReport_; - bitField0_ = (bitField0_ & ~0x00000010); - } else { - ensureHalApiReportIsMutable(); - halApiReport_.addAll(other.halApiReport_); - } - onChanged(); - } - } else { - if (!other.halApiReport_.isEmpty()) { - if (halApiReportBuilder_.isEmpty()) { - halApiReportBuilder_.dispose(); - halApiReportBuilder_ = null; - halApiReport_ = other.halApiReport_; - bitField0_ = (bitField0_ & ~0x00000010); - halApiReportBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getHalApiReportFieldBuilder() : null; - } else { - halApiReportBuilder_.addAllMessages(other.halApiReport_); - } - } - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.android.vts.proto.VtsReportMessage.TestPlanReportMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.android.vts.proto.VtsReportMessage.TestPlanReportMessage) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private com.google.protobuf.LazyStringList testModuleName_ = com.google.protobuf.LazyStringArrayList.EMPTY; - private void ensureTestModuleNameIsMutable() { - if (!((bitField0_ & 0x00000001) == 0x00000001)) { - testModuleName_ = new com.google.protobuf.LazyStringArrayList(testModuleName_); - bitField0_ |= 0x00000001; - } - } - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - public com.google.protobuf.ProtocolStringList - getTestModuleNameList() { - return testModuleName_.getUnmodifiableView(); - } - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - public int getTestModuleNameCount() { - return testModuleName_.size(); - } - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - public java.lang.String getTestModuleName(int index) { - return testModuleName_.get(index); - } - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - public com.google.protobuf.ByteString - getTestModuleNameBytes(int index) { - return testModuleName_.getByteString(index); - } - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - public Builder setTestModuleName( - int index, java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureTestModuleNameIsMutable(); - testModuleName_.set(index, value); - onChanged(); - return this; - } - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - public Builder addTestModuleName( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureTestModuleNameIsMutable(); - testModuleName_.add(value); - onChanged(); - return this; - } - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - public Builder addAllTestModuleName( - java.lang.Iterable<java.lang.String> values) { - ensureTestModuleNameIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, testModuleName_); - onChanged(); - return this; - } - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - public Builder clearTestModuleName() { - testModuleName_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - return this; - } - /** - * <pre> - * Keys used to find all TestReportMessage messages of test modules in - * this plan. - * </pre> - * - * <code>repeated string test_module_name = 11;</code> - */ - public Builder addTestModuleNameBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - ensureTestModuleNameIsMutable(); - testModuleName_.add(value); - onChanged(); - return this; - } - - private java.util.List<java.lang.Long> testModuleStartTimestamp_ = java.util.Collections.emptyList(); - private void ensureTestModuleStartTimestampIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - testModuleStartTimestamp_ = new java.util.ArrayList<java.lang.Long>(testModuleStartTimestamp_); - bitField0_ |= 0x00000002; - } - } - /** - * <code>repeated int64 test_module_start_timestamp = 12;</code> - */ - public java.util.List<java.lang.Long> - getTestModuleStartTimestampList() { - return java.util.Collections.unmodifiableList(testModuleStartTimestamp_); - } - /** - * <code>repeated int64 test_module_start_timestamp = 12;</code> - */ - public int getTestModuleStartTimestampCount() { - return testModuleStartTimestamp_.size(); - } - /** - * <code>repeated int64 test_module_start_timestamp = 12;</code> - */ - public long getTestModuleStartTimestamp(int index) { - return testModuleStartTimestamp_.get(index); - } - /** - * <code>repeated int64 test_module_start_timestamp = 12;</code> - */ - public Builder setTestModuleStartTimestamp( - int index, long value) { - ensureTestModuleStartTimestampIsMutable(); - testModuleStartTimestamp_.set(index, value); - onChanged(); - return this; - } - /** - * <code>repeated int64 test_module_start_timestamp = 12;</code> - */ - public Builder addTestModuleStartTimestamp(long value) { - ensureTestModuleStartTimestampIsMutable(); - testModuleStartTimestamp_.add(value); - onChanged(); - return this; - } - /** - * <code>repeated int64 test_module_start_timestamp = 12;</code> - */ - public Builder addAllTestModuleStartTimestamp( - java.lang.Iterable<? extends java.lang.Long> values) { - ensureTestModuleStartTimestampIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, testModuleStartTimestamp_); - onChanged(); - return this; - } - /** - * <code>repeated int64 test_module_start_timestamp = 12;</code> - */ - public Builder clearTestModuleStartTimestamp() { - testModuleStartTimestamp_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - return this; - } - - private java.lang.Object testPlanName_ = ""; - /** - * <pre> - * The test plan name. - * </pre> - * - * <code>optional string test_plan_name = 21;</code> - */ - public boolean hasTestPlanName() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - /** - * <pre> - * The test plan name. - * </pre> - * - * <code>optional string test_plan_name = 21;</code> - */ - public java.lang.String getTestPlanName() { - java.lang.Object ref = testPlanName_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - testPlanName_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <pre> - * The test plan name. - * </pre> - * - * <code>optional string test_plan_name = 21;</code> - */ - public com.google.protobuf.ByteString - getTestPlanNameBytes() { - java.lang.Object ref = testPlanName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - testPlanName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <pre> - * The test plan name. - * </pre> - * - * <code>optional string test_plan_name = 21;</code> - */ - public Builder setTestPlanName( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - testPlanName_ = value; - onChanged(); - return this; - } - /** - * <pre> - * The test plan name. - * </pre> - * - * <code>optional string test_plan_name = 21;</code> - */ - public Builder clearTestPlanName() { - bitField0_ = (bitField0_ & ~0x00000004); - testPlanName_ = getDefaultInstance().getTestPlanName(); - onChanged(); - return this; - } - /** - * <pre> - * The test plan name. - * </pre> - * - * <code>optional string test_plan_name = 21;</code> - */ - public Builder setTestPlanNameBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - testPlanName_ = value; - onChanged(); - return this; - } - - private java.util.List<com.android.vts.proto.VtsReportMessage.UrlResourceMessage> partnerReport_ = - java.util.Collections.emptyList(); - private void ensurePartnerReportIsMutable() { - if (!((bitField0_ & 0x00000008) == 0x00000008)) { - partnerReport_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.UrlResourceMessage>(partnerReport_); - bitField0_ |= 0x00000008; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.UrlResourceMessage, com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder, com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder> partnerReportBuilder_; - - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.UrlResourceMessage> getPartnerReportList() { - if (partnerReportBuilder_ == null) { - return java.util.Collections.unmodifiableList(partnerReport_); - } else { - return partnerReportBuilder_.getMessageList(); - } - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public int getPartnerReportCount() { - if (partnerReportBuilder_ == null) { - return partnerReport_.size(); - } else { - return partnerReportBuilder_.getCount(); - } - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public com.android.vts.proto.VtsReportMessage.UrlResourceMessage getPartnerReport(int index) { - if (partnerReportBuilder_ == null) { - return partnerReport_.get(index); - } else { - return partnerReportBuilder_.getMessage(index); - } - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public Builder setPartnerReport( - int index, com.android.vts.proto.VtsReportMessage.UrlResourceMessage value) { - if (partnerReportBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePartnerReportIsMutable(); - partnerReport_.set(index, value); - onChanged(); - } else { - partnerReportBuilder_.setMessage(index, value); - } - return this; - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public Builder setPartnerReport( - int index, com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder builderForValue) { - if (partnerReportBuilder_ == null) { - ensurePartnerReportIsMutable(); - partnerReport_.set(index, builderForValue.build()); - onChanged(); - } else { - partnerReportBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public Builder addPartnerReport(com.android.vts.proto.VtsReportMessage.UrlResourceMessage value) { - if (partnerReportBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePartnerReportIsMutable(); - partnerReport_.add(value); - onChanged(); - } else { - partnerReportBuilder_.addMessage(value); - } - return this; - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public Builder addPartnerReport( - int index, com.android.vts.proto.VtsReportMessage.UrlResourceMessage value) { - if (partnerReportBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensurePartnerReportIsMutable(); - partnerReport_.add(index, value); - onChanged(); - } else { - partnerReportBuilder_.addMessage(index, value); - } - return this; - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public Builder addPartnerReport( - com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder builderForValue) { - if (partnerReportBuilder_ == null) { - ensurePartnerReportIsMutable(); - partnerReport_.add(builderForValue.build()); - onChanged(); - } else { - partnerReportBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public Builder addPartnerReport( - int index, com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder builderForValue) { - if (partnerReportBuilder_ == null) { - ensurePartnerReportIsMutable(); - partnerReport_.add(index, builderForValue.build()); - onChanged(); - } else { - partnerReportBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public Builder addAllPartnerReport( - java.lang.Iterable<? extends com.android.vts.proto.VtsReportMessage.UrlResourceMessage> values) { - if (partnerReportBuilder_ == null) { - ensurePartnerReportIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, partnerReport_); - onChanged(); - } else { - partnerReportBuilder_.addAllMessages(values); - } - return this; - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public Builder clearPartnerReport() { - if (partnerReportBuilder_ == null) { - partnerReport_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - onChanged(); - } else { - partnerReportBuilder_.clear(); - } - return this; - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public Builder removePartnerReport(int index) { - if (partnerReportBuilder_ == null) { - ensurePartnerReportIsMutable(); - partnerReport_.remove(index); - onChanged(); - } else { - partnerReportBuilder_.remove(index); - } - return this; - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder getPartnerReportBuilder( - int index) { - return getPartnerReportFieldBuilder().getBuilder(index); - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder getPartnerReportOrBuilder( - int index) { - if (partnerReportBuilder_ == null) { - return partnerReport_.get(index); } else { - return partnerReportBuilder_.getMessageOrBuilder(index); - } - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder> - getPartnerReportOrBuilderList() { - if (partnerReportBuilder_ != null) { - return partnerReportBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(partnerReport_); - } - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder addPartnerReportBuilder() { - return getPartnerReportFieldBuilder().addBuilder( - com.android.vts.proto.VtsReportMessage.UrlResourceMessage.getDefaultInstance()); - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder addPartnerReportBuilder( - int index) { - return getPartnerReportFieldBuilder().addBuilder( - index, com.android.vts.proto.VtsReportMessage.UrlResourceMessage.getDefaultInstance()); - } - /** - * <pre> - * Report resource flies. - * </pre> - * - * <code>repeated .android.vts.UrlResourceMessage partner_report = 31;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder> - getPartnerReportBuilderList() { - return getPartnerReportFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.UrlResourceMessage, com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder, com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder> - getPartnerReportFieldBuilder() { - if (partnerReportBuilder_ == null) { - partnerReportBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.UrlResourceMessage, com.android.vts.proto.VtsReportMessage.UrlResourceMessage.Builder, com.android.vts.proto.VtsReportMessage.UrlResourceMessageOrBuilder>( - partnerReport_, - ((bitField0_ & 0x00000008) == 0x00000008), - getParentForChildren(), - isClean()); - partnerReport_ = null; - } - return partnerReportBuilder_; - } - - private java.util.List<com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage> halApiReport_ = - java.util.Collections.emptyList(); - private void ensureHalApiReportIsMutable() { - if (!((bitField0_ & 0x00000010) == 0x00000010)) { - halApiReport_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage>(halApiReport_); - bitField0_ |= 0x00000010; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder> halApiReportBuilder_; - - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage> getHalApiReportList() { - if (halApiReportBuilder_ == null) { - return java.util.Collections.unmodifiableList(halApiReport_); - } else { - return halApiReportBuilder_.getMessageList(); - } - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public int getHalApiReportCount() { - if (halApiReportBuilder_ == null) { - return halApiReport_.size(); - } else { - return halApiReportBuilder_.getCount(); - } - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage getHalApiReport(int index) { - if (halApiReportBuilder_ == null) { - return halApiReport_.get(index); - } else { - return halApiReportBuilder_.getMessage(index); - } - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public Builder setHalApiReport( - int index, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage value) { - if (halApiReportBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureHalApiReportIsMutable(); - halApiReport_.set(index, value); - onChanged(); - } else { - halApiReportBuilder_.setMessage(index, value); - } - return this; - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public Builder setHalApiReport( - int index, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder builderForValue) { - if (halApiReportBuilder_ == null) { - ensureHalApiReportIsMutable(); - halApiReport_.set(index, builderForValue.build()); - onChanged(); - } else { - halApiReportBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public Builder addHalApiReport(com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage value) { - if (halApiReportBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureHalApiReportIsMutable(); - halApiReport_.add(value); - onChanged(); - } else { - halApiReportBuilder_.addMessage(value); - } - return this; - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public Builder addHalApiReport( - int index, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage value) { - if (halApiReportBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureHalApiReportIsMutable(); - halApiReport_.add(index, value); - onChanged(); - } else { - halApiReportBuilder_.addMessage(index, value); - } - return this; - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public Builder addHalApiReport( - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder builderForValue) { - if (halApiReportBuilder_ == null) { - ensureHalApiReportIsMutable(); - halApiReport_.add(builderForValue.build()); - onChanged(); - } else { - halApiReportBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public Builder addHalApiReport( - int index, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder builderForValue) { - if (halApiReportBuilder_ == null) { - ensureHalApiReportIsMutable(); - halApiReport_.add(index, builderForValue.build()); - onChanged(); - } else { - halApiReportBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public Builder addAllHalApiReport( - java.lang.Iterable<? extends com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage> values) { - if (halApiReportBuilder_ == null) { - ensureHalApiReportIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, halApiReport_); - onChanged(); - } else { - halApiReportBuilder_.addAllMessages(values); - } - return this; - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public Builder clearHalApiReport() { - if (halApiReportBuilder_ == null) { - halApiReport_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); - onChanged(); - } else { - halApiReportBuilder_.clear(); - } - return this; - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public Builder removeHalApiReport(int index) { - if (halApiReportBuilder_ == null) { - ensureHalApiReportIsMutable(); - halApiReport_.remove(index); - onChanged(); - } else { - halApiReportBuilder_.remove(index); - } - return this; - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder getHalApiReportBuilder( - int index) { - return getHalApiReportFieldBuilder().getBuilder(index); - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder getHalApiReportOrBuilder( - int index) { - if (halApiReportBuilder_ == null) { - return halApiReport_.get(index); } else { - return halApiReportBuilder_.getMessageOrBuilder(index); - } - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder> - getHalApiReportOrBuilderList() { - if (halApiReportBuilder_ != null) { - return halApiReportBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(halApiReport_); - } - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder addHalApiReportBuilder() { - return getHalApiReportFieldBuilder().addBuilder( - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.getDefaultInstance()); - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder addHalApiReportBuilder( - int index) { - return getHalApiReportFieldBuilder().addBuilder( - index, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.getDefaultInstance()); - } - /** - * <pre> - * Available HAL APIs for coverage measurement. - * Only used for profiling test plan. - * </pre> - * - * <code>repeated .android.vts.ApiCoverageReportMessage hal_api_report = 41;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder> - getHalApiReportBuilderList() { - return getHalApiReportFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder> - getHalApiReportFieldBuilder() { - if (halApiReportBuilder_ == null) { - halApiReportBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage.Builder, com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessageOrBuilder>( - halApiReport_, - ((bitField0_ & 0x00000010) == 0x00000010), - getParentForChildren(), - isClean()); - halApiReport_ = null; - } - return halApiReportBuilder_; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:android.vts.TestPlanReportMessage) - } - - // @@protoc_insertion_point(class_scope:android.vts.TestPlanReportMessage) - private static final com.android.vts.proto.VtsReportMessage.TestPlanReportMessage DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.android.vts.proto.VtsReportMessage.TestPlanReportMessage(); - } - - public static com.android.vts.proto.VtsReportMessage.TestPlanReportMessage getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - @java.lang.Deprecated public static final com.google.protobuf.Parser<TestPlanReportMessage> - PARSER = new com.google.protobuf.AbstractParser<TestPlanReportMessage>() { - public TestPlanReportMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new TestPlanReportMessage(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser<TestPlanReportMessage> parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser<TestPlanReportMessage> getParserForType() { - return PARSER; - } - - public com.android.vts.proto.VtsReportMessage.TestPlanReportMessage getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - public interface DashboardPostMessageOrBuilder extends - // @@protoc_insertion_point(interface_extends:android.vts.DashboardPostMessage) - com.google.protobuf.MessageOrBuilder { - - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - boolean hasAccessToken(); - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - java.lang.String getAccessToken(); - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - com.google.protobuf.ByteString - getAccessTokenBytes(); - - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - java.util.List<com.android.vts.proto.VtsReportMessage.TestReportMessage> - getTestReportList(); - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - com.android.vts.proto.VtsReportMessage.TestReportMessage getTestReport(int index); - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - int getTestReportCount(); - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - java.util.List<? extends com.android.vts.proto.VtsReportMessage.TestReportMessageOrBuilder> - getTestReportOrBuilderList(); - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - com.android.vts.proto.VtsReportMessage.TestReportMessageOrBuilder getTestReportOrBuilder( - int index); - - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - java.util.List<com.android.vts.proto.VtsReportMessage.TestPlanReportMessage> - getTestPlanReportList(); - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - com.android.vts.proto.VtsReportMessage.TestPlanReportMessage getTestPlanReport(int index); - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - int getTestPlanReportCount(); - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - java.util.List<? extends com.android.vts.proto.VtsReportMessage.TestPlanReportMessageOrBuilder> - getTestPlanReportOrBuilderList(); - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - com.android.vts.proto.VtsReportMessage.TestPlanReportMessageOrBuilder getTestPlanReportOrBuilder( - int index); - } - /** - * <pre> - * Proto wrapper for posting data to the VTS Dashboard - * </pre> - * - * Protobuf type {@code android.vts.DashboardPostMessage} - */ - public static final class DashboardPostMessage extends - com.google.protobuf.GeneratedMessageV3 implements - // @@protoc_insertion_point(message_implements:android.vts.DashboardPostMessage) - DashboardPostMessageOrBuilder { - // Use DashboardPostMessage.newBuilder() to construct. - private DashboardPostMessage(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { - super(builder); - } - private DashboardPostMessage() { - accessToken_ = ""; - testReport_ = java.util.Collections.emptyList(); - testPlanReport_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private DashboardPostMessage( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - this(); - int mutable_bitField0_ = 0; - com.google.protobuf.UnknownFieldSet.Builder unknownFields = - com.google.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); - bitField0_ |= 0x00000001; - accessToken_ = bs; - break; - } - case 18: { - if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - testReport_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.TestReportMessage>(); - mutable_bitField0_ |= 0x00000002; - } - testReport_.add( - input.readMessage(com.android.vts.proto.VtsReportMessage.TestReportMessage.PARSER, extensionRegistry)); - break; - } - case 26: { - if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - testPlanReport_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.TestPlanReportMessage>(); - mutable_bitField0_ |= 0x00000004; - } - testPlanReport_.add( - input.readMessage(com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.PARSER, extensionRegistry)); - break; - } - } - } - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException( - e).setUnfinishedMessage(this); - } finally { - if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - testReport_ = java.util.Collections.unmodifiableList(testReport_); - } - if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - testPlanReport_ = java.util.Collections.unmodifiableList(testPlanReport_); - } - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_DashboardPostMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_DashboardPostMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.DashboardPostMessage.class, com.android.vts.proto.VtsReportMessage.DashboardPostMessage.Builder.class); - } - - private int bitField0_; - public static final int ACCESS_TOKEN_FIELD_NUMBER = 1; - private volatile java.lang.Object accessToken_; - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public boolean hasAccessToken() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public java.lang.String getAccessToken() { - java.lang.Object ref = accessToken_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - accessToken_ = s; - } - return s; - } - } - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public com.google.protobuf.ByteString - getAccessTokenBytes() { - java.lang.Object ref = accessToken_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - accessToken_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int TEST_REPORT_FIELD_NUMBER = 2; - private java.util.List<com.android.vts.proto.VtsReportMessage.TestReportMessage> testReport_; - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.TestReportMessage> getTestReportList() { - return testReport_; - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.TestReportMessageOrBuilder> - getTestReportOrBuilderList() { - return testReport_; - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public int getTestReportCount() { - return testReport_.size(); - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestReportMessage getTestReport(int index) { - return testReport_.get(index); - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestReportMessageOrBuilder getTestReportOrBuilder( - int index) { - return testReport_.get(index); - } - - public static final int TEST_PLAN_REPORT_FIELD_NUMBER = 3; - private java.util.List<com.android.vts.proto.VtsReportMessage.TestPlanReportMessage> testPlanReport_; - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.TestPlanReportMessage> getTestPlanReportList() { - return testPlanReport_; - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.TestPlanReportMessageOrBuilder> - getTestPlanReportOrBuilderList() { - return testPlanReport_; - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public int getTestPlanReportCount() { - return testPlanReport_.size(); - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestPlanReportMessage getTestPlanReport(int index) { - return testPlanReport_.get(index); - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestPlanReportMessageOrBuilder getTestPlanReportOrBuilder( - int index) { - return testPlanReport_.get(index); - } - - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - if (((bitField0_ & 0x00000001) == 0x00000001)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, accessToken_); - } - for (int i = 0; i < testReport_.size(); i++) { - output.writeMessage(2, testReport_.get(i)); - } - for (int i = 0; i < testPlanReport_.size(); i++) { - output.writeMessage(3, testPlanReport_.get(i)); - } - unknownFields.writeTo(output); - } - - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (((bitField0_ & 0x00000001) == 0x00000001)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, accessToken_); - } - for (int i = 0; i < testReport_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, testReport_.get(i)); - } - for (int i = 0; i < testPlanReport_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, testPlanReport_.get(i)); - } - size += unknownFields.getSerializedSize(); - memoizedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.android.vts.proto.VtsReportMessage.DashboardPostMessage)) { - return super.equals(obj); - } - com.android.vts.proto.VtsReportMessage.DashboardPostMessage other = (com.android.vts.proto.VtsReportMessage.DashboardPostMessage) obj; - - boolean result = true; - result = result && (hasAccessToken() == other.hasAccessToken()); - if (hasAccessToken()) { - result = result && getAccessToken() - .equals(other.getAccessToken()); - } - result = result && getTestReportList() - .equals(other.getTestReportList()); - result = result && getTestPlanReportList() - .equals(other.getTestPlanReportList()); - result = result && unknownFields.equals(other.unknownFields); - return result; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptorForType().hashCode(); - if (hasAccessToken()) { - hash = (37 * hash) + ACCESS_TOKEN_FIELD_NUMBER; - hash = (53 * hash) + getAccessToken().hashCode(); - } - if (getTestReportCount() > 0) { - hash = (37 * hash) + TEST_REPORT_FIELD_NUMBER; - hash = (53 * hash) + getTestReportList().hashCode(); - } - if (getTestPlanReportCount() > 0) { - hash = (37 * hash) + TEST_PLAN_REPORT_FIELD_NUMBER; - hash = (53 * hash) + getTestPlanReportList().hashCode(); - } - hash = (29 * hash) + unknownFields.hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.android.vts.proto.VtsReportMessage.DashboardPostMessage parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.DashboardPostMessage parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.DashboardPostMessage parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - public static com.android.vts.proto.VtsReportMessage.DashboardPostMessage parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.DashboardPostMessage parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.DashboardPostMessage parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.DashboardPostMessage parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.DashboardPostMessage parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseDelimitedWithIOException(PARSER, input, extensionRegistry); - } - public static com.android.vts.proto.VtsReportMessage.DashboardPostMessage parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input); - } - public static com.android.vts.proto.VtsReportMessage.DashboardPostMessage parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3 - .parseWithIOException(PARSER, input, extensionRegistry); - } - - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder() { - return DEFAULT_INSTANCE.toBuilder(); - } - public static Builder newBuilder(com.android.vts.proto.VtsReportMessage.DashboardPostMessage prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { - return this == DEFAULT_INSTANCE - ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * <pre> - * Proto wrapper for posting data to the VTS Dashboard - * </pre> - * - * Protobuf type {@code android.vts.DashboardPostMessage} - */ - public static final class Builder extends - com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements - // @@protoc_insertion_point(builder_implements:android.vts.DashboardPostMessage) - com.android.vts.proto.VtsReportMessage.DashboardPostMessageOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_DashboardPostMessage_descriptor; - } - - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_DashboardPostMessage_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.android.vts.proto.VtsReportMessage.DashboardPostMessage.class, com.android.vts.proto.VtsReportMessage.DashboardPostMessage.Builder.class); - } - - // Construct using com.android.vts.proto.VtsReportMessage.DashboardPostMessage.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private Builder( - com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - maybeForceBuilderInitialization(); - } - private void maybeForceBuilderInitialization() { - if (com.google.protobuf.GeneratedMessageV3 - .alwaysUseFieldBuilders) { - getTestReportFieldBuilder(); - getTestPlanReportFieldBuilder(); - } - } - public Builder clear() { - super.clear(); - accessToken_ = ""; - bitField0_ = (bitField0_ & ~0x00000001); - if (testReportBuilder_ == null) { - testReport_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - } else { - testReportBuilder_.clear(); - } - if (testPlanReportBuilder_ == null) { - testPlanReport_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - } else { - testPlanReportBuilder_.clear(); - } - return this; - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return com.android.vts.proto.VtsReportMessage.internal_static_android_vts_DashboardPostMessage_descriptor; - } - - public com.android.vts.proto.VtsReportMessage.DashboardPostMessage getDefaultInstanceForType() { - return com.android.vts.proto.VtsReportMessage.DashboardPostMessage.getDefaultInstance(); - } - - public com.android.vts.proto.VtsReportMessage.DashboardPostMessage build() { - com.android.vts.proto.VtsReportMessage.DashboardPostMessage result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - public com.android.vts.proto.VtsReportMessage.DashboardPostMessage buildPartial() { - com.android.vts.proto.VtsReportMessage.DashboardPostMessage result = new com.android.vts.proto.VtsReportMessage.DashboardPostMessage(this); - int from_bitField0_ = bitField0_; - int to_bitField0_ = 0; - if (((from_bitField0_ & 0x00000001) == 0x00000001)) { - to_bitField0_ |= 0x00000001; - } - result.accessToken_ = accessToken_; - if (testReportBuilder_ == null) { - if (((bitField0_ & 0x00000002) == 0x00000002)) { - testReport_ = java.util.Collections.unmodifiableList(testReport_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.testReport_ = testReport_; - } else { - result.testReport_ = testReportBuilder_.build(); - } - if (testPlanReportBuilder_ == null) { - if (((bitField0_ & 0x00000004) == 0x00000004)) { - testPlanReport_ = java.util.Collections.unmodifiableList(testPlanReport_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.testPlanReport_ = testPlanReport_; - } else { - result.testPlanReport_ = testPlanReportBuilder_.build(); - } - result.bitField0_ = to_bitField0_; - onBuilt(); - return result; - } - - public Builder clone() { - return (Builder) super.clone(); - } - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.setField(field, value); - } - public Builder clearField( - com.google.protobuf.Descriptors.FieldDescriptor field) { - return (Builder) super.clearField(field); - } - public Builder clearOneof( - com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return (Builder) super.clearOneof(oneof); - } - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - int index, Object value) { - return (Builder) super.setRepeatedField(field, index, value); - } - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, - Object value) { - return (Builder) super.addRepeatedField(field, value); - } - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.android.vts.proto.VtsReportMessage.DashboardPostMessage) { - return mergeFrom((com.android.vts.proto.VtsReportMessage.DashboardPostMessage)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.android.vts.proto.VtsReportMessage.DashboardPostMessage other) { - if (other == com.android.vts.proto.VtsReportMessage.DashboardPostMessage.getDefaultInstance()) return this; - if (other.hasAccessToken()) { - bitField0_ |= 0x00000001; - accessToken_ = other.accessToken_; - onChanged(); - } - if (testReportBuilder_ == null) { - if (!other.testReport_.isEmpty()) { - if (testReport_.isEmpty()) { - testReport_ = other.testReport_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureTestReportIsMutable(); - testReport_.addAll(other.testReport_); - } - onChanged(); - } - } else { - if (!other.testReport_.isEmpty()) { - if (testReportBuilder_.isEmpty()) { - testReportBuilder_.dispose(); - testReportBuilder_ = null; - testReport_ = other.testReport_; - bitField0_ = (bitField0_ & ~0x00000002); - testReportBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getTestReportFieldBuilder() : null; - } else { - testReportBuilder_.addAllMessages(other.testReport_); - } - } - } - if (testPlanReportBuilder_ == null) { - if (!other.testPlanReport_.isEmpty()) { - if (testPlanReport_.isEmpty()) { - testPlanReport_ = other.testPlanReport_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureTestPlanReportIsMutable(); - testPlanReport_.addAll(other.testPlanReport_); - } - onChanged(); - } - } else { - if (!other.testPlanReport_.isEmpty()) { - if (testPlanReportBuilder_.isEmpty()) { - testPlanReportBuilder_.dispose(); - testPlanReportBuilder_ = null; - testPlanReport_ = other.testPlanReport_; - bitField0_ = (bitField0_ & ~0x00000004); - testPlanReportBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? - getTestPlanReportFieldBuilder() : null; - } else { - testPlanReportBuilder_.addAllMessages(other.testPlanReport_); - } - } - } - this.mergeUnknownFields(other.unknownFields); - onChanged(); - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - com.android.vts.proto.VtsReportMessage.DashboardPostMessage parsedMessage = null; - try { - parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (com.android.vts.proto.VtsReportMessage.DashboardPostMessage) e.getUnfinishedMessage(); - throw e.unwrapIOException(); - } finally { - if (parsedMessage != null) { - mergeFrom(parsedMessage); - } - } - return this; - } - private int bitField0_; - - private java.lang.Object accessToken_ = ""; - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public boolean hasAccessToken() { - return ((bitField0_ & 0x00000001) == 0x00000001); - } - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public java.lang.String getAccessToken() { - java.lang.Object ref = accessToken_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - accessToken_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public com.google.protobuf.ByteString - getAccessTokenBytes() { - java.lang.Object ref = accessToken_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8( - (java.lang.String) ref); - accessToken_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public Builder setAccessToken( - java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - accessToken_ = value; - onChanged(); - return this; - } - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public Builder clearAccessToken() { - bitField0_ = (bitField0_ & ~0x00000001); - accessToken_ = getDefaultInstance().getAccessToken(); - onChanged(); - return this; - } - /** - * <pre> - * oauth2.0 access token - * </pre> - * - * <code>optional string access_token = 1;</code> - */ - public Builder setAccessTokenBytes( - com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000001; - accessToken_ = value; - onChanged(); - return this; - } - - private java.util.List<com.android.vts.proto.VtsReportMessage.TestReportMessage> testReport_ = - java.util.Collections.emptyList(); - private void ensureTestReportIsMutable() { - if (!((bitField0_ & 0x00000002) == 0x00000002)) { - testReport_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.TestReportMessage>(testReport_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.TestReportMessage, com.android.vts.proto.VtsReportMessage.TestReportMessage.Builder, com.android.vts.proto.VtsReportMessage.TestReportMessageOrBuilder> testReportBuilder_; - - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.TestReportMessage> getTestReportList() { - if (testReportBuilder_ == null) { - return java.util.Collections.unmodifiableList(testReport_); - } else { - return testReportBuilder_.getMessageList(); - } - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public int getTestReportCount() { - if (testReportBuilder_ == null) { - return testReport_.size(); - } else { - return testReportBuilder_.getCount(); - } - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestReportMessage getTestReport(int index) { - if (testReportBuilder_ == null) { - return testReport_.get(index); - } else { - return testReportBuilder_.getMessage(index); - } - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public Builder setTestReport( - int index, com.android.vts.proto.VtsReportMessage.TestReportMessage value) { - if (testReportBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTestReportIsMutable(); - testReport_.set(index, value); - onChanged(); - } else { - testReportBuilder_.setMessage(index, value); - } - return this; - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public Builder setTestReport( - int index, com.android.vts.proto.VtsReportMessage.TestReportMessage.Builder builderForValue) { - if (testReportBuilder_ == null) { - ensureTestReportIsMutable(); - testReport_.set(index, builderForValue.build()); - onChanged(); - } else { - testReportBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public Builder addTestReport(com.android.vts.proto.VtsReportMessage.TestReportMessage value) { - if (testReportBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTestReportIsMutable(); - testReport_.add(value); - onChanged(); - } else { - testReportBuilder_.addMessage(value); - } - return this; - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public Builder addTestReport( - int index, com.android.vts.proto.VtsReportMessage.TestReportMessage value) { - if (testReportBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTestReportIsMutable(); - testReport_.add(index, value); - onChanged(); - } else { - testReportBuilder_.addMessage(index, value); - } - return this; - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public Builder addTestReport( - com.android.vts.proto.VtsReportMessage.TestReportMessage.Builder builderForValue) { - if (testReportBuilder_ == null) { - ensureTestReportIsMutable(); - testReport_.add(builderForValue.build()); - onChanged(); - } else { - testReportBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public Builder addTestReport( - int index, com.android.vts.proto.VtsReportMessage.TestReportMessage.Builder builderForValue) { - if (testReportBuilder_ == null) { - ensureTestReportIsMutable(); - testReport_.add(index, builderForValue.build()); - onChanged(); - } else { - testReportBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public Builder addAllTestReport( - java.lang.Iterable<? extends com.android.vts.proto.VtsReportMessage.TestReportMessage> values) { - if (testReportBuilder_ == null) { - ensureTestReportIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, testReport_); - onChanged(); - } else { - testReportBuilder_.addAllMessages(values); - } - return this; - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public Builder clearTestReport() { - if (testReportBuilder_ == null) { - testReport_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - testReportBuilder_.clear(); - } - return this; - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public Builder removeTestReport(int index) { - if (testReportBuilder_ == null) { - ensureTestReportIsMutable(); - testReport_.remove(index); - onChanged(); - } else { - testReportBuilder_.remove(index); - } - return this; - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestReportMessage.Builder getTestReportBuilder( - int index) { - return getTestReportFieldBuilder().getBuilder(index); - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestReportMessageOrBuilder getTestReportOrBuilder( - int index) { - if (testReportBuilder_ == null) { - return testReport_.get(index); } else { - return testReportBuilder_.getMessageOrBuilder(index); - } - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.TestReportMessageOrBuilder> - getTestReportOrBuilderList() { - if (testReportBuilder_ != null) { - return testReportBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(testReport_); - } - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestReportMessage.Builder addTestReportBuilder() { - return getTestReportFieldBuilder().addBuilder( - com.android.vts.proto.VtsReportMessage.TestReportMessage.getDefaultInstance()); - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestReportMessage.Builder addTestReportBuilder( - int index) { - return getTestReportFieldBuilder().addBuilder( - index, com.android.vts.proto.VtsReportMessage.TestReportMessage.getDefaultInstance()); - } - /** - * <code>repeated .android.vts.TestReportMessage test_report = 2;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.TestReportMessage.Builder> - getTestReportBuilderList() { - return getTestReportFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.TestReportMessage, com.android.vts.proto.VtsReportMessage.TestReportMessage.Builder, com.android.vts.proto.VtsReportMessage.TestReportMessageOrBuilder> - getTestReportFieldBuilder() { - if (testReportBuilder_ == null) { - testReportBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.TestReportMessage, com.android.vts.proto.VtsReportMessage.TestReportMessage.Builder, com.android.vts.proto.VtsReportMessage.TestReportMessageOrBuilder>( - testReport_, - ((bitField0_ & 0x00000002) == 0x00000002), - getParentForChildren(), - isClean()); - testReport_ = null; - } - return testReportBuilder_; - } - - private java.util.List<com.android.vts.proto.VtsReportMessage.TestPlanReportMessage> testPlanReport_ = - java.util.Collections.emptyList(); - private void ensureTestPlanReportIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - testPlanReport_ = new java.util.ArrayList<com.android.vts.proto.VtsReportMessage.TestPlanReportMessage>(testPlanReport_); - bitField0_ |= 0x00000004; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.TestPlanReportMessage, com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.Builder, com.android.vts.proto.VtsReportMessage.TestPlanReportMessageOrBuilder> testPlanReportBuilder_; - - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.TestPlanReportMessage> getTestPlanReportList() { - if (testPlanReportBuilder_ == null) { - return java.util.Collections.unmodifiableList(testPlanReport_); - } else { - return testPlanReportBuilder_.getMessageList(); - } - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public int getTestPlanReportCount() { - if (testPlanReportBuilder_ == null) { - return testPlanReport_.size(); - } else { - return testPlanReportBuilder_.getCount(); - } - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestPlanReportMessage getTestPlanReport(int index) { - if (testPlanReportBuilder_ == null) { - return testPlanReport_.get(index); - } else { - return testPlanReportBuilder_.getMessage(index); - } - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public Builder setTestPlanReport( - int index, com.android.vts.proto.VtsReportMessage.TestPlanReportMessage value) { - if (testPlanReportBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTestPlanReportIsMutable(); - testPlanReport_.set(index, value); - onChanged(); - } else { - testPlanReportBuilder_.setMessage(index, value); - } - return this; - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public Builder setTestPlanReport( - int index, com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.Builder builderForValue) { - if (testPlanReportBuilder_ == null) { - ensureTestPlanReportIsMutable(); - testPlanReport_.set(index, builderForValue.build()); - onChanged(); - } else { - testPlanReportBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public Builder addTestPlanReport(com.android.vts.proto.VtsReportMessage.TestPlanReportMessage value) { - if (testPlanReportBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTestPlanReportIsMutable(); - testPlanReport_.add(value); - onChanged(); - } else { - testPlanReportBuilder_.addMessage(value); - } - return this; - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public Builder addTestPlanReport( - int index, com.android.vts.proto.VtsReportMessage.TestPlanReportMessage value) { - if (testPlanReportBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureTestPlanReportIsMutable(); - testPlanReport_.add(index, value); - onChanged(); - } else { - testPlanReportBuilder_.addMessage(index, value); - } - return this; - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public Builder addTestPlanReport( - com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.Builder builderForValue) { - if (testPlanReportBuilder_ == null) { - ensureTestPlanReportIsMutable(); - testPlanReport_.add(builderForValue.build()); - onChanged(); - } else { - testPlanReportBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public Builder addTestPlanReport( - int index, com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.Builder builderForValue) { - if (testPlanReportBuilder_ == null) { - ensureTestPlanReportIsMutable(); - testPlanReport_.add(index, builderForValue.build()); - onChanged(); - } else { - testPlanReportBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public Builder addAllTestPlanReport( - java.lang.Iterable<? extends com.android.vts.proto.VtsReportMessage.TestPlanReportMessage> values) { - if (testPlanReportBuilder_ == null) { - ensureTestPlanReportIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, testPlanReport_); - onChanged(); - } else { - testPlanReportBuilder_.addAllMessages(values); - } - return this; - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public Builder clearTestPlanReport() { - if (testPlanReportBuilder_ == null) { - testPlanReport_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - onChanged(); - } else { - testPlanReportBuilder_.clear(); - } - return this; - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public Builder removeTestPlanReport(int index) { - if (testPlanReportBuilder_ == null) { - ensureTestPlanReportIsMutable(); - testPlanReport_.remove(index); - onChanged(); - } else { - testPlanReportBuilder_.remove(index); - } - return this; - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.Builder getTestPlanReportBuilder( - int index) { - return getTestPlanReportFieldBuilder().getBuilder(index); - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestPlanReportMessageOrBuilder getTestPlanReportOrBuilder( - int index) { - if (testPlanReportBuilder_ == null) { - return testPlanReport_.get(index); } else { - return testPlanReportBuilder_.getMessageOrBuilder(index); - } - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public java.util.List<? extends com.android.vts.proto.VtsReportMessage.TestPlanReportMessageOrBuilder> - getTestPlanReportOrBuilderList() { - if (testPlanReportBuilder_ != null) { - return testPlanReportBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(testPlanReport_); - } - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.Builder addTestPlanReportBuilder() { - return getTestPlanReportFieldBuilder().addBuilder( - com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.getDefaultInstance()); - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.Builder addTestPlanReportBuilder( - int index) { - return getTestPlanReportFieldBuilder().addBuilder( - index, com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.getDefaultInstance()); - } - /** - * <code>repeated .android.vts.TestPlanReportMessage test_plan_report = 3;</code> - */ - public java.util.List<com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.Builder> - getTestPlanReportBuilderList() { - return getTestPlanReportFieldBuilder().getBuilderList(); - } - private com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.TestPlanReportMessage, com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.Builder, com.android.vts.proto.VtsReportMessage.TestPlanReportMessageOrBuilder> - getTestPlanReportFieldBuilder() { - if (testPlanReportBuilder_ == null) { - testPlanReportBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< - com.android.vts.proto.VtsReportMessage.TestPlanReportMessage, com.android.vts.proto.VtsReportMessage.TestPlanReportMessage.Builder, com.android.vts.proto.VtsReportMessage.TestPlanReportMessageOrBuilder>( - testPlanReport_, - ((bitField0_ & 0x00000004) == 0x00000004), - getParentForChildren(), - isClean()); - testPlanReport_ = null; - } - return testPlanReportBuilder_; - } - public final Builder setUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - - // @@protoc_insertion_point(builder_scope:android.vts.DashboardPostMessage) - } - - // @@protoc_insertion_point(class_scope:android.vts.DashboardPostMessage) - private static final com.android.vts.proto.VtsReportMessage.DashboardPostMessage DEFAULT_INSTANCE; - static { - DEFAULT_INSTANCE = new com.android.vts.proto.VtsReportMessage.DashboardPostMessage(); - } - - public static com.android.vts.proto.VtsReportMessage.DashboardPostMessage getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - @java.lang.Deprecated public static final com.google.protobuf.Parser<DashboardPostMessage> - PARSER = new com.google.protobuf.AbstractParser<DashboardPostMessage>() { - public DashboardPostMessage parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return new DashboardPostMessage(input, extensionRegistry); - } - }; - - public static com.google.protobuf.Parser<DashboardPostMessage> parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser<DashboardPostMessage> getParserForType() { - return PARSER; - } - - public com.android.vts.proto.VtsReportMessage.DashboardPostMessage getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } - - } - - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_android_vts_AndroidDeviceInfoMessage_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_android_vts_AndroidDeviceInfoMessage_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_android_vts_AndroidBuildInfo_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_android_vts_AndroidBuildInfo_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_android_vts_VtsHostInfo_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_android_vts_VtsHostInfo_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_android_vts_TestCaseReportMessage_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_android_vts_TestCaseReportMessage_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_android_vts_ProfilingReportMessage_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_android_vts_ProfilingReportMessage_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_android_vts_SystraceReportMessage_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_android_vts_SystraceReportMessage_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_android_vts_CoverageReportMessage_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_android_vts_CoverageReportMessage_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_android_vts_HalInterfaceMessage_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_android_vts_HalInterfaceMessage_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_android_vts_ApiCoverageReportMessage_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_android_vts_ApiCoverageReportMessage_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_android_vts_LogMessage_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_android_vts_LogMessage_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_android_vts_UrlResourceMessage_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_android_vts_UrlResourceMessage_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_android_vts_TestReportMessage_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_android_vts_TestReportMessage_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_android_vts_TestPlanReportMessage_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_android_vts_TestPlanReportMessage_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor - internal_static_android_vts_DashboardPostMessage_descriptor; - private static final - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_android_vts_DashboardPostMessage_fieldAccessorTable; - - public static com.google.protobuf.Descriptors.FileDescriptor - getDescriptor() { - return descriptor; - } - private static com.google.protobuf.Descriptors.FileDescriptor - descriptor; - static { - java.lang.String[] descriptorData = { - "\n\034proto/VtsReportMessage.proto\022\013android." + - "vts\"\340\001\n\030AndroidDeviceInfoMessage\022\024\n\014prod" + - "uct_type\030\001 \001(\014\022\027\n\017product_variant\030\002 \001(\014\022" + - "\024\n\014build_flavor\030\013 \001(\014\022\020\n\010build_id\030\014 \001(\014\022" + - "\016\n\006branch\030\025 \001(\014\022\023\n\013build_alias\030\026 \001(\014\022\021\n\t" + - "api_level\030\037 \001(\014\022\020\n\010abi_name\0303 \001(\014\022\023\n\013abi" + - "_bitness\0304 \001(\014\022\016\n\006serial\030e \001(\014\"g\n\020Androi" + - "dBuildInfo\022\n\n\002id\030\001 \001(\014\022\014\n\004name\030\013 \001(\014\022\022\n\n" + - "build_type\030\014 \001(\014\022\016\n\006branch\030\r \001(\014\022\025\n\rbuil" + - "d_summary\030\025 \001(\014\"\037\n\013VtsHostInfo\022\020\n\010hostna", - "me\030\001 \001(\014\"\325\002\n\025TestCaseReportMessage\022\014\n\004na" + - "me\030\001 \001(\014\0220\n\013test_result\030\013 \001(\0162\033.android." + - "vts.TestCaseResult\022\027\n\017start_timestamp\030\025 " + - "\001(\003\022\025\n\rend_timestamp\030\026 \001(\003\0224\n\010coverage\030\037" + - " \003(\0132\".android.vts.CoverageReportMessage" + - "\0226\n\tprofiling\030) \003(\0132#.android.vts.Profil" + - "ingReportMessage\0228\n\010systrace\030* \003(\0132\".and" + - "roid.vts.SystraceReportMessageB\002\030\001\022$\n\003lo" + - "g\030e \003(\0132\027.android.vts.LogMessage\"\240\002\n\026Pro" + - "filingReportMessage\022\014\n\004name\030\001 \001(\014\022+\n\004typ", - "e\030\002 \001(\0162\035.android.vts.VtsProfilingType\022@" + - "\n\017regression_mode\030\003 \001(\0162\'.android.vts.Vt" + - "sProfilingRegressionMode\022\027\n\017start_timest" + - "amp\030\013 \001(\003\022\025\n\rend_timestamp\030\014 \001(\003\022\r\n\005labe" + - "l\030\025 \003(\014\022\r\n\005value\030\026 \003(\003\022\024\n\014x_axis_label\030\037" + - " \001(\014\022\024\n\014y_axis_label\030 \001(\014\022\017\n\007options\030) " + - "\003(\014\"H\n\025SystraceReportMessage\022\024\n\014process_" + - "name\030\001 \001(\014\022\014\n\004html\030\013 \003(\014\022\013\n\003url\030\025 \003(\014\"\345\001" + - "\n\025CoverageReportMessage\022\021\n\tfile_path\030\013 \001" + - "(\014\022\024\n\014project_name\030\014 \001(\014\022\020\n\010revision\030\r \001", - "(\014\022\034\n\024line_coverage_vector\030\027 \003(\003\022\030\n\020tota" + - "l_line_count\030e \001(\005\022\032\n\022covered_line_count" + - "\030f \001(\005\022\024\n\010dir_path\030\001 \001(\014B\002\030\001\022\025\n\tfile_nam" + - "e\030\002 \001(\014B\002\030\001\022\020\n\004html\030\003 \001(\014B\002\030\001\"\234\001\n\023HalInt" + - "erfaceMessage\022\030\n\020hal_package_name\030\001 \001(\014\022" + - "\031\n\021hal_version_major\030\002 \001(\005\022\031\n\021hal_versio" + - "n_minor\030\003 \001(\005\022\032\n\022hal_interface_name\030\004 \001(" + - "\014\022\031\n\021hal_release_level\030\005 \001(\014\"}\n\030ApiCover" + - "ageReportMessage\0227\n\rhal_interface\030\001 \001(\0132" + - " .android.vts.HalInterfaceMessage\022\017\n\007hal", - "_api\030\013 \003(\014\022\027\n\017covered_hal_api\030\014 \003(\014\"8\n\nL" + - "ogMessage\022\013\n\003url\030\001 \001(\014\022\014\n\004name\030\002 \001(\014\022\017\n\007" + - "content\030\003 \001(\014\"@\n\022UrlResourceMessage\022\013\n\003u" + - "rl\030\001 \001(\014\022\014\n\004name\030\002 \001(\014\022\017\n\007content\030\003 \001(\014\"" + - "\310\005\n\021TestReportMessage\022\026\n\ntest_suite\030\001 \001(" + - "\014B\002\030\001\022\014\n\004test\030\002 \001(\014\022+\n\ttest_type\030\003 \001(\0162\030" + - ".android.vts.VtsTestType\022:\n\013device_info\030" + - "\004 \003(\0132%.android.vts.AndroidDeviceInfoMes" + - "sage\0221\n\nbuild_info\030\005 \001(\0132\035.android.vts.A" + - "ndroidBuildInfo\022\030\n\020subscriber_email\030\006 \003(", - "\014\022+\n\thost_info\030\007 \001(\0132\030.android.vts.VtsHo" + - "stInfo\0225\n\ttest_case\030\013 \003(\0132\".android.vts." + - "TestCaseReportMessage\0226\n\tprofiling\030\025 \003(\013" + - "2#.android.vts.ProfilingReportMessage\0228\n" + - "\010systrace\030\026 \003(\0132\".android.vts.SystraceRe" + - "portMessageB\002\030\001\022\027\n\017start_timestamp\030e \001(\003" + - "\022\025\n\rend_timestamp\030f \001(\003\0224\n\010coverage\030g \003(" + - "\0132\".android.vts.CoverageReportMessage\022;\n" + - "\014api_coverage\030h \003(\0132%.android.vts.ApiCov" + - "erageReportMessage\022%\n\003log\030\351\007 \003(\0132\027.andro", - "id.vts.LogMessage\0227\n\rlink_resource\030\363\007 \003(" + - "\0132\037.android.vts.UrlResourceMessage\"\346\001\n\025T" + - "estPlanReportMessage\022\030\n\020test_module_name" + - "\030\013 \003(\t\022#\n\033test_module_start_timestamp\030\014 " + - "\003(\003\022\026\n\016test_plan_name\030\025 \001(\t\0227\n\016partner_r" + - "eport\030\037 \003(\0132\037.android.vts.UrlResourceMes" + - "sage\022=\n\016hal_api_report\030) \003(\0132%.android.v" + - "ts.ApiCoverageReportMessage\"\237\001\n\024Dashboar" + - "dPostMessage\022\024\n\014access_token\030\001 \001(\t\0223\n\013te" + - "st_report\030\002 \003(\0132\036.android.vts.TestReport", - "Message\022<\n\020test_plan_report\030\003 \003(\0132\".andr" + - "oid.vts.TestPlanReportMessage*\263\001\n\016TestCa" + - "seResult\022\022\n\016UNKNOWN_RESULT\020\000\022\031\n\025TEST_CAS" + - "E_RESULT_PASS\020\001\022\031\n\025TEST_CASE_RESULT_FAIL" + - "\020\002\022\031\n\025TEST_CASE_RESULT_SKIP\020\003\022\036\n\032TEST_CA" + - "SE_RESULT_EXCEPTION\020\004\022\034\n\030TEST_CASE_RESUL" + - "T_TIMEOUT\020\005*\234\001\n\013VtsTestType\022\030\n\024UNKNOWN_V" + - "TS_TESTTYPE\020\000\022\036\n\032VTS_HOST_DRIVEN_STRUCTU" + - "RAL\020\001\022\033\n\027VTS_HOST_DRIVEN_FUZZING\020\002\022\031\n\025VT" + - "S_TARGET_SIDE_GTEST\020\003\022\033\n\027VTS_TARGET_SIDE", - "_FUZZING\020\004*\243\001\n\032VtsProfilingRegressionMod" + - "e\022\033\n\027UNKNOWN_REGRESSION_MODE\020\000\022 \n\034VTS_RE" + - "GRESSION_MODE_DISABLED\020\001\022\"\n\036VTS_REGRESSI" + - "ON_MODE_INCREASING\020\002\022\"\n\036VTS_REGRESSION_M" + - "ODE_DECREASING\020\003*\244\001\n\020VtsProfilingType\022\036\n" + - "\032UNKNOWN_VTS_PROFILING_TYPE\020\000\022 \n\034VTS_PRO" + - "FILING_TYPE_TIMESTAMP\020\001\022%\n!VTS_PROFILING" + - "_TYPE_LABELED_VECTOR\020\002\022\'\n#VTS_PROFILING_" + - "TYPE_UNLABELED_VECTOR\020\003B+\n\025com.android.v" + - "ts.protoB\020VtsReportMessageP\000" - }; - com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - return null; - } - }; - com.google.protobuf.Descriptors.FileDescriptor - .internalBuildGeneratedFileFrom(descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - }, assigner); - internal_static_android_vts_AndroidDeviceInfoMessage_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_android_vts_AndroidDeviceInfoMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_android_vts_AndroidDeviceInfoMessage_descriptor, - new java.lang.String[] { "ProductType", "ProductVariant", "BuildFlavor", "BuildId", "Branch", "BuildAlias", "ApiLevel", "AbiName", "AbiBitness", "Serial", }); - internal_static_android_vts_AndroidBuildInfo_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_android_vts_AndroidBuildInfo_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_android_vts_AndroidBuildInfo_descriptor, - new java.lang.String[] { "Id", "Name", "BuildType", "Branch", "BuildSummary", }); - internal_static_android_vts_VtsHostInfo_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_android_vts_VtsHostInfo_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_android_vts_VtsHostInfo_descriptor, - new java.lang.String[] { "Hostname", }); - internal_static_android_vts_TestCaseReportMessage_descriptor = - getDescriptor().getMessageTypes().get(3); - internal_static_android_vts_TestCaseReportMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_android_vts_TestCaseReportMessage_descriptor, - new java.lang.String[] { "Name", "TestResult", "StartTimestamp", "EndTimestamp", "Coverage", "Profiling", "Systrace", "Log", }); - internal_static_android_vts_ProfilingReportMessage_descriptor = - getDescriptor().getMessageTypes().get(4); - internal_static_android_vts_ProfilingReportMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_android_vts_ProfilingReportMessage_descriptor, - new java.lang.String[] { "Name", "Type", "RegressionMode", "StartTimestamp", "EndTimestamp", "Label", "Value", "XAxisLabel", "YAxisLabel", "Options", }); - internal_static_android_vts_SystraceReportMessage_descriptor = - getDescriptor().getMessageTypes().get(5); - internal_static_android_vts_SystraceReportMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_android_vts_SystraceReportMessage_descriptor, - new java.lang.String[] { "ProcessName", "Html", "Url", }); - internal_static_android_vts_CoverageReportMessage_descriptor = - getDescriptor().getMessageTypes().get(6); - internal_static_android_vts_CoverageReportMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_android_vts_CoverageReportMessage_descriptor, - new java.lang.String[] { "FilePath", "ProjectName", "Revision", "LineCoverageVector", "TotalLineCount", "CoveredLineCount", "DirPath", "FileName", "Html", }); - internal_static_android_vts_HalInterfaceMessage_descriptor = - getDescriptor().getMessageTypes().get(7); - internal_static_android_vts_HalInterfaceMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_android_vts_HalInterfaceMessage_descriptor, - new java.lang.String[] { "HalPackageName", "HalVersionMajor", "HalVersionMinor", "HalInterfaceName", "HalReleaseLevel", }); - internal_static_android_vts_ApiCoverageReportMessage_descriptor = - getDescriptor().getMessageTypes().get(8); - internal_static_android_vts_ApiCoverageReportMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_android_vts_ApiCoverageReportMessage_descriptor, - new java.lang.String[] { "HalInterface", "HalApi", "CoveredHalApi", }); - internal_static_android_vts_LogMessage_descriptor = - getDescriptor().getMessageTypes().get(9); - internal_static_android_vts_LogMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_android_vts_LogMessage_descriptor, - new java.lang.String[] { "Url", "Name", "Content", }); - internal_static_android_vts_UrlResourceMessage_descriptor = - getDescriptor().getMessageTypes().get(10); - internal_static_android_vts_UrlResourceMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_android_vts_UrlResourceMessage_descriptor, - new java.lang.String[] { "Url", "Name", "Content", }); - internal_static_android_vts_TestReportMessage_descriptor = - getDescriptor().getMessageTypes().get(11); - internal_static_android_vts_TestReportMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_android_vts_TestReportMessage_descriptor, - new java.lang.String[] { "TestSuite", "Test", "TestType", "DeviceInfo", "BuildInfo", "SubscriberEmail", "HostInfo", "TestCase", "Profiling", "Systrace", "StartTimestamp", "EndTimestamp", "Coverage", "ApiCoverage", "Log", "LinkResource", }); - internal_static_android_vts_TestPlanReportMessage_descriptor = - getDescriptor().getMessageTypes().get(12); - internal_static_android_vts_TestPlanReportMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_android_vts_TestPlanReportMessage_descriptor, - new java.lang.String[] { "TestModuleName", "TestModuleStartTimestamp", "TestPlanName", "PartnerReport", "HalApiReport", }); - internal_static_android_vts_DashboardPostMessage_descriptor = - getDescriptor().getMessageTypes().get(13); - internal_static_android_vts_DashboardPostMessage_fieldAccessorTable = new - com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_android_vts_DashboardPostMessage_descriptor, - new java.lang.String[] { "AccessToken", "TestReport", "TestPlanReport", }); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/src/main/java/com/android/vts/servlet/BaseServlet.java b/src/main/java/com/android/vts/servlet/BaseServlet.java deleted file mode 100644 index 5319ee1..0000000 --- a/src/main/java/com/android/vts/servlet/BaseServlet.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (c) 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.servlet; - -import com.android.vts.entity.CoverageEntity; -import com.android.vts.entity.TestSuiteResultEntity; -import com.android.vts.entity.UserEntity; -import com.android.vts.util.EmailHelper; -import com.android.vts.util.GcsHelper; -import com.google.appengine.api.users.User; -import com.google.appengine.api.users.UserService; -import com.google.appengine.api.users.UserServiceFactory; -import com.google.gson.Gson; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.Properties; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.ServletConfig; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -public abstract class BaseServlet extends HttpServlet { - - protected final Logger logger = Logger.getLogger(getClass().getName()); - - protected String ERROR_MESSAGE_JSP = "WEB-INF/jsp/error_msg.jsp"; - - // Environment variables - protected static String GERRIT_URI; - protected static String GERRIT_SCOPE; - protected static String CLIENT_ID; - protected static String ANALYTICS_ID; - - protected static final String TREE_DEFAULT_PARAM = "treeDefault"; - - public enum PageType { - TOT("Test", "/"), - RELEASE("Release", "/show_release"), - COVERAGE_OVERVIEW("Coverage", "/show_coverage_overview"), - PROFILING_LIST("Profiling", "/show_profiling_list"), - TABLE("", "/show_table"), - TREE("", "/show_tree"), - GRAPH("Profiling", "/show_graph"), - COVERAGE("Coverage", "/show_coverage"), - PERFORMANCE_DIGEST("Performance Digest", "/show_performance_digest"), - PLAN_RELEASE("", "/show_plan_release"), - PLAN_RUN("Plan Run", "/show_plan_run"), - PROFILING_OVERVIEW("", "/show_profiling_overview"); - - public final String defaultName; - public final String defaultUrl; - - PageType(String defaultName, String defaultUrl) { - this.defaultName = defaultName; - this.defaultUrl = defaultUrl; - } - } - - public static class Page { - - private final PageType type; - private final String name; - private final String url; - - public Page(PageType type) { - this.type = type; - this.name = type.defaultName; - this.url = type.defaultUrl; - } - - public Page(PageType type, String name, String url) { - this.type = type; - this.name = type.defaultName + name; - this.url = type.defaultUrl + url; - } - - public Page(PageType type, String name, String url, Boolean withoutDefault) { - this.type = type; - this.name = name; - this.url = type.defaultUrl + url; - } - - public Page(PageType type, String url) { - this.type = type; - this.name = type.defaultName; - this.url = type.defaultUrl + url; - } - - public String getName() { - return name; - } - - public String getUrl() { - return url; - } - } - - public static final List<Page> navbarLinks; - - static { - List<Page> links = new ArrayList<>(); - links.add(new Page(PageType.TOT)); - links.add(new Page(PageType.RELEASE)); - links.add(new Page(PageType.COVERAGE_OVERVIEW)); - links.add(new Page(PageType.PROFILING_LIST)); - navbarLinks = links; - } - - public abstract PageType getNavParentType(); - - /** - * Get a list of URL/Display name pairs for the breadcrumb hierarchy. - * - * @param request The HttpServletRequest object for the page request. - * @return a list of Page entries. - */ - public abstract List<Page> getBreadcrumbLinks(HttpServletRequest request); - - /** System Configuration Property class */ - protected static Properties systemConfigProp = new Properties(); - - @Override - public void init(ServletConfig cfg) throws ServletException { - super.init(cfg); - - systemConfigProp = - Properties.class.cast(cfg.getServletContext().getAttribute("systemConfigProp")); - - GERRIT_URI = systemConfigProp.getProperty("gerrit.uri"); - GERRIT_SCOPE = systemConfigProp.getProperty("gerrit.scope"); - CLIENT_ID = systemConfigProp.getProperty("appengine.clientID"); - ANALYTICS_ID = systemConfigProp.getProperty("analytics.id"); - - CoverageEntity.setPropertyValues(systemConfigProp); - TestSuiteResultEntity.setPropertyValues(systemConfigProp); - EmailHelper.setPropertyValues(systemConfigProp); - GcsHelper.setGcsProjectId(systemConfigProp.getProperty("gcs.projectID")); - } - - @Override - public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - // If the user is logged out, allow them to log back in and return to the page. - // Set the logout URL to direct back to a login page that directs to the current request. - UserService userService = UserServiceFactory.getUserService(); - Optional<User> currentUser = Optional.ofNullable(userService.getCurrentUser()); - String currentUserEmail = - currentUser.isPresent() - ? currentUser.map(user -> user.getEmail().trim()).orElse("") - : ""; - String requestUri = request.getRequestURI(); - String requestArgs = request.getQueryString(); - String loginURI = userService.createLoginURL(requestUri + '?' + requestArgs); - String logoutURI = userService.createLogoutURL(loginURI); - if (currentUserEmail != "") { - - int activeIndex; - switch (getNavParentType()) { - case PROFILING_LIST: - activeIndex = 3; - break; - case COVERAGE_OVERVIEW: - activeIndex = 2; - break; - case RELEASE: - activeIndex = 1; - break; - default: - activeIndex = 0; - break; - } - if (request.getParameter(TREE_DEFAULT_PARAM) != null) { - HttpSession session = request.getSession(true); - boolean treeDefault = request.getParameter(TREE_DEFAULT_PARAM).equals("true"); - session.setAttribute(TREE_DEFAULT_PARAM, treeDefault); - } - - request.setAttribute("serverName", request.getServerName()); - request.setAttribute("logoutURL", logoutURI); - request.setAttribute("email", currentUserEmail); - request.setAttribute("analyticsID", new Gson().toJson(ANALYTICS_ID)); - request.setAttribute("breadcrumbLinks", getBreadcrumbLinks(request)); - request.setAttribute("navbarLinks", navbarLinks); - request.setAttribute("activeIndex", activeIndex); - response.setContentType("text/html"); - - if (currentUserEmail.endsWith("@google.com") - || UserEntity.getUserList().contains(currentUserEmail)) { - doGetHandler(request, response); - } else { - RequestDispatcher dispatcher = - request.getRequestDispatcher("WEB-INF/jsp/auth_error.jsp"); - try { - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Exception caught : ", e); - } - } - } else { - response.sendRedirect(loginURI); - } - } - - /** - * Implementation of the doGet method to be executed by servlet subclasses. - * - * @param request The HttpServletRequest object. - * @param response The HttpServletResponse object. - */ - public abstract void doGetHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException; -} diff --git a/src/main/java/com/android/vts/servlet/DashboardMainServlet.java b/src/main/java/com/android/vts/servlet/DashboardMainServlet.java deleted file mode 100644 index 73a7287..0000000 --- a/src/main/java/com/android/vts/servlet/DashboardMainServlet.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.servlet; - -import com.android.vts.entity.TestEntity; -import com.android.vts.entity.TestStatusEntity; -import com.android.vts.entity.UserFavoriteEntity; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.PropertyProjection; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.datastore.Query.Filter; -import com.google.appengine.api.datastore.Query.FilterOperator; -import com.google.appengine.api.datastore.Query.FilterPredicate; -import com.google.appengine.api.users.User; -import com.google.appengine.api.users.UserService; -import com.google.appengine.api.users.UserServiceFactory; -import com.google.gson.Gson; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; -import java.util.stream.Collectors; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -/** Represents the servlet that is invoked on loading the first page of dashboard. */ -public class DashboardMainServlet extends BaseServlet { - private static final String DASHBOARD_MAIN_JSP = "WEB-INF/jsp/dashboard_main.jsp"; - private static final String NO_TESTS_ERROR = "No test results available."; - - @Override - public PageType getNavParentType() { - return PageType.TOT; - } - - @Override - public List<Page> getBreadcrumbLinks(HttpServletRequest request) { - return null; - } - - /** Helper class for displaying test entries on the main dashboard. */ - public class TestDisplay implements Comparable<TestDisplay> { - private final Key testKey; - private final int passCount; - private final int failCount; - private boolean muteNotifications; - private boolean isFavorite; - - /** - * Test display constructor. - * - * @param testKey The key of the test. - * @param passCount The number of tests passing. - * @param failCount The number of tests failing. - * @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) { - this.testKey = testKey; - this.passCount = passCount; - this.failCount = failCount; - this.muteNotifications = muteNotifications; - this.isFavorite = isFavorite; - } - - /** - * Get the key of the test. - * - * @return The key of the test. - */ - public String getName() { - return this.testKey.getName(); - } - - /** - * Get the number of passing test cases. - * - * @return The number of passing test cases. - */ - public int getPassCount() { - return this.passCount; - } - - /** - * Get the number of failing test cases. - * - * @return The number of failing test cases. - */ - public int getFailCount() { - return this.failCount; - } - - /** - * Get the notification mute status. - * - * @return True if the subscriber has muted notifications, false otherwise. - */ - public boolean getMuteNotifications() { - return this.muteNotifications; - } - - /** Set the notification mute status. */ - public void setMuteNotifications(boolean muteNotifications) { - this.muteNotifications = muteNotifications; - } - - /** - * Get the favorate status. - * - * @return True if an user set favorate for the test, false otherwise. - */ - public boolean getIsFavorite() { - return this.isFavorite; - } - - /** Set the favorite status. */ - public void setIsFavorite(boolean isFavorite) { - this.isFavorite = isFavorite; - } - - @Override - public int compareTo(TestDisplay test) { - return this.testKey.getName().compareTo(test.getName()); - } - } - - @Override - public void doGetHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - UserService userService = UserServiceFactory.getUserService(); - User currentUser = userService.getCurrentUser(); - RequestDispatcher dispatcher = null; - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - HttpSession session = request.getSession(true); - PageType referTo = PageType.TREE; - if (session.getAttribute("treeDefault") != null) { - boolean treeDefault = (boolean) session.getAttribute("treeDefault"); - if (!treeDefault) { - referTo = PageType.TABLE; - } - } - - List<TestDisplay> displayedTests = new ArrayList<>(); - List<Key> unprocessedTestKeys = new ArrayList<>(); - - Map<Key, TestDisplay> testMap = new HashMap<>(); // map from table key to TestDisplay - Map<String, String> subscriptionMap = new HashMap<>(); - - boolean showAll = request.getParameter("showAll") != null; - String error = null; - - List<String> allTestNames = TestEntity.getAllTestNames(); - - List<Key> favoriteKeyList = new ArrayList<Key>(); - Filter userFilter = - new FilterPredicate(UserFavoriteEntity.USER, FilterOperator.EQUAL, currentUser); - Query filterQuery = new Query(UserFavoriteEntity.KIND).setFilter(userFilter); - Iterable<Entity> 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())); - }); - - Query query = - new Query(TestStatusEntity.KIND) - .addProjection( - new PropertyProjection(TestStatusEntity.PASS_COUNT, Long.class)) - .addProjection( - new PropertyProjection(TestStatusEntity.FAIL_COUNT, Long.class)); - for (Entity status : datastore.prepare(query).asIterable()) { - TestStatusEntity statusEntity = TestStatusEntity.fromEntity(status); - if (statusEntity == null) continue; - 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.getPassCount(), - statusEntity.getFailCount(), - false, - isFavorite); - } - testMap.put(testKey, display); - } - - if (testMap.size() == 0) { - error = NO_TESTS_ERROR; - } - - if (showAll) { - for (Key testKey : testMap.keySet()) { - displayedTests.add(testMap.get(testKey)); - } - } else { - if (testMap.size() > 0) { - for (Entity favoriteEntity : favoriteIter) { - UserFavoriteEntity favorite = UserFavoriteEntity.fromEntity(favoriteEntity); - Key testKey = favorite.testKey; - if (!testMap.containsKey(testKey)) { - continue; - } - TestDisplay display = testMap.get(testKey); - display.setMuteNotifications(favorite.muteNotifications); - displayedTests.add(display); - } - } - } - displayedTests.sort(Comparator.naturalOrder()); - - response.setStatus(HttpServletResponse.SC_OK); - request.setAttribute("allTestsJson", new Gson().toJson(allTestNames)); - request.setAttribute("subscriptionMapJson", new Gson().toJson(subscriptionMap)); - request.setAttribute("testNames", displayedTests); - request.setAttribute("showAll", showAll); - request.setAttribute("error", error); - request.setAttribute("resultsUrl", referTo.defaultUrl); - dispatcher = request.getRequestDispatcher(DASHBOARD_MAIN_JSP); - try { - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Excpetion caught : ", e); - } - } -} diff --git a/src/main/java/com/android/vts/servlet/ShowCoverageOverviewServlet.java b/src/main/java/com/android/vts/servlet/ShowCoverageOverviewServlet.java deleted file mode 100644 index 210c980..0000000 --- a/src/main/java/com/android/vts/servlet/ShowCoverageOverviewServlet.java +++ /dev/null @@ -1,432 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.servlet; - -import com.android.vts.entity.CodeCoverageEntity; -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.TestCoverageStatusEntity; -import com.android.vts.entity.TestEntity; -import com.android.vts.entity.TestRunEntity; - -import com.android.vts.proto.VtsReportMessage; -import com.android.vts.util.FilterUtil; -import com.google.cloud.datastore.Datastore; -import com.google.cloud.datastore.DatastoreOptions; -import com.google.cloud.datastore.PathElement; -import com.google.cloud.datastore.StructuredQuery.CompositeFilter; -import com.google.cloud.datastore.StructuredQuery.Filter; -import com.google.cloud.datastore.StructuredQuery.PropertyFilter; -import com.google.gson.Gson; -import com.google.visualization.datasource.DataSourceHelper; -import com.google.visualization.datasource.DataSourceRequest; -import com.google.visualization.datasource.base.DataSourceException; -import com.google.visualization.datasource.base.ReasonType; -import com.google.visualization.datasource.base.ResponseStatus; -import com.google.visualization.datasource.base.StatusType; -import com.google.visualization.datasource.base.TypeMismatchException; -import com.google.visualization.datasource.datatable.ColumnDescription; -import com.google.visualization.datasource.datatable.DataTable; -import com.google.visualization.datasource.datatable.TableRow; -import com.google.visualization.datasource.datatable.value.DateTimeValue; -import com.google.visualization.datasource.datatable.value.NumberValue; -import com.google.visualization.datasource.datatable.value.ValueType; -import com.googlecode.objectify.Key; -import com.ibm.icu.util.GregorianCalendar; -import com.ibm.icu.util.TimeZone; -import java.io.IOException; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Predicate; -import java.util.logging.Level; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -/** Represents the servlet that is invoked on loading the coverage overview page. */ -public class ShowCoverageOverviewServlet extends BaseServlet { - - @Override - public PageType getNavParentType() { - return PageType.COVERAGE_OVERVIEW; - } - - @Override - public List<Page> getBreadcrumbLinks(HttpServletRequest request) { - return null; - } - - @Override - public void doGetHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - - String pageType = - request.getParameter("pageType") == null - ? "html" - : request.getParameter("pageType"); - - RequestDispatcher dispatcher; - if (pageType.equalsIgnoreCase("html")) { - dispatcher = this.getCoverageDispatcher(request, response); - try { - request.setAttribute("pageType", pageType); - response.setStatus(HttpServletResponse.SC_OK); - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Exception caught : ", e); - } - } else { - - String testName = request.getParameter("testName"); - - DataTable data = getCoverageDataTable(testName); - DataSourceRequest dsRequest = null; - - try { - // Extract the datasource request parameters. - dsRequest = new DataSourceRequest(request); - - // NOTE: If you want to work in restricted mode, which means that only - // requests from the same domain can access the data source, uncomment the following - // call. - // - // DataSourceHelper.verifyAccessApproved(dsRequest); - - // Apply the query to the data table. - DataTable newData = - DataSourceHelper.applyQuery( - dsRequest.getQuery(), data, dsRequest.getUserLocale()); - - // Set the response. - DataSourceHelper.setServletResponse(newData, dsRequest, response); - } catch (RuntimeException rte) { - logger.log(Level.SEVERE, "A runtime exception has occured", rte); - ResponseStatus status = - new ResponseStatus( - StatusType.ERROR, ReasonType.INTERNAL_ERROR, rte.getMessage()); - if (dsRequest == null) { - dsRequest = DataSourceRequest.getDefaultDataSourceRequest(request); - } - DataSourceHelper.setServletErrorResponse(status, dsRequest, response); - } catch (DataSourceException e) { - if (dsRequest != null) { - DataSourceHelper.setServletErrorResponse(e, dsRequest, response); - } else { - DataSourceHelper.setServletErrorResponse(e, request, response); - } - } - } - } - - private List<Key<TestRunEntity>> getTestRunEntityKeyList( - List<TestCoverageStatusEntity> testCoverageStatusEntityList) { - return testCoverageStatusEntityList.stream() - .map( - testCoverageStatusEntity -> { - com.googlecode.objectify.Key testKey = - com.googlecode.objectify.Key.create( - TestEntity.class, - testCoverageStatusEntity.getTestName()); - return com.googlecode.objectify.Key.create( - testKey, - TestRunEntity.class, - testCoverageStatusEntity.getUpdatedTimestamp()); - }) - .collect(Collectors.toList()); - } - - private Predicate<DeviceInfoEntity> isBranchAndDevice(String branch, String device) { - return d -> d.getBranch().equals(branch) && d.getBuildFlavor().equals(device); - } - - private Predicate<DeviceInfoEntity> isBranch(String branch) { - return d -> d.getBranch().equals(branch); - } - - private Predicate<DeviceInfoEntity> isDevice(String device) { - return d -> d.getBuildFlavor().equals(device); - } - - private RequestDispatcher getCoverageDispatcher( - HttpServletRequest request, HttpServletResponse response) { - - String COVERAGE_OVERVIEW_JSP = "WEB-INF/jsp/show_coverage_overview.jsp"; - - RequestDispatcher dispatcher = null; - boolean unfiltered = request.getParameter("unfiltered") != null; - boolean showPresubmit = request.getParameter("showPresubmit") != null; - boolean showPostsubmit = request.getParameter("showPostsubmit") != null; - - // If no params are specified, set to default of postsubmit-only. - if (!(showPresubmit || showPostsubmit)) { - showPostsubmit = true; - } - - // If unfiltered, set showPre- and Post-submit to true for accurate UI. - if (unfiltered) { - showPostsubmit = true; - showPresubmit = true; - } - - // Add test names to list - List<String> resultNames = - Arrays.stream(VtsReportMessage.TestCaseResult.values()) - .map(testCaseResult -> testCaseResult.name()) - .collect(Collectors.toList()); - - Map<String, String[]> parameterMap = request.getParameterMap(); - - List<TestCoverageStatusEntity> testCoverageStatusEntityList = - TestCoverageStatusEntity.getAllTestCoverage(); - - List<com.googlecode.objectify.Key<TestRunEntity>> testRunEntityKeyList = new ArrayList<>(); - - if (Objects.nonNull(parameterMap.get("branch")) - || Objects.nonNull(parameterMap.get("device"))) { - List<com.googlecode.objectify.Key<DeviceInfoEntity>> deviceInfoEntityKeyList = - TestCoverageStatusEntity.getDeviceInfoEntityKeyList( - testCoverageStatusEntityList); - - Collection<DeviceInfoEntity> deviceInfoEntityMap = - ofy().load().keys(() -> deviceInfoEntityKeyList.iterator()).values(); - - Stream<DeviceInfoEntity> deviceInfoEntityStream = Stream.empty(); - if (Objects.nonNull(parameterMap.get("branch")) - && Objects.nonNull(parameterMap.get("device"))) { - String branch = parameterMap.get("branch")[0]; - String device = parameterMap.get("device")[0]; - deviceInfoEntityStream = - deviceInfoEntityMap.stream().filter(isBranchAndDevice(branch, device)); - } else if (Objects.nonNull(parameterMap.get("branch"))) { - String branch = parameterMap.get("branch")[0]; - deviceInfoEntityStream = deviceInfoEntityMap.stream().filter(isBranch(branch)); - } else if (Objects.nonNull(parameterMap.get("device"))) { - String device = parameterMap.get("device")[0]; - deviceInfoEntityStream = deviceInfoEntityMap.stream().filter(isDevice(device)); - } else { - logger.log(Level.WARNING, "unmet search condition!"); - } - testRunEntityKeyList = - deviceInfoEntityStream - .map( - deviceInfoEntity -> { - com.googlecode.objectify.Key testKey = - com.googlecode.objectify.Key.create( - TestEntity.class, - deviceInfoEntity - .getParent() - .getParent() - .getName()); - return com.googlecode.objectify.Key.create( - testKey, - TestRunEntity.class, - deviceInfoEntity.getParent().getId()); - }) - .collect(Collectors.toList()); - logger.log(Level.INFO, "testRunEntityKeyList size => " + testRunEntityKeyList.size()); - } else { - testRunEntityKeyList = this.getTestRunEntityKeyList(testCoverageStatusEntityList); - } - Iterator<Key<TestRunEntity>> testRunEntityKeyIterator = testRunEntityKeyList.iterator(); - - Map<Key<TestRunEntity>, TestRunEntity> keyTestRunEntityMap = - ofy().load().keys(() -> testRunEntityKeyIterator); - - List<com.googlecode.objectify.Key<CodeCoverageEntity>> codeCoverageEntityKeyList = - new ArrayList<>(); - Map<Long, TestRunEntity> testRunEntityMap = new HashMap<>(); - for (Map.Entry<com.googlecode.objectify.Key<TestRunEntity>, TestRunEntity> entry : - keyTestRunEntityMap.entrySet()) { - com.googlecode.objectify.Key codeCoverageEntityKey = - com.googlecode.objectify.Key.create( - entry.getKey(), CodeCoverageEntity.class, entry.getValue().getId()); - codeCoverageEntityKeyList.add(codeCoverageEntityKey); - testRunEntityMap.put(entry.getValue().getId(), entry.getValue()); - } - - Map<com.googlecode.objectify.Key<CodeCoverageEntity>, CodeCoverageEntity> - keyCodeCoverageEntityMap = - ofy().load().keys(() -> codeCoverageEntityKeyList.iterator()); - - Map<Long, CodeCoverageEntity> codeCoverageEntityMap = new HashMap<>(); - for (Map.Entry<com.googlecode.objectify.Key<CodeCoverageEntity>, CodeCoverageEntity> entry : - keyCodeCoverageEntityMap.entrySet()) { - codeCoverageEntityMap.put(entry.getValue().getId(), entry.getValue()); - } - - int coveredLines = 0; - int uncoveredLines = 0; - int passCount = 0; - int failCount = 0; - for (Map.Entry<Long, CodeCoverageEntity> entry : codeCoverageEntityMap.entrySet()) { - TestRunEntity testRunEntity = testRunEntityMap.get(entry.getKey()); - - CodeCoverageEntity codeCoverageEntity = entry.getValue(); - - coveredLines += codeCoverageEntity.getCoveredLineCount(); - uncoveredLines += - codeCoverageEntity.getTotalLineCount() - - codeCoverageEntity.getCoveredLineCount(); - passCount += testRunEntity.getPassCount(); - failCount += testRunEntity.getFailCount(); - } - - FilterUtil.setAttributes(request, parameterMap); - - int[] testStats = new int[VtsReportMessage.TestCaseResult.values().length]; - testStats[VtsReportMessage.TestCaseResult.TEST_CASE_RESULT_PASS.getNumber()] = passCount; - testStats[VtsReportMessage.TestCaseResult.TEST_CASE_RESULT_FAIL.getNumber()] = failCount; - - response.setStatus(HttpServletResponse.SC_OK); - request.setAttribute("resultNames", resultNames); - request.setAttribute("resultNamesJson", new Gson().toJson(resultNames)); - request.setAttribute("testRunEntityList", testRunEntityMap.values()); - request.setAttribute("codeCoverageEntityMap", codeCoverageEntityMap); - request.setAttribute("coveredLines", new Gson().toJson(coveredLines)); - request.setAttribute("uncoveredLines", new Gson().toJson(uncoveredLines)); - request.setAttribute("testStats", new Gson().toJson(testStats)); - - request.setAttribute("unfiltered", unfiltered); - request.setAttribute("showPresubmit", showPresubmit); - request.setAttribute("showPostsubmit", showPostsubmit); - - request.setAttribute( - "deviceOptions", - TestCoverageStatusEntity.getDeviceSet(testCoverageStatusEntityList)); - request.setAttribute( - "branchOptions", - TestCoverageStatusEntity.getBranchSet(testCoverageStatusEntityList)); - dispatcher = request.getRequestDispatcher(COVERAGE_OVERVIEW_JSP); - return dispatcher; - } - - private DataTable getCoverageDataTable(String testName) { - - Datastore datastore = DatastoreOptions.getDefaultInstance().getService(); - - DataTable dataTable = new DataTable(); - ArrayList<ColumnDescription> cd = new ArrayList<>(); - ColumnDescription startDate = - new ColumnDescription("startDate", ValueType.DATETIME, "Date"); - startDate.setPattern("yyyy-MM-dd"); - cd.add(startDate); - cd.add( - new ColumnDescription( - "coveredLineCount", ValueType.NUMBER, "Covered Source Code Line Count")); - cd.add( - new ColumnDescription( - "totalLineCount", ValueType.NUMBER, "Total Source Code Line Count")); - cd.add(new ColumnDescription("percentage", ValueType.NUMBER, "Coverage Ratio (%)")); - - dataTable.addColumns(cd); - - Calendar cal = Calendar.getInstance(); - cal.add(Calendar.MONTH, -6); - Long startTime = cal.getTime().getTime() * 1000; - Long endTime = Calendar.getInstance().getTime().getTime() * 1000; - - com.google.cloud.datastore.Key startKey = - datastore - .newKeyFactory() - .setKind(TestRunEntity.KIND) - .addAncestors( - PathElement.of(TestEntity.KIND, testName), - PathElement.of(TestRunEntity.KIND, startTime)) - .newKey(startTime); - - com.google.cloud.datastore.Key endKey = - datastore - .newKeyFactory() - .setKind(TestRunEntity.KIND) - .addAncestors( - PathElement.of(TestEntity.KIND, testName), - PathElement.of(TestRunEntity.KIND, endTime)) - .newKey(endTime); - - Filter codeCoverageFilter = - CompositeFilter.and( - PropertyFilter.lt("__key__", endKey), - PropertyFilter.gt("__key__", startKey)); - - List<CodeCoverageEntity> codeCoverageEntityList = - ofy().load() - .type(CodeCoverageEntity.class) - .filter(codeCoverageFilter) - .limit(10) - .list(); - - DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd"); - Map<String, List<CodeCoverageEntity>> codeCoverageEntityListMap = - codeCoverageEntityList - .stream() - .collect( - Collectors.groupingBy( - v -> dateTimeFormatter.print(v.getId() / 1000))); - - codeCoverageEntityListMap.forEach( - (key, entityList) -> { - GregorianCalendar gCal = new GregorianCalendar(); - gCal.setTimeZone(TimeZone.getTimeZone("GMT")); - gCal.setTimeInMillis(entityList.get(0).getId() / 1000); - - Long sumCoveredLine = - entityList.stream().mapToLong(val -> val.getCoveredLineCount()).sum(); - Long sumTotalLine = - entityList.stream().mapToLong(val -> val.getTotalLineCount()).sum(); - float percentage = 0; - if (sumTotalLine > 0) { - BigDecimal coveredLineNum = new BigDecimal(sumCoveredLine); - BigDecimal totalLineNum = new BigDecimal(sumTotalLine); - BigDecimal totalPercent = new BigDecimal(100); - percentage = - coveredLineNum - .multiply(totalPercent) - .divide(totalLineNum, 2, RoundingMode.HALF_DOWN) - .floatValue(); - } - - TableRow tableRow = new TableRow(); - tableRow.addCell(new DateTimeValue(gCal)); - tableRow.addCell(new NumberValue(sumCoveredLine)); - tableRow.addCell(new NumberValue(sumTotalLine)); - tableRow.addCell(new NumberValue(percentage)); - try { - dataTable.addRow(tableRow); - } catch (TypeMismatchException e) { - logger.log(Level.WARNING, "Invalid type! "); - } - }); - - return dataTable; - } -} diff --git a/src/main/java/com/android/vts/servlet/ShowCoverageServlet.java b/src/main/java/com/android/vts/servlet/ShowCoverageServlet.java deleted file mode 100644 index 08e5db6..0000000 --- a/src/main/java/com/android/vts/servlet/ShowCoverageServlet.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.servlet; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -import com.android.vts.entity.CoverageEntity; -import com.android.vts.entity.RoleEntity; -import com.android.vts.entity.TestEntity; -import com.android.vts.entity.TestRunEntity; -import com.android.vts.entity.UserEntity; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query; -import com.google.gson.Gson; -import com.googlecode.objectify.Ref; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.logging.Level; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Servlet for handling requests to show code coverage. - */ -public class ShowCoverageServlet extends BaseServlet { - - private static final String COVERAGE_JSP = "WEB-INF/jsp/show_coverage.jsp"; - private static final String TREE_JSP = "WEB-INF/jsp/show_tree.jsp"; - - @Override - public PageType getNavParentType() { - return PageType.TOT; - } - - @Override - public List<Page> getBreadcrumbLinks(HttpServletRequest request) { - List<Page> links = new ArrayList<>(); - String testName = request.getParameter("testName"); - links.add(new Page(PageType.TABLE, testName, "?testName=" + testName)); - - String startTime = request.getParameter("startTime"); - links.add(new Page(PageType.COVERAGE, "?testName=" + testName + "&startTime=" + startTime)); - return links; - } - - @Override - public void doGetHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - RequestDispatcher dispatcher = null; - - String test = request.getParameter("testName"); - String timeString = request.getParameter("startTime"); - - Boolean isModerator = false; - String currentUserEmail = request.getAttribute("email").toString(); - Optional<UserEntity> userEntityOptional = Optional - .ofNullable(UserEntity.getUser(currentUserEmail)); - if (userEntityOptional.isPresent()) { - Ref refRole = Ref.create(RoleEntity.getRole("coverage-moderator")); - isModerator = userEntityOptional.get().getRoles().contains(refRole); - } - - // Process the time key requested - long time = -1; - try { - time = Long.parseLong(timeString); - } catch (NumberFormatException e) { - request.setAttribute("testName", test); - dispatcher = request.getRequestDispatcher(TREE_JSP); - return; - } - - com.googlecode.objectify.Key testKey = com.googlecode.objectify.Key - .create(TestEntity.class, test); - com.googlecode.objectify.Key testRunKey = com.googlecode.objectify.Key - .create(testKey, TestRunEntity.class, time); - - List<CoverageEntity> coverageEntityList = ofy().load().type(CoverageEntity.class) - .ancestor(testRunKey).list(); - - Collections.sort(coverageEntityList, CoverageEntity.isIgnoredComparator); - - request.setAttribute("isModerator", isModerator); - request.setAttribute("testName", request.getParameter("testName")); - request.setAttribute("gerritURI", new Gson().toJson(GERRIT_URI)); - request.setAttribute("gerritScope", new Gson().toJson(GERRIT_SCOPE)); - request.setAttribute("clientId", new Gson().toJson(CLIENT_ID)); - request.setAttribute("startTime", request.getParameter("startTime")); - request.setAttribute("coverageEntityList", coverageEntityList); - - dispatcher = request.getRequestDispatcher(COVERAGE_JSP); - try { - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Exception caught : ", e); - } - } -} diff --git a/src/main/java/com/android/vts/servlet/ShowGcsLogServlet.java b/src/main/java/com/android/vts/servlet/ShowGcsLogServlet.java deleted file mode 100644 index ad5e871..0000000 --- a/src/main/java/com/android/vts/servlet/ShowGcsLogServlet.java +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright (c) 2018 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.servlet; - -import com.android.vts.util.GcsHelper; -import com.google.appengine.api.memcache.ErrorHandlers; -import com.google.appengine.api.memcache.MemcacheService; -import com.google.appengine.api.memcache.MemcacheServiceFactory; -import com.google.auth.oauth2.ServiceAccountCredentials; -import com.google.cloud.storage.Blob; -import com.google.cloud.storage.Bucket; -import com.google.cloud.storage.Storage; -import com.google.cloud.storage.Storage.BlobListOption; -import com.google.cloud.storage.StorageOptions; -import com.google.gson.Gson; -import org.apache.commons.io.IOUtils; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.nio.file.Path; -import java.nio.file.Paths; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.logging.Level; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -/** - * A GCS log servlet read log zip file from Google Cloud Storage bucket and show the content in it - * from the zip file by unarchiving it - */ -@SuppressWarnings("serial") -public class ShowGcsLogServlet extends BaseServlet { - - private static final String GCS_LOG_JSP = "WEB-INF/jsp/show_gcs_log.jsp"; - - /** Google Cloud Storage project's key file to access the storage */ - private static String GCS_KEY_FILE; - /** Google Cloud Storage project's default bucket name for vtslab test result files */ - private static String GCS_BUCKET_NAME; - /** Google Cloud Storage project's default bucket name for vtslab infra log files */ - private static String GCS_INFRA_LOG_BUCKET_NAME; - - /** - * This is the key file to access vtslab-gcs project. It will allow the dashboard to have a full - * control of the bucket. - */ - private InputStream keyFileInputStream; - - /** This is the instance of java google storage library */ - private Storage storage; - - /** This is the instance of App Engine memcache service java library */ - private MemcacheService syncCache = MemcacheServiceFactory.getMemcacheService(); - - /** GCS Test Report Bucket instance */ - private Bucket vtsReportBucket; - - /** GCS Infra Log Bucket instance */ - private Bucket vtsInfraLogBucket; - - @Override - public void init(ServletConfig cfg) throws ServletException { - super.init(cfg); - - GCS_KEY_FILE = systemConfigProp.getProperty("gcs.keyFile"); - GCS_BUCKET_NAME = systemConfigProp.getProperty("gcs.bucketName"); - GCS_INFRA_LOG_BUCKET_NAME = systemConfigProp.getProperty("gcs.infraLogBucketName"); - - String keyFilePath = "keys/" + GCS_KEY_FILE; - - byte[] keyFileByteArray = new byte[0]; - try { - keyFileByteArray = - IOUtils.toByteArray( - this.getClass().getClassLoader().getResourceAsStream(keyFilePath)); - } catch (IOException e) { - e.printStackTrace(); - } - this.keyFileInputStream = new ByteArrayInputStream(keyFileByteArray); - InputStream vtsReportInputStream = new ByteArrayInputStream(keyFileByteArray); - InputStream vtsInfraInputStream = new ByteArrayInputStream(keyFileByteArray); - - Optional<Storage> optionalVtsReportStorage = GcsHelper.getStorage(vtsReportInputStream); - if (optionalVtsReportStorage.isPresent()) { - this.storage = optionalVtsReportStorage.get(); - this.vtsReportBucket = storage.get(GCS_BUCKET_NAME); - } else { - logger.log(Level.SEVERE, "Error on getting storage instance!"); - throw new ServletException("Creating storage instance exception!"); - } - - Optional<Storage> optionalVtsInfraStorage = GcsHelper.getStorage(vtsInfraInputStream); - if (optionalVtsInfraStorage.isPresent()) { - this.storage = optionalVtsInfraStorage.get(); - this.vtsInfraLogBucket = storage.get(GCS_INFRA_LOG_BUCKET_NAME); - } else { - logger.log(Level.SEVERE, "Error on getting storage instance!"); - throw new ServletException("Creating storage instance exception!"); - } - syncCache.setErrorHandler(ErrorHandlers.getConsistentLogAndContinue(Level.INFO)); - } - - @Override - public PageType getNavParentType() { - return PageType.TOT; - } - - @Override - public List<Page> getBreadcrumbLinks(HttpServletRequest request) { - return null; - } - - @Override - public void doGetHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - if (keyFileInputStream == null) { - request.setAttribute("error_title", "GCS Key file Error"); - request.setAttribute("error_message", "The GCS Key file is not existed!"); - RequestDispatcher dispatcher = request.getRequestDispatcher(ERROR_MESSAGE_JSP); - try { - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Excpetion caught : ", e); - } - } else { - String pathInfo = request.getPathInfo(); - if (Objects.nonNull(pathInfo)) { - if (pathInfo.equalsIgnoreCase("/download")) { - downloadHandler(request, response); - } else { - logger.log(Level.INFO, "Path Info => " + pathInfo); - logger.log(Level.WARNING, "Unknown path access!"); - } - } else { - defaultHandler(request, response); - } - } - } - - private void downloadHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - String file = request.getParameter("file") == null ? "/" : request.getParameter("file"); - Path filePathInfo = Paths.get(file); - - Blob blobFile = vtsInfraLogBucket.get(filePathInfo.toString()); - - if (blobFile.exists()) { - response.setContentType("application/octet-stream"); - response.setContentLength(blobFile.getSize().intValue()); - response.setHeader( - "Content-Disposition", - "attachment; filename=\"" + filePathInfo.getFileName() + "\""); - - response.getOutputStream().write(blobFile.getContent()); - } else { - request.setAttribute("error_title", "Infra Log File Not Found"); - request.setAttribute("error_message", "Please contact the administrator!"); - RequestDispatcher dispatcher = request.getRequestDispatcher(ERROR_MESSAGE_JSP); - try { - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Excpetion caught : ", e); - } - } - } - - private void defaultHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - - String action = - request.getParameter("action") == null ? "read" : request.getParameter("action"); - String path = request.getParameter("path") == null ? "/" : request.getParameter("path"); - String entry = request.getParameter("entry") == null ? "" : request.getParameter("entry"); - Path pathInfo = Paths.get(path); - - List<String> dirList = new ArrayList<>(); - List<String> fileList = new ArrayList<>(); - List<String> entryList = new ArrayList<>(); - Map<String, Object> resultMap = new HashMap<>(); - String entryContent = ""; - - if (pathInfo.toString().endsWith(".zip")) { - - Blob blobFile = (Blob) this.syncCache.get(path.toString()); - if (blobFile == null) { - blobFile = vtsReportBucket.get(path); - this.syncCache.put(path.toString(), blobFile); - } - - if (action.equalsIgnoreCase("read")) { - InputStream blobInputStream = new ByteArrayInputStream(blobFile.getContent()); - ZipInputStream zipInputStream = new ZipInputStream(blobInputStream); - - ZipEntry zipEntry; - while ((zipEntry = zipInputStream.getNextEntry()) != null) { - if (zipEntry.isDirectory()) { - - } else { - if (entry.length() > 0) { - logger.log(Level.INFO, "param entry => " + entry); - if (zipEntry.getName().equals(entry)) { - logger.log(Level.INFO, "matched !!!! " + zipEntry.getName()); - entryContent = - IOUtils.toString( - zipInputStream, StandardCharsets.UTF_8.name()); - } - } else { - entryList.add(zipEntry.getName()); - } - } - } - resultMap.put("entryList", entryList); - resultMap.put("entryContent", entryContent); - - String json = new Gson().toJson(resultMap); - response.setContentType("application/json"); - response.setCharacterEncoding("UTF-8"); - response.getWriter().write(json); - } else { - response.setContentType("application/octet-stream"); - response.setContentLength(blobFile.getSize().intValue()); - response.setHeader( - "Content-Disposition", - "attachment; filename=\"" + pathInfo.getFileName() + "\""); - - response.getOutputStream().write(blobFile.getContent()); - } - - } else { - - logger.log(Level.INFO, "path info => " + pathInfo); - logger.log(Level.INFO, "path name count => " + pathInfo.getNameCount()); - - BlobListOption[] listOptions; - if (pathInfo.getNameCount() == 0) { - listOptions = new BlobListOption[] {BlobListOption.currentDirectory()}; - } else { - String prefixPathString = path.endsWith("/") ? path : path.concat("/"); - if (pathInfo.getNameCount() <= 1) { - dirList.add("/"); - } else { - dirList.add(getParentDirPath(prefixPathString)); - } - - listOptions = - new BlobListOption[] { - BlobListOption.currentDirectory(), - BlobListOption.prefix(prefixPathString) - }; - } - - Iterable<Blob> blobIterable = vtsReportBucket.list(listOptions).iterateAll(); - Iterator<Blob> blobIterator = blobIterable.iterator(); - while (blobIterator.hasNext()) { - Blob blob = blobIterator.next(); - logger.log(Level.INFO, "blob name => " + blob); - if (blob.isDirectory()) { - logger.log(Level.INFO, "directory name => " + blob.getName()); - dirList.add(blob.getName()); - } else { - logger.log(Level.INFO, "file name => " + blob.getName()); - fileList.add(Paths.get(blob.getName()).getFileName().toString()); - } - } - - response.setStatus(HttpServletResponse.SC_OK); - request.setAttribute("entryList", entryList); - request.setAttribute("dirList", dirList); - request.setAttribute("fileList", fileList); - request.setAttribute("path", path); - RequestDispatcher dispatcher = request.getRequestDispatcher(GCS_LOG_JSP); - try { - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Excpetion caught : ", e); - } - } - } - - private String getParentDirPath(String fileOrDirPath) { - boolean endsWithSlashCheck = fileOrDirPath.endsWith(File.separator); - return fileOrDirPath.substring( - 0, - fileOrDirPath.lastIndexOf( - File.separatorChar, - endsWithSlashCheck - ? fileOrDirPath.length() - 2 - : fileOrDirPath.length() - 1)); - } -} diff --git a/src/main/java/com/android/vts/servlet/ShowGraphServlet.java b/src/main/java/com/android/vts/servlet/ShowGraphServlet.java deleted file mode 100644 index 22b7098..0000000 --- a/src/main/java/com/android/vts/servlet/ShowGraphServlet.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (c) 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.servlet; - -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.ProfilingPointRunEntity; -import com.android.vts.entity.TestEntity; -import com.android.vts.entity.TestRunEntity; -import com.android.vts.util.DatastoreHelper; -import com.android.vts.util.FilterUtil; -import com.android.vts.util.Graph; -import com.android.vts.util.GraphSerializer; -import com.android.vts.util.Histogram; -import com.android.vts.util.LineGraph; -import com.android.vts.util.PerformanceUtil; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.datastore.Query.Filter; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.apache.commons.lang.StringUtils; - -/** Servlet for handling requests to load graphs. */ -public class ShowGraphServlet extends BaseServlet { - private static final String GRAPH_JSP = "WEB-INF/jsp/show_graph.jsp"; - private static final long DEFAULT_FILTER_OPTION = -1; - - private static final String HIDL_HAL_OPTION = "hidl_hal_mode"; - private static final String[] splitKeysArray = new String[] {HIDL_HAL_OPTION}; - private static final Set<String> splitKeySet = new HashSet<>(Arrays.asList(splitKeysArray)); - private static final String PROFILING_DATA_ALERT = "No profiling data was found."; - - @Override - public PageType getNavParentType() { - return PageType.TOT; - } - - @Override - public List<Page> getBreadcrumbLinks(HttpServletRequest request) { - List<Page> links = new ArrayList<>(); - String testName = request.getParameter("testName"); - links.add(new Page(PageType.TABLE, testName, "?testName=" + testName)); - - String profilingPointName = request.getParameter("profilingPoint"); - links.add( - new Page( - PageType.GRAPH, - "?testName=" + testName + "&profilingPoint=" + profilingPointName)); - return links; - } - - /** - * Process a profiling report message and add it to the map of graphs. - * - * @param profilingRun The Entity of a profiling point run to process. - * @param idString The ID derived from the test run to identify the profiling report. - * @param graphMap A map from graph name to Graph object. - */ - private static void processProfilingRun( - Entity profilingRun, String idString, Map<String, Graph> graphMap) { - ProfilingPointRunEntity pt = ProfilingPointRunEntity.fromEntity(profilingRun); - if (pt == null) return; - String name = PerformanceUtil.getOptionAlias(pt, splitKeySet); - Graph g = null; - if (pt.getLabels() != null && pt.getLabels().size() == pt.getValues().size()) { - g = new LineGraph(name); - } else if (pt.getLabels() == null && pt.getValues().size() > 0) { - g = new Histogram(name); - } else { - return; - } - if (!graphMap.containsKey(name)) { - graphMap.put(name, g); - } - graphMap.get(name).addData(idString, pt); - } - - /** - * Get a summary string describing the devices in the test run. - * - * @param devices The list of device descriptors for a particular test run. - * @return A string describing the devices in the test run. - */ - private static String getDeviceSummary(List<DeviceInfoEntity> devices) { - if (devices == null) return null; - List<String> buildInfos = new ArrayList<>(); - for (DeviceInfoEntity device : devices) { - buildInfos.add(device.getProduct() + " (" + device.getBuildId() + ")"); - } - return StringUtils.join(buildInfos, ", "); - } - - @Override - public void doGetHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - RequestDispatcher dispatcher = null; - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - String testName = request.getParameter("testName"); - String profilingPointName = request.getParameter("profilingPoint"); - String selectedDevice = request.getParameter("device"); - Long endTime = null; - if (request.getParameter("endTime") != null) { - String time = request.getParameter("endTime"); - try { - endTime = Long.parseLong(time); - } catch (NumberFormatException e) { - } - } - if (endTime == null) { - endTime = TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()); - } - Long startTime = endTime - TimeUnit.DAYS.toMicros(1); - - // Set of device names - List<String> devices = DatastoreHelper.getAllBuildFlavors(); - if (!devices.contains(selectedDevice)) selectedDevice = null; - - Map<String, Graph> graphMap = new HashMap<>(); - - // Create a query for test runs matching the time window filter - Key parentKey = KeyFactory.createKey(TestEntity.KIND, testName); - Filter timeFilter = - FilterUtil.getTimeFilter(parentKey, TestRunEntity.KIND, startTime, endTime); - Query testRunQuery = - new Query(TestRunEntity.KIND) - .setAncestor(parentKey) - .setFilter(timeFilter) - .setKeysOnly(); - - // Process the test runs in the query - List<Key> gets = new ArrayList<>(); - for (Entity testRun : - datastore - .prepare(testRunQuery) - .asIterable(DatastoreHelper.getLargeBatchOptions())) { - gets.add( - KeyFactory.createKey( - testRun.getKey(), ProfilingPointRunEntity.KIND, profilingPointName)); - } - Map<Key, Entity> profilingPoints = datastore.get(gets); - Map<Key, Entity> testRunProfiling = new HashMap<>(); - for (Key key : profilingPoints.keySet()) { - testRunProfiling.put(key.getParent(), profilingPoints.get(key)); - } - - Filter deviceFilter = - FilterUtil.getDeviceTimeFilter(parentKey, TestRunEntity.KIND, startTime, endTime); - if (selectedDevice != null) { - deviceFilter = - Query.CompositeFilterOperator.and( - deviceFilter, - new Query.FilterPredicate( - DeviceInfoEntity.BUILD_FLAVOR, - Query.FilterOperator.EQUAL, - selectedDevice)); - } - Query deviceQuery = - new Query(DeviceInfoEntity.KIND) - .setAncestor(parentKey) - .setFilter(deviceFilter) - .setKeysOnly(); - gets = new ArrayList<>(); - for (Entity device : - datastore.prepare(deviceQuery).asIterable(DatastoreHelper.getLargeBatchOptions())) { - if (testRunProfiling.containsKey(device.getParent())) { - gets.add(device.getKey()); - } - } - - Map<Key, Entity> deviceInfos = datastore.get(gets); - Map<Key, List<DeviceInfoEntity>> testRunDevices = new HashMap<>(); - for (Key deviceKey : deviceInfos.keySet()) { - if (!testRunDevices.containsKey(deviceKey.getParent())) { - testRunDevices.put(deviceKey.getParent(), new ArrayList<DeviceInfoEntity>()); - } - DeviceInfoEntity device = DeviceInfoEntity.fromEntity(deviceInfos.get(deviceKey)); - if (device == null) continue; - testRunDevices.get(deviceKey.getParent()).add(device); - } - - for (Key runKey : testRunProfiling.keySet()) { - String idString = getDeviceSummary(testRunDevices.get(runKey)); - if (idString != null) { - processProfilingRun(testRunProfiling.get(runKey), idString, graphMap); - } - } - - // Get the names of the graphs to render - String[] names = graphMap.keySet().toArray(new String[graphMap.size()]); - Arrays.sort(names); - - List<Graph> graphList = new ArrayList<>(); - boolean hasHistogram = false; - for (String name : names) { - Graph g = graphMap.get(name); - if (g.size() > 0) { - graphList.add(g); - if (g instanceof Histogram) hasHistogram = true; - } - } - - String filterVal = request.getParameter("filterVal"); - try { - Long.parseLong(filterVal); - } catch (NumberFormatException e) { - filterVal = Long.toString(DEFAULT_FILTER_OPTION); - } - request.setAttribute("testName", request.getParameter("testName")); - request.setAttribute("filterVal", filterVal); - request.setAttribute("endTime", new Gson().toJson(endTime)); - request.setAttribute("devices", devices); - request.setAttribute("selectedDevice", selectedDevice); - request.setAttribute("showFilterDropdown", hasHistogram); - if (graphList.size() == 0) request.setAttribute("error", PROFILING_DATA_ALERT); - - Gson gson = - new GsonBuilder() - .registerTypeHierarchyAdapter(Graph.class, new GraphSerializer()) - .create(); - request.setAttribute("graphs", gson.toJson(graphList)); - - request.setAttribute("profilingPointName", profilingPointName); - dispatcher = request.getRequestDispatcher(GRAPH_JSP); - try { - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Excpetion caught : ", e); - } - } -} diff --git a/src/main/java/com/android/vts/servlet/ShowGreenReleaseServlet.java b/src/main/java/com/android/vts/servlet/ShowGreenReleaseServlet.java deleted file mode 100644 index 7fad9a2..0000000 --- a/src/main/java/com/android/vts/servlet/ShowGreenReleaseServlet.java +++ /dev/null @@ -1,502 +0,0 @@ -/* - * Copyright (c) 2018 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.servlet; - -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.TestPlanEntity; -import com.android.vts.entity.TestPlanRunEntity; -import com.android.vts.entity.TestSuiteResultEntity; -import com.android.vts.util.FilterUtil; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.PropertyProjection; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.datastore.Query.Filter; -import com.google.appengine.api.datastore.Query.SortDirection; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -import java.util.Arrays; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Comparator; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; - -import java.util.logging.Level; -import java.util.stream.Collectors; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -public class ShowGreenReleaseServlet extends BaseServlet { - private static final int MAX_RUNS_PER_PAGE = 9999; - - /** Helper class for displaying each device build info on the green build page. */ - public class DeviceBuildInfo implements Comparable<DeviceBuildInfo>, Cloneable { - - /** Device model name ex) marlin, walleye */ - private String deviceBuildTarget; - /** Candidate Build ID */ - private String candidateBuildId; - /** Candidate Build ID Timestamp for url parameter */ - private Long candidateBuildIdTimestamp; - /** Green Build ID */ - private String greenBuildId; - /** Green Build ID Timestamp for url parameter */ - private Long greenBuildIdTimestamp; - - /** - * Device Build Info constructor. - * - * @param deviceBuildTarget The key of the test. - * @param candidateBuildId The number of tests failing. - */ - public DeviceBuildInfo(String deviceBuildTarget, String candidateBuildId) { - this.deviceBuildTarget = deviceBuildTarget; - this.candidateBuildId = candidateBuildId; - this.candidateBuildIdTimestamp = 0L; - this.greenBuildId = "N/A"; - this.greenBuildIdTimestamp = 0L; - } - - /** - * Get the device name. - * - * @return The device name. - */ - public String getDeviceBuildTarget() { - return this.deviceBuildTarget; - } - - /** - * Get the candidate build ID. - * - * @return The candidate build ID. - */ - public String getCandidateBuildId() { - return this.candidateBuildId; - } - - /** Set the candidate build ID. */ - public void setCandidateBuildId(String candidateBuildId) { - this.candidateBuildId = candidateBuildId; - } - - /** - * Get the candidate build ID timestamp. - * - * @return The candidate build ID timestamp. - */ - public Long getCandidateBuildIdTimestamp() { - return this.candidateBuildIdTimestamp; - } - - /** Set the candidate build ID timestamp. */ - public void setCandidateBuildIdTimestamp(Long candidateBuildIdTimestamp) { - this.candidateBuildIdTimestamp = candidateBuildIdTimestamp; - } - - /** - * Get the green build ID. - * - * @return The green build ID. - */ - public String getGreenBuildId() { - return this.greenBuildId; - } - - /** Set the green build ID. */ - public void setGreenBuildId(String greenBuildId) { - this.greenBuildId = greenBuildId; - } - - /** - * Get the candidate build ID timestamp. - * - * @return The candidate build ID timestamp. - */ - public Long getGreenBuildIdTimestamp() { - return this.greenBuildIdTimestamp; - } - - /** Set the candidate build ID timestamp. */ - public void setGreenBuildIdTimestamp(Long greenBuildIdTimestamp) { - this.greenBuildIdTimestamp = greenBuildIdTimestamp; - } - - @Override - public int compareTo(DeviceBuildInfo deviceBuildInfo) { - return this.deviceBuildTarget.compareTo(deviceBuildInfo.getDeviceBuildTarget()); - } - - @Override - protected Object clone() throws CloneNotSupportedException { - return super.clone(); - } - } - - @Override - public PageType getNavParentType() { - return PageType.RELEASE; - } - - @Override - public List<Page> getBreadcrumbLinks(HttpServletRequest request) { - List<Page> links = new ArrayList<>(); - String planName = request.getParameter("plan"); - links.add(new Page(PageType.PLAN_RELEASE, planName, "?plan=" + planName)); - return links; - } - - // This function will build and return basic parameter HashMap based on parameter information - // and - // this value will also be used on green build page to show the basic structure. - private Map<String, List<DeviceBuildInfo>> getBasicParamMap(Map<String, List<String>> param) { - Map<String, List<DeviceBuildInfo>> basicParamMap = new HashMap<>(); - param.forEach( - (branch, buildTargetList) -> { - List<DeviceBuildInfo> deviceBuildTargetList = new ArrayList<>(); - buildTargetList.forEach( - buildTargetName -> { - deviceBuildTargetList.add( - new DeviceBuildInfo(buildTargetName, "N/A")); - }); - basicParamMap.put(branch, deviceBuildTargetList); - }); - return basicParamMap; - } - - @Override - public void doGetHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - - String testType = - request.getParameter("type") == null ? "plan" : request.getParameter("type"); - - RequestDispatcher dispatcher; - if (testType.equalsIgnoreCase("plan")) { - dispatcher = this.getTestPlanDispatcher(request, response); - } else { - dispatcher = this.getTestSuiteDispatcher(request, response); - } - - try { - request.setAttribute("testType", testType); - response.setStatus(HttpServletResponse.SC_OK); - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Exception caught : ", e); - } - } - - private RequestDispatcher getTestPlanDispatcher( - HttpServletRequest request, HttpServletResponse response) { - String GREEN_RELEASE_JSP = "WEB-INF/jsp/show_green_plan_release.jsp"; - - String testPlan = request.getParameter("plan"); - - Calendar cal = Calendar.getInstance(); - cal.add(Calendar.DATE, -7); - Long startTime = cal.getTime().getTime() * 1000; - Long endTime = Calendar.getInstance().getTime().getTime() * 1000; - - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - - Query deviceInfoQuery = - new Query(DeviceInfoEntity.KIND) - .setAncestor(KeyFactory.createKey(TestPlanEntity.KIND, testPlan)) - .addProjection( - new PropertyProjection(DeviceInfoEntity.BRANCH, String.class)) - .addProjection( - new PropertyProjection(DeviceInfoEntity.BUILD_FLAVOR, String.class)) - .setDistinct(true); - - Map<String, List<String>> paramInfoMap = new HashMap<>(); - for (Entity entity : datastore.prepare(deviceInfoQuery).asIterable()) { - String branch = entity.getProperty(DeviceInfoEntity.BRANCH).toString(); - String target = entity.getProperty(DeviceInfoEntity.BUILD_FLAVOR).toString(); - if (paramInfoMap.containsKey(branch)) { - paramInfoMap.get(branch).add(target); - } else { - paramInfoMap.put(branch, new LinkedList<>(Arrays.asList(target))); - } - } - - Map<String, List<DeviceBuildInfo>> baseParamMap = getBasicParamMap(paramInfoMap); - baseParamMap.forEach( - (branchKey, deviceBuildInfoList) -> { - List<List<String>> allPassIdLists = new ArrayList<>(); - Map<String, List<TestPlanRunEntity>> allTestPlanRunEntityMap = new HashMap<>(); - deviceBuildInfoList.forEach( - deviceBuildInfo -> { - Map<String, String[]> paramMap = - new HashMap<String, String[]>() { - { - put("branch", new String[] {branchKey}); - put( - "device", - new String[] { - deviceBuildInfo.getDeviceBuildTarget() - }); - } - }; - - SortDirection dir = SortDirection.DESCENDING; - - boolean unfiltered = false; - boolean showPresubmit = false; - boolean showPostsubmit = true; - Filter typeFilter = - FilterUtil.getTestTypeFilter( - showPresubmit, showPostsubmit, unfiltered); - Key testPlanKey = - KeyFactory.createKey(TestPlanEntity.KIND, testPlan); - Filter testPlanRunFilter = - FilterUtil.getTimeFilter( - testPlanKey, - TestPlanRunEntity.KIND, - startTime, - endTime, - typeFilter); - - List<Filter> userTestFilters = - FilterUtil.getUserTestFilters(paramMap); - userTestFilters.add(0, testPlanRunFilter); - Filter userDeviceFilter = FilterUtil.getUserDeviceFilter(paramMap); - - List<Key> matchingKeyList = - FilterUtil.getMatchingKeys( - testPlanKey, - TestPlanRunEntity.KIND, - userTestFilters, - userDeviceFilter, - dir, - MAX_RUNS_PER_PAGE); - - logger.log( - Level.INFO, - "the number of matching key => " + matchingKeyList.size()); - if (matchingKeyList.size() > 0) { - Map<Key, Entity> entityMap = datastore.get(matchingKeyList); - - List<TestPlanRunEntity> testPlanRunEntityList = - entityMap - .values() - .stream() - .map( - entity -> - TestPlanRunEntity.fromEntity( - entity)) - .collect(Collectors.toList()); - - allTestPlanRunEntityMap.put( - branchKey - + "-" - + deviceBuildInfo.getDeviceBuildTarget(), - testPlanRunEntityList); - - // The passBuildIdList containing all passed buildId List for - // device - List<String> passBuildIdList = - testPlanRunEntityList - .stream() - .filter(entity -> entity.getFailCount() == 0L) - .map(entity -> entity.getTestBuildId()) - .collect(Collectors.toList()); - allPassIdLists.add(passBuildIdList); - logger.log(Level.INFO, "passBuildIdList => " + passBuildIdList); - - // The logic for candidate build ID is starting from here - Comparator<TestPlanRunEntity> byPassing = - Comparator.comparingLong( - elemFirst -> elemFirst.getPassCount()); - - Comparator<TestPlanRunEntity> byNonPassing = - Comparator.comparingLong( - elemFirst -> elemFirst.getFailCount()); - - // This will get the TestPlanRunEntity having maximum number of - // passing and minimum number of fail - Optional<TestPlanRunEntity> testPlanRunEntity = - testPlanRunEntityList - .stream() - .sorted( - byPassing - .reversed() - .thenComparing(byNonPassing)) - .findFirst(); - - String buildId = - testPlanRunEntity - .map(entity -> entity.getTestBuildId()) - .orElse(""); - deviceBuildInfo.setCandidateBuildId(buildId); - Long buildIdTimestamp = - testPlanRunEntity - .map( - entity -> { - return entity.getStartTimestamp(); - }) - .orElse(0L); - deviceBuildInfo.setCandidateBuildIdTimestamp(buildIdTimestamp); - } else { - allPassIdLists.add(new ArrayList<>()); - deviceBuildInfo.setCandidateBuildId("No Test Results"); - } - }); - Set<String> greenBuildIdList = FilterUtil.getCommonElements(allPassIdLists); - if (greenBuildIdList.size() > 0) { - String greenBuildId = greenBuildIdList.iterator().next(); - deviceBuildInfoList.forEach( - deviceBuildInfo -> { - // This is to get the timestamp for greenBuildId - Optional<TestPlanRunEntity> testPlanRunEntity = - allTestPlanRunEntityMap - .get( - branchKey - + "-" - + deviceBuildInfo - .getDeviceBuildTarget()) - .stream() - .filter( - entity -> - entity.getFailCount() == 0L - && entity.getTestBuildId() - .equalsIgnoreCase( - greenBuildId)) - .findFirst(); - // Setting the greenBuildId value and timestamp to - // deviceBuildInfo object - deviceBuildInfo.setGreenBuildId(greenBuildId); - Long buildIdTimestamp = - testPlanRunEntity - .map(entity -> entity.getStartTimestamp()) - .orElse(0L); - deviceBuildInfo.setGreenBuildIdTimestamp(buildIdTimestamp); - }); - } - }); - - request.setAttribute("plan", request.getParameter("plan")); - request.setAttribute("greenBuildInfo", baseParamMap); - RequestDispatcher dispatcher = request.getRequestDispatcher(GREEN_RELEASE_JSP); - return dispatcher; - } - - private RequestDispatcher getTestSuiteDispatcher( - HttpServletRequest request, HttpServletResponse response) { - String GREEN_RELEASE_JSP = "WEB-INF/jsp/show_green_suite_release.jsp"; - - String testPlan = request.getParameter("plan"); - - List<TestSuiteResultEntity> branchTargetInfoList = - ofy().load() - .type(TestSuiteResultEntity.class) - .filter("suitePlan", testPlan) - .project("branch") - .distinct(true) - .project("target") - .distinct(true) - .list(); - - Map<String, List<String>> paramInfoMap = new HashMap<>(); - for (TestSuiteResultEntity testSuiteResultEntity : branchTargetInfoList) { - String branch = testSuiteResultEntity.getBranch(); - String target = testSuiteResultEntity.getTarget(); - if (paramInfoMap.containsKey(branch)) { - paramInfoMap.get(branch).add(target); - } else { - paramInfoMap.put(branch, new LinkedList<>(Arrays.asList(target))); - } - } - - Calendar cal = Calendar.getInstance(); - cal.add(Calendar.DATE, -7); - Long oneWeekAgoTimestamp = cal.getTime().getTime() * 1000; - - Map<String, List<DeviceBuildInfo>> baseParamMap = getBasicParamMap(paramInfoMap); - baseParamMap.forEach( - (branchKey, deviceBuildInfoList) -> { - List<List<String>> allPassIdLists = new ArrayList<>(); - - deviceBuildInfoList.forEach( - deviceBuildInfo -> { - List<String> passBuildIdList = - ofy().load() - .type(TestSuiteResultEntity.class) - .filter("suitePlan", testPlan) - .filter("branch", branchKey) - .filter( - "target", - deviceBuildInfo.getDeviceBuildTarget()) - .filter("failedTestCaseCount", 0) - .filterKey( - ">=", - com.googlecode.objectify.Key.create( - TestSuiteResultEntity.class, - oneWeekAgoTimestamp)) - .project("buildId") - .list() - .stream() - .map(entity -> entity.getBuildId()) - .collect(Collectors.toList()); - allPassIdLists.add(passBuildIdList); - - TestSuiteResultEntity candidateIdEntity = - ofy().load() - .type(TestSuiteResultEntity.class) - .filter("suitePlan", testPlan) - .filter("branch", branchKey) - .filter( - "target", - deviceBuildInfo.getDeviceBuildTarget()) - .filterKey( - ">=", - com.googlecode.objectify.Key.create( - TestSuiteResultEntity.class, - oneWeekAgoTimestamp)) - .project("buildId") - .order("__key__") - .order("-passedTestCaseRatio") - .first() - .now(); - if (candidateIdEntity == null) { - deviceBuildInfo.setCandidateBuildId("N/A"); - } else { - deviceBuildInfo.setCandidateBuildId( - candidateIdEntity.getBuildId()); - } - }); - }); - - request.setAttribute("plan", request.getParameter("plan")); - request.setAttribute("greenBuildInfo", baseParamMap); - RequestDispatcher dispatcher = request.getRequestDispatcher(GREEN_RELEASE_JSP); - return dispatcher; - } -} diff --git a/src/main/java/com/android/vts/servlet/ShowPerformanceDigestServlet.java b/src/main/java/com/android/vts/servlet/ShowPerformanceDigestServlet.java deleted file mode 100644 index 5a70738..0000000 --- a/src/main/java/com/android/vts/servlet/ShowPerformanceDigestServlet.java +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright (c) 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.servlet; - -import com.android.vts.util.DatastoreHelper; -import com.android.vts.util.PerformanceSummary; -import com.android.vts.util.PerformanceUtil; -import com.android.vts.util.ProfilingPointSummary; -import com.android.vts.util.StatSummary; -import java.io.IOException; -import java.math.RoundingMode; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** Servlet for producing tabular performance summaries. */ -public class ShowPerformanceDigestServlet extends BaseServlet { - private static final String PERF_DIGEST_JSP = "WEB-INF/jsp/show_performance_digest.jsp"; - - private static final String MEAN = "Mean"; - private static final String MIN = "Min"; - private static final String MAX = "Max"; - private static final String MEAN_DELTA = "ΔMean (%)"; - private static final String HIGHER_IS_BETTER = - "Note: Higher values are better. Maximum is the best-case performance."; - private static final String LOWER_IS_BETTER = - "Note: Lower values are better. Minimum is the best-case performance."; - private static final String STD = "Std"; - - private static final DecimalFormat FORMATTER; - - /** Initialize the decimal formatter. */ - static { - FORMATTER = new DecimalFormat("#.##"); - FORMATTER.setRoundingMode(RoundingMode.HALF_UP); - } - - @Override - public PageType getNavParentType() { - return PageType.TOT; - } - - @Override - public List<Page> getBreadcrumbLinks(HttpServletRequest request) { - List<Page> links = new ArrayList<>(); - String testName = request.getParameter("testName"); - links.add(new Page(PageType.TABLE, testName, "?testName=" + testName)); - links.add(new Page(PageType.PERFORMANCE_DIGEST, "?testName=" + testName)); - return links; - } - - /** - * Generates an HTML summary of the performance changes for the profiling results in the - * specified table. - * - * <p>Retrieves the past 24 hours of profiling data and compares it to the 24 hours that - * preceded it. Creates a table representation of the mean and standard deviation for each - * profiling point. When performance degrades, the cell is shaded red. - * - * @param profilingPoint The name of the profiling point to summarize. - * @param testSummary The ProfilingPointSummary object to compare against. - * @param perfSummaries List of PerformanceSummary objects for each profiling run (in reverse - * chronological order). - * @param sectionLabels HTML string for the section labels (i.e. for each time interval). - * @returns An HTML string for a table comparing the profiling point results across time - * intervals. - */ - public static String getPerformanceSummary( - String profilingPoint, - ProfilingPointSummary testSummary, - List<PerformanceSummary> perfSummaries, - String sectionLabels) { - String tableHTML = "<table>"; - - // Format section labels - tableHTML += "<tr>"; - tableHTML += "<th class='section-label grey lighten-2'>"; - tableHTML += testSummary.yLabel + "</th>"; - tableHTML += sectionLabels; - tableHTML += "</tr>"; - - String bestCaseString; - switch (testSummary.getRegressionMode()) { - case VTS_REGRESSION_MODE_DECREASING: - bestCaseString = MAX; - break; - default: - bestCaseString = MIN; - break; - } - - // Format column labels - tableHTML += "<tr>"; - for (int i = 0; i <= perfSummaries.size() + 1; i++) { - if (i > 1) { - tableHTML += "<th class='section-label grey lighten-2'>" + MEAN_DELTA + "</th>"; - } - if (i == 0) { - tableHTML += "<th class='section-label grey lighten-2'>"; - tableHTML += testSummary.xLabel + "</th>"; - } else if (i > 0) { - tableHTML += "<th class='section-label grey lighten-2'>" + bestCaseString + "</th>"; - tableHTML += "<th class='section-label grey lighten-2'>" + MEAN + "</th>"; - tableHTML += "<th class='section-label grey lighten-2'>" + STD + "</th>"; - } - } - tableHTML += "</tr>"; - - // Populate data cells - for (StatSummary stats : testSummary) { - String label = stats.getLabel(); - tableHTML += "<tr><td class='axis-label grey lighten-2'>" + label; - tableHTML += "</td><td class='cell inner-cell'>"; - tableHTML += FORMATTER.format(stats.getBestCase()) + "</td>"; - tableHTML += "<td class='cell inner-cell'>"; - tableHTML += FORMATTER.format(stats.getMean()) + "</td>"; - tableHTML += "<td class='cell outer-cell'>"; - if (stats.getCount() < 2) { - tableHTML += " - </td>"; - } else { - tableHTML += FORMATTER.format(stats.getStd()) + "</td>"; - } - for (PerformanceSummary prevPerformance : perfSummaries) { - if (prevPerformance.hasProfilingPoint(profilingPoint)) { - StatSummary baseline = - prevPerformance - .getProfilingPointSummary(profilingPoint) - .getStatSummary(label); - tableHTML += - PerformanceUtil.getAvgCasePerformanceComparisonHTML( - baseline, stats, "cell inner-cell", "cell outer-cell", "", ""); - } else { - tableHTML += "<td></td><td></td><td></td><td></td>"; - } - } - tableHTML += "</tr>"; - } - tableHTML += "</table>"; - return tableHTML; - } - - @Override - public void doGetHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - RequestDispatcher dispatcher = null; - String testName = request.getParameter("testName"); - String selectedDevice = request.getParameter("device"); - Long startTime = null; - if (request.getParameter("startTime") != null) { - String time = request.getParameter("startTime"); - try { - startTime = Long.parseLong(time); - } catch (NumberFormatException e) { - logger.log(Level.WARNING, "Invalid start time passed to digest servlet: " + time); - } - } - if (startTime == null) { - startTime = TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()); - } - - // Add today to the list of time intervals to analyze - List<PerformanceSummary> summaries = new ArrayList<>(); - PerformanceSummary today = - new PerformanceSummary(startTime - TimeUnit.DAYS.toMicros(1), startTime); - summaries.add(today); - - // Add yesterday as a baseline time interval for analysis - long oneDayAgo = startTime - TimeUnit.DAYS.toMicros(1); - PerformanceSummary yesterday = - new PerformanceSummary(oneDayAgo - TimeUnit.DAYS.toMicros(1), oneDayAgo); - summaries.add(yesterday); - - // Add last week as a baseline time interval for analysis - long oneWeek = TimeUnit.DAYS.toMicros(7); - long oneWeekAgo = startTime - oneWeek; - String spanString = "<span class='date-label'>"; - String label = - spanString + TimeUnit.MICROSECONDS.toMillis(oneWeekAgo - oneWeek) + "</span>"; - label += " - " + spanString + TimeUnit.MICROSECONDS.toMillis(oneWeekAgo) + "</span>"; - PerformanceSummary lastWeek = - new PerformanceSummary(oneWeekAgo - oneWeek, oneWeekAgo, label); - summaries.add(lastWeek); - PerformanceUtil.updatePerformanceSummary( - testName, oneWeekAgo - oneWeek, startTime, selectedDevice, summaries); - - int colCount = 0; - String sectionLabels = ""; - List<PerformanceSummary> nonEmptySummaries = new ArrayList<>(); - for (PerformanceSummary perfSummary : summaries) { - if (perfSummary.size() == 0) continue; - - nonEmptySummaries.add(perfSummary); - String content = perfSummary.label; - sectionLabels += "<th class='section-label grey lighten-2 center' "; - if (colCount++ == 0) sectionLabels += "colspan='3'"; - else sectionLabels += "colspan='4'"; - sectionLabels += ">" + content + "</th>"; - } - - List<String> tables = new ArrayList<>(); - List<String> tableTitles = new ArrayList<>(); - List<String> tableSubtitles = new ArrayList<>(); - if (nonEmptySummaries.size() != 0) { - PerformanceSummary todayPerformance = nonEmptySummaries.remove(0); - String[] profilingNames = todayPerformance.getProfilingPointNames(); - - for (String profilingPointName : profilingNames) { - ProfilingPointSummary baselinePerformance = - todayPerformance.getProfilingPointSummary(profilingPointName); - String table = - getPerformanceSummary( - profilingPointName, - baselinePerformance, - nonEmptySummaries, - sectionLabels); - if (table != null) { - tables.add(table); - tableTitles.add(profilingPointName); - switch (baselinePerformance.getRegressionMode()) { - case VTS_REGRESSION_MODE_DECREASING: - tableSubtitles.add(HIGHER_IS_BETTER); - break; - default: - tableSubtitles.add(LOWER_IS_BETTER); - break; - } - } - } - } - - request.setAttribute("testName", testName); - request.setAttribute("tables", tables); - request.setAttribute("tableTitles", tableTitles); - request.setAttribute("tableSubtitles", tableSubtitles); - request.setAttribute("startTime", Long.toString(startTime)); - request.setAttribute("selectedDevice", selectedDevice); - request.setAttribute("devices", DatastoreHelper.getAllBuildFlavors()); - - dispatcher = request.getRequestDispatcher(PERF_DIGEST_JSP); - try { - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Exception caught : " + e.toString()); - } - } -} diff --git a/src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java b/src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java deleted file mode 100644 index 0fa28f2..0000000 --- a/src/main/java/com/android/vts/servlet/ShowPlanReleaseServlet.java +++ /dev/null @@ -1,415 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.servlet; - -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.TestPlanEntity; -import com.android.vts.entity.TestPlanRunEntity; -import com.android.vts.entity.TestSuiteResultEntity; -import com.android.vts.util.DatastoreHelper; -import com.android.vts.util.FilterUtil; -import com.android.vts.util.Pagination; - -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.datastore.Query.Filter; -import com.google.appengine.api.datastore.Query.SortDirection; -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import org.apache.commons.lang.StringUtils; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.logging.Level; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -public class ShowPlanReleaseServlet extends BaseServlet { - private static final int MAX_RUNS_PER_PAGE = 90; - - /** the previous cursor string token list where to start */ - private static final LinkedHashSet<String> pageCountTokenSet = new LinkedHashSet<>(); - - @Override - public PageType getNavParentType() { - return PageType.RELEASE; - } - - @Override - public List<Page> getBreadcrumbLinks(HttpServletRequest request) { - String testType = - request.getParameter("type") == null ? "plan" : request.getParameter("type"); - List<Page> links = new ArrayList<>(); - String planName = request.getParameter("plan"); - if (testType.equals("plan")) { - links.add(new Page(PageType.RELEASE, "TEST PLANS", "?type=" + testType, true)); - links.add(new Page(PageType.PLAN_RELEASE, planName, "?plan=" + planName)); - } else { - links.add(new Page(PageType.RELEASE, "TEST SUITES", "?type=" + testType, true)); - links.add( - new Page( - PageType.PLAN_RELEASE, - planName, - "?plan=" + planName + "&type=" + testType)); - } - return links; - } - - /** Model to describe each test plan run . */ - private class TestPlanRunMetadata implements Comparable<TestPlanRunMetadata> { - public final TestPlanRunEntity testPlanRun; - public final List<String> devices; - public final Set<DeviceInfoEntity> deviceSet; - - public TestPlanRunMetadata(TestPlanRunEntity testPlanRun) { - this.testPlanRun = testPlanRun; - this.devices = new ArrayList<>(); - this.deviceSet = new HashSet<>(); - } - - public void addDevice(DeviceInfoEntity device) { - if (device == null || deviceSet.contains(device)) return; - devices.add( - device.getBranch() - + "/" - + device.getBuildFlavor() - + " (" - + device.getBuildId() - + ")"); - deviceSet.add(device); - } - - public JsonObject toJson() { - JsonObject obj = new JsonObject(); - obj.add("testPlanRun", testPlanRun.toJson()); - obj.add("deviceInfo", new JsonPrimitive(StringUtils.join(devices, ", "))); - return obj; - } - - @Override - public int compareTo(TestPlanRunMetadata o) { - return new Long(o.testPlanRun.getStartTimestamp()) - .compareTo(this.testPlanRun.getStartTimestamp()); - } - } - - @Override - public void doGetHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - String testType = - request.getParameter("type") == null ? "plan" : request.getParameter("type"); - - RequestDispatcher dispatcher; - if (testType.equalsIgnoreCase("plan")) { - dispatcher = this.getTestPlanDispatcher(request, response); - } else { - dispatcher = this.getTestSuiteDispatcher(request, response); - } - - try { - request.setAttribute("testType", testType); - response.setStatus(HttpServletResponse.SC_OK); - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Excpetion caught : ", e); - } - } - - private RequestDispatcher getTestPlanDispatcher( - HttpServletRequest request, HttpServletResponse response) { - String PLAN_RELEASE_JSP = "WEB-INF/jsp/show_plan_release.jsp"; - - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - - Long startTime = null; // time in microseconds - Long endTime = null; // time in microseconds - if (request.getParameter("startTime") != null) { - String time = request.getParameter("startTime"); - try { - startTime = Long.parseLong(time); - startTime = startTime > 0 ? startTime : null; - } catch (NumberFormatException e) { - startTime = null; - } - } - if (request.getParameter("endTime") != null) { - String time = request.getParameter("endTime"); - try { - endTime = Long.parseLong(time); - endTime = endTime > 0 ? endTime : null; - } catch (NumberFormatException e) { - endTime = null; - } - } - SortDirection dir = SortDirection.DESCENDING; - if (startTime != null && endTime == null) { - dir = SortDirection.ASCENDING; - } - boolean unfiltered = request.getParameter("unfiltered") != null; - boolean showPresubmit = request.getParameter("showPresubmit") != null; - boolean showPostsubmit = request.getParameter("showPostsubmit") != null; - // If no params are specified, set to default of postsubmit-only. - if (!(showPresubmit || showPostsubmit)) { - showPostsubmit = true; - } - - // If unfiltered, set showPre- and Post-submit to true for accurate UI. - if (unfiltered) { - showPostsubmit = true; - showPresubmit = true; - } - Filter typeFilter = FilterUtil.getTestTypeFilter(showPresubmit, showPostsubmit, unfiltered); - String testPlan = request.getParameter("plan"); - Key testPlanKey = KeyFactory.createKey(TestPlanEntity.KIND, testPlan); - Filter testPlanRunFilter = - FilterUtil.getTimeFilter( - testPlanKey, TestPlanRunEntity.KIND, startTime, endTime, typeFilter); - Map<String, String[]> parameterMap = request.getParameterMap(); - List<Filter> userTestFilters = FilterUtil.getUserTestFilters(parameterMap); - userTestFilters.add(0, testPlanRunFilter); - Filter userDeviceFilter = FilterUtil.getUserDeviceFilter(parameterMap); - - List<TestPlanRunMetadata> testPlanRuns = new ArrayList<>(); - Map<Key, TestPlanRunMetadata> testPlanMap = new HashMap<>(); - Key minKey = null; - Key maxKey = null; - List<Key> gets = - FilterUtil.getMatchingKeys( - testPlanKey, - TestPlanRunEntity.KIND, - userTestFilters, - userDeviceFilter, - dir, - MAX_RUNS_PER_PAGE); - Map<Key, Entity> entityMap = datastore.get(gets); - logger.log(Level.INFO, "entityMap => " + entityMap); - for (Key key : gets) { - if (!entityMap.containsKey(key)) { - continue; - } - TestPlanRunEntity testPlanRun = TestPlanRunEntity.fromEntity(entityMap.get(key)); - if (testPlanRun == null) { - continue; - } - TestPlanRunMetadata metadata = new TestPlanRunMetadata(testPlanRun); - testPlanRuns.add(metadata); - testPlanMap.put(key, metadata); - if (minKey == null || key.compareTo(minKey) < 0) { - minKey = key; - } - if (maxKey == null || key.compareTo(maxKey) > 0) { - maxKey = key; - } - } - if (minKey != null && maxKey != null) { - Filter deviceFilter = - FilterUtil.getDeviceTimeFilter( - testPlanKey, TestPlanRunEntity.KIND, minKey.getId(), maxKey.getId()); - Query deviceQuery = - new Query(DeviceInfoEntity.KIND) - .setAncestor(testPlanKey) - .setFilter(deviceFilter) - .setKeysOnly(); - List<Key> deviceGets = new ArrayList<>(); - for (Entity device : - datastore - .prepare(deviceQuery) - .asIterable(DatastoreHelper.getLargeBatchOptions())) { - if (testPlanMap.containsKey(device.getParent())) { - deviceGets.add(device.getKey()); - } - } - logger.log(Level.INFO, "deviceGets => " + deviceGets); - Map<Key, Entity> devices = datastore.get(deviceGets); - for (Key key : devices.keySet()) { - if (!testPlanMap.containsKey(key.getParent())) continue; - DeviceInfoEntity device = DeviceInfoEntity.fromEntity(devices.get(key)); - if (device == null) continue; - TestPlanRunMetadata metadata = testPlanMap.get(key.getParent()); - metadata.addDevice(device); - } - } - - testPlanRuns.sort(Comparator.naturalOrder()); - logger.log(Level.INFO, "testPlanRuns => " + testPlanRuns); - - if (testPlanRuns.size() > 0) { - TestPlanRunMetadata firstRun = testPlanRuns.get(0); - endTime = firstRun.testPlanRun.getStartTimestamp(); - - TestPlanRunMetadata lastRun = testPlanRuns.get(testPlanRuns.size() - 1); - startTime = lastRun.testPlanRun.getStartTimestamp(); - } - - List<JsonObject> testPlanRunObjects = new ArrayList<>(); - for (TestPlanRunMetadata metadata : testPlanRuns) { - testPlanRunObjects.add(metadata.toJson()); - } - - FilterUtil.setAttributes(request, parameterMap); - - request.setAttribute("plan", request.getParameter("plan")); - request.setAttribute( - "hasNewer", - new Gson() - .toJson( - DatastoreHelper.hasNewer( - testPlanKey, TestPlanRunEntity.KIND, endTime))); - request.setAttribute( - "hasOlder", - new Gson() - .toJson( - DatastoreHelper.hasOlder( - testPlanKey, TestPlanRunEntity.KIND, startTime))); - request.setAttribute("planRuns", new Gson().toJson(testPlanRunObjects)); - - request.setAttribute("unfiltered", unfiltered); - request.setAttribute("showPresubmit", showPresubmit); - request.setAttribute("showPostsubmit", showPostsubmit); - request.setAttribute("startTime", new Gson().toJson(startTime)); - request.setAttribute("endTime", new Gson().toJson(endTime)); - request.setAttribute("branches", new Gson().toJson(DatastoreHelper.getAllBranches())); - request.setAttribute("devices", new Gson().toJson(DatastoreHelper.getAllBuildFlavors())); - - RequestDispatcher dispatcher = request.getRequestDispatcher(PLAN_RELEASE_JSP); - return dispatcher; - } - - private RequestDispatcher getTestSuiteDispatcher( - HttpServletRequest request, HttpServletResponse response) { - String PLAN_RELEASE_JSP = "WEB-INF/jsp/show_suite_release.jsp"; - - String testPlan = request.getParameter("plan"); - String testCategoryType = - Objects.isNull(request.getParameter("testCategoryType")) - ? "1" - : request.getParameter("testCategoryType"); - int page = - Objects.isNull(request.getParameter("page")) - ? 1 - : Integer.valueOf(request.getParameter("page")); - String nextPageToken = - Objects.isNull(request.getParameter("nextPageToken")) - ? "" - : request.getParameter("nextPageToken"); - - com.googlecode.objectify.cmd.Query<TestSuiteResultEntity> testSuiteResultEntityQuery = - ofy().load() - .type(TestSuiteResultEntity.class) - .filter("suitePlan", testPlan) - .filter(this.getTestTypeFieldName(testCategoryType), true); - - if (Objects.nonNull(request.getParameter("branch"))) { - request.setAttribute("branch", request.getParameter("branch")); - testSuiteResultEntityQuery = - testSuiteResultEntityQuery.filter("branch", request.getParameter("branch")); - } - if (Objects.nonNull(request.getParameter("hostName"))) { - request.setAttribute("hostName", request.getParameter("hostName")); - testSuiteResultEntityQuery = - testSuiteResultEntityQuery.filter("hostName", request.getParameter("hostName")); - } - if (Objects.nonNull(request.getParameter("buildId"))) { - request.setAttribute("buildId", request.getParameter("buildId")); - testSuiteResultEntityQuery = - testSuiteResultEntityQuery.filter("buildId", request.getParameter("buildId")); - } - if (Objects.nonNull(request.getParameter("deviceName"))) { - request.setAttribute("deviceName", request.getParameter("deviceName")); - testSuiteResultEntityQuery = - testSuiteResultEntityQuery.filter( - "deviceName", request.getParameter("deviceName")); - } - testSuiteResultEntityQuery = testSuiteResultEntityQuery.orderKey(true); - - Pagination<TestSuiteResultEntity> testSuiteResultEntityPagination = - new Pagination( - testSuiteResultEntityQuery, - page, - Pagination.DEFAULT_PAGE_SIZE, - nextPageToken, - pageCountTokenSet); - - String nextPageTokenPagination = testSuiteResultEntityPagination.getNextPageCountToken(); - if (!nextPageTokenPagination.trim().isEmpty()) { - this.pageCountTokenSet.add(nextPageTokenPagination); - } - - logger.log(Level.INFO, "pageCountTokenSet => " + pageCountTokenSet); - - logger.log(Level.INFO, "list => " + testSuiteResultEntityPagination.getList()); - logger.log( - Level.INFO, - "next page count token => " - + testSuiteResultEntityPagination.getNextPageCountToken()); - logger.log( - Level.INFO, - "page min range => " + testSuiteResultEntityPagination.getMinPageRange()); - logger.log( - Level.INFO, - "page max range => " + testSuiteResultEntityPagination.getMaxPageRange()); - logger.log(Level.INFO, "page size => " + testSuiteResultEntityPagination.getPageSize()); - logger.log(Level.INFO, "total count => " + testSuiteResultEntityPagination.getTotalCount()); - - request.setAttribute("plan", testPlan); - request.setAttribute("page", page); - request.setAttribute("testType", "suite"); - request.setAttribute("testCategoryType", testCategoryType); - request.setAttribute("testSuiteResultEntityPagination", testSuiteResultEntityPagination); - RequestDispatcher dispatcher = request.getRequestDispatcher(PLAN_RELEASE_JSP); - return dispatcher; - } - - private String getTestTypeFieldName(String testCategoryType) { - String fieldName; - switch (testCategoryType) { - case "1": // TOT - fieldName = "testTypeIndex.TOT"; - break; - case "2": // OTA - fieldName = "testTypeIndex.OTA"; - break; - case "4": // SIGNED - fieldName = "testTypeIndex.SIGNED"; - break; - default: - fieldName = "testTypeIndex.TOT"; - break; - } - return fieldName; - } -} diff --git a/src/main/java/com/android/vts/servlet/ShowPlanRunServlet.java b/src/main/java/com/android/vts/servlet/ShowPlanRunServlet.java deleted file mode 100644 index 9138a90..0000000 --- a/src/main/java/com/android/vts/servlet/ShowPlanRunServlet.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.servlet; - -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.TestPlanEntity; -import com.android.vts.entity.TestPlanRunEntity; -import com.android.vts.entity.TestRunEntity; -import com.android.vts.proto.VtsReportMessage.TestCaseResult; -import com.android.vts.util.TestRunMetadata; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.EntityNotFoundException; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query; -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** Servlet for handling requests to load individual plan runs. */ -public class ShowPlanRunServlet extends BaseServlet { - private static final String PLAN_RUN_JSP = "WEB-INF/jsp/show_plan_run.jsp"; - - @Override - public PageType getNavParentType() { - return PageType.RELEASE; - } - - @Override - public List<Page> getBreadcrumbLinks(HttpServletRequest request) { - List<Page> links = new ArrayList<>(); - String planName = request.getParameter("plan"); - links.add(new Page(PageType.PLAN_RELEASE, planName, "?plan=" + planName)); - - String time = request.getParameter("time"); - links.add(new Page(PageType.PLAN_RUN, "?plan=" + planName + "&time=" + time)); - return links; - } - - @Override - public void doGetHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - Long time = null; // time in microseconds - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - RequestDispatcher dispatcher = null; - - String plan = request.getParameter("plan"); - - if (request.getParameter("time") != null) { - String timeString = request.getParameter("time"); - try { - time = Long.parseLong(timeString); - time = time > 0 ? time : null; - } catch (NumberFormatException e) { - time = null; - } - } - - // Add result names to list - List<String> resultNames = new ArrayList<>(); - for (TestCaseResult r : TestCaseResult.values()) { - resultNames.add(r.name()); - } - - List<JsonObject> passingTestObjects = new ArrayList<>(); - List<JsonObject> failingTestObjects = new ArrayList<>(); - List<JsonObject> testRunObjects = new ArrayList<>(); - - Key planKey = KeyFactory.createKey(TestPlanEntity.KIND, plan); - Key planRunKey = KeyFactory.createKey(planKey, TestPlanRunEntity.KIND, time); - String testBuildId = ""; - int passCount = 0; - int failCount = 0; - 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<Key, Entity> 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.getOldTestRuns()) { - if (!testRuns.containsKey(key)) continue; - TestRunEntity testRunEntity = TestRunEntity.fromEntity(testRuns.get(key)); - if (testRunEntity == null) continue; - Query deviceInfoQuery = new Query(DeviceInfoEntity.KIND).setAncestor(key); - List<DeviceInfoEntity> devices = new ArrayList<>(); - for (Entity device : datastore.prepare(deviceInfoQuery).asIterable()) { - DeviceInfoEntity deviceEntity = DeviceInfoEntity.fromEntity(device); - if (deviceEntity == null) continue; - devices.add(deviceEntity); - } - TestRunMetadata metadata = - new TestRunMetadata(key.getParent().getName(), testRunEntity, devices); - if (metadata.testRun.getFailCount() > 0) { - failingTestObjects.add(metadata.toJson()); - } else { - passingTestObjects.add(metadata.toJson()); - } - } - } catch (EntityNotFoundException e) { - // Invalid parameters - } - testRunObjects.addAll(failingTestObjects); - testRunObjects.addAll(passingTestObjects); - - int[] topBuildResultCounts = new int[TestCaseResult.values().length]; - topBuildResultCounts[TestCaseResult.TEST_CASE_RESULT_PASS.getNumber()] = passCount; - topBuildResultCounts[TestCaseResult.TEST_CASE_RESULT_FAIL.getNumber()] = failCount; - - request.setAttribute("plan", request.getParameter("plan")); - request.setAttribute("time", request.getParameter("time")); - - request.setAttribute("resultNames", resultNames); - request.setAttribute("resultNamesJson", new Gson().toJson(resultNames)); - request.setAttribute("testRuns", new Gson().toJson(testRunObjects)); - request.setAttribute("testBuildId", new Gson().toJson(testBuildId)); - request.setAttribute("startTime", new Gson().toJson(startTime)); - request.setAttribute("endTime", new Gson().toJson(endTime)); - 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)); - - dispatcher = request.getRequestDispatcher(PLAN_RUN_JSP); - try { - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Exception caught : " + e.toString()); - } - } -} diff --git a/src/main/java/com/android/vts/servlet/ShowProfilingListServlet.java b/src/main/java/com/android/vts/servlet/ShowProfilingListServlet.java deleted file mode 100644 index ce138cc..0000000 --- a/src/main/java/com/android/vts/servlet/ShowProfilingListServlet.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.servlet; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -import com.android.vts.entity.TestEntity; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Query; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.logging.Level; -import java.util.stream.Collectors; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Servlet for handling requests to display profiling tests. - */ -public class ShowProfilingListServlet extends BaseServlet { - - private static final String PROFILING_LIST_JSP = "WEB-INF/jsp/show_profiling_list.jsp"; - - @Override - public PageType getNavParentType() { - return PageType.PROFILING_LIST; - } - - @Override - public List<Page> getBreadcrumbLinks(HttpServletRequest request) { - return null; - } - - @Override - public void doGetHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - List<String> tests = ofy().load().type(TestEntity.class) - .filter(TestEntity.HAS_PROFILING_DATA, true).list().stream() - .sorted(Comparator.comparing(TestEntity::getTestName)).map(t -> t.getTestName()) - .collect(Collectors.toList()); - - response.setStatus(HttpServletResponse.SC_OK); - request.setAttribute("testNames", tests); - RequestDispatcher dispatcher = request.getRequestDispatcher(PROFILING_LIST_JSP); - try { - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Excpetion caught : ", e); - } - } -} diff --git a/src/main/java/com/android/vts/servlet/ShowProfilingOverviewServlet.java b/src/main/java/com/android/vts/servlet/ShowProfilingOverviewServlet.java deleted file mode 100644 index 5dc8c6e..0000000 --- a/src/main/java/com/android/vts/servlet/ShowProfilingOverviewServlet.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.servlet; - -import com.android.vts.entity.ProfilingPointEntity; -import com.android.vts.entity.ProfilingPointSummaryEntity; -import com.android.vts.util.BoxPlot; -import com.android.vts.util.DatastoreHelper; -import com.android.vts.util.FilterUtil; -import com.android.vts.util.GraphSerializer; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.datastore.Query.Filter; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.stream.Collectors; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** Servlet for handling requests to load graphs. */ -public class ShowProfilingOverviewServlet extends BaseServlet { - private static final String PROFILING_OVERVIEW_JSP = "WEB-INF/jsp/show_profiling_overview.jsp"; - - @Override - public PageType getNavParentType() { - return PageType.PROFILING_LIST; - } - - @Override - public List<Page> getBreadcrumbLinks(HttpServletRequest request) { - List<Page> links = new ArrayList<>(); - String testName = request.getParameter("testName"); - links.add(new Page(PageType.PROFILING_OVERVIEW, testName, "?testName=" + testName)); - return links; - } - - @Override - public void doGetHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - RequestDispatcher dispatcher = null; - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - - String testName = request.getParameter("testName"); - long endTime = TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()); - long startTime = endTime - TimeUnit.DAYS.toMicros(30); - - // Create a query for test runs matching the time window filter - - Map<String, String[]> parameterMap = request.getParameterMap(); - boolean hasBranchFilter = parameterMap.containsKey(FilterUtil.FilterKey.BRANCH.getValue()); - Filter deviceFilter; - if (hasBranchFilter) { - deviceFilter = - FilterUtil.FilterKey.BRANCH.getFilterForString( - FilterUtil.getFirstParameter( - parameterMap, FilterUtil.FilterKey.BRANCH.getValue())); - } else { - deviceFilter = - FilterUtil.FilterKey.BRANCH.getFilterForString(ProfilingPointSummaryEntity.ALL); - } - - boolean hasTargetFilter = parameterMap.containsKey(FilterUtil.FilterKey.TARGET.getValue()); - if (hasTargetFilter) { - deviceFilter = - Query.CompositeFilterOperator.and( - deviceFilter, - FilterUtil.FilterKey.TARGET.getFilterForString( - FilterUtil.getFirstParameter( - parameterMap, FilterUtil.FilterKey.TARGET.getValue()))); - } else { - deviceFilter = - Query.CompositeFilterOperator.and( - deviceFilter, - FilterUtil.FilterKey.TARGET.getFilterForString( - ProfilingPointSummaryEntity.ALL)); - } - - Filter startFilter = - new Query.FilterPredicate( - ProfilingPointSummaryEntity.START_TIME, - Query.FilterOperator.GREATER_THAN_OR_EQUAL, - startTime); - Filter endFilter = - new Query.FilterPredicate( - ProfilingPointSummaryEntity.START_TIME, - Query.FilterOperator.LESS_THAN_OR_EQUAL, - endTime); - Filter timeFilter = Query.CompositeFilterOperator.and(startFilter, endFilter); - - Filter filter = Query.CompositeFilterOperator.and(timeFilter, deviceFilter); - - Query profilingPointQuery = - new Query(ProfilingPointEntity.KIND) - .setFilter( - new Query.FilterPredicate( - ProfilingPointEntity.TEST_NAME, - Query.FilterOperator.EQUAL, - testName)); - - List<ProfilingPointEntity> profilingPoints = new ArrayList<>(); - for (Entity e : - datastore - .prepare(profilingPointQuery) - .asIterable(DatastoreHelper.getLargeBatchOptions())) { - ProfilingPointEntity pp = ProfilingPointEntity.fromEntity(e); - if (pp == null) continue; - profilingPoints.add(pp); - } - - Map<ProfilingPointEntity, Iterable<Entity>> asyncEntities = new HashMap<>(); - for (ProfilingPointEntity pp : profilingPoints) { - Query profilingQuery = - new Query(ProfilingPointSummaryEntity.KIND) - .setAncestor(pp.getKey()) - .setFilter(filter); - asyncEntities.put( - pp, - datastore - .prepare(profilingQuery) - .asIterable(DatastoreHelper.getLargeBatchOptions())); - } - - Map<String, BoxPlot> plotMap = new HashMap<>(); - for (ProfilingPointEntity pp : profilingPoints) { - if (!plotMap.containsKey(pp.getProfilingPointName())) { - plotMap.put( - pp.getProfilingPointName(), new BoxPlot(pp.getProfilingPointName(), null, pp.getXLabel())); - } - BoxPlot plot = plotMap.get(pp.getProfilingPointName()); - Set<Long> timestamps = new HashSet<>(); - for (Entity e : asyncEntities.get(pp)) { - ProfilingPointSummaryEntity pps = ProfilingPointSummaryEntity.fromEntity(e); - if (pps == null) continue; - plot.addSeriesData(Long.toString(pps.getStartTime()), pps.getSeries(), pps.getGlobalStats()); - timestamps.add(pps.getStartTime()); - } - List<Long> timestampList = new ArrayList<>(timestamps); - timestampList.sort(Comparator.reverseOrder()); - List<String> timestampStrings = - timestampList.stream().map(Object::toString).collect(Collectors.toList()); - plot.setLabels(timestampStrings); - } - - List<BoxPlot> plots = new ArrayList<>(); - for (String key : plotMap.keySet()) { - BoxPlot plot = plotMap.get(key); - if (plot.size() == 0) continue; - plots.add(plot); - } - plots.sort((b1, b2) -> b1.getName().compareTo(b2.getName())); - - Gson gson = - new GsonBuilder() - .registerTypeHierarchyAdapter(BoxPlot.class, new GraphSerializer()) - .create(); - - FilterUtil.setAttributes(request, parameterMap); - request.setAttribute("plots", gson.toJson(plots)); - request.setAttribute("testName", request.getParameter("testName")); - request.setAttribute("branches", new Gson().toJson(DatastoreHelper.getAllBranches())); - request.setAttribute("devices", new Gson().toJson(DatastoreHelper.getAllBuildFlavors())); - dispatcher = request.getRequestDispatcher(PROFILING_OVERVIEW_JSP); - try { - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Exception caught : ", e); - } - } -} diff --git a/src/main/java/com/android/vts/servlet/ShowReleaseServlet.java b/src/main/java/com/android/vts/servlet/ShowReleaseServlet.java deleted file mode 100644 index ae175ae..0000000 --- a/src/main/java/com/android/vts/servlet/ShowReleaseServlet.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.servlet; - -import com.android.vts.entity.TestPlanEntity; -import com.android.vts.entity.TestSuiteResultEntity; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.users.UserServiceFactory; - -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.logging.Level; -import java.util.stream.Collectors; - -import static com.googlecode.objectify.ObjectifyService.ofy; - -/** - * Represents the servlet that is invoked on loading the release page. - */ -public class ShowReleaseServlet extends BaseServlet { - - @Override - public PageType getNavParentType() { - return PageType.RELEASE; - } - - @Override - public List<Page> getBreadcrumbLinks(HttpServletRequest request) { - return null; - } - - @Override - public void doGetHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - String testType = - request.getParameter("type") == null ? "plan" : request.getParameter("type"); - - RequestDispatcher dispatcher; - if (testType.equalsIgnoreCase("plan")) { - dispatcher = this.getTestPlanDispatcher(request, response); - } else { - dispatcher = this.getTestSuiteDispatcher(request, response); - } - - try { - request.setAttribute("testType", testType); - response.setStatus(HttpServletResponse.SC_OK); - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Excpetion caught : ", e); - } - } - - private RequestDispatcher getTestPlanDispatcher( - HttpServletRequest request, HttpServletResponse response) { - String RELEASE_JSP = "WEB-INF/jsp/show_release.jsp"; - - List<TestPlanEntity> testPlanEntityList = ofy().load().type(TestPlanEntity.class).list(); - - List<String> plans = testPlanEntityList.stream() - .sorted(Comparator.comparing(TestPlanEntity::getTestPlanName)) - .map(te -> te.getTestPlanName()).collect(Collectors.toList()); - - request.setAttribute("isAdmin", UserServiceFactory.getUserService().isUserAdmin()); - request.setAttribute("planNames", plans); - RequestDispatcher dispatcher = request.getRequestDispatcher(RELEASE_JSP); - return dispatcher; - } - - private RequestDispatcher getTestSuiteDispatcher( - HttpServletRequest request, HttpServletResponse response) { - String RELEASE_JSP = "WEB-INF/jsp/show_release.jsp"; - - List<TestSuiteResultEntity> suiteResultEntityList = TestSuiteResultEntity.getTestSuitePlans(); - - List<String> plans = - suiteResultEntityList - .stream() - .map(suiteEntity -> suiteEntity.getSuitePlan()) - .collect(Collectors.toList()); - request.setAttribute("isAdmin", UserServiceFactory.getUserService().isUserAdmin()); - request.setAttribute("planNames", plans); - RequestDispatcher dispatcher = request.getRequestDispatcher(RELEASE_JSP); - return dispatcher; - } -} diff --git a/src/main/java/com/android/vts/servlet/ShowTableServlet.java b/src/main/java/com/android/vts/servlet/ShowTableServlet.java deleted file mode 100644 index b56ce9c..0000000 --- a/src/main/java/com/android/vts/servlet/ShowTableServlet.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.servlet; - -import com.android.vts.entity.CodeCoverageEntity; -import com.android.vts.entity.TestCaseRunEntity; -import com.android.vts.entity.TestEntity; -import com.android.vts.entity.TestRunEntity; -import com.android.vts.proto.VtsReportMessage.TestCaseResult; -import com.android.vts.util.DatastoreHelper; -import com.android.vts.util.FilterUtil; -import com.android.vts.util.TestResults; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query.Filter; -import com.google.appengine.api.datastore.Query.SortDirection; -import com.google.gson.Gson; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** Servlet for handling requests to load individual tables. */ -public class ShowTableServlet extends BaseServlet { - private static final String TABLE_JSP = "WEB-INF/jsp/show_table.jsp"; - // Error message displayed on the webpage is tableName passed is null. - private static final String TABLE_NAME_ERROR = "Error : Table name must be passed!"; - private static final String PROFILING_DATA_ALERT = "No profiling data was found."; - private static final int MAX_BUILD_IDS_PER_PAGE = 10; - - @Override - public PageType getNavParentType() { - return PageType.TOT; - } - - @Override - public List<Page> getBreadcrumbLinks(HttpServletRequest request) { - List<Page> links = new ArrayList<>(); - String testName = request.getParameter("testName"); - links.add(new Page(PageType.TABLE, testName, "?testName=" + testName)); - return links; - } - - public static void processTestRun(TestResults testResults, Entity testRun) { - TestRunEntity testRunEntity = TestRunEntity.fromEntity(testRun); - if (testRunEntity == null) { - return; - } - - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - List<Key> gets = new ArrayList<>(); - for (long testCaseId : testRunEntity.getTestCaseIds()) { - gets.add(KeyFactory.createKey(TestCaseRunEntity.KIND, testCaseId)); - } - - List<Entity> testCases = new ArrayList<>(); - Map<Key, Entity> entityMap = datastore.get(gets); - for (Key key : gets) { - if (entityMap.containsKey(key)) { - testCases.add(entityMap.get(key)); - } - } - - testResults.addTestRun(testRun, testCases); - } - - @Override - public void doGetHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - boolean unfiltered = request.getParameter("unfiltered") != null; - boolean showPresubmit = request.getParameter("showPresubmit") != null; - boolean showPostsubmit = request.getParameter("showPostsubmit") != null; - - Long startTime = null; // time in microseconds - Long endTime = null; // time in microseconds - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - RequestDispatcher dispatcher = null; - - // message to display if profiling point data is not available - String profilingDataAlert = ""; - - if (request.getParameter("testName") == null) { - request.setAttribute("testName", TABLE_NAME_ERROR); - return; - } - String testName = request.getParameter("testName"); - - if (request.getParameter("startTime") != null) { - String time = request.getParameter("startTime"); - try { - startTime = Long.parseLong(time); - startTime = startTime > 0 ? startTime : null; - } catch (NumberFormatException e) { - startTime = null; - } - } - if (request.getParameter("endTime") != null) { - String time = request.getParameter("endTime"); - try { - endTime = Long.parseLong(time); - endTime = endTime > 0 ? endTime : null; - } catch (NumberFormatException e) { - endTime = null; - } - } - - // If no params are specified, set to default of postsubmit-only. - if (!(showPresubmit || showPostsubmit)) { - showPostsubmit = true; - } - - // If unfiltered, set showPre- and Post-submit to true for accurate UI. - if (unfiltered) { - showPostsubmit = true; - showPresubmit = true; - } - - // Add result names to list - List<String> resultNames = new ArrayList<>(); - for (TestCaseResult r : TestCaseResult.values()) { - resultNames.add(r.name()); - } - - TestResults testResults = new TestResults(testName); - - SortDirection dir = SortDirection.DESCENDING; - if (startTime != null && endTime == null) { - dir = SortDirection.ASCENDING; - } - Key testKey = KeyFactory.createKey(TestEntity.KIND, testName); - - Filter typeFilter = FilterUtil.getTestTypeFilter(showPresubmit, showPostsubmit, unfiltered); - Filter testFilter = - FilterUtil.getTimeFilter( - testKey, TestRunEntity.KIND, startTime, endTime, typeFilter); - - Map<String, String[]> parameterMap = request.getParameterMap(); - List<Filter> userTestFilters = FilterUtil.getUserTestFilters(parameterMap); - userTestFilters.add(0, testFilter); - Filter userDeviceFilter = FilterUtil.getUserDeviceFilter(parameterMap); - - List<Key> gets = - FilterUtil.getMatchingKeys( - testKey, - TestRunEntity.KIND, - userTestFilters, - userDeviceFilter, - dir, - MAX_BUILD_IDS_PER_PAGE); - Map<Key, Entity> entityMap = datastore.get(gets); - for (Key key : gets) { - if (!entityMap.containsKey(key)) { - continue; - } - processTestRun(testResults, entityMap.get(key)); - } - testResults.processReport(); - - if (testResults.profilingPointNames.length == 0) { - profilingDataAlert = PROFILING_DATA_ALERT; - } - - FilterUtil.setAttributes(request, parameterMap); - - request.setAttribute("testName", request.getParameter("testName")); - - request.setAttribute("error", profilingDataAlert); - - // pass values by converting to JSON - request.setAttribute("headerRow", new Gson().toJson(testResults.headerRow)); - request.setAttribute("timeGrid", new Gson().toJson(testResults.timeGrid)); - request.setAttribute("durationGrid", new Gson().toJson(testResults.durationGrid)); - request.setAttribute("summaryGrid", new Gson().toJson(testResults.summaryGrid)); - request.setAttribute("resultsGrid", new Gson().toJson(testResults.resultsGrid)); - request.setAttribute("profilingPointNames", testResults.profilingPointNames); - request.setAttribute("resultNames", resultNames); - request.setAttribute("resultNamesJson", new Gson().toJson(resultNames)); - request.setAttribute("logInfoMap", new Gson().toJson(testResults.logInfoMap)); - - // data for pie chart - request.setAttribute( - "topBuildResultCounts", new Gson().toJson(testResults.totResultCounts)); - request.setAttribute("topBuildId", testResults.totBuildId); - request.setAttribute("startTime", new Gson().toJson(testResults.startTime)); - request.setAttribute("endTime", new Gson().toJson(testResults.endTime)); - request.setAttribute( - "hasNewer", - new Gson() - .toJson( - DatastoreHelper.hasNewer( - testKey, TestRunEntity.KIND, testResults.endTime))); - request.setAttribute( - "hasOlder", - new Gson() - .toJson( - DatastoreHelper.hasOlder( - testKey, TestRunEntity.KIND, testResults.startTime))); - request.setAttribute("unfiltered", unfiltered); - request.setAttribute("showPresubmit", showPresubmit); - request.setAttribute("showPostsubmit", showPostsubmit); - - request.setAttribute("branches", new Gson().toJson(DatastoreHelper.getAllBranches())); - request.setAttribute("devices", new Gson().toJson(DatastoreHelper.getAllBuildFlavors())); - - dispatcher = request.getRequestDispatcher(TABLE_JSP); - try { - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Exception caught : " + e.toString()); - } - } -} diff --git a/src/main/java/com/android/vts/servlet/ShowTestAcknowledgmentServlet.java b/src/main/java/com/android/vts/servlet/ShowTestAcknowledgmentServlet.java deleted file mode 100644 index c75352c..0000000 --- a/src/main/java/com/android/vts/servlet/ShowTestAcknowledgmentServlet.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.servlet; - -import com.android.vts.entity.TestAcknowledgmentEntity; -import com.android.vts.entity.TestEntity; -import com.android.vts.util.DatastoreHelper; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.users.UserServiceFactory; -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -public class ShowTestAcknowledgmentServlet extends BaseServlet { - private static final String TEST_ACK_JSP = "WEB-INF/jsp/show_test_acknowledgments.jsp"; - - @Override - public PageType getNavParentType() { - return PageType.TOT; - } - - @Override - public List<Page> getBreadcrumbLinks(HttpServletRequest request) { - List<Page> links = new ArrayList<>(); - return links; - } - - @Override - public void doGetHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - Query ackQuery = new Query(TestAcknowledgmentEntity.KIND); - List<JsonObject> testAcks = new ArrayList<>(); - for (Entity ackEntity : - datastore.prepare(ackQuery).asIterable(DatastoreHelper.getLargeBatchOptions())) { - TestAcknowledgmentEntity ack = TestAcknowledgmentEntity.fromEntity(ackEntity); - if (ack == null) continue; - testAcks.add(ack.toJson()); - } - - List<String> allTestNames = TestEntity.getAllTestNames(); - - request.setAttribute("testAcknowledgments", new Gson().toJson(testAcks)); - request.setAttribute("allTests", new Gson().toJson(allTestNames)); - request.setAttribute("branches", new Gson().toJson(DatastoreHelper.getAllBranches())); - request.setAttribute("devices", new Gson().toJson(DatastoreHelper.getAllBuildFlavors())); - request.setAttribute("readOnly", new Gson().toJson(!UserServiceFactory.getUserService().isUserAdmin())); - - RequestDispatcher dispatcher = request.getRequestDispatcher(TEST_ACK_JSP); - try { - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Exception caught : ", e); - } - } -} diff --git a/src/main/java/com/android/vts/servlet/ShowTreeServlet.java b/src/main/java/com/android/vts/servlet/ShowTreeServlet.java deleted file mode 100644 index e087807..0000000 --- a/src/main/java/com/android/vts/servlet/ShowTreeServlet.java +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.servlet; - -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.ProfilingPointRunEntity; -import com.android.vts.entity.TestCaseRunEntity; -import com.android.vts.entity.TestEntity; -import com.android.vts.entity.TestRunEntity; -import com.android.vts.proto.VtsReportMessage.TestCaseResult; -import com.android.vts.util.DatastoreHelper; -import com.android.vts.util.FilterUtil; -import com.android.vts.util.TestRunDetails; -import com.android.vts.util.TestRunMetadata; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.datastore.Query.Filter; -import com.google.appengine.api.datastore.Query.SortDirection; -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.logging.Level; -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * Servlet for handling requests to load individual tables. - */ -public class ShowTreeServlet extends BaseServlet { - - private static final String TABLE_JSP = "WEB-INF/jsp/show_tree.jsp"; - // Error message displayed on the webpage is tableName passed is null. - private static final String TABLE_NAME_ERROR = "Error : Table name must be passed!"; - private static final String PROFILING_DATA_ALERT = "No profiling data was found."; - private static final int MAX_RESULT_COUNT = 60; - private static final int MAX_PREFETCH_COUNT = 10; - - @Override - public PageType getNavParentType() { - return PageType.TOT; - } - - @Override - public List<Page> getBreadcrumbLinks(HttpServletRequest request) { - List<Page> links = new ArrayList<>(); - String testName = request.getParameter("testName"); - links.add(new Page(PageType.TREE, testName, "?testName=" + testName)); - return links; - } - - /** - * Get the test run details for a test run. - * - * @param metadata The metadata for the test run whose details will be fetched. - * @return The TestRunDetails object for the provided test run. - */ - public static TestRunDetails processTestDetails(TestRunMetadata metadata) { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - TestRunDetails details = new TestRunDetails(); - List<Key> gets = new ArrayList<>(); - for (long testCaseId : metadata.testRun.getTestCaseIds()) { - gets.add(KeyFactory.createKey(TestCaseRunEntity.KIND, testCaseId)); - } - Map<Key, Entity> entityMap = datastore.get(gets); - for (int i = 0; i < 1; i++) { - for (Key key : entityMap.keySet()) { - TestCaseRunEntity testCaseRun = TestCaseRunEntity.fromEntity(entityMap.get(key)); - if (testCaseRun == null) { - continue; - } - details.addTestCase(testCaseRun); - } - } - return details; - } - - @Override - public void doGetHandler(HttpServletRequest request, HttpServletResponse response) - throws IOException { - boolean unfiltered = request.getParameter("unfiltered") != null; - boolean showPresubmit = request.getParameter("showPresubmit") != null; - boolean showPostsubmit = request.getParameter("showPostsubmit") != null; - Long startTime = null; // time in microseconds - Long endTime = null; // time in microseconds - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - RequestDispatcher dispatcher = null; - - // message to display if profiling point data is not available - String profilingDataAlert = ""; - - if (request.getParameter("testName") == null) { - request.setAttribute("testName", TABLE_NAME_ERROR); - return; - } - String testName = request.getParameter("testName"); - - if (request.getParameter("startTime") != null) { - String time = request.getParameter("startTime"); - try { - startTime = Long.parseLong(time); - startTime = startTime > 0 ? startTime : null; - } catch (NumberFormatException e) { - startTime = null; - } - } - if (request.getParameter("endTime") != null) { - String time = request.getParameter("endTime"); - try { - endTime = Long.parseLong(time); - endTime = endTime > 0 ? endTime : null; - } catch (NumberFormatException e) { - endTime = null; - } - } - - // If no params are specified, set to default of postsubmit-only. - if (!(showPresubmit || showPostsubmit)) { - showPostsubmit = true; - } - - // If unfiltered, set showPre- and Post-submit to true for accurate UI. - if (unfiltered) { - showPostsubmit = true; - showPresubmit = true; - } - - // Add result names to list - List<String> resultNames = new ArrayList<>(); - for (TestCaseResult r : TestCaseResult.values()) { - resultNames.add(r.name()); - } - - SortDirection dir = SortDirection.DESCENDING; - if (startTime != null && endTime == null) { - dir = SortDirection.ASCENDING; - } - Key testKey = KeyFactory.createKey(TestEntity.KIND, testName); - - Filter typeFilter = FilterUtil.getTestTypeFilter(showPresubmit, showPostsubmit, unfiltered); - Filter testFilter = - FilterUtil.getTimeFilter( - testKey, TestRunEntity.KIND, startTime, endTime, typeFilter); - - Map<String, String[]> parameterMap = request.getParameterMap(); - List<Filter> userTestFilters = FilterUtil.getUserTestFilters(parameterMap); - userTestFilters.add(0, testFilter); - Filter userDeviceFilter = FilterUtil.getUserDeviceFilter(parameterMap); - - List<TestRunMetadata> testRunMetadata = new ArrayList<>(); - Map<Key, TestRunMetadata> metadataMap = new HashMap<>(); - Key minKey = null; - Key maxKey = null; - List<Key> gets = - FilterUtil.getMatchingKeys( - testKey, - TestRunEntity.KIND, - userTestFilters, - userDeviceFilter, - dir, - MAX_RESULT_COUNT); - Map<Key, Entity> entityMap = datastore.get(gets); - for (Key key : gets) { - if (!entityMap.containsKey(key)) { - continue; - } - TestRunEntity testRunEntity = TestRunEntity.fromEntity(entityMap.get(key)); - if (testRunEntity == null) { - continue; - } - if (minKey == null || key.compareTo(minKey) < 0) { - minKey = key; - } - if (maxKey == null || key.compareTo(maxKey) > 0) { - maxKey = key; - } - TestRunMetadata metadata = new TestRunMetadata(testName, testRunEntity); - testRunMetadata.add(metadata); - metadataMap.put(key, metadata); - } - - List<String> profilingPointNames = new ArrayList<>(); - if (minKey != null && maxKey != null) { - Filter deviceFilter = - FilterUtil.getDeviceTimeFilter( - testKey, TestRunEntity.KIND, minKey.getId(), maxKey.getId()); - Query deviceQuery = - new Query(DeviceInfoEntity.KIND) - .setAncestor(testKey) - .setFilter(deviceFilter) - .setKeysOnly(); - List<Key> deviceGets = new ArrayList<>(); - for (Entity device : - datastore - .prepare(deviceQuery) - .asIterable(DatastoreHelper.getLargeBatchOptions())) { - if (metadataMap.containsKey(device.getParent())) { - deviceGets.add(device.getKey()); - } - } - Map<Key, Entity> devices = datastore.get(deviceGets); - for (Key key : devices.keySet()) { - if (!metadataMap.containsKey(key.getParent())) { - continue; - } - DeviceInfoEntity device = DeviceInfoEntity.fromEntity(devices.get(key)); - if (device == null) { - continue; - } - TestRunMetadata metadata = metadataMap.get(key.getParent()); - metadata.addDevice(device); - } - - Filter profilingFilter = - FilterUtil.getProfilingTimeFilter( - testKey, TestRunEntity.KIND, minKey.getId(), maxKey.getId()); - - Set<String> profilingPoints = new HashSet<>(); - Query profilingPointQuery = - new Query(ProfilingPointRunEntity.KIND) - .setAncestor(testKey) - .setFilter(profilingFilter) - .setKeysOnly(); - for (Entity e : datastore.prepare(profilingPointQuery).asIterable()) { - profilingPoints.add(e.getKey().getName()); - } - - if (profilingPoints.size() == 0) { - profilingDataAlert = PROFILING_DATA_ALERT; - } - profilingPointNames.addAll(profilingPoints); - profilingPointNames.sort(Comparator.naturalOrder()); - } - - testRunMetadata.sort( - (t1, t2) -> - new Long(t2.testRun.getStartTimestamp()).compareTo(t1.testRun.getStartTimestamp())); - List<JsonObject> testRunObjects = new ArrayList<>(); - - int prefetchCount = 0; - for (TestRunMetadata metadata : testRunMetadata) { - if (metadata.testRun.getFailCount() > 0 && prefetchCount < MAX_PREFETCH_COUNT) { - // process - metadata.addDetails(processTestDetails(metadata)); - ++prefetchCount; - } - testRunObjects.add(metadata.toJson()); - } - - int[] topBuildResultCounts = null; - String topBuild = ""; - if (testRunMetadata.size() > 0) { - TestRunMetadata firstRun = testRunMetadata.get(0); - topBuild = firstRun.getDeviceInfo(); - endTime = firstRun.testRun.getStartTimestamp(); - TestRunDetails topDetails = firstRun.getDetails(); - if (topDetails == null) { - topDetails = processTestDetails(firstRun); - } - topBuildResultCounts = topDetails.resultCounts; - - TestRunMetadata lastRun = testRunMetadata.get(testRunMetadata.size() - 1); - startTime = lastRun.testRun.getStartTimestamp(); - } - - FilterUtil.setAttributes(request, parameterMap); - - request.setAttribute("testName", request.getParameter("testName")); - - request.setAttribute("error", profilingDataAlert); - - request.setAttribute("profilingPointNames", profilingPointNames); - request.setAttribute("resultNames", resultNames); - request.setAttribute("resultNamesJson", new Gson().toJson(resultNames)); - request.setAttribute("testRuns", new Gson().toJson(testRunObjects)); - - // data for pie chart - request.setAttribute("topBuildResultCounts", new Gson().toJson(topBuildResultCounts)); - request.setAttribute("topBuildId", topBuild); - request.setAttribute("startTime", new Gson().toJson(startTime)); - request.setAttribute("endTime", new Gson().toJson(endTime)); - request.setAttribute( - "hasNewer", - new Gson().toJson(DatastoreHelper.hasNewer(testKey, TestRunEntity.KIND, endTime))); - request.setAttribute( - "hasOlder", - new Gson() - .toJson(DatastoreHelper.hasOlder(testKey, TestRunEntity.KIND, startTime))); - request.setAttribute("unfiltered", unfiltered); - request.setAttribute("showPresubmit", showPresubmit); - request.setAttribute("showPostsubmit", showPostsubmit); - - request.setAttribute("branches", new Gson().toJson(DatastoreHelper.getAllBranches())); - request.setAttribute("devices", new Gson().toJson(DatastoreHelper.getAllBuildFlavors())); - - dispatcher = request.getRequestDispatcher(TABLE_JSP); - try { - dispatcher.forward(request, response); - } catch (ServletException e) { - logger.log(Level.SEVERE, "Servlet Exception caught : " + e.toString()); - } - } -} diff --git a/src/main/java/com/android/vts/util/BoxPlot.java b/src/main/java/com/android/vts/util/BoxPlot.java deleted file mode 100644 index 455d778..0000000 --- a/src/main/java/com/android/vts/util/BoxPlot.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.util; - -import com.android.vts.entity.ProfilingPointRunEntity; -import com.android.vts.proto.VtsReportMessage; -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** Helper object for describing time-series box plot data. */ -public class BoxPlot extends Graph { - private static final String LABEL_KEY = "label"; - private static final String SERIES_KEY = "seriesList"; - private static final String MEAN_KEY = "mean"; - private static final String STD_KEY = "std"; - private static final String COUNT_KEY = "count"; - - private static final String DAY = "Day"; - - private final GraphType type = GraphType.BOX_PLOT; - private final String name; - private final String xLabel; - private final String yLabel; - private final Map<String, Map<String, StatSummary>> labelSeriesMap; - private final Set<String> seriesSet; - - private int count; - private List<String> labels; - - public BoxPlot(String name, String xLabel, String yLabel) { - this.name = name; - this.xLabel = xLabel == null ? DAY : xLabel; - this.yLabel = yLabel; - this.count = 0; - this.labelSeriesMap = new HashMap<>(); - this.seriesSet = new HashSet<>(); - this.labels = new ArrayList<>(); - } - - /** - * Get the x axis label. - * - * @return The x axis label. - */ - @Override - public String getXLabel() { - return xLabel; - } - - /** - * Get the graph type. - * - * @return The graph type. - */ - @Override - public GraphType getType() { - return type; - } - - /** - * Get the name of the graph. - * - * @return The name of the graph. - */ - @Override - public String getName() { - return name; - } - - /** - * Get the y axis label. - * - * @return The y axis label. - */ - @Override - public String getYLabel() { - return yLabel; - } - - /** - * Get the number of data points stored in the graph. - * - * @return The number of data points stored in the graph. - */ - @Override - public int size() { - return this.count; - } - - /** - * Add data to the graph. - * - * @param label The name of the category. - * @param profilingPoint The ProfilingPointRunEntity containing data to add. - */ - @Override - public void addData(String label, ProfilingPointRunEntity profilingPoint) { - StatSummary stat = - new StatSummary( - label, VtsReportMessage.VtsProfilingRegressionMode.UNKNOWN_REGRESSION_MODE); - for (long value : profilingPoint.getValues()) { - stat.updateStats(value); - } - addSeriesData(label, "", stat); - } - - public void addSeriesData(String label, String series, StatSummary stats) { - if (!labelSeriesMap.containsKey(label)) { - labelSeriesMap.put(label, new HashMap<>()); - } - Map<String, StatSummary> seriesMap = labelSeriesMap.get(label); - seriesMap.put(series, stats); - seriesSet.add(series); - count += stats.getCount(); - } - - public void setLabels(List<String> labels) { - this.labels = labels; - } - - /** - * Serializes the graph to json format. - * - * @return A JsonElement object representing the graph object. - */ - @Override - public JsonObject toJson() { - JsonObject json = super.toJson(); - List<JsonObject> stats = new ArrayList<>(); - List<String> seriesList = new ArrayList<>(seriesSet); - seriesList.sort(Comparator.naturalOrder()); - for (String label : labels) { - JsonObject statJson = new JsonObject(); - String boxLabel = label; - List<JsonObject> statList = new ArrayList<>(seriesList.size()); - Map<String, StatSummary> seriesMap = labelSeriesMap.get(label); - for (String series : seriesList) { - JsonObject statSummary = new JsonObject(); - Double mean = null; - Double std = null; - Integer count = null; - if (seriesMap.containsKey(series) && seriesMap.get(series).getCount() > 0) { - StatSummary stat = seriesMap.get(series); - mean = stat.getMean(); - std = 0.; - if (stat.getCount() > 1) { - std = stat.getStd(); - } - count = stat.getCount(); - } - statSummary.addProperty(MEAN_KEY, mean); - statSummary.addProperty(STD_KEY, std); - statSummary.addProperty(COUNT_KEY, count); - statList.add(statSummary); - } - statJson.addProperty(LABEL_KEY, boxLabel); - statJson.add(VALUE_KEY, new Gson().toJsonTree(statList)); - stats.add(statJson); - } - json.add(VALUE_KEY, new Gson().toJsonTree(stats)); - json.add(SERIES_KEY, new Gson().toJsonTree(seriesList)); - return json; - } -} diff --git a/src/main/java/com/android/vts/util/DatastoreHelper.java b/src/main/java/com/android/vts/util/DatastoreHelper.java deleted file mode 100644 index 782887b..0000000 --- a/src/main/java/com/android/vts/util/DatastoreHelper.java +++ /dev/null @@ -1,246 +0,0 @@ -/** - * Copyright 2016 Google Inc. All Rights Reserved. - * - * <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of the License at - * - * <p>http://www.apache.org/licenses/LICENSE-2.0 - * - * <p>Unless required by applicable law or agreed to in writing, software distributed under the - * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.vts.util; - - -import com.android.vts.entity.ApiCoverageEntity; -import com.android.vts.entity.BranchEntity; -import com.android.vts.entity.BuildTargetEntity; -import com.android.vts.entity.CodeCoverageEntity; -import com.android.vts.entity.CoverageEntity; -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.ProfilingPointRunEntity; -import com.android.vts.entity.TestCaseRunEntity; -import com.android.vts.entity.TestEntity; -import com.android.vts.entity.TestPlanEntity; -import com.android.vts.entity.TestPlanRunEntity; -import com.android.vts.entity.TestRunEntity; -import com.android.vts.entity.TestRunEntity.TestRunType; -import com.android.vts.job.VtsAlertJobServlet; -import com.android.vts.job.VtsCoverageAlertJobServlet; -import com.android.vts.job.VtsProfilingStatsJobServlet; -import com.android.vts.proto.VtsReportMessage.AndroidDeviceInfoMessage; -import com.android.vts.proto.VtsReportMessage.ApiCoverageReportMessage; -import com.android.vts.proto.VtsReportMessage.CoverageReportMessage; -import com.android.vts.proto.VtsReportMessage.HalInterfaceMessage; -import com.android.vts.proto.VtsReportMessage.LogMessage; -import com.android.vts.proto.VtsReportMessage.ProfilingReportMessage; -import com.android.vts.proto.VtsReportMessage.TestCaseReportMessage; -import com.android.vts.proto.VtsReportMessage.TestCaseResult; -import com.android.vts.proto.VtsReportMessage.TestPlanReportMessage; -import com.android.vts.proto.VtsReportMessage.TestReportMessage; -import com.android.vts.proto.VtsReportMessage.UrlResourceMessage; -import com.google.appengine.api.datastore.DatastoreFailureException; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.DatastoreTimeoutException; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.EntityNotFoundException; -import com.google.appengine.api.datastore.FetchOptions; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.datastore.Query.Filter; -import com.google.appengine.api.datastore.Query.FilterOperator; -import com.google.appengine.api.datastore.Query.FilterPredicate; -import com.google.appengine.api.datastore.Transaction; -import com.google.appengine.api.datastore.TransactionOptions; -import com.google.common.collect.Lists; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.ConcurrentModificationException; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Collectors; - -/** - * DatastoreHelper, a helper class for interacting with Cloud Datastore. - */ -public class DatastoreHelper { - - /** - * The default kind name for datastore - */ - public static final String NULL_ENTITY_KIND = "nullEntity"; - - public static final int MAX_WRITE_RETRIES = 5; - /** - * This variable is for maximum number of entities per transaction You can find the detail here - * (https://cloud.google.com/datastore/docs/concepts/limits) - */ - public static final int MAX_ENTITY_SIZE_PER_TRANSACTION = 300; - - protected static final Logger logger = Logger.getLogger(DatastoreHelper.class.getName()); - private static final DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - - /** - * Get query fetch options for large batches of entities. - * - * @return FetchOptions with a large chunk and prefetch size. - */ - public static FetchOptions getLargeBatchOptions() { - return FetchOptions.Builder.withChunkSize(1000).prefetchSize(1000); - } - - /** - * Returns true if there are data points newer than lowerBound in the results table. - * - * @param parentKey The parent key to use in the query. - * @param kind The query entity kind. - * @param lowerBound The (exclusive) lower time bound, long, microseconds. - * @return boolean True if there are newer data points. - */ - public static boolean hasNewer(Key parentKey, String kind, Long lowerBound) { - if (lowerBound == null || lowerBound <= 0) { - return false; - } - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - Key startKey = KeyFactory.createKey(parentKey, kind, lowerBound); - Filter startFilter = - new FilterPredicate( - Entity.KEY_RESERVED_PROPERTY, FilterOperator.GREATER_THAN, startKey); - Query q = new Query(kind).setAncestor(parentKey).setFilter(startFilter).setKeysOnly(); - return datastore.prepare(q).countEntities(FetchOptions.Builder.withLimit(1)) > 0; - } - - /** - * Returns true if there are data points older than upperBound in the table. - * - * @param parentKey The parent key to use in the query. - * @param kind The query entity kind. - * @param upperBound The (exclusive) upper time bound, long, microseconds. - * @return boolean True if there are older data points. - */ - public static boolean hasOlder(Key parentKey, String kind, Long upperBound) { - if (upperBound == null || upperBound <= 0) { - return false; - } - Key endKey = KeyFactory.createKey(parentKey, kind, upperBound); - Filter endFilter = - new FilterPredicate(Entity.KEY_RESERVED_PROPERTY, FilterOperator.LESS_THAN, endKey); - Query q = new Query(kind).setAncestor(parentKey).setFilter(endFilter).setKeysOnly(); - return datastore.prepare(q).countEntities(FetchOptions.Builder.withLimit(1)) > 0; - } - - /** - * Get all of the devices branches. - * - * @return a list of all branches. - */ - public static List<String> getAllBranches() { - Query query = new Query(BranchEntity.KIND).setKeysOnly(); - List<String> branches = new ArrayList<>(); - for (Entity e : datastore.prepare(query).asIterable(getLargeBatchOptions())) { - branches.add(e.getKey().getName()); - } - return branches; - } - - /** - * Get all of the device build flavors. - * - * @return a list of all device build flavors. - */ - public static List<String> getAllBuildFlavors() { - Query query = new Query(BuildTargetEntity.KIND).setKeysOnly(); - List<String> devices = new ArrayList<>(); - for (Entity e : datastore.prepare(query).asIterable(getLargeBatchOptions())) { - devices.add(e.getKey().getName()); - } - return devices; - } - - /** - * Datastore Transactional process for data insertion with MAX_WRITE_RETRIES times and withXG of - * false value - * - * @param entity The entity that you want to insert to datastore. - * @param entityList The list of entity for using datastore put method. - */ - private static boolean datastoreTransactionalRetry(Entity entity, List<Entity> entityList) { - return datastoreTransactionalRetryWithXG(entity, entityList, false); - } - - /** - * Datastore Transactional process for data insertion with MAX_WRITE_RETRIES times - * - * @param entity The entity that you want to insert to datastore. - * @param entityList The list of entity for using datastore put method. - */ - private static boolean datastoreTransactionalRetryWithXG( - Entity entity, List<Entity> entityList, boolean withXG) { - int retries = 0; - while (true) { - Transaction txn; - if (withXG) { - TransactionOptions options = TransactionOptions.Builder.withXG(withXG); - txn = datastore.beginTransaction(options); - } else { - txn = datastore.beginTransaction(); - } - - try { - // Check if test already exists in the database - if (!entity.getKind().equalsIgnoreCase(NULL_ENTITY_KIND)) { - try { - if (entity.getKind().equalsIgnoreCase("Test")) { - Entity datastoreEntity = datastore.get(entity.getKey()); - TestEntity datastoreTestEntity = TestEntity.fromEntity(datastoreEntity); - if (datastoreTestEntity == null - || !datastoreTestEntity.equals(entity)) { - entityList.add(entity); - } - } else if (entity.getKind().equalsIgnoreCase("TestPlan")) { - datastore.get(entity.getKey()); - } else { - datastore.get(entity.getKey()); - } - } catch (EntityNotFoundException e) { - entityList.add(entity); - } - } - datastore.put(txn, entityList); - txn.commit(); - break; - } catch (ConcurrentModificationException - | DatastoreFailureException - | DatastoreTimeoutException e) { - entityList.remove(entity); - logger.log( - Level.WARNING, - "Retrying insert kind: " + entity.getKind() + " key: " + entity.getKey()); - if (retries++ >= MAX_WRITE_RETRIES) { - logger.log( - Level.SEVERE, - "Exceeded maximum retries kind: " - + entity.getKind() - + " key: " - + entity.getKey()); - return false; - } - } finally { - if (txn.isActive()) { - logger.log( - Level.WARNING, "Transaction rollback forced for : " + entity.getKind()); - txn.rollback(); - } - } - } - return true; - } -} diff --git a/src/main/java/com/android/vts/util/EmailHelper.java b/src/main/java/com/android/vts/util/EmailHelper.java deleted file mode 100644 index de1d6e9..0000000 --- a/src/main/java/com/android/vts/util/EmailHelper.java +++ /dev/null @@ -1,200 +0,0 @@ -/** - * Copyright 2016 Google Inc. All Rights Reserved. - * - * <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of the License at - * - * <p>http://www.apache.org/licenses/LICENSE-2.0 - * - * <p>Unless required by applicable law or agreed to in writing, software distributed under the - * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.vts.util; - -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.TestRunEntity; -import com.android.vts.entity.UserFavoriteEntity; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.datastore.Query.Filter; -import com.google.appengine.api.datastore.Query.FilterOperator; -import com.google.appengine.api.datastore.Query.FilterPredicate; -import java.io.IOException; -import java.io.UnsupportedEncodingException; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Optional; -import java.util.Properties; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.Session; -import javax.mail.Transport; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeMessage; -import org.apache.commons.lang.StringUtils; - -/** EmailHelper, a helper class for building and sending emails. */ -public class EmailHelper { - protected static final Logger logger = Logger.getLogger(EmailHelper.class.getName()); - protected static String DEFAULT_EMAIL; - protected static String EMAIL_DOMAIN; - protected static String SENDER_EMAIL; - private static final String VTS_EMAIL_NAME = "VTS Alert Bot"; - - public static void setPropertyValues(Properties systemConfigProp) { - DEFAULT_EMAIL = systemConfigProp.getProperty("appengine.defaultEmail"); - EMAIL_DOMAIN = systemConfigProp.getProperty("appengine.emailDomain"); - SENDER_EMAIL = systemConfigProp.getProperty("appengine.senderEmail"); - } - - /** - * Create an email footer with the information from the test run. - * - * @param testRun The TestRunEntity containing test run metadata, or null. - * @param devices The list of devices whose fingerprints to include in the email, or null. - * @param link A link to the Dashboard page containing more information. - * @return The String email footer. - */ - public static String getEmailFooter( - TestRunEntity testRun, List<DeviceInfoEntity> devices, String link) { - StringBuilder sb = new StringBuilder(); - sb.append("<br><br>"); - if (devices != null) { - for (DeviceInfoEntity device : devices) { - sb.append("Device: " + device.getFingerprint() + "<br>"); - } - } - - if (testRun != null) { - sb.append("VTS Build ID: " + testRun.getTestBuildId() + "<br>"); - sb.append("Start Time: " + TimeUtil.getDateTimeZoneString(testRun.getStartTimestamp())); - sb.append("<br>End Time: " + TimeUtil.getDateTimeZoneString(testRun.getEndTimestamp())); - } - sb.append( - "<br><br>For details, visit the" - + " <a href='" - + link - + "'>" - + "VTS dashboard.</a>"); - return sb.toString(); - } - - /** - * Fetches the list of subscriber email addresses for a test. - * - * @param testKey The key for the test for which to fetch the email addresses. - * @returns List of email addresses (String). - * @throws IOException - */ - public static List<String> getSubscriberEmails(Key testKey) throws IOException { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - Filter testFilter = - new FilterPredicate(UserFavoriteEntity.TEST_KEY, FilterOperator.EQUAL, testKey); - Query favoritesQuery = new Query(UserFavoriteEntity.KIND).setFilter(testFilter); - Set<String> emailSet = new HashSet<>(); - if (!StringUtils.isBlank(DEFAULT_EMAIL)) { - emailSet.add(DEFAULT_EMAIL); - } - for (Entity favorite : datastore.prepare(favoritesQuery).asIterable()) { - UserFavoriteEntity favoriteEntity = UserFavoriteEntity.fromEntity(favorite); - // TODO this logic need to be reexamined thoroughly and improved - if (favoriteEntity != null - && favoriteEntity.user != null - && !favoriteEntity.muteNotifications) { - Optional<String> userEmail = Optional.of(favoriteEntity.user.getEmail()); - if (userEmail.isPresent() && - userEmail.orElse("").endsWith(EMAIL_DOMAIN)) { - emailSet.add(favoriteEntity.user.getEmail()); - } - } - } - return new ArrayList<>(emailSet); - } - - /** - * Sends an email to the specified email address to notify of a test status change. - * - * @param emails List of subscriber email addresses (byte[]) to which the email should be sent. - * @param subject The email subject field, string. - * @param body The html (string) body to send in the email. - * @returns The Message object to be sent. - * @throws MessagingException, UnsupportedEncodingException - */ - public static Message composeEmail(List<String> emails, String subject, String body) - throws MessagingException, UnsupportedEncodingException { - if (emails.size() == 0) { - throw new MessagingException("No subscriber email addresses provided"); - } - Properties props = new Properties(); - Session session = Session.getDefaultInstance(props, null); - - Message msg = new MimeMessage(session); - for (String email : emails) { - try { - msg.addRecipient(Message.RecipientType.TO, new InternetAddress(email, email)); - } catch (MessagingException | UnsupportedEncodingException e) { - // Gracefully continue when a subscriber email is invalid. - logger.log(Level.WARNING, "Error sending email to recipient " + email + " : ", e); - } - } - msg.setFrom(new InternetAddress(SENDER_EMAIL, VTS_EMAIL_NAME)); - msg.setSubject(subject); - msg.setContent(body, "text/html; charset=utf-8"); - return msg; - } - - /** - * Sends an email. - * - * @param msg Message object to send. - * @returns true if the message sends successfully, false otherwise - */ - public static boolean send(Message msg) { - try { - Transport.send(msg); - } catch (MessagingException e) { - logger.log(Level.WARNING, "Error sending email : ", e); - return false; - } - return true; - } - - /** - * Sends a list of emails and logs any failures. - * - * @param messages List of Message objects to be sent. - */ - public static void sendAll(List<Message> messages) { - for (Message msg : messages) { - send(msg); - } - } - - /** - * Sends an email. - * - * @param recipients List of email address strings to which an email will be sent. - * @param subject The subject of the email. - * @param body The body of the email. - * @returns true if the message sends successfully, false otherwise - */ - public static boolean send(List<String> recipients, String subject, String body) { - try { - Message msg = composeEmail(recipients, subject, body); - return send(msg); - } catch (MessagingException | UnsupportedEncodingException e) { - logger.log(Level.WARNING, "Error composing email : ", e); - return false; - } - } -} diff --git a/src/main/java/com/android/vts/util/FilterUtil.java b/src/main/java/com/android/vts/util/FilterUtil.java deleted file mode 100644 index 5a567e5..0000000 --- a/src/main/java/com/android/vts/util/FilterUtil.java +++ /dev/null @@ -1,537 +0,0 @@ -/** - * Copyright 2016 Google Inc. All Rights Reserved. - * - * <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of the License at - * - * <p>http://www.apache.org/licenses/LICENSE-2.0 - * - * <p>Unless required by applicable law or agreed to in writing, software distributed under the - * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.vts.util; - -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.ProfilingPointRunEntity; -import com.android.vts.entity.TestRunEntity; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.FetchOptions; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query; -import com.google.appengine.api.datastore.Query.CompositeFilterOperator; -import com.google.appengine.api.datastore.Query.Filter; -import com.google.appengine.api.datastore.Query.FilterOperator; -import com.google.appengine.api.datastore.Query.FilterPredicate; -import com.google.common.collect.Sets; -import com.google.gson.Gson; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Comparator; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.servlet.http.HttpServletRequest; - -/** FilterUtil, a helper class for parsing and matching search queries to data. */ -public class FilterUtil { - protected static final Logger logger = Logger.getLogger(FilterUtil.class.getName()); - private static final String INEQUALITY_REGEX = "(<=|>=|<|>|=)"; - - /** Key class to represent a filter token. */ - public enum FilterKey { - DEVICE_BUILD_ID("deviceBuildId", DeviceInfoEntity.BUILD_ID, true), - BRANCH("branch", DeviceInfoEntity.BRANCH, true), - TARGET("device", DeviceInfoEntity.BUILD_FLAVOR, true), - VTS_BUILD_ID("testBuildId", TestRunEntity.TEST_BUILD_ID, false), - HOSTNAME("hostname", TestRunEntity.HOST_NAME, false), - PASSING("passing", TestRunEntity.PASS_COUNT, false), - NONPASSING("nonpassing", TestRunEntity.FAIL_COUNT, false); - - private static final Map<String, FilterKey> keyMap; - - static { - keyMap = new HashMap<>(); - for (FilterKey k : EnumSet.allOf(FilterKey.class)) { - keyMap.put(k.keyString, k); - } - } - - /** - * Test if a string is a valid device key. - * - * @param keyString The key string. - * @return True if they key string matches a key and the key is a device filter. - */ - public static boolean isDeviceKey(String keyString) { - return keyMap.containsKey(keyString) && keyMap.get(keyString).isDevice; - } - - /** - * Test if a string is a valid test key. - * - * @param keyString The key string. - * @return True if they key string matches a key and the key is a test filter. - */ - public static boolean isTestKey(String keyString) { - return keyMap.containsKey(keyString) && !keyMap.get(keyString).isDevice; - } - - /** - * Parses a key string into a key. - * - * @param keyString The key string. - * @return The key matching the key string. - */ - public static FilterKey parse(String keyString) { - return keyMap.get(keyString); - } - - private final String keyString; - private final String property; - private final boolean isDevice; - - /** - * Constructs a key with the specified key string. - * - * @param keyString The identifying key string. - * @param propertyName The name of the property to match. - */ - private FilterKey(String keyString, String propertyName, boolean isDevice) { - this.keyString = keyString; - this.property = propertyName; - this.isDevice = isDevice; - } - - /** - * Return a filter predicate for string equality. - * - * @param matchString The string to match. - * @return A filter predicate enforcing equality on the property. - */ - public FilterPredicate getFilterForString(String matchString) { - return new FilterPredicate(this.property, FilterOperator.EQUAL, matchString); - } - - /** - * Return a filter predicate for number inequality or equality. - * - * @param matchNumber A string, either a number or an inequality symbol followed by a - * number. - * @return A filter predicate enforcing equality on the property, or null if invalid. - */ - public FilterPredicate getFilterForNumber(String matchNumber) { - String numberString = matchNumber.trim(); - Pattern p = Pattern.compile(INEQUALITY_REGEX); - Matcher m = p.matcher(numberString); - - // Default operator is equality. - FilterOperator op = FilterOperator.EQUAL; - - // Determine if there is an inequality operator. - if (m.find() && m.start() == 0 && m.end() != numberString.length()) { - String opString = m.group(); - - // Inequality operator can be <=, <, >, >=, or =. - if (opString.equals("<=")) { - op = FilterOperator.LESS_THAN_OR_EQUAL; - } else if (opString.equals("<")) { - op = FilterOperator.LESS_THAN; - } else if (opString.equals(">")) { - op = FilterOperator.GREATER_THAN; - } else if (opString.equals(">=")) { - op = FilterOperator.GREATER_THAN_OR_EQUAL; - } else if (!opString.equals("=")) { // unrecognized inequality. - return null; - } - numberString = matchNumber.substring(m.end()).trim(); - } - try { - long number = Long.parseLong(numberString); - return new FilterPredicate(this.property, op, number); - } catch (NumberFormatException e) { - // invalid number - return null; - } - } - - /** - * Get the enum value - * - * @return The string value associated with the key. - */ - public String getValue() { - return this.keyString; - } - } - - /** - * Get the common elements among multiple collections. - * - * @param collections The collections containing all sub collections to find common element. - * @return The common elements set found from the collections param. - */ - public static <T> Set<T> getCommonElements(Collection<? extends Collection<T>> collections) { - - Set<T> common = new LinkedHashSet<T>(); - if (!collections.isEmpty()) { - Iterator<? extends Collection<T>> iterator = collections.iterator(); - common.addAll(iterator.next()); - while (iterator.hasNext()) { - common.retainAll(iterator.next()); - } - } - return common; - } - - /** - * Get the first value associated with the key in the parameter map. - * - * @param parameterMap The parameter map with string keys and (Object) String[] values. - * @param key The key whose value to get. - * @return The first value associated with the provided key. - */ - public static String getFirstParameter(Map<String, String[]> parameterMap, String key) { - String[] values = (String[]) parameterMap.get(key); - if (values.length == 0) return null; - return values[0]; - } - - /** - * Get a filter on devices from a user search query. - * - * @param parameterMap The key-value map of url parameters. - * @return A filter with the values from the user search parameters. - */ - public static Filter getUserDeviceFilter(Map<String, String[]> parameterMap) { - Filter deviceFilter = null; - for (String key : parameterMap.keySet()) { - if (!FilterKey.isDeviceKey(key)) continue; - String value = getFirstParameter(parameterMap, key); - if (value == null) continue; - FilterKey filterKey = FilterKey.parse(key); - Filter f = filterKey.getFilterForString(value); - if (deviceFilter == null) { - deviceFilter = f; - } else { - deviceFilter = CompositeFilterOperator.and(deviceFilter, f); - } - } - return deviceFilter; - } - - /** - * Get a list of test filters given the user parameters. - * - * @param parameterMap The key-value map of url parameters. - * @return A list of filters, each having at most one inequality filter. - */ - public static List<Filter> getUserTestFilters(Map<String, String[]> parameterMap) { - List<Filter> userFilters = new ArrayList<>(); - for (String key : parameterMap.keySet()) { - if (!FilterKey.isTestKey(key)) continue; - String stringValue = getFirstParameter(parameterMap, key); - if (stringValue == null) continue; - FilterKey filterKey = FilterKey.parse(key); - switch (filterKey) { - case NONPASSING: - case PASSING: - userFilters.add(filterKey.getFilterForNumber(stringValue)); - break; - case HOSTNAME: - case VTS_BUILD_ID: - userFilters.add(filterKey.getFilterForString(stringValue.toLowerCase())); - break; - default: - continue; - } - } - return userFilters; - } - - /** - * Get a filter on the test run type. - * - * @param showPresubmit True to display presubmit tests. - * @param showPostsubmit True to display postsubmit tests. - * @param unfiltered True if no filtering should be applied. - * @return A filter on the test type. - */ - public static Filter getTestTypeFilter( - boolean showPresubmit, boolean showPostsubmit, boolean unfiltered) { - if (unfiltered) { - return null; - } else if (showPresubmit && !showPostsubmit) { - return new FilterPredicate( - TestRunEntity.TYPE, - FilterOperator.EQUAL, - TestRunEntity.TestRunType.PRESUBMIT.getNumber()); - } else if (showPostsubmit && !showPresubmit) { - return new FilterPredicate( - TestRunEntity.TYPE, - FilterOperator.EQUAL, - TestRunEntity.TestRunType.POSTSUBMIT.getNumber()); - } else { - List<Integer> types = new ArrayList<>(); - types.add(TestRunEntity.TestRunType.PRESUBMIT.getNumber()); - types.add(TestRunEntity.TestRunType.POSTSUBMIT.getNumber()); - return new FilterPredicate(TestRunEntity.TYPE, FilterOperator.IN, types); - } - } - - /** - * Get a filter for profiling points between a specified time window. - * - * @param grandparentKey The key of the profiling point grandparent entity. - * @param parentKind The kind of the profiling point parent. - * @param startTime The start time of the window, or null if unbounded. - * @param endTime The end time of the window, or null if unbounded. - * @return A filter to query for profiling points in the time window. - */ - public static Filter getProfilingTimeFilter( - Key grandparentKey, String parentKind, Long startTime, Long endTime) { - if (startTime == null && endTime == null) { - endTime = TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()); - } - Filter startFilter = null; - Filter endFilter = null; - Filter filter = null; - if (startTime != null) { - Key minRunKey = KeyFactory.createKey(grandparentKey, parentKind, startTime); - Key startKey = - KeyFactory.createKey( - minRunKey, ProfilingPointRunEntity.KIND, String.valueOf((char) 0x0)); - startFilter = - new FilterPredicate( - Entity.KEY_RESERVED_PROPERTY, - FilterOperator.GREATER_THAN_OR_EQUAL, - startKey); - filter = startFilter; - } - if (endTime != null) { - Key maxRunKey = KeyFactory.createKey(grandparentKey, parentKind, endTime); - Key endKey = - KeyFactory.createKey( - maxRunKey, ProfilingPointRunEntity.KIND, String.valueOf((char) 0xff)); - endFilter = - new FilterPredicate( - Entity.KEY_RESERVED_PROPERTY, - FilterOperator.LESS_THAN_OR_EQUAL, - endKey); - filter = endFilter; - } - if (startFilter != null && endFilter != null) { - filter = CompositeFilterOperator.and(startFilter, endFilter); - } - return filter; - } - - /** - * Get a filter for device information between a specified time window. - * - * @param grandparentKey The key of the device's grandparent entity. - * @param parentKind The kind of the device's parent. - * @param startTime The start time of the window, or null if unbounded. - * @param endTime The end time of the window, or null if unbounded. - * @return A filter to query for devices in the time window. - */ - public static Filter getDeviceTimeFilter( - Key grandparentKey, String parentKind, Long startTime, Long endTime) { - if (startTime == null && endTime == null) { - endTime = TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()); - } - Filter startFilter = null; - Filter endFilter = null; - Filter filter = null; - if (startTime != null) { - Key minRunKey = KeyFactory.createKey(grandparentKey, parentKind, startTime); - Key startKey = KeyFactory.createKey(minRunKey, DeviceInfoEntity.KIND, 1); - startFilter = - new FilterPredicate( - Entity.KEY_RESERVED_PROPERTY, - FilterOperator.GREATER_THAN_OR_EQUAL, - startKey); - filter = startFilter; - } - if (endTime != null) { - Key maxRunKey = KeyFactory.createKey(grandparentKey, parentKind, endTime); - Key endKey = KeyFactory.createKey(maxRunKey, DeviceInfoEntity.KIND, Long.MAX_VALUE); - endFilter = - new FilterPredicate( - Entity.KEY_RESERVED_PROPERTY, - FilterOperator.LESS_THAN_OR_EQUAL, - endKey); - filter = endFilter; - } - if (startFilter != null && endFilter != null) { - filter = CompositeFilterOperator.and(startFilter, endFilter); - } - return filter; - } - - /** - * Get the time range filter to apply to a query. - * - * @param testKey The key of the parent TestEntity object. - * @param kind The kind to use for the filters. - * @param startTime The start time in microseconds, or null if unbounded. - * @param endTime The end time in microseconds, or null if unbounded. - * @param testRunFilter The existing filter on test runs to apply, or null. - * @return A filter to apply on test runs. - */ - public static Filter getTimeFilter( - Key testKey, String kind, Long startTime, Long endTime, Filter testRunFilter) { - if (startTime == null && endTime == null) { - endTime = TimeUnit.MILLISECONDS.toMicros(System.currentTimeMillis()); - } - - Filter startFilter = null; - Filter endFilter = null; - Filter filter = null; - if (startTime != null) { - Key startKey = KeyFactory.createKey(testKey, kind, startTime); - startFilter = - new FilterPredicate( - Entity.KEY_RESERVED_PROPERTY, - FilterOperator.GREATER_THAN_OR_EQUAL, - startKey); - filter = startFilter; - } - if (endTime != null) { - Key endKey = KeyFactory.createKey(testKey, kind, endTime); - endFilter = - new FilterPredicate( - Entity.KEY_RESERVED_PROPERTY, - FilterOperator.LESS_THAN_OR_EQUAL, - endKey); - filter = endFilter; - } - if (startFilter != null && endFilter != null) { - filter = CompositeFilterOperator.and(startFilter, endFilter); - } - if (testRunFilter != null) { - filter = CompositeFilterOperator.and(filter, testRunFilter); - } - return filter; - } - - public static Filter getTimeFilter(Key testKey, String kind, Long startTime, Long endTime) { - return getTimeFilter(testKey, kind, startTime, endTime, null); - } - - /** - * Get the list of keys matching the provided test filter and device filter. - * - * @param ancestorKey The ancestor key to use in the query. - * @param kind The entity kind to use in the test query. - * @param testFilters The filter list to apply to test runs (each having <=1 inequality filter). - * @param deviceFilter The filter to apply to associated devices. - * @param dir The sort direction of the returned list. - * @param maxSize The maximum number of entities to return. - * @return a list of keys matching the provided test and device filters. - */ - public static List<Key> getMatchingKeys( - Key ancestorKey, - String kind, - List<Filter> testFilters, - Filter deviceFilter, - Query.SortDirection dir, - int maxSize) { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - Set<Key> matchingTestKeys = null; - Key minKey = null; - Key maxKey = null; - for (Filter testFilter : testFilters) { - Query testQuery = - new Query(kind).setAncestor(ancestorKey).setFilter(testFilter).setKeysOnly(); - Set<Key> filterMatches = new HashSet<>(); - FetchOptions ops = DatastoreHelper.getLargeBatchOptions(); - if (deviceFilter == null && testFilters.size() == 1) { - ops.limit(maxSize); - testQuery.addSort(Entity.KEY_RESERVED_PROPERTY, dir); - } - logger.log(Level.INFO, "testQuery => " + testQuery); - for (Entity testRunKey : datastore.prepare(testQuery).asIterable(ops)) { - filterMatches.add(testRunKey.getKey()); - if (maxKey == null || testRunKey.getKey().compareTo(maxKey) > 0) - maxKey = testRunKey.getKey(); - if (minKey == null || testRunKey.getKey().compareTo(minKey) < 0) - minKey = testRunKey.getKey(); - } - if (matchingTestKeys == null) { - matchingTestKeys = filterMatches; - } else { - matchingTestKeys = Sets.intersection(matchingTestKeys, filterMatches); - } - } - logger.log(Level.INFO, "matchingTestKeys => " + matchingTestKeys); - - Set<Key> allMatchingKeys; - if (deviceFilter == null || matchingTestKeys.size() == 0) { - allMatchingKeys = matchingTestKeys; - } else { - deviceFilter = - CompositeFilterOperator.and( - deviceFilter, - getDeviceTimeFilter( - minKey.getParent(), - minKey.getKind(), - minKey.getId(), - maxKey.getId())); - allMatchingKeys = new HashSet<>(); - Query deviceQuery = - new Query(DeviceInfoEntity.KIND) - .setAncestor(ancestorKey) - .setFilter(deviceFilter) - .setKeysOnly(); - for (Entity device : - datastore - .prepare(deviceQuery) - .asIterable(DatastoreHelper.getLargeBatchOptions())) { - if (matchingTestKeys.contains(device.getKey().getParent())) { - allMatchingKeys.add(device.getKey().getParent()); - } - } - } - logger.log(Level.INFO, "allMatchingKeys => " + allMatchingKeys); - List<Key> gets = new ArrayList<>(allMatchingKeys); - if (dir == Query.SortDirection.DESCENDING) { - gets.sort(Comparator.reverseOrder()); - } else { - gets.sort(Comparator.naturalOrder()); - } - gets = gets.subList(0, Math.min(gets.size(), maxSize)); - return gets; - } - - /** - * Set the request with the provided key/value attribute map. - * - * @param request The request whose attributes to set. - * @param parameterMap The map from key to (Object) String[] value whose entries to parse. - */ - public static void setAttributes(HttpServletRequest request, Map<String, String[]> parameterMap) { - for (String key : parameterMap.keySet()) { - if (!FilterKey.isDeviceKey(key) && !FilterKey.isTestKey(key)) continue; - FilterKey filterKey = FilterKey.parse(key); - String[] values = parameterMap.get(key); - if (values.length == 0) continue; - String stringValue = values[0]; - request.setAttribute(filterKey.keyString, new Gson().toJson(stringValue)); - } - } -} diff --git a/src/main/java/com/android/vts/util/GcsHelper.java b/src/main/java/com/android/vts/util/GcsHelper.java deleted file mode 100644 index b2c6aac..0000000 --- a/src/main/java/com/android/vts/util/GcsHelper.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.android.vts.util; - -import com.google.auth.oauth2.ServiceAccountCredentials; -import com.google.cloud.storage.Storage; -import com.google.cloud.storage.StorageOptions; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Optional; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** GcsHelper, a helper class for interacting with Google Cloud Storage. */ -public class GcsHelper { - private static final Logger logger = Logger.getLogger(GcsHelper.class.getName()); - - /** Google Cloud Storage project ID */ - private static String GCS_PROJECT_ID; - - public static void setGcsProjectId(String gcsProjectId) { - GCS_PROJECT_ID = gcsProjectId; - } - - /** - * Get GCS storage from Key file input stream parameter. - */ - public static Optional<Storage> getStorage(InputStream keyFileInputStream) { - - if (keyFileInputStream == null) { - logger.log(Level.SEVERE, "Error GCS key file is not exiting. Check key file!"); - return Optional.empty(); - } else { - try { - Storage storage = - StorageOptions.newBuilder() - .setProjectId(GCS_PROJECT_ID) - .setCredentials( - ServiceAccountCredentials.fromStream(keyFileInputStream)) - .build() - .getService(); - return Optional.of(storage); - } catch (IOException e) { - logger.log(Level.SEVERE, "Error on creating storage instance!"); - return Optional.empty(); - } - } - } -} diff --git a/src/main/java/com/android/vts/util/Graph.java b/src/main/java/com/android/vts/util/Graph.java deleted file mode 100644 index 00c2a3d..0000000 --- a/src/main/java/com/android/vts/util/Graph.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.util; - -import com.android.vts.entity.ProfilingPointRunEntity; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; - -/** Helper object for describing graph data. */ -public abstract class Graph { - public static final String VALUE_KEY = "values"; - public static final String X_LABEL_KEY = "x_label"; - public static final String Y_LABEL_KEY = "y_label"; - public static final String IDS_KEY = "ids"; - public static final String NAME_KEY = "name"; - public static final String TYPE_KEY = "type"; - - public static enum GraphType { LINE_GRAPH, HISTOGRAM, BOX_PLOT } - - /** - * Get the graph type. - * - * @return The graph type. - */ - public abstract GraphType getType(); - - /** - * Get the x axis label. - * - * @return The x axis label. - */ - public abstract String getXLabel(); - - /** - * Get the y axis label. - * - * @return The y axis label. - */ - public abstract String getYLabel(); - - /** - * Get the name of the graph. - * - * @return The name of the graph. - */ - public abstract String getName(); - - /** - * Get the number of data points stored in the graph. - * - * @return The number of data points stored in the graph. - */ - public abstract int size(); - - /** - * Add data to the graph. - * - * @param id The name of the graph. - * @param profilingPoint The ProfilingPointEntity containing data to add. - */ - public abstract void addData(String id, ProfilingPointRunEntity profilingPoint); - - /** - * Serializes the graph to json format. - * - * @return A JsonElement object representing the graph object. - */ - public JsonObject toJson() { - JsonObject json = new JsonObject(); - json.add(X_LABEL_KEY, new JsonPrimitive(getXLabel())); - json.add(Y_LABEL_KEY, new JsonPrimitive(getYLabel())); - json.add(NAME_KEY, new JsonPrimitive(getName())); - json.add(TYPE_KEY, new JsonPrimitive(getType().toString())); - return json; - } -} diff --git a/src/main/java/com/android/vts/util/GraphSerializer.java b/src/main/java/com/android/vts/util/GraphSerializer.java deleted file mode 100644 index 722b511..0000000 --- a/src/main/java/com/android/vts/util/GraphSerializer.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.util; - -import com.google.gson.JsonElement; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; -import java.lang.reflect.Type; - -/** Serializer class for Graph objects. */ -public class GraphSerializer implements JsonSerializer<Graph> { - @Override - public JsonElement serialize(Graph src, Type typeOfSrc, JsonSerializationContext context) { - return src.toJson(); - } -} diff --git a/src/main/java/com/android/vts/util/Histogram.java b/src/main/java/com/android/vts/util/Histogram.java deleted file mode 100644 index 2f62a57..0000000 --- a/src/main/java/com/android/vts/util/Histogram.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.util; - -import com.android.vts.entity.ProfilingPointRunEntity; -import com.google.common.primitives.Doubles; -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import java.util.ArrayList; -import java.util.List; -import org.apache.commons.math3.stat.descriptive.rank.Percentile; - -/** Helper object for describing graph data. */ -public class Histogram extends Graph { - public static final String PERCENTILES_KEY = "percentiles"; - public static final String PERCENTILE_VALUES_KEY = "percentile_values"; - public static final String MIN_KEY = "min"; - public static final String MAX_KEY = "max"; - - private List<Double> values; - private List<String> ids; - private String xLabel; - private String yLabel; - private String name; - private GraphType type = GraphType.HISTOGRAM; - private Double min = null; - private Double max = null; - - public Histogram(String name) { - this.name = name; - this.values = new ArrayList<>(); - this.ids = new ArrayList<>(); - } - - /** - * Get the x axis label. - * - * @return The x axis label. - */ - @Override - public String getXLabel() { - return xLabel; - } - - /** - * Get the graph type. - * - * @return The graph type. - */ - @Override - public GraphType getType() { - return type; - } - - /** - * Get the name of the graph. - * - * @return The name of the graph. - */ - @Override - public String getName() { - return name; - } - - /** - * Get the y axis label. - * - * @return The y axis label. - */ - @Override - public String getYLabel() { - return yLabel; - } - - /** - * Get the number of data points stored in the graph. - * - * @return The number of data points stored in the graph. - */ - @Override - public int size() { - return values.size(); - } - - /** - * Get the minimum value. - * - * @return The minimum value. - */ - public Double getMin() { - return min; - } - - /** - * Get the maximum value. - * - * @return The maximum value. - */ - public Double getMax() { - return max; - } - - /** - * Add data to the graph. - * - * @param id The name of the graph. - * @param profilingPoint The ProfilingPointRunEntity containing data to add. - */ - @Override - public void addData(String id, ProfilingPointRunEntity profilingPoint) { - if (profilingPoint.getValues().size() == 0) - return; - xLabel = profilingPoint.getXLabel(); - yLabel = profilingPoint.getYLabel(); - for (long v : profilingPoint.getValues()) { - double value = v; - values.add(value); - ids.add(id); - if (max == null || value > max) - max = value; - if (min == null || value < min) - min = value; - } - } - - /** - * Serializes the graph to json format. - * - * @return A JsonElement object representing the graph object. - */ - @Override - public JsonObject toJson() { - int[] percentiles = {1, 2, 5, 10, 25, 50, 75, 90, 95, 98, 99}; - double[] percentileValues = new double[percentiles.length]; - double[] valueList = Doubles.toArray(values); - for (int i = 0; i < percentiles.length; i++) { - percentileValues[i] = - Math.round(new Percentile().evaluate(valueList, percentiles[i]) * 1000d) - / 1000d; - } - JsonObject json = super.toJson(); - json.add(VALUE_KEY, new Gson().toJsonTree(values).getAsJsonArray()); - json.add(PERCENTILES_KEY, new Gson().toJsonTree(percentiles).getAsJsonArray()); - json.add(PERCENTILE_VALUES_KEY, new Gson().toJsonTree(percentileValues).getAsJsonArray()); - json.add(IDS_KEY, new Gson().toJsonTree(ids).getAsJsonArray()); - json.add(MIN_KEY, new JsonPrimitive(min)); - json.add(MAX_KEY, new JsonPrimitive(max)); - return json; - } -} diff --git a/src/main/java/com/android/vts/util/LineGraph.java b/src/main/java/com/android/vts/util/LineGraph.java deleted file mode 100644 index 4788961..0000000 --- a/src/main/java/com/android/vts/util/LineGraph.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.util; - -import com.android.vts.entity.ProfilingPointRunEntity; -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** Helper object for describing graph data. */ -public class LineGraph extends Graph { - public static final String TICKS_KEY = "ticks"; - - private List<ProfilingPointRunEntity> profilingRuns; - private List<String> ids; - private String xLabel; - private String yLabel; - private String name; - private GraphType type = GraphType.LINE_GRAPH; - - public LineGraph(String name) { - this.name = name; - profilingRuns = new ArrayList<>(); - ids = new ArrayList<>(); - } - - /** - * Get the x axis label. - * - * @return The x axis label. - */ - @Override - public String getXLabel() { - return xLabel; - } - - /** - * Get the graph type. - * - * @return The graph type. - */ - @Override - public GraphType getType() { - return type; - } - - /** - * Get the name of the graph. - * - * @return The name of the graph. - */ - @Override - public String getName() { - return name; - } - - /** - * Get the y axis label. - * - * @return The y axis label. - */ - @Override - public String getYLabel() { - return yLabel; - } - - /** - * Get the number of data points stored in the graph. - * - * @return The number of data points stored in the graph. - */ - @Override - public int size() { - return profilingRuns.size(); - } - - /** - * Add data to the graph. - * - * @param id The name of the graph. - * @param profilingPoint The ProfilingPointRunEntity containing data to add. - */ - @Override - public void addData(String id, ProfilingPointRunEntity profilingPoint) { - if (profilingPoint.getValues().size() == 0 - || profilingPoint.getValues().size() != profilingPoint.getLabels().size()) - return; - ids.add(id); - profilingRuns.add(profilingPoint); - xLabel = profilingPoint.getXLabel(); - yLabel = profilingPoint.getYLabel(); - } - - /** - * Serializes the graph to json format. - * - * @return A JsonElement object representing the graph object. - */ - @Override - public JsonObject toJson() { - JsonObject json = super.toJson(); - // Use the most recent profiling vector to generate the labels - ProfilingPointRunEntity profilingRun = profilingRuns.get(profilingRuns.size() - 1); - - List<String> axisTicks = new ArrayList<>(); - Map<String, Integer> tickIndexMap = new HashMap<>(); - for (int i = 0; i < profilingRun.getLabels().size(); i++) { - String label = profilingRun.getLabels().get(i); - axisTicks.add(label); - tickIndexMap.put(label, i); - } - - long[][] lineGraphValues = new long[axisTicks.size()][profilingRuns.size()]; - for (int reportIndex = 0; reportIndex < profilingRuns.size(); reportIndex++) { - ProfilingPointRunEntity pt = profilingRuns.get(reportIndex); - for (int i = 0; i < pt.getLabels().size(); i++) { - String label = pt.getLabels().get(i); - - // Skip value if its label is not present - if (!tickIndexMap.containsKey(label)) - continue; - int labelIndex = tickIndexMap.get(label); - - lineGraphValues[labelIndex][reportIndex] = pt.getValues().get(i); - } - } - json.add(VALUE_KEY, new Gson().toJsonTree(lineGraphValues).getAsJsonArray()); - json.add(IDS_KEY, new Gson().toJsonTree(ids).getAsJsonArray()); - json.add(TICKS_KEY, new Gson().toJsonTree(axisTicks)); - return json; - } -} diff --git a/src/main/java/com/android/vts/util/Pagination.java b/src/main/java/com/android/vts/util/Pagination.java deleted file mode 100644 index 4a0d652..0000000 --- a/src/main/java/com/android/vts/util/Pagination.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2018 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.util; - -import com.google.cloud.datastore.Cursor; -import com.google.cloud.datastore.QueryResults; -import com.googlecode.objectify.cmd.Query; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** Helper class for pagination. */ -public class Pagination<T> implements Iterable<T> { - - /** the default page size */ - public static final int DEFAULT_PAGE_SIZE = 10; - /** the default page window size */ - private static final int DEFAULT_PAGE_WINDOW = 10; - - /** the current page */ - private int page; - - /** the page window size */ - private int pageSize = DEFAULT_PAGE_SIZE; - - /** the total number of found entities */ - private int totalCount; - - /** the previous cursor string token where to start */ - private String previousPageCountToken = ""; - - /** the previous cursor string token where to start */ - private String currentPageCountToken = ""; - - /** the next cursor string token where to start */ - private String nextPageCountToken = ""; - - /** the previous cursor string token list where to start */ - private LinkedHashSet<String> pageCountTokenSet; - - /** the maximum number of pages */ - private int maxPages; - - /** the list of object on the page */ - private List<T> list = new ArrayList<>(); - - public Pagination(List<T> list, int page, int pageSize, int totalCount) { - this.list = list; - this.page = page; - this.pageSize = pageSize; - this.totalCount = totalCount; - } - - public Pagination( - Query<T> query, - int page, - int pageSize, - String startPageToken, - LinkedHashSet<String> pageCountTokenSet) { - this.page = page; - this.pageSize = pageSize; - this.pageCountTokenSet = pageCountTokenSet; - this.currentPageCountToken = startPageToken; - - List<String> pageCountTokenList = - this.pageCountTokenSet.stream().collect(Collectors.toList()); - if (pageCountTokenList.size() > 0) { - int foundIndex = pageCountTokenList.indexOf(startPageToken); - if (foundIndex <= 0) { - this.previousPageCountToken = ""; - } else { - this.previousPageCountToken = pageCountTokenList.get(foundIndex - 1); - } - } - - int limitValue = pageSize * DEFAULT_PAGE_WINDOW + pageSize / 2; - query = query.limit(limitValue); - if (startPageToken.equals("")) { - this.totalCount = query.count(); - } else { - query = query.startAt(Cursor.fromUrlSafe(startPageToken)); - this.totalCount = query.count(); - } - - this.maxPages = - this.totalCount / this.pageSize + (this.totalCount % this.pageSize == 0 ? 0 : 1); - - int iteratorIndex = 0; - int startIndex = (page % pageSize == 0 ? 9 : page % pageSize - 1) * pageSize; - - QueryResults<T> resultIterator = query.iterator(); - while (resultIterator.hasNext()) { - if (startIndex <= iteratorIndex && iteratorIndex < startIndex + this.pageSize) - this.list.add(resultIterator.next()); - else resultIterator.next(); - if (iteratorIndex == DEFAULT_PAGE_WINDOW * this.pageSize) { - if ( Objects.nonNull(resultIterator) && Objects.nonNull(resultIterator.getCursorAfter()) ) { - this.nextPageCountToken = resultIterator.getCursorAfter().toUrlSafe(); - } - } - iteratorIndex++; - } - } - - public Iterator<T> iterator() { - return list.iterator(); - } - - /** - * Gets the total number of objects. - * - * @return the total number of objects as an int - */ - public int getTotalCount() { - return totalCount; - } - - /** - * Gets the number of page window. - * - * @return the number of page window as an int - */ - public int getPageSize() { - return pageSize; - } - - /** - * Gets the maximum number of pages. - * - * @return the maximum number of pages as an int - */ - public int getMaxPages() { - return this.maxPages; - } - - /** - * Gets the page. - * - * @return the page as an int - */ - public int getPage() { - return page; - } - - /** - * Gets the minimum page in the window. - * - * @return the page number - */ - public int getMinPageRange() { - if (this.getPage() <= this.getPageSize()) { - return 1; - } else { - if ((this.getPage() % this.getPageSize()) == 0) { - return (this.getPage() / this.getPageSize() - 1) * this.getPageSize() + 1; - } else { - return this.getPage() / this.getPageSize() * this.getPageSize() + 1; - } - } - } - - /** - * Gets the maximum page in the window. - * - * @return the page number - */ - public int getMaxPageRange() { - if (this.getMaxPages() > this.getPageSize()) { - return getMinPageRange() + this.getPageSize() - 1; - } else { - return this.getMinPageRange() + this.getMaxPages() - 1; - } - } - - /** - * Gets the subset of the list for the current page. - * - * @return a List - */ - public List<T> getList() { - return this.list; - } - - /** - * Gets the cursor token for the previous page starting point. - * - * @return a string of cursor of previous starting point - */ - public String getPreviousPageCountToken() { - return this.previousPageCountToken; - } - - /** - * Gets the cursor token for the current page starting point. - * - * @return a string of cursor of current starting point - */ - public String getCurrentPageCountToken() { - return this.currentPageCountToken; - } - - /** - * Gets the cursor token for the next page starting point. - * - * @return a string of cursor of next starting point - */ - public String getNextPageCountToken() { - return this.nextPageCountToken; - } -} diff --git a/src/main/java/com/android/vts/util/PerformanceSummary.java b/src/main/java/com/android/vts/util/PerformanceSummary.java deleted file mode 100644 index a9ce0b4..0000000 --- a/src/main/java/com/android/vts/util/PerformanceSummary.java +++ /dev/null @@ -1,155 +0,0 @@ -/** - * Copyright 2016 Google Inc. All Rights Reserved. - * - * <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of the License at - * - * <p>http://www.apache.org/licenses/LICENSE-2.0 - * - * <p>Unless required by applicable law or agreed to in writing, software distributed under the - * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.vts.util; - -import com.android.vts.entity.ProfilingPointEntity; -import com.android.vts.entity.ProfilingPointSummaryEntity; -import com.google.appengine.api.datastore.Entity; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.logging.Logger; - -/** PerformanceSummary, an object summarizing performance across profiling points for a test run. */ -public class PerformanceSummary { - protected static Logger logger = Logger.getLogger(PerformanceSummary.class.getName()); - private Map<String, ProfilingPointSummary> summaryMap; - - public final long startTime; - public final long endTime; - public final String label; - - /** Creates a performance summary object. */ - public PerformanceSummary(long startTime, long endTime, String label) { - this.summaryMap = new HashMap<>(); - this.startTime = startTime; - this.endTime = endTime; - this.label = label; - } - - /** Creates a performance summary object. */ - public PerformanceSummary(long startTime, long endTime) { - this( - startTime, - endTime, - "<span class='date-label'>" - + Long.toString(TimeUnit.MICROSECONDS.toMillis(endTime)) - + "</span>"); - } - - /** - * Determine if the performance summary contains the provided time. - * - * @param time The time (unix timestamp, microseconds) to check. - * @return True if the time is within the performance summary window, false otherwise. - */ - public boolean contains(long time) { - return time >= startTime && time <= endTime; - } - - /** - * Add the profiling data from a ProfilingPointRunEntity to the performance summary. - * - * @param profilingRun The Entity object whose data to add. - */ - public void addData(ProfilingPointEntity profilingPoint, Entity profilingRun) { - ProfilingPointSummaryEntity ppSummary = - ProfilingPointSummaryEntity.fromEntity(profilingRun); - if (ppSummary == null) return; - - String name = profilingPoint.getProfilingPointName(); - if (ppSummary.getLabels() != null && ppSummary.getLabels().size() > 0) { - if (!ppSummary.getSeries().equals("")) { - name += " (" + ppSummary.getSeries() + ")"; - } - if (!summaryMap.containsKey(name)) { - summaryMap.put( - name, - new ProfilingPointSummary( - profilingPoint.getXLabel(), - profilingPoint.getYLabel(), - profilingPoint.getVtsProfilingRegressionMode(profilingPoint.getRegressionMode()))); - } - summaryMap.get(name).update(ppSummary); - } else { - // Use the option suffix as the table name. - // Group all profiling points together into one table - if (!summaryMap.containsKey(ppSummary.getSeries())) { - summaryMap.put( - ppSummary.getSeries(), - new ProfilingPointSummary( - profilingPoint.getXLabel(), - profilingPoint.getYLabel(), - profilingPoint.getVtsProfilingRegressionMode(profilingPoint.getRegressionMode()))); - } - summaryMap.get(ppSummary.getSeries()).updateLabel(ppSummary, name); - } - } - - /** - * Adds a ProfilingPointSummary object into the summary map only if the key doesn't exist. - * - * @param key The name of the profiling point. - * @param summary The ProfilingPointSummary object to add into the summary map. - * @return True if the data was inserted into the performance summary, false otherwise. - */ - public boolean insertProfilingPointSummary(String key, ProfilingPointSummary summary) { - if (!summaryMap.containsKey(key)) { - summaryMap.put(key, summary); - return true; - } - return false; - } - - /** - * Gets the number of profiling points. - * - * @return The number of profiling points in the performance summary. - */ - public int size() { - return summaryMap.size(); - } - - /** - * Gets the names of the profiling points. - * - * @return A string array of profiling point names. - */ - public String[] getProfilingPointNames() { - String[] profilingNames = summaryMap.keySet().toArray(new String[summaryMap.size()]); - Arrays.sort(profilingNames); - return profilingNames; - } - - /** - * Determines if a profiling point is described by the performance summary. - * - * @param profilingPointName The name of the profiling point. - * @return True if the profiling point is contained in the performance summary, else false. - */ - public boolean hasProfilingPoint(String profilingPointName) { - return summaryMap.containsKey(profilingPointName); - } - - /** - * Gets the profiling point summary by name. - * - * @param profilingPointName The name of the profiling point to fetch. - * @return The ProfilingPointSummary object describing the specified profiling point. - */ - public ProfilingPointSummary getProfilingPointSummary(String profilingPointName) { - return summaryMap.get(profilingPointName); - } -} diff --git a/src/main/java/com/android/vts/util/PerformanceUtil.java b/src/main/java/com/android/vts/util/PerformanceUtil.java deleted file mode 100644 index 000f4e0..0000000 --- a/src/main/java/com/android/vts/util/PerformanceUtil.java +++ /dev/null @@ -1,304 +0,0 @@ -/** - * Copyright 2016 Google Inc. All Rights Reserved. - * - * <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of the License at - * - * <p>http://www.apache.org/licenses/LICENSE-2.0 - * - * <p>Unless required by applicable law or agreed to in writing, software distributed under the - * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.vts.util; - -import com.android.vts.entity.ProfilingPointEntity; -import com.android.vts.entity.ProfilingPointRunEntity; -import com.android.vts.entity.ProfilingPointSummaryEntity; -import com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Query; -import java.io.IOException; -import java.math.RoundingMode; -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.logging.Logger; -import org.apache.commons.lang.StringUtils; - -/** PerformanceUtil, a helper class for analyzing profiling and performance data. */ -public class PerformanceUtil { - protected static Logger logger = Logger.getLogger(PerformanceUtil.class.getName()); - - private static final int MAX_BATCH_SIZE = 2000; - private static final DecimalFormat FORMATTER; - private static final String NAME_DELIMITER = ", "; - private static final String OPTION_DELIMITER = "="; - - /** Initialize the decimal formatter. */ - static { - FORMATTER = new DecimalFormat("#.##"); - FORMATTER.setRoundingMode(RoundingMode.HALF_UP); - } - - /** - * Creates the HTML for a table cell representing the percent change between two numbers. - * - * <p>Computes the percent change (after - before)/before * 100 and inserts it into a table cell - * with the specified style. The color of the cell is white if 'after' is less than before. - * Otherwise, the cell is colored red with opacity according to the percent change (100%+ delta - * means 100% opacity). If the before value is 0 and the after value is positive, then the color - * of the cell is 100% red to indicate an increase of undefined magnitude. - * - * @param baseline The baseline value observed. - * @param test The value to compare against the baseline. - * @param classNames A string containing HTML classes to apply to the table cell. - * @param style A string containing additional CSS styles. - * @returns An HTML string for a colored table cell containing the percent change. - */ - public static String getPercentChangeHTML( - double baseline, - double test, - String classNames, - String style, - VtsProfilingRegressionMode mode) { - String pctChangeString = "0 %"; - double alpha = 0; - double delta = test - baseline; - if (baseline != 0) { - double pctChange = delta / baseline; - alpha = pctChange * 2; - pctChangeString = FORMATTER.format(pctChange * 100) + " %"; - } else if (delta != 0) { - // If the percent change is undefined, the cell will be solid red or white - alpha = (int) Math.signum(delta); // get the sign of the delta (+1, 0, -1) - pctChangeString = ""; - } - if (mode == VtsProfilingRegressionMode.VTS_REGRESSION_MODE_DECREASING) { - alpha = -alpha; - } - String color = "background-color: rgba(255, 0, 0, " + alpha + "); "; - String html = "<td class='" + classNames + "' style='" + color + style + "'>"; - html += pctChangeString + "</td>"; - return html; - } - - /** - * Compares a test StatSummary to a baseline StatSummary using best-case performance. - * - * @param baseline The StatSummary object containing initial values to compare against - * @param test The StatSummary object containing test values to be compared against the baseline - * @param innerClasses Class names to apply to cells on the inside of the grid - * @param outerClasses Class names to apply to cells on the outside of the grid - * @param innerStyles CSS styles to apply to cells on the inside of the grid - * @param outerStyles CSS styles to apply to cells on the outside of the grid - * @return HTML string representing the performance of the test versus the baseline - */ - public static String getBestCasePerformanceComparisonHTML( - StatSummary baseline, - StatSummary test, - String innerClasses, - String outerClasses, - String innerStyles, - String outerStyles) { - if (test == null || baseline == null) { - return "<td></td><td></td><td></td><td></td>"; - } - String row = ""; - // Intensity of red color is a function of the relative (percent) change - // in the new value compared to the previous day's. Intensity is a linear function - // of percentage change, reaching a ceiling at 100% change (e.g. a doubling). - row += - getPercentChangeHTML( - baseline.getBestCase(), - test.getBestCase(), - innerClasses, - innerStyles, - test.getRegressionMode()); - row += "<td class='" + innerClasses + "' style='" + innerStyles + "'>"; - row += FORMATTER.format(baseline.getBestCase()); - row += "<td class='" + innerClasses + "' style='" + innerStyles + "'>"; - row += FORMATTER.format(baseline.getMean()); - row += "<td class='" + outerClasses + "' style='" + outerStyles + "'>"; - row += FORMATTER.format(baseline.getStd()) + "</td>"; - return row; - } - - /** - * Updates a PerformanceSummary object with data in the specified window. - * - * @param testName The name of the table whose profiling vectors to retrieve. - * @param startTime The (inclusive) start time in microseconds to scan from. - * @param endTime The (inclusive) end time in microseconds at which to stop scanning. - * @param selectedDevice The name of the device whose data to query for, or null for unfiltered. - * @param summaries The list of PerformanceSummary objects to populate with data. - * @throws IOException - */ - public static void updatePerformanceSummary( - String testName, - long startTime, - long endTime, - String selectedDevice, - List<PerformanceSummary> summaries) { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - Query profilingPointQuery = - new Query(ProfilingPointEntity.KIND) - .setFilter( - new Query.FilterPredicate( - ProfilingPointEntity.TEST_NAME, - Query.FilterOperator.EQUAL, - testName)); - - List<ProfilingPointEntity> profilingPoints = new ArrayList<>(); - for (Entity e : - datastore - .prepare(profilingPointQuery) - .asIterable(DatastoreHelper.getLargeBatchOptions())) { - ProfilingPointEntity pp = ProfilingPointEntity.fromEntity(e); - if (pp == null) continue; - profilingPoints.add(pp); - } - - Query.Filter startFilter = - new Query.FilterPredicate( - ProfilingPointSummaryEntity.START_TIME, - Query.FilterOperator.GREATER_THAN_OR_EQUAL, - startTime); - Query.Filter endFilter = - new Query.FilterPredicate( - ProfilingPointSummaryEntity.START_TIME, - Query.FilterOperator.LESS_THAN_OR_EQUAL, - endTime); - Query.Filter timeFilter = Query.CompositeFilterOperator.and(startFilter, endFilter); - - Query.Filter deviceFilter; - if (selectedDevice != null) { - deviceFilter = FilterUtil.FilterKey.TARGET.getFilterForString(selectedDevice); - } else { - deviceFilter = - FilterUtil.FilterKey.TARGET.getFilterForString(ProfilingPointSummaryEntity.ALL); - } - deviceFilter = - Query.CompositeFilterOperator.and( - deviceFilter, - FilterUtil.FilterKey.BRANCH.getFilterForString( - ProfilingPointSummaryEntity.ALL)); - Query.Filter filter = Query.CompositeFilterOperator.and(timeFilter, deviceFilter); - - Map<ProfilingPointEntity, Iterable<Entity>> asyncEntities = new HashMap<>(); - for (ProfilingPointEntity pp : profilingPoints) { - Query profilingQuery = - new Query(ProfilingPointSummaryEntity.KIND) - .setAncestor(pp.getKey()) - .setFilter(filter); - asyncEntities.put( - pp, - datastore - .prepare(profilingQuery) - .asIterable(DatastoreHelper.getLargeBatchOptions())); - } - - for (ProfilingPointEntity pp : asyncEntities.keySet()) { - for (Entity ppSummaryEntity : asyncEntities.get(pp)) { - ProfilingPointSummaryEntity ppSummary = - ProfilingPointSummaryEntity.fromEntity(ppSummaryEntity); - if (ppSummary == null) continue; - for (PerformanceSummary perfSummary : summaries) { - if (perfSummary.contains(ppSummary.getStartTime())) { - perfSummary.addData(pp, ppSummaryEntity); - } - } - } - } - } - - /** - * Compares a test StatSummary to a baseline StatSummary using average-case performance. - * - * @param baseline The StatSummary object containing initial values to compare against - * @param test The StatSummary object containing test values to be compared against the baseline - * @param innerClasses Class names to apply to cells on the inside of the grid - * @param outerClasses Class names to apply to cells on the outside of the grid - * @param innerStyles CSS styles to apply to cells on the inside of the grid - * @param outerStyles CSS styles to apply to cells on the outside of the grid - * @return HTML string representing the performance of the test versus the baseline - */ - public static String getAvgCasePerformanceComparisonHTML( - StatSummary baseline, - StatSummary test, - String innerClasses, - String outerClasses, - String innerStyles, - String outerStyles) { - if (test == null || baseline == null) { - return "<td></td><td></td><td></td><td></td>"; - } - String row = ""; - // Intensity of red color is a function of the relative (percent) change - // in the new value compared to the previous day's. Intensity is a linear function - // of percentage change, reaching a ceiling at 100% change (e.g. a doubling). - row += - getPercentChangeHTML( - baseline.getMean(), - test.getMean(), - innerClasses, - innerStyles, - test.getRegressionMode()); - row += "<td class='" + innerClasses + "' style='" + innerStyles + "'>"; - row += FORMATTER.format(baseline.getBestCase()); - row += "<td class='" + innerClasses + "' style='" + innerStyles + "'>"; - row += FORMATTER.format(baseline.getMean()); - row += "<td class='" + outerClasses + "' style='" + outerStyles + "'>"; - row += FORMATTER.format(baseline.getStd()) + "</td>"; - return row; - } - - /** - * Generates a string of the values in optionsList which have matches in the profiling entity. - * - * @param profilingRun The entity for a profiling point run. - * @param optionKeys A list of keys to match against the optionsList key value pairs. - * @return The values in optionsList whose key match a key in optionKeys. - */ - public static String getOptionAlias( - ProfilingPointRunEntity profilingRun, Set<String> optionKeys) { - String name = ""; - if (profilingRun.getOptions() != null) { - name = getOptionAlias(profilingRun.getOptions(), optionKeys); - } - return name; - } - - /** - * Generates a string of the values in optionsList which have matches in the profiling entity. - * - * @param optionList The list of key=value option pair strings. - * @param optionKeys A list of keys to match against the optionsList key value pairs. - * @return The values in optionsList whose key match a key in optionKeys. - */ - public static String getOptionAlias(List<String> optionList, Set<String> optionKeys) { - String name = ""; - List<String> nameSuffixes = new ArrayList<>(); - for (String optionString : optionList) { - String[] optionParts = optionString.split(OPTION_DELIMITER); - if (optionParts.length != 2) { - continue; - } - if (optionKeys.contains(optionParts[0].trim().toLowerCase())) { - nameSuffixes.add(optionParts[1].trim().toLowerCase()); - } - } - if (nameSuffixes.size() > 0) { - StringUtils.join(nameSuffixes, NAME_DELIMITER); - name += StringUtils.join(nameSuffixes, NAME_DELIMITER); - } - return name; - } -} diff --git a/src/main/java/com/android/vts/util/ProfilingPointSummary.java b/src/main/java/com/android/vts/util/ProfilingPointSummary.java deleted file mode 100644 index b08615a..0000000 --- a/src/main/java/com/android/vts/util/ProfilingPointSummary.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.util; - -import com.android.vts.entity.ProfilingPointSummaryEntity; -import com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -/** Represents statistical summaries of each profiling point. */ -public class ProfilingPointSummary implements Iterable<StatSummary> { - private List<StatSummary> statSummaries; - private Map<String, Integer> labelIndices; - private List<String> labels; - private VtsProfilingRegressionMode regressionMode; - public String xLabel; - public String yLabel; - - /** Initializes the summary with empty arrays. */ - public ProfilingPointSummary( - String xLabel, String yLabel, VtsProfilingRegressionMode regressionMode) { - statSummaries = new ArrayList<>(); - labelIndices = new HashMap<>(); - labels = new ArrayList<>(); - this.regressionMode = regressionMode; - this.xLabel = xLabel; - this.yLabel = yLabel; - } - - /** - * Determines if a data label is present in the profiling point. - * - * @param label The name of the label. - * @return true if the label is present, false otherwise. - */ - public boolean hasLabel(String label) { - return labelIndices.containsKey(label); - } - - /** - * Gets the statistical summary for a specified data label. - * - * @param label The name of the label. - * @return The StatSummary object if it exists, or null otherwise. - */ - public StatSummary getStatSummary(String label) { - if (!hasLabel(label)) return null; - return statSummaries.get(labelIndices.get(label)); - } - - /** - * Gets the last-seen regression mode. - * - * @return The VtsProfilingRegressionMode value. - */ - public VtsProfilingRegressionMode getRegressionMode() { - return regressionMode; - } - - /** - * Updates the profiling summary with the data from a new profiling report. - * - * @param ppSummary The profiling point run entity object containing profiling data. - */ - public void update(ProfilingPointSummaryEntity ppSummary) { - for (String label : ppSummary.getLabels()) { - if (!ppSummary.getLabelStats().containsKey(label)) continue; - if (!labelIndices.containsKey(label)) { - labelIndices.put(label, statSummaries.size()); - labels.add(label); - statSummaries.add(ppSummary.getLabelStats().get(label)); - } else { - StatSummary summary = getStatSummary(label); - summary.merge(ppSummary.getLabelStats().get(label)); - } - } - } - - /** - * Updates the profiling summary at a label with the data from a new profiling report. - * - * <p>Updates the summary specified by the label with all values provided in the report. If - * labels are provided in the report, they will be ignored -- all values are updated only to the - * provided label. - * - * @param ppSummary The ProfilingPointSummaryEntity object containing profiling data. - * @param label The String label for which all values in the report will be updated. - */ - public void updateLabel(ProfilingPointSummaryEntity ppSummary, String label) { - if (!labelIndices.containsKey(label)) { - labelIndices.put(label, labels.size()); - labels.add(label); - StatSummary stat = - new StatSummary( - label, - ppSummary.getGlobalStats().getMin(), - ppSummary.getGlobalStats().getMax(), - ppSummary.getGlobalStats().getMean(), - ppSummary.getGlobalStats().getSumSq(), - ppSummary.getGlobalStats().getCount(), - ppSummary.getGlobalStats().getRegressionMode()); - statSummaries.add(stat); - } else { - StatSummary summary = getStatSummary(label); - summary.merge(ppSummary.getGlobalStats()); - } - } - - /** - * Gets an iterator that returns stat summaries in the ordered the labels were specified in the - * ProfilingReportMessage objects. - */ - @Override - public Iterator<StatSummary> iterator() { - Iterator<StatSummary> it = - new Iterator<StatSummary>() { - private int currentIndex = 0; - - @Override - public boolean hasNext() { - return labels != null && currentIndex < labels.size(); - } - - @Override - public StatSummary next() { - String label = labels.get(currentIndex++); - return statSummaries.get(labelIndices.get(label)); - } - - @Override - public void remove() { - // Not supported - throw new UnsupportedOperationException(); - } - }; - return it; - } -} diff --git a/src/main/java/com/android/vts/util/StatSummary.java b/src/main/java/com/android/vts/util/StatSummary.java deleted file mode 100644 index 3b4713c..0000000 --- a/src/main/java/com/android/vts/util/StatSummary.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.util; - -import com.android.vts.proto.VtsReportMessage.VtsProfilingRegressionMode; - -/** Helper object for storing statistics. */ -public class StatSummary { - private String label; - private double min; - private double max; - private double mean; - private double sumSq; - private int n; - private VtsProfilingRegressionMode regression_mode; - - /** - * Create a statistical summary. - * - * <p>Sets the label, min, max, mean, sum of squared error, n, and mode as provided. - * - * @param label The (String) label to assign to the summary. - * @param min The minimum observed value. - * @param max The maximum observed value. - * @param mean The average observed value. - * @param sumSq The sum of squared error. - * @param n The number of values observed. - * @param mode The VtsProfilingRegressionMode to use when analyzing performance. - */ - public StatSummary( - String label, - double min, - double max, - double mean, - double sumSq, - int n, - VtsProfilingRegressionMode mode) { - this.label = label; - this.min = min; - this.max = max; - this.mean = mean; - this.sumSq = sumSq; - this.n = n; - this.regression_mode = mode; - } - - /** - * Initializes the statistical summary. - * - * <p>Sets the label as provided. Initializes the mean, variance, and n (number of values seen) - * to 0. - * - * @param label The (String) label to assign to the summary. - * @param mode The VtsProfilingRegressionMode to use when analyzing performance. - */ - public StatSummary(String label, VtsProfilingRegressionMode mode) { - this(label, Double.MAX_VALUE, Double.MIN_VALUE, 0, 0, 0, mode); - } - - /** - * Update the mean and variance using Welford's single-pass method. - * - * @param value The observed value in the stream. - */ - public void updateStats(double value) { - n += 1; - double oldMean = mean; - mean = oldMean + (value - oldMean) / n; - sumSq = sumSq + (value - mean) * (value - oldMean); - if (value < min) min = value; - if (value > max) max = value; - } - - /** - * Combine the mean and variance with another StatSummary. - * - * @param stat The StatSummary to combine with. - */ - public void merge(StatSummary stat) { - double delta = stat.getMean() - mean; - int newN = n + stat.getCount(); - sumSq = sumSq + stat.getSumSq() + delta / newN * delta * n * stat.getCount(); - double recipN = 1.0 / newN; - mean = n * recipN * mean + stat.getCount() * recipN * stat.getMean(); - n = newN; - } - - /** - * Gets the best case of the stream. - * - * @return The min or max. - */ - public double getBestCase() { - switch (regression_mode) { - case VTS_REGRESSION_MODE_DECREASING: - return getMax(); - default: - return getMin(); - } - } - - /** - * Gets the calculated min of the stream. - * - * @return The min. - */ - public double getMin() { - return min; - } - - /** - * Gets the calculated max of the stream. - * - * @return The max. - */ - public double getMax() { - return max; - } - - /** - * Gets the calculated mean of the stream. - * - * @return The mean. - */ - public double getMean() { - return mean; - } - - /** - * Gets the calculated sum of squared error of the stream. - * - * @return The sum of squared error. - */ - public double getSumSq() { - return sumSq; - } - - /** - * Gets the calculated standard deviation of the stream. - * - * @return The standard deviation. - */ - public double getStd() { - return Math.sqrt(sumSq / (n - 1)); - } - - /** - * Gets the number of elements that have passed through the stream. - * - * @return Number of elements. - */ - public int getCount() { - return n; - } - - /** - * Gets the label for the summarized statistics. - * - * @return The (string) label. - */ - public String getLabel() { - return label; - } - - /** - * Gets the regression mode. - * - * @return The VtsProfilingRegressionMode value. - */ - public VtsProfilingRegressionMode getRegressionMode() { - return regression_mode; - } -} diff --git a/src/main/java/com/android/vts/util/TaskQueueHelper.java b/src/main/java/com/android/vts/util/TaskQueueHelper.java deleted file mode 100644 index 3d5df53..0000000 --- a/src/main/java/com/android/vts/util/TaskQueueHelper.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the - * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.vts.util; - -import com.google.appengine.api.taskqueue.Queue; -import com.google.appengine.api.taskqueue.TaskOptions; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** TaskQueueHelper, a helper class for interacting with App Engine Task Queue API. */ -public class TaskQueueHelper { - protected static final Logger logger = Logger.getLogger(TaskQueueHelper.class.getName()); - public static final int MAX_BATCH_ADD_SIZE = 100; - - /** - * Add the list of tasks to the provided queue. - * - * @param queue The task queue in which to insert the tasks. - * @param tasks The list of tasks to add. - */ - public static void addToQueue(Queue queue, List<TaskOptions> tasks) { - List<TaskOptions> puts = new ArrayList<>(); - for (TaskOptions task : tasks) { - puts.add(task); - if (puts.size() == MAX_BATCH_ADD_SIZE) { - queue.addAsync(puts); - puts = new ArrayList<>(); - } else if (puts.size() > MAX_BATCH_ADD_SIZE) { - logger.log(Level.SEVERE, "Too many tasks batched in the task queue API."); - return; - } - } - if (puts.size() > 0) { - queue.addAsync(puts); - } - } -} diff --git a/src/main/java/com/android/vts/util/TestResults.java b/src/main/java/com/android/vts/util/TestResults.java deleted file mode 100644 index adb2a5a..0000000 --- a/src/main/java/com/android/vts/util/TestResults.java +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.util; - -import com.android.vts.entity.CodeCoverageEntity; -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.ProfilingPointRunEntity; -import com.android.vts.entity.TestCaseRunEntity; -import com.android.vts.entity.TestCaseRunEntity.TestCase; -import com.android.vts.entity.TestEntity; -import com.android.vts.entity.TestRunEntity; -import com.android.vts.proto.VtsReportMessage.TestCaseResult; -import com.android.vts.util.UrlUtil.LinkDisplay; -import com.google.appengine.api.datastore.DatastoreService; -import com.google.appengine.api.datastore.DatastoreServiceFactory; -import com.google.appengine.api.datastore.Entity; -import com.google.appengine.api.datastore.Key; -import com.google.appengine.api.datastore.KeyFactory; -import com.google.appengine.api.datastore.Query; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.apache.commons.lang.StringUtils; - -/** Helper object for describing test results data. */ -public class TestResults { - private final Logger logger = Logger.getLogger(getClass().getName()); - - private List<TestRunEntity> testRuns; // list of all test runs - private Map<Key, List<TestCaseRunEntity>> - testCaseRunMap; // map from test run key to the test run information - private Map<Key, List<DeviceInfoEntity>> deviceInfoMap; // map from test run key to device info - private Map<String, Integer> testCaseNameMap; // map from test case name to its order - private Set<String> profilingPointNameSet; // set of profiling point names - - public String testName; - public String[] headerRow; // row to display above the test results table - public String[][] timeGrid; // grid of data storing timestamps to render as dates - public String[][] durationGrid; // grid of data storing timestamps to render as time intervals - public String[][] summaryGrid; // grid of data displaying a summary of the test run - public String[][] resultsGrid; // grid of data displaying test case results - public String[] profilingPointNames; // list of profiling point names in the test run - public Map<String, List<String[]>> logInfoMap; // map from test run index to url/display pairs - public int[] totResultCounts; // array of test result counts for the tip-of-tree runs - public String totBuildId = ""; // build ID of tip-of-tree run - public long startTime = Long.MAX_VALUE; // oldest timestamp displayed in the results table - public long endTime = Long.MIN_VALUE; // newest timestamp displayed in the results table - - // Row labels for the test time-formatted information. - private static final String[] TIME_INFO_NAMES = {"Test Start", "Test End"}; - - // Row labels for the test duration information. - private static final String[] DURATION_INFO_NAMES = {"<b>Test Duration</b>"}; - - // Row labels for the test summary grid. - private static final String[] SUMMARY_NAMES = { - "Total", "Passing #", "Non-Passing #", "Passing %", "Covered Lines", "Coverage %", "Links" - }; - - // Row labels for the device summary information in the table header. - private static final String[] HEADER_NAMES = { - "<b>Stats Type \\ Device Build ID</b>", - "Branch", - "Build Target", - "Device", - "ABI Target", - "VTS Build ID", - "Hostname" - }; - - /** - * Create a test results object. - * - * @param testName The name of the test. - */ - public TestResults(String testName) { - this.testName = testName; - this.testRuns = new ArrayList<>(); - this.deviceInfoMap = new HashMap<>(); - this.testCaseRunMap = new HashMap<>(); - this.testCaseNameMap = new HashMap<>(); - this.logInfoMap = new HashMap<>(); - this.profilingPointNameSet = new HashSet<>(); - } - - /** - * Add a test run to the test results. - * - * @param testRun The Entity containing the test run information. - * @param testCaseRuns The collection of test case executions within the test run. - */ - public void addTestRun(Entity testRun, Iterable<Entity> testCaseRuns) { - TestRunEntity testRunEntity = TestRunEntity.fromEntity(testRun); - if (testRunEntity == null) return; - if (testRunEntity.getStartTimestamp() < startTime) { - startTime = testRunEntity.getStartTimestamp(); - } - if (testRunEntity.getStartTimestamp() > endTime) { - endTime = testRunEntity.getStartTimestamp(); - } - testRuns.add(testRunEntity); - testCaseRunMap.put(testRun.getKey(), new ArrayList<TestCaseRunEntity>()); - - // Process the test cases in the test run - for (Entity e : testCaseRuns) { - TestCaseRunEntity testCaseRunEntity = TestCaseRunEntity.fromEntity(e); - if (testCaseRunEntity == null) continue; - testCaseRunMap.get(testRun.getKey()).add(testCaseRunEntity); - for (TestCase testCase : testCaseRunEntity.testCases) { - if (!testCaseNameMap.containsKey(testCase.name)) { - testCaseNameMap.put(testCase.name, testCaseNameMap.size()); - } - } - } - } - - /** Creates a test case breakdown of the most recent test run. */ - private void generateToTBreakdown() { - totResultCounts = new int[TestCaseResult.values().length]; - if (testRuns.size() == 0) return; - - TestRunEntity mostRecentRun = testRuns.get(0); - List<TestCaseRunEntity> testCaseResults = testCaseRunMap.get(mostRecentRun.getKey()); - List<DeviceInfoEntity> deviceInfos = deviceInfoMap.get(mostRecentRun.getKey()); - if (deviceInfos.size() > 0) { - DeviceInfoEntity totDevice = deviceInfos.get(0); - totBuildId = totDevice.getBuildId(); - } - // Count array for each test result - for (TestCaseRunEntity testCaseRunEntity : testCaseResults) { - for (TestCase testCase : testCaseRunEntity.testCases) { - totResultCounts[testCase.result]++; - } - } - } - - /** - * Get the number of test runs observed. - * - * @return The number of test runs observed. - */ - public int getSize() { - return testRuns.size(); - } - - /** Fetch and process profiling point names for the set of test runs. */ - private void processProfilingPoints() { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - Key testKey = KeyFactory.createKey(TestEntity.KIND, this.testName); - Query.Filter profilingFilter = - FilterUtil.getProfilingTimeFilter( - testKey, TestRunEntity.KIND, this.startTime, this.endTime); - Query profilingPointQuery = - new Query(ProfilingPointRunEntity.KIND) - .setAncestor(testKey) - .setFilter(profilingFilter) - .setKeysOnly(); - Iterable<Entity> profilingPoints = datastore.prepare(profilingPointQuery).asIterable(); - // Process the profiling point observations in the test run - for (Entity e : profilingPoints) { - if (e.getKey().getName() != null) { - profilingPointNameSet.add(e.getKey().getName()); - } - } - } - - /** Fetch and process device information for the set of test runs. */ - private void processDeviceInfos() { - DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); - Key testKey = KeyFactory.createKey(TestEntity.KIND, this.testName); - Query.Filter deviceFilter = - FilterUtil.getDeviceTimeFilter( - testKey, TestRunEntity.KIND, this.startTime, this.endTime); - Query deviceQuery = - new Query(DeviceInfoEntity.KIND) - .setAncestor(testKey) - .setFilter(deviceFilter) - .setKeysOnly(); - List<Key> deviceGets = new ArrayList<>(); - for (Entity device : - datastore.prepare(deviceQuery).asIterable(DatastoreHelper.getLargeBatchOptions())) { - if (testCaseRunMap.containsKey(device.getParent())) { - deviceGets.add(device.getKey()); - } - } - Map<Key, Entity> devices = datastore.get(deviceGets); - for (Key key : devices.keySet()) { - Entity device = devices.get(key); - if (!testCaseRunMap.containsKey(device.getParent())) return; - DeviceInfoEntity deviceEntity = DeviceInfoEntity.fromEntity(device); - if (deviceEntity == null) return; - if (!deviceInfoMap.containsKey(device.getParent())) { - deviceInfoMap.put(device.getParent(), new ArrayList<DeviceInfoEntity>()); - } - deviceInfoMap.get(device.getParent()).add(deviceEntity); - } - } - - /** Post-process the test runs to generate reports of the results. */ - public void processReport() { - if (getSize() > 0) { - processDeviceInfos(); - processProfilingPoints(); - } - testRuns.sort((t1, t2) -> new Long(t2.getStartTimestamp()).compareTo(t1.getStartTimestamp())); - generateToTBreakdown(); - - headerRow = new String[testRuns.size() + 1]; - headerRow[0] = StringUtils.join(HEADER_NAMES, "<br>"); - - summaryGrid = new String[SUMMARY_NAMES.length][testRuns.size() + 1]; - for (int i = 0; i < SUMMARY_NAMES.length; i++) { - summaryGrid[i][0] = "<b>" + SUMMARY_NAMES[i] + "</b>"; - } - - timeGrid = new String[TIME_INFO_NAMES.length][testRuns.size() + 1]; - for (int i = 0; i < TIME_INFO_NAMES.length; i++) { - timeGrid[i][0] = "<b>" + TIME_INFO_NAMES[i] + "</b>"; - } - - durationGrid = new String[DURATION_INFO_NAMES.length][testRuns.size() + 1]; - for (int i = 0; i < DURATION_INFO_NAMES.length; i++) { - durationGrid[i][0] = "<b>" + DURATION_INFO_NAMES[i] + "</b>"; - } - - resultsGrid = new String[testCaseNameMap.size()][testRuns.size() + 1]; - // first column for results grid - for (String testCaseName : testCaseNameMap.keySet()) { - resultsGrid[testCaseNameMap.get(testCaseName)][0] = testCaseName; - } - - // Iterate through the test runs - for (int col = 0; col < testRuns.size(); col++) { - TestRunEntity testRun = testRuns.get(col); - CodeCoverageEntity codeCoverageEntity = testRun.getCodeCoverageEntity(); - - // Process the device information - List<DeviceInfoEntity> devices = deviceInfoMap.get(testRun.getKey()); - List<String> buildIdList = new ArrayList<>(); - List<String> buildAliasList = new ArrayList<>(); - List<String> buildFlavorList = new ArrayList<>(); - List<String> productVariantList = new ArrayList<>(); - List<String> abiInfoList = new ArrayList<>(); - for (DeviceInfoEntity deviceInfoEntity : devices) { - buildAliasList.add(deviceInfoEntity.getBranch()); - buildFlavorList.add(deviceInfoEntity.getBuildFlavor()); - productVariantList.add(deviceInfoEntity.getProduct()); - buildIdList.add(deviceInfoEntity.getBuildId()); - String abi = ""; - String abiName = deviceInfoEntity.getAbiName(); - String abiBitness = deviceInfoEntity.getAbiBitness(); - if (abiName.length() > 0) { - abi += abiName; - if (abiBitness.length() > 0) { - abi += " (" + abiBitness + " bit)"; - } - } - abiInfoList.add(abi); - } - - String buildAlias = StringUtils.join(buildAliasList, ","); - String buildFlavor = StringUtils.join(buildFlavorList, ","); - String productVariant = StringUtils.join(productVariantList, ","); - String buildIds = StringUtils.join(buildIdList, ","); - String abiInfo = StringUtils.join(abiInfoList, ","); - String vtsBuildId = testRun.getTestBuildId(); - - int totalCount = 0; - int passCount = (int) testRun.getPassCount(); - int nonpassCount = (int) testRun.getFailCount(); - TestCaseResult aggregateStatus = TestCaseResult.UNKNOWN_RESULT; - - long totalLineCount = 0; - long coveredLineCount = 0; - if (testRun.getHasCodeCoverage()) { - totalLineCount = codeCoverageEntity.getTotalLineCount(); - coveredLineCount = codeCoverageEntity.getCoveredLineCount(); - } - - // Process test case results - for (TestCaseRunEntity testCaseEntity : testCaseRunMap.get(testRun.getKey())) { - // Update the aggregated test run status - totalCount += testCaseEntity.testCases.size(); - for (TestCase testCase : testCaseEntity.testCases) { - int result = testCase.result; - String name = testCase.name; - if (result == TestCaseResult.TEST_CASE_RESULT_PASS.getNumber()) { - if (aggregateStatus == TestCaseResult.UNKNOWN_RESULT) { - aggregateStatus = TestCaseResult.TEST_CASE_RESULT_PASS; - } - } else if (result != TestCaseResult.TEST_CASE_RESULT_SKIP.getNumber()) { - aggregateStatus = TestCaseResult.TEST_CASE_RESULT_FAIL; - } - - String systraceUrl = null; - - if (testCaseEntity.getSystraceUrl() != null) { - String url = testCaseEntity.getSystraceUrl(); - LinkDisplay validatedLink = UrlUtil.processUrl(url); - if (validatedLink != null) { - systraceUrl = validatedLink.url; - } else { - logger.log(Level.WARNING, "Invalid systrace URL : " + url); - } - } - - int index = testCaseNameMap.get(name); - String classNames = "test-case-status "; - String glyph = ""; - TestCaseResult testCaseResult = TestCaseResult.valueOf(result); - if (testCaseResult != null) classNames += testCaseResult.toString(); - else classNames += TestCaseResult.UNKNOWN_RESULT.toString(); - - if (systraceUrl != null) { - classNames += " width-1"; - glyph += - "<a href=\"" - + systraceUrl - + "\" " - + "class=\"waves-effect waves-light btn red right inline-btn\">" - + "<i class=\"material-icons inline-icon\">info_outline</i></a>"; - } - resultsGrid[index][col + 1] = - "<div class=\"" + classNames + "\"> </div>" + glyph; - } - } - String passInfo; - try { - double passPct = - Math.round((100 * passCount / (passCount + nonpassCount)) * 100f) / 100f; - passInfo = Double.toString(passPct) + "%"; - } catch (ArithmeticException e) { - passInfo = " - "; - } - - // Process coverage metadata - String coverageInfo; - String coveragePctInfo; - try { - double coveragePct = - Math.round((100 * coveredLineCount / totalLineCount) * 100f) / 100f; - coveragePctInfo = - Double.toString(coveragePct) - + "%" - + "<a href=\"/show_coverage?testName=" - + testName - + "&startTime=" - + testRun.getStartTimestamp() - + "\" class=\"waves-effect waves-light btn red right inline-btn\">" - + "<i class=\"material-icons inline-icon\">menu</i></a>"; - coverageInfo = coveredLineCount + "/" + totalLineCount; - } catch (ArithmeticException e) { - coveragePctInfo = " - "; - coverageInfo = " - "; - } - - // Process log information - String linkSummary = " - "; - List<String[]> linkEntries = new ArrayList<>(); - logInfoMap.put(Integer.toString(col), linkEntries); - - if (testRun.getLogLinks() != null) { - for (String rawUrl : testRun.getLogLinks()) { - LinkDisplay validatedLink = UrlUtil.processUrl(rawUrl); - if (validatedLink == null) { - logger.log(Level.WARNING, "Invalid logging URL : " + rawUrl); - continue; - } - String[] logInfo = - new String[] { - validatedLink.name, - validatedLink.url // TODO: process the name from the URL - }; - linkEntries.add(logInfo); - } - } - if (linkEntries.size() > 0) { - linkSummary = Integer.toString(linkEntries.size()); - linkSummary += - "<i class=\"waves-effect waves-light btn red right inline-btn" - + " info-btn material-icons inline-icon\"" - + " data-col=\"" - + Integer.toString(col) - + "\"" - + ">launch</i>"; - } - - String icon = "<div class='status-icon " + aggregateStatus.toString() + "'> </div>"; - String hostname = testRun.getHostName(); - - // Populate the header row - headerRow[col + 1] = - "<span class='valign-wrapper'><b>" - + buildIds - + "</b>" - + icon - + "</span>" - + buildAlias - + "<br>" - + buildFlavor - + "<br>" - + productVariant - + "<br>" - + abiInfo - + "<br>" - + vtsBuildId - + "<br>" - + hostname; - - // Populate the test summary grid - summaryGrid[0][col + 1] = Integer.toString(totalCount); - summaryGrid[1][col + 1] = Integer.toString(passCount); - summaryGrid[2][col + 1] = Integer.toString(nonpassCount); - summaryGrid[3][col + 1] = passInfo; - summaryGrid[4][col + 1] = coverageInfo; - summaryGrid[5][col + 1] = coveragePctInfo; - summaryGrid[6][col + 1] = linkSummary; - - // Populate the test time info grid - timeGrid[0][col + 1] = Long.toString(testRun.getStartTimestamp()); - timeGrid[1][col + 1] = Long.toString(testRun.getEndTimestamp()); - - // Populate the test duration info grid - durationGrid[0][col + 1] = Long.toString(testRun.getEndTimestamp() - testRun.getStartTimestamp()); - } - - profilingPointNames = - profilingPointNameSet.toArray(new String[profilingPointNameSet.size()]); - Arrays.sort(profilingPointNames); - } -} diff --git a/src/main/java/com/android/vts/util/TestRunDetails.java b/src/main/java/com/android/vts/util/TestRunDetails.java deleted file mode 100644 index 584abaf..0000000 --- a/src/main/java/com/android/vts/util/TestRunDetails.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.util; - -import com.android.vts.entity.TestCaseRunEntity; -import com.android.vts.entity.TestCaseRunEntity.TestCase; -import com.android.vts.proto.VtsReportMessage.TestCaseResult; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; - -/** Helper object for describing test results data. */ -public class TestRunDetails { - private static final String NAME_KEY = "name"; - private static final String DATA_KEY = "data"; - - private class ResultColumn { - private final String name; - private final List<String> testCases; - - public ResultColumn(String name) { - this.name = name; - this.testCases = new ArrayList<>(); - } - - public void add(String testCase) { - this.testCases.add(testCase); - } - - public int size() { - return this.testCases.size(); - } - - public JsonObject toJson() { - testCases.sort(Comparator.naturalOrder()); - JsonObject json = new JsonObject(); - json.add(NAME_KEY, new JsonPrimitive(name)); - json.add(DATA_KEY, new Gson().toJsonTree(testCases)); - return json; - } - } - - private final ResultColumn[] columns; - public final int[] resultCounts = new int[TestCaseResult.values().length]; - - public TestRunDetails() { - columns = new ResultColumn[TestCaseResult.values().length]; - for (TestCaseResult r : TestCaseResult.values()) { - columns[r.getNumber()] = new ResultColumn(r.name()); - } - } - - /** - * Add a test case entity to the details object. - * @param testCaseEntity The TestCaseRunEntity object storing test case results. - */ - public void addTestCase(TestCaseRunEntity testCaseEntity) { - for (TestCase testCase : testCaseEntity.getTestCases()) { - int result = testCase.result; - if (result > resultCounts.length) - continue; - ++resultCounts[result]; - ResultColumn column = columns[result]; - column.add(testCase.name); - } - } - - /** - * Serializes the test run details to json format. - * - * @return A JsonObject object representing the details object. - */ - public JsonElement toJson() { - List<JsonObject> jsonColumns = new ArrayList<>(); - for (ResultColumn column : columns) { - if (column.size() > 0) { - jsonColumns.add(column.toJson()); - } - } - return new Gson().toJsonTree(jsonColumns); - } -} diff --git a/src/main/java/com/android/vts/util/TestRunMetadata.java b/src/main/java/com/android/vts/util/TestRunMetadata.java deleted file mode 100644 index bf4bd24..0000000 --- a/src/main/java/com/android/vts/util/TestRunMetadata.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ - -package com.android.vts.util; - -import com.android.vts.entity.DeviceInfoEntity; -import com.android.vts.entity.TestRunEntity; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import java.util.ArrayList; -import java.util.List; -import org.apache.commons.lang.StringUtils; - -/** Helper object for describing test results data. */ -public class TestRunMetadata { - private static final String TEST_RUN = "testRun"; - private static final String TEST_DETAILS = "testDetails"; - private static final String DEVICE_INFO = "deviceInfo"; - private static final String ABI_INFO = "abiInfo"; - public final TestRunEntity testRun; - - private final List<DeviceInfoEntity> devices; - private String deviceInfo; - private String abiInfo; - private TestRunDetails details; - - /** - * Create a test metadata object. - * - * @param testName The name of the test. - * @param testRun The test run entity storing run information. - * @param devices The list of device entities describing the test run. - */ - public TestRunMetadata(String testName, TestRunEntity testRun, List<DeviceInfoEntity> devices) { - this.testRun = testRun; - this.deviceInfo = ""; - this.abiInfo = ""; - this.details = null; - this.devices = devices; - } - - /** - * Create a test metadata object. - * - * @param testName The name of the test. - * @param testRun The test run entity storing run information. - */ - public TestRunMetadata(String testName, TestRunEntity testRun) { - this(testName, testRun, new ArrayList<DeviceInfoEntity>()); - } - - /** - * Add a device info to the test run metadata. - * - * @param device The entity to add. - */ - public void addDevice(DeviceInfoEntity device) { - this.devices.add(device); - } - - /** Get device information for the test run and add it to the metadata message. */ - private void processDeviceInfo() { - List<String> deviceInfoList = new ArrayList<>(); - List<String> abiInfoList = new ArrayList<>(); - - for (DeviceInfoEntity device : this.devices) { - String abi = ""; - String abiName = device.getAbiName(); - String abiBitness = device.getAbiBitness(); - if (abiName.length() > 0) { - abi += abiName; - if (abiBitness.length() > 0) { - abi += " (" + abiBitness + " bit)"; - } - } - abiInfoList.add(abi); - deviceInfoList.add(device.getFingerprint()); - } - this.abiInfo = StringUtils.join(abiInfoList, ", "); - this.deviceInfo = StringUtils.join(deviceInfoList, ", "); - } - - /** - * Get the device info string in the test metadata. - * - * @return The string descriptor of the devices used in the test run. - */ - public String getDeviceInfo() { - return this.deviceInfo; - } - - /** - * Get the test run details (e.g. test case information) for the test run. - * - * @return The TestRunDetails object stored in the metadata, or null if not set. - */ - public TestRunDetails getDetails() { - return this.details; - } - - /** - * Add test case details to the metadata object. - * - * <p>Used for prefetching details on initial page load. - * - * @param details The TestRunDetails object storing test case results for the test run. - */ - public void addDetails(TestRunDetails details) { - this.details = details; - } - - /** - * Serializes the test run metadata to json format. - * - * @return A JsonElement object representing the details object. - */ - public JsonObject toJson() { - processDeviceInfo(); - JsonObject json = new JsonObject(); - json.add(DEVICE_INFO, new JsonPrimitive(this.deviceInfo)); - json.add(ABI_INFO, new JsonPrimitive(this.abiInfo)); - json.add(TEST_RUN, this.testRun.toJson()); - if (this.details != null) { - json.add(TEST_DETAILS, this.details.toJson()); - } - return json; - } -} diff --git a/src/main/java/com/android/vts/util/TimeUtil.java b/src/main/java/com/android/vts/util/TimeUtil.java deleted file mode 100644 index 7e9be26..0000000 --- a/src/main/java/com/android/vts/util/TimeUtil.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you - * may not use this file except in compliance with the License. You may - * obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied. See the License for the specific language governing - * permissions and limitations under the License. - */ -package com.android.vts.util; - -import java.time.Instant; -import java.time.ZoneId; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; -import java.util.concurrent.TimeUnit; -import java.util.logging.Logger; - -/** TimeUtil, a helper class for formatting times. */ -public class TimeUtil { - protected static final Logger logger = Logger.getLogger(TimeUtil.class.getName()); - - public static final String DATE_FORMAT = "yyyy-MM-dd"; - public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; - public static final String DATE_TIME_ZONE_FORMAT = "yyyy-MM-dd HH:mm:ss (z)"; - public static final ZoneId PT_ZONE = ZoneId.of("America/Los_Angeles"); - - /** - * Create a date time string with zone info from the provided timestamp. - * - * @param timeMicroseconds The time in microseconds - * @return A formatted date time string. - */ - public static String getDateTimeZoneString(long timeMicroseconds) { - long timeMillis = TimeUnit.MICROSECONDS.toMillis(timeMicroseconds); - ZonedDateTime zdt = ZonedDateTime.ofInstant(Instant.ofEpochMilli(timeMillis), PT_ZONE); - return DateTimeFormatter.ofPattern(DATE_TIME_ZONE_FORMAT).format(zdt); - } - - /** - * Create a date string from the provided timestamp. - * - * @param timeMicroseconds The time in microseconds - * @return A formatted date string. - */ - public static String getDateString(long timeMicroseconds) { - long timeMillis = TimeUnit.MICROSECONDS.toMillis(timeMicroseconds); - ZonedDateTime zdt = ZonedDateTime.ofInstant(Instant.ofEpochMilli(timeMillis), PT_ZONE); - return DateTimeFormatter.ofPattern(DATE_FORMAT).format(zdt); - } - - /** - * Create a date string from the provided timestamp. - * - * @param timeMicroseconds The time in microseconds - * @return A formatted date string. - */ - public static String getDateTimeString(long timeMicroseconds) { - long timeMillis = TimeUnit.MICROSECONDS.toMillis(timeMicroseconds); - ZonedDateTime zdt = ZonedDateTime.ofInstant(Instant.ofEpochMilli(timeMillis), PT_ZONE); - return DateTimeFormatter.ofPattern(DATE_TIME_FORMAT).format(zdt); - } - - /** - * Create a ZonedDateTime object from the provided timestamp. - * - * @param timeMicroseconds The time in microseconds - * @return A ZonedDateTime object. - */ - public static ZonedDateTime getZonedDateTime(long timeMicroseconds) { - long timeMillis = TimeUnit.MICROSECONDS.toMillis(timeMicroseconds); - return ZonedDateTime.ofInstant(Instant.ofEpochMilli(timeMillis), PT_ZONE); - } -} diff --git a/src/main/java/com/android/vts/util/UrlUtil.java b/src/main/java/com/android/vts/util/UrlUtil.java deleted file mode 100644 index 03c23eb..0000000 --- a/src/main/java/com/android/vts/util/UrlUtil.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright 2017 Google Inc. All Rights Reserved. - * - * <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of the License at - * - * <p>http://www.apache.org/licenses/LICENSE-2.0 - * - * <p>Unless required by applicable law or agreed to in writing, software distributed under the - * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.vts.util; - -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; - -/** UrlUtil, a helper class for formatting and validating URLs. */ -public class UrlUtil { - private static final String HTTPS = "https"; - - public static class LinkDisplay { - public final String name; - public final String url; - - /** - * Create a link display object. - * - * @param uri The hyperlink URI. - */ - public LinkDisplay(URI uri) { - this.url = uri.toString(); - - // Parse the name from the URI path - int lastSeparator = uri.getPath().lastIndexOf('/'); - if (lastSeparator < 0) { - this.name = uri.toString(); - } else { - this.name = uri.getPath().substring(lastSeparator + 1); - } - } - } - - /** - * Validates and formats a URL. - * - * <p>Ensures that the protocol is HTTPs and the URL is properly formatted. This avoids link - * issues in the UI and possible vulnerabilities due to embedded JS in URLs. - * - * @param urlString The url string to validate. - * @returns The validated LinkDisplay object. - */ - public static LinkDisplay processUrl(String urlString) { - try { - URL url = new URL(urlString); - String scheme = url.getProtocol(); - String userInfo = url.getUserInfo(); - String host = url.getHost(); - int port = url.getPort(); - String path = url.getPath(); - String query = url.getQuery(); - String fragment = url.getRef(); - if (!url.getProtocol().equals(HTTPS)) - throw new MalformedURLException(); - URI uri = new URI(scheme, userInfo, host, port, path, query, fragment); - return new LinkDisplay(uri); - } catch (MalformedURLException | URISyntaxException e) { - return null; - } - } -} |