+ public boolean isDistMode() {
+ return mode;
+ }
+ protected JsonElement makeRpcAndGetJson(List<String> args,int count,int index) throws VTPException, IOException {
+ return this.makeRpcAndGetJson(args,count,index, VTP_EXECUTION_GRPC_TIMEOUT);
+ }
+
+ protected JsonElement makeRpcAndGetJson(List<String> args,int count,int index, int timeout) throws VTPException {
+ List<String> result = this.makeRpc(args,count,index, timeout);
+ JsonArray jsonArray = new JsonArray();
+ for (String jsonString : result) {
+ JsonElement obj = new JsonParser().parse(jsonString);
+ jsonArray.add(obj);
+ }
+ return jsonArray;
+ }
+
+ protected List<String> makeRpc(List<String> args, int count, int index, int timeout) {
+ distManager = new DistManager();
+ JsonElement jsonElement = distManager.getExecutionJson(count, index);
+ List<String> resultList = new ArrayList<>();
+ if (jsonElement != null && jsonElement.isJsonArray() && jsonElement.getAsJsonArray().size() > 0) {
+ JsonArray resultsArray = jsonElement.getAsJsonArray();
+ Client client = ClientBuilder.newClient();
+ for (JsonElement jElement : resultsArray) {
+ JsonObject jsonObject = jElement.getAsJsonObject();
+ String testerId = null;
+ String executionId = null;
+ if (jsonObject.has("tester_id"))
+ testerId = jsonObject.get("tester_id").getAsString();
+ if (jsonObject.has("execution_id"))
+ executionId = jsonObject.get("execution_id").getAsString();
+ if (testerId == null || executionId == null)
+ throw new IllegalArgumentException("testerId: " + testerId + " and " + " executionId: " + executionId + " should not be null");
+
+ String testerPath = "/manager/tester/" + testerId;
+ JsonObject jObject = distManager.getResponseFromTester(client, distManager.getManagerURL(), testerPath).getAsJsonObject();
+ String vtpTestCenterIp = jObject.get("iP").getAsString();
+ int vtpTestCenterPort = Integer.parseInt(jObject.get("port").getAsString());
+ args.set(4, executionId);
+ try {
+ resultList.add(distManager.getExecutionDetails(vtpTestCenterIp, vtpTestCenterPort, args, timeout).getOutput());
+ } catch (Exception e) {
+ LOG.error("executionId : " + executionId + " not valid::: " + e.getMessage());
+ }
+ }
+ }
+ return resultList;
+ }