+++ /dev/null
-/*******************************************************************************\r
- * ============LICENSE_START====================================================\r
- * * org.onap.aaf\r
- * * ===========================================================================\r
- * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
- * * ===========================================================================\r
- * * Licensed under the Apache License, Version 2.0 (the "License");\r
- * * you may not use this file except in compliance with the License.\r
- * * You may obtain a copy of the License at\r
- * * \r
- * * http://www.apache.org/licenses/LICENSE-2.0\r
- * * \r
- * * Unless required by applicable law or agreed to in writing, software\r
- * * distributed under the License is distributed on an "AS IS" BASIS,\r
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * * See the License for the specific language governing permissions and\r
- * * limitations under the License.\r
- * * ============LICENSE_END====================================================\r
- * *\r
- * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
- * *\r
- ******************************************************************************/\r
-package org.onap.aaf.content;\r
-\r
-import java.io.StringReader;\r
-\r
-import org.junit.AfterClass;\r
-import org.junit.BeforeClass;\r
-import org.junit.Test;\r
-\r
-import aaf.v2_0.Error;\r
-\r
-import org.onap.aaf.rosetta.env.RosettaDF;\r
-import org.onap.aaf.rosetta.env.RosettaData;\r
-import org.onap.aaf.rosetta.env.RosettaEnv;\r
-\r
-public class JU_Content {\r
-\r
- @BeforeClass\r
- public static void setUpBeforeClass() throws Exception {\r
- }\r
-\r
- @AfterClass\r
- public static void tearDownAfterClass() throws Exception {\r
- }\r
-\r
-\r
- @Test\r
- public void parseErrorJSON() throws Exception {\r
- final String msg = "{\"messageId\":\"SVC2000\",\"text\":\"Select which cred to delete (or 0 to delete all):" +\r
- "1) %1" +\r
- "2) %2" +\r
- "3) %3" +\r
- "4) %4" +\r
- "Run same command again with chosen entry as last parameter\"," +\r
- "\"variables\":[" +\r
- "\"m55555@jr583u.cred.test.com 1 Wed Oct 08 11:48:08 CDT 2014\"," +\r
- "\"m55555@jr583u.cred.test.com 1 Thu Oct 09 12:54:46 CDT 2014\"," +\r
- "\"m55555@jr583u.cred.test.com 1 Tue Jan 06 05:00:00 CST 2015\"," +\r
- "\"m55555@jr583u.cred.test.com 1 Wed Jan 07 05:00:00 CST 2015\"]}";\r
- \r
- Error err = new Error();\r
- err.setText("Hello");\r
- err.getVariables().add("I'm a teapot");\r
- err.setMessageId("12");\r
- \r
- \r
-// System.out.println(msg);\r
- RosettaEnv env = new RosettaEnv();\r
- RosettaDF<aaf.v2_0.Error> errDF = env.newDataFactory(aaf.v2_0.Error.class);\r
- errDF.in(RosettaData.TYPE.JSON);\r
- errDF.out(RosettaData.TYPE.JSON);\r
- RosettaData<Error> data = errDF.newData();\r
- data.load(err);\r
- System.out.println(data.asString());\r
- \r
- data.load(new StringReader(msg));\r
- err = data.asObject();\r
- System.out.println(err.getText());\r
- }\r
- \r
-\r
-}\r