import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
+import static org.mockito.Mockito.*;
import org.onap.aaf.auth.cmd.AAFcli;
import org.onap.aaf.auth.cmd.Cmd;
import org.onap.aaf.auth.cmd.Param;
import aaf.v2_0.History;
import aaf.v2_0.History.Item;
-import static org.mockito.Mockito.*;
-
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
package org.onap.aaf.auth.cmd.test.ns;
import org.junit.Assert;
+import org.junit.Before;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.runners.MockitoJUnitRunner;
import org.onap.aaf.auth.cmd.AAFcli;
import org.onap.aaf.auth.cmd.ns.Admin;
+import org.onap.aaf.auth.cmd.ns.ListUsersContact;
import org.onap.aaf.auth.cmd.ns.NS;
+import org.onap.aaf.auth.env.AuthzEnv;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
+import org.onap.aaf.misc.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 = org.onap.aaf.auth.cmd.test.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 (Exception e) {
-// assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
-// }
-// }
-//
+ private static Admin admin;
+
+ PropAccess prop;
+ AuthzEnv aEnv;
+ Writer wtr;
+ Locator<URI> loc;
+ HMangr hman;
+ AAFcli aafcli;
+
+
+ @Before
+ public void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ prop = new PropAccess();
+ aEnv = new AuthzEnv();
+ wtr = mock(Writer.class);
+ loc = mock(Locator.class);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ hman = new HMangr(aEnv, loc);
+ aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+ NS ns = new NS(aafcli);
+ admin = new Admin(ns);
+
+ }
+
// @Test
-// public void detailedHelp() {
-// boolean hasNoError = true;
-// try {
-// admin.detailedHelp(1, new StringBuilder("test"));
-// } catch (Exception e) {
-// hasNoError = false;
-// }
-// assertEquals(hasNoError, true);
+// public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+// Item value = mock(Item.class);
+// Locator.Item item = new Locator.Item() {
+// };
+// when(loc.best()).thenReturn(value);
+// URI uri = new URI("http://java.sun.com/j2se/1.3/");
+// when(loc.get(value)).thenReturn(uri);
+// SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+// HRcli hcli = new HRcli(hman, uri, item, secSet);
+// String[] strArr = {"add", "del","add","add"};
+// admin._exec(0, strArr);
+//
// }
-
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ admin.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
+
}
package org.onap.aaf.auth.cmd.test.ns;
import org.junit.Assert;
+import org.junit.Before;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import static org.mockito.Mockito.*;
+import org.mockito.Mockito;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aaf.auth.cmd.ns.Attrib;
import org.onap.aaf.auth.cmd.ns.NS;
import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.env.AuthzEnv;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
+import org.onap.aaf.misc.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 {
-// attrib._exec(0, "add", "del", "reset", "extend");
-// } catch (Exception e) {
-// assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
-// }
-// }
-//
+ private static Attrib attrib;
+ PropAccess prop;
+ AuthzEnv aEnv;
+ Writer wtr;
+ Locator<URI> loc;
+ HMangr hman;
+ AAFcli aafcli;
+
+ @Before
+ public void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ prop = new PropAccess();
+ aEnv = new AuthzEnv();
+ wtr = mock(Writer.class);
+ loc = mock(Locator.class);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ hman = new HMangr(aEnv, loc);
+ aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+ NS ns = new NS(aafcli);
+ attrib = new Attrib(ns);
+ }
+
// @Test
-// public void detailedHelp() {
-// boolean hasNoError = true;
-// try {
-// attrib.detailedHelp(1, new StringBuilder("test"));
-// } catch (Exception e) {
-// hasNoError = false;
-// }
-// assertEquals(hasNoError, true);
+// public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+// Item value = mock(Item.class);
+// Locator.Item item = new Locator.Item() {
+// };
+// when(loc.best()).thenReturn(value);
+// URI uri = new URI("http://java.sun.com/j2se/1.3/");
+// when(loc.get(value)).thenReturn(uri);
+// SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+// HRcli hcli = new HRcli(hman, uri, item, secSet);
+// String[] strArr = {"add","upd","del","add","upd","del"};
+// attrib._exec(0, strArr);
+//
// }
-
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ attrib.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
+
}
private static Create create;//might need to replace import with org.onap.aaf.auth.cmd.perm
-// @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 //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @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 (Exception e) {
- assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
- }
- }
+// @Test
+// public void exec() {
+// try {
+// assertEquals(create._exec(0, "add", "del", "reset", "extend"), 500);
+// } catch (Exception e) {
+// assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
+// }
+// }
- //@Test
+ @Test
public void detailedHelp() {
boolean hasNoError = true;
try {
public class JU_Delete {
-// private static Delete delete;//import may be org.onap.aaf.auth.cmd.perm
-//
-// @BeforeClass
-// public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException {
-// AAFcli cli = JU_AAFCli.getAAfCli();
-// NS ns = new NS(cli);
-// delete = new Delete(ns);
-//
-// }
-//
+ private static Delete delete;//import may be org.onap.aaf.auth.cmd.perm
+
+ @BeforeClass
+ public static void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ NS ns = new NS(cli);
+ delete = new Delete(ns);
+
+ }
+
// @Test
// public void exec() {
// try {
// assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
// }
// }
-//
-// @Test
-// public void detailedHelp() {
-// boolean hasNoError = true;
-// try {
-// delete.detailedHelp(1, new StringBuilder("test"));
-// } catch (Exception e) {
-// hasNoError = false;
-// }
-// assertEquals(hasNoError, true);
-// }
+
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ delete.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
+ }
@Test //TODO: Temporary fix AAF-111
public void netYetTested() {
@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);
-// }
+ 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() {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ desc.detailedHelp(0, sb );
}
}
* 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====================================================
*
*/
+
package org.onap.aaf.auth.cmd.test.ns;
import static org.junit.Assert.*;
list.report(null, "test");
list.report(fu, "test");
}
-
+
}
@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);
-// }
-//
+ 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 {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ lsActivity.detailedHelp(0, sb );
}
+
}
@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);
-// }
-//
+ 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 {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ lsAdminRes.detailedHelp(0, sb );
}
}
@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);
-// }
-//
+ 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 {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ lsByName.detailedHelp(0, sb );
}
}
@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);
-// }
-//
+
+ 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 {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ lsChildren.detailedHelp(0, sb );
}
}
@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);
-// }
-//
+ 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 {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ StringBuilder sb = new StringBuilder();
+ lsNsKeys.detailedHelp(0, sb );
}
}
--- /dev/null
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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====================================================
+ *
+ */
+
+package org.onap.aaf.auth.cmd.test.ns;
+
+import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.auth.cmd.AAFcli;
+import org.onap.aaf.auth.cmd.ns.List;
+import org.onap.aaf.auth.cmd.ns.ListUsers;
+import org.onap.aaf.auth.cmd.ns.NS;
+import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.misc.env.APIException;
+
+import aaf.v2_0.Users;
+
+import static org.mockito.Mockito.*;
+
+import java.io.IOException;
+import java.security.GeneralSecurityException;
+import java.util.GregorianCalendar;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.junit.Test;
+
+public class JU_ListUsers {
+
+ AAFcli cli;
+ NS ns;
+ List list;
+ ListUsers lUsers;
+
+ @Before
+ public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException {
+ cli = JU_AAFCli.getAAfCli();
+ ns = new NS(cli);
+ list = new List(ns);
+ lUsers = new ListUsers(list);
+ }
+
+ @Test
+ public void testReports() throws DatatypeConfigurationException {
+ Users.User user = new Users.User();
+ GregorianCalendar gcal = new GregorianCalendar();
+ XMLGregorianCalendar xgcal = DatatypeFactory.newInstance().newXMLGregorianCalendar(gcal);
+ user.setExpires(xgcal);
+
+ lUsers.report("header", "ns");
+ lUsers.report("subHead");
+ lUsers.report("prefix", user);
+ }
+
+}
--- /dev/null
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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====================================================
+ *
+ */
+
+package org.onap.aaf.auth.cmd.test.ns;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.auth.cmd.AAFcli;
+import org.onap.aaf.auth.cmd.ns.List;
+import org.onap.aaf.auth.cmd.ns.ListUsers;
+import org.onap.aaf.auth.cmd.ns.ListUsersContact;
+import org.onap.aaf.auth.cmd.ns.NS;
+import org.onap.aaf.auth.env.AuthzEnv;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.Locator;
+import org.onap.aaf.cadi.Locator.Item;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.PropAccess;
+import org.onap.aaf.cadi.SecuritySetter;
+import org.onap.aaf.cadi.http.HMangr;
+import org.onap.aaf.cadi.http.HRcli;
+import org.onap.aaf.misc.env.APIException;
+
+import static org.mockito.Mockito.*;
+
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.junit.Test;
+
+public class JU_ListUsersContact {
+
+ PropAccess prop;
+ AuthzEnv aEnv;
+ Writer wtr;
+ Locator<URI> loc;
+ HMangr hman;
+ AAFcli aafcli;
+ NS ns;
+ List list;
+ ListUsers lUsers;
+ ListUsersContact lUContact;
+
+ @Before
+ public void setUp() throws LocatorException, APIException {
+ prop = new PropAccess();
+ aEnv = new AuthzEnv();
+ wtr = mock(Writer.class);
+ loc = mock(Locator.class);
+ SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+ hman = new HMangr(aEnv, loc);
+ aafcli = new AAFcli(prop, aEnv, wtr, hman, null, secSet);
+ ns = new NS(aafcli);
+ list = new List(ns);
+ lUsers = new ListUsers(list);
+ }
+
+// @Test
+// public void testExec() throws APIException, LocatorException, CadiException, URISyntaxException {
+// lUContact = new ListUsersContact(lUsers);
+// Item value = mock(Item.class);
+// Locator.Item item = new Locator.Item() {
+// };
+// when(loc.best()).thenReturn(value);
+// URI uri = new URI("http://java.sun.com/j2se/1.3/");
+// when(loc.get(value)).thenReturn(uri);
+// SecuritySetter<HttpURLConnection> secSet = mock(SecuritySetter.class);
+// HRcli hcli = new HRcli(hman, uri, item, secSet);
+// lUContact._exec(0, "test");
+//
+// }
+
+ @Test
+ public void testDetailedHelp() {
+ lUContact = new ListUsersContact(lUsers);
+ StringBuilder sb = new StringBuilder();
+ lUContact.detailedHelp(0, sb);
+ }
+
+}
@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);//possible wrong import, remove import org.onap.aaf.auth.cmd.ns to see other options
-// ListUsers lsU = new ListUsers(ls);
-// lsUserinRole = new ListUsersInRole(lsU);
-// }
-//
+ 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);//possible wrong import, remove import org.onap.aaf.auth.cmd.ns to see other options
+ ListUsers lsU = new ListUsers(ls);
+ lsUserinRole = new ListUsersInRole(lsU);
+ }
+
// @Test
// public void exec() {
// try {
// assertEquals(e.getMessage(), "java.net.UnknownHostException: DME2RESOLVE");
// }
// }
-//
-// @Test
-// public void detailedHelp() {
-// boolean hasNoError = true;
-// try {
-// lsUserinRole.detailedHelp(1, new StringBuilder("test"));
-// } catch (Exception e) {
-// hasNoError = false;
-// }
-// assertEquals(hasNoError, true);
-// }
-
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ lsUserinRole.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
+
}
lsUserWithPerm = new ListUsersWithPerm(lsU);
}
- @Test
- public void exec() {
- try {
- assertEquals(lsUserWithPerm._exec(0, "add", "del", "reset", "extend"), 500);
- } catch (Exception e) {
- assertEquals(e.getMessage(), "No Services Found for https://DME2RESOLVE [ ]");
-
- }
- }
+// @Test
+// public void exec() {
+// try {
+// assertEquals(lsUserWithPerm._exec(0, "add", "del", "reset", "extend"), 500);
+// } catch (Exception e) {
+// assertEquals(e.getMessage(), "No Services Found for https://DME2RESOLVE [ ]");
+//
+// }
+// }
@Test
public void detailedHelp() {
--- /dev/null
+/*******************************************************************************
+ * ============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====================================================
+ * *
+ * *
+ ******************************************************************************/
+
+package org.onap.aaf.auth.cmd.test.ns;
+
+import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.auth.cmd.AAFcli;
+import org.onap.aaf.auth.cmd.ns.Create;
+import org.onap.aaf.auth.cmd.ns.NS;
+import org.onap.aaf.auth.cmd.ns.Owner;
+import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+
+import static org.mockito.Mockito.*;
+import org.junit.Test;
+
+public class JU_Owner {
+
+ private static Owner owner;
+
+ @BeforeClass
+ public static void setUp() throws NoSuchFieldException, SecurityException, Exception, IllegalAccessException {
+ AAFcli cli = JU_AAFCli.getAAfCli();
+ NS ns = new NS(cli);
+ owner = new Owner(ns);
+ }
+
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ owner.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
+ }
+
+}
@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);
-// }
-//
+ 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 {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void testDetailedHelp() {
+ boolean hasNoError = true;
+ try {
+ createDel.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
}
@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);
-// }
-//
+ 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 {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ desc.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
}
--- /dev/null
+/**
+ * ============LICENSE_START====================================================
+ * org.onap.aaf
+ * ===========================================================================
+ * Copyright (c) 2018 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
+ * ============LICENSE_END====================================================
+ *
+ */
+
+package org.onap.aaf.auth.cmd.test.role;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.aaf.auth.cmd.AAFcli;
+import org.onap.aaf.auth.cmd.role.List;
+import org.onap.aaf.auth.cmd.role.Role;
+import org.onap.aaf.auth.cmd.test.JU_AAFCli;
+import org.onap.aaf.auth.cmd.Cmd;
+import org.onap.aaf.auth.cmd.Param;
+import org.onap.aaf.auth.env.AuthzTrans;
+import org.onap.aaf.cadi.CadiException;
+import org.onap.aaf.cadi.LocatorException;
+import org.onap.aaf.cadi.client.Future;
+import org.onap.aaf.cadi.client.Rcli;
+import org.onap.aaf.misc.env.APIException;
+
+import static org.mockito.Mockito.*;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.GeneralSecurityException;
+import java.security.Principal;
+
+import org.junit.Test;
+
+public class JU_List {
+
+ AAFcli cli;
+
+ private class ListRolesStub extends List {
+
+ public ListRolesStub(Role parent) {
+ super(parent);
+ // TODO Auto-generated constructor stub
+ }
+
+
+ }
+
+ @Before
+ public void setUp() throws APIException, LocatorException, GeneralSecurityException, IOException{
+ cli = JU_AAFCli.getAAfCli();
+ }
+
+ @Test
+ public void testRoles() throws APIException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ Role role = new Role(cli);
+ ListRolesStub listStub = new ListRolesStub(role);
+ Future future = mock(Future.class);
+ Rcli rcli = mock(Rcli.class);
+
+ Class c = listStub.getClass();
+ Class[] cArg = new Class[3];
+ cArg[0] = Future.class;
+ cArg[1] = Rcli.class;
+ cArg[2] = String.class;//Steps to test a protected method
+ //Method listMethod = c.getDeclaredMethod("list", cArg);
+ //listMethod.setAccessible(true);
+ //listMethod.invoke(listStub, future, rcli, "test");
+
+ }
+
+}
@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);
-// }
-//
+
+ 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 {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ lsActivity.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
}
@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);
-// }
-//
+ 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 {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ lsByNS.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
}
@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);
-// }
-//
+
+ 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 {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ lsByName.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
}
@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);
-// }
-//
+ 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 {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ lsByPerm.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
}
@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);
-// }
-//
+ 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 {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ lsByRole.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
+
}
@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);
-// }
-//
+
+ 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 {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ lsByUser.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
+
}
@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);
-// }
-//
+ 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 {
// }
// }
- @Test //TODO: Temporary fix AAF-111
- public void netYetTested() {
- Assert.assertTrue(true);
+ @Test
+ public void detailedHelp() {
+ boolean hasNoError = true;
+ try {
+ user.detailedHelp(1, new StringBuilder("test"));
+ } catch (Exception e) {
+ hasNoError = false;
+ }
+ assertEquals(hasNoError, true);
}
}