X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-cmd%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fcmd%2Ftest%2Fns%2FJU_List.java;h=683db0b3edbfe0aa93c968331dd0ce125848dcd8;hb=1296352d8eafee57f982a4342ad79ada4aa56d28;hp=a6d2130fe31100fd7712e6fdd1630870df6f66aa;hpb=f85f0889b3b0e5e9694afab4dd01a4a97a155188;p=aaf%2Fauthz.git diff --git a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java index a6d2130f..683db0b3 100644 --- a/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java +++ b/auth/auth-cmd/src/test/java/org/onap/aaf/auth/cmd/test/ns/JU_List.java @@ -16,6 +16,7 @@ * limitations under the License. * ============LICENSE_END============================================ */ + package org.onap.aaf.auth.cmd.test.ns; import static org.junit.Assert.*; @@ -53,91 +54,91 @@ import static org.mockito.Mockito.*; import org.junit.Test; public class JU_List { - - List list; - AAFcli aafcli; - User user; - - private class NssStub extends Nss { - public void addNs(Nss.Ns ns) { - if (this.ns == null) { - this.ns = new ArrayList<>(); - } - this.ns.add(ns); - } - - private class NsStub extends Ns{ - public void addAttrib(Nss.Ns.Attrib attrib) { - if ( this.attrib == null) { - this.attrib = new ArrayList<>(); - } - this.attrib.add(attrib); - } - - public void addResponsible(String str) { - if (this.responsible == null) { - this.responsible = new ArrayList<>(); - } - this.responsible.add(str); - } - - public void addAdmin(String str) { - if (this.admin == null) { - this.admin = new ArrayList<>(); - } - this.admin.add(str); - } - } - - - - - } - - - @Before - public void setUp() throws APIException, LocatorException, CadiException { - PropAccess prop = new PropAccess(); - AuthzEnv aEnv = new AuthzEnv(); - Writer wtr = mock(Writer.class); - Locator loc = mock(Locator.class); - HMangr hman = new HMangr(aEnv, loc); - aafcli = new AAFcli(prop, aEnv, wtr, hman, null, null); - user = new User(); - NS ns = new NS(aafcli); - - list = new List(ns); - } - - @Test - public void testReport() throws Exception { - Future fu = mock(Future.class); - NssStub nssStub = new NssStub(); - NssStub.NsStub nsStub = nssStub.new NsStub(); - Nss.Ns.Attrib attrib = mock(Nss.Ns.Attrib.class); - when(attrib.getKey()).thenReturn("key"); - when(attrib.getValue()).thenReturn("value"); - nsStub.addAttrib(attrib); - nsStub.addResponsible("test"); - nsStub.addAdmin("admin"); - nssStub.addNs(nsStub); - fu.value = nssStub; - aafcli.eval("DETAILS @[ 123"); - - list.report(fu, "test"); - } - - @Test - public void testGetType() { - Assert.assertEquals("n/a", list.getType(user)); - user.setType(1); - Assert.assertEquals("U/P", list.getType(user)); - user.setType(2); - Assert.assertEquals("U/P2", list.getType(user)); - user.setType(10); - Assert.assertEquals("Cert", list.getType(user)); - user.setType(200); - Assert.assertEquals("x509", list.getType(user)); - } - + + List list; + AAFcli aafcli; + User user; + + private class NssStub extends Nss { + public void addNs(Nss.Ns ns) { + if (this.ns == null) { + this.ns = new ArrayList<>(); + } + this.ns.add(ns); + } + + private class NsStub extends Ns{ + public void addAttrib(Nss.Ns.Attrib attrib) { + if ( this.attrib == null) { + this.attrib = new ArrayList<>(); + } + this.attrib.add(attrib); + } + + public void addResponsible(String str) { + if (this.responsible == null) { + this.responsible = new ArrayList<>(); + } + this.responsible.add(str); + } + + public void addAdmin(String str) { + if (this.admin == null) { + this.admin = new ArrayList<>(); + } + this.admin.add(str); + } + } + + + + + } + + + @Before + public void setUp() throws APIException, LocatorException, CadiException { + PropAccess prop = new PropAccess(); + AuthzEnv aEnv = new AuthzEnv(); + Writer wtr = mock(Writer.class); + Locator loc = mock(Locator.class); + HMangr hman = new HMangr(aEnv, loc); + aafcli = new AAFcli(prop, aEnv, wtr, hman, null, null); + user = new User(); + NS ns = new NS(aafcli); + + list = new List(ns); + } + + @Test + public void testReport() throws Exception { + Future fu = mock(Future.class); + NssStub nssStub = new NssStub(); + NssStub.NsStub nsStub = nssStub.new NsStub(); + Nss.Ns.Attrib attrib = mock(Nss.Ns.Attrib.class); + when(attrib.getKey()).thenReturn("key"); + when(attrib.getValue()).thenReturn("value"); + nsStub.addAttrib(attrib); + nsStub.addResponsible("test"); + nsStub.addAdmin("admin"); + nssStub.addNs(nsStub); + fu.value = nssStub; + aafcli.eval("DETAILS @[ 123"); + + list.report(fu, "test"); + } + + @Test + public void testGetType() { + Assert.assertEquals("n/a", list.getType(user)); + user.setType(1); + Assert.assertEquals("U/P", list.getType(user)); + user.setType(2); + Assert.assertEquals("U/P2", list.getType(user)); + user.setType(10); + Assert.assertEquals("FQI", list.getType(user)); + user.setType(200); + Assert.assertEquals("x509", list.getType(user)); + } + }