首页 \ 问答 \ linux命令和shell命令有什么区别?sudo,yum又是什么?

linux命令和shell命令有什么区别?sudo,yum又是什么?

更新时间:2023-07-19 13:07

最满意答案

定义了RestFul Api,必须先做单元测试,确保Api可用,然后再交给别人去调用,这样才能确保工作进度
(1)使用Apache的jmeter测试工具,很方便,可以批量测试Api,
(2) 使用JerseyClient写测试程序。因为我们用的是jersey实现的RestFul。
(3) 使用浏览器插件工具,我用的是火狐的插件RESTClient
(4)使用curl命令行工具。

使用工具测试Api,GET方法还好,如果是POST方法需要指定方法的Headers(数据格式),Body(请求参数),Api的url。
Body请求参数,如何获取呢,在这里我使用了Gson,先用java组织参数对象,然后用Gson将参数对象转化为json串。
Gson gson = new Gson(); 
String wqtString = gson.toJson(wqt);

System.out.println(wqtString)
举例说明:
我们框架中封装了一个查询参数WebQueryTerm。我获取到它的json串格式为:
{"page":{"number":1,"size":10,"total":0,"sorts":[{"field":"creationTime","type":"DESC"}]},"terms":[{"field":"appType","operator":"equal","value":"0"}]}
其中
page表示分页属性。number当前页,size一页显示多少条数据,
sorts排序:field表示排序字段。type表示排序类型,是desc降序还是asc升序
terms表示查询。field表示查询字段;operator表示是模糊查询Like还是精确查询Equal,value表示你输入的查询值。
追答
这里简单说一下,怎么使用火狐的RESTClient。
(1)首先,在火狐浏览器菜单-附件组件-插件,中搜索RESTClient,并安装
(2)打开RESTClient,点击菜单Headers。输入自定义Request Headers。例如Name = Content-Type  Value=application/json 点击okay!
(3)选择Method,我选择Post,因为我测试获取应用列表,带分页,带查询条件。
(4)输入api资源的url:http://192.168.1.183:8080/osd/rest/app/get_app_list
(5)输入上面的请求参数json串。
(6)点击Send请求API。
结果查看:Response Headers如果Status Code =200 ok则表明API没有异常
再看Response Body返回数据,是否满足你的要求。测试工作完成!

其他回答

info主要存放内容,即请求端需要的数据
response_status 有成功和失败
msg 请求成功为空,失败则解释请求为何失败,逻辑或者少传参数,等等。
{
    "info": {
        "extra": null,
        "data":"ba8ec027040b58ba55f52b07514f948e"
    },
    "response_status": "success",
    "msg": ""
}

相关问答

更多
  • 在很多Java企业级应用中,Spring占据了非常重要的位置,这就导致了基本上的技术选型都是围绕着Spring来, 比方说笔者最近的项目需要开发一个Restful的API接口,选型的时候就说,客户架构师直接就拍了spring-ws,原因呢?系统中其他的模块都是用的Spring-ws,保持一致,而且社区活跃,文档丰富,遇到问题易解决。好了,入正题。 既然选定了Spring-WS, 已经TDD入魔的我,首先想到的就是我应该怎么测试这个API接口呢? 作为业界最成熟的框架,Spring为测试其Web应用提供了非常 ...
  • 首先,在项目的测试代码中加入辅助Spring Web测试的库 Gradle代码 testCompile( "org.springframework:spring-test:$springVersion", "org.springframework.ws:spring-ws-test:2.1.0.RELEASE", "javax.servlet:javax.servlet-api:3.0.1", "com.jayway.jsonpath:json-path-assert:0.9.0" ) 其中,jsonpat ...
  • 首先,在项目的测试代码中加入辅助Spring Web测试的库 Gradle代码 testCompile( "org.springframework:spring-test:$springVersion", "org.springframework.ws:spring-ws-test:2.1.0.RELEASE", "javax.servlet:javax.servlet-api:3.0.1", "com.jayway.jsonpath:json-path-assert:0.9.0" ) 其中,jsonpat ...
  • 在很多Java企业级应用中,Spring占据了非常重要的位置,这就导致了基本上的技术选型都是围绕着Spring来, 比方说笔者最近的项目需要开发一个Restful的API接口,选型的时候就说,客户架构师直接就拍了spring-ws,原因呢?系统中其他的模块都是用的Spring-ws,保持一致,而且社区活跃,文档丰富,遇到问题易解决。好了,入正题。 既然选定了Spring-WS, 已经TDD入魔的我,首先想到的就是我应该怎么测试这个API接口呢? 作为业界最成熟的框架,Spring为测试其Web应用提供了非常 ...
  • 定义了RestFul Api,必须先做单元测试,确保Api可用,然后再交给别人去调用,这样才能确保工作进度 (1)使用Apache的jmeter测试工具,很方便,可以批量测试Api, (2) 使用JerseyClient写测试程序。因为我们用的是jersey实现的RestFul。 (3) 使用浏览器插件工具,我用的是火狐的插件RESTClient (4)使用curl命令行工具。 使用工具测试Api,GET方法还好,如果是POST方法需要指定方法的Headers(数据格式),Body(请求参数),Api的ur ...
  • 如果通过取消一项工作你的意思是删除它,那么你可以使用DELETE动词: DELETE /jobs?ids=123,321,... 如果通过取消工作,你的意思是设置一些状态字段取消,那么你可以使用PATCH动词: PATCH /jobs Content-Type: application/json [ { "id": 123, "status": "cancelled" }, { "id": 321, "status": "cancelled" } ] If by cancelling a job you ...
  • 6个月后更新 誓言 - 很烂。 使用摩卡 原版的 用vow-is代码更新 这是誓言 - 是誓言的例子 - 是examples文件夹 。 // simple HTTP // Run with node example/simple-http.js var express = require("express"); is = require("../src/vows-is.js"); is.config({ "server": { "factory": function _f ...
  • 我会建议: 每个资源只使用一个URI 仅在属性层面区分动物 将多个URI设置为相同的资源绝对不是一个好主意,因为它可能会导致混乱和意外的副作用。 鉴于此,您的单个URI应基于像/animals这样的通用计划。 在“基础”层面处理整个狗和猫集合的下一个挑战已经通过/animals URI方法来解决。 处理特殊类型(如狗和猫)的最后挑战可以通过媒体类型中的查询参数和标识属性的组合来轻松解决。 例如: GET /animals ( Accept : application/vnd.vet-services.ani ...
  • 说实话,任何主要的REST API都需要API密钥,客户端ID或OAuth使用者密钥。 如果您使用Instagram注册您的网站并获得客户ID,那么您可以使用REST API通过JSON“获取”照片和其他详细信息,如下所示: https://api.instagram.com/v1/media/popular?client_id={CLIENT-ID} 如果您在Tumblr注册,您可以获得一个OAuth使用者密钥(也就是API密钥),您可以使用它来“获取”Tumblr博客上的信息,如下所示: https:/ ...
  • 之前未设置/定义$data 。 您需要执行以下操作: $data = new StdObject; 然后为其分配属性: $data -> name = "TESTNAME"; class Hello extends REST_Controller { function world_get() { $data = new StdObject; $data->name = "TESTNAME"; $this->response($data); } } 或者根据示例,您可以使用 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)