小编Mik*_*ike的帖子

Spring测试和JsonPath问题

我遇到了测试和json路径的问题

我只是尝试执行一个简单的测试并检查id的值:

mockMvc.perform(get("/applications/")).andExpect(status().isOk())
       .andDo(print())
       .andExpect(content().contentType(TestUtils.APPLICATION_JSON_UTF8))
       .andExpect(jsonPath("$", hasSize(4)))
       .andExpect(jsonPath("$.id",is(1)));
Run Code Online (Sandbox Code Playgroud)

但是我收到如下错误.好像我的代码应该检查id值.我不够具体,因为返回的JSON中有多个项目?任何帮助表示赞赏.谢谢.

     Content type = application/json;charset=UTF-8
             Body = [{"id":1,"name":"test2"},{"id":2,"name":"test2"}]
   Forwarded URL = null
   Redirected URL = null
          Cookies = []

java.lang.AssertionError: No value at JSON path "$.id", exception: Expected to find an object with property ['id'] in path $ but found 'net.minidev.json.JSONArray'. This is not a json object according to the JsonProvider: 'com.jayway.jsonpath.spi.json.JsonSmartJsonProvider'.
    at org.springframework.test.util.JsonPathExpectationsHelper.evaluateJsonPath(JsonPathExpectationsHelper.java:258)
    at ...
Run Code Online (Sandbox Code Playgroud)

spring-mvc jsonpath

8
推荐指数
2
解决办法
9730
查看次数

带有GenerationType.IDENTITY的JPA和PostgreSQL

我有一个关于Postgres和GenerationType.Identity与Sequence的问题

在这个例子中......

@Id
@SequenceGenerator(name="mytable_id_seq",
                   sequenceName="mytable_id_seq",
                   allocationSize=1)
@GeneratedValue(strategy = GenerationType.SEQUENCE,
                generator="mytable_id_seq")
Run Code Online (Sandbox Code Playgroud)

我知道我正在通过注释指定Postgres序列.

但是,我有一个用'serial'类型定义的id列,我读过我可以简单地使用GenerationType.IDENTITY,它会自动生成一个db序列并用它来自动递增.

如果是这种情况,我认为使用SEQUENCE注释没有优势,除非您使用id的整数或者有一些特定的理由使用您创建的其他序列.IDENTITY的代码很少,并且可能使它在数据库中可移植.

有什么我想念的吗?

提前感谢您的反馈.

postgresql hibernate jpa

6
推荐指数
1
解决办法
9826
查看次数

属性字符串上的Chef错误不匹配

我似乎无法解决在我的attributes/default.rb文件中处理类似命名属性的厨师错误.

我有2个属性:

default['test']['webservice']['https']['keyManagerPwd'] = 'password'
...
...
default['test']['webservice']['https']['keyManagerPwd']['type'] = 'encrypted'
Run Code Online (Sandbox Code Playgroud)

请注意,直到最后一个括号(['type']),名称是相同的.

我在模板和配方中的模板块中引用这些属性.当我去运行它时,我收到此错误:

==================================================[0m
I, [2015-01-28T13:36:43.668692 #7920]  INFO -- core-14-2-centos-65: 
[31mRecipe Compile Error
in /tmp/kitchen/cache/cookbooks/avx/attributes/default.rb[0m
I, [2015-01-28T13:36:43.669192 #7920]  INFO -- core-14-2-centos-65: 
=================================================================[0m
I, [2015-01-28T13:36:43.669192 #7920]  INFO -- core-14-2-centos-65: 
I, [2015-01-28T13:36:43.669692 #7920]  INFO -- core-14-2-centos-65:    
[0mIndexError[0m
I, [2015-01-28T13:36:43.669692 #7920]  INFO -- core-14-2-centos-65: -------
--[0m
I, [2015-01-28T13:36:43.669692 #7920]  INFO -- core-14-2-centos-65: string not matched[0m
I, [2015-01-28T13:36:43.670192 #7920]  INFO -- core-14-2-centos-65: 
I, [2015-01-28T13:36:43.670192 #7920]  INFO -- core-14-2-centos-65:
[0mCookbook Trace:[0m
I, …
Run Code Online (Sandbox Code Playgroud)

ruby chef-infra

3
推荐指数
1
解决办法
2314
查看次数

WSO2 Identity Server - 内部角色与外部角色

我们正在考虑将我们在WSO2中的角色存储在内部数据库中 - 暂时.

据我了解,这些内部角色存储在表UM_HYBRID_ROLE中.我要确认的是,这些角色的处理方式与在外部LDAP中配置的角色的处理方式相同,涉及XACML策略,声明mgt等.

换句话说,我们是否可以假设与内部角色相关的政策/主张与外部角色相关时的行为相同?

WSO2如何处理内部/外部角色(除了它们持续存在的地方)之间是否存在任何差异,我应该注意哪些?

谢谢,迈克

wso2 wso2is

2
推荐指数
1
解决办法
1285
查看次数

标签 统计

chef-infra ×1

hibernate ×1

jpa ×1

jsonpath ×1

postgresql ×1

ruby ×1

spring-mvc ×1

wso2 ×1

wso2is ×1