Mass removal of all Tabs (Style Warnings)
[aaf/authz.git] / cadi / aaf / src / test / java / org / onap / aaf / content / JU_Content.java
1 /*******************************************************************************
2  * ============LICENSE_START====================================================
3  * * org.onap.aaf
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
10  * * 
11  *  *      http://www.apache.org/licenses/LICENSE-2.0
12  * * 
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====================================================
19  * *
20  * *
21  ******************************************************************************/
22 package org.onap.aaf.content;
23
24 import java.io.StringReader;
25
26 import org.junit.*;
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;
30
31 import aaf.v2_0.Error;
32
33 // TODO: This test doesn't really do anything. It should be deleted as soon as coverage is above 50%
34
35 public class JU_Content {
36
37     @Test
38     public void parseErrorJSON() throws Exception {
39         final String msg = "{\"messageId\":\"SVC2000\",\"text\":\"Select which cred to delete (or 0 to delete all):" +
40             "1) %1" +
41             "2) %2" +
42             "3) %3" +
43             "4) %4" +
44             "Run same command again with chosen entry as last parameter\"," +
45             "\"variables\":[" +
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\"]}";
50         
51         Error err = new Error();
52         err.setText("Hello");
53         err.getVariables().add("I'm a teapot");
54         err.setMessageId("12");
55         
56         
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();
63         data.load(err);
64         
65         @SuppressWarnings("unused")
66         String output = data.asString();
67 //        System.out.println(output);
68         
69         data.load(new StringReader(msg));
70         err = data.asObject();
71         output = err.getText();
72 //        System.out.println(output);
73     }
74         
75
76 }