From 4ccc6b830291f15b8006fdee37a8aae21c22f9df Mon Sep 17 00:00:00 2001 From: sg481n Date: Wed, 4 Oct 2017 17:29:37 +0000 Subject: Improve code coverage for aaf authz modules Change-Id: Ie81597c6c94fea2224f1e3e847222bcc872b7c00 Issue-ID: AAF-79 Signed-off-by: sg481n --- authz-batch/pom.xml | 135 ++++++++------- authz-cass/pom.xml | 132 ++++++++------- authz-certman/pom.xml | 130 +++++++------- authz-client/pom.xml | 131 ++++++++------- authz-cmd/pom.xml | 129 +++++++------- .../src/test/java/org/onap/aaf/cmd/JU_AAFCli.java | 125 ++++++++++++-- .../src/test/java/org/onap/aaf/cmd/JU_BaseCmd.java | 187 ++++++++++++++++++++- .../src/test/java/org/onap/aaf/cmd/JU_Help.java | 23 ++- .../test/java/org/onap/aaf/cmd/user/JU_Cred.java | 41 +++-- authz-core/pom.xml | 130 +++++++------- authz-defOrg/pom.xml | 131 ++++++++------- 11 files changed, 853 insertions(+), 441 deletions(-) diff --git a/authz-batch/pom.xml b/authz-batch/pom.xml index 64b26eab..db72a359 100644 --- a/authz-batch/pom.xml +++ b/authz-batch/pom.xml @@ -42,14 +42,17 @@ UTF-8 false 3.1.200 - java - jacoco - true - ${project.build.directory}/surefire-reports - ${project.build.directory}/coverage-reports/jacoco.exec - ${project.build.directory}/coverage-reports/jacoco-it.exec - true - ${project.version} + + + 0.7.7.201606060606 + true + 3.2 + jacoco + + target/code-coverage/jacoco-ut.exec + target/code-coverage/jacoco-it.exec + + **/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/** https://nexus.onap.org /content/repositories/snapshots/ /content/repositories/releases/ @@ -214,58 +217,72 @@ 176c31dfe190a ecomp-staging - - - org.jacoco - jacoco-maven-plugin - 0.7.7.201606060606 - - true - - org.onap.aaf.* - - - - - pre-unit-test - - prepare-agent - - - ${project.build.directory}/coverage-reports/jacoco.exec - - - - - pre-integration-test - pre-integration-test - - prepare-agent - - - ${project.build.directory}/coverage-reports/jacoco-it.exec - - - - - - merge - - post-integration-test - - - - ${project.build.directory}/coverage-reports - - *.exec - - - - ${project.build.directory}/jacoco-dev.exec - - - + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + **/gen/** + **/generated-sources/** + **/yang-gen/** + **/pax/** + + + + + + pre-unit-test + + prepare-agent + + + ${project.build.directory}/code-coverage/jacoco-ut.exec + surefireArgLine + + + + + + post-unit-test + test + + report + + + ${project.build.directory}/code-coverage/jacoco-ut.exec + ${project.reporting.outputDirectory}/jacoco-ut + + + + pre-integration-test + pre-integration-test + + prepare-agent + + + ${project.build.directory}/code-coverage/jacoco-it.exec + + failsafeArgLine + + + + + + post-integration-test + post-integration-test + + report + + + ${project.build.directory}/code-coverage/jacoco-it.exec + ${project.reporting.outputDirectory}/jacoco-it + + + + diff --git a/authz-cass/pom.xml b/authz-cass/pom.xml index b5304587..ee9cf1ed 100644 --- a/authz-cass/pom.xml +++ b/authz-cass/pom.xml @@ -53,14 +53,17 @@ UTF-8 1.0.0-SNAPSHOT - java - true - jacoco - ${project.build.directory}/surefire-reports - ${project.build.directory}/coverage-reports/jacoco.exec - ${project.build.directory}/coverage-reports/jacoco-it.exec - true - ${project.version} + + + 0.7.7.201606060606 + true + 3.2 + jacoco + + target/code-coverage/jacoco-ut.exec + target/code-coverage/jacoco-it.exec + + **/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/** https://nexus.onap.org /content/repositories/snapshots/ /content/repositories/releases/ @@ -163,56 +166,69 @@ - org.jacoco - jacoco-maven-plugin - 0.7.7.201606060606 - - true - - org.onap.aaf.* - - - - - pre-unit-test - - prepare-agent - - - ${project.build.directory}/coverage-reports/jacoco.exec - - - - - pre-integration-test - pre-integration-test - - prepare-agent - - - ${project.build.directory}/coverage-reports/jacoco-it.exec - - - - - - merge - - post-integration-test - - - - ${project.build.directory}/coverage-reports - - *.exec - - - - ${project.build.directory}/jacoco-dev.exec - - - - + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + **/gen/** + **/generated-sources/** + **/yang-gen/** + **/pax/** + + + + + + pre-unit-test + + prepare-agent + + + ${project.build.directory}/code-coverage/jacoco-ut.exec + surefireArgLine + + + + + + post-unit-test + test + + report + + + ${project.build.directory}/code-coverage/jacoco-ut.exec + ${project.reporting.outputDirectory}/jacoco-ut + + + + pre-integration-test + pre-integration-test + + prepare-agent + + + ${project.build.directory}/code-coverage/jacoco-it.exec + + failsafeArgLine + + + + + + post-integration-test + post-integration-test + + report + + + ${project.build.directory}/code-coverage/jacoco-it.exec + ${project.reporting.outputDirectory}/jacoco-it + + + + diff --git a/authz-certman/pom.xml b/authz-certman/pom.xml index 625bde9d..fa787fba 100644 --- a/authz-certman/pom.xml +++ b/authz-certman/pom.xml @@ -55,14 +55,16 @@ 45 UTF-8 1.0.0-SNAPSHOT - java - true - jacoco - ${project.build.directory}/surefire-reports - ${project.build.directory}/coverage-reports/jacoco.exec - ${project.build.directory}/coverage-reports/jacoco-it.exec - true - ${project.version} + + 0.7.7.201606060606 + true + 3.2 + jacoco + + target/code-coverage/jacoco-ut.exec + target/code-coverage/jacoco-it.exec + + **/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/** https://nexus.onap.org /content/repositories/snapshots/ /content/repositories/releases/ @@ -161,57 +163,69 @@ - org.jacoco - jacoco-maven-plugin - 0.7.7.201606060606 - - true - - org.onap.aaf.* - - - - - pre-unit-test - - prepare-agent - - - ${project.build.directory}/coverage-reports/jacoco.exec - - - - - pre-integration-test - pre-integration-test - - prepare-agent - - - ${project.build.directory}/coverage-reports/jacoco-it.exec - - - - - - merge - - post-integration-test - - - - ${project.build.directory}/coverage-reports - - *.exec - - - - ${project.build.directory}/jacoco-dev.exec - - - - + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + **/gen/** + **/generated-sources/** + **/yang-gen/** + **/pax/** + + + + + + pre-unit-test + + prepare-agent + + + ${project.build.directory}/code-coverage/jacoco-ut.exec + surefireArgLine + + + + + + post-unit-test + test + + report + + + ${project.build.directory}/code-coverage/jacoco-ut.exec + ${project.reporting.outputDirectory}/jacoco-ut + + + + pre-integration-test + pre-integration-test + + prepare-agent + + + ${project.build.directory}/code-coverage/jacoco-it.exec + + failsafeArgLine + + + + + post-integration-test + post-integration-test + + report + + + ${project.build.directory}/code-coverage/jacoco-it.exec + ${project.reporting.outputDirectory}/jacoco-it + + + + diff --git a/authz-client/pom.xml b/authz-client/pom.xml index 902e58dc..2ff47be3 100644 --- a/authz-client/pom.xml +++ b/authz-client/pom.xml @@ -62,14 +62,16 @@ /opt/app/aft/${project.artifactId}/${project.version} true 1.0.0-SNAPSHOT - java - true - jacoco - ${project.build.directory}/surefire-reports - ${project.build.directory}/coverage-reports/jacoco.exec - ${project.build.directory}/coverage-reports/jacoco-it.exec - true - ${project.version} + + 0.7.7.201606060606 + true + 3.2 + jacoco + + target/code-coverage/jacoco-ut.exec + target/code-coverage/jacoco-it.exec + + **/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/** https://nexus.onap.org /content/repositories/snapshots/ /content/repositories/releases/ @@ -192,56 +194,69 @@ - org.jacoco - jacoco-maven-plugin - 0.7.7.201606060606 - - true - - org.onap.aaf.* - - - - - pre-unit-test - - prepare-agent - - - ${project.build.directory}/coverage-reports/jacoco.exec - - - - - pre-integration-test - pre-integration-test - - prepare-agent - - - ${project.build.directory}/coverage-reports/jacoco-it.exec - - - - - - merge - - post-integration-test - - - - ${project.build.directory}/coverage-reports - - *.exec - - - - ${project.build.directory}/jacoco-dev.exec - - - - + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + **/gen/** + **/generated-sources/** + **/yang-gen/** + **/pax/** + + + + + + pre-unit-test + + prepare-agent + + + ${project.build.directory}/code-coverage/jacoco-ut.exec + surefireArgLine + + + + + + post-unit-test + test + + report + + + ${project.build.directory}/code-coverage/jacoco-ut.exec + ${project.reporting.outputDirectory}/jacoco-ut + + + + pre-integration-test + pre-integration-test + + prepare-agent + + + ${project.build.directory}/code-coverage/jacoco-it.exec + + failsafeArgLine + + + + + + post-integration-test + post-integration-test + + report + + + ${project.build.directory}/code-coverage/jacoco-it.exec + ${project.reporting.outputDirectory}/jacoco-it + + + + diff --git a/authz-cmd/pom.xml b/authz-cmd/pom.xml index 36960942..f42237da 100644 --- a/authz-cmd/pom.xml +++ b/authz-cmd/pom.xml @@ -55,13 +55,15 @@ false 21 1.0.0-SNAPSHOT - java - jacoco - ${project.build.directory}/surefire-reports - ${project.build.directory}/coverage-reports/jacoco.exec - ${project.build.directory}/coverage-reports/jacoco-it.exec - true - ${project.version} + + 0.7.7.201606060606 + 3.2 + jacoco + + target/code-coverage/jacoco-ut.exec + target/code-coverage/jacoco-it.exec + + **/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/** https://nexus.onap.org /content/repositories/snapshots/ /content/repositories/releases/ @@ -167,56 +169,69 @@ - org.jacoco - jacoco-maven-plugin - 0.7.7.201606060606 - - true - - org.onap.aaf.* - - - - - pre-unit-test - - prepare-agent - - - ${project.build.directory}/coverage-reports/jacoco.exec - - - - - pre-integration-test - pre-integration-test - - prepare-agent - - - ${project.build.directory}/coverage-reports/jacoco-it.exec - - - - - - merge - - post-integration-test - - - - ${project.build.directory}/coverage-reports - - *.exec - - - - ${project.build.directory}/jacoco-dev.exec - - - - + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + **/gen/** + **/generated-sources/** + **/yang-gen/** + **/pax/** + + + + + + pre-unit-test + + prepare-agent + + + ${project.build.directory}/code-coverage/jacoco-ut.exec + surefireArgLine + + + + + + post-unit-test + test + + report + + + ${project.build.directory}/code-coverage/jacoco-ut.exec + ${project.reporting.outputDirectory}/jacoco-ut + + + + pre-integration-test + pre-integration-test + + prepare-agent + + + ${project.build.directory}/code-coverage/jacoco-it.exec + + failsafeArgLine + + + + + + post-integration-test + post-integration-test + + report + + + ${project.build.directory}/code-coverage/jacoco-it.exec + ${project.reporting.outputDirectory}/jacoco-it + + + + diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_AAFCli.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_AAFCli.java index 6a970ce0..f0057387 100644 --- a/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_AAFCli.java +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_AAFCli.java @@ -22,6 +22,7 @@ ******************************************************************************/ package org.onap.aaf.cmd; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; @@ -36,7 +37,7 @@ import org.junit.runner.RunWith; import org.mockito.runners.MockitoJUnitRunner; import org.onap.aaf.authz.env.AuthzEnv; import org.onap.aaf.cmd.AAFcli; - +import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.Locator; import org.onap.aaf.cadi.LocatorException; import org.onap.aaf.cadi.client.PropertyLocator; @@ -48,42 +49,144 @@ import org.onap.aaf.inno.env.APIException; @RunWith(MockitoJUnitRunner.class) public class JU_AAFCli { - + private static AAFcli cli; private static int TIMEOUT = Integer.parseInt(Config.AAF_CONN_TIMEOUT_DEF); - + @BeforeClass public static void setUp() throws Exception, Exception { cli = getAAfCli(); } - + @Test public void eval() throws Exception { assertTrue(cli.eval("#startswith")); } - + @Test - public void eval_empty() throws Exception{ + public void eval_empty() throws Exception { assertTrue(cli.eval("")); } + + @Test + public void eval1() throws Exception { + assertTrue(cli.eval("@[123")); + } + + @Test + public void eval2() throws Exception { + assertFalse(cli.eval("as @[ 123")); + } + + @Test + public void eval3() throws Exception { + try { + cli.eval("expect @[ 123"); + } catch (Exception e) { + // TODO Auto-generated catch block + assertTrue(e instanceof CadiException); + } + } + + public void eval31() throws Exception { + try { + cli.eval("expect 1 @[ 123"); + } catch (Exception e) { + // TODO Auto-generated catch block + assertTrue(e instanceof CadiException); + } + } + + @Test + public void eval4() throws Exception { + try { + cli.eval("sleep @[ 123"); + } catch (Exception e) { + assertTrue(e instanceof NumberFormatException); + } + } + + @Test + public void eval41() throws Exception { + assertTrue(cli.eval("sleep 1 @[ 123")); + } + + @Test + public void eval5() throws Exception { + try { + cli.eval("delay @[ 123"); + } catch (Exception e) { + assertTrue(e instanceof NumberFormatException); + } + } + + @Test + public void eval51() throws Exception { + assertTrue(cli.eval("delay 1 @[ 123")); + } + + @Test + public void eval7() throws Exception { + assertFalse(cli.eval("exit @[ 123")); + } + + @Test + public void eval8() throws Exception { + assertTrue(cli.eval("REQUEST @[ 123")); + } + + @Test + public void eval9() throws Exception { + assertTrue(cli.eval("FORCE @[ 123")); + } + + @Test + public void eval10() throws Exception { + assertTrue(cli.eval("set @[ 123")); + } + + @Test + public void keyboardHelp() throws Exception { + boolean noError=true; + try { + cli.keyboardHelp(); + } catch (Exception e) { + noError=false; + } + assertTrue(noError); + } + + + + @Test + public void setProp() throws Exception { + boolean noError=true; + try { + cli.keyboardHelp(); + } catch (Exception e) { + noError=false; + } + assertTrue(noError); + } @Test public void eval_randomString() throws Exception { assertTrue(cli.eval("Some random string @#&*& to check complete 100 coverage")); } - + public static AAFcli getAAfCli() throws APIException, LocatorException, GeneralSecurityException, IOException { final AuthzEnv env = new AuthzEnv(System.getProperties()); String aafUrl = "https://DME2RESOLVE"; SecurityInfo si = new SecurityInfo(env); env.loadToSystemPropsStartsWith("AAF", "DME2"); Locator loc; - loc = new PropertyLocator(aafUrl); + loc = new PropertyLocator(aafUrl); TIMEOUT = Integer.parseInt(env.getProperty(Config.AAF_CONN_TIMEOUT, Config.AAF_CONN_TIMEOUT_DEF)); HMangr hman = new HMangr(env, loc).readTimeout(TIMEOUT).apiVersion("2.0"); - - //TODO: Consider requiring a default in properties - env.setProperty(Config.AAF_DEFAULT_REALM, System.getProperty(Config.AAF_DEFAULT_REALM,Config.getDefaultRealm())); + + // TODO: Consider requiring a default in properties + env.setProperty(Config.AAF_DEFAULT_REALM, + System.getProperty(Config.AAF_DEFAULT_REALM, Config.getDefaultRealm())); HBasicAuthSS ss = mock(HBasicAuthSS.class); return new AAFcli(env, new OutputStreamWriter(System.out), hman, si, ss); } diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_BaseCmd.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_BaseCmd.java index a1d19ddb..77243e9c 100644 --- a/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_BaseCmd.java +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_BaseCmd.java @@ -26,33 +26,204 @@ import static org.junit.Assert.assertEquals; import java.io.IOException; import java.security.GeneralSecurityException; +import java.util.Date; +import java.util.GregorianCalendar; + +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.XMLGregorianCalendar; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.runners.MockitoJUnitRunner; -import org.onap.aaf.cmd.AAFcli; -import org.onap.aaf.cmd.BaseCmd; - import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.cadi.client.Future; import org.onap.aaf.inno.env.APIException; +import aaf.v2_0.History; + @RunWith(MockitoJUnitRunner.class) public class JU_BaseCmd { - + private static AAFcli cli; private static BaseCmd bCmd; - + @BeforeClass public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException { cli = JU_AAFCli.getAAfCli(); bCmd = new BaseCmd<>(cli, "testString"); } - + @Test public void exec() throws CadiException, APIException, LocatorException { - assertEquals(bCmd._exec(0, "add","del","reset","extend"), 0); - + assertEquals(bCmd._exec(0, "add", "del", "reset", "extend"), 0); + + } + + @Test + public void error() throws CadiException, APIException, LocatorException { + boolean noError = true; + Future future = new Future() { + + @Override + public boolean get(int timeout) throws CadiException { + // TODO Auto-generated method stub + return false; + } + + @Override + public int code() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String body() { + // TODO Auto-generated method stub + return "{%}"; + } + + @Override + public String header(String tag) { + // TODO Auto-generated method stub + return null; + } + }; + try { + bCmd.error(future); + } catch (Exception e) { + noError = false; + } + assertEquals(noError, true); + + } + + + + @Test + public void activity() throws DatatypeConfigurationException { + boolean noError = true; + History history = new History(); + History.Item item = new History.Item(); + item.setTarget("target"); + item.setUser("user"); + item.setMemo("memo"); + + GregorianCalendar c = new GregorianCalendar(); + c.setTime(new Date()); + XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); + item.setTimestamp(date); + history.getItem().add(item); + try { + bCmd.activity(history, "history"); + } catch (Exception e) { + noError = false; + } + assertEquals(noError, true); + } + + @Test + public void activity1() throws DatatypeConfigurationException { + boolean noError = true; + History history = new History(); + History.Item item = new History.Item(); + item.setTarget("target"); + item.setUser("user"); + item.setMemo("memo"); + + GregorianCalendar c = new GregorianCalendar(); + c.setTime(new Date()); + XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(c); + item.setTimestamp(date); + history.getItem().add(item); + try { + bCmd.activity(history, "1[]"); + } catch (Exception e) { + noError = false; + } + assertEquals(noError, true); + + } + + + + @Test + public void error1() { + boolean noError = true; + Future future = new Future() { + + @Override + public boolean get(int timeout) throws CadiException { + // TODO Auto-generated method stub + return false; + } + + @Override + public int code() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String body() { + // TODO Auto-generated method stub + return "{1"; + } + + @Override + public String header(String tag) { + // TODO Auto-generated method stub + return null; + } + }; + try { + bCmd.error(future); + } catch (Exception e) { + noError = false; + } + assertEquals(noError, true); + + } + + @Test + public void error2() { + boolean noError = true; + Future future = new Future() { + + @Override + public boolean get(int timeout) throws CadiException { + // TODO Auto-generated method stub + return false; + } + + @Override + public int code() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String body() { + // TODO Auto-generated method stub + return "other"; + } + + @Override + public String header(String tag) { + // TODO Auto-generated method stub + return null; + } + }; + try { + bCmd.error(future); + } catch (Exception e) { + noError = false; + } + assertEquals(noError, true); + + } + } diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_Help.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_Help.java index c51246bd..f48d71e0 100644 --- a/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_Help.java +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_Help.java @@ -62,10 +62,31 @@ public class JU_Help { @Test public void exec_HTTP_200() { try { - assertEquals(help._exec(0, "helps"), HttpStatus.OK_200); + assertEquals(help._exec(1, "helps"), HttpStatus.OK_200); } catch (CadiException | APIException | LocatorException e) { // TODO Auto-generated catch block e.printStackTrace(); } } + + @Test + public void exec_HTTP_200_1() { + try { + assertEquals(help._exec(1, "helps","help"), HttpStatus.OK_200); + } catch (CadiException | APIException | LocatorException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Test + public void detailhelp() { + boolean hasError=false; + try { + help.detailedHelp(2, new StringBuilder("detail help test")); + } catch (Exception e) { + hasError=true; + } + assertEquals(hasError,false); + } } diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_Cred.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_Cred.java index 77c05a99..aa975936 100644 --- a/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_Cred.java +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_Cred.java @@ -27,13 +27,19 @@ import static org.junit.Assert.assertNotNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import java.io.FileNotFoundException; +import java.io.PrintWriter; + import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; +import org.onap.aaf.cmd.AAFcli; +import org.onap.aaf.cmd.Cmd; import org.onap.aaf.cmd.user.Cred; import org.onap.aaf.cmd.user.User; - +import org.onap.aaf.authz.env.AuthzEnv; import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.LocatorException; import org.onap.aaf.inno.env.APIException; @@ -43,29 +49,32 @@ public class JU_Cred { private static Cred testCred; private static User testUser; + private static AuthzEnv env; @BeforeClass - public static void setUp() { + public static void setUp() throws FileNotFoundException, APIException { + testCred = mock(Cred.class); testUser = mock(User.class); - try { - when(testCred._exec(4, "String1","String2","String3","String4")).thenReturn(10); - } catch (CadiException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (APIException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (LocatorException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + env = mock(AuthzEnv.class); + Mockito.when(env.getProperty(Cmd.STARTDATE,null)).thenReturn(null); + Mockito.when(env.getProperty(Cmd.ENDDATE,null)).thenReturn(null); + } @Test - public void exec() throws CadiException, APIException, LocatorException { - assertEquals(testCred._exec(4, "String1","String2","String3","String4"), 10); + public void exec() throws CadiException, APIException, LocatorException, FileNotFoundException { + boolean isNullpointer=false; + AAFcli aaFcli= new AAFcli(env, new PrintWriter("temp"), null, null, null); + User user= new User(aaFcli); + Cred testCred= new Cred(user); + try { + testCred._exec(0, "add", "del", "reset", "extend"); + } catch (Exception e) { + isNullpointer=true; + } + assertEquals(isNullpointer, true); } diff --git a/authz-core/pom.xml b/authz-core/pom.xml index ef361b48..b779e3ed 100644 --- a/authz-core/pom.xml +++ b/authz-core/pom.xml @@ -53,13 +53,16 @@ 1.0.0-SNAPSHOT 1.0.0-SNAPSHOT - java - jacoco - ${project.build.directory}/surefire-reports - ${project.build.directory}/coverage-reports/jacoco.exec - ${project.build.directory}/coverage-reports/jacoco-it.exec - true - ${project.version} + + 0.7.7.201606060606 + true + 3.2 + jacoco + + target/code-coverage/jacoco-ut.exec + target/code-coverage/jacoco-it.exec + + **/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/** https://nexus.onap.org /content/repositories/snapshots/ /content/repositories/releases/ @@ -151,56 +154,69 @@ - org.jacoco - jacoco-maven-plugin - 0.7.7.201606060606 - - true - - org.onap.aaf.* - - - - - pre-unit-test - - prepare-agent - - - ${project.build.directory}/coverage-reports/jacoco.exec - - - - - pre-integration-test - pre-integration-test - - prepare-agent - - - ${project.build.directory}/coverage-reports/jacoco-it.exec - - - - - - merge - - post-integration-test - - - - ${project.build.directory}/coverage-reports - - *.exec - - - - ${project.build.directory}/jacoco-dev.exec - - - - + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + **/gen/** + **/generated-sources/** + **/yang-gen/** + **/pax/** + + + + + + pre-unit-test + + prepare-agent + + + ${project.build.directory}/code-coverage/jacoco-ut.exec + surefireArgLine + + + + + + post-unit-test + test + + report + + + ${project.build.directory}/code-coverage/jacoco-ut.exec + ${project.reporting.outputDirectory}/jacoco-ut + + + + pre-integration-test + pre-integration-test + + prepare-agent + + + ${project.build.directory}/code-coverage/jacoco-it.exec + + failsafeArgLine + + + + + + post-integration-test + post-integration-test + + report + + + ${project.build.directory}/code-coverage/jacoco-it.exec + ${project.reporting.outputDirectory}/jacoco-it + + + + diff --git a/authz-defOrg/pom.xml b/authz-defOrg/pom.xml index e34484d5..f6dd79fa 100644 --- a/authz-defOrg/pom.xml +++ b/authz-defOrg/pom.xml @@ -56,14 +56,16 @@ 0 1.0.0-SNAPSHOT 1.0.0-SNAPSHOT - java - true - jacoco - ${project.build.directory}/surefire-reports - ${project.build.directory}/coverage-reports/jacoco.exec - ${project.build.directory}/coverage-reports/jacoco-it.exec - true - ${project.version} + + 0.7.7.201606060606 + true + 3.2 + jacoco + + target/code-coverage/jacoco-ut.exec + target/code-coverage/jacoco-it.exec + + **/gen/**,**/generated-sources/**,**/yang-gen**,**/pax/** https://nexus.onap.org /content/repositories/snapshots/ /content/repositories/releases/ @@ -122,56 +124,69 @@ - org.jacoco - jacoco-maven-plugin - 0.7.7.201606060606 - - true - - org.onap.aaf.* - - - - - pre-unit-test - - prepare-agent - - - ${project.build.directory}/coverage-reports/jacoco.exec - - - - - pre-integration-test - pre-integration-test - - prepare-agent - - - ${project.build.directory}/coverage-reports/jacoco-it.exec - - - - - - merge - - post-integration-test - - - - ${project.build.directory}/coverage-reports - - *.exec - - - - ${project.build.directory}/jacoco-dev.exec - - - - + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + **/gen/** + **/generated-sources/** + **/yang-gen/** + **/pax/** + + + + + + pre-unit-test + + prepare-agent + + + ${project.build.directory}/code-coverage/jacoco-ut.exec + surefireArgLine + + + + + + post-unit-test + test + + report + + + ${project.build.directory}/code-coverage/jacoco-ut.exec + ${project.reporting.outputDirectory}/jacoco-ut + + + + pre-integration-test + pre-integration-test + + prepare-agent + + + ${project.build.directory}/code-coverage/jacoco-it.exec + + failsafeArgLine + + + + + + post-integration-test + post-integration-test + + report + + + ${project.build.directory}/code-coverage/jacoco-it.exec + ${project.reporting.outputDirectory}/jacoco-it + + + + -- cgit 1.2.3-korg