diff options
Diffstat (limited to 'misc/rosetta')
54 files changed, 598 insertions, 598 deletions
diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InJson.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InJson.java index 582c750c..ab33c2af 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InJson.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InJson.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,7 +37,7 @@ public class InJson implements Parse<Reader, State> { state.unsent = 0; return parsed; } - + int ch; char c; StringBuilder sb = parsed.sb; @@ -48,7 +48,7 @@ public class InJson implements Parse<Reader, State> { while (go && (ch=r.read())>=0) { if (state.braces>=0 || ch==Parse.START_OBJ) { // ignore garbage/whitespace before content c=(char)ch; - // Character is a quote. + // Character is a quote. if (c=='"') { if (inQuotes) { if (escaped) { // if escaped Quote, add to data. @@ -112,7 +112,7 @@ public class InJson implements Parse<Reader, State> { parsed.event = c; go = false; break; - + // The Escape Sequence, for Quote marks within Quotes case '\\': // Ignore these, unless within quotes, at which point data-gather @@ -141,7 +141,7 @@ public class InJson implements Parse<Reader, State> { public int braces = 0; public char unsent = 0; } - + // @Override public Parsed<State> newParsed() { return new Parsed<State>(new State()); // no State needed diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InXML.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InXML.java index 175a2aa2..5cd2b1a5 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InXML.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/InXML.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -40,7 +40,7 @@ public class InXML implements Parse<Reader, State> { public InXML(JaxInfo jaxInfo) { this.jaxInfo = jaxInfo; } - + public InXML(Class<?> cls, String ... rootNs) throws SecurityException, NoSuchFieldException, ClassNotFoundException, ParseException { jaxInfo = JaxInfo.build(cls,rootNs); } @@ -49,7 +49,7 @@ public class InXML implements Parse<Reader, State> { // @Override public Parsed<State> parse(Reader r, Parsed<State> parsed) throws ParseException { State state = parsed.state; - + // OK, before anything else, see if there is leftover processing, if so, do it! if (state.unevaluated!=null) { DerTag dt = state.unevaluated; @@ -71,7 +71,7 @@ public class InXML implements Parse<Reader, State> { StringBuilder sb = parsed.sb, tempSB = new StringBuilder(); boolean go = true; - + try { while (go && (ch=r.read())>=0) { c = (char)ch; @@ -108,7 +108,7 @@ public class InXML implements Parse<Reader, State> { // don't add Whitespace to start of SB... saves removing later if (sb.length()>0) { sb.append(c); - } else if (!Character.isWhitespace(c)) { + } else if (!Character.isWhitespace(c)) { sb.append(c); } } @@ -119,28 +119,28 @@ public class InXML implements Parse<Reader, State> { throw new ParseException(e); } } - + public static final class DerTag { public String name; public boolean isEndTag; public List<Prop> props; private boolean isXmlInfo; - //private String ns; - + //private String ns; + public DerTag() { name=null; isEndTag = false; props = null; isXmlInfo = false; } - + public DerTag parse(Reader r, StringBuilder sb) throws ParseException { int ch; char c; boolean inQuotes = false, escaped = false; boolean go = true; String tag = null; - + try { if ((ch = r.read())<0) throw new ParseException("Reader content ended before complete"); if (ch=='?') { @@ -210,7 +210,7 @@ public class InXML implements Parse<Reader, State> { } } } - + public String toString() { StringBuilder sb = new StringBuilder(); sb.append(isEndTag?"End":"Start"); @@ -227,7 +227,7 @@ public class InXML implements Parse<Reader, State> { return sb.toString(); } } - + private static class ArrayState { public boolean firstObj = true; public boolean didNext = false; @@ -244,7 +244,7 @@ public class InXML implements Parse<Reader, State> { unevaluated = null; attribs = null;; } - + public boolean hasAttributes() { return attribs!=null && idx<attribs.size(); } @@ -256,7 +256,7 @@ public class InXML implements Parse<Reader, State> { } attribs.add(prop); } - + public Prop pop() { Prop rv = null; if (attribs!=null) { @@ -266,18 +266,18 @@ public class InXML implements Parse<Reader, State> { return rv; } } - + private static abstract class GreatExpectations { protected JaxInfo ji; protected GreatExpectations prev; private Map<String,String> ns; - + public GreatExpectations(State state, JaxInfo curr, GreatExpectations prev, DerTag derTag) throws ParseException { this.prev = prev; ns = null; ji = getDerived(state, curr,derTag); } - + public abstract boolean eval(Parsed<State> parsed, DerTag derTag) throws ParseException; // Recursively look back for any namespaces @@ -301,9 +301,9 @@ public class InXML implements Parse<Reader, State> { private JaxInfo getDerived(State state, JaxInfo ji, DerTag derTag) throws ParseException { if (derTag==null)return ji; - + List<Prop> props = derTag.props; - + Prop derived = null; if (props!=null) { // Load Namespaces (if any) @@ -339,13 +339,13 @@ public class InXML implements Parse<Reader, State> { return derived==null?ji:ji.getDerived(derived.value); } } - + private static class RootExpectations extends GreatExpectations { - + public RootExpectations(State state, JaxInfo curr, GreatExpectations prev) throws ParseException { super(state,curr,prev, null); } - + // @Override public boolean eval(Parsed<State> parsed, DerTag derTag) throws ParseException { if (derTag.isXmlInfo) { @@ -357,13 +357,13 @@ public class InXML implements Parse<Reader, State> { } else { //parsed.name = derTag.name; parsed.event = START_OBJ; - parsed.state.greatExp = new ObjectExpectations(parsed.state,ji, this, false, derTag); + parsed.state.greatExp = new ObjectExpectations(parsed.state,ji, this, false, derTag); } } return false; } } - + private static class ObjectExpectations extends GreatExpectations { private boolean printName; @@ -413,7 +413,7 @@ public class InXML implements Parse<Reader, State> { return false; } } - + private static class LeafExpectations extends GreatExpectations { public LeafExpectations(State state, JaxInfo curr, GreatExpectations prev) throws ParseException { super(state, curr, prev, null); @@ -429,7 +429,7 @@ public class InXML implements Parse<Reader, State> { throw new ParseException("Expected </" + ji.name + '>'); } return false; - } + } } private static class ArrayExpectations extends GreatExpectations { @@ -445,7 +445,7 @@ public class InXML implements Parse<Reader, State> { if (derTag.isEndTag) { throw new ParseException("Unexpected End Tag </" + derTag.name + '>'); } else { - ArrayState ai = parsed.state.arrayInfo.peek(); + ArrayState ai = parsed.state.arrayInfo.peek(); if (ai.firstObj || ai.didNext) { ai.firstObj = false; ai.didNext = false; @@ -473,7 +473,7 @@ public class InXML implements Parse<Reader, State> { parsed.state.arrayInfo.pop(); } return false; - } + } } // @Override public Parsed<State> newParsed() throws ParseException { @@ -484,5 +484,5 @@ public class InXML implements Parse<Reader, State> { public TimeTaken start(Env env) { return env.start("Rosetta XML In", Env.XML); } - + } diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxEval.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxEval.java index cb6d2f8c..7e4617be 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxEval.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxEval.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxInfo.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxInfo.java index d209f02f..b4d5782a 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxInfo.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxInfo.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -39,7 +39,7 @@ public class JaxInfo { public static final int DATA = 0; public static final int ARRAY = 1; public static final int OBJECT = 2; - + public final String name; public final Class<?> clss; public Map<String, JaxInfo> extensions; // Classes, which might be found at runtime, that extend this class. Lazy Instantiation @@ -50,7 +50,7 @@ public class JaxInfo { public final boolean nillable; public String ns; public boolean isObject() {return members!=null;} - + private JaxInfo(String n, String ns, Class<?> c, JaxInfo[] members, boolean string, boolean array, boolean required, boolean nillable) { name = n; this.ns = ns; @@ -62,14 +62,14 @@ public class JaxInfo { this.nillable = nillable; extensions = null; } - + public int getType() { if (isArray)return ARRAY; else if (members!=null)return OBJECT; return DATA; } - + public JaxInfo getDerived(String derivedName) { JaxInfo derived; // Lazy Instantiation @@ -79,7 +79,7 @@ public class JaxInfo { } else { derived = extensions.get(derivedName); } - + if (derived == null) { //TODO for the moment, Classes are in same package Package pkg = clss.getPackage(); @@ -103,7 +103,7 @@ public class JaxInfo { /** * Build up JAXB Information (recursively) - * + * * @param cls * @param rootNns * @return @@ -117,7 +117,7 @@ public class JaxInfo { } /** * Build up JAXB Information (recursively) - * + * * @param cls * @param rootNns * @return @@ -151,10 +151,10 @@ public class JaxInfo { } } } - + return new JaxInfo(name,defaultNS, cls,buildFields(cls,defaultNS),false,false,false,false); } - + // Build up the name and members of this particular class // This is recursive, if a member is a JAXB Object as well. private static JaxInfo[] buildFields(Class<?> clazz, String defaultNS) throws SecurityException, NoSuchFieldException, ClassNotFoundException { @@ -168,12 +168,12 @@ public class JaxInfo { if ("".equals(field)) break; // odd bug. "" returned when no fields exist, rather than empty array Field rf = cls.getDeclaredField(field); Class<?> ft = rf.getType(); - + boolean required = false; boolean nillable = false; String xmlName = field; String namespace = defaultNS; - + XmlElement xe = rf.getAnnotation(XmlElement.class); if (xe!=null) { xmlName=xe.name(); diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java index 2d7af059..e480b79d 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/JaxSet.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -30,9 +30,9 @@ import javax.xml.bind.annotation.XmlType; /** * For specific XML class, quickly find a Setter Method which will load the object - * + * * Object type of Setter must match String at this time. - * + * * @author Jonathan * * @param <T> @@ -65,7 +65,7 @@ public class JaxSet<T> { } } } - + public static abstract class Setter<O> { protected final Method meth; public Setter(Method meth) { diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Ladder.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Ladder.java index 6ff627b9..6a0a7252 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Ladder.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Ladder.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,9 +25,9 @@ package org.onap.aaf.misc.rosetta; /** * A Ladder is a Stack like Storage Class, but where you can ascend and descend while * the elements exists. - * + * * Like an extension ladder, you can make taller as you go - * + * * @author Jonathan * */ @@ -52,16 +52,16 @@ public class Ladder<T> { public void bottom() { rung = 0; } - + public void top() { rung = struts.length-1; while (rung>0 && struts[rung]==null)--rung; } - + public int howHigh() { return rung; } - + public void jumpTo(int rung) { if (rung>=struts.length) { Object[] temp = new Object[init_size*((rung/init_size)+1)]; @@ -70,17 +70,17 @@ public class Ladder<T> { } this.rung = rung; } - + public int height() { return struts.length; } - + public void cutTo(int rungs) { Object[] temp = new Object[rungs]; System.arraycopy(struts, 0, temp, 0, Math.min(rungs, struts.length)); struts = temp; } - + public void ascend() { ++rung; if (rung>=struts.length) { @@ -89,20 +89,20 @@ public class Ladder<T> { struts = temp; } } - + public void descend() { --rung; } - + @SuppressWarnings("unchecked") public T peek() { return (T)struts[rung]; } - + public void push(T t) { struts[rung]=t; } - + @SuppressWarnings("unchecked") public T pop() { T t = (T)struts[rung]; diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Marshal.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Marshal.java index 3729d1e3..933df4aa 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Marshal.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Marshal.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -72,9 +72,9 @@ public abstract class Marshal<T> implements Parse<T, Marshal.State> { /** * Typical definition of Done is when Iterator in Ladder is "DONE_ITERATOR" - * + * * It is important, however, that the "Ladder Rung" is set to the right level. - * + * * @param state * @return */ diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Nulls.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Nulls.java index d36c07ec..51221bc5 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Nulls.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Nulls.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -48,9 +48,9 @@ public class Nulls { public TimeTaken start(Env env) { return env.start("IN", Env.SUB); } - + }; - + public static final Out OUT = new Out() { // @Override diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Out.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Out.java index aa2b2992..660af000 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Out.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Out.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,7 +28,7 @@ import java.io.Writer; public abstract class Out { public abstract<IN,S> void extract(IN in, Writer writer, Parse<IN, S> parse, boolean ... options) throws IOException, ParseException; - + public<IN,S> void extract(IN in, OutputStream os, Parse<IN, S> parse, boolean ... options) throws IOException, ParseException { Writer w = new OutputStreamWriter(os); try { @@ -37,7 +37,7 @@ public abstract class Out { w.flush(); } } - + public abstract String logName(); - + } diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJax.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJax.java index 4fb52d86..9f78c2c7 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJax.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJax.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -39,9 +39,9 @@ public class OutJax extends Out { if (je==null)throw new ParseException("Incomplete content"); je = je.eval(p); } - + } - + @Override public String logName() { return "Rosetta JAX"; diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java index 2d93bb49..e2f45d1e 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutJson.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -50,7 +50,7 @@ public class OutJson extends Out { while ((p = prs.parse(in,p.reuse())).valid()) { ++count; switch(p.event) { - case 1: + case 1: continue; case 2: if (count==2) { // it's empty, write open/close on it's own @@ -64,7 +64,7 @@ public class OutJson extends Out { if (jsonLevel.peek().printObjectName) { print = true; } else { // don't print names on first - print=false; + print=false; } maybe=jsonLevel.peek().listItem(); jsonLevel.push(new LevelStack(true)); @@ -72,9 +72,9 @@ public class OutJson extends Out { case '}': if (p.hasData()) { // if we have data, we print that, so may need to prepend a comma. maybe = jsonLevel.peek().listItem(); - } else { // No data means just print, + } else { // No data means just print, p.name = ""; // XML tags come through with names, but no data - } + } print = true; jsonLevel.pop(); afterName = p.event; @@ -94,7 +94,7 @@ public class OutJson extends Out { else maybe = jsonLevel.peek().listItem(); } else { p.name = ""; // XML tags come through with names, but no data - } + } jsonLevel.pop(); print = true; @@ -114,7 +114,7 @@ public class OutJson extends Out { } if (maybe!=0) { - if (ipw==null)writer.append(maybe); + if (ipw==null)writer.append(maybe); else ipw.println(maybe); maybe = 0; } @@ -132,7 +132,7 @@ public class OutJson extends Out { if (p.event==3)writer.append("__"); writer.append(p.name); writer.append("\":"); - } + } if (p.hasData()) { if (p.isString) { writer.append('"'); @@ -171,7 +171,7 @@ public class OutJson extends Out { } afterName = 0; } - + if (ipw!=null) { switch(p.event) { case '[': @@ -206,7 +206,7 @@ public class OutJson extends Out { } } - + } @Override @@ -217,11 +217,11 @@ public class OutJson extends Out { private static class LevelStack { public boolean printObjectName=false; private boolean first_n_List=true; - + public LevelStack(boolean printObjectName) { this.printObjectName = printObjectName; } - + public char listItem() { if (first_n_List) { first_n_List=false; diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutRaw.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutRaw.java index f07498b3..fbdf631d 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutRaw.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutRaw.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,13 +29,13 @@ public class OutRaw extends Out{ @Override public<IN,S> void extract(IN in, Writer writer, Parse<IN,S> prs, boolean ... options) throws IOException, ParseException { Parsed<S> p = prs.newParsed(); - - while ((p = prs.parse(in,p.reuse())).valid()) { + + while ((p = prs.parse(in,p.reuse())).valid()) { writer.append(p.toString()); writer.append('\n'); } } - + @Override public String logName() { return "Rosetta RAW"; diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutXML.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutXML.java index 6472c88e..1004da6e 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutXML.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/OutXML.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,9 +34,9 @@ import org.onap.aaf.misc.env.util.StringBuilderWriter; public class OutXML extends Out{ private static final String XMLNS_XSI = "xmlns:xsi"; - public static final String XML_INFO = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"; + public static final String XML_INFO = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"; public static final String XML_SCHEMA_INSTANCE = "http://www.w3.org/2001/XMLSchema-instance"; - + private String root; private List<Prop> props; @@ -49,27 +49,27 @@ public class OutXML extends Out{ props.add(new Prop(tv[0],tv[1])); } } - + public OutXML(JaxInfo jaxInfo) { this(jaxInfo.name,genNS(jaxInfo)); } - + public OutXML(InXML inXML) { this(inXML.jaxInfo.name,genNS(inXML.jaxInfo)); } - + private static String[] genNS(JaxInfo jaxInfo) { return new String[] {"xmlns=" + jaxInfo.ns}; } - - + + @Override public<IN,S> void extract(IN in, Writer writer, Parse<IN,S> prs, boolean ... options) throws IOException, ParseException { Parsed<S> p = prs.newParsed(); Stack<Level> stack = new Stack<Level>(); // If it's an IndentPrintWriter, it is pretty printing. boolean pretty = (options.length>0&&options[0]); - + IndentPrintWriter ipw; if (pretty) { if (writer instanceof IndentPrintWriter) { @@ -114,22 +114,22 @@ public class OutXML extends Out{ if (pretty)ipw.inc(); break; case Parse.END_OBJ: - if (p.hasData()) + if (p.hasData()) closeTag = tag(writer,writer,pretty,false,p.name, XmlEscape.convert(p.sb)); if (pretty)ipw.dec(); writer.append(level.sbw.getBuffer()); level = stack.pop(); break; - case Parse.START_ARRAY: + case Parse.START_ARRAY: level.multi = p.name; break; case Parse.END_ARRAY: - if (p.hasData()) + if (p.hasData()) closeTag = tag(writer,writer,pretty,false, p.name, XmlEscape.convert(p.sb)); level.multi=null; break; case Parse.ATTRIB: - if (p.hasData()) + if (p.hasData()) attrib(writer,pretty,p.name, XmlEscape.convert(p.sb), level); break; case Parse.NEXT: @@ -141,13 +141,13 @@ public class OutXML extends Out{ writer.append(level.sbw.getBuffer()); writer.flush(); } - + private class Level { public final StringBuilderWriter sbw; public String multi; private Level prev; private Map<String,String> nses; - + public Level(Level level) { sbw = new StringBuilderWriter(); multi = null; @@ -162,18 +162,18 @@ public class OutXML extends Out{ String v = nses.get(ns); return value.equals(v); // note: accomodates not finding NS as well } - + if (create && !rv) { if (nses == null) nses = new HashMap<>(); nses.put(ns, value); } return rv; } - - - + + + } - + private boolean tag(Writer fore, Writer aft, boolean pretty, boolean returns, String tag, String data) throws IOException { fore.append('<'); fore.append(tag); @@ -188,7 +188,7 @@ public class OutXML extends Out{ if (pretty)aft.append('\n'); return data==null; } - + private void attrib(Writer fore, boolean pretty, String tag, String value, Level level) throws IOException { String realTag = tag.startsWith("__")?tag.substring(2):tag; // remove __ if (realTag.equals(Parsed.EXTENSION_TAG)) { // Convert Derived name into XML defined Inheritance @@ -209,7 +209,7 @@ public class OutXML extends Out{ } } fore.append(' '); - fore.append(realTag); + fore.append(realTag); fore.append("=\""); fore.append(value); fore.append('"'); diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parse.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parse.java index d068530c..fe2dd3e2 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parse.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parse.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,20 +26,20 @@ import org.onap.aaf.misc.env.TimeTaken; public interface Parse<IN, S> { public Parsed<S> parse(IN in, Parsed<S> parsed) throws ParseException; - + // EVENTS public static final char NONE = 0; public static final char START_DOC = 1; public static final char END_DOC = 2; public static final char ATTRIB = 3; - + public static final char NEXT = ','; public static final char START_OBJ = '{'; public static final char END_OBJ = '}'; public static final char START_ARRAY = '['; public static final char END_ARRAY = ']'; - + public Parsed<S> newParsed() throws ParseException; - public TimeTaken start(Env env); - + public TimeTaken start(Env env); + } diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/ParseException.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/ParseException.java index 38ea956a..8b1dd8fe 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/ParseException.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/ParseException.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parsed.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parsed.java index 29a86de8..739d8e52 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parsed.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Parsed.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,9 +24,9 @@ package org.onap.aaf.misc.rosetta; public class Parsed<S> { public static final String EXTENSION_TAG="extension"; - + public boolean isString; - + public StringBuilder sb; public char event; public String name; @@ -48,7 +48,7 @@ public class Parsed<S> { public boolean valid() { return event!=Parse.NONE; } - + public Parsed<S> reuse() { isString=false; sb.setLength(0); @@ -70,7 +70,7 @@ public class Parsed<S> { public boolean hasData() { return sb.length()>0; } - + public String toString() { StringBuilder sb2 = new StringBuilder(); if (event<40)sb2.append((int)event); diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Prop.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Prop.java index d46fc8be..4d414c3c 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Prop.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Prop.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,13 +28,13 @@ class Prop { tag = t; value =v; } - + public Prop(String t_equals_v) { String[] tv = t_equals_v.split("="); if (tv.length>1) { tag = tv[0]; value = tv[1]; - } + } } public String toString() { diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Saved.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Saved.java index efb4ce4b..5e88e3a3 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Saved.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/Saved.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,9 +31,9 @@ import org.onap.aaf.misc.env.TimeTaken; import org.onap.aaf.misc.rosetta.Saved.State; /** - * An Out Object that will save off produced Parsed Stream and + * An Out Object that will save off produced Parsed Stream and * a Parse (In) Object that will reproduce Parsed Stream on demand - * + * * @author Jonathan * */ @@ -43,7 +43,7 @@ public class Saved extends Out implements Parse<Reader, State>{ private Content content[]; private int idx; private boolean append = false; - + /** * Read from Parsed Stream and save */ @@ -59,7 +59,7 @@ public class Saved extends Out implements Parse<Reader, State>{ content[idx]=null; } while (--idx>=0); } - + // Note: idx needs to be -1 on initialization and no appendages while ((p = parser.parse(in,p.reuse())).valid()) { if (!(append && (p.event==START_DOC || p.event==END_DOC))) { // skip any start/end of document in appendages @@ -72,14 +72,14 @@ public class Saved extends Out implements Parse<Reader, State>{ } } } - + // @Override public Parsed<State> parse(Reader ignore, Parsed<State> parsed) throws ParseException { int i; - if ((i=parsed.state.count++)<=idx) + if ((i=parsed.state.count++)<=idx) content[i].load(parsed); - else - parsed.event = Parse.NONE; + else + parsed.event = Parse.NONE; return parsed; } @@ -113,14 +113,14 @@ public class Saved extends Out implements Parse<Reader, State>{ public static class State { public int count = 0; } - + public static class Content { private boolean isString; private char event; private String name; private List<Prop> props; private String str; - + public Content(Parsed<?> p) { isString = p.isString; event = p.event; @@ -137,7 +137,7 @@ public class Saved extends Out implements Parse<Reader, State>{ if (str!=null) p.sb.append(str); } - + public String toString() { StringBuilder sb = new StringBuilder(); sb.append(event); @@ -161,7 +161,7 @@ public class Saved extends Out implements Parse<Reader, State>{ return sb.toString(); } } - + //// @Override public Parsed<State> newParsed() { Parsed<State> ps = new Parsed<State>(new State()); @@ -184,7 +184,7 @@ public class Saved extends Out implements Parse<Reader, State>{ public TimeTaken start(Env env) { return env.start(ROSETTA_SAVED, 0); } - + @Override public String logName() { return ROSETTA_SAVED; diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/XmlEscape.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/XmlEscape.java index 3007ea95..15f42050 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/XmlEscape.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/XmlEscape.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,7 +28,7 @@ import java.util.TreeMap; public class XmlEscape { private XmlEscape() {} - + private static final TreeMap<String,Integer> charMap; // see initialization at end private static final TreeMap<Integer,String> intMap; // see initialization at end @@ -38,7 +38,7 @@ public class XmlEscape { StringBuilder esc = new StringBuilder(); for (int cnt = 0;cnt<9 /*max*/; ++cnt) { if ((c=r.read())<0)throw new ParseException("Invalid Data: Unfinished Escape Sequence"); - if (c!=';') { + if (c!=';') { esc.append((char)c); } else { // evaluate Integer i = charMap.get(esc.toString()); @@ -53,19 +53,19 @@ public class XmlEscape { break; } } - - + + } catch (IOException e) { throw new ParseException(e); } } - + public static void xmlEscape(StringBuilder sb, int chr) { sb.append('&'); sb.append(intMap.get(chr)); sb.append(';'); } - + public static String convert(StringBuilder insb) { int idx, ch; StringBuilder sb=null; @@ -77,9 +77,9 @@ public class XmlEscape { break; } } - + if (sb==null)return insb.toString(); - + for (int i=idx;i<insb.length();++i) { ch = insb.charAt(i); if (ch<160) { @@ -361,7 +361,7 @@ public class XmlEscape { charMap.put("clubs",9827); charMap.put("hearts",9829); charMap.put("diams",9830); - + for ( Entry<String, Integer> es: charMap.entrySet()) { if (es.getValue()>=160); // save small space... note that no longer has amp, etc. intMap.put(es.getValue(), es.getKey()); diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaDF.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaDF.java index a95da8ea..b12cce02 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaDF.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaDF.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -56,18 +56,18 @@ import org.onap.aaf.misc.rosetta.ParseException; import org.onap.aaf.misc.rosetta.marshal.DocMarshal; public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> { - + static InJson inJSON = new InJson(); InXML inXML; static OutJson outJSON = new OutJson(); OutXML outXML; static OutRaw outRAW = new OutRaw(); - + // Temporary until we write JAXB impl... JAXBmar jaxMar; JAXBumar jaxUmar; - + private Parse<Reader,?> defaultIn; private Out defaultOut; private RosettaEnv env; @@ -75,7 +75,7 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> { private TYPE outType; private int defOption; Marshal<T> marshal = null; - + /** * Private constructor to setup Type specific data manipulators @@ -92,13 +92,13 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> { RosettaDF(RosettaEnv env, Schema schema, String rootNs, Class<T> cls) throws APIException { this.env = env; try { - // Note: rootNs can be null, in order to derive content from Class. + // Note: rootNs can be null, in order to derive content from Class. JaxInfo ji = rootNs==null?JaxInfo.build(cls):JaxInfo.build(cls,rootNs); // Note: JAXBmar sets qname to null if not exists jaxMar = new JAXBmar(rootNs==null?null:new QName("xmlns",rootNs),cls); // Note: JAXBumar sets schema to null if not exists jaxUmar = new JAXBumar(schema, cls); - + defaultIn = inXML = new InXML(ji); defaultOut = outXML = new OutXML(ji); inType=outType=Data.TYPE.XML; @@ -107,11 +107,11 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> { throw new APIException(e); } } - + // @Override public RosettaData<T> newData() { - RosettaData<T> data = new RosettaData<T>(env, this) + RosettaData<T> data = new RosettaData<T>(env, this) .in(inType) .out(outType) .option(defOption); @@ -141,7 +141,7 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> { /** * If exists, first option is "Pretty", second is "Fragment" - * + * * @param options * @return */ @@ -150,7 +150,7 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> { defaultOut = getOut(type==Data.TYPE.DEFAULT?Data.TYPE.JSON:type); return this; } - + public Parse<Reader,?> getIn(Data.TYPE type) { switch(type) { case DEFAULT: @@ -163,7 +163,7 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> { return defaultIn; } } - + public Out getOut(Data.TYPE type) { switch(type) { case DEFAULT: @@ -178,7 +178,7 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> { return defaultOut; } } - + public int logType(org.onap.aaf.misc.env.Data.TYPE ot) { switch(ot) { case JSON: @@ -204,15 +204,15 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> { public RosettaDF<T> option(int option) { defOption = option; - + return this; } /** * Assigning Root Marshal Object - * + * * Will wrap with DocMarshal Object if not already - * + * * @param marshal * @return */ @@ -224,7 +224,7 @@ public class RosettaDF<T> extends BaseDataFactory implements DataFactory<T> { } return this; } - + public void direct(Trans trans, T t, OutputStream os, boolean ... options) throws APIException, IOException { Out out = getOut(outType); TimeTaken tt = trans.start(out.logName(),logType(outType)); // determine from Out.. without dependency on Env? diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java index 36ebde68..006e8133 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -48,7 +48,7 @@ public class RosettaData<T> implements Data<T>{ private boolean options[] = new boolean[] {false, false}; // Temp Storage of XML. Only when we must use JAXB to read in Objects private String xml,json; - + // package on purpose RosettaData(Env env, RosettaDF<T> rosettaDF) { df = rosettaDF; @@ -57,7 +57,7 @@ public class RosettaData<T> implements Data<T>{ inType = df.getInType(); outType = df.getOutType(); // take defaults } - + //Added for junits void setSaved(Saved saved) { this.saved = saved; @@ -68,7 +68,7 @@ public class RosettaData<T> implements Data<T>{ inType = rosettaType; return this; } - + // // @Override public RosettaData<T> out(TYPE rosettaType) { outType = rosettaType; @@ -89,7 +89,7 @@ public class RosettaData<T> implements Data<T>{ } return this; } - + // @Override public RosettaData<T> load(InputStream is) throws APIException { Parse<Reader,?> in = df.getIn(inType); @@ -119,7 +119,7 @@ public class RosettaData<T> implements Data<T>{ json = str; break; default: - + } } catch (Exception e) { throw new APIException(e); @@ -152,7 +152,7 @@ public class RosettaData<T> implements Data<T>{ public Saved getEvents() { return saved; } - + // @Override public T asObject() throws APIException { Out out = df.getOut(TYPE.XML); @@ -206,7 +206,7 @@ public class RosettaData<T> implements Data<T>{ os.write(xml.getBytes()); } else if (outType==TYPE.JSON && json!=null) { os.write(json.getBytes()); - } else { + } else { out.extract(null, os, saved, options); } } catch (Exception e) { @@ -226,7 +226,7 @@ public class RosettaData<T> implements Data<T>{ writer.append(xml); } else if (outType==TYPE.JSON && json!=null) { writer.append(json); - } else { + } else { out.extract(null, writer, saved, options); } } catch (Exception e) { @@ -236,18 +236,18 @@ public class RosettaData<T> implements Data<T>{ } return this; } - + // @Override public Class<T> getTypeClass() { return df.getTypeClass(); } private static final boolean[] emptyOption = new boolean[0]; - + public void direct(InputStream is, OutputStream os) throws APIException, IOException { direct(is,os,emptyOption); } - + public void direct(Reader reader, Writer writer, boolean ... options) throws APIException, IOException { Parse<Reader,?> in = df.getIn(inType); Out out = df.getOut(outType); @@ -302,7 +302,7 @@ public class RosettaData<T> implements Data<T>{ } } - + public void direct(InputStream is, OutputStream os, boolean ... options) throws APIException, IOException { direct(new InputStreamReader(is),new OutputStreamWriter(os), options); } diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaEnv.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaEnv.java index 43855d6c..62d7bc1b 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaEnv.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/env/RosettaEnv.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,7 +32,7 @@ import org.onap.aaf.misc.env.APIException; /** * An essential Implementation of Env, which will fully function, without any sort * of configuration. - * + * * Use as a basis for Group level Env, just overriding where needed. * @author Jonathan * @@ -62,7 +62,7 @@ public class RosettaEnv extends org.onap.aaf.misc.env.impl.BasicEnv { public RosettaEnv(Properties props) { super(props); } - + @SuppressWarnings("unchecked") @Override public <T> RosettaDF<T> newDataFactory(Class<?>... classes) throws APIException { diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DataWriter.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DataWriter.java index 0617e01d..e546d6dc 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DataWriter.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DataWriter.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,38 +26,38 @@ import javax.xml.datatype.XMLGregorianCalendar; import org.onap.aaf.misc.env.util.Chrono; /** - * We make these objects instead of static functions so they can be passed into + * We make these objects instead of static functions so they can be passed into * FieldArray. - * + * * @author Jonathan * * @param <T> */ public abstract class DataWriter<T> { public abstract boolean write(T t, StringBuilder sb); - + public final static DataWriter<String> STRING = new DataWriter<String>() { @Override public boolean write(String s, StringBuilder sb) { sb.append(s); return true; - } + } }; - + public final static DataWriter<Integer> INTEGER = new DataWriter<Integer>() { @Override public boolean write(Integer i, StringBuilder sb) { sb.append(i); return false; - } + } }; - + public final static DataWriter<Long> LONG = new DataWriter<Long>() { @Override public boolean write(Long t, StringBuilder sb) { sb.append(t); return false; - } + } }; public final static DataWriter<Byte> BYTE = new DataWriter<Byte>() { @@ -65,7 +65,7 @@ public abstract class DataWriter<T> { public boolean write(Byte t, StringBuilder sb) { sb.append(t); return false; - } + } }; public final static DataWriter<Character> CHAR = new DataWriter<Character>() { @@ -73,7 +73,7 @@ public abstract class DataWriter<T> { public boolean write(Character t, StringBuilder sb) { sb.append(t); return true; - } + } }; public final static DataWriter<Boolean> BOOL = new DataWriter<Boolean>() { @@ -81,7 +81,7 @@ public abstract class DataWriter<T> { public boolean write(Boolean t, StringBuilder sb) { sb.append(t); return true; - } + } }; @@ -99,7 +99,7 @@ public abstract class DataWriter<T> { // } return true; } - + }; */ @@ -110,7 +110,7 @@ public abstract class DataWriter<T> { return true; } }; - + public final static DataWriter<XMLGregorianCalendar> DATE_TIME = new DataWriter<XMLGregorianCalendar>() { @Override public boolean write(XMLGregorianCalendar t, StringBuilder sb) { @@ -123,7 +123,7 @@ public abstract class DataWriter<T> { public final static DataWriter<byte[]> HEX_BINARY = new DataWriter<byte[]>() { @Override public boolean write(byte[] ba, StringBuilder sb) { - // FYI, doing this because don't want intermediate + // FYI, doing this because don't want intermediate // String in "HexString" or the processing in // "String.format" //sb.append("0x"); diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DocMarshal.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DocMarshal.java index 1fa17010..1a7ec972 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DocMarshal.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/DocMarshal.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,11 +31,11 @@ import org.onap.aaf.misc.rosetta.Parsed; public class DocMarshal<T> extends Marshal<T> { private Marshal<T> root; - + public DocMarshal(Marshal<T> root) { this.root = root; } - + @Override public Parsed<State> parse(T t, Parsed<State> parsed) throws ParseException { Ladder<Iterator<?>> ladder = parsed.state.ladder; diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldArray.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldArray.java index abc19b26..d91286af 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldArray.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldArray.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -38,7 +38,7 @@ public abstract class FieldArray<T,S> extends Marshal<T> { this.name = name; dataWriter = dw; } - + @SuppressWarnings("unchecked") @Override public Parsed<State> parse(T t, Parsed<State> parsed) throws ParseException { @@ -69,7 +69,7 @@ public abstract class FieldArray<T,S> extends Marshal<T> { } else { mem=null; } - + if (mem!=null) { parsed.isString=dataWriter.write(mem, parsed.sb); parsed.event = NEXT; diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldBlob.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldBlob.java index 34fa5dd6..9849bf43 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldBlob.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldBlob.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,12 +26,12 @@ public abstract class FieldBlob<T> extends FieldMarshal<T>{ super(name); } - protected abstract byte[] data(T t); + protected abstract byte[] data(T t); @Override protected boolean data(T t, StringBuilder sb) { return false; - // unimplemented + // unimplemented //return DataWriter.BYTE_ARRAY.write(data(t),sb); } diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDate.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDate.java index 2418d7af..e0f837a7 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDate.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDate.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,5 +33,5 @@ public abstract class FieldDate<T> extends FieldMarshal<T> { return DataWriter.DATE.write(data(t), sb); } - protected abstract XMLGregorianCalendar data(T t); + protected abstract XMLGregorianCalendar data(T t); } diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDateTime.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDateTime.java index ae125617..aa7623cf 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDateTime.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldDateTime.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,5 +33,5 @@ public abstract class FieldDateTime<T> extends FieldMarshal<T> { return DataWriter.DATE_TIME.write(data(t), sb); } - protected abstract XMLGregorianCalendar data(T t); + protected abstract XMLGregorianCalendar data(T t); } diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldHexBinary.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldHexBinary.java index fa9e6323..668aede6 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldHexBinary.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldHexBinary.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,7 +26,7 @@ public abstract class FieldHexBinary<T> extends FieldMarshal<T>{ super(name); } - protected abstract byte[] data(T t); + protected abstract byte[] data(T t); @Override protected boolean data(T t, StringBuilder sb) { diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldMarshal.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldMarshal.java index 2e77618b..d76c65a2 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldMarshal.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldMarshal.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,11 +32,11 @@ public abstract class FieldMarshal<T> extends Marshal<T> { public FieldMarshal(String name) { this.name = name; } - + public String getName() { return name; } - + @Override public Parsed<State> parse(T t, Parsed<State> parsed) { parsed.state.ladder.push(DONE_ITERATOR); @@ -55,5 +55,5 @@ public abstract class FieldMarshal<T> extends Marshal<T> { * @return */ protected abstract boolean data(T t, StringBuilder sb); - + }
\ No newline at end of file diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldNumeric.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldNumeric.java index 0a5c28ad..072775bc 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldNumeric.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldNumeric.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,5 +32,5 @@ public abstract class FieldNumeric<N,T> extends FieldMarshal<T> { return false; } - protected abstract N data(T t); + protected abstract N data(T t); } diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldString.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldString.java index e96b6967..d0b1e486 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldString.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/FieldString.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -26,7 +26,7 @@ public abstract class FieldString<T> extends FieldMarshal<T> { super(name); } - protected abstract String data(T t); + protected abstract String data(T t); @Override final protected boolean data(T t, StringBuilder sb) { diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ListIterator.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ListIterator.java index ed8b98c4..4bc23449 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ListIterator.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ListIterator.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -35,7 +35,7 @@ final class ListIterator<T> implements Iterator<T> { private Iterator<T> delg; public ListIterator(List<T> list) { curr = null; - delg = list.iterator(); + delg = list.iterator(); } @Override public boolean hasNext() { @@ -46,7 +46,7 @@ final class ListIterator<T> implements Iterator<T> { public T next() { return curr = delg.hasNext()?delg.next():null; } - + public T peek() { return curr==null?next():curr; } @@ -55,5 +55,5 @@ final class ListIterator<T> implements Iterator<T> { public void remove() { delg.remove(); } - + }
\ No newline at end of file diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java index 9c64e83d..f6685234 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjArray.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java index d96a44d0..3f5d3732 100644 --- a/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java +++ b/misc/rosetta/src/main/java/org/onap/aaf/misc/rosetta/marshal/ObjMarshal.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -41,23 +41,23 @@ public abstract class ObjMarshal<T> extends Marshal<T> { // Note: Not Using List or ArrayList, because there is no "Peek" concept in their iterator. private Marshal<T>[] pml; private int end=0; - + /** * @param pm */ @SuppressWarnings("unchecked") protected void add(Marshal<T> pm) { if (pml==null) { - pml = new Marshal[Ladder.DEFAULT_INIT_SIZE]; + pml = new Marshal[Ladder.DEFAULT_INIT_SIZE]; } else if (end>pml.length) { - Object temp[] = pml; + Object temp[] = pml; pml = new Marshal[pml.length+Ladder.DEFAULT_INIT_SIZE]; System.arraycopy(temp, 0, pml, 0, pml.length); } pml[end]=pm; ++end; } - + /* (non-Javadoc) * @see org.onap.aaf.misc.rosetta.Parse#parse(java.lang.Object, org.onap.aaf.misc.rosetta.Parsed) */ @@ -120,12 +120,12 @@ public abstract class ObjMarshal<T> extends Marshal<T> { public Marshal<T> peek() { return idx<0?null:pml[idx]; } - + @Override public void remove() { pml[idx]=null; } - + } } diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java index 1a31b0fb..83972f96 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -43,7 +43,7 @@ public class JU_ParseException { ParseException pe = new ParseException("exception",new NullPointerException("exception")); } - - + + } diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/Api.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/Api.java index 20744355..e7d07406 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/Api.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/Api.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,10 +19,10 @@ * */ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2018.12.09 at 10:14:23 PM IST +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2018.12.09 at 10:14:23 PM IST // @@ -39,9 +39,9 @@ import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. - * + * * <p>The following schema fragment specifies the expected content contained within this class. - * + * * <pre> * <complexType> * <complexContent> @@ -70,8 +70,8 @@ import javax.xml.bind.annotation.XmlType; * </complexContent> * </complexType> * </pre> - * - * + * + * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { @@ -84,25 +84,25 @@ public class Api { /** * Gets the value of the route property. - * - * <p> + * + * * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the route property. - * - * <p> + * + * * For example, to add a new item, do as follows: * <pre> * getRoute().add(newItem); * </pre> - * - * - * <p> + * + * + * * Objects of the following type(s) are allowed in the list * {@link Api.Route } - * - * + * + * */ public List<Api.Route> getRoute() { if (route == null) { @@ -114,9 +114,9 @@ public class Api { /** * <p>Java class for anonymous complex type. - * + * * <p>The following schema fragment specifies the expected content contained within this class. - * + * * <pre> * <complexType> * <complexContent> @@ -135,8 +135,8 @@ public class Api { * </complexContent> * </complexType> * </pre> - * - * + * + * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { @@ -166,11 +166,11 @@ public class Api { /** * Gets the value of the meth property. - * + * * @return * possible object is * {@link String } - * + * */ public String getMeth() { return meth; @@ -178,11 +178,11 @@ public class Api { /** * Sets the value of the meth property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setMeth(String value) { this.meth = value; @@ -190,11 +190,11 @@ public class Api { /** * Gets the value of the path property. - * + * * @return * possible object is * {@link String } - * + * */ public String getPath() { return path; @@ -202,11 +202,11 @@ public class Api { /** * Sets the value of the path property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setPath(String value) { this.path = value; @@ -214,25 +214,25 @@ public class Api { /** * Gets the value of the param property. - * - * <p> + * + * * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the param property. - * - * <p> + * + * * For example, to add a new item, do as follows: * <pre> * getParam().add(newItem); * </pre> - * - * - * <p> + * + * + * * Objects of the following type(s) are allowed in the list * {@link String } - * - * + * + * */ public List<String> getParam() { if (param == null) { @@ -243,11 +243,11 @@ public class Api { /** * Gets the value of the desc property. - * + * * @return * possible object is * {@link String } - * + * */ public String getDesc() { return desc; @@ -255,11 +255,11 @@ public class Api { /** * Sets the value of the desc property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setDesc(String value) { this.desc = value; @@ -267,25 +267,25 @@ public class Api { /** * Gets the value of the comments property. - * - * <p> + * + * * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the comments property. - * - * <p> + * + * * For example, to add a new item, do as follows: * <pre> * getComments().add(newItem); * </pre> - * - * - * <p> + * + * + * * Objects of the following type(s) are allowed in the list * {@link String } - * - * + * + * */ public List<String> getComments() { if (comments == null) { @@ -296,25 +296,25 @@ public class Api { /** * Gets the value of the contentType property. - * - * <p> + * + * * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the contentType property. - * - * <p> + * + * * For example, to add a new item, do as follows: * <pre> * getContentType().add(newItem); * </pre> - * - * - * <p> + * + * + * * Objects of the following type(s) are allowed in the list * {@link String } - * - * + * + * */ public List<String> getContentType() { if (contentType == null) { @@ -325,7 +325,7 @@ public class Api { /** * Gets the value of the expected property. - * + * */ public int getExpected() { return expected; @@ -333,7 +333,7 @@ public class Api { /** * Sets the value of the expected property. - * + * */ public void setExpected(int value) { this.expected = value; @@ -341,25 +341,25 @@ public class Api { /** * Gets the value of the explicitErr property. - * - * <p> + * + * * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the explicitErr property. - * - * <p> + * + * * For example, to add a new item, do as follows: * <pre> * getExplicitErr().add(newItem); * </pre> - * - * - * <p> + * + * + * * Objects of the following type(s) are allowed in the list * {@link Integer } - * - * + * + * */ public List<Integer> getExplicitErr() { if (explicitErr == null) { diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java index 9ab3b258..0d942e09 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -58,21 +58,21 @@ public class JU_RosettaData { @Mock Env env; - + @Mock RosettaDF df; - + @Mock JAXBmar bmar; - + @Mock Saved saved; - + @Before public void setUp() { initMocks(this); } - + @Test public void testLoad() { RosettaData rosettaObj = new RosettaData(env, df); @@ -84,14 +84,14 @@ public class JU_RosettaData { Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(sr,(Writer)null,inxml); - + rosettaObj = rosettaObj.load(sr); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testLoadException() { RosettaData rosettaObj = new RosettaData(env, df); @@ -105,7 +105,7 @@ public class JU_RosettaData { assertTrue(e.getMessage().contains("NullPointerException")); } } - + @Test public void testLoadIs() { RosettaData rosettaObj = new RosettaData(env, df); @@ -117,14 +117,14 @@ public class JU_RosettaData { Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(new InputStreamReader(sr),(Writer)null,inxml); - + rosettaObj = rosettaObj.load(sr); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testLoadIsException() { RosettaData rosettaObj = new RosettaData(env, df); @@ -138,7 +138,7 @@ public class JU_RosettaData { assertTrue(e.getMessage().contains("NullPointerException")); } } - + @Test public void testLoadStr() { RosettaData rosettaObj = new RosettaData(env, df); @@ -149,7 +149,7 @@ public class JU_RosettaData { Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml); - + rosettaObj = rosettaObj.load("test"); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block @@ -166,7 +166,7 @@ public class JU_RosettaData { Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.JSON); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml); - + rosettaObj = rosettaObj.load("test"); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block @@ -186,7 +186,7 @@ public class JU_RosettaData { assertTrue(e.getMessage().contains("NullPointerException")); } } - + @Test public void testLoadT() { RosettaData rosettaObj = new RosettaData(env, df); @@ -198,7 +198,7 @@ public class JU_RosettaData { df.jaxMar = Mockito.mock(JAXBmar.class); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml); - + rosettaObj = rosettaObj.load(bmar); df.marshal = null; rosettaObj = rosettaObj.load(bmar); @@ -207,7 +207,7 @@ public class JU_RosettaData { e.printStackTrace(); } } - + @Test public void testLoadTMarshalNull() { RosettaData rosettaObj = new RosettaData(env, df); @@ -226,7 +226,7 @@ public class JU_RosettaData { e.printStackTrace(); } } - + @Test public void testLoadTException() { RosettaData rosettaObj = new RosettaData(env, df); @@ -240,14 +240,14 @@ public class JU_RosettaData { assertTrue(e.getMessage().contains("NullPointerException")); } } - + @Test public void testGetEvents() { RosettaData rosettaObj = new RosettaData(env, df); Saved saved = rosettaObj.getEvents(); assertEquals("Rosetta Saved", saved.logName()); } - + @Test public void testAsObject() { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); @@ -265,15 +265,15 @@ public class JU_RosettaData { Mockito.doReturn( lt).when(env).debug(); Mockito.doNothing().when(saved).extract(null,new StringWriter(),saved); Mockito.doReturn(bmar).when(df.jaxUmar).unmarshal(lt,""); - + bmar = rosettaObj.asObject(); - + } catch (APIException | IOException | ParseException | JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testAsObjectException() { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); @@ -291,9 +291,9 @@ public class JU_RosettaData { Mockito.doReturn( lt).when(env).debug(); Mockito.doThrow(new IOException("test Exception")).when(saved).extract(null,new StringWriter(),saved); Mockito.doThrow(new JAXBException("test Exception")).when(df.jaxUmar).unmarshal(lt,""); - + bmar = rosettaObj.asObject(); - + } catch (APIException | IOException | ParseException | JAXBException e) { assertTrue(e.getMessage().contains("test Exception")); } @@ -308,12 +308,12 @@ public class JU_RosettaData { rosettaObj.setSaved(saved); try { Out outxml = Mockito.mock(OutXML.class); - + Mockito.doReturn(outxml).when(df).getOut(type); Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML); Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2); - + String retVal = rosettaObj.asString(); assertTrue("".equals(retVal)); } catch (APIException e) { @@ -321,7 +321,7 @@ public class JU_RosettaData { e.printStackTrace(); } } - + @Test public void testAsStringJson() { TYPE type = TYPE.JSON; @@ -331,12 +331,12 @@ public class JU_RosettaData { rosettaObj.setSaved(saved); try { Out outxml = Mockito.mock(OutXML.class); - + Mockito.doReturn(outxml).when(df).getOut(type); Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON); Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4); - + String retVal = rosettaObj.asString(); assertTrue("".equals(retVal)); } catch (APIException e) { @@ -351,34 +351,34 @@ public class JU_RosettaData { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); rosettaObj = rosettaObj.in(Data.TYPE.XML); rosettaObj.setSaved(saved); - + try { InXML inxml = Mockito.mock(InXML.class); Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml); - + rosettaObj = rosettaObj.load("test"); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + try { Out outxml = Mockito.mock(OutXML.class); - + Mockito.doReturn(outxml).when(df).getOut(type); Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML); Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2); RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(OutputStream.class)); - + } catch (APIException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testToJson() { TYPE type = TYPE.JSON; @@ -386,34 +386,34 @@ public class JU_RosettaData { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); rosettaObj = rosettaObj.in(Data.TYPE.JSON); rosettaObj.setSaved(saved); - + try { InXML inxml = Mockito.mock(InXML.class); Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.JSON); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml); - + rosettaObj = rosettaObj.load("test"); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + try { Out outxml = Mockito.mock(OutXML.class); - + Mockito.doReturn(outxml).when(df).getOut(type); Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON); Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4); RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(OutputStream.class)); - + } catch (APIException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testTo() { TYPE type = TYPE.XML; @@ -421,22 +421,22 @@ public class JU_RosettaData { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); rosettaObj = rosettaObj.in(Data.TYPE.XML); rosettaObj.setSaved(saved); - + try { Out outxml = Mockito.mock(OutXML.class); - + Mockito.doReturn(outxml).when(df).getOut(type); Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML); Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2); RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(OutputStream.class)); - + } catch (APIException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testToWriterXml() { TYPE type = TYPE.XML; @@ -444,34 +444,34 @@ public class JU_RosettaData { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); rosettaObj = rosettaObj.in(Data.TYPE.XML); rosettaObj.setSaved(saved); - + try { InXML inxml = Mockito.mock(InXML.class); Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml); - + rosettaObj = rosettaObj.load("test"); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + try { Out outxml = Mockito.mock(OutXML.class); - + Mockito.doReturn(outxml).when(df).getOut(type); Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML); Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2); RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(StringWriter.class)); - + } catch (APIException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testToWriterJson() { TYPE type = TYPE.JSON; @@ -479,34 +479,34 @@ public class JU_RosettaData { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); rosettaObj = rosettaObj.in(Data.TYPE.JSON); rosettaObj.setSaved(saved); - + try { InXML inxml = Mockito.mock(InXML.class); Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.JSON); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml); - + rosettaObj = rosettaObj.load("test"); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + try { Out outxml = Mockito.mock(OutXML.class); - + Mockito.doReturn(outxml).when(df).getOut(type); Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON); Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4); RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(StringWriter.class)); - + } catch (APIException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testToWriter() { TYPE type = TYPE.XML; @@ -514,28 +514,28 @@ public class JU_RosettaData { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); rosettaObj = rosettaObj.in(Data.TYPE.XML); rosettaObj.setSaved(saved); - + try { Out outxml = Mockito.mock(OutXML.class); - + Mockito.doReturn(outxml).when(df).getOut(type); Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML); Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2); RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(StringWriter.class)); - + } catch (APIException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testGetTypeClass() { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); rosettaObj.getTypeClass(); } - + @Test public void testDirect() { TYPE type = TYPE.XML; @@ -553,7 +553,7 @@ public class JU_RosettaData { e.printStackTrace(); } } - + @Test public void testDirectException() { TYPE type = TYPE.XML; @@ -561,11 +561,11 @@ public class JU_RosettaData { Mockito.doReturn(type).when(df).getInType(); RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); InXML inxml = null; - + inxml = Mockito.mock(InXML.class); Mockito.doReturn(inxml).when(df).getIn(type); - - + + StringReader is = Mockito.mock(StringReader.class); StringWriter os= Mockito.mock(StringWriter.class); try { @@ -575,14 +575,14 @@ public class JU_RosettaData { Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2); Mockito.doThrow( new IOException("testException")).when(outxml).extract(is, os, inxml, true); - + rosettaObj.direct(is,os, true); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block assertTrue(e.getMessage().contains("testException")); } } - + @Test public void testDirectT() { TYPE type = TYPE.XML; @@ -599,7 +599,7 @@ public class JU_RosettaData { LogTarget lt = Mockito.mock(LogTarget.class); Mockito.doReturn( lt).when(env).debug(); Mockito.doReturn(bmar).when(df.jaxMar).marshal(lt,bmar, new StringWriter(),true); - + rosettaObj.direct(bmar, Mockito.mock(StringWriter.class), true); df.marshal =Mockito.mock(Marshal.class);; rosettaObj.direct(bmar, Mockito.mock(StringWriter.class), true); @@ -608,7 +608,7 @@ public class JU_RosettaData { e.printStackTrace(); } } - + @Test public void testDirectTOS() { TYPE type = TYPE.XML; @@ -625,7 +625,7 @@ public class JU_RosettaData { LogTarget lt = Mockito.mock(LogTarget.class); Mockito.doReturn( lt).when(env).debug(); Mockito.doReturn(bmar).when(df.jaxMar).marshal(lt,bmar, new StringWriter(),true); - + rosettaObj.direct(bmar, Mockito.mock(OutputStream.class), true); df.marshal =Mockito.mock(Marshal.class);; rosettaObj.direct(bmar, Mockito.mock(OutputStream.class), true); @@ -634,7 +634,7 @@ public class JU_RosettaData { e.printStackTrace(); } } - + @Test public void testDirectTOSJson() { TYPE type = TYPE.JSON; @@ -651,13 +651,13 @@ public class JU_RosettaData { LogTarget lt = Mockito.mock(LogTarget.class); Mockito.doReturn( lt).when(env).debug(); Mockito.doReturn(bmar).when(df.jaxMar).marshal(lt,bmar, new StringWriter(),true); - + rosettaObj.direct(bmar, Mockito.mock(OutputStream.class), true); } catch (APIException | IOException | JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + } diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java index c8771519..631abc00 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -45,7 +45,7 @@ public class JU_RosettaEnv { public void setUp() { initMocks(this); } - + @Test public void testNewDataFactoryClass() { RosettaEnv rosettaObj = new RosettaEnv(); @@ -57,7 +57,7 @@ public class JU_RosettaEnv { e.printStackTrace(); } } - + @Test public void testNewDataFactorySchema() { RosettaEnv rosettaObj = new RosettaEnv(Mockito.mock(Applet.class),"test"); @@ -69,7 +69,7 @@ public class JU_RosettaEnv { e.printStackTrace(); } } - + @Test public void testNewDataFactoryQname() { RosettaEnv rosettaObj = new RosettaEnv(new String[] {"test"}); @@ -82,7 +82,7 @@ public class JU_RosettaEnv { e.printStackTrace(); } } - + @Test public void testNewDataFactoryQnameSchema() { RosettaEnv rosettaObj = new RosettaEnv("test", new String[] {"test"}); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java index 5b7875f7..a7f8f115 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -38,7 +38,7 @@ public class JU_FieldBlob { // TODO Auto-generated method stub return null; } - + } @Test public void testData() { diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java index 67565122..d36862e8 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -58,18 +58,18 @@ public class JU_FromJSON { new OutRaw().extract(new StringReader(str),sbw,inJSON); System.out.println(sbw.getBuffer()); } - + @Test public void parseJSON2Dump() throws Exception { System.out.println("*** PARSE JSON -> Dump ***"); System.out.println(str); StringBuilderWriter sbw = new StringBuilderWriter(1024); - + new OutDump().extract(new StringReader(str), sbw, inJSON); - + System.out.println(sbw.getBuffer()); } - + @Test public void nonprettyJSON() throws Exception { System.out.println("*** JSON -> (Intermediate Stream) -> Non-pretty JSON ***"); @@ -91,21 +91,21 @@ public class JU_FromJSON { } report.glean(trans,Env.JSON); } while (report.go()); - + String result = sbw.toString(); System.out.println(result); Assert.assertEquals(result, str); report.report(sbw); System.out.println(sbw.toString()); } - + @Test public void parseJSON2JSON() throws Exception { System.out.println("*** JSON -> (Intermediate Stream) -> Pretty JSON ***"); System.out.println(str); StringBuilderWriter sbw = new StringBuilderWriter(1024); - + Out jout = new OutJson(); Trans trans; Report report = new Report(ITERATIONS,"JSON"); @@ -121,7 +121,7 @@ public class JU_FromJSON { } report.glean(trans,Env.JSON); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); } @@ -132,7 +132,7 @@ public class JU_FromJSON { System.out.println(str); StringBuilderWriter sbw = new StringBuilderWriter(1024); - + Out xout = new OutXML("LargerData","xmlns=urn:s:xsd"); Trans trans; Report report = new Report(ITERATIONS,"JSON"); @@ -148,7 +148,7 @@ public class JU_FromJSON { } report.glean(trans,Env.JSON); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); } @@ -160,7 +160,7 @@ public class JU_FromJSON { StringBuilderWriter sbw = new StringBuilderWriter(1024); IndentPrintWriter ipw = new IndentPrintWriter(sbw); - + Out xout = new OutXML("LargerData","xmlns=urn:s:xsd"); Trans trans; Report report = new Report(ITERATIONS,"JSON"); @@ -176,12 +176,12 @@ public class JU_FromJSON { } report.glean(trans,Env.JSON); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); } - - + + @Test public void jaxbObj2XML() throws Exception { System.out.println("*** JAXB Object -> XML ***"); @@ -200,7 +200,7 @@ public class JU_FromJSON { sd.getItem().add("Item 2.2"); ld.getSampleData().add(sd); ld.setFluff("MyFluff"); - + JAXBmar jaxBmar = new JAXBmar(LargerData.class); //jaxBmar.asFragment(true); //jaxBmar.pretty(true); @@ -219,7 +219,7 @@ public class JU_FromJSON { } report.glean(trans,Env.XML); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); } @@ -242,7 +242,7 @@ public class JU_FromJSON { sd.getItem().add("Item 2.2"); ld.getSampleData().add(sd); ld.setFluff("MyFluff"); - + JAXBmar jaxBmar = new JAXBmar(LargerData.class); //jaxBmar.asFragment(true); jaxBmar.pretty(true); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java index 4fefe622..1a10779b 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -45,8 +45,8 @@ import s.xsd.LargerData; public class JU_FromXML { private static int ITERATIONS = 1; ; - - private final static String xml = + + private final static String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<LargerData xmlns=\"urn:s:xsd\">\n" + " <SampleData>\n" + @@ -63,21 +63,21 @@ public class JU_FromXML { " </SampleData>\n" + " <fluff>MyFluff</fluff>\n" + "</LargerData>\n"; - - + + @Test public void test() throws Exception { InXML inXML = new InXML(LargerData.class); - + System.out.println(xml); StringBuilderWriter sbw = new StringBuilderWriter(1024); - + Reader rdr = new StringReader(xml); - + new OutRaw().extract(rdr, sbw, inXML); System.out.println(sbw.getBuffer()); } - + @Test public void xml2JSON() throws Exception { @@ -86,7 +86,7 @@ public class JU_FromXML { InXML inXML = new InXML(LargerData.class); StringBuilderWriter sbw = new StringBuilderWriter(1024); - + Trans trans; Report report = new Report(ITERATIONS,"XML"); do { @@ -101,7 +101,7 @@ public class JU_FromXML { } report.glean(trans,Env.XML); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); } @@ -113,7 +113,7 @@ public class JU_FromXML { InXML inXML = new InXML(LargerData.class); StringBuilderWriter sbw = new StringBuilderWriter(1024); - + Trans trans; Report report = new Report(ITERATIONS,"XML"); do { @@ -128,23 +128,23 @@ public class JU_FromXML { } report.glean(trans,Env.XML); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); } - - + + @Test public void warmup() throws Exception { if (ITERATIONS>20) { System.out.println("*** Warmup JAXB ***"); - + JAXBumar jaxbUmar = new JAXBumar(LargerData.class); JAXBmar jaxBmar = new JAXBmar(LargerData.class); //jaxBmar.asFragment(true); //jaxBmar.pretty(true); StringBuilderWriter sbw = new StringBuilderWriter(1024); - + LargerData ld; Trans trans; @@ -171,7 +171,7 @@ public class JU_FromXML { } report.glean(trans,Env.XML); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); } @@ -210,7 +210,7 @@ public class JU_FromXML { } report.glean(trans,Env.XML); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); } diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java index af58ea57..4e9bfdc5 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -44,7 +44,7 @@ public class JU_JSON { Out jout = new OutJson(); go(jin, jout, "{\"id\":\"Me, Myself\",\"date\":1353094689100}"); - + go(jin, jout, "{\"id\":\"My ID 1\",\"desc\":\"My Description 1\",\"comment\":[\"My Comment 1\"],\"utc\":1360418381310}"); go(jin, jout, "{\"id\":\"My ID 1\",\"desc\":\"My Description 1\",\"comment\":[\"My Comment 1\",\"My Comment 2\"],\"utc\":1360418381310}"); @@ -52,16 +52,16 @@ public class JU_JSON { "{\"id\":\"sd object \\\"1\\\"\",\"date\":1316084944213,\"item\":[\"Item 1.1\",\"Item 1.2\"]}," + "{\"id\":\"sd object \\\"2\\\"\",\"date\":1316084945343,\"item\":[\"Item 2.1\",\"Item 2.2\"]}],\"fluff\":\"MyFluff\"}" ); - + go(jin, jout, "{\"SampleData\":[{\"date\":1316084945343}],\"fluff\":\"MyFluff\"}"); - + go(jin, jout, "{\"id\":\"Me,[}[eg[)(:x,\\\" Myself\",\"date\":1353094689100}"); - + // TODO: Clean out AT&T specific data go(jin,jout, "{\"userid\":\"xk3233\",\"timestamp\":1353097388531,\"item\":[{\"tag\":\"color\",\"value\":\"Mauve\"},{\"tag\":\"shirtsize\",\"value\":\"Xtra Large\"}]}"); //go() //"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><vote xmlns=\"urn:poll.att.com\"><userid>xk3233</userid><timestamp>1353082669667</timestamp></vote>"); - + // 3/11/2015 Jonathan found a case with missing comma go(jin,jout, "{\"start\":\"2015-03-11T18:18:05.580-05:00\",\"end\":\"2015-09-11-05:00\",\"force\":\"false\",\"perm\":{\"type\":\"org.osaaf.myns.mytype\",\"instance\":\"myInstance\",\"action\":\"myAction\"}" + ",\"role\":\"org.osaaf.myns.myrole\"}"); @@ -74,8 +74,8 @@ public class JU_JSON { go(jin,jout, "{\"meth\":\"GET\",\"path\":\"/authz/perms/:type\",\"desc\":\"GetPermsByType\",\"comments\":[\"List All Permissions that match :type listed\"]," + "\"contentType\":[\"application/Permissions+json;q=1.0;charset=utf-8;version=1.1,application/json;q=1.0;version=1.1\"" + ",\"application/Perms+xml;q=1.0;charset=utf-8;version=2.0,text/xml;q=1.0;version=2.0\",\"application/Perms+json;q=1.0;charset=utf-8;version=2.0,application/json;q=1.0;version=2.0,*/*;q=1.0\"" - + ",\"application/Permissions+xml;q=1.0;charset=utf-8;version=1.1,text/xml;q=1.0;version=1.1\"]}"); - + + ",\"application/Permissions+xml;q=1.0;charset=utf-8;version=1.1,text/xml;q=1.0;version=1.1\"]}"); + // Test a Windoze "Pretty Print", validate skipping of Windoze characters as well as other odd control characters listed // in json.org @@ -87,8 +87,8 @@ public class JU_JSON { ),sw,jin); Assert.assertEquals("{\"id\":\"Me, \b\f\n\r\tMyself\",\"date\":1353094689100}",sw.toString()); System.out.println(sw.toString()); - - // 10/01/2015 Jonathan AAF-703 Ron Gallagher, this response is ok + + // 10/01/2015 Jonathan AAF-703 Ron Gallagher, this response is ok go(jin,jout, "{\"perm\":[{\"type\":\"org.osaaf.myns.myPerm\",\"action\":\"myAction\",\"description\":\"something\"}]}"); // but when description:"" causes extra comma at end go(jin,jout, "{\"perm\":[{\"type\":\"org.osaaf.myns.myPerm\",\"action\":\"myAction\",\"description\":\"\"}]}","{\"perm\":[{\"type\":\"org.osaaf.myns.myPerm\",\"action\":\"myAction\"}]}"); @@ -96,33 +96,33 @@ public class JU_JSON { go(jin,jout, "{\"perm\":[{\"type\":\"\",\"action\":\"\",\"description\":\"\"}]}","{\"perm\":[{}]}"); go(jin,jout, "{\"perm\":[{\"type\":\"\",\"action\":\"\",\"description\":\"hi\"}]}","{\"perm\":[{\"description\":\"hi\"}]}"); go(jin,jout, "{\"perm\":[{\"type\":\"\",\"action\":\"myAction\",\"description\":\"\"}]}","{\"perm\":[{\"action\":\"myAction\"}]}"); - - + + go(jin,jout, "{\"perm\":[{\"type\":\"org.osaaf.myns.myPerm\",\"action\":,\"description\":\"something\"}]}","{\"perm\":[{\"type\":\"org.osaaf.myns.myPerm\",\"description\":\"something\"}]}"); - + go(jin, jout, "{\"name\":\"\\\"hello\\\"\"}"); - + go(jin, jout, "{\"name\":\"\\\\\"}"); go(jin, jout, "{\"role\":\"org.osaaf.scamper.UserStory0152 7_IT-00323-a-admin\",\"perm\":{\"type\":\"org.osaaf.scamper.application\",\"instance\":\"_()`!@#\\\\$%^=+][{}<>/.-valid.app.name-is_good\",\"action\":\"Administrator\"}}"); - - + + } - - + + private void go(Parse<Reader,?> in, Out out, String str) throws IOException, ParseException { go(in,out,str,str); } private void go(Parse<Reader, ?> in, Out out, String str, String cmp) throws IOException, ParseException { - + System.out.println(str); StringWriter sw = new StringWriter(1024); out.extract(new StringReader(str), sw, in); System.out.println(sw); String result = sw.toString(); - + if (!result.equals(cmp)) { sw.getBuffer().setLength(0); new OutRaw().extract(new StringReader(str), sw, in); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java index fd6142b1..335d87ad 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,7 +31,7 @@ public class JU_Ladder { @Test public void test() { Ladder<String> ladder = new Ladder<String>(); - + for (int i=0;i<30;++i) { for (int j=0;j<i;++j)ladder.ascend(); String str = "Rung " + i; @@ -43,10 +43,10 @@ public class JU_Ladder { for (int j=0;j<i;++j)ladder.descend(); } assertEquals(ladder.height(),32); // Sizing, when naturally created is by 8 - + ladder.cutTo(8); - assertEquals(ladder.height(),8); - + assertEquals(ladder.height(),8); + for (int i=0;i<30;++i) { ladder.jumpTo(i); String str = "Rung " + i; @@ -56,16 +56,16 @@ public class JU_Ladder { } ladder.bottom(); - + for (int i=0;i<30;++i) { assertEquals("Rung " + i,ladder.peek()); ladder.ascend(); } - + ladder.bottom(); ladder.top(); assertEquals("Rung 29",ladder.peek()); - + for (int i=0;i<30;++i) { ladder.jumpTo(i); assertEquals("Rung " + i,ladder.peek()); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Nulls.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Nulls.java index a1e94c51..2cb8a177 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Nulls.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Nulls.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -58,13 +58,13 @@ public class JU_Nulls { data.load(urr); System.out.println(data.asString()); Assert.assertEquals("{\"SampleData\":[{\"date\":1444125487798}]}", data.asString()); - + System.out.println(data.out(Data.TYPE.RAW).asString()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } - + } } diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java index ccc29317..287c2563 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -78,16 +78,16 @@ public class JU_RosettaDF { tt.done(); } sbw.append('\n'); - + tt = trans.start("To XML from Cache",4); try { data.out(Data.TYPE.XML).to(sbw); } finally { tt.done(); } - + sbw.append('\n'); - + tt = trans.start("To JSON from Cache",5); try { data.out(Data.TYPE.JSON).to(sbw); @@ -96,10 +96,10 @@ public class JU_RosettaDF { } report.glean(trans, 1,2,3,4,5); } while (report.go()); - + report.report(sbw); System.out.println(sbw); - + } @Test @@ -118,12 +118,12 @@ public class JU_RosettaDF { data.direct(new StringReader(JU_FromJSON.str), sbw); report.glean(trans); } while (report.go()); - + report.report(sbw); System.out.println(sbw); - + } - + @Test public void testMulti() throws Exception { RosettaEnv env = new RosettaEnv(); @@ -135,10 +135,10 @@ public class JU_RosettaDF { Multi m = new Multi(); m.getF1().add("String1"); m.getF2().add("String2"); - + System.out.println(df.newData().load(m).out(TYPE.RAW).asString()); System.out.println(df.newData().load(m).out(TYPE.JSON).asString()); - + } @Test @@ -154,7 +154,7 @@ public class JU_RosettaDF { Assert.assertEquals( "{\"id\":\"\\\"AT&T Services, Inc.\\\"\",\"date\":0}", out); - + SampleData sd2 = df.newData().in(TYPE.JSON).load(out).asObject(); System.out.println(sd2.getId()); Assert.assertEquals(sd.getId(),sd2.getId()); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java index a0847f4c..43a202f5 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -47,11 +47,11 @@ public class JU_Saved<b> { JaxInfo ji = JaxInfo.build(LargerData.class); OutXML xml = new OutXML(ji);; OutJson json = new OutJson(); - + Saved saved = new Saved(); - + StringBuilderWriter sbw = new StringBuilderWriter(1024); - + Trans trans; Report report = new Report(ITERATIONS,"Save","Dump","XML ","JSON"); do { @@ -67,7 +67,7 @@ public class JU_Saved<b> { // sbw.append("==== Start Direct Raw =====\n"); // new OutRaw().extract(new StringReader(JU_FromJSON.str), sbw, inJSON); -// +// // sbw.append("==== Start Raw from Saved =====\n"); // new OutRaw().extract(null,sbw,saved); @@ -78,7 +78,7 @@ public class JU_Saved<b> { } finally { tt.done(); } - + sbw.append("\n==== Start XML =====\n"); tt = trans.start("XML", 3); try { @@ -86,7 +86,7 @@ public class JU_Saved<b> { } finally { tt.done(); } - + sbw.append("\n==== Start JSON =====\n"); tt = trans.start("JSON", 4); try { @@ -96,7 +96,7 @@ public class JU_Saved<b> { } report.glean(trans,1,2,3,4); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Stream2Obj.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Stream2Obj.java index b0fc29a2..a3c4f181 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Stream2Obj.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Stream2Obj.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,7 +57,7 @@ public class JU_Stream2Obj { <value>value_2</value> </base> </root> - + {"base":[{"__extension":"derivedA","name":"myDerivedA_1","num":1432,"shortName":"mda_1","value":["value_1","value_2"]}]} */ @@ -69,7 +69,7 @@ public class JU_Stream2Obj { da.setShortName("mda_1"); da.getValue().add("value_1"); da.getValue().add("value_2"); - + Root root = new Root(); root.getBase().add(da); @@ -80,10 +80,10 @@ public class JU_Stream2Obj { da.getValue().add("value_2.1"); da.getValue().add("value_2.2"); root.getBase().add(da); - + EnvJAXB env = new BasicEnv(); DataFactory<Root> rootDF = env.newDataFactory(Root.class); - + String xml = rootDF.newData(env).out(Data.TYPE.XML).load(root).option(Data.PRETTY).asString(); System.out.println(xml); @@ -95,21 +95,21 @@ public class JU_Stream2Obj { out.extract(new StringReader(xml), sw, in); System.out.println(sw.toString()); - + out = new OutJson(); sw = new StringWriter(); out.extract(new StringReader(xml), sw, in); String json; System.out.println(json = sw.toString()); - + in = new InJson(); out = new OutRaw(); sw = new StringWriter(); out.extract(new StringReader(json), sw, in); System.out.println(sw.toString()); - + out = new OutXML(inXML); sw = new StringWriter(); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java index 40c41596..1a366fa0 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -42,7 +42,7 @@ public class JU_Struct { "</SampleData>\n" + "<fluff>MyFluff</fluff>\n" + "</LargerData>\n"; - + // @Test // public void test2() throws Exception { // @@ -50,20 +50,20 @@ public class JU_Struct { // sd.setDate(new Date().getTime()); // sd.setId("myId"); // sd.getItem().add("Item 1.1"); -// +// // InObj<SampleData> inObj = new InObj<SampleData>(SampleData.class); // // JaxSet<SampleData> jaxSet = JaxSet.get(SampleData.class); // Setter<SampleData> setter = jaxSet.setter("id"); // setter.set(sd, "Your ID"); -// +// // for (Entry<String, Getter<SampleData>> es : jaxSet.getters()) { // System.out.print(es.getKey()); // System.out.print(' '); // System.out.println(es.getValue().get(sd)); // } // } - + @Test public void test() throws Exception { JaxInfo ji = JaxInfo.build(LargerData.class); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java index 2aca5f52..550e2566 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -55,18 +55,18 @@ public class JU_Types { public void single() throws Exception { Single single = setSData(); SingleMarshal psingle = new SingleMarshal(); - + OutRaw raw = new OutRaw(); OutJson json = new OutJson(); OutXML xml = new OutXML("Single","xmlns=urn:types:xsd"); - - + + System.out.println("===== RAW ====="); raw.extract(single, System.out, psingle); System.out.println("\n===== JSON ====="); json.extract(single, System.out, psingle); - + System.out.println("\n\n===== Pretty JSON ====="); json.extract(single, System.out, psingle, true); @@ -92,7 +92,7 @@ public class JU_Types { // xml.extract(single, sw, psingle, true); news = jumar.unmarshal(env.info(), sw.toString()); System.out.println(sw.toString()); - + String sample = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "\n<ns2:urn.types.xsd xmlns:ns2=\"Single\" xmlns=\"urn:types:xsd\">" + "\n<str>MyString</str>" @@ -110,7 +110,7 @@ public class JU_Types { System.out.println(news.getDatetime()); } - + @Test public void multi() throws Exception { OutRaw raw = new OutRaw(); @@ -119,7 +119,7 @@ public class JU_Types { Multi multi = new Multi(); MultiMarshal pmulti = new MultiMarshal(); - + for (int i=0;i<10;++i) { System.out.println("===== Multi Iteration " + i + " ====="); if (i>0) { @@ -127,16 +127,16 @@ public class JU_Types { } System.out.println(" ===== RAW ====="); raw.extract(multi, System.out, pmulti); - + System.out.println("\n ===== JSON ====="); json.extract(multi, System.out, pmulti); - + System.out.println("\n\n ===== Pretty JSON ====="); json.extract(multi, System.out, pmulti, true); - + System.out.println("\n\n ===== XML ====="); xml.extract(multi, System.out, pmulti,false); - + System.out.println("\n\n ===== Pretty XML ====="); xml.extract(multi, System.out, pmulti, true); } @@ -150,7 +150,7 @@ public class JU_Types { Multi multi = new Multi(); DocMarshal<Multi> doc = DocMarshal.root(new MultiMarshal()); - + for (int i=0;i<3;++i) { System.out.println("===== Multi Iteration " + i + " ====="); if (i>0) { @@ -158,16 +158,16 @@ public class JU_Types { } System.out.println(" ===== RAW ====="); raw.extract(multi, System.out, doc); - + System.out.println("\n ===== JSON ====="); json.extract(multi, System.out, doc); - + System.out.println("\n\n ===== Pretty JSON ====="); json.extract(multi, System.out, doc, true); - + System.out.println("\n\n ===== XML ====="); xml.extract(multi, System.out, doc,false); - + System.out.println("\n\n ===== Pretty XML ====="); xml.extract(multi, System.out, doc, true); } @@ -179,16 +179,16 @@ public class JU_Types { // Saved saved = new Saved(); // saved.extract(in, ignore, parser, options); // } - + @Test public void df() throws Exception { RosettaEnv env = new RosettaEnv(); RosettaDF<Multi> df = env.newDataFactory(Multi.class); df.out(TYPE.JSON).option(Data.PRETTY); - + Multi multi = new Multi(); multi.getSingle().add(setSData()); - + System.out.println("========== Original loading"); Trans trans = env.newTrans(); @@ -199,7 +199,7 @@ public class JU_Types { } trans = env.newTrans(); data = df.newData(trans); - + int iters = 10000; for (int i=0;i<iters;++i) { data.load(multi); @@ -220,14 +220,14 @@ public class JU_Types { } trans = env.newTrans(); data = df.newData(trans); - + for (int i=0;i<iters;++i) { data.load(multi); } metrics = trans.auditTrail(0, null,Env.JSON,Env.XML); System.out.println(data.asString()); System.out.println(metrics.total/iters + "ms avg"); - + // Assert.assertEquals(first, second); System.out.println("========== Direct Object to JSON String"); @@ -246,13 +246,13 @@ public class JU_Types { sbw.reset(); data.direct(multi, sbw, true); } - + metrics = trans.auditTrail(0, null,Env.JSON,Env.XML); System.out.println(sbw.toString()); System.out.println(metrics.total/iters + "ms avg"); - + } - + private Single setSData() { Single s = new Single(); s.setStr("MyString"); @@ -274,19 +274,19 @@ public class JU_Types { // Out jout = new OutJson(); // //// go(jin, jout, "{\"id\":\"Me, Myself\",\"date\":1353094689100}"); -// +// // } - - + + /* private void go(Parse<Reader,?> in, Out out, String str) throws IOException, ParseException { - + System.out.println(str); StringWriter sw = new StringWriter(1024); out.extract(new StringReader(str), sw, in); System.out.println(sw); String result = sw.toString(); - + if (!result.equals(str)) { sw.getBuffer().setLength(0); new OutRaw().extract(new StringReader(str), sw, in); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java index 7e230822..e5035dbf 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,7 +37,7 @@ public class OutDump extends Out{ IndentPrintWriter ipw = writer instanceof IndentPrintWriter?(IndentPrintWriter)writer:new IndentPrintWriter(writer); Parsed<S> p = prs.newParsed(); - + while ((p = prs.parse(in,p.reuse())).valid()) { switch(p.event) { case Parse.START_OBJ: @@ -45,7 +45,7 @@ public class OutDump extends Out{ ipw.append(p.name); ipw.inc(); break; - case Parse.END_OBJ: + case Parse.END_OBJ: printData(ipw,p); ipw.dec(); ipw.append("End Object "); @@ -57,7 +57,7 @@ public class OutDump extends Out{ ipw.append(p.name); ipw.append('\n'); break; - case Parse.END_ARRAY: + case Parse.END_ARRAY: printData(ipw,p); ipw.dec(); ipw.append("End Array "); @@ -69,13 +69,13 @@ public class OutDump extends Out{ } } } - + private void printData(IndentPrintWriter ipw, Parsed<?> parsed) { if (parsed.hasData()) { ipw.append("Data:["); if (parsed.hasName()) { ipw.append(parsed.name); - ipw.append(" : "); + ipw.append(" : "); } ipw.append(parsed.sb); ipw.append("]"); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java index acb33010..dc07ae63 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ public class Report { String[] names; private int iterations; private int count; - + public Report(int iters, String ... names) { iterations = iters; buckets = new float[names.length]; @@ -41,7 +41,7 @@ public class Report { total=0; count = 0; } - + public void glean(Trans trans, int ... type) { Metric m = trans.auditTrail(0, null, type); total+=m.total; @@ -50,12 +50,12 @@ public class Report { buckets[b]+=m.buckets[b]; } } - + public boolean go() { return ++count<iterations; } - - + + public void report(Writer sbw) throws IOException { sbw.append("\n"+count + " entries, Total Time: " + total + "ms, Avg Time: " + total/count + "ms\n"); int min = Math.min(buckets.length, names.length); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/MultiMarshal.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/MultiMarshal.java index b28ca766..3c8433ec 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/MultiMarshal.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/MultiMarshal.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/SingleMarshal.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/SingleMarshal.java index bde91c9e..ddbeb6cf 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/SingleMarshal.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/SingleMarshal.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -44,14 +44,14 @@ public class SingleMarshal extends ObjMarshal<Single> { return t.getStr(); } }); - + add(new FieldNumeric<Integer, Single>("int") { @Override protected Integer data(Single t) { return t.getInt(); } }); - + add(new FieldNumeric<Long,Single>("long") { @Override protected Long data(Single t) { @@ -72,14 +72,14 @@ public class SingleMarshal extends ObjMarshal<Single> { return t.getDate(); } }); - + add(new FieldHexBinary<Single>("binary") { @Override protected byte[] data(Single t) { return t.getBinary(); } }); - + add(new FieldArray<Single,String>("array", DataWriter.STRING) { @Override protected List<String> data(Single t) { |