gluu
公開メンバ関数 | 全メンバ一覧
org.xdi.oxd.common.JsonTest クラス
org.xdi.oxd.common.JsonTest 連携図
Collaboration graph

公開メンバ関数

void testCommandType () throws IOException
 
void testCommand () throws IOException
 
void testErrorResponseJson () throws IOException
 

詳解

著者
Yuriy Zabrovarnyy
バージョン
0.9, 09/08/2013

関数詳解

◆ testCommand()

void org.xdi.oxd.common.JsonTest.testCommand ( ) throws IOException
inline
29  {
30  Command c = new Command();
31  c.setCommandType(CommandType.GET_USER_INFO);
32  c.setParams(JsonNodeFactory.instance.textNode("myParams"));
33 
34  final String cJson = CoreUtils.asJson(c);
35  Assert.assertTrue(StringUtils.isNotBlank(cJson));
36 
37  final String json = "{\"command\":\"register_client\",\"params\": {\"discovery_url\":\"<discovery url>\",\n" +
38  " \"redirect_url\":\"<redirect url>\",\n" +
39  " \"client_name\":\"<client name>\"\n" +
40  " }\n" +
41  "}";
42  final Command command = CoreUtils.createJsonMapper().readValue(json, Command.class);
43  Assert.assertNotNull(command);
44  }

◆ testCommandType()

void org.xdi.oxd.common.JsonTest.testCommandType ( ) throws IOException
inline
21  {
22  final String json = CoreUtils.asJson(CommandType.GET_AUTHORIZATION_URL);
23  Assert.assertEquals(json, "\"obtain_pat\"");
24  final CommandType obtainPat = CoreUtils.createJsonMapper().readValue(json, CommandType.class);
25  Assert.assertNotNull(obtainPat);
26  }

◆ testErrorResponseJson()

void org.xdi.oxd.common.JsonTest.testErrorResponseJson ( ) throws IOException
inline
47  {
48  final CommandResponse response = CommandResponse.createInternalError();
49  final String json = CoreUtils.asJson(response);
50  Assert.assertTrue(StringUtils.isNotBlank(json));
51  }

このクラス詳解は次のファイルから抽出されました: