diff options
author | Instrumental <jonathan.gathman@att.com> | 2019-10-15 08:19:50 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2019-10-15 08:35:35 -0500 |
commit | 1296352d8eafee57f982a4342ad79ada4aa56d28 (patch) | |
tree | 355cdb89d85530a861319f892b0f24236e6adc50 /misc/rosetta/src/test/java | |
parent | bdce7667a6e272e2fa32e298d957a0d9090c5bc9 (diff) |
Sonar Fixes, Formatting
Issue-ID: AAF-1019
Change-Id: Ica49d9e7323aad9622ff9d95cc21b87430c22c54
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'misc/rosetta/src/test/java')
19 files changed, 326 insertions, 326 deletions
diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java index 1a31b0fb..83972f96 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/JU_ParseException.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -43,7 +43,7 @@ public class JU_ParseException { ParseException pe = new ParseException("exception",new NullPointerException("exception")); } - - + + } diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/Api.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/Api.java index 20744355..e7d07406 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/Api.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/Api.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,10 +19,10 @@ * */ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2018.12.09 at 10:14:23 PM IST +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.5-2 +// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2018.12.09 at 10:14:23 PM IST // @@ -39,9 +39,9 @@ import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. - * + * * <p>The following schema fragment specifies the expected content contained within this class. - * + * * <pre> * <complexType> * <complexContent> @@ -70,8 +70,8 @@ import javax.xml.bind.annotation.XmlType; * </complexContent> * </complexType> * </pre> - * - * + * + * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { @@ -84,25 +84,25 @@ public class Api { /** * Gets the value of the route property. - * - * <p> + * + * * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the route property. - * - * <p> + * + * * For example, to add a new item, do as follows: * <pre> * getRoute().add(newItem); * </pre> - * - * - * <p> + * + * + * * Objects of the following type(s) are allowed in the list * {@link Api.Route } - * - * + * + * */ public List<Api.Route> getRoute() { if (route == null) { @@ -114,9 +114,9 @@ public class Api { /** * <p>Java class for anonymous complex type. - * + * * <p>The following schema fragment specifies the expected content contained within this class. - * + * * <pre> * <complexType> * <complexContent> @@ -135,8 +135,8 @@ public class Api { * </complexContent> * </complexType> * </pre> - * - * + * + * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { @@ -166,11 +166,11 @@ public class Api { /** * Gets the value of the meth property. - * + * * @return * possible object is * {@link String } - * + * */ public String getMeth() { return meth; @@ -178,11 +178,11 @@ public class Api { /** * Sets the value of the meth property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setMeth(String value) { this.meth = value; @@ -190,11 +190,11 @@ public class Api { /** * Gets the value of the path property. - * + * * @return * possible object is * {@link String } - * + * */ public String getPath() { return path; @@ -202,11 +202,11 @@ public class Api { /** * Sets the value of the path property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setPath(String value) { this.path = value; @@ -214,25 +214,25 @@ public class Api { /** * Gets the value of the param property. - * - * <p> + * + * * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the param property. - * - * <p> + * + * * For example, to add a new item, do as follows: * <pre> * getParam().add(newItem); * </pre> - * - * - * <p> + * + * + * * Objects of the following type(s) are allowed in the list * {@link String } - * - * + * + * */ public List<String> getParam() { if (param == null) { @@ -243,11 +243,11 @@ public class Api { /** * Gets the value of the desc property. - * + * * @return * possible object is * {@link String } - * + * */ public String getDesc() { return desc; @@ -255,11 +255,11 @@ public class Api { /** * Sets the value of the desc property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setDesc(String value) { this.desc = value; @@ -267,25 +267,25 @@ public class Api { /** * Gets the value of the comments property. - * - * <p> + * + * * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the comments property. - * - * <p> + * + * * For example, to add a new item, do as follows: * <pre> * getComments().add(newItem); * </pre> - * - * - * <p> + * + * + * * Objects of the following type(s) are allowed in the list * {@link String } - * - * + * + * */ public List<String> getComments() { if (comments == null) { @@ -296,25 +296,25 @@ public class Api { /** * Gets the value of the contentType property. - * - * <p> + * + * * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the contentType property. - * - * <p> + * + * * For example, to add a new item, do as follows: * <pre> * getContentType().add(newItem); * </pre> - * - * - * <p> + * + * + * * Objects of the following type(s) are allowed in the list * {@link String } - * - * + * + * */ public List<String> getContentType() { if (contentType == null) { @@ -325,7 +325,7 @@ public class Api { /** * Gets the value of the expected property. - * + * */ public int getExpected() { return expected; @@ -333,7 +333,7 @@ public class Api { /** * Sets the value of the expected property. - * + * */ public void setExpected(int value) { this.expected = value; @@ -341,25 +341,25 @@ public class Api { /** * Gets the value of the explicitErr property. - * - * <p> + * + * * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the explicitErr property. - * - * <p> + * + * * For example, to add a new item, do as follows: * <pre> * getExplicitErr().add(newItem); * </pre> - * - * - * <p> + * + * + * * Objects of the following type(s) are allowed in the list * {@link Integer } - * - * + * + * */ public List<Integer> getExplicitErr() { if (explicitErr == null) { diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java index 9ab3b258..0d942e09 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -58,21 +58,21 @@ public class JU_RosettaData { @Mock Env env; - + @Mock RosettaDF df; - + @Mock JAXBmar bmar; - + @Mock Saved saved; - + @Before public void setUp() { initMocks(this); } - + @Test public void testLoad() { RosettaData rosettaObj = new RosettaData(env, df); @@ -84,14 +84,14 @@ public class JU_RosettaData { Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(sr,(Writer)null,inxml); - + rosettaObj = rosettaObj.load(sr); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testLoadException() { RosettaData rosettaObj = new RosettaData(env, df); @@ -105,7 +105,7 @@ public class JU_RosettaData { assertTrue(e.getMessage().contains("NullPointerException")); } } - + @Test public void testLoadIs() { RosettaData rosettaObj = new RosettaData(env, df); @@ -117,14 +117,14 @@ public class JU_RosettaData { Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(new InputStreamReader(sr),(Writer)null,inxml); - + rosettaObj = rosettaObj.load(sr); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testLoadIsException() { RosettaData rosettaObj = new RosettaData(env, df); @@ -138,7 +138,7 @@ public class JU_RosettaData { assertTrue(e.getMessage().contains("NullPointerException")); } } - + @Test public void testLoadStr() { RosettaData rosettaObj = new RosettaData(env, df); @@ -149,7 +149,7 @@ public class JU_RosettaData { Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml); - + rosettaObj = rosettaObj.load("test"); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block @@ -166,7 +166,7 @@ public class JU_RosettaData { Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.JSON); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml); - + rosettaObj = rosettaObj.load("test"); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block @@ -186,7 +186,7 @@ public class JU_RosettaData { assertTrue(e.getMessage().contains("NullPointerException")); } } - + @Test public void testLoadT() { RosettaData rosettaObj = new RosettaData(env, df); @@ -198,7 +198,7 @@ public class JU_RosettaData { df.jaxMar = Mockito.mock(JAXBmar.class); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml); - + rosettaObj = rosettaObj.load(bmar); df.marshal = null; rosettaObj = rosettaObj.load(bmar); @@ -207,7 +207,7 @@ public class JU_RosettaData { e.printStackTrace(); } } - + @Test public void testLoadTMarshalNull() { RosettaData rosettaObj = new RosettaData(env, df); @@ -226,7 +226,7 @@ public class JU_RosettaData { e.printStackTrace(); } } - + @Test public void testLoadTException() { RosettaData rosettaObj = new RosettaData(env, df); @@ -240,14 +240,14 @@ public class JU_RosettaData { assertTrue(e.getMessage().contains("NullPointerException")); } } - + @Test public void testGetEvents() { RosettaData rosettaObj = new RosettaData(env, df); Saved saved = rosettaObj.getEvents(); assertEquals("Rosetta Saved", saved.logName()); } - + @Test public void testAsObject() { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); @@ -265,15 +265,15 @@ public class JU_RosettaData { Mockito.doReturn( lt).when(env).debug(); Mockito.doNothing().when(saved).extract(null,new StringWriter(),saved); Mockito.doReturn(bmar).when(df.jaxUmar).unmarshal(lt,""); - + bmar = rosettaObj.asObject(); - + } catch (APIException | IOException | ParseException | JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testAsObjectException() { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); @@ -291,9 +291,9 @@ public class JU_RosettaData { Mockito.doReturn( lt).when(env).debug(); Mockito.doThrow(new IOException("test Exception")).when(saved).extract(null,new StringWriter(),saved); Mockito.doThrow(new JAXBException("test Exception")).when(df.jaxUmar).unmarshal(lt,""); - + bmar = rosettaObj.asObject(); - + } catch (APIException | IOException | ParseException | JAXBException e) { assertTrue(e.getMessage().contains("test Exception")); } @@ -308,12 +308,12 @@ public class JU_RosettaData { rosettaObj.setSaved(saved); try { Out outxml = Mockito.mock(OutXML.class); - + Mockito.doReturn(outxml).when(df).getOut(type); Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML); Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2); - + String retVal = rosettaObj.asString(); assertTrue("".equals(retVal)); } catch (APIException e) { @@ -321,7 +321,7 @@ public class JU_RosettaData { e.printStackTrace(); } } - + @Test public void testAsStringJson() { TYPE type = TYPE.JSON; @@ -331,12 +331,12 @@ public class JU_RosettaData { rosettaObj.setSaved(saved); try { Out outxml = Mockito.mock(OutXML.class); - + Mockito.doReturn(outxml).when(df).getOut(type); Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON); Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4); - + String retVal = rosettaObj.asString(); assertTrue("".equals(retVal)); } catch (APIException e) { @@ -351,34 +351,34 @@ public class JU_RosettaData { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); rosettaObj = rosettaObj.in(Data.TYPE.XML); rosettaObj.setSaved(saved); - + try { InXML inxml = Mockito.mock(InXML.class); Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml); - + rosettaObj = rosettaObj.load("test"); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + try { Out outxml = Mockito.mock(OutXML.class); - + Mockito.doReturn(outxml).when(df).getOut(type); Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML); Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2); RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(OutputStream.class)); - + } catch (APIException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testToJson() { TYPE type = TYPE.JSON; @@ -386,34 +386,34 @@ public class JU_RosettaData { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); rosettaObj = rosettaObj.in(Data.TYPE.JSON); rosettaObj.setSaved(saved); - + try { InXML inxml = Mockito.mock(InXML.class); Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.JSON); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml); - + rosettaObj = rosettaObj.load("test"); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + try { Out outxml = Mockito.mock(OutXML.class); - + Mockito.doReturn(outxml).when(df).getOut(type); Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON); Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4); RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(OutputStream.class)); - + } catch (APIException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testTo() { TYPE type = TYPE.XML; @@ -421,22 +421,22 @@ public class JU_RosettaData { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); rosettaObj = rosettaObj.in(Data.TYPE.XML); rosettaObj.setSaved(saved); - + try { Out outxml = Mockito.mock(OutXML.class); - + Mockito.doReturn(outxml).when(df).getOut(type); Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML); Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2); RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(OutputStream.class)); - + } catch (APIException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testToWriterXml() { TYPE type = TYPE.XML; @@ -444,34 +444,34 @@ public class JU_RosettaData { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); rosettaObj = rosettaObj.in(Data.TYPE.XML); rosettaObj.setSaved(saved); - + try { InXML inxml = Mockito.mock(InXML.class); Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.XML); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml); - + rosettaObj = rosettaObj.load("test"); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + try { Out outxml = Mockito.mock(OutXML.class); - + Mockito.doReturn(outxml).when(df).getOut(type); Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML); Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2); RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(StringWriter.class)); - + } catch (APIException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testToWriterJson() { TYPE type = TYPE.JSON; @@ -479,34 +479,34 @@ public class JU_RosettaData { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); rosettaObj = rosettaObj.in(Data.TYPE.JSON); rosettaObj.setSaved(saved); - + try { InXML inxml = Mockito.mock(InXML.class); Mockito.doReturn(inxml).when(df).getIn(Data.TYPE.JSON); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(inxml).start(env); Mockito.doNothing().when(saved).extract(new StringReader("test"),(Writer)null,inxml); - + rosettaObj = rosettaObj.load("test"); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + try { Out outxml = Mockito.mock(OutXML.class); - + Mockito.doReturn(outxml).when(df).getOut(type); Mockito.doReturn(Env.JSON).when(df).logType(Data.TYPE.JSON); Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",4); RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(StringWriter.class)); - + } catch (APIException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testToWriter() { TYPE type = TYPE.XML; @@ -514,28 +514,28 @@ public class JU_RosettaData { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); rosettaObj = rosettaObj.in(Data.TYPE.XML); rosettaObj.setSaved(saved); - + try { Out outxml = Mockito.mock(OutXML.class); - + Mockito.doReturn(outxml).when(df).getOut(type); Mockito.doReturn(Env.XML).when(df).logType(Data.TYPE.XML); Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2); RosettaData<JAXBmar> retVal = rosettaObj.to(Mockito.mock(StringWriter.class)); - + } catch (APIException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + @Test public void testGetTypeClass() { RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); rosettaObj.getTypeClass(); } - + @Test public void testDirect() { TYPE type = TYPE.XML; @@ -553,7 +553,7 @@ public class JU_RosettaData { e.printStackTrace(); } } - + @Test public void testDirectException() { TYPE type = TYPE.XML; @@ -561,11 +561,11 @@ public class JU_RosettaData { Mockito.doReturn(type).when(df).getInType(); RosettaData<JAXBmar> rosettaObj = new RosettaData<JAXBmar>(env, df); InXML inxml = null; - + inxml = Mockito.mock(InXML.class); Mockito.doReturn(inxml).when(df).getIn(type); - - + + StringReader is = Mockito.mock(StringReader.class); StringWriter os= Mockito.mock(StringWriter.class); try { @@ -575,14 +575,14 @@ public class JU_RosettaData { Mockito.doReturn("test").when(outxml).logName(); Mockito.doReturn( Mockito.mock(TimeTaken.class)).when(env).start("test",2); Mockito.doThrow( new IOException("testException")).when(outxml).extract(is, os, inxml, true); - + rosettaObj.direct(is,os, true); } catch (APIException | IOException | ParseException e) { // TODO Auto-generated catch block assertTrue(e.getMessage().contains("testException")); } } - + @Test public void testDirectT() { TYPE type = TYPE.XML; @@ -599,7 +599,7 @@ public class JU_RosettaData { LogTarget lt = Mockito.mock(LogTarget.class); Mockito.doReturn( lt).when(env).debug(); Mockito.doReturn(bmar).when(df.jaxMar).marshal(lt,bmar, new StringWriter(),true); - + rosettaObj.direct(bmar, Mockito.mock(StringWriter.class), true); df.marshal =Mockito.mock(Marshal.class);; rosettaObj.direct(bmar, Mockito.mock(StringWriter.class), true); @@ -608,7 +608,7 @@ public class JU_RosettaData { e.printStackTrace(); } } - + @Test public void testDirectTOS() { TYPE type = TYPE.XML; @@ -625,7 +625,7 @@ public class JU_RosettaData { LogTarget lt = Mockito.mock(LogTarget.class); Mockito.doReturn( lt).when(env).debug(); Mockito.doReturn(bmar).when(df.jaxMar).marshal(lt,bmar, new StringWriter(),true); - + rosettaObj.direct(bmar, Mockito.mock(OutputStream.class), true); df.marshal =Mockito.mock(Marshal.class);; rosettaObj.direct(bmar, Mockito.mock(OutputStream.class), true); @@ -634,7 +634,7 @@ public class JU_RosettaData { e.printStackTrace(); } } - + @Test public void testDirectTOSJson() { TYPE type = TYPE.JSON; @@ -651,13 +651,13 @@ public class JU_RosettaData { LogTarget lt = Mockito.mock(LogTarget.class); Mockito.doReturn( lt).when(env).debug(); Mockito.doReturn(bmar).when(df.jaxMar).marshal(lt,bmar, new StringWriter(),true); - + rosettaObj.direct(bmar, Mockito.mock(OutputStream.class), true); } catch (APIException | IOException | JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); } } - + } diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java index c8771519..631abc00 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/env/JU_RosettaEnv.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -45,7 +45,7 @@ public class JU_RosettaEnv { public void setUp() { initMocks(this); } - + @Test public void testNewDataFactoryClass() { RosettaEnv rosettaObj = new RosettaEnv(); @@ -57,7 +57,7 @@ public class JU_RosettaEnv { e.printStackTrace(); } } - + @Test public void testNewDataFactorySchema() { RosettaEnv rosettaObj = new RosettaEnv(Mockito.mock(Applet.class),"test"); @@ -69,7 +69,7 @@ public class JU_RosettaEnv { e.printStackTrace(); } } - + @Test public void testNewDataFactoryQname() { RosettaEnv rosettaObj = new RosettaEnv(new String[] {"test"}); @@ -82,7 +82,7 @@ public class JU_RosettaEnv { e.printStackTrace(); } } - + @Test public void testNewDataFactoryQnameSchema() { RosettaEnv rosettaObj = new RosettaEnv("test", new String[] {"test"}); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java index 5b7875f7..a7f8f115 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/marshal/JU_FieldBlob.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -38,7 +38,7 @@ public class JU_FieldBlob { // TODO Auto-generated method stub return null; } - + } @Test public void testData() { diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java index 67565122..d36862e8 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromJSON.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -58,18 +58,18 @@ public class JU_FromJSON { new OutRaw().extract(new StringReader(str),sbw,inJSON); System.out.println(sbw.getBuffer()); } - + @Test public void parseJSON2Dump() throws Exception { System.out.println("*** PARSE JSON -> Dump ***"); System.out.println(str); StringBuilderWriter sbw = new StringBuilderWriter(1024); - + new OutDump().extract(new StringReader(str), sbw, inJSON); - + System.out.println(sbw.getBuffer()); } - + @Test public void nonprettyJSON() throws Exception { System.out.println("*** JSON -> (Intermediate Stream) -> Non-pretty JSON ***"); @@ -91,21 +91,21 @@ public class JU_FromJSON { } report.glean(trans,Env.JSON); } while (report.go()); - + String result = sbw.toString(); System.out.println(result); Assert.assertEquals(result, str); report.report(sbw); System.out.println(sbw.toString()); } - + @Test public void parseJSON2JSON() throws Exception { System.out.println("*** JSON -> (Intermediate Stream) -> Pretty JSON ***"); System.out.println(str); StringBuilderWriter sbw = new StringBuilderWriter(1024); - + Out jout = new OutJson(); Trans trans; Report report = new Report(ITERATIONS,"JSON"); @@ -121,7 +121,7 @@ public class JU_FromJSON { } report.glean(trans,Env.JSON); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); } @@ -132,7 +132,7 @@ public class JU_FromJSON { System.out.println(str); StringBuilderWriter sbw = new StringBuilderWriter(1024); - + Out xout = new OutXML("LargerData","xmlns=urn:s:xsd"); Trans trans; Report report = new Report(ITERATIONS,"JSON"); @@ -148,7 +148,7 @@ public class JU_FromJSON { } report.glean(trans,Env.JSON); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); } @@ -160,7 +160,7 @@ public class JU_FromJSON { StringBuilderWriter sbw = new StringBuilderWriter(1024); IndentPrintWriter ipw = new IndentPrintWriter(sbw); - + Out xout = new OutXML("LargerData","xmlns=urn:s:xsd"); Trans trans; Report report = new Report(ITERATIONS,"JSON"); @@ -176,12 +176,12 @@ public class JU_FromJSON { } report.glean(trans,Env.JSON); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); } - - + + @Test public void jaxbObj2XML() throws Exception { System.out.println("*** JAXB Object -> XML ***"); @@ -200,7 +200,7 @@ public class JU_FromJSON { sd.getItem().add("Item 2.2"); ld.getSampleData().add(sd); ld.setFluff("MyFluff"); - + JAXBmar jaxBmar = new JAXBmar(LargerData.class); //jaxBmar.asFragment(true); //jaxBmar.pretty(true); @@ -219,7 +219,7 @@ public class JU_FromJSON { } report.glean(trans,Env.XML); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); } @@ -242,7 +242,7 @@ public class JU_FromJSON { sd.getItem().add("Item 2.2"); ld.getSampleData().add(sd); ld.setFluff("MyFluff"); - + JAXBmar jaxBmar = new JAXBmar(LargerData.class); //jaxBmar.asFragment(true); jaxBmar.pretty(true); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java index 4fefe622..1a10779b 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_FromXML.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -45,8 +45,8 @@ import s.xsd.LargerData; public class JU_FromXML { private static int ITERATIONS = 1; ; - - private final static String xml = + + private final static String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<LargerData xmlns=\"urn:s:xsd\">\n" + " <SampleData>\n" + @@ -63,21 +63,21 @@ public class JU_FromXML { " </SampleData>\n" + " <fluff>MyFluff</fluff>\n" + "</LargerData>\n"; - - + + @Test public void test() throws Exception { InXML inXML = new InXML(LargerData.class); - + System.out.println(xml); StringBuilderWriter sbw = new StringBuilderWriter(1024); - + Reader rdr = new StringReader(xml); - + new OutRaw().extract(rdr, sbw, inXML); System.out.println(sbw.getBuffer()); } - + @Test public void xml2JSON() throws Exception { @@ -86,7 +86,7 @@ public class JU_FromXML { InXML inXML = new InXML(LargerData.class); StringBuilderWriter sbw = new StringBuilderWriter(1024); - + Trans trans; Report report = new Report(ITERATIONS,"XML"); do { @@ -101,7 +101,7 @@ public class JU_FromXML { } report.glean(trans,Env.XML); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); } @@ -113,7 +113,7 @@ public class JU_FromXML { InXML inXML = new InXML(LargerData.class); StringBuilderWriter sbw = new StringBuilderWriter(1024); - + Trans trans; Report report = new Report(ITERATIONS,"XML"); do { @@ -128,23 +128,23 @@ public class JU_FromXML { } report.glean(trans,Env.XML); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); } - - + + @Test public void warmup() throws Exception { if (ITERATIONS>20) { System.out.println("*** Warmup JAXB ***"); - + JAXBumar jaxbUmar = new JAXBumar(LargerData.class); JAXBmar jaxBmar = new JAXBmar(LargerData.class); //jaxBmar.asFragment(true); //jaxBmar.pretty(true); StringBuilderWriter sbw = new StringBuilderWriter(1024); - + LargerData ld; Trans trans; @@ -171,7 +171,7 @@ public class JU_FromXML { } report.glean(trans,Env.XML); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); } @@ -210,7 +210,7 @@ public class JU_FromXML { } report.glean(trans,Env.XML); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); } diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java index af58ea57..4e9bfdc5 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_JSON.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -44,7 +44,7 @@ public class JU_JSON { Out jout = new OutJson(); go(jin, jout, "{\"id\":\"Me, Myself\",\"date\":1353094689100}"); - + go(jin, jout, "{\"id\":\"My ID 1\",\"desc\":\"My Description 1\",\"comment\":[\"My Comment 1\"],\"utc\":1360418381310}"); go(jin, jout, "{\"id\":\"My ID 1\",\"desc\":\"My Description 1\",\"comment\":[\"My Comment 1\",\"My Comment 2\"],\"utc\":1360418381310}"); @@ -52,16 +52,16 @@ public class JU_JSON { "{\"id\":\"sd object \\\"1\\\"\",\"date\":1316084944213,\"item\":[\"Item 1.1\",\"Item 1.2\"]}," + "{\"id\":\"sd object \\\"2\\\"\",\"date\":1316084945343,\"item\":[\"Item 2.1\",\"Item 2.2\"]}],\"fluff\":\"MyFluff\"}" ); - + go(jin, jout, "{\"SampleData\":[{\"date\":1316084945343}],\"fluff\":\"MyFluff\"}"); - + go(jin, jout, "{\"id\":\"Me,[}[eg[)(:x,\\\" Myself\",\"date\":1353094689100}"); - + // TODO: Clean out AT&T specific data go(jin,jout, "{\"userid\":\"xk3233\",\"timestamp\":1353097388531,\"item\":[{\"tag\":\"color\",\"value\":\"Mauve\"},{\"tag\":\"shirtsize\",\"value\":\"Xtra Large\"}]}"); //go() //"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><vote xmlns=\"urn:poll.att.com\"><userid>xk3233</userid><timestamp>1353082669667</timestamp></vote>"); - + // 3/11/2015 Jonathan found a case with missing comma go(jin,jout, "{\"start\":\"2015-03-11T18:18:05.580-05:00\",\"end\":\"2015-09-11-05:00\",\"force\":\"false\",\"perm\":{\"type\":\"org.osaaf.myns.mytype\",\"instance\":\"myInstance\",\"action\":\"myAction\"}" + ",\"role\":\"org.osaaf.myns.myrole\"}"); @@ -74,8 +74,8 @@ public class JU_JSON { go(jin,jout, "{\"meth\":\"GET\",\"path\":\"/authz/perms/:type\",\"desc\":\"GetPermsByType\",\"comments\":[\"List All Permissions that match :type listed\"]," + "\"contentType\":[\"application/Permissions+json;q=1.0;charset=utf-8;version=1.1,application/json;q=1.0;version=1.1\"" + ",\"application/Perms+xml;q=1.0;charset=utf-8;version=2.0,text/xml;q=1.0;version=2.0\",\"application/Perms+json;q=1.0;charset=utf-8;version=2.0,application/json;q=1.0;version=2.0,*/*;q=1.0\"" - + ",\"application/Permissions+xml;q=1.0;charset=utf-8;version=1.1,text/xml;q=1.0;version=1.1\"]}"); - + + ",\"application/Permissions+xml;q=1.0;charset=utf-8;version=1.1,text/xml;q=1.0;version=1.1\"]}"); + // Test a Windoze "Pretty Print", validate skipping of Windoze characters as well as other odd control characters listed // in json.org @@ -87,8 +87,8 @@ public class JU_JSON { ),sw,jin); Assert.assertEquals("{\"id\":\"Me, \b\f\n\r\tMyself\",\"date\":1353094689100}",sw.toString()); System.out.println(sw.toString()); - - // 10/01/2015 Jonathan AAF-703 Ron Gallagher, this response is ok + + // 10/01/2015 Jonathan AAF-703 Ron Gallagher, this response is ok go(jin,jout, "{\"perm\":[{\"type\":\"org.osaaf.myns.myPerm\",\"action\":\"myAction\",\"description\":\"something\"}]}"); // but when description:"" causes extra comma at end go(jin,jout, "{\"perm\":[{\"type\":\"org.osaaf.myns.myPerm\",\"action\":\"myAction\",\"description\":\"\"}]}","{\"perm\":[{\"type\":\"org.osaaf.myns.myPerm\",\"action\":\"myAction\"}]}"); @@ -96,33 +96,33 @@ public class JU_JSON { go(jin,jout, "{\"perm\":[{\"type\":\"\",\"action\":\"\",\"description\":\"\"}]}","{\"perm\":[{}]}"); go(jin,jout, "{\"perm\":[{\"type\":\"\",\"action\":\"\",\"description\":\"hi\"}]}","{\"perm\":[{\"description\":\"hi\"}]}"); go(jin,jout, "{\"perm\":[{\"type\":\"\",\"action\":\"myAction\",\"description\":\"\"}]}","{\"perm\":[{\"action\":\"myAction\"}]}"); - - + + go(jin,jout, "{\"perm\":[{\"type\":\"org.osaaf.myns.myPerm\",\"action\":,\"description\":\"something\"}]}","{\"perm\":[{\"type\":\"org.osaaf.myns.myPerm\",\"description\":\"something\"}]}"); - + go(jin, jout, "{\"name\":\"\\\"hello\\\"\"}"); - + go(jin, jout, "{\"name\":\"\\\\\"}"); go(jin, jout, "{\"role\":\"org.osaaf.scamper.UserStory0152 7_IT-00323-a-admin\",\"perm\":{\"type\":\"org.osaaf.scamper.application\",\"instance\":\"_()`!@#\\\\$%^=+][{}<>/.-valid.app.name-is_good\",\"action\":\"Administrator\"}}"); - - + + } - - + + private void go(Parse<Reader,?> in, Out out, String str) throws IOException, ParseException { go(in,out,str,str); } private void go(Parse<Reader, ?> in, Out out, String str, String cmp) throws IOException, ParseException { - + System.out.println(str); StringWriter sw = new StringWriter(1024); out.extract(new StringReader(str), sw, in); System.out.println(sw); String result = sw.toString(); - + if (!result.equals(cmp)) { sw.getBuffer().setLength(0); new OutRaw().extract(new StringReader(str), sw, in); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java index fd6142b1..335d87ad 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Ladder.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,7 +31,7 @@ public class JU_Ladder { @Test public void test() { Ladder<String> ladder = new Ladder<String>(); - + for (int i=0;i<30;++i) { for (int j=0;j<i;++j)ladder.ascend(); String str = "Rung " + i; @@ -43,10 +43,10 @@ public class JU_Ladder { for (int j=0;j<i;++j)ladder.descend(); } assertEquals(ladder.height(),32); // Sizing, when naturally created is by 8 - + ladder.cutTo(8); - assertEquals(ladder.height(),8); - + assertEquals(ladder.height(),8); + for (int i=0;i<30;++i) { ladder.jumpTo(i); String str = "Rung " + i; @@ -56,16 +56,16 @@ public class JU_Ladder { } ladder.bottom(); - + for (int i=0;i<30;++i) { assertEquals("Rung " + i,ladder.peek()); ladder.ascend(); } - + ladder.bottom(); ladder.top(); assertEquals("Rung 29",ladder.peek()); - + for (int i=0;i<30;++i) { ladder.jumpTo(i); assertEquals("Rung " + i,ladder.peek()); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Nulls.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Nulls.java index a1e94c51..2cb8a177 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Nulls.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Nulls.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -58,13 +58,13 @@ public class JU_Nulls { data.load(urr); System.out.println(data.asString()); Assert.assertEquals("{\"SampleData\":[{\"date\":1444125487798}]}", data.asString()); - + System.out.println(data.out(Data.TYPE.RAW).asString()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } - + } } diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java index ccc29317..287c2563 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_RosettaDF.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -78,16 +78,16 @@ public class JU_RosettaDF { tt.done(); } sbw.append('\n'); - + tt = trans.start("To XML from Cache",4); try { data.out(Data.TYPE.XML).to(sbw); } finally { tt.done(); } - + sbw.append('\n'); - + tt = trans.start("To JSON from Cache",5); try { data.out(Data.TYPE.JSON).to(sbw); @@ -96,10 +96,10 @@ public class JU_RosettaDF { } report.glean(trans, 1,2,3,4,5); } while (report.go()); - + report.report(sbw); System.out.println(sbw); - + } @Test @@ -118,12 +118,12 @@ public class JU_RosettaDF { data.direct(new StringReader(JU_FromJSON.str), sbw); report.glean(trans); } while (report.go()); - + report.report(sbw); System.out.println(sbw); - + } - + @Test public void testMulti() throws Exception { RosettaEnv env = new RosettaEnv(); @@ -135,10 +135,10 @@ public class JU_RosettaDF { Multi m = new Multi(); m.getF1().add("String1"); m.getF2().add("String2"); - + System.out.println(df.newData().load(m).out(TYPE.RAW).asString()); System.out.println(df.newData().load(m).out(TYPE.JSON).asString()); - + } @Test @@ -154,7 +154,7 @@ public class JU_RosettaDF { Assert.assertEquals( "{\"id\":\"\\\"AT&T Services, Inc.\\\"\",\"date\":0}", out); - + SampleData sd2 = df.newData().in(TYPE.JSON).load(out).asObject(); System.out.println(sd2.getId()); Assert.assertEquals(sd.getId(),sd2.getId()); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java index a0847f4c..43a202f5 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Saved.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -47,11 +47,11 @@ public class JU_Saved<b> { JaxInfo ji = JaxInfo.build(LargerData.class); OutXML xml = new OutXML(ji);; OutJson json = new OutJson(); - + Saved saved = new Saved(); - + StringBuilderWriter sbw = new StringBuilderWriter(1024); - + Trans trans; Report report = new Report(ITERATIONS,"Save","Dump","XML ","JSON"); do { @@ -67,7 +67,7 @@ public class JU_Saved<b> { // sbw.append("==== Start Direct Raw =====\n"); // new OutRaw().extract(new StringReader(JU_FromJSON.str), sbw, inJSON); -// +// // sbw.append("==== Start Raw from Saved =====\n"); // new OutRaw().extract(null,sbw,saved); @@ -78,7 +78,7 @@ public class JU_Saved<b> { } finally { tt.done(); } - + sbw.append("\n==== Start XML =====\n"); tt = trans.start("XML", 3); try { @@ -86,7 +86,7 @@ public class JU_Saved<b> { } finally { tt.done(); } - + sbw.append("\n==== Start JSON =====\n"); tt = trans.start("JSON", 4); try { @@ -96,7 +96,7 @@ public class JU_Saved<b> { } report.glean(trans,1,2,3,4); } while (report.go()); - + report.report(sbw); System.out.println(sbw.toString()); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Stream2Obj.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Stream2Obj.java index b0fc29a2..a3c4f181 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Stream2Obj.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Stream2Obj.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -57,7 +57,7 @@ public class JU_Stream2Obj { <value>value_2</value> </base> </root> - + {"base":[{"__extension":"derivedA","name":"myDerivedA_1","num":1432,"shortName":"mda_1","value":["value_1","value_2"]}]} */ @@ -69,7 +69,7 @@ public class JU_Stream2Obj { da.setShortName("mda_1"); da.getValue().add("value_1"); da.getValue().add("value_2"); - + Root root = new Root(); root.getBase().add(da); @@ -80,10 +80,10 @@ public class JU_Stream2Obj { da.getValue().add("value_2.1"); da.getValue().add("value_2.2"); root.getBase().add(da); - + EnvJAXB env = new BasicEnv(); DataFactory<Root> rootDF = env.newDataFactory(Root.class); - + String xml = rootDF.newData(env).out(Data.TYPE.XML).load(root).option(Data.PRETTY).asString(); System.out.println(xml); @@ -95,21 +95,21 @@ public class JU_Stream2Obj { out.extract(new StringReader(xml), sw, in); System.out.println(sw.toString()); - + out = new OutJson(); sw = new StringWriter(); out.extract(new StringReader(xml), sw, in); String json; System.out.println(json = sw.toString()); - + in = new InJson(); out = new OutRaw(); sw = new StringWriter(); out.extract(new StringReader(json), sw, in); System.out.println(sw.toString()); - + out = new OutXML(inXML); sw = new StringWriter(); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java index 40c41596..1a366fa0 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Struct.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -42,7 +42,7 @@ public class JU_Struct { "</SampleData>\n" + "<fluff>MyFluff</fluff>\n" + "</LargerData>\n"; - + // @Test // public void test2() throws Exception { // @@ -50,20 +50,20 @@ public class JU_Struct { // sd.setDate(new Date().getTime()); // sd.setId("myId"); // sd.getItem().add("Item 1.1"); -// +// // InObj<SampleData> inObj = new InObj<SampleData>(SampleData.class); // // JaxSet<SampleData> jaxSet = JaxSet.get(SampleData.class); // Setter<SampleData> setter = jaxSet.setter("id"); // setter.set(sd, "Your ID"); -// +// // for (Entry<String, Getter<SampleData>> es : jaxSet.getters()) { // System.out.print(es.getKey()); // System.out.print(' '); // System.out.println(es.getValue().get(sd)); // } // } - + @Test public void test() throws Exception { JaxInfo ji = JaxInfo.build(LargerData.class); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java index 2aca5f52..550e2566 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/JU_Types.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -55,18 +55,18 @@ public class JU_Types { public void single() throws Exception { Single single = setSData(); SingleMarshal psingle = new SingleMarshal(); - + OutRaw raw = new OutRaw(); OutJson json = new OutJson(); OutXML xml = new OutXML("Single","xmlns=urn:types:xsd"); - - + + System.out.println("===== RAW ====="); raw.extract(single, System.out, psingle); System.out.println("\n===== JSON ====="); json.extract(single, System.out, psingle); - + System.out.println("\n\n===== Pretty JSON ====="); json.extract(single, System.out, psingle, true); @@ -92,7 +92,7 @@ public class JU_Types { // xml.extract(single, sw, psingle, true); news = jumar.unmarshal(env.info(), sw.toString()); System.out.println(sw.toString()); - + String sample = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "\n<ns2:urn.types.xsd xmlns:ns2=\"Single\" xmlns=\"urn:types:xsd\">" + "\n<str>MyString</str>" @@ -110,7 +110,7 @@ public class JU_Types { System.out.println(news.getDatetime()); } - + @Test public void multi() throws Exception { OutRaw raw = new OutRaw(); @@ -119,7 +119,7 @@ public class JU_Types { Multi multi = new Multi(); MultiMarshal pmulti = new MultiMarshal(); - + for (int i=0;i<10;++i) { System.out.println("===== Multi Iteration " + i + " ====="); if (i>0) { @@ -127,16 +127,16 @@ public class JU_Types { } System.out.println(" ===== RAW ====="); raw.extract(multi, System.out, pmulti); - + System.out.println("\n ===== JSON ====="); json.extract(multi, System.out, pmulti); - + System.out.println("\n\n ===== Pretty JSON ====="); json.extract(multi, System.out, pmulti, true); - + System.out.println("\n\n ===== XML ====="); xml.extract(multi, System.out, pmulti,false); - + System.out.println("\n\n ===== Pretty XML ====="); xml.extract(multi, System.out, pmulti, true); } @@ -150,7 +150,7 @@ public class JU_Types { Multi multi = new Multi(); DocMarshal<Multi> doc = DocMarshal.root(new MultiMarshal()); - + for (int i=0;i<3;++i) { System.out.println("===== Multi Iteration " + i + " ====="); if (i>0) { @@ -158,16 +158,16 @@ public class JU_Types { } System.out.println(" ===== RAW ====="); raw.extract(multi, System.out, doc); - + System.out.println("\n ===== JSON ====="); json.extract(multi, System.out, doc); - + System.out.println("\n\n ===== Pretty JSON ====="); json.extract(multi, System.out, doc, true); - + System.out.println("\n\n ===== XML ====="); xml.extract(multi, System.out, doc,false); - + System.out.println("\n\n ===== Pretty XML ====="); xml.extract(multi, System.out, doc, true); } @@ -179,16 +179,16 @@ public class JU_Types { // Saved saved = new Saved(); // saved.extract(in, ignore, parser, options); // } - + @Test public void df() throws Exception { RosettaEnv env = new RosettaEnv(); RosettaDF<Multi> df = env.newDataFactory(Multi.class); df.out(TYPE.JSON).option(Data.PRETTY); - + Multi multi = new Multi(); multi.getSingle().add(setSData()); - + System.out.println("========== Original loading"); Trans trans = env.newTrans(); @@ -199,7 +199,7 @@ public class JU_Types { } trans = env.newTrans(); data = df.newData(trans); - + int iters = 10000; for (int i=0;i<iters;++i) { data.load(multi); @@ -220,14 +220,14 @@ public class JU_Types { } trans = env.newTrans(); data = df.newData(trans); - + for (int i=0;i<iters;++i) { data.load(multi); } metrics = trans.auditTrail(0, null,Env.JSON,Env.XML); System.out.println(data.asString()); System.out.println(metrics.total/iters + "ms avg"); - + // Assert.assertEquals(first, second); System.out.println("========== Direct Object to JSON String"); @@ -246,13 +246,13 @@ public class JU_Types { sbw.reset(); data.direct(multi, sbw, true); } - + metrics = trans.auditTrail(0, null,Env.JSON,Env.XML); System.out.println(sbw.toString()); System.out.println(metrics.total/iters + "ms avg"); - + } - + private Single setSData() { Single s = new Single(); s.setStr("MyString"); @@ -274,19 +274,19 @@ public class JU_Types { // Out jout = new OutJson(); // //// go(jin, jout, "{\"id\":\"Me, Myself\",\"date\":1353094689100}"); -// +// // } - - + + /* private void go(Parse<Reader,?> in, Out out, String str) throws IOException, ParseException { - + System.out.println(str); StringWriter sw = new StringWriter(1024); out.extract(new StringReader(str), sw, in); System.out.println(sw); String result = sw.toString(); - + if (!result.equals(str)) { sw.getBuffer().setLength(0); new OutRaw().extract(new StringReader(str), sw, in); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java index 7e230822..e5035dbf 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/OutDump.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,7 +37,7 @@ public class OutDump extends Out{ IndentPrintWriter ipw = writer instanceof IndentPrintWriter?(IndentPrintWriter)writer:new IndentPrintWriter(writer); Parsed<S> p = prs.newParsed(); - + while ((p = prs.parse(in,p.reuse())).valid()) { switch(p.event) { case Parse.START_OBJ: @@ -45,7 +45,7 @@ public class OutDump extends Out{ ipw.append(p.name); ipw.inc(); break; - case Parse.END_OBJ: + case Parse.END_OBJ: printData(ipw,p); ipw.dec(); ipw.append("End Object "); @@ -57,7 +57,7 @@ public class OutDump extends Out{ ipw.append(p.name); ipw.append('\n'); break; - case Parse.END_ARRAY: + case Parse.END_ARRAY: printData(ipw,p); ipw.dec(); ipw.append("End Array "); @@ -69,13 +69,13 @@ public class OutDump extends Out{ } } } - + private void printData(IndentPrintWriter ipw, Parsed<?> parsed) { if (parsed.hasData()) { ipw.append("Data:["); if (parsed.hasName()) { ipw.append(parsed.name); - ipw.append(" : "); + ipw.append(" : "); } ipw.append(parsed.sb); ipw.append("]"); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java index acb33010..dc07ae63 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/Report.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,7 +33,7 @@ public class Report { String[] names; private int iterations; private int count; - + public Report(int iters, String ... names) { iterations = iters; buckets = new float[names.length]; @@ -41,7 +41,7 @@ public class Report { total=0; count = 0; } - + public void glean(Trans trans, int ... type) { Metric m = trans.auditTrail(0, null, type); total+=m.total; @@ -50,12 +50,12 @@ public class Report { buckets[b]+=m.buckets[b]; } } - + public boolean go() { return ++count<iterations; } - - + + public void report(Writer sbw) throws IOException { sbw.append("\n"+count + " entries, Total Time: " + total + "ms, Avg Time: " + total/count + "ms\n"); int min = Math.min(buckets.length, names.length); diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/MultiMarshal.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/MultiMarshal.java index b28ca766..3c8433ec 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/MultiMarshal.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/MultiMarshal.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/SingleMarshal.java b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/SingleMarshal.java index bde91c9e..ddbeb6cf 100644 --- a/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/SingleMarshal.java +++ b/misc/rosetta/src/test/java/org/onap/aaf/misc/rosetta/test/obj/SingleMarshal.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -44,14 +44,14 @@ public class SingleMarshal extends ObjMarshal<Single> { return t.getStr(); } }); - + add(new FieldNumeric<Integer, Single>("int") { @Override protected Integer data(Single t) { return t.getInt(); } }); - + add(new FieldNumeric<Long,Single>("long") { @Override protected Long data(Single t) { @@ -72,14 +72,14 @@ public class SingleMarshal extends ObjMarshal<Single> { return t.getDate(); } }); - + add(new FieldHexBinary<Single>("binary") { @Override protected byte[] data(Single t) { return t.getBinary(); } }); - + add(new FieldArray<Single,String>("array", DataWriter.STRING) { @Override protected List<String> data(Single t) { |