From 1296352d8eafee57f982a4342ad79ada4aa56d28 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Tue, 15 Oct 2019 08:19:50 -0500 Subject: Sonar Fixes, Formatting Issue-ID: AAF-1019 Change-Id: Ica49d9e7323aad9622ff9d95cc21b87430c22c54 Signed-off-by: Instrumental --- .../java/org/onap/aaf/misc/env/util/Chrono.java | 9 +- .../src/test/java/org/onap/aaf/misc/env/Api.java | 146 ++++++++-------- .../org/onap/aaf/misc/env/JU_BaseDataFactory.java | 12 +- .../onap/aaf/misc/env/JU_JavaUtilLogTarget.java | 16 +- .../org/onap/aaf/misc/env/JU_NullLifeCycle.java | 8 +- .../org/onap/aaf/misc/env/impl/JU_AbsTrans.java | 56 +++---- .../onap/aaf/misc/env/impl/JU_AbsTransJaxb.java | 26 +-- .../aaf/misc/env/impl/JU_Log4JLogTargetTest.java | 4 +- .../java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java | 186 ++++++++++----------- .../aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java | 62 +++---- .../aaf/misc/env/jaxb/JU_JAXBStringifierTest.java | 55 +++--- .../onap/aaf/misc/env/jaxb/JU_StoreImplTest.java | 38 ++--- .../aaf/misc/env/log4j/JU_LogFileNamerTest.java | 8 +- .../java/org/onap/aaf/misc/rosetta/InJson.java | 12 +- .../main/java/org/onap/aaf/misc/rosetta/InXML.java | 60 +++---- .../java/org/onap/aaf/misc/rosetta/JaxEval.java | 4 +- .../java/org/onap/aaf/misc/rosetta/JaxInfo.java | 26 +-- .../java/org/onap/aaf/misc/rosetta/JaxSet.java | 10 +- .../java/org/onap/aaf/misc/rosetta/Ladder.java | 28 ++-- .../java/org/onap/aaf/misc/rosetta/Marshal.java | 8 +- .../main/java/org/onap/aaf/misc/rosetta/Nulls.java | 8 +- .../main/java/org/onap/aaf/misc/rosetta/Out.java | 10 +- .../java/org/onap/aaf/misc/rosetta/OutJax.java | 8 +- .../java/org/onap/aaf/misc/rosetta/OutJson.java | 26 +-- .../java/org/onap/aaf/misc/rosetta/OutRaw.java | 10 +- .../java/org/onap/aaf/misc/rosetta/OutXML.java | 46 ++--- .../main/java/org/onap/aaf/misc/rosetta/Parse.java | 14 +- .../org/onap/aaf/misc/rosetta/ParseException.java | 4 +- .../java/org/onap/aaf/misc/rosetta/Parsed.java | 12 +- .../main/java/org/onap/aaf/misc/rosetta/Prop.java | 8 +- .../main/java/org/onap/aaf/misc/rosetta/Saved.java | 30 ++-- .../java/org/onap/aaf/misc/rosetta/XmlEscape.java | 22 +-- .../org/onap/aaf/misc/rosetta/env/RosettaDF.java | 36 ++-- .../org/onap/aaf/misc/rosetta/env/RosettaData.java | 28 ++-- .../org/onap/aaf/misc/rosetta/env/RosettaEnv.java | 8 +- .../onap/aaf/misc/rosetta/marshal/DataWriter.java | 32 ++-- .../onap/aaf/misc/rosetta/marshal/DocMarshal.java | 8 +- .../onap/aaf/misc/rosetta/marshal/FieldArray.java | 8 +- .../onap/aaf/misc/rosetta/marshal/FieldBlob.java | 8 +- .../onap/aaf/misc/rosetta/marshal/FieldDate.java | 6 +- .../aaf/misc/rosetta/marshal/FieldDateTime.java | 6 +- .../aaf/misc/rosetta/marshal/FieldHexBinary.java | 6 +- .../aaf/misc/rosetta/marshal/FieldMarshal.java | 10 +- .../aaf/misc/rosetta/marshal/FieldNumeric.java | 6 +- .../onap/aaf/misc/rosetta/marshal/FieldString.java | 6 +- .../aaf/misc/rosetta/marshal/ListIterator.java | 10 +- .../onap/aaf/misc/rosetta/marshal/ObjArray.java | 4 +- .../onap/aaf/misc/rosetta/marshal/ObjMarshal.java | 16 +- .../onap/aaf/misc/rosetta/JU_ParseException.java | 8 +- .../java/org/onap/aaf/misc/rosetta/env/Api.java | 146 ++++++++-------- .../onap/aaf/misc/rosetta/env/JU_RosettaData.java | 152 ++++++++--------- .../onap/aaf/misc/rosetta/env/JU_RosettaEnv.java | 12 +- .../aaf/misc/rosetta/marshal/JU_FieldBlob.java | 6 +- .../onap/aaf/misc/rosetta/test/JU_FromJSON.java | 38 ++--- .../org/onap/aaf/misc/rosetta/test/JU_FromXML.java | 40 ++--- .../org/onap/aaf/misc/rosetta/test/JU_JSON.java | 42 ++--- .../org/onap/aaf/misc/rosetta/test/JU_Ladder.java | 18 +- .../org/onap/aaf/misc/rosetta/test/JU_Nulls.java | 8 +- .../onap/aaf/misc/rosetta/test/JU_RosettaDF.java | 26 +-- .../org/onap/aaf/misc/rosetta/test/JU_Saved.java | 18 +- .../onap/aaf/misc/rosetta/test/JU_Stream2Obj.java | 18 +- .../org/onap/aaf/misc/rosetta/test/JU_Struct.java | 12 +- .../org/onap/aaf/misc/rosetta/test/JU_Types.java | 64 +++---- .../org/onap/aaf/misc/rosetta/test/OutDump.java | 14 +- .../org/onap/aaf/misc/rosetta/test/Report.java | 14 +- .../aaf/misc/rosetta/test/obj/MultiMarshal.java | 4 +- .../aaf/misc/rosetta/test/obj/SingleMarshal.java | 12 +- 67 files changed, 915 insertions(+), 907 deletions(-) (limited to 'misc') diff --git a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java index f5de5d7d..e6c95db8 100644 --- a/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java +++ b/misc/env/src/main/java/org/onap/aaf/misc/env/util/Chrono.java @@ -38,7 +38,13 @@ import javax.xml.datatype.XMLGregorianCalendar; public class Chrono { private static final long NUM_100NS_INTERVALS_SINCE_UUID_EPOCH = 0x01b21dd213814000L; - public final static DateFormat dateFmt, dateOnlyFmt, niceDateFmt, utcFmt, niceUTCDateFmt, iso8601Fmt; + public final static DateFormat dateFmt; + public final static DateFormat dateOnlyFmt; + public final static DateFormat niceDateFmt; + public final static DateFormat utcFmt; + public final static DateFormat niceUTCDateFmt; + public final static DateFormat iso8601Fmt; + public final static DateFormat batchFmt; // Give general access to XML DataType Factory, since it's pretty common public static final DatatypeFactory xmlDatatypeFactory; @@ -56,6 +62,7 @@ public class Chrono { niceUTCDateFmt = new SimpleDateFormat("yyyy/MM/dd HH:mm zzz"); niceUTCDateFmt.setTimeZone(TimeZone.getTimeZone("UTC")); iso8601Fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX"); + batchFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss+SSSS"); } diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/Api.java b/misc/env/src/test/java/org/onap/aaf/misc/env/Api.java index 688e11b8..d9cda923 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/Api.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/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 http://java.sun.com/xml/jaxb -// 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 http://java.sun.com/xml/jaxb +// 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; /** *

Java class for anonymous complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType>
  *   <complexContent>
@@ -70,8 +70,8 @@ import javax.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * + * + * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { @@ -84,25 +84,25 @@ public class Api { /** * Gets the value of the route property. - * - *

+ * + * * 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 set method for the route property. - * - *

+ * + * * For example, to add a new item, do as follows: *

      *    getRoute().add(newItem);
      * 
- * - * - *

+ * + * + * * Objects of the following type(s) are allowed in the list * {@link Api.Route } - * - * + * + * */ public List getRoute() { if (route == null) { @@ -114,9 +114,9 @@ public class Api { /** *

Java class for anonymous complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

      * <complexType>
      *   <complexContent>
@@ -135,8 +135,8 @@ public class Api {
      *   </complexContent>
      * </complexType>
      * 
- * - * + * + * */ @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. - * - *

+ * + * * 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 set method for the param property. - * - *

+ * + * * For example, to add a new item, do as follows: *

          *    getParam().add(newItem);
          * 
- * - * - *

+ * + * + * * Objects of the following type(s) are allowed in the list * {@link String } - * - * + * + * */ public List 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. - * - *

+ * + * * 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 set method for the comments property. - * - *

+ * + * * For example, to add a new item, do as follows: *

          *    getComments().add(newItem);
          * 
- * - * - *

+ * + * + * * Objects of the following type(s) are allowed in the list * {@link String } - * - * + * + * */ public List getComments() { if (comments == null) { @@ -296,25 +296,25 @@ public class Api { /** * Gets the value of the contentType property. - * - *

+ * + * * 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 set method for the contentType property. - * - *

+ * + * * For example, to add a new item, do as follows: *

          *    getContentType().add(newItem);
          * 
- * - * - *

+ * + * + * * Objects of the following type(s) are allowed in the list * {@link String } - * - * + * + * */ public List 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. - * - *

+ * + * * 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 set method for the explicitErr property. - * - *

+ * + * * For example, to add a new item, do as follows: *

          *    getExplicitErr().add(newItem);
          * 
- * - * - *

+ * + * + * * Objects of the following type(s) are allowed in the list * {@link Integer } - * - * + * + * */ public List getExplicitErr() { if (explicitErr == null) { diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_BaseDataFactory.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_BaseDataFactory.java index 15049dcd..e7ae3a35 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_BaseDataFactory.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_BaseDataFactory.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,7 +34,7 @@ public class JU_BaseDataFactory { public void setUp() throws Exception { initMocks(this); } - + @Test public void testGenSchemaException() { Store env = Mockito.mock(Store.class); @@ -45,7 +45,7 @@ public class JU_BaseDataFactory { assertTrue(e.getLocalizedMessage().contains("does not exist. You can set this with")); } } - + @Test public void testGenSchemaXsdException() { Store env = Mockito.mock(Store.class); @@ -57,7 +57,7 @@ public class JU_BaseDataFactory { assertTrue(e.getLocalizedMessage().contains("for schema validation")); } } - + @Test public void testGenSchemaNoException() { Store env = Mockito.mock(Store.class); @@ -69,7 +69,7 @@ public class JU_BaseDataFactory { e.printStackTrace(); } } - + @Test public void testGetQName() { String[] schemaFIles = new String[] {"../../auth-client/src/main/xsd/aaf_2_0.xsd"}; diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java index a3063f73..a1c684f0 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_JavaUtilLogTarget.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 JU_JavaUtilLogTarget { public void testLoggable() { JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level); boolean retVal = logObj.isLoggable(); - + assertFalse(retVal); } @@ -61,22 +61,22 @@ public class JU_JavaUtilLogTarget { logObj.log(new Object[] {"test","test2",""}); Mockito.doReturn(true).when(log).isLoggable(level); logObj.log(new Object[] {"test","test2",""}); - + } - + @Test public void testLogThrowable() { JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level); - + Mockito.doReturn(true).when(log).isLoggable(level); logObj.log(new Throwable("test exception"), new Object[] {"test","test2",""}); logObj.log(new Throwable(), new Object[] {"test","test2",""}); } - + @Test public void testPrintf() { JavaUtilLogTarget logObj = new JavaUtilLogTarget( log, level); - + Mockito.doReturn(true).when(log).isLoggable(level); logObj.printf("test", new Object[] {"test","test2",""}); diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java index ed75f4cb..1d0b29d7 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/JU_NullLifeCycle.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. @@ -36,8 +36,8 @@ public class JU_NullLifeCycle { lifeCycleObj.threadPrestart(null); lifeCycleObj.refresh(null); }catch(APIException a) { - + } } - + } \ No newline at end of file diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTrans.java b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTrans.java index e1e7d0e9..df54f0e4 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTrans.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTrans.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,25 +41,25 @@ public class JU_AbsTrans { @Mock Env delegate; - + @Mock BasicEnv delegate1; - + @Mock LogTarget lt; - + @Before public void setUp() { initMocks(this); } - + class AbsTransImpl extends AbsTrans{ public AbsTransImpl(Env delegate) { super(delegate); // TODO Auto-generated constructor stub } - + public AbsTransImpl(BasicEnv delegate) { super(delegate); // TODO Auto-generated constructor stub @@ -111,17 +111,17 @@ public class JU_AbsTrans { protected TimeTaken newTimeTaken(String name, int flag, Object ... values) { // TODO Auto-generated method stub return new TimeTaken("nameTest", Env.XML) { - + @Override public void output(StringBuilder sb) { // TODO Auto-generated method stub - + } }; } - + } - + @Test public void testFatal() { AbsTransImpl absTransObj = new AbsTransImpl(delegate); @@ -129,7 +129,7 @@ public class JU_AbsTrans { LogTarget lt = absTransObj.fatal(); assertTrue(lt instanceof LogTarget); } - + @Test public void testError() { AbsTransImpl absTransObj = new AbsTransImpl(delegate); @@ -137,7 +137,7 @@ public class JU_AbsTrans { LogTarget lt = absTransObj.error(); assertTrue(lt instanceof LogTarget); } - + @Test public void testAudit() { AbsTransImpl absTransObj = new AbsTransImpl(delegate); @@ -145,7 +145,7 @@ public class JU_AbsTrans { LogTarget lt = absTransObj.audit(); assertTrue(lt instanceof LogTarget); } - + @Test public void testInit() { AbsTransImpl absTransObj = new AbsTransImpl(delegate); @@ -153,7 +153,7 @@ public class JU_AbsTrans { LogTarget lt = absTransObj.init(); assertTrue(lt instanceof LogTarget); } - + @Test public void testWarn() { AbsTransImpl absTransObj = new AbsTransImpl(delegate); @@ -161,7 +161,7 @@ public class JU_AbsTrans { LogTarget lt = absTransObj.warn(); assertTrue(lt instanceof LogTarget); } - + @Test public void testInfo() { AbsTransImpl absTransObj = new AbsTransImpl(delegate); @@ -169,7 +169,7 @@ public class JU_AbsTrans { LogTarget lt = absTransObj.info(); assertTrue(lt instanceof LogTarget); } - + @Test public void testDebug() { AbsTransImpl absTransObj = new AbsTransImpl(delegate); @@ -177,7 +177,7 @@ public class JU_AbsTrans { LogTarget lt = absTransObj.debug(); assertTrue(lt instanceof LogTarget); } - + @Test public void testTrace() { AbsTransImpl absTransObj = new AbsTransImpl(delegate); @@ -185,28 +185,28 @@ public class JU_AbsTrans { LogTarget lt = absTransObj.trace(); assertTrue(lt instanceof LogTarget); } - + @Test public void testStart() { AbsTransImpl absTransObj = new AbsTransImpl(delegate); TimeTaken lt = absTransObj.start("test",1); assertEquals("nameTest", lt.name); } - + @Test public void testCheckpint() { AbsTransImpl absTransObj = new AbsTransImpl(delegate); absTransObj.checkpoint("test"); assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); } - + @Test public void testCheckpintAddFlag() { AbsTransImpl absTransObj = new AbsTransImpl(delegate); absTransObj.checkpoint("test",1); assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); } - + @Test public void testAuditTrailWithEmptyTrail() { AbsTransImpl absTransObj = new AbsTransImpl(delegate); @@ -215,7 +215,7 @@ public class JU_AbsTrans { absTransObj.auditTrail(1, new StringBuilder(), 1); //assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); } - + @Test public void testAuditTrail() { AbsTransImpl absTransObj = new AbsTransImpl(delegate); @@ -228,7 +228,7 @@ public class JU_AbsTrans { absTransObj.auditTrail(1, new StringBuilder(), 2); //assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); } - + @Test public void testAuditTrailLoggableFalse() { AbsTransImpl absTransObj = new AbsTransImpl(delegate); @@ -241,7 +241,7 @@ public class JU_AbsTrans { absTransObj.auditTrail(1, new StringBuilder(), 1); //assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); } - + @Test public void testAuditTrailNullSB() { AbsTransImpl absTransObj = new AbsTransImpl(delegate); @@ -254,7 +254,7 @@ public class JU_AbsTrans { absTransObj.auditTrail(1, null, 1); //assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); } - + @Test public void testAuditTrailEmpptyFlag() { AbsTransImpl absTransObj = new AbsTransImpl(delegate); @@ -267,7 +267,7 @@ public class JU_AbsTrans { absTransObj.auditTrail(1, null, new int[] {}); //assertEquals("nameTest", ((TimeTaken)absTransObj.trail.get(0)).name); } - + @Test public void testPut() { AbsTransImpl absTransObj = new AbsTransImpl(delegate1); @@ -277,7 +277,7 @@ public class JU_AbsTrans { assertTrue(e instanceof NullPointerException); } } - + @Test public void testGet() { AbsTransImpl absTransObj = new AbsTransImpl(delegate1); diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTransJaxb.java b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTransJaxb.java index f8b32451..727673f9 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTransJaxb.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_AbsTransJaxb.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,15 +44,15 @@ public class JU_AbsTransJaxb { @Mock EnvJAXB delegate; - + @Mock LogTarget lt; - + @Before public void setUp() { initMocks(this); } - + class AbsTransJAXBImpl extends AbsTransJAXB{ public AbsTransJAXBImpl(EnvJAXB env) { @@ -108,10 +108,10 @@ public class JU_AbsTransJaxb { return null; } - + } - - + + @Test public void testNewDataFactory() { AbsTransJAXB absTransObj = new AbsTransJAXBImpl(delegate); @@ -126,7 +126,7 @@ public class JU_AbsTransJaxb { } //assertTrue(lt instanceof LogTarget); } - + @Test public void testNewDataFactorySchema() { AbsTransJAXB absTransObj = new AbsTransJAXBImpl(delegate); @@ -141,7 +141,7 @@ public class JU_AbsTransJaxb { } //assertTrue(lt instanceof LogTarget); } - + @Test public void testNewDataFactoryQname() { AbsTransJAXB absTransObj = new AbsTransJAXBImpl(delegate); @@ -156,7 +156,7 @@ public class JU_AbsTransJaxb { } //assertTrue(lt instanceof LogTarget); } - + @Test public void testNewDataFactorySchemaQname() { AbsTransJAXB absTransObj = new AbsTransJAXBImpl(delegate); @@ -172,6 +172,6 @@ public class JU_AbsTransJaxb { } //assertTrue(lt instanceof LogTarget); } - - + + } \ No newline at end of file diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java index b5101158..4c4db5c7 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/impl/JU_Log4JLogTargetTest.java @@ -47,8 +47,8 @@ public class JU_Log4JLogTargetTest { @Test public void testLoggable() { - Logger l4jLogger = Logger.getLogger("testLogger"); - l4jLogger.setLevel(Level.DEBUG); + Logger l4jLogger = Logger.getLogger("testLogger"); + l4jLogger.setLevel(Level.DEBUG); Log4JLogTarget logObj = null; try { logObj = new Log4JLogTarget( "testLogger", Level.DEBUG); diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java index 7952740b..30f42567 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBDF.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,16 +50,16 @@ public class JU_JAXBDF { @Mock EnvJAXB primaryEnv; - + @Mock JAXBumar jumar; - + @Mock JAXBmar jmar; - + @Mock Env env; - + TimeTaken tt,ttObjectify; @Before @@ -89,9 +89,9 @@ public class JU_JAXBDF { // TODO Auto-generated catch block e.printStackTrace(); } - + } - + @Test public void testNewInstanceNoException() { JAXBDF bdfObj = null; @@ -101,10 +101,10 @@ public class JU_JAXBDF { assertTrue(retVal instanceof JU_JAXBDF); } catch (APIException e) { e.printStackTrace(); - } - + } + } - + @Test public void testPrettyNoException() { JAXBDF bdfObj = null; @@ -114,7 +114,7 @@ public class JU_JAXBDF { assertTrue(retVal instanceof JAXBDF); } catch (APIException e) { e.printStackTrace(); - } + } } @Test @@ -131,10 +131,10 @@ public class JU_JAXBDF { bdfObj.serviceDestroy(null); } catch (APIException e) { e.printStackTrace(); - } - + } + } - + @Test public void testNewData() { JAXBDF bdfObj = null; @@ -144,9 +144,9 @@ public class JU_JAXBDF { assertTrue(retVal instanceof JAXBData); } catch (APIException e) { e.printStackTrace(); - } + } } - + @Test public void testNewDataENV() { JAXBDF bdfObj = null; @@ -156,9 +156,9 @@ public class JU_JAXBDF { assertTrue(retVal instanceof JAXBData); } catch (APIException e) { e.printStackTrace(); - } + } } - + @Test public void testNewDataType() { JAXBDF bdfObj = null; @@ -171,9 +171,9 @@ public class JU_JAXBDF { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } + } } - + @Test public void testNewDataStream() { JAXBDF bdfObj = null; @@ -191,9 +191,9 @@ public class JU_JAXBDF { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } + } } - + @Test public void testNewDataStreamException() { JAXBDF bdfObj = null; @@ -210,9 +210,9 @@ public class JU_JAXBDF { } catch (JAXBException e) { // TODO Auto-generated catch block assertTrue(e.getMessage().contains("test")); - } + } } - + @Test public void testNewDataFromString() { JAXBDF bdfObj = null; @@ -222,9 +222,9 @@ public class JU_JAXBDF { assertTrue(retVal instanceof JAXBData); } catch (APIException e) { e.printStackTrace(); - } + } } - + @Test public void testStringify() { JAXBDF bdfObj = null; @@ -243,9 +243,9 @@ public class JU_JAXBDF { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } + } } - + @Test public void testStringifyException() { JAXBDF bdfObj = null; @@ -263,9 +263,9 @@ public class JU_JAXBDF { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } + } } - + @Test public void testStringifyWriter() { JAXBDF bdfObj = null; @@ -283,9 +283,9 @@ public class JU_JAXBDF { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } + } } - + @Test public void testStringifyWriterException() { JAXBDF bdfObj = null; @@ -303,9 +303,9 @@ public class JU_JAXBDF { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } + } } - + @Test public void testStringifyOS() { JAXBDF bdfObj = null; @@ -323,9 +323,9 @@ public class JU_JAXBDF { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } + } } - + @Test public void testStringifyOsException() { JAXBDF bdfObj = null; @@ -343,9 +343,9 @@ public class JU_JAXBDF { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } + } } - + @Test public void testStringifyOptions() { JAXBDF bdfObj = null; @@ -363,9 +363,9 @@ public class JU_JAXBDF { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } + } } - + @Test public void testStringifyOSOptions() { JAXBDF bdfObj = null; @@ -383,9 +383,9 @@ public class JU_JAXBDF { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } + } } - + @Test public void testStringifyOsOptionsException() { JAXBDF bdfObj = null; @@ -403,7 +403,7 @@ public class JU_JAXBDF { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } + } } @Test public void testStringifySWOptions() { @@ -422,9 +422,9 @@ public class JU_JAXBDF { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } + } } - + @Test public void testStringifySWOptionsException() { JAXBDF bdfObj = null; @@ -442,9 +442,9 @@ public class JU_JAXBDF { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } + } } - + @Test public void testObjectifyEnv() { JAXBDF bdfObj = null; @@ -456,14 +456,14 @@ public class JU_JAXBDF { LogTarget logT = Mockito.mock(LogTarget.class); Mockito.doReturn(logT).when(env).debug(); Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(StringReader.class)); - + bdfObj.objectify(env, Mockito.mock(StringReader.class)); } catch (APIException e) { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } - + } + } @Test public void testObjectifyEnvException() { @@ -477,16 +477,16 @@ public class JU_JAXBDF { Mockito.doReturn(logT).when(env).debug(); StringReader sr = Mockito.mock(StringReader.class); Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr); - + bdfObj.objectify(env, sr); } catch (APIException e) { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } - + } + } - + @Test public void testObjectifyRdr() { JAXBDF bdfObj = null; @@ -498,14 +498,14 @@ public class JU_JAXBDF { LogTarget logT = Mockito.mock(LogTarget.class); Mockito.doReturn(logT).when(env).debug(); Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(StringReader.class)); - + bdfObj.objectify( Mockito.mock(StringReader.class)); } catch (APIException e) { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } - + } + } @Test public void testObjectifyRdrException() { @@ -519,16 +519,16 @@ public class JU_JAXBDF { Mockito.doReturn(logT).when(envJaxb).debug(); StringReader sr = Mockito.mock(StringReader.class); Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr); - + bdfObj.objectify(sr); } catch (APIException e) { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } - + } + } - + @Test public void testObjectifyEnvIS() { JAXBDF bdfObj = null; @@ -540,14 +540,14 @@ public class JU_JAXBDF { LogTarget logT = Mockito.mock(LogTarget.class); Mockito.doReturn(logT).when(env).debug(); Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(InputStream.class)); - + bdfObj.objectify(env, Mockito.mock(InputStream.class)); } catch (APIException e) { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } - + } + } @Test public void testObjectifyEnvISException() { @@ -561,16 +561,16 @@ public class JU_JAXBDF { Mockito.doReturn(logT).when(env).debug(); InputStream sr = Mockito.mock(InputStream.class); Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr); - + bdfObj.objectify(env, sr); } catch (APIException e) { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } - + } + } - + @Test public void testObjectifyIs() { JAXBDF bdfObj = null; @@ -582,14 +582,14 @@ public class JU_JAXBDF { LogTarget logT = Mockito.mock(LogTarget.class); Mockito.doReturn(logT).when(env).debug(); Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, Mockito.mock(InputStream.class)); - + bdfObj.objectify( Mockito.mock(InputStream.class)); } catch (APIException e) { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } - + } + } @Test public void testObjectifyIsException() { @@ -603,16 +603,16 @@ public class JU_JAXBDF { Mockito.doReturn(logT).when(envJaxb).debug(); InputStream sr = Mockito.mock(InputStream.class); Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, sr); - + bdfObj.objectify(sr); } catch (APIException e) { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } - + } + } - + @Test public void testObjectifyEnvStr() { JAXBDF bdfObj = null; @@ -624,14 +624,14 @@ public class JU_JAXBDF { LogTarget logT = Mockito.mock(LogTarget.class); Mockito.doReturn(logT).when(env).debug(); Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, "test"); - + bdfObj.objectify(env, "test"); } catch (APIException e) { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } - + } + } @Test public void testObjectifyEnvStrException() { @@ -645,16 +645,16 @@ public class JU_JAXBDF { Mockito.doReturn(logT).when(env).debug(); InputStream sr = Mockito.mock(InputStream.class); Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, "test"); - + bdfObj.objectify(env, "test"); } catch (APIException e) { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } - + } + } - + @Test public void testObjectifyStr() { JAXBDF bdfObj = null; @@ -666,14 +666,14 @@ public class JU_JAXBDF { LogTarget logT = Mockito.mock(LogTarget.class); Mockito.doReturn(logT).when(env).debug(); Mockito.doReturn(this.getClass()).when(bdfObj.jumar).unmarshal(logT, "test"); - + bdfObj.objectify( "test"); } catch (APIException e) { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } - + } + } @Test public void testObjectifyStrException() { @@ -687,28 +687,28 @@ public class JU_JAXBDF { Mockito.doReturn(logT).when(envJaxb).debug(); InputStream sr = Mockito.mock(InputStream.class); Mockito.doThrow(new JAXBException("test")).when(bdfObj.jumar).unmarshal(logT, "test"); - + bdfObj.objectify("test"); } catch (APIException e) { assertTrue(e.getMessage().contains("test")); } catch (JAXBException e) { assertTrue(e.getMessage().contains("test")); - } - + } + } - + @Test public void testTypeClass() { JAXBDF bdfObj = null; try { EnvJAXB envJaxb = Mockito.mock(EnvJAXB.class); bdfObj = new JAXBDF( envJaxb, new Class[] {this.getClass()}); - + Object obj = bdfObj.getTypeClass(); assertFalse(obj instanceof JU_JAXBDF); } catch (APIException e) { assertTrue(e.getMessage().contains("test")); - } - + } + } } diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java index 9330f18b..2c082c7d 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBObjectifierTest.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,17 +43,17 @@ public class JU_JAXBObjectifierTest { @Mock JAXBumar jumar; - + @Mock Schema schema; - + @Mock Env env; - + TimeTaken tt,ttObjectify; - + LogTarget logT; - + @Before public void setUp() { initMocks(this); @@ -77,10 +77,10 @@ public class JU_JAXBObjectifierTest { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - + } + } - + @Test public void testObjectifyException() { JAXBObjectifier bdfObj = null; @@ -93,10 +93,10 @@ public class JU_JAXBObjectifierTest { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - + } + } - + @Test public void testObjectifyRdr() { JAXBObjectifier bdfObj = null; @@ -110,10 +110,10 @@ public class JU_JAXBObjectifierTest { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - + } + } - + @Test public void testObjectifyRdrException() { JAXBObjectifier bdfObj = null; @@ -127,10 +127,10 @@ public class JU_JAXBObjectifierTest { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - + } + } - + @Test public void testObjectifyIs() { JAXBObjectifier bdfObj = null; @@ -143,10 +143,10 @@ public class JU_JAXBObjectifierTest { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - + } + } - + @Test public void testObjectifyIsException() { JAXBObjectifier bdfObj = null; @@ -160,10 +160,10 @@ public class JU_JAXBObjectifierTest { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - + } + } - + @Test public void testEmptyMethods() { JAXBObjectifier bdfObj = null; @@ -176,10 +176,10 @@ public class JU_JAXBObjectifierTest { bdfObj.refresh(env); } catch (APIException e) { assertTrue(e.getMessage().contains("Test Exception")); - } - + } + } - + @Test public void testNewInstance() { JAXBObjectifier bdfObj = null; @@ -187,7 +187,7 @@ public class JU_JAXBObjectifierTest { bdfObj = new JAXBObjectifier(jumar); Object retVal = bdfObj.newInstance(); Mockito.doThrow(new IllegalAccessException("Test Exception")).when(jumar).newInstance(); - + } catch (IllegalAccessException e) { assertEquals("Test Exception", e.getLocalizedMessage()); } catch (APIException e) { @@ -197,7 +197,7 @@ public class JU_JAXBObjectifierTest { e.printStackTrace(); } } - + @Test public void testNewInstanceException() { JAXBObjectifier bdfObj = null; @@ -213,6 +213,6 @@ public class JU_JAXBObjectifierTest { // TODO Auto-generated catch block e.printStackTrace(); } - + } } diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.java index 84415fdb..86ef59b3 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_JAXBStringifierTest.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. @@ -18,6 +18,7 @@ * ============LICENSE_END==================================================== * */ + package org.onap.aaf.misc.env.jaxb; import static org.junit.Assert.assertEquals; @@ -44,17 +45,17 @@ public class JU_JAXBStringifierTest { @Mock JAXBmar jumar; - + @Mock QName qname; - + @Mock Env env; - + TimeTaken tt,ttstringify; - + LogTarget logT; - + @Before public void setUp() { initMocks(this); @@ -78,10 +79,10 @@ public class JU_JAXBStringifierTest { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - + } + } - + @Test public void teststringifyWriter() { JAXBStringifier bdfObj = null; @@ -95,10 +96,10 @@ public class JU_JAXBStringifierTest { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - + } + } - + @Test public void teststringifyWriterException() { JAXBStringifier bdfObj = null; @@ -112,10 +113,10 @@ public class JU_JAXBStringifierTest { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - + } + } - + @Test public void teststringifyOs() { JAXBStringifier bdfObj = null; @@ -128,10 +129,10 @@ public class JU_JAXBStringifierTest { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - + } + } - + @Test public void teststringifyOsException() { JAXBStringifier bdfObj = null; @@ -145,10 +146,10 @@ public class JU_JAXBStringifierTest { } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - + } + } - + @Test public void testEmptyMethods() { JAXBStringifier bdfObj = null; @@ -161,10 +162,10 @@ public class JU_JAXBStringifierTest { bdfObj.refresh(env); } catch (APIException e) { assertTrue(e.getMessage().contains("Test Exception")); - } - + } + } - + @Test public void testPretty() { JAXBStringifier bdfObj = null; @@ -173,7 +174,7 @@ public class JU_JAXBStringifierTest { Object retVal = bdfObj.pretty(true); assertTrue(retVal instanceof JAXBStringifier); } - + @Test public void testNewInstanceException() { JAXBStringifier bdfObj = null; @@ -181,6 +182,6 @@ public class JU_JAXBStringifierTest { Mockito.doReturn(jumar).when(jumar).asFragment(true); Object retVal = bdfObj.asFragment(true); assertTrue(retVal instanceof JAXBStringifier); - + } } diff --git a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java index 22c209c2..3623625a 100644 --- a/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.java +++ b/misc/env/src/test/java/org/onap/aaf/misc/env/jaxb/JU_StoreImplTest.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,19 +43,19 @@ import org.onap.aaf.misc.env.StaticSlot; import org.onap.aaf.misc.env.StoreImpl; import org.onap.aaf.misc.env.TimeTaken; -@RunWith(MockitoJUnitRunner.class) +@RunWith(MockitoJUnitRunner.class) public class JU_StoreImplTest { - + @Mock QName qname; - + @Mock Env env; - + TimeTaken tt,ttstringify; - + LogTarget logT; - + @Before public void setUp() { initMocks(this); @@ -72,36 +72,36 @@ public class JU_StoreImplTest { bdfObj = new StoreImpl(""); bdfObj.propsFromArgs(null, new String[] {"test"}); bdfObj.propsFromArgs("test", new String[] {"test","te=st","test=1"}); - + } - + @Test public void testMorePropsConstructor() { Properties props = Mockito.mock(Properties.class); new StoreImpl(null,props); StoreImpl bdfObj = new StoreImpl("test",props); } - + @Test public void testMorePropsFileNOtExists() { Properties props = Mockito.mock(Properties.class); Mockito.doReturn("test").when(props).getProperty("test"); StoreImpl bdfObj = new StoreImpl("test",props); } - + @Test public void testMorePropsExists() { Properties props = Mockito.mock(Properties.class); Mockito.doReturn(System.getProperty("user.dir")+"/src/test/java/org/onap/aaf/misc/env/JU_StoreImplTest.java").when(props).getProperty("test"); StoreImpl bdfObj = new StoreImpl("test",props); } - + @Test public void testNewTransState() { StoreImpl bdfObj = new StoreImpl(null, new String[] {}); bdfObj.newTransState(); } - + @Test public void testSlot() { StoreImpl bdfObj = new StoreImpl("test", new String[] {}); @@ -110,35 +110,35 @@ public class JU_StoreImplTest { slot = bdfObj.slot("test"); assertEquals(slot.toString(),"test=1"); } - + @Test public void testExistingSlot() { StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"}); Slot retVal = bdfObj.existingSlot("test"); assertNull(retVal); } - + @Test public void testExistingSlotNames() { StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"}); List retVal = bdfObj.existingSlotNames(); assertTrue(retVal.size()==0); } - + @Test public void testGet() { StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"}); Object retVal = bdfObj.get(new StaticSlot(1,"test"),qname); assertTrue(retVal instanceof QName); } - + @Test public void testGetSlot() { StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"}); Object retVal = bdfObj.get(new StaticSlot(1,"test")); assertNull(retVal); } - + @Test public void testExistingStaticSlotNames() { StoreImpl bdfObj = new StoreImpl("test", new String[] {"test","test=1"}); diff --git a/misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java b/misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java index 1aaeb7fb..1aca545e 100644 --- a/misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java +++ b/misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java @@ -57,11 +57,11 @@ public class JU_LogFileNamerTest { try { LogFileNamer logFileNamer = new LogFileNamer(dir.getCanonicalPath(), "log"); assertEquals(logFileNamer, logFileNamer.noPID()); - + logFileNamer.setAppender(name); assertEquals(System.getProperty("LOG4J_FILENAME_Append"), dir.getCanonicalFile() + File.separator + "log-" + name + ".log"); - + logFileNamer.setAppender(name); assertEquals(System.getProperty("LOG4J_FILENAME_Append"), dir.getCanonicalFile() + File.separator + "log-" + name + ".0.log"); @@ -76,11 +76,11 @@ public class JU_LogFileNamerTest { try { LogFileNamer logFileNamer = new LogFileNamer(dir.getCanonicalPath(), ""); assertEquals(logFileNamer, logFileNamer.noPID()); - + logFileNamer.setAppender(name); assertEquals(System.getProperty("LOG4J_FILENAME_Different"), dir.getCanonicalPath() + File.separator + name + ".log"); - + logFileNamer.setAppender(name); assertEquals(System.getProperty("LOG4J_FILENAME_Different"), dir.getCanonicalPath() + File.separator + name + ".0.log"); 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 { state.unsent = 0; return parsed; } - + int ch; char c; StringBuilder sb = parsed.sb; @@ -48,7 +48,7 @@ public class InJson implements Parse { 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 { 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 { public int braces = 0; public char unsent = 0; } - + // @Override public Parsed newParsed() { return new Parsed(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 { 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 { // @Override public Parsed parse(Reader r, Parsed 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 { 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 { // 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 { throw new ParseException(e); } } - + public static final class DerTag { public String name; public boolean isEndTag; public List 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 { } } } - + public String toString() { StringBuilder sb = new StringBuilder(); sb.append(isEndTag?"End":"Start"); @@ -227,7 +227,7 @@ public class InXML implements Parse { return sb.toString(); } } - + private static class ArrayState { public boolean firstObj = true; public boolean didNext = false; @@ -244,7 +244,7 @@ public class InXML implements Parse { unevaluated = null; attribs = null;; } - + public boolean hasAttributes() { return attribs!=null && idx { } attribs.add(prop); } - + public Prop pop() { Prop rv = null; if (attribs!=null) { @@ -266,18 +266,18 @@ public class InXML implements Parse { return rv; } } - + private static abstract class GreatExpectations { protected JaxInfo ji; protected GreatExpectations prev; private Map 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 parsed, DerTag derTag) throws ParseException; // Recursively look back for any namespaces @@ -301,9 +301,9 @@ public class InXML implements Parse { private JaxInfo getDerived(State state, JaxInfo ji, DerTag derTag) throws ParseException { if (derTag==null)return ji; - + List props = derTag.props; - + Prop derived = null; if (props!=null) { // Load Namespaces (if any) @@ -339,13 +339,13 @@ public class InXML implements Parse { 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 parsed, DerTag derTag) throws ParseException { if (derTag.isXmlInfo) { @@ -357,13 +357,13 @@ public class InXML implements Parse { } 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 { 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 { throw new ParseException("Expected '); } return false; - } + } } private static class ArrayExpectations extends GreatExpectations { @@ -445,7 +445,7 @@ public class InXML implements Parse { if (derTag.isEndTag) { throw new ParseException("Unexpected End Tag '); } 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 { parsed.state.arrayInfo.pop(); } return false; - } + } } // @Override public Parsed newParsed() throws ParseException { @@ -484,5 +484,5 @@ public class InXML implements Parse { 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 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 @@ -65,7 +65,7 @@ public class JaxSet { } } } - + public static abstract class Setter { 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 { 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 { } 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 { 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 implements Parse { /** * 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 void extract(IN in, Writer writer, Parse parse, boolean ... options) throws IOException, ParseException; - + public void extract(IN in, OutputStream os, Parse 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 void extract(IN in, Writer writer, Parse prs, boolean ... options) throws IOException, ParseException { Parsed 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 = ""; + public static final String XML_INFO = ""; public static final String XML_SCHEMA_INSTANCE = "http://www.w3.org/2001/XMLSchema-instance"; - + private String root; private List 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 void extract(IN in, Writer writer, Parse prs, boolean ... options) throws IOException, ParseException { Parsed p = prs.newParsed(); Stack stack = new Stack(); // 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 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 { public Parsed parse(IN in, Parsed 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 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 { 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 { public boolean valid() { return event!=Parse.NONE; } - + public Parsed reuse() { isString=false; sb.setLength(0); @@ -70,7 +70,7 @@ public class Parsed { 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{ 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{ 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{ } } } - + // @Override public Parsed parse(Reader ignore, Parsed 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{ public static class State { public int count = 0; } - + public static class Content { private boolean isString; private char event; private String name; private List 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{ 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{ return sb.toString(); } } - + //// @Override public Parsed newParsed() { Parsed ps = new Parsed(new State()); @@ -184,7 +184,7 @@ public class Saved extends Out implements Parse{ 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 charMap; // see initialization at end private static final TreeMap 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 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 extends BaseDataFactory implements DataFactory { - + 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 defaultIn; private Out defaultOut; private RosettaEnv env; @@ -75,7 +75,7 @@ public class RosettaDF extends BaseDataFactory implements DataFactory { private TYPE outType; private int defOption; Marshal marshal = null; - + /** * Private constructor to setup Type specific data manipulators @@ -92,13 +92,13 @@ public class RosettaDF extends BaseDataFactory implements DataFactory { RosettaDF(RosettaEnv env, Schema schema, String rootNs, Class 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 extends BaseDataFactory implements DataFactory { throw new APIException(e); } } - + // @Override public RosettaData newData() { - RosettaData data = new RosettaData(env, this) + RosettaData data = new RosettaData(env, this) .in(inType) .out(outType) .option(defOption); @@ -141,7 +141,7 @@ public class RosettaDF extends BaseDataFactory implements DataFactory { /** * If exists, first option is "Pretty", second is "Fragment" - * + * * @param options * @return */ @@ -150,7 +150,7 @@ public class RosettaDF extends BaseDataFactory implements DataFactory { defaultOut = getOut(type==Data.TYPE.DEFAULT?Data.TYPE.JSON:type); return this; } - + public Parse getIn(Data.TYPE type) { switch(type) { case DEFAULT: @@ -163,7 +163,7 @@ public class RosettaDF extends BaseDataFactory implements DataFactory { return defaultIn; } } - + public Out getOut(Data.TYPE type) { switch(type) { case DEFAULT: @@ -178,7 +178,7 @@ public class RosettaDF extends BaseDataFactory implements DataFactory { return defaultOut; } } - + public int logType(org.onap.aaf.misc.env.Data.TYPE ot) { switch(ot) { case JSON: @@ -204,15 +204,15 @@ public class RosettaDF extends BaseDataFactory implements DataFactory { public RosettaDF 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 extends BaseDataFactory implements DataFactory { } 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 implements Data{ 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 rosettaDF) { df = rosettaDF; @@ -57,7 +57,7 @@ public class RosettaData implements Data{ 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 implements Data{ inType = rosettaType; return this; } - + // // @Override public RosettaData out(TYPE rosettaType) { outType = rosettaType; @@ -89,7 +89,7 @@ public class RosettaData implements Data{ } return this; } - + // @Override public RosettaData load(InputStream is) throws APIException { Parse in = df.getIn(inType); @@ -119,7 +119,7 @@ public class RosettaData implements Data{ json = str; break; default: - + } } catch (Exception e) { throw new APIException(e); @@ -152,7 +152,7 @@ public class RosettaData implements Data{ public Saved getEvents() { return saved; } - + // @Override public T asObject() throws APIException { Out out = df.getOut(TYPE.XML); @@ -206,7 +206,7 @@ public class RosettaData implements Data{ 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 implements Data{ 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 implements Data{ } return this; } - + // @Override public Class 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 in = df.getIn(inType); Out out = df.getOut(outType); @@ -302,7 +302,7 @@ public class RosettaData implements Data{ } } - + 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 RosettaDF 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 */ public abstract class DataWriter { public abstract boolean write(T t, StringBuilder sb); - + public final static DataWriter STRING = new DataWriter() { @Override public boolean write(String s, StringBuilder sb) { sb.append(s); return true; - } + } }; - + public final static DataWriter INTEGER = new DataWriter() { @Override public boolean write(Integer i, StringBuilder sb) { sb.append(i); return false; - } + } }; - + public final static DataWriter LONG = new DataWriter() { @Override public boolean write(Long t, StringBuilder sb) { sb.append(t); return false; - } + } }; public final static DataWriter BYTE = new DataWriter() { @@ -65,7 +65,7 @@ public abstract class DataWriter { public boolean write(Byte t, StringBuilder sb) { sb.append(t); return false; - } + } }; public final static DataWriter CHAR = new DataWriter() { @@ -73,7 +73,7 @@ public abstract class DataWriter { public boolean write(Character t, StringBuilder sb) { sb.append(t); return true; - } + } }; public final static DataWriter BOOL = new DataWriter() { @@ -81,7 +81,7 @@ public abstract class DataWriter { public boolean write(Boolean t, StringBuilder sb) { sb.append(t); return true; - } + } }; @@ -99,7 +99,7 @@ public abstract class DataWriter { // } return true; } - + }; */ @@ -110,7 +110,7 @@ public abstract class DataWriter { return true; } }; - + public final static DataWriter DATE_TIME = new DataWriter() { @Override public boolean write(XMLGregorianCalendar t, StringBuilder sb) { @@ -123,7 +123,7 @@ public abstract class DataWriter { public final static DataWriter HEX_BINARY = new DataWriter() { @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 extends Marshal { private Marshal root; - + public DocMarshal(Marshal root) { this.root = root; } - + @Override public Parsed parse(T t, Parsed parsed) throws ParseException { Ladder> 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 extends Marshal { this.name = name; dataWriter = dw; } - + @SuppressWarnings("unchecked") @Override public Parsed parse(T t, Parsed parsed) throws ParseException { @@ -69,7 +69,7 @@ public abstract class FieldArray extends Marshal { } 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 extends FieldMarshal{ 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 extends FieldMarshal { 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 extends FieldMarshal { 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 extends FieldMarshal{ 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 extends Marshal { public FieldMarshal(String name) { this.name = name; } - + public String getName() { return name; } - + @Override public Parsed parse(T t, Parsed parsed) { parsed.state.ladder.push(DONE_ITERATOR); @@ -55,5 +55,5 @@ public abstract class FieldMarshal extends Marshal { * @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 extends FieldMarshal { 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 extends FieldMarshal { 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 implements Iterator { private Iterator delg; public ListIterator(List list) { curr = null; - delg = list.iterator(); + delg = list.iterator(); } @Override public boolean hasNext() { @@ -46,7 +46,7 @@ final class ListIterator implements Iterator { 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 implements Iterator { 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 extends Marshal { // Note: Not Using List or ArrayList, because there is no "Peek" concept in their iterator. private Marshal[] pml; private int end=0; - + /** * @param pm */ @SuppressWarnings("unchecked") protected void add(Marshal 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 extends Marshal { public Marshal 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 http://java.sun.com/xml/jaxb -// 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 http://java.sun.com/xml/jaxb +// 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; /** *

Java class for anonymous complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

  * <complexType>
  *   <complexContent>
@@ -70,8 +70,8 @@ import javax.xml.bind.annotation.XmlType;
  *   </complexContent>
  * </complexType>
  * 
- * - * + * + * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { @@ -84,25 +84,25 @@ public class Api { /** * Gets the value of the route property. - * - *

+ * + * * 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 set method for the route property. - * - *

+ * + * * For example, to add a new item, do as follows: *

      *    getRoute().add(newItem);
      * 
- * - * - *

+ * + * + * * Objects of the following type(s) are allowed in the list * {@link Api.Route } - * - * + * + * */ public List getRoute() { if (route == null) { @@ -114,9 +114,9 @@ public class Api { /** *

Java class for anonymous complex type. - * + * *

The following schema fragment specifies the expected content contained within this class. - * + * *

      * <complexType>
      *   <complexContent>
@@ -135,8 +135,8 @@ public class Api {
      *   </complexContent>
      * </complexType>
      * 
- * - * + * + * */ @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. - * - *

+ * + * * 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 set method for the param property. - * - *

+ * + * * For example, to add a new item, do as follows: *

          *    getParam().add(newItem);
          * 
- * - * - *

+ * + * + * * Objects of the following type(s) are allowed in the list * {@link String } - * - * + * + * */ public List 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. - * - *

+ * + * * 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 set method for the comments property. - * - *

+ * + * * For example, to add a new item, do as follows: *

          *    getComments().add(newItem);
          * 
- * - * - *

+ * + * + * * Objects of the following type(s) are allowed in the list * {@link String } - * - * + * + * */ public List getComments() { if (comments == null) { @@ -296,25 +296,25 @@ public class Api { /** * Gets the value of the contentType property. - * - *

+ * + * * 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 set method for the contentType property. - * - *

+ * + * * For example, to add a new item, do as follows: *

          *    getContentType().add(newItem);
          * 
- * - * - *

+ * + * + * * Objects of the following type(s) are allowed in the list * {@link String } - * - * + * + * */ public List 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. - * - *

+ * + * * 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 set method for the explicitErr property. - * - *

+ * + * * For example, to add a new item, do as follows: *

          *    getExplicitErr().add(newItem);
          * 
- * - * - *

+ * + * + * * Objects of the following type(s) are allowed in the list * {@link Integer } - * - * + * + * */ public List 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 rosettaObj = new RosettaData(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 rosettaObj = new RosettaData(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 rosettaObj = new RosettaData(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 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 rosettaObj = new RosettaData(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 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 rosettaObj = new RosettaData(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 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 rosettaObj = new RosettaData(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 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 rosettaObj = new RosettaData(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 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 rosettaObj = new RosettaData(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 retVal = rosettaObj.to(Mockito.mock(StringWriter.class)); - + } catch (APIException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testGetTypeClass() { RosettaData rosettaObj = new RosettaData(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 rosettaObj = new RosettaData(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 = "\n" + "\n" + " \n" + @@ -63,21 +63,21 @@ public class JU_FromXML { " \n" + " MyFluff\n" + "\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() //"xk32331353082669667"); - + // 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 in, Out out, String str) throws IOException, ParseException { go(in,out,str,str); } private void go(Parse 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 ladder = new Ladder(); - + for (int i=0;i<30;++i) { for (int j=0;j { 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 { // 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 { } finally { tt.done(); } - + sbw.append("\n==== Start XML =====\n"); tt = trans.start("XML", 3); try { @@ -86,7 +86,7 @@ public class JU_Saved { } finally { tt.done(); } - + sbw.append("\n==== Start JSON =====\n"); tt = trans.start("JSON", 4); try { @@ -96,7 +96,7 @@ public class JU_Saved { } 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_2 - + {"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 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 { "\n" + "MyFluff\n" + "\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 inObj = new InObj(SampleData.class); // // JaxSet jaxSet = JaxSet.get(SampleData.class); // Setter setter = jaxSet.setter("id"); // setter.set(sd, "Your ID"); -// +// // for (Entry> 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 = "" + "\n" + "\nMyString" @@ -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 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 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 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 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 { return t.getStr(); } }); - + add(new FieldNumeric("int") { @Override protected Integer data(Single t) { return t.getInt(); } }); - + add(new FieldNumeric("long") { @Override protected Long data(Single t) { @@ -72,14 +72,14 @@ public class SingleMarshal extends ObjMarshal { return t.getDate(); } }); - + add(new FieldHexBinary("binary") { @Override protected byte[] data(Single t) { return t.getBinary(); } }); - + add(new FieldArray("array", DataWriter.STRING) { @Override protected List data(Single t) { -- cgit 1.2.3-korg