1 /*******************************************************************************
2 * ============LICENSE_START====================================================
4 * * ===========================================================================
5 * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * * ===========================================================================
7 * * Licensed under the Apache License, Version 2.0 (the "License");
8 * * you may not use this file except in compliance with the License.
9 * * You may obtain a copy of the License at
11 * * http://www.apache.org/licenses/LICENSE-2.0
13 * * Unless required by applicable law or agreed to in writing, software
14 * * distributed under the License is distributed on an "AS IS" BASIS,
15 * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * * See the License for the specific language governing permissions and
17 * * limitations under the License.
18 * * ============LICENSE_END====================================================
21 ******************************************************************************/
22 package org.onap.aaf.content;
24 import java.io.StringReader;
27 import org.onap.aaf.misc.rosetta.env.RosettaDF;
28 import org.onap.aaf.misc.rosetta.env.RosettaData;
29 import org.onap.aaf.misc.rosetta.env.RosettaEnv;
31 import aaf.v2_0.Error;
33 // TODO: This test doesn't really do anything. It should be deleted as soon as coverage is above 50%
35 public class JU_Content {
38 public void parseErrorJSON() throws Exception {
39 final String msg = "{\"messageId\":\"SVC2000\",\"text\":\"Select which cred to delete (or 0 to delete all):" +
44 "Run same command again with chosen entry as last parameter\"," +
46 "\"m55555@jr583u.cred.test.com 1 Wed Oct 08 11:48:08 CDT 2014\"," +
47 "\"m55555@jr583u.cred.test.com 1 Thu Oct 09 12:54:46 CDT 2014\"," +
48 "\"m55555@jr583u.cred.test.com 1 Tue Jan 06 05:00:00 CST 2015\"," +
49 "\"m55555@jr583u.cred.test.com 1 Wed Jan 07 05:00:00 CST 2015\"]}";
51 Error err = new Error();
53 err.getVariables().add("I'm a teapot");
54 err.setMessageId("12");
57 // System.out.println(msg);
58 RosettaEnv env = new RosettaEnv();
59 RosettaDF<aaf.v2_0.Error> errDF = env.newDataFactory(aaf.v2_0.Error.class);
60 errDF.in(RosettaData.TYPE.JSON);
61 errDF.out(RosettaData.TYPE.JSON);
62 RosettaData<Error> data = errDF.newData();
65 @SuppressWarnings("unused")
66 String output = data.asString();
67 // System.out.println(output);
69 data.load(new StringReader(msg));
70 err = data.asObject();
71 output = err.getText();
72 // System.out.println(output);