diff options
author | Rich Tabedzki <richard.tabedzki@att.com> | 2017-10-04 16:53:04 +0000 |
---|---|---|
committer | Rich Tabedzki <richard.tabedzki@att.com> | 2017-10-04 17:01:46 +0000 |
commit | e4037ffc232e37758db669402523bf4e24321e4d (patch) | |
tree | b5b6ec5adf9769b66fedaadf8b6708047e7a5e58 /aai-service/provider/src/test | |
parent | 73e10c782444301edd8e01092e75b90bf6576847 (diff) |
Improve CCSDK adaptors Sonar coverage
Changes made:
1. Cleaned up blocker issues
Change-Id: Ie0424ce7aeaf07ed8a521dc2bff21b66a28e051f
Issue-ID: CCSDK-108
Signed-off-by: Rich Tabedzki <richard.tabedzki@att.com>
Diffstat (limited to 'aai-service/provider/src/test')
-rwxr-xr-x | aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestTest.java | 141 |
1 files changed, 72 insertions, 69 deletions
diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestTest.java index 5a3d88ec..9d1f6a53 100755 --- a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestTest.java +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestTest.java @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,72 +39,75 @@ import org.slf4j.LoggerFactory; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class EchoRequestTest { - private static final Logger LOG = LoggerFactory.getLogger(EchoRequestTest.class); - - protected static AAIRequest request; - - @BeforeClass - public static void setUp() throws Exception { - request = new EchoRequest(); - LOG.info("\nEchoRequestTest.setUp\n"); - } - - @AfterClass - public static void tearDown() throws Exception { - request = null; - LOG.info("----------------------- EchoRequestTest.tearDown -----------------------"); - } - - @Test - public void runGetRequestUrlTest() { - LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------"); - - URL url; - try { - url = request.getRequestUrl("GET", null); - assertNotNull(url); - } catch (UnsupportedEncodingException | MalformedURLException exc) { - LOG.error("Failed test", exc); - } - - } - - @Test - public void runToJSONStringTest() { - LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------"); - - try { - String json = request.toJSONString(); - assertNotNull(json); - } catch (Exception exc) { - LOG.error("Failed test", exc); - } - - } - - @Test - public void runGetArgsListTest() { - LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------"); - - try { - String[] args = request.getArgsList(); - assertNotNull(args); - } catch (Exception exc) { - LOG.error("Failed test", exc); - } - - } - - @Test - public void runGetModelTest() { - LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------"); - - try { - Class<? extends AAIDatum> clazz = request.getModelClass(); - assertNotNull(clazz); - } catch (Exception exc) { - LOG.error("Failed test", exc); - } - - } + private static final Logger LOG = LoggerFactory.getLogger(EchoRequestTest.class); + + private static AAIRequest request; + private static AAIService aaiService; + + @BeforeClass + public static void setUp() throws Exception { + aaiService = new AAIService( + AAIService.class.getResource(AAIService.AAICLIENT_PROPERTIES)); + request = new EchoRequest(); + LOG.info("\nEchoRequestTest.setUp\n"); + } + + @AfterClass + public static void tearDown() throws Exception { + request = null; + LOG.info("----------------------- EchoRequestTest.tearDown -----------------------"); + } + + @Test + public void runGetRequestUrlTest() { + LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------"); + + URL url; + try { + url = request.getRequestUrl("GET", null); + assertNotNull(url); + } catch (UnsupportedEncodingException | MalformedURLException exc) { + LOG.error("Failed test", exc); + } + + } + + @Test + public void runToJSONStringTest() { + LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------"); + + try { + String json = request.toJSONString(); + assertNotNull(json); + } catch (Exception exc) { + LOG.error("Failed test", exc); + } + + } + + @Test + public void runGetArgsListTest() { + LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------"); + + try { + String[] args = request.getArgsList(); + assertNotNull(args); + } catch (Exception exc) { + LOG.error("Failed test", exc); + } + + } + + @Test + public void runGetModelTest() { + LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------"); + + try { + Class<? extends AAIDatum> clazz = request.getModelClass(); + assertNotNull(clazz); + } catch (Exception exc) { + LOG.error("Failed test", exc); + } + + } } |