2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2018 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====================================================
22 package org.onap.aaf.misc.rosetta.test;
24 import java.io.Reader;
25 import java.io.StringReader;
27 import org.junit.Test;
28 import org.onap.aaf.misc.env.TimeTaken;
29 import org.onap.aaf.misc.env.Trans;
30 import org.onap.aaf.misc.env.impl.EnvFactory;
31 import org.onap.aaf.misc.env.util.StringBuilderWriter;
32 import org.onap.aaf.misc.rosetta.InJson;
33 import org.onap.aaf.misc.rosetta.JaxInfo;
34 import org.onap.aaf.misc.rosetta.OutJson;
35 import org.onap.aaf.misc.rosetta.OutXML;
36 import org.onap.aaf.misc.rosetta.Saved;
38 import s.xsd.LargerData;
40 public class JU_Saved<b> {
41 private static int ITERATIONS = 100000;
44 public void test() throws Exception {
45 InJson inJSON = new InJson();
46 OutDump dump = new OutDump();
47 JaxInfo ji = JaxInfo.build(LargerData.class);
48 OutXML xml = new OutXML(ji);;
49 OutJson json = new OutJson();
51 Saved saved = new Saved();
53 StringBuilderWriter sbw = new StringBuilderWriter(1024);
56 Report report = new Report(ITERATIONS,"Save","Dump","XML ","JSON");
59 trans = EnvFactory.newTrans();
60 Reader sr = new StringReader(JU_FromJSON.str);
61 TimeTaken tt = trans.start("Parse Text, and Save", 1);
63 saved.load(sr, inJSON);
68 // sbw.append("==== Start Direct Raw =====\n");
69 // new OutRaw().extract(new StringReader(JU_FromJSON.str), sbw, inJSON);
71 // sbw.append("==== Start Raw from Saved =====\n");
72 // new OutRaw().extract(null,sbw,saved);
74 sbw.append("==== Start Dump from Saved =====\n");
75 tt = trans.start("Dump", 2);
77 dump.extract(null,sbw,saved);
82 sbw.append("\n==== Start XML =====\n");
83 tt = trans.start("XML", 3);
85 xml.extract(null,sbw,saved);
90 sbw.append("\n==== Start JSON =====\n");
91 tt = trans.start("JSON", 4);
93 json.extract(null,sbw,saved);
97 report.glean(trans,1,2,3,4);
101 System.out.println(sbw.toString());