public static String testSetQuery(String testSetFolderId, String testSetName) { Map<String, String> params = new HashMap<String, String>(); params.put(QcTestSetEntity.ParentID, testSetFolderId); params.put(QcTestSetEntity.Name, testSetName); return RestQueryBuilder.getQuery(params); }
public static String folderQuery(String folderParentId, String folderName) { Map<String, String> params = new HashMap<String, String>(); params.put(QcFolderEntity.ParentID, folderParentId); params.put(QcFolderEntity.Name, folderName); return RestQueryBuilder.getQuery(params); }
public static String testQuery(String testFolderId, String testName) { Map<String, String> params = new HashMap<String, String>(); if (StringUtils.isDefined(testFolderId)) { params.put(QcTestEntity.ParentID, testFolderId); } params.put(QcTestEntity.Name, testName); return RestQueryBuilder.getQuery(params); }
public static String testInstanceQuery(String testSetId, String testName, String testInstanceId) { String fieldRealization = "fields=" + QcTestInstanceRelations.RealizedByTest + "&"; Map<String, String> params = new HashMap<String, String>(); params.put(QcTestInstanceRelations.ContainsTestSet, testSetId); params.put(QcTestInstanceRelations.RealizedByTest, testName); if (StringUtils.isDefined(testInstanceId)) { params.put(QcTestInstanceEntity.TestInstance, testInstanceId); } return fieldRealization + RestQueryBuilder.getQuery(params); }
public static String getQuery(Map<String, String> kv) { if (kv.size() == 1) { Object[] keys = kv.keySet().toArray(); Object[] values = kv.values().toArray(); return RestQueryBuilder.getQuery(keys[0].toString(), values[0].toString()); } StringBuilder queryStream = new StringBuilder(); for (Map.Entry<String, String> entry : kv.entrySet()) { queryStream.append(entry.getKey().toString()); queryStream.append("['"); queryStream.append(entry.getValue().toString().trim()); queryStream.append("'];"); } return "query=" + getEncoded("{" + queryStream.substring(0, queryStream.length() - 1) + "}"); }