1 /*******************************************************************************
\r
2 * ============LICENSE_START====================================================
\r
4 * * ===========================================================================
\r
5 * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * * ===========================================================================
\r
7 * * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * * you may not use this file except in compliance with the License.
\r
9 * * You may obtain a copy of the License at
\r
11 * * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * * Unless required by applicable law or agreed to in writing, software
\r
14 * * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * * See the License for the specific language governing permissions and
\r
17 * * limitations under the License.
\r
18 * * ============LICENSE_END====================================================
\r
20 * * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
22 ******************************************************************************/
\r
23 package org.onap.aaf.content;
\r
25 import java.io.StringReader;
\r
27 import org.junit.AfterClass;
\r
28 import org.junit.BeforeClass;
\r
29 import org.junit.Test;
\r
31 import aaf.v2_0.Error;
\r
33 import org.onap.aaf.rosetta.env.RosettaDF;
\r
34 import org.onap.aaf.rosetta.env.RosettaData;
\r
35 import org.onap.aaf.rosetta.env.RosettaEnv;
\r
37 public class JU_Content {
\r
40 public static void setUpBeforeClass() throws Exception {
\r
44 public static void tearDownAfterClass() throws Exception {
\r
49 public void parseErrorJSON() throws Exception {
\r
50 final String msg = "{\"messageId\":\"SVC2000\",\"text\":\"Select which cred to delete (or 0 to delete all):" +
\r
55 "Run same command again with chosen entry as last parameter\"," +
\r
57 "\"m55555@jr583u.cred.test.com 1 Wed Oct 08 11:48:08 CDT 2014\"," +
\r
58 "\"m55555@jr583u.cred.test.com 1 Thu Oct 09 12:54:46 CDT 2014\"," +
\r
59 "\"m55555@jr583u.cred.test.com 1 Tue Jan 06 05:00:00 CST 2015\"," +
\r
60 "\"m55555@jr583u.cred.test.com 1 Wed Jan 07 05:00:00 CST 2015\"]}";
\r
62 Error err = new Error();
\r
63 err.setText("Hello");
\r
64 err.getVariables().add("I'm a teapot");
\r
65 err.setMessageId("12");
\r
68 // System.out.println(msg);
\r
69 RosettaEnv env = new RosettaEnv();
\r
70 RosettaDF<aaf.v2_0.Error> errDF = env.newDataFactory(aaf.v2_0.Error.class);
\r
71 errDF.in(RosettaData.TYPE.JSON);
\r
72 errDF.out(RosettaData.TYPE.JSON);
\r
73 RosettaData<Error> data = errDF.newData();
\r
75 System.out.println(data.asString());
\r
77 data.load(new StringReader(msg));
\r
78 err = data.asObject();
\r
79 System.out.println(err.getText());
\r