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 ++--- 12 files changed, 313 insertions(+), 305 deletions(-) (limited to 'misc/env') 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"}); -- cgit 1.2.3-korg