From bd890c575163e4d87ac24198b9c68a39cf4bbc4d Mon Sep 17 00:00:00 2001 From: sg481n Date: Mon, 28 Aug 2017 12:11:35 -0400 Subject: Update project structure to org.onap.aaf Update project structure of authz module in aaf from com.att to org.onap.aaf and add distribution management and repositories. Issue-id: AAF-21 Change-Id: Ia2486954e99f2bd60f18122ed60d32d5590781e9 Signed-off-by: sg481n --- .../src/test/java/org/onap/aaf/cmd/JU_AAFCli.java | 90 ++++++++++++++++ .../src/test/java/org/onap/aaf/cmd/JU_BaseCmd.java | 58 +++++++++++ .../test/java/org/onap/aaf/cmd/JU_BasicAuth.java | 49 +++++++++ .../src/test/java/org/onap/aaf/cmd/JU_Help.java | 71 +++++++++++++ .../src/test/java/org/onap/aaf/cmd/JU_Version.java | 59 +++++++++++ .../test/java/org/onap/aaf/cmd/mgmt/JU_Clear.java | 63 +++++++++++ .../test/java/org/onap/aaf/cmd/mgmt/JU_Log.java | 63 +++++++++++ .../java/org/onap/aaf/cmd/mgmt/JU_SessClear.java | 63 +++++++++++ .../test/java/org/onap/aaf/cmd/ns/JU_Admin.java | 72 +++++++++++++ .../test/java/org/onap/aaf/cmd/ns/JU_Attrib.java | 72 +++++++++++++ .../test/java/org/onap/aaf/cmd/ns/JU_Create.java | 72 +++++++++++++ .../test/java/org/onap/aaf/cmd/ns/JU_Delete.java | 73 +++++++++++++ .../test/java/org/onap/aaf/cmd/ns/JU_Describe.java | 73 +++++++++++++ .../java/org/onap/aaf/cmd/ns/JU_ListActivity.java | 70 +++++++++++++ .../onap/aaf/cmd/ns/JU_ListAdminResponsible.java | 70 +++++++++++++ .../java/org/onap/aaf/cmd/ns/JU_ListByName.java | 70 +++++++++++++ .../java/org/onap/aaf/cmd/ns/JU_ListChildren.java | 70 +++++++++++++ .../org/onap/aaf/cmd/ns/JU_ListNsKeysByAttrib.java | 70 +++++++++++++ .../org/onap/aaf/cmd/ns/JU_ListUsersInRole.java | 71 +++++++++++++ .../org/onap/aaf/cmd/ns/JU_ListUsersWithPerm.java | 71 +++++++++++++ .../java/org/onap/aaf/cmd/ns/JU_Responsible.java | 67 ++++++++++++ .../test/java/org/onap/aaf/cmd/perm/JU_Create.java | 69 ++++++++++++ .../test/java/org/onap/aaf/cmd/perm/JU_Delete.java | 69 ++++++++++++ .../java/org/onap/aaf/cmd/perm/JU_Describe.java | 69 ++++++++++++ .../test/java/org/onap/aaf/cmd/perm/JU_Grant.java | 69 ++++++++++++ .../org/onap/aaf/cmd/perm/JU_ListActivity.java | 71 +++++++++++++ .../java/org/onap/aaf/cmd/perm/JU_ListByNS.java | 71 +++++++++++++ .../java/org/onap/aaf/cmd/perm/JU_ListByName.java | 71 +++++++++++++ .../java/org/onap/aaf/cmd/perm/JU_ListByRole.java | 71 +++++++++++++ .../java/org/onap/aaf/cmd/perm/JU_ListByUser.java | 71 +++++++++++++ .../test/java/org/onap/aaf/cmd/perm/JU_Rename.java | 69 ++++++++++++ .../org/onap/aaf/cmd/role/JU_CreateDelete.java | 67 ++++++++++++ .../java/org/onap/aaf/cmd/role/JU_Describe.java | 67 ++++++++++++ .../org/onap/aaf/cmd/role/JU_ListActivity.java | 69 ++++++++++++ .../java/org/onap/aaf/cmd/role/JU_ListByNS.java | 69 ++++++++++++ .../org/onap/aaf/cmd/role/JU_ListByNameOnly.java | 69 ++++++++++++ .../java/org/onap/aaf/cmd/role/JU_ListByPerm.java | 69 ++++++++++++ .../java/org/onap/aaf/cmd/role/JU_ListByRole.java | 69 ++++++++++++ .../java/org/onap/aaf/cmd/role/JU_ListByUser.java | 69 ++++++++++++ .../test/java/org/onap/aaf/cmd/role/JU_User.java | 68 ++++++++++++ .../test/java/org/onap/aaf/cmd/user/JU_Cred.java | 116 +++++++++++++++++++++ .../test/java/org/onap/aaf/cmd/user/JU_Delg.java | 81 ++++++++++++++ .../org/onap/aaf/cmd/user/JU_ListActivity.java | 70 +++++++++++++ .../org/onap/aaf/cmd/user/JU_ListApprovals.java | 70 +++++++++++++ .../org/onap/aaf/cmd/user/JU_ListDelegates.java | 70 +++++++++++++ .../org/onap/aaf/cmd/user/JU_ListForCreds.java | 70 +++++++++++++ .../onap/aaf/cmd/user/JU_ListForPermission.java | 70 +++++++++++++ .../org/onap/aaf/cmd/user/JU_ListForRoles.java | 70 +++++++++++++ .../test/java/org/onap/aaf/cmd/user/JU_Role.java | 68 ++++++++++++ 49 files changed, 3438 insertions(+) create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/JU_AAFCli.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/JU_BaseCmd.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/JU_BasicAuth.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/JU_Help.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/JU_Version.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/mgmt/JU_Clear.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/mgmt/JU_Log.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/mgmt/JU_SessClear.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Admin.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Attrib.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Create.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Delete.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Describe.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListActivity.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListAdminResponsible.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListByName.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListChildren.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListNsKeysByAttrib.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListUsersInRole.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListUsersWithPerm.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Responsible.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Create.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Delete.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Describe.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Grant.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListActivity.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListByNS.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListByName.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListByRole.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListByUser.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Rename.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_CreateDelete.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_Describe.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListActivity.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByNS.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByNameOnly.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByPerm.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByRole.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByUser.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_User.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_Cred.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_Delg.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListActivity.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListApprovals.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListDelegates.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListForCreds.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListForPermission.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListForRoles.java create mode 100644 authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_Role.java (limited to 'authz-cmd/src/test') 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 new file mode 100644 index 00000000..6a970ce0 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_AAFCli.java @@ -0,0 +1,90 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; +import java.security.GeneralSecurityException; + +import org.junit.BeforeClass; +import org.junit.Test; +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.Locator; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.cadi.client.PropertyLocator; +import org.onap.aaf.cadi.config.Config; +import org.onap.aaf.cadi.config.SecurityInfo; +import org.onap.aaf.cadi.http.HBasicAuthSS; +import org.onap.aaf.cadi.http.HMangr; +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{ + assertTrue(cli.eval("")); + } + + @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); + 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())); + 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 new file mode 100644 index 00000000..a1d19ddb --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_BaseCmd.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.security.GeneralSecurityException; + +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.inno.env.APIException; + +@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); + + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_BasicAuth.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_BasicAuth.java new file mode 100644 index 00000000..07f008b6 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_BasicAuth.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.aaf.cmd.BasicAuth; + +@RunWith(MockitoJUnitRunner.class) +public class JU_BasicAuth { + + @Test + public void getID () { + try { + BasicAuth bAuth = new BasicAuth("testUser", "nopass"); + assertEquals(bAuth.getID(), "testUser"); + System.out.println(bAuth.getID()); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } +} 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 new file mode 100644 index 00000000..c51246bd --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_Help.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.security.GeneralSecurityException; +import java.util.ArrayList; +import java.util.List; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.aaf.cmd.AAFcli; +import org.onap.aaf.cmd.Cmd; +import org.onap.aaf.cmd.Help; + +import com.att.aft.dme2.internal.jetty.http.HttpStatus; +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Help { + + private static AAFcli cli; + private static Help help; + + @Mock + private static List cmds; + + @BeforeClass + public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException { + cli = JU_AAFCli.getAAfCli(); + cmds = new ArrayList<>(); + help = new Help(cli, cmds); + } + + @Test + public void exec_HTTP_200() { + try { + assertEquals(help._exec(0, "helps"), HttpStatus.OK_200); + } catch (CadiException | APIException | LocatorException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_Version.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_Version.java new file mode 100644 index 00000000..3bff61b7 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/JU_Version.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.security.GeneralSecurityException; + +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.Version; + +import com.att.aft.dme2.internal.jetty.http.HttpStatus; +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Version { + + private static AAFcli cli; + private static Version version; + + @BeforeClass + public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException { + cli = JU_AAFCli.getAAfCli(); + version = new Version(cli); + } + + @Test + public void exec_HTTP_200() throws CadiException, APIException, LocatorException { + assertEquals(version._exec(0, "Version"), HttpStatus.OK_200); + + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/mgmt/JU_Clear.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/mgmt/JU_Clear.java new file mode 100644 index 00000000..99a2c317 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/mgmt/JU_Clear.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.mgmt; + +import static org.mockito.Mockito.mock; +import static org.junit.Assert.assertEquals; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.aaf.cmd.mgmt.Clear; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Clear { + + private static Clear clr; + + @BeforeClass + public static void setUp() { + clr = mock(Clear.class); + } + + @Test + public void exec() { + try { + assertEquals(clr._exec(0, "clear"), 0); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/mgmt/JU_Log.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/mgmt/JU_Log.java new file mode 100644 index 00000000..04a06f0e --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/mgmt/JU_Log.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.mgmt; + +import static org.mockito.Mockito.mock; +import static org.junit.Assert.assertEquals; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.aaf.cmd.mgmt.Log; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Log { + + private static Log log; + + @BeforeClass + public static void setUp() { + log = mock(Log.class); + } + + @Test + public void exec() { + try { + assertEquals(log._exec(0, "session clear"), 0); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/mgmt/JU_SessClear.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/mgmt/JU_SessClear.java new file mode 100644 index 00000000..7cda450e --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/mgmt/JU_SessClear.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.mgmt; + +import static org.mockito.Mockito.mock; +import static org.junit.Assert.assertEquals; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.aaf.cmd.mgmt.SessClear; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_SessClear { + + private static SessClear sessclr; + + @BeforeClass + public static void setUp() { + sessclr = mock(SessClear.class); + } + + @Test + public void exec() { + try { + assertEquals(sessclr._exec(0, "session clear"), 0); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Admin.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Admin.java new file mode 100644 index 00000000..fdecbd15 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Admin.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.ns; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.CALLS_REAL_METHODS; +import static org.mockito.Mockito.mock; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +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.JU_AAFCli; +import org.onap.aaf.cmd.ns.Admin; +import org.onap.aaf.cmd.ns.NS; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Admin { + + private static Admin admin; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + admin = new Admin(ns); + } + + @Test + public void exec() { + try { + assertEquals(admin._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Attrib.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Attrib.java new file mode 100644 index 00000000..ea41bb67 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Attrib.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.ns; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.CALLS_REAL_METHODS; +import static org.mockito.Mockito.mock; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +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.JU_AAFCli; +import org.onap.aaf.cmd.ns.Attrib; +import org.onap.aaf.cmd.ns.NS; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Attrib { + + private static Attrib attrib; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + attrib = new Attrib(ns); + } + + @Test + public void exec() { + try { + assertEquals(attrib._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Create.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Create.java new file mode 100644 index 00000000..af56be57 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Create.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.ns; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.CALLS_REAL_METHODS; +import static org.mockito.Mockito.mock; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +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.JU_AAFCli; +import org.onap.aaf.cmd.ns.Create; +import org.onap.aaf.cmd.ns.NS; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Create { + + private static Create create; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + create = new Create(ns); + } + + @Test + public void exec() { + try { + assertEquals(create._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Delete.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Delete.java new file mode 100644 index 00000000..5d0f7bd3 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Delete.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.ns; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.CALLS_REAL_METHODS; +import static org.mockito.Mockito.mock; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +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.JU_AAFCli; +import org.onap.aaf.cmd.ns.Delete; +import org.onap.aaf.cmd.ns.NS; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Delete { + + private static Delete del; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + del = new Delete(ns); + } + + @Test + public void exec() { + try { + assertEquals(del._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} + diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Describe.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Describe.java new file mode 100644 index 00000000..1cd7b387 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Describe.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.ns; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.CALLS_REAL_METHODS; +import static org.mockito.Mockito.mock; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +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.JU_AAFCli; +import org.onap.aaf.cmd.ns.Describe; +import org.onap.aaf.cmd.ns.NS; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Describe { + + private static Describe desc; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + desc = new Describe(ns); + } + + @Test + public void exec() { + try { + assertEquals(desc._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} + diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListActivity.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListActivity.java new file mode 100644 index 00000000..16062b8f --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListActivity.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.ns; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.ns.List; +import org.onap.aaf.cmd.ns.ListActivity; +import org.onap.aaf.cmd.ns.NS; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListActivity { + + private static ListActivity lsActivity; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + List ls = new List(ns); + lsActivity = new ListActivity(ls); + } + + @Test + public void exec() { + try { + assertEquals(lsActivity._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} + diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListAdminResponsible.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListAdminResponsible.java new file mode 100644 index 00000000..ab28722b --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListAdminResponsible.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.ns; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.ns.List; +import org.onap.aaf.cmd.ns.ListAdminResponsible; +import org.onap.aaf.cmd.ns.NS; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListAdminResponsible { + + private static ListAdminResponsible lsAdminRes; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + List ls = new List(ns); + lsAdminRes = new ListAdminResponsible(ls); + } + + @Test + public void exec() { + try { + assertEquals(lsAdminRes._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} + diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListByName.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListByName.java new file mode 100644 index 00000000..effa1d41 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListByName.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.ns; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.ns.List; +import org.onap.aaf.cmd.ns.ListByName; +import org.onap.aaf.cmd.ns.NS; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListByName { + + private static ListByName lsByName; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + List ls = new List(ns); + lsByName = new ListByName(ls); + } + + @Test + public void exec() { + try { + assertEquals(lsByName._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} + diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListChildren.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListChildren.java new file mode 100644 index 00000000..f7a850f4 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListChildren.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.ns; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.ns.List; +import org.onap.aaf.cmd.ns.ListChildren; +import org.onap.aaf.cmd.ns.NS; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListChildren { + + private static ListChildren lsChildren; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + List ls = new List(ns); + lsChildren = new ListChildren(ls); + } + + @Test + public void exec() { + try { + assertEquals(lsChildren._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} + diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListNsKeysByAttrib.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListNsKeysByAttrib.java new file mode 100644 index 00000000..62935a11 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListNsKeysByAttrib.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.ns; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.ns.List; +import org.onap.aaf.cmd.ns.ListNsKeysByAttrib; +import org.onap.aaf.cmd.ns.NS; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListNsKeysByAttrib { + + private static ListNsKeysByAttrib lsNsKeys; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + List ls = new List(ns); + lsNsKeys = new ListNsKeysByAttrib(ls); + } + + @Test + public void exec() { + try { + assertEquals(lsNsKeys._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} + diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListUsersInRole.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListUsersInRole.java new file mode 100644 index 00000000..7fc7af3c --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListUsersInRole.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.ns; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.ns.List; +import org.onap.aaf.cmd.ns.ListUsers; +import org.onap.aaf.cmd.ns.ListUsersInRole; +import org.onap.aaf.cmd.ns.NS; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListUsersInRole { + + private static ListUsersInRole lsUserinRole; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + List ls = new List(ns); + ListUsers lsU = new ListUsers(ls); + lsUserinRole = new ListUsersInRole(lsU); + } + + @Test + public void exec() { + try { + assertEquals(lsUserinRole._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListUsersWithPerm.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListUsersWithPerm.java new file mode 100644 index 00000000..fd44a429 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_ListUsersWithPerm.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.ns; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.ns.List; +import org.onap.aaf.cmd.ns.ListUsers; +import org.onap.aaf.cmd.ns.ListUsersWithPerm; +import org.onap.aaf.cmd.ns.NS; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListUsersWithPerm { + + private static ListUsersWithPerm lsUserWithPerm; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + List ls = new List(ns); + ListUsers lsU = new ListUsers(ls); + lsUserWithPerm = new ListUsersWithPerm(lsU); + } + + @Test + public void exec() { + try { + assertEquals(lsUserWithPerm._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Responsible.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Responsible.java new file mode 100644 index 00000000..77f7a15f --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/ns/JU_Responsible.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.ns; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.ns.NS; +import org.onap.aaf.cmd.ns.Responsible; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Responsible { + + private static Responsible respsble; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + NS ns = new NS(cli); + respsble = new Responsible(ns); + } + + @Test + public void exec() { + try { + assertEquals(respsble._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Create.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Create.java new file mode 100644 index 00000000..82c083b5 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Create.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.perm; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.perm.Create; +import org.onap.aaf.cmd.perm.Perm; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Create { + + private static Create create; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + Perm perm = new Perm(role); + create = new Create(perm); + } + + @Test + public void exec() { + try { + assertEquals(create._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Delete.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Delete.java new file mode 100644 index 00000000..21e7e35c --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Delete.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.perm; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.perm.Delete; +import org.onap.aaf.cmd.perm.Perm; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Delete { + + private static Delete del; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + Perm perm = new Perm(role); + del = new Delete(perm); + } + + @Test + public void exec() { + try { + assertEquals(del._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Describe.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Describe.java new file mode 100644 index 00000000..d05b44e4 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Describe.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.perm; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.perm.Describe; +import org.onap.aaf.cmd.perm.Perm; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Describe { + + private static Describe desc; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + Perm perm = new Perm(role); + desc = new Describe(perm); + } + + @Test + public void exec() { + try { + assertEquals(desc._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Grant.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Grant.java new file mode 100644 index 00000000..a233ca02 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Grant.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.perm; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.perm.Grant; +import org.onap.aaf.cmd.perm.Perm; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Grant { + + private static Grant grant; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + Perm perm = new Perm(role); + grant = new Grant(perm); + } + + @Test + public void exec() { + try { + assertEquals(grant._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListActivity.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListActivity.java new file mode 100644 index 00000000..c2712beb --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListActivity.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.perm; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.perm.List; +import org.onap.aaf.cmd.perm.ListActivity; +import org.onap.aaf.cmd.perm.Perm; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListActivity { + + private static ListActivity lsActivity; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + Perm perm = new Perm(role); + List ls = new List(perm); + lsActivity = new ListActivity(ls); + } + + @Test + public void exec() { + try { + assertEquals(lsActivity._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListByNS.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListByNS.java new file mode 100644 index 00000000..8935045e --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListByNS.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.perm; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.perm.List; +import org.onap.aaf.cmd.perm.ListByNS; +import org.onap.aaf.cmd.perm.Perm; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListByNS { + + private static ListByNS lsByNS; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + Perm perm = new Perm(role); + List ls = new List(perm); + lsByNS = new ListByNS(ls); + } + + @Test + public void exec() { + try { + assertEquals(lsByNS._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListByName.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListByName.java new file mode 100644 index 00000000..3e59d4e6 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListByName.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.perm; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.perm.List; +import org.onap.aaf.cmd.perm.ListByName; +import org.onap.aaf.cmd.perm.Perm; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListByName { + + private static ListByName lsByName; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + Perm perm = new Perm(role); + List ls = new List(perm); + lsByName = new ListByName(ls); + } + + @Test + public void exec() { + try { + assertEquals(lsByName._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListByRole.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListByRole.java new file mode 100644 index 00000000..d55c0b94 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListByRole.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.perm; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.perm.List; +import org.onap.aaf.cmd.perm.ListByRole; +import org.onap.aaf.cmd.perm.Perm; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListByRole { + + private static ListByRole lsByRole; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + Perm perm = new Perm(role); + List ls = new List(perm); + lsByRole = new ListByRole(ls); + } + + @Test + public void exec() { + try { + assertEquals(lsByRole._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListByUser.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListByUser.java new file mode 100644 index 00000000..88fef497 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_ListByUser.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.perm; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.perm.List; +import org.onap.aaf.cmd.perm.ListByUser; +import org.onap.aaf.cmd.perm.Perm; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListByUser { + + private static ListByUser lsByName; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + Perm perm = new Perm(role); + List ls = new List(perm); + lsByName = new ListByUser(ls); + } + + @Test + public void exec() { + try { + assertEquals(lsByName._exec(0, "add","del","reset","extend"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Rename.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Rename.java new file mode 100644 index 00000000..6e53e301 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/perm/JU_Rename.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.perm; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.perm.Perm; +import org.onap.aaf.cmd.perm.Rename; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Rename { + + private static Rename rename; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + Perm perm = new Perm(role); + rename = new Rename(perm); + } + + @Test + public void exec() { + try { + assertEquals(rename._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_CreateDelete.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_CreateDelete.java new file mode 100644 index 00000000..92794971 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_CreateDelete.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.role; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.role.CreateDelete; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_CreateDelete { + + private static CreateDelete createDel; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + createDel = new CreateDelete(role); + } + + @Test + public void exec() { + try { + assertEquals(createDel._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_Describe.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_Describe.java new file mode 100644 index 00000000..388b0463 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_Describe.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.role; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.role.Describe; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Describe { + + private static Describe desc; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + desc = new Describe(role); + } + + @Test + public void exec() { + try { + assertEquals(desc._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListActivity.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListActivity.java new file mode 100644 index 00000000..08dc1199 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListActivity.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.role; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.role.List; +import org.onap.aaf.cmd.role.ListActivity; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListActivity { + + private static ListActivity lsActivity; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + List ls = new List(role); + lsActivity = new ListActivity(ls); + } + + @Test + public void exec() { + try { + assertEquals(lsActivity._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByNS.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByNS.java new file mode 100644 index 00000000..82133fab --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByNS.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.role; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.role.List; +import org.onap.aaf.cmd.role.ListByNS; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListByNS { + + private static ListByNS lsByNS; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + List ls = new List(role); + lsByNS = new ListByNS(ls); + } + + @Test + public void exec() { + try { + assertEquals(lsByNS._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByNameOnly.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByNameOnly.java new file mode 100644 index 00000000..266039aa --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByNameOnly.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.role; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.role.List; +import org.onap.aaf.cmd.role.ListByNameOnly; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListByNameOnly { + + private static ListByNameOnly lsByName; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + List ls = new List(role); + lsByName = new ListByNameOnly(ls); + } + + @Test + public void exec() { + try { + assertEquals(lsByName._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByPerm.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByPerm.java new file mode 100644 index 00000000..f97a684c --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByPerm.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.role; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.role.List; +import org.onap.aaf.cmd.role.ListByPerm; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListByPerm { + + private static ListByPerm lsByPerm; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + List ls = new List(role); + lsByPerm = new ListByPerm(ls); + } + + @Test + public void exec() { + try { + assertEquals(lsByPerm._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByRole.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByRole.java new file mode 100644 index 00000000..0848eb14 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByRole.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.role; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.role.List; +import org.onap.aaf.cmd.role.ListByRole; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListByRole { + + private static ListByRole lsByRole; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + List ls = new List(role); + lsByRole = new ListByRole(ls); + } + + @Test + public void exec() { + try { + assertEquals(lsByRole._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByUser.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByUser.java new file mode 100644 index 00000000..17f99812 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_ListByUser.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.role; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.role.List; +import org.onap.aaf.cmd.role.ListByUser; +import org.onap.aaf.cmd.role.Role; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListByUser { + + private static ListByUser lsByUser; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + List ls = new List(role); + lsByUser = new ListByUser(ls); + } + + @Test + public void exec() { + try { + assertEquals(lsByUser._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } 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(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_User.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_User.java new file mode 100644 index 00000000..cadfd941 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/role/JU_User.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.role; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.perm.Perm; +import org.onap.aaf.cmd.role.Role; +import org.onap.aaf.cmd.role.User; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_User { + + private static User user; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + Role role = new Role(cli); + user = new User(role); + } + + @Test + public void exec() { + try { + assertEquals(user._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } 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(); + } + } +} 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 new file mode 100644 index 00000000..77c05a99 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_Cred.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.user; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.aaf.cmd.user.Cred; +import org.onap.aaf.cmd.user.User; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Cred { + + private static Cred testCred; + private static User testUser; + + + @BeforeClass + public static void setUp() { + 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(); + } + } + + @Test + public void exec() throws CadiException, APIException, LocatorException { + assertEquals(testCred._exec(4, "String1","String2","String3","String4"), 10); + } + + + @Test + public void exec_add() { + try { + assertNotNull(testCred._exec(0, "zeroed","add","del","reset","extend")); + } catch (CadiException | APIException | LocatorException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + @Test + public void exec_del() { + try { + assertNotNull(testCred._exec(1, "zeroed","add","del","reset","extend")); + } catch (CadiException | APIException | LocatorException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + @Test + public void exec_reset() { + try { + assertNotNull(testCred._exec(2, "zeroed","add","del","reset","extend")); + } catch (CadiException | APIException | LocatorException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + @Test + public void exec_extend() { + try { + assertNotNull(testCred._exec(3, "zeroed","add","del","reset","extend")); + } catch (CadiException | APIException | LocatorException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_Delg.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_Delg.java new file mode 100644 index 00000000..41708466 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_Delg.java @@ -0,0 +1,81 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.user; + +import static org.mockito.Mockito.mock; +import static org.junit.Assert.*; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.aaf.cmd.user.Delg; +import org.onap.aaf.cmd.user.User; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Delg { + + private static User testUser; + private static Delg delg; + + @BeforeClass + public static void setUp() throws APIException { + testUser = mock(User.class); + delg = mock(Delg.class); + } + + @Test + public void exec_add() { + try { + assertEquals(delg._exec(0, "zero","add","upd","del"), 0); + } catch (CadiException | APIException | LocatorException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Test + public void exec_upd() { + try { + assertEquals(delg._exec(1, "zero","add","upd","del"), 0); + } catch (CadiException | APIException | LocatorException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Test + public void exec_del() { + try { + assertEquals(delg._exec(2, "zero","add","upd","del"), 0); + } catch (CadiException | APIException | LocatorException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListActivity.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListActivity.java new file mode 100644 index 00000000..8edc633b --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListActivity.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.user; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.user.List; +import org.onap.aaf.cmd.user.ListActivity; +import org.onap.aaf.cmd.user.User; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListActivity { + + private static ListActivity lsActivity; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + User usr = new User(cli); + List parent = new List(usr); + lsActivity = new ListActivity(parent); + + } + + @Test + public void exec() { + try { + assertEquals(lsActivity._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } catch (CadiException e) { + + e.printStackTrace(); + } catch (APIException e) { + + e.printStackTrace(); + } catch (LocatorException e) { + + e.printStackTrace(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListApprovals.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListApprovals.java new file mode 100644 index 00000000..fe3b91c3 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListApprovals.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.user; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.user.List; +import org.onap.aaf.cmd.user.ListApprovals; +import org.onap.aaf.cmd.user.User; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListApprovals { + + private static ListApprovals lsApprovals; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + User usr = new User(cli); + List parent = new List(usr); + lsApprovals = new ListApprovals(parent); + + } + + @Test + public void exec() { + try { + assertEquals(lsApprovals._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } catch (CadiException e) { + + e.printStackTrace(); + } catch (APIException e) { + + e.printStackTrace(); + } catch (LocatorException e) { + + e.printStackTrace(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListDelegates.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListDelegates.java new file mode 100644 index 00000000..e25cedf9 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListDelegates.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.user; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.user.List; +import org.onap.aaf.cmd.user.ListDelegates; +import org.onap.aaf.cmd.user.User; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListDelegates { + + private static ListDelegates lsDelegates; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + User usr = new User(cli); + List parent = new List(usr); + lsDelegates = new ListDelegates(parent); + + } + + @Test + public void exec() { + try { + assertEquals(lsDelegates._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } catch (CadiException e) { + + e.printStackTrace(); + } catch (APIException e) { + + e.printStackTrace(); + } catch (LocatorException e) { + + e.printStackTrace(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListForCreds.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListForCreds.java new file mode 100644 index 00000000..95012bd0 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListForCreds.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.user; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.user.List; +import org.onap.aaf.cmd.user.ListForCreds; +import org.onap.aaf.cmd.user.User; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListForCreds { + + private static ListForCreds lsForCreds; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + User usr = new User(cli); + List parent = new List(usr); + lsForCreds = new ListForCreds(parent); + + } + + @Test + public void exec() { + try { + assertEquals(lsForCreds._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } catch (CadiException e) { + + e.printStackTrace(); + } catch (APIException e) { + + e.printStackTrace(); + } catch (LocatorException e) { + + e.printStackTrace(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListForPermission.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListForPermission.java new file mode 100644 index 00000000..bb1e3dba --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListForPermission.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.user; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.user.List; +import org.onap.aaf.cmd.user.ListForPermission; +import org.onap.aaf.cmd.user.User; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListForPermission { + + private static ListForPermission lsForPermission; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + User usr = new User(cli); + List parent = new List(usr); + lsForPermission = new ListForPermission(parent); + + } + + @Test + public void exec() { + try { + assertEquals(lsForPermission._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } catch (CadiException e) { + + e.printStackTrace(); + } catch (APIException e) { + + e.printStackTrace(); + } catch (LocatorException e) { + + e.printStackTrace(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListForRoles.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListForRoles.java new file mode 100644 index 00000000..e2b5cfe6 --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_ListForRoles.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.user; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.user.List; +import org.onap.aaf.cmd.user.ListForRoles; +import org.onap.aaf.cmd.user.User; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_ListForRoles { + + private static ListForRoles lsForRoles; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + User usr = new User(cli); + List parent = new List(usr); + lsForRoles = new ListForRoles(parent); + + } + + @Test + public void exec() { + try { + assertEquals(lsForRoles._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } catch (CadiException e) { + + e.printStackTrace(); + } catch (APIException e) { + + e.printStackTrace(); + } catch (LocatorException e) { + + e.printStackTrace(); + } + } +} diff --git a/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_Role.java b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_Role.java new file mode 100644 index 00000000..133adf7b --- /dev/null +++ b/authz-cmd/src/test/java/org/onap/aaf/cmd/user/JU_Role.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * ============LICENSE_START==================================================== + * * org.onap.aaf + * * =========================================================================== + * * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * * =========================================================================== + * * 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. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * * ============LICENSE_END==================================================== + * * + * * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * * + ******************************************************************************/ +package org.onap.aaf.cmd.user; + +import static org.junit.Assert.assertEquals; + +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.JU_AAFCli; +import org.onap.aaf.cmd.user.Role; +import org.onap.aaf.cmd.user.User; + +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.LocatorException; +import org.onap.aaf.inno.env.APIException; + +@RunWith(MockitoJUnitRunner.class) +public class JU_Role { + + private static Role role; + + @BeforeClass + public static void setUp () throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException { + AAFcli cli = JU_AAFCli.getAAfCli(); + User usr = new User(cli); + role = new Role(usr); + + } + + @Test + public void exec() { + try { + assertEquals(role._exec(0, "add","del","reset","extend","clear", "rename", "create"),500); + } catch (CadiException e) { + + e.printStackTrace(); + } catch (APIException e) { + + e.printStackTrace(); + } catch (LocatorException e) { + + e.printStackTrace(); + } + } +} -- cgit 1.2.3-korg