From e4037ffc232e37758db669402523bf4e24321e4d Mon Sep 17 00:00:00 2001 From: Rich Tabedzki Date: Wed, 4 Oct 2017 16:53:04 +0000 Subject: Improve CCSDK adaptors Sonar coverage Changes made: 1. Cleaned up blocker issues Change-Id: Ie0424ce7aeaf07ed8a521dc2bff21b66a28e051f Issue-ID: CCSDK-108 Signed-off-by: Rich Tabedzki --- .../ccsdk/sli/adaptors/aai/EchoRequestTest.java | 141 +++++++++++---------- 1 file changed, 72 insertions(+), 69 deletions(-) (limited to 'aai-service/provider/src/test') 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 5a3d88ec4..9d1f6a530 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 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 clazz = request.getModelClass(); + assertNotNull(clazz); + } catch (Exception exc) { + LOG.error("Failed test", exc); + } + + } } -- cgit 1.2.3-korg