当前位置: 首页>>代码示例>>Java>>正文


Java JsonPath.get方法代码示例

本文整理汇总了Java中com.jayway.restassured.path.json.JsonPath.get方法的典型用法代码示例。如果您正苦于以下问题:Java JsonPath.get方法的具体用法?Java JsonPath.get怎么用?Java JsonPath.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jayway.restassured.path.json.JsonPath的用法示例。


在下文中一共展示了JsonPath.get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: verifyTaskAttachmentValues

import com.jayway.restassured.path.json.JsonPath; //导入方法依赖的package包/类
private void verifyTaskAttachmentValues(Attachment mockTaskAttachment, String responseContent, boolean urlExist) {
  JsonPath path = from(responseContent);
  String returnedId = path.get("id");
  String returnedTaskId = path.get("taskId");
  String returnedName = path.get("name");
  String returnedType = path.get("type");
  String returnedDescription = path.get("description");
  String returnedUrl = path.get("url");

  Attachment mockAttachment = mockTaskAttachments.get(0);

  assertEquals(mockAttachment.getId(), returnedId);
  assertEquals(mockAttachment.getTaskId(), returnedTaskId);
  assertEquals(mockAttachment.getName(), returnedName);
  assertEquals(mockAttachment.getType(), returnedType);
  assertEquals(mockAttachment.getDescription(), returnedDescription);
  if (urlExist) {
    assertEquals(mockAttachment.getUrl(), returnedUrl);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:TaskRestServiceInteractionTest.java

示例2: loadGeneralSettings

import com.jayway.restassured.path.json.JsonPath; //导入方法依赖的package包/类
private void loadGeneralSettings(JsonPath testSuiteJsonPath) {
    Map<String, String> generalSettings = testSuiteJsonPath.get(JSONPATH_GENERAL_SETTINGS);
    if (generalSettings.containsKey(JSON_FIELD_HTTP_METHOD)) {
        try {
            httpMethod = Method.valueOf(generalSettings.get(JSON_FIELD_HTTP_METHOD));
        } catch (IllegalArgumentException oEx) {
            throw new HeatException("HTTP method '" + generalSettings.get(JSON_FIELD_HTTP_METHOD) + "' not supported");
        }
    }
    if (generalSettings.containsKey(SUITE_DESCRIPTION_PATH)) {
        suiteDescription = generalSettings.get(SUITE_DESCRIPTION_PATH);
    }

}
 
开发者ID:HotelsDotCom,项目名称:heat,代码行数:15,代码来源:TestCaseUtils.java

示例3: loadPreloadedSection

import com.jayway.restassured.path.json.JsonPath; //导入方法依赖的package包/类
private void loadPreloadedSection(JsonPath testSuiteJsonPath) {
    preloadVariables = testSuiteJsonPath.get(JSONPATH_PRELOAD_SECTION);
    if (preloadVariables != null && !preloadVariables.isEmpty()) {
        logUtils.debug("PRELOAD VARIABLES PRESENT");
        placeholderHandler = new PlaceholderHandler();
        for (Map.Entry<String, Object> entry : preloadVariables.entrySet()) {
            preloadVariables.put(entry.getKey(), placeholderHandler.placeholderProcessString(entry.getValue().toString()));
            logUtils.debug("PRELOADED VARIABLE: '{}' = '{}'", entry.getKey(), entry.getValue());
        }
    }
}
 
开发者ID:HotelsDotCom,项目名称:heat,代码行数:12,代码来源:TestCaseUtils.java

示例4: getTestCaseIterator

import com.jayway.restassured.path.json.JsonPath; //导入方法依赖的package包/类
private Iterator<Object[]> getTestCaseIterator(JsonPath testSuiteJsonPath) {
    List<Object> testCases = testSuiteJsonPath.get(JSONPATH_TEST_CASES);
    List<Object[]> listOfArray = new ArrayList<>();
    for (Iterator<Object> testCasesIterator = testCases.iterator(); testCasesIterator.hasNext();) {
        Object[] array = new Object[1];
        array[0] = testCasesIterator.next();
        listOfArray.add(array);
    }
    tcArrayIterator = listOfArray.iterator();
    return tcArrayIterator;
}
 
开发者ID:HotelsDotCom,项目名称:heat,代码行数:12,代码来源:TestCaseUtils.java

示例5: findDatasetIdFromGlobalId

import com.jayway.restassured.path.json.JsonPath; //导入方法依赖的package包/类
/**
 * Assumes you have turned on experimental non-public search
 * https://github.com/IQSS/dataverse/issues/1299
 *
 * curl -X PUT -d true
 * http://localhost:8080/api/admin/settings/:SearchApiNonPublicAllowed
 *
 * @return The Integer found or null.
 */
private static Integer findDatasetIdFromGlobalId(String globalId, String apiToken) {
    Response searchForGlobalId = given()
            .get("api/search?key=" + apiToken
                    + "&q=dsPersistentId:\""
                    + globalId.replace(":", "\\:")
                    + "\"&show_entity_ids=true");
    JsonPath jsonPath = JsonPath.from(searchForGlobalId.body().asString());
    int id;
    try {
        id = jsonPath.get("data.items[0].entity_id");
    } catch (IllegalArgumentException ex) {
        return null;
    }
    return id;
}
 
开发者ID:pengchengluo,项目名称:Peking-University-Open-Research-Data-Platform,代码行数:25,代码来源:SearchIT.java

示例6: getTokenAPI

import com.jayway.restassured.path.json.JsonPath; //导入方法依赖的package包/类
private String getTokenAPI() {
    Response response = given()
            .parameters(Constant.USERNAME, credentials.getAdminUserName(), Constant.PASSWORD,
                    credentials.getAdminUserPassword(), Constant.AUTHENTICATION, Constant.LOCAL)
            .post("/login");

    String json = response.asString();
    JsonPath jp = new JsonPath(json);
    return jp.get(Constant.TOKEN);
}
 
开发者ID:PenielDVP,项目名称:RoomManagerAutomation,代码行数:11,代码来源:APIManager.java

示例7: createLink

import com.jayway.restassured.path.json.JsonPath; //导入方法依赖的package包/类
private String createLink(String url) {
    // @formatter:off
    JsonPath result = given()
        .contentType(MediaType.APPLICATION_FORM_URLENCODED_VALUE)
        .formParameter(PARAMETER_URL, url)
        .post("/api/v1" + LinkController.LINKS)
        .then()
        .statusCode(CREATED.getStatusCode())
        .body(PARAMETER_HASH, not(empty()))
        .extract().body().jsonPath();
    // @formatter:on

    return result.get("hash");
}
 
开发者ID:drissamri,项目名称:linkshortener,代码行数:15,代码来源:LinkControllerIT.java

示例8: getServerIdsForGroup

import com.jayway.restassured.path.json.JsonPath; //导入方法依赖的package包/类
/**
 * Given a RHQ Group this will return a the resource Ids in this
 * Group.
 *
 * @param groupId - the group's RHQ id.
 * @return a list of resourceIds in this group.
 */
public List<Integer> getServerIdsForGroup(Integer groupId) {

	Response response =
	given()
	    .header(acceptJson)
       	.pathParam("groupId", groupId) //$NON-NLS-1$
       .expect()
       	.statusCode(200)
       .when()
       	.get("/group/{groupId}/resources"); //$NON-NLS-1$
	JsonPath jsonPath = response.jsonPath();
	List<Integer> resourceIds = jsonPath.get("resourceId"); //$NON-NLS-1$
	return resourceIds;
}
 
开发者ID:Governance,项目名称:dtgov,代码行数:22,代码来源:RHQDeployUtil.java

示例9: verifyStandardDeploymentValues

import com.jayway.restassured.path.json.JsonPath; //导入方法依赖的package包/类
private void verifyStandardDeploymentValues(Deployment mockDeployment, JsonPath path) {
  String returnedId = path.get("id");
  String returnedName = path.get("name");
  Date returnedDeploymentTime = DateTimeUtil.parseDate(path.<String>get("deploymentTime"));

  assertEquals(mockDeployment.getId(), returnedId);
  assertEquals(mockDeployment.getName(), returnedName);
  assertEquals(mockDeployment.getDeploymentTime(), returnedDeploymentTime);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:10,代码来源:DeploymentRestServiceInteractionTest.java

示例10: verifyDeploymentResource

import com.jayway.restassured.path.json.JsonPath; //导入方法依赖的package包/类
private void verifyDeploymentResource(Resource mockDeploymentResource, Response response) {
  String content = response.asString();

  JsonPath path = from(content);
  String returnedId = path.get("id");
  String returnedName = path.get("name");
  String returnedDeploymentId = path.get("deploymentId");

  assertEquals(mockDeploymentResource.getId(), returnedId);
  assertEquals(mockDeploymentResource.getName(), returnedName);
  assertEquals(mockDeploymentResource.getDeploymentId(), returnedDeploymentId);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:13,代码来源:DeploymentRestServiceInteractionTest.java

示例11: verifyTaskCommentValues

import com.jayway.restassured.path.json.JsonPath; //导入方法依赖的package包/类
private void verifyTaskCommentValues(Comment mockTaskComment, String responseContent) {
  JsonPath path = from(responseContent);
  String returnedId = path.get("id");
  String returnedUserId = path.get("userId");
  String returnedTaskId = path.get("taskId");
  Date returnedTime = DateTimeUtil.parseDate(path.<String>get("time"));
  String returnedFullMessage = path.get("message");

  assertEquals(mockTaskComment.getId(), returnedId);
  assertEquals(mockTaskComment.getTaskId(), returnedTaskId);
  assertEquals(mockTaskComment.getUserId(), returnedUserId);
  assertEquals(mockTaskComment.getTime(), returnedTime);
  assertEquals(mockTaskComment.getFullMessage(), returnedFullMessage);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:15,代码来源:TaskRestServiceInteractionTest.java

示例12: loadJsonSchemaForOutputValidation

import com.jayway.restassured.path.json.JsonPath; //导入方法依赖的package包/类
private void loadJsonSchemaForOutputValidation(JsonPath testSuiteJsonPath) {
    jsonSchemas = testSuiteJsonPath.get(JSONPATH_JSONSCHEMAS);
}
 
开发者ID:HotelsDotCom,项目名称:heat,代码行数:4,代码来源:TestCaseUtils.java


注:本文中的com.jayway.restassured.path.json.JsonPath.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。