From 67bac2c1c44beab7752b39584553449e1c8a4e94 Mon Sep 17 00:00:00 2001 From: Instrumental Date: Mon, 2 Apr 2018 17:41:10 -0500 Subject: Keep only clean TestCases, remove 2 license issues Issue-ID: AAF-111 Change-Id: I7f779f4beacc84427734ce2c5b0369d5727e136d Signed-off-by: Instrumental --- .../org/onap/aaf/auth/cass/hl/JU_Question.java | 509 --------------------- .../org/onap/aaf/auth/cass/hl/JU_Question2.java | 73 --- .../onap/aaf/auth/dao/aaf/test/JU_ApprovalDAO.java | 146 ------ .../org/onap/aaf/auth/dao/aaf/test/JU_ArtiDAO.java | 136 ------ .../aaf/auth/dao/aaf/test/JU_CacheInfoDAO.java | 63 --- .../org/onap/aaf/auth/dao/aaf/test/JU_CertDAO.java | 103 ----- .../org/onap/aaf/auth/dao/aaf/test/JU_CredDAO.java | 250 ---------- .../onap/aaf/auth/dao/aaf/test/JU_DelegateDAO.java | 106 ----- .../onap/aaf/auth/dao/aaf/test/JU_FastCalling.java | 89 ---- .../onap/aaf/auth/dao/aaf/test/JU_HistoryDAO.java | 153 ------- .../org/onap/aaf/auth/dao/aaf/test/JU_NsDAO.java | 185 -------- .../org/onap/aaf/auth/dao/aaf/test/JU_PermDAO.java | 174 ------- .../org/onap/aaf/auth/dao/aaf/test/JU_RoleDAO.java | 137 ------ .../onap/aaf/auth/direct/test/JU_DirectAAFLur.java | 63 --- .../aaf/auth/direct/test/JU_DirectAAFUserPass.java | 84 ---- 15 files changed, 2271 deletions(-) delete mode 100644 auth/auth-cass/src/test/java/org/onap/aaf/auth/cass/hl/JU_Question.java delete mode 100644 auth/auth-cass/src/test/java/org/onap/aaf/auth/cass/hl/JU_Question2.java delete mode 100644 auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_ApprovalDAO.java delete mode 100644 auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_ArtiDAO.java delete mode 100644 auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_CacheInfoDAO.java delete mode 100644 auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_CertDAO.java delete mode 100644 auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_CredDAO.java delete mode 100644 auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_DelegateDAO.java delete mode 100644 auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_FastCalling.java delete mode 100644 auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_HistoryDAO.java delete mode 100644 auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_NsDAO.java delete mode 100644 auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_PermDAO.java delete mode 100644 auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_RoleDAO.java delete mode 100644 auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLur.java delete mode 100644 auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFUserPass.java (limited to 'auth/auth-cass/src/test/java/org') diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/cass/hl/JU_Question.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/cass/hl/JU_Question.java deleted file mode 100644 index e06a8c57..00000000 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/cass/hl/JU_Question.java +++ /dev/null @@ -1,509 +0,0 @@ -/******************************************************************************* - * ============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.cass.hl; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.aaf.auth.dao.cass.NsDAO; -import org.onap.aaf.auth.dao.cass.PermDAO; -import org.onap.aaf.auth.dao.cass.RoleDAO; -import org.onap.aaf.auth.dao.cass.UserRoleDAO; -import org.onap.aaf.auth.dao.cass.NsDAO.Data; -import org.onap.aaf.auth.dao.hl.Question; -import org.onap.aaf.auth.dao.hl.Question.Access; -import org.onap.aaf.auth.env.AuthzTrans; -import org.onap.aaf.auth.layer.Result; -import org.onap.aaf.cadi.principal.TaggedPrincipal; -import org.onap.aaf.misc.env.Env; -import org.onap.aaf.misc.env.TimeTaken; - -import com.att.dao.aaf.test.AbsJUCass; - -public class JU_Question extends AbsJUCass { - - private static final int EXPIRES_IN = 60000000; - private static final String COM_TEST_JU = "com.test.ju_question"; - private static final String JU9999_JU_TEST_COM = "ju9999@ju.test.com"; - private static final String JU9998_JU_TEST_COM = "ju9998@ju.test.com"; - private static final String READ = "read"; - private static final int NFR_1 = 80; - private static final int NFR_2 = 4000; - private static final int ROLE_LEVEL1 = 1000; - private static final int PERM_LEVEL1 = 1000; -// private static final int PERM_LEVEL2 = 20; - private static Question q; - private static NsDAO.Data ndd; - - @BeforeClass - public static void startupBeforeClass() throws Exception { - details=false; - AuthzTrans trans = env.newTransNoAvg(); - q = new Question(trans,cluster,AUTHZ, false); - ndd = new NsDAO.Data(); - ndd.name=COM_TEST_JU; - ndd.type=3; // app - ndd.parent="com.test"; - ndd.description="Temporary Namespace for JU_Question"; - q.nsDAO.create(trans, ndd); - } - - @AfterClass - public static void endAfterClass() throws Exception { - q.nsDAO.delete(trans, ndd,false); - } -// @Test - public void mayUserRead_EmptyPerm() { - PermDAO.Data pdd = new PermDAO.Data(); - Result result = q.mayUser(trans,JU9999_JU_TEST_COM,pdd,Access.read); - assertFalse(result.isOK()); - } - -// @Test - public void mayUserRead_OnePermNotExist() { - Result result = q.mayUser(trans,JU9999_JU_TEST_COM,newPerm(0,0,READ),Access.read); - assertFalse(result.isOK()); - assertEquals("Denied - ["+ JU9999_JU_TEST_COM +"] may not read Perm [" + COM_TEST_JU + ".myPerm0|myInstance0|read]",result.errorString()); - } - -// @Test - public void mayUserRead_OnePermExistDenied() { - PermDAO.Data perm = newPerm(0,0,READ); - q.permDAO.create(trans,perm); - try { - Result result; - TimeTaken tt = trans.start("q.mayUser...", Env.SUB); - try { - result = q.mayUser(trans,JU9999_JU_TEST_COM,perm,Access.read); - } finally { - tt.done(); - assertTrue("NFR time < "+ NFR_1 + "ms",tt.millis() result; - TimeTaken tt = trans.start("q.mayUser...", Env.SUB); - try { - result = q.mayUser(trans,JU9999_JU_TEST_COM,perm,Access.read); - } finally { - tt.done(); - assertTrue("NFR time < "+ NFR_1 + "ms",tt.millis()> pres; - TimeTaken tt = trans.start("q.getPerms...", Env.SUB); - try { - pres = q.getPermsByUserFromRolesFilter(trans, JU9999_JU_TEST_COM, JU9999_JU_TEST_COM); - } finally { - tt.done(); - trans.info().log("filter_OnePermOneRleExistOK",tt); - assertTrue("NFR time < "+ NFR_1 + "ms",tt.millis() lrole = new ArrayList(); - List lur = new ArrayList(); - try { - q.permDAO.create(trans,perm); - for(int i=0;i result; - TimeTaken tt = trans.start("mayUserRead_OnePermMultiRoleExistOK", Env.SUB); - try { - result = q.mayUser(trans,JU9999_JU_TEST_COM,perm,Access.read); - } finally { - tt.done(); - env.info().log(tt,ROLE_LEVEL1,"iterations"); - assertTrue("NFR time < "+ NFR_2 + "ms",tt.millis() lperm = new ArrayList(); - try { - for(int i=0;i result; - TimeTaken tt = trans.start("mayUserRead_MultiPermOneRoleExistOK", Env.SUB); - try { - result = q.mayUser(trans,JU9999_JU_TEST_COM,lperm.get(PERM_LEVEL1-1),Access.read); - } finally { - tt.done(); - env.info().log(tt,PERM_LEVEL1,"iterations"); - assertTrue("NFR time < "+ NFR_2 + "ms",tt.millis() lperm = new ArrayList(); -// List lrole = new ArrayList(); -// List lur = new ArrayList(); -// -// try { -// RoleDAO.Data role; -// UserRoleDAO.Data ur; -// for(int i=0;i result; -// TimeTaken tt = trans.start("mayUserRead_MultiPermMultiRoleExistOK", Env.SUB); -// try { -// result = q.mayUser(trans,JU9999_JU_TEST_COM,lperm.get(ROLE_LEVEL1*PERM_LEVEL2-1),Access.read); -// } finally { -// tt.done(); -// env.info().log(tt,lperm.size(),"perms",", ",lrole.size(),"role"); -// assertTrue("NFR time < "+ NFR_2 + "ms",tt.millis() lperm = new ArrayList(); - List lrole = new ArrayList(); - List lur = new ArrayList(); - load(roleLevel, permLevel, lperm,lrole,lur); - - - Result> pres; - trans.setUser(new TaggedPrincipal() { - @Override - public String getName() { - return JU9999_JU_TEST_COM; - } - - @Override - public String tag() { - return "JUnit"; - } - - @Override - public String personalName() { - return JU9998_JU_TEST_COM; - } - }); - - try { - TimeTaken group = trans.start(" Original Security Method (1st time)", Env.SUB); - try { - TimeTaken tt = trans.start(" Get User Perms for "+JU9998_JU_TEST_COM, Env.SUB); - try { - pres = q.getPermsByUser(trans,JU9998_JU_TEST_COM,true); - } finally { - tt.done(); - env.info().log(tt," Looked up (full) getPermsByUser for",JU9998_JU_TEST_COM); - } - assertTrue(pres.isOK()); - tt = trans.start(" q.mayUser", Env.SUB); - List reduced = new ArrayList(); - - try { - for(PermDAO.Data p : pres.value) { - Result r = q.mayUser(trans,JU9999_JU_TEST_COM,p,Access.read); - if(r.isOK()) { - reduced.add(p); - } - } - } finally { - tt.done(); - env.info().log(tt," reduced" + pres.value.size(),"perms","to",reduced.size()); - // assertTrue("NFR time < "+ NFR_2 + "ms",tt.millis() lperm = new ArrayList(); - List lrole = new ArrayList(); - List lur = new ArrayList(); - load(roleLevel, permLevel, lperm,lrole,lur); - - try { - - Result> pres; - TimeTaken tt = trans.start(" mayUserRead_MultiPermMultiRoleExist_New New Filter", Env.SUB); - try { - pres = q.getPermsByUserFromRolesFilter(trans, JU9999_JU_TEST_COM, JU9998_JU_TEST_COM); - } finally { - tt.done(); - env.info().log(tt,lperm.size(),"perms",", ",lrole.size(),"role", lur.size(), "UserRoles"); -// assertTrue("NFR time < "+ NFR_2 + "ms",tt.millis() lperm , List lrole, List lur) { - RoleDAO.Data role; - UserRoleDAO.Data ur; - PermDAO.Data perm; - - int onethirdR=roleLevel/3; - int twothirdR=onethirdR*2; - int onethirdP=permLevel/3; - int twothirdP=onethirdP*2; - - for(int i=0;i lperm , List lrole, List lur) { - for(PermDAO.Data perm : lperm) { - q.permDAO.delete(trans, perm, false); - } - for(RoleDAO.Data role : lrole) { - q.roleDAO.delete(trans, role, false); - } - for(UserRoleDAO.Data ur : lur) { - q.userRoleDAO.delete(trans, ur, false); - } - - } - private PermDAO.Data newPerm(int permNum, int instNum, String action, RoleDAO.Data ... grant) { - PermDAO.Data pdd = new PermDAO.Data(); - pdd.ns=COM_TEST_JU; - pdd.type="myPerm"+permNum; - pdd.instance="myInstance"+instNum; - pdd.action=action; - for(RoleDAO.Data r : grant) { - pdd.roles(true).add(r.fullName()); - r.perms(true).add(pdd.encode()); - } - return pdd; - } - - private RoleDAO.Data newRole(int roleNum, PermDAO.Data ... grant) { - RoleDAO.Data rdd = new RoleDAO.Data(); - rdd.ns = COM_TEST_JU+roleNum; - rdd.name = "myRole"+roleNum; - for(PermDAO.Data p : grant) { - rdd.perms(true).add(p.encode()); - p.roles(true).add(rdd.fullName()); - } - return rdd; - } - - private UserRoleDAO.Data newUserRole(RoleDAO.Data role,String user, long offset) { - UserRoleDAO.Data urd = new UserRoleDAO.Data(); - urd.user=user; - urd.role(role); - urd.expires=new Date(System.currentTimeMillis()+offset); - return urd; - } - - -} diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/cass/hl/JU_Question2.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/cass/hl/JU_Question2.java deleted file mode 100644 index bfb6fd4e..00000000 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/cass/hl/JU_Question2.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * ============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.cass.hl; - -import java.io.IOException; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.aaf.auth.dao.hl.Question; - -public class JU_Question2 { - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Before - public void setUp() throws Exception { - } - - @After - public void tearDown() throws Exception { - } - - @Test - public void test() throws IOException { - String s,u; - System.out.println((s="com") + '=' + (u=Question.toUnique(s))); - System.out.println(u+'='+(Question.fromUnique(u))); - System.out.println((s="org.osaaf.cdp.Tenant32_what-a-joy") + '=' + (u=Question.toUnique(s))); - System.out.println(u+'='+(Question.fromUnique(u))); - System.out.println((s="org.osaaf.cdp") + '=' + (u=Question.toUnique(s))); - System.out.println(u+'='+(Question.fromUnique(u))); - -// Assert.assertSame(s="com", Question.toUnique(s)); -// Assert.assertSame(s="", Question.toUnique(s)); -// Assert.assertSame(s="com.aa", Question.toUnique(s)); -// Assert.assertNotSame(s="com.Aa", Question.toUnique(s)); -// Assert.assertEquals("com.aa", Question.toUnique(s)); -// Assert.assertNotSame(s="com.Aa.1", Question.toUnique(s)); -// Assert.assertEquals("com.aa.1", Question.toUnique(s)); -// Assert.assertNotSame(s="com.Aa.1-3", Question.toUnique(s)); -// Assert.assertEquals("com.aa.13", Question.toUnique(s)); -// Assert.assertEquals("com.aa.13", Question.toUnique("com.aA.1_3")); - } - -} diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_ApprovalDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_ApprovalDAO.java deleted file mode 100644 index 13a13edf..00000000 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_ApprovalDAO.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * ============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.dao.aaf.test; - - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertTrue; - -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import org.junit.Test; -import org.onap.aaf.auth.dao.cass.ApprovalDAO; -import org.onap.aaf.auth.dao.cass.ApprovalDAO.Data; -import org.onap.aaf.auth.layer.Result; - -public class JU_ApprovalDAO extends AbsJUCass { - @Test - public void testCRUD() throws Exception { - ApprovalDAO rrDAO = new ApprovalDAO(trans, cluster, AUTHZ); - ApprovalDAO.Data data = new ApprovalDAO.Data(); - - data.ticket = UUID.randomUUID(); // normally, read from Future object - data.user = "testid@test.com"; - data.approver = "mySuper@att.com"; - data.type = "supervisor"; - data.status = "pending"; - data.operation = "C"; - data.updated = new Date(); - - try { - // Test create - rrDAO.create(trans, data); - - // Test Read by Ticket - Result> rlad; - rlad = rrDAO.readByTicket(trans, data.ticket); - assertTrue(rlad.isOK()); - assertEquals(1,rlad.value.size()); - compare(data,rlad.value.get(0)); - - // Hold onto original ID for deletion, and read tests - UUID id = rlad.value.get(0).id; - - try { - // Test Read by User - rlad = rrDAO.readByUser(trans, data.user); - assertTrue(rlad.isOKhasData()); - boolean ok = false; - for(ApprovalDAO.Data a : rlad.value) { - if(a.id.equals(id)) { - ok = true; - compare(data,a); - } - } - assertTrue(ok); - - // Test Read by Approver - rlad = rrDAO.readByApprover(trans, data.approver); - assertTrue(rlad.isOKhasData()); - ok = false; - for(ApprovalDAO.Data a : rlad.value) { - if(a.id.equals(id)) { - ok = true; - compare(data,a); - } - } - assertTrue(ok); - - // Test Read by ID - rlad = rrDAO.read(trans, id); - assertTrue(rlad.isOKhasData()); - ok = false; - for(ApprovalDAO.Data a : rlad.value) { - if(a.id.equals(id)) { - ok = true; - compare(data,a); - } - } - assertTrue(ok); - - // Test Update - data.status = "approved"; - data.id = id; - assertTrue(rrDAO.update(trans, data).isOK()); - - rlad = rrDAO.read(trans, id); - assertTrue(rlad.isOKhasData()); - ok = false; - for(ApprovalDAO.Data a : rlad.value) { - if(a.id.equals(id)) { - ok = true; - compare(data,a); - } - } - assertTrue(ok); - - } finally { - // Delete - data.id = id; - rrDAO.delete(trans, data, true); - rlad = rrDAO.read(trans, id); - assertTrue(rlad.isOK()); - assertTrue(rlad.isEmpty()); - } - - } finally { - rrDAO.close(trans); - } - } - - private void compare(Data d1, Data d2) { - assertNotSame(d1.id,d2.id); - assertEquals(d1.ticket,d2.ticket); - assertEquals(d1.user,d2.user); - assertEquals(d1.approver,d2.approver); - assertEquals(d1.type,d2.type); - assertEquals(d1.status,d2.status); - assertEquals(d1.operation,d2.operation); - assertNotSame(d1.updated,d2.updated); - } - - - -} diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_ArtiDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_ArtiDAO.java deleted file mode 100644 index f095e32f..00000000 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_ArtiDAO.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * ============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.dao.aaf.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.security.NoSuchAlgorithmException; -import java.util.Date; -import java.util.List; - -import org.junit.Test; -import org.onap.aaf.auth.dao.cass.ArtiDAO; -import org.onap.aaf.auth.dao.cass.ArtiDAO.Data; -import org.onap.aaf.auth.layer.Result; - -/** - * UserDAO unit test. - * User: tp007s - * Date: 7/19/13 - */ -public class JU_ArtiDAO extends AbsJUCass { - @Test - public void test() throws IOException, NoSuchAlgorithmException { - ArtiDAO adao = new ArtiDAO(trans,cluster,"authz"); - try { - // Create - ArtiDAO.Data data = new ArtiDAO.Data(); - data.mechid="m55555@perturbed.att.com"; - data.machine="perturbed1232.att.com"; - data.type(false).add("file"); - data.type(false).add("jks"); - data.sponsor="Fred Flintstone"; - data.ca="devl"; - data.dir="/opt/app/aft/keys"; - data.ns="kumquat"; - data.os_user="aft"; - data.notify="email:myname@bogus.email.com"; - data.expires=new Date(); - -// Bytification - ByteBuffer bb = data.bytify(); - Data bdata = new ArtiDAO.Data(); - bdata.reconstitute(bb); - checkData1(data, bdata); - - -// DB work - adao.create(trans,data); - try { - // Validate Read with key fields in Data - Result> rlcd = adao.read(trans,data); - assertTrue(rlcd.isOKhasData()); - for(ArtiDAO.Data d : rlcd.value) { - checkData1(data,d); - } - - // Validate Read with key fields in Data - rlcd = adao.read(trans,data.mechid, data.machine); - assertTrue(rlcd.isOKhasData()); - for(ArtiDAO.Data d : rlcd.value) { - checkData1(data,d); - } - - // By Machine - rlcd = adao.readByMachine(trans,data.machine); - assertTrue(rlcd.isOKhasData()); - for(ArtiDAO.Data d : rlcd.value) { - checkData1(data,d); - } - - // By MechID - rlcd = adao.readByMechID(trans,data.mechid); - assertTrue(rlcd.isOKhasData()); - for(ArtiDAO.Data d : rlcd.value) { - checkData1(data,d); - } - - // Update - data.sponsor = "Wilma Flintstone"; - adao.update(trans,data); - rlcd = adao.read(trans,data); - assertTrue(rlcd.isOKhasData()); - for(ArtiDAO.Data d : rlcd.value) { - checkData1(data,d); - } - - } finally { - // Always delete data, even if failure. - adao.delete(trans,data, true); - } - } finally { - adao.close(trans); - } - - - } - - private void checkData1(Data data, Data d) { - assertEquals(data.mechid,d.mechid); - assertEquals(data.machine,d.machine); - assertEquals(data.type(false).size(),d.type(false).size()); - for(String s: data.type(false)) { - assertTrue(d.type(false).contains(s)); - } - assertEquals(data.sponsor,d.sponsor); - assertEquals(data.ca,d.ca); - assertEquals(data.dir,d.dir); - assertEquals(data.ns,d.ns); - assertEquals(data.os_user,d.os_user); - assertEquals(data.notify,d.notify); - assertEquals(data.expires,d.expires); - } - -} diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_CacheInfoDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_CacheInfoDAO.java deleted file mode 100644 index 7a1bd58c..00000000 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_CacheInfoDAO.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * ============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.dao.aaf.test; - -import java.io.IOException; -import java.util.Date; - -import org.junit.Test; -import org.onap.aaf.auth.dao.CIDAO; -import org.onap.aaf.auth.dao.DAOException; -import org.onap.aaf.auth.dao.cass.CacheInfoDAO; -import org.onap.aaf.auth.dao.cass.RoleDAO; -import org.onap.aaf.auth.dao.cass.Status; -import org.onap.aaf.auth.env.AuthzTrans; -import org.onap.aaf.auth.layer.Result; -import org.onap.aaf.misc.env.APIException; -import org.onap.aaf.misc.env.util.Chrono; - -import junit.framework.Assert; - - -public class JU_CacheInfoDAO extends AbsJUCass { - - @Test - public void test() throws DAOException, APIException, IOException { - CIDAO id = new CacheInfoDAO(trans, cluster, AUTHZ); - Date date = new Date(); - - id.touch(trans, RoleDAO.TABLE,1); - try { - Thread.sleep(3000); - } catch (InterruptedException e) { - } - Result rid = id.check(trans); - Assert.assertEquals(rid.status,Status.OK); - Date[] dates = CacheInfoDAO.info.get(RoleDAO.TABLE); - if(dates.length>0 && dates[1]!=null) { - System.out.println(Chrono.dateStamp(dates[1])); - System.out.println(Chrono.dateStamp(date)); - Assert.assertTrue(Math.abs(dates[1].getTime() - date.getTime())<20000); // allow for 4 seconds, given Remote DB - } - } - -} diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_CertDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_CertDAO.java deleted file mode 100644 index 8e8ed6ea..00000000 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_CertDAO.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * ============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.dao.aaf.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.math.BigInteger; -import java.nio.ByteBuffer; -import java.security.NoSuchAlgorithmException; -import java.util.List; - -import org.junit.Test; -import org.onap.aaf.auth.dao.cass.CertDAO; -import org.onap.aaf.auth.dao.cass.CertDAO.Data; -import org.onap.aaf.auth.layer.Result; -import org.onap.aaf.misc.env.APIException; - -/** - * UserDAO unit test. - * User: tp007s - * Date: 7/19/13 - */ -public class JU_CertDAO extends AbsJUCass { - @Test - public void test() throws IOException, NoSuchAlgorithmException, APIException { - CertDAO cdao = new CertDAO(trans,cluster,"authz"); - try { - // Create - CertDAO.Data data = new CertDAO.Data(); - data.serial=new BigInteger("11839383"); - data.id = "m55555@tguard.att.com"; - data.x500="CN=ju_cert.dao.att.com, OU=AAF, O=\"ATT Services, Inc.\", L=Southfield, ST=Michigan, C=US"; - data.x509="I'm a cert"; - data.ca = "aaf"; - cdao.create(trans,data); - -// Bytification - ByteBuffer bb = data.bytify(); - Data bdata = new CertDAO.Data(); - bdata.reconstitute(bb); - checkData1(data, bdata); - - // Validate Read with key fields in Data - Result> rlcd = cdao.read(trans,data); - assertTrue(rlcd.isOKhasData()); - for(CertDAO.Data d : rlcd.value) { - checkData1(data,d); - } - - // Validate Read with key fields in Data - rlcd = cdao.read(trans,data.ca,data.serial); - assertTrue(rlcd.isOKhasData()); - for(CertDAO.Data d : rlcd.value) { - checkData1(data,d); - } - - // Update - data.id = "m66666.tguard.att.com"; - cdao.update(trans,data); - rlcd = cdao.read(trans,data); - assertTrue(rlcd.isOKhasData()); - for(CertDAO.Data d : rlcd.value) { - checkData1(data,d); - } - - cdao.delete(trans,data, true); - } finally { - cdao.close(trans); - } - - - } - - private void checkData1(Data data, Data d) { - assertEquals(data.ca,d.ca); - assertEquals(data.serial,d.serial); - assertEquals(data.id,d.id); - assertEquals(data.x500,d.x500); - assertEquals(data.x509,d.x509); - } - -} diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_CredDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_CredDAO.java deleted file mode 100644 index bb88a2aa..00000000 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_CredDAO.java +++ /dev/null @@ -1,250 +0,0 @@ -/******************************************************************************* - * ============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.dao.aaf.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.security.NoSuchAlgorithmException; -import java.util.Date; -import java.util.List; - -import org.junit.Test; -import org.onap.aaf.auth.dao.cass.CredDAO; -import org.onap.aaf.auth.dao.cass.CredDAO.Data; -import org.onap.aaf.auth.layer.Result; -import org.onap.aaf.misc.env.APIException; - -/** - * UserDAO unit test. - * User: tp007s - * Date: 7/19/13 - */ -public class JU_CredDAO extends AbsJUCass { - @Test - public void test() throws IOException, NoSuchAlgorithmException, APIException { - CredDAO udao = new CredDAO(trans,cluster,"authz"); - try { - // Create - CredDAO.Data data = new CredDAO.Data(); - data.id = "m55555@aaf.att.com"; - data.type = CredDAO.BASIC_AUTH; - data.notes = "temp pass"; - data.cred = ByteBuffer.wrap(userPassToBytes("m55555","mypass")); - data.other = 12; - data.expires = new Date(System.currentTimeMillis() + 60000*60*24*90); - udao.create(trans,data); - -// Bytification - ByteBuffer bb = data.bytify(); - Data bdata = new CredDAO.Data(); - bdata.reconstitute(bb); - checkData1(data, bdata); - - // Validate Read with key fields in Data - Result> rlcd = udao.read(trans,data); - assertTrue(rlcd.isOKhasData()); - for(CredDAO.Data d : rlcd.value) { - checkData1(data,d); - } - - // Update - data.cred = ByteBuffer.wrap(userPassToBytes("m55555","mynewpass")); - udao.update(trans,data); - rlcd = udao.read(trans,data); - assertTrue(rlcd.isOKhasData()); - for(CredDAO.Data d : rlcd.value) { - checkData1(data,d); - } - - udao.delete(trans,data, true); - } finally { - udao.close(trans); - } - - - } - - private void checkData1(Data data, Data d) { - assertEquals(data.id,d.id); - assertEquals(data.type,d.type); - assertEquals(data.ns,d.ns); - assertEquals(data.notes,d.notes); - assertEquals(data.cred,d.cred); - assertEquals(data.other,d.other); - assertEquals(data.expires,d.expires); - } - -// private String CONST_myName = "MyName"; -// public static final java.nio.ByteBuffer CONST_MY_CRED = get_CONST_MY_CRED(); -// public static final int CONST_CRED_TYPE = 11; -// -// public static final Date CONST_UPDATE_DATE = new Date(System.currentTimeMillis()+60000*24); -// @Test -// public void test() { -// UserDAO ud = new UserDAO(trans, cluster,"authz"); -// try { -// UserDAO.Data data = createPrototypeUserData(); -// ud.create(trans, data); -// -// // Validate Read with key fields in Data -// for(UserDAO.Data d : ud.read(trans, data)) { -// checkData1(data,d); -// } -// -// // Validate readByName -// for(UserDAO.Data d : ud.read(trans, CONST_myName)) { -// checkData1(data,d); -// } -// -// ud.delete(trans, data); -// List d_2 = ud.read(trans, CONST_myName); -// -// // Validate that data was deleted -// assertEquals("User should not be found after deleted", 0, d_2.size() ); -// -// data = new UserDAO.Data(); -// data.name = CONST_myName; -// data.cred = CONST_MY_CRED; -// data.cred_type= CONST_CRED_TYPE; -// data.expires = new Date(System.currentTimeMillis()+60000*24); -// final Result user = ud.r_create(trans, data); -// assertEquals("ud.createUser should work", Result.Status.OK, user.status); -// -// checkDataIgnoreDateDiff(data, user.value); -// -// // finally leave system in consistent state by deleting user again -// ud.delete(trans,data); -// -// } catch (DAOException e) { -// e.printStackTrace(); -// fail("Fail due to Exception"); -// } finally { -// ud.close(trans); -// } -// } -// -// private UserDAO.Data createPrototypeUserData() { -// UserDAO.Data data = new UserDAO.Data(); -// data.name = CONST_myName; -// -// data.cred_type = CONST_CRED_TYPE; -// data.cred = CONST_MY_CRED; -// data.expires = CONST_UPDATE_DATE; -// return data; -// } -// -// // @Test -// // public void testReadByUser() throws Exception { -// // // this test was done above in our super test, since it uses the same setup -// // } -// -// @Test -// public void testFunctionCreateUser() throws Exception { -// String name = "roger_rabbit"; -// Integer credType = CONST_CRED_TYPE; -// java.nio.ByteBuffer cred = CONST_MY_CRED; -// final UserDAO ud = new UserDAO(trans, cluster,"authz"); -// final UserDAO.Data data = createPrototypeUserData(); -// Result ret = ud.r_create(trans, data); -// Result> byUserNameLookup = ud.r_read(trans, name); -// -// assertEquals("sanity test w/ different username (different than other test cases) failed", name, byUserNameLookup.value.get(0).name); -// assertEquals("delete roger_rabbit failed", true, ud.delete(trans, byUserNameLookup.value.get(0))); -// } -// -// @Test -// public void testLowLevelCassandraCreateData_Given_UserAlreadyPresent_ShouldPass() throws Exception { -// UserDAO ud = new UserDAO(trans, cluster,"authz"); -// -// final UserDAO.Data data = createPrototypeUserData(); -// final UserDAO.Data data1 = ud.create(trans, data); -// final UserDAO.Data data2 = ud.create(trans, data); -// -// assertNotNull(data1); -// assertNotNull(data2); -// -// assertEquals(CONST_myName, data1.name); -// assertEquals(CONST_myName, data2.name); -// } -// -// @Test -// public void testCreateUser_Given_UserAlreadyPresent_ShouldFail() throws Exception { -// UserDAO ud = new UserDAO(trans, cluster,"authz"); -// -// final UserDAO.Data data = createPrototypeUserData(); -// -// // make sure that some prev test did not leave the user in the DB -// ud.delete(trans, data); -// -// // attempt to create same user twice !!! -// -// final Result data1 = ud.r_create(trans, data); -// final Result data2 = ud.r_create(trans, data); -// -// assertNotNull(data1); -// assertNotNull(data2); -// -// assertEquals(true, Result.Status.OK == data1.status); -// assertEquals(false, Result.Status.OK == data2.status); -// } -// -// private void checkData1(UserDAO.Data data, UserDAO.Data d) { -// data.name = CONST_myName; -// -// data.cred_type = CONST_CRED_TYPE; -// data.cred = CONST_MY_CRED; -// data.expires = CONST_UPDATE_DATE; -// -// assertEquals(data.name, d.name); -// assertEquals(data.cred_type, d.cred_type); -// assertEquals(data.cred, d.cred); -// assertEquals(data.expires, d.expires); -// -// } -// -// private void checkDataIgnoreDateDiff(UserDAO.Data data, UserDAO.Data d) { -// data.name = CONST_myName; -// -// data.cred_type = CONST_CRED_TYPE; -// data.cred = CONST_MY_CRED; -// data.expires = CONST_UPDATE_DATE; -// -// assertEquals(data.name, d.name); -// assertEquals(data.cred_type, d.cred_type); -// assertEquals(data.cred, d.cred); -// // we allow dates to be different, e.g. high level calls e.g. createUser sets the date itself. -// //assertEquals(data.updated, d.updated); -// -// } -// -// /** -// * Get a CONST_MY_CRED ByteBuffer, which is the java type for a cass blob. -// * @return -// */ -// private static java.nio.ByteBuffer get_CONST_MY_CRED() { -// return ByteBuffer.wrap("Hello".getBytes()); -// } -// -} diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_DelegateDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_DelegateDAO.java deleted file mode 100644 index a518e509..00000000 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_DelegateDAO.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * ============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.dao.aaf.test; - - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.nio.ByteBuffer; -import java.util.Date; -import java.util.List; - -import org.junit.Test; -import org.onap.aaf.auth.dao.cass.DelegateDAO; -import org.onap.aaf.auth.dao.cass.DelegateDAO.Data; -import org.onap.aaf.auth.layer.Result; - - -public class JU_DelegateDAO extends AbsJUCass { - @Test - public void testCRUD() throws Exception { - DelegateDAO dao = new DelegateDAO(trans, cluster, AUTHZ); - DelegateDAO.Data data = new DelegateDAO.Data(); - data.user = "myname"; - data.delegate = "yourname"; - data.expires = new Date(); - -// Bytification - ByteBuffer bb = data.bytify(); - Data bdata = new DelegateDAO.Data(); - bdata.reconstitute(bb); - compare(data, bdata); - - try { - // Test create - Result ddcr = dao.create(trans,data); - assertTrue(ddcr.isOK()); - - - // Read by User - Result> records = dao.read(trans,data.user); - assertTrue(records.isOKhasData()); - for(DelegateDAO.Data rdata : records.value) - compare(data,rdata); - - // Read by Delegate - records = dao.readByDelegate(trans,data.delegate); - assertTrue(records.isOKhasData()); - for(DelegateDAO.Data rdata : records.value) - compare(data,rdata); - - // Update - data.delegate = "hisname"; - data.expires = new Date(); - assertTrue(dao.update(trans, data).isOK()); - - // Read by User - records = dao.read(trans,data.user); - assertTrue(records.isOKhasData()); - for(DelegateDAO.Data rdata : records.value) - compare(data,rdata); - - // Read by Delegate - records = dao.readByDelegate(trans,data.delegate); - assertTrue(records.isOKhasData()); - for(DelegateDAO.Data rdata : records.value) - compare(data,rdata); - - // Test delete - dao.delete(trans,data, true); - records = dao.read(trans,data.user); - assertTrue(records.isEmpty()); - - - } finally { - dao.close(trans); - } - } - - private void compare(Data d1, Data d2) { - assertEquals(d1.user, d2.user); - assertEquals(d1.delegate, d2.delegate); - assertEquals(d1.expires,d2.expires); - } - - -} diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_FastCalling.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_FastCalling.java deleted file mode 100644 index d7886d3c..00000000 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_FastCalling.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * ============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.dao.aaf.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.security.NoSuchAlgorithmException; -import java.util.Date; -import java.util.List; - -import org.junit.Test; -import org.onap.aaf.auth.dao.cass.CredDAO; -import org.onap.aaf.auth.dao.cass.CredDAO.Data; -import org.onap.aaf.auth.layer.Result; -import org.onap.aaf.misc.env.APIException; - -public class JU_FastCalling extends AbsJUCass { - - @Test - public void test() throws IOException, NoSuchAlgorithmException, APIException { - trans.setProperty("cassandra.writeConsistency.cred","ONE"); - - CredDAO udao = new CredDAO(env.newTransNoAvg(),cluster,"authz"); - System.out.println("Starting calls"); - for(iterations=0;iterations<8;++iterations) { - try { - // Create - CredDAO.Data data = new CredDAO.Data(); - data.id = "m55555@aaf.att.com"; - data.type = CredDAO.BASIC_AUTH; - data.cred = ByteBuffer.wrap(userPassToBytes("m55555","mypass")); - data.expires = new Date(System.currentTimeMillis() + 60000*60*24*90); - udao.create(trans,data); - - // Validate Read with key fields in Data - Result> rlcd = udao.read(trans,data); - assertTrue(rlcd.isOKhasData()); - for(CredDAO.Data d : rlcd.value) { - checkData1(data,d); - } - - // Update - data.cred = ByteBuffer.wrap(userPassToBytes("m55555","mynewpass")); - udao.update(trans,data); - rlcd = udao.read(trans,data); - assertTrue(rlcd.isOKhasData()); - for(CredDAO.Data d : rlcd.value) { - checkData1(data,d); - } - - udao.delete(trans,data, true); - } finally { - updateTotals(); - newTrans(); - } - } - - } - - private void checkData1(Data data, Data d) { - assertEquals(data.id,d.id); - assertEquals(data.type,d.type); - assertEquals(data.cred,d.cred); - assertEquals(data.expires,d.expires); - } - -} diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_HistoryDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_HistoryDAO.java deleted file mode 100644 index 0b552a49..00000000 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_HistoryDAO.java +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - * ============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.dao.aaf.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.nio.ByteBuffer; -import java.util.List; -import java.util.Random; - -import org.junit.Test; -import org.onap.aaf.auth.dao.cass.HistoryDAO; -import org.onap.aaf.auth.layer.Result; - -public class JU_HistoryDAO extends AbsJUCass { - - @Test - public void testCreate() throws Exception { - HistoryDAO historyDAO = new HistoryDAO(trans, cluster, AUTHZ); - HistoryDAO.Data data = createHistoryData(); - - try { - historyDAO.create(trans,data); - Thread.sleep(200);// History Create is Async - Result> records = historyDAO.readByUser(trans,data.user,data.yr_mon); - assertTrue(records.isOKhasData()); - for(HistoryDAO.Data d : records.value) { - assertHistory(data, d); - } - } finally { - historyDAO.close(trans); - } - } - - @Test - public void tesReadByUser() throws Exception { - HistoryDAO historyDAO = new HistoryDAO(trans,cluster, AUTHZ); - HistoryDAO.Data data = createHistoryData(); - - try { - historyDAO.create(trans,data); - Thread.sleep(200);// History Create is Async - Result> records = historyDAO.readByUser(trans, data.user,data.yr_mon); - assertTrue(records.isOKhasData()); - for(HistoryDAO.Data d : records.value) { - assertHistory(data, d); - } - } finally { - historyDAO.close(trans); - } - } - -/* - @Test - public void readByUserAndMonth() throws Exception { - HistoryDAO historyDAO = new HistoryDAO(trans,cluster, AUTHZ); - HistoryDAO.Data data = createHistoryData(); - - try { - historyDAO.create(trans,data); - Thread.sleep(200);// History Create is Async - Result> records = historyDAO.readByUserAndMonth(trans, - data.user, Integer.valueOf(String.valueOf(data.yr_mon).substring(0, 4)), - Integer.valueOf(String.valueOf(data.yr_mon).substring(4, 6))); - assertTrue(records.isOKhasData()); - for(HistoryDAO.Data d : records.value) { - assertHistory(data, d); - } - } finally { - historyDAO.close(trans); - } - } -*/ - //TODO readadd this -// @Test -// public void readByUserAndDay() throws Exception { -// HistoryDAO historyDAO = new HistoryDAO(trans, cluster, AUTHZ); -// HistoryDAO.Data data = createHistoryData(); -// -// try { -// historyDAO.create(trans, data); -// Thread.sleep(200);// History Create is Async -// -// String dayTime = String.valueOf(data.day_time); -// String day = null; -// if (dayTime.length() < 8) -// day = dayTime.substring(0, 1); -// else -// day = dayTime.substring(0, 2); -// -// List records = historyDAO.readByUserBetweenDates(trans, -// data.user, Integer.valueOf(String.valueOf(data.yr_mon).substring(0, 4)), -// Integer.valueOf(String.valueOf(data.yr_mon).substring(4, 6)), -// Integer.valueOf(day), 0); -// assertEquals(1,records.size()); -// for(HistoryDAO.Data d : records) { -// assertHistory(data, d); -// } -// } finally { -// historyDAO.close(trans); -// } -// } - private HistoryDAO.Data createHistoryData() { - HistoryDAO.Data data = HistoryDAO.newInitedData(); - Random random = new Random(); - data.user = "test" + random.nextInt(); - data.action = "add"; - data.target = "history"; - data.memo = "adding a row into history table"; -// data.detail().put("id", "test"); -// data.detail().put("name", "test"); - //String temp = "Test Blob Message"; - data.reconstruct = ByteBuffer.wrap("Temp Blob Message".getBytes()); - return data; - } - - private void assertHistory(HistoryDAO.Data ip, HistoryDAO.Data op) { - assertEquals(ip.yr_mon, op.yr_mon); -// assertEquals(ip.day_time, op.day_time); - assertEquals(ip.user, op.user); - assertEquals(ip.action, op.action); - assertEquals(ip.target, op.target); - assertEquals(ip.memo, op.memo); - //TODO : have to see if third party assert utility can be used -// assertTrue(CollectionUtils.isEqualCollection(ip.detail, op.detail)); -// for (String key : ip.detail().keySet()) { -// assertNotNull(op.detail().get(key)); -// } - assertNotNull(op.reconstruct); - } - -} diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_NsDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_NsDAO.java deleted file mode 100644 index eb064959..00000000 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_NsDAO.java +++ /dev/null @@ -1,185 +0,0 @@ -/******************************************************************************* - * ============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.dao.aaf.test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import org.junit.Test; -import org.onap.aaf.auth.dao.cass.NsDAO; -import org.onap.aaf.auth.dao.cass.NsType; -import org.onap.aaf.auth.dao.cass.NsDAO.Data; -import org.onap.aaf.auth.layer.Result; -import org.onap.aaf.misc.env.APIException; - - -public class JU_NsDAO extends AbsJUCass { - private static final String CRM = "ju_crm"; - private static final String SWM = "ju_swm"; - - @Test - public void test() throws APIException, IOException { - NsDAO nsd = new NsDAO(trans, cluster, AUTHZ); - try { - final String nsparent = "com.test"; - final String ns1 = nsparent +".ju_ns"; - final String ns2 = nsparent + ".ju_ns2"; - - Map oAttribs = new HashMap(); - oAttribs.put(SWM, "swm_data"); - oAttribs.put(CRM, "crm_data"); - Data data = new NsDAO.Data(); - data.name = ns1; - data.type = NsType.APP.type; - data.attrib(true).putAll(oAttribs); - - - Result> rdrr; - - // CREATE - Result rdc = nsd.create(trans, data); - assertTrue(rdc.isOK()); - - try { -// Bytification - ByteBuffer bb = data.bytify(); - Data bdata = new NsDAO.Data(); - bdata.reconstitute(bb); - compare(data, bdata); - - // Test READ by Object - rdrr = nsd.read(trans, data); - assertTrue(rdrr.isOKhasData()); - assertEquals(rdrr.value.size(),1); - Data d = rdrr.value.get(0); - assertEquals(d.name,data.name); - assertEquals(d.type,data.type); - attribsEqual(d.attrib(false),data.attrib(false)); - attribsEqual(oAttribs,data.attrib(false)); - - // Test Read by Key - rdrr = nsd.read(trans, data.name); - assertTrue(rdrr.isOKhasData()); - assertEquals(rdrr.value.size(),1); - d = rdrr.value.get(0); - assertEquals(d.name,data.name); - assertEquals(d.type,data.type); - attribsEqual(d.attrib(false),data.attrib(false)); - attribsEqual(oAttribs,data.attrib(false)); - - // Read NS by Type - Result> rtypes = nsd.readNsByAttrib(trans, SWM); - Set types; - if(rtypes.notOK()) { - throw new IOException(rtypes.errorString()); - } else { - types = rtypes.value; - } - assertEquals(1,types.size()); - assertEquals(true,types.contains(ns1)); - - // Add second NS to test list of data returned - Data data2 = new NsDAO.Data(); - data2.name = ns2; - data2.type = 3; // app - Result rdc2 = nsd.create(trans, data2); - assertTrue(rdc2.isOK()); - - // Interrupt - test PARENT - Result> rdchildren = nsd.getChildren(trans, "com.test"); - assertTrue(rdchildren.isOKhasData()); - boolean child1 = false; - boolean child2 = false; - for(Data dchild : rdchildren.value) { - if(ns1.equals(dchild.name))child1=true; - if(ns2.equals(dchild.name))child2=true; - } - assertTrue(child1); - assertTrue(child2); - - // FINISH DATA 2 by deleting - Result rddr = nsd.delete(trans, data2, true); - assertTrue(rddr.isOK()); - - // ADD DESCRIPTION - String description = "This is my test Namespace"; - assertFalse(description.equalsIgnoreCase(data.description)); - - Result addDesc = nsd.addDescription(trans, data.name, description); - assertTrue(addDesc.isOK()); - rdrr = nsd.read(trans, data); - assertTrue(rdrr.isOKhasData()); - assertEquals(rdrr.value.size(),1); - assertEquals(rdrr.value.get(0).description,description); - - // UPDATE - String newDescription = "zz1234 Owns This Namespace Now"; - oAttribs.put("mso", "mso_data"); - data.attrib(true).put("mso", "mso_data"); - data.description = newDescription; - Result update = nsd.update(trans, data); - assertTrue(update.isOK()); - rdrr = nsd.read(trans, data); - assertTrue(rdrr.isOKhasData()); - assertEquals(rdrr.value.size(),1); - assertEquals(rdrr.value.get(0).description,newDescription); - attribsEqual(oAttribs, rdrr.value.get(0).attrib); - - - } catch (IOException e) { - e.printStackTrace(); - } finally { - // DELETE - Result rddr = nsd.delete(trans, data, true); - assertTrue(rddr.isOK()); - rdrr = nsd.read(trans, data); - assertTrue(rdrr.isOK() && rdrr.isEmpty()); - assertEquals(rdrr.value.size(),0); - } - } finally { - nsd.close(trans); - } - } - - private void compare(NsDAO.Data d, NsDAO.Data data) { - assertEquals(d.name,data.name); - assertEquals(d.type,data.type); - attribsEqual(d.attrib(false),data.attrib(false)); - attribsEqual(d.attrib(false),data.attrib(false)); - } - - private void attribsEqual(Map aa, Map ba) { - assertEquals(aa.size(),ba.size()); - for(Entry es : aa.entrySet()) { - assertEquals(es.getValue(),ba.get(es.getKey())); - } - } -} diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_PermDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_PermDAO.java deleted file mode 100644 index 1a407af7..00000000 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_PermDAO.java +++ /dev/null @@ -1,174 +0,0 @@ -/******************************************************************************* - * ============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.dao.aaf.test; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertTrue; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.List; -import java.util.Set; - -import org.junit.Test; -import org.onap.aaf.auth.dao.cass.PermDAO; -import org.onap.aaf.auth.dao.cass.RoleDAO; -import org.onap.aaf.auth.dao.cass.PermDAO.Data; -import org.onap.aaf.auth.layer.Result; -import org.onap.aaf.misc.env.APIException; - -/** - * Test the PermissionDAO - * - * Utilize AbsJUCass to initialize and pre-load Cass - * - * - */ -public class JU_PermDAO extends AbsJUCass{ - - @Test - public void test() throws APIException, IOException { - PermDAO pd = new PermDAO(trans,cluster,"authz"); - try { - PermDAO.Data data = new PermDAO.Data(); - data.ns = "com.test.ju_perm"; - data.type = "MyType"; - data.instance = "MyInstance"; - data.action = "MyAction"; - data.roles(true).add(data.ns + ".dev"); - - - - // CREATE - Result rpdc = pd.create(trans,data); - assertTrue(rpdc.isOK()); - - Result> rlpd; - try { -// Bytification - ByteBuffer bb = data.bytify(); - Data bdata = new PermDAO.Data(); - bdata.reconstitute(bb); - compare(data, bdata); - - // Validate Read with key fields in Data - if((rlpd = pd.read(trans,data)).isOK()) - for(PermDAO.Data d : rlpd.value) { - checkData1(data,d); - } - - // Validate readByName - if((rlpd = pd.readByType(trans,data.ns, data.type)).isOK()) - for(PermDAO.Data d : rlpd.value) { - checkData1(data,d); - } - - // Add Role - RoleDAO.Data role = new RoleDAO.Data(); - role.ns = data.ns; - role.name = "test"; - - Result rvpd = pd.addRole(trans, data, role.fullName()); - assertTrue(rvpd.isOK()); - // Validate Read with key fields in Data - if((rlpd = pd.read(trans,data)).isOK()) - for(PermDAO.Data d : rlpd.value) { - checkData2(data,d); - } - - // Remove Role - rvpd = pd.delRole(trans, data, role.fullName()); - assertTrue(rvpd.isOK()); - if((rlpd = pd.read(trans,data)).isOK()) - for(PermDAO.Data d : rlpd.value) { - checkData1(data,d); - } - - // Add Child - Data data2 = new Data(); - data2.ns = data.ns; - data2.type = data.type + ".2"; - data2.instance = data.instance; - data2.action = data.action; - - rpdc = pd.create(trans, data2); - assertTrue(rpdc.isOK()); - try { - rlpd = pd.readChildren(trans, data.ns,data.type); - assertTrue(rlpd.isOKhasData()); - assertEquals(rlpd.value.size(),1); - assertEquals(rlpd.value.get(0).fullType(),data2.fullType()); - } finally { - // Delete Child - pd.delete(trans, data2,true); - - } - } catch (IOException e) { - e.printStackTrace(); - } finally { - // DELETE - Result rpdd = pd.delete(trans,data,true); - assertTrue(rpdd.isOK()); - rlpd = pd.read(trans, data); - assertTrue(rlpd.isOK() && rlpd.isEmpty()); - assertEquals(rlpd.value.size(),0); - } - } finally { - pd.close(trans); - } - } - - private void compare(Data a, Data b) { - assertEquals(a.ns,b.ns); - assertEquals(a.type,b.type); - assertEquals(a.instance,b.instance); - assertEquals(a.action,b.action); - assertEquals(a.roles(false).size(),b.roles(false).size()); - for(String s: a.roles(false)) { - assertTrue(b.roles(false).contains(s)); - } - } - private void checkData1(Data data, Data d) { - assertEquals(data.ns,d.ns); - assertEquals(data.type,d.type); - assertEquals(data.instance,d.instance); - assertEquals(data.action,d.action); - - Set ss = d.roles(true); - assertEquals(1,ss.size()); - assertTrue(ss.contains(data.ns+".dev")); - } - - private void checkData2(Data data, Data d) { - assertEquals(data.ns,d.ns); - assertEquals(data.type,d.type); - assertEquals(data.instance,d.instance); - assertEquals(data.action,d.action); - - Set ss = d.roles(true); - assertEquals(2,ss.size()); - assertTrue(ss.contains(data.ns+".dev")); - assertTrue(ss.contains(data.ns+".test")); - } - - -} diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_RoleDAO.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_RoleDAO.java deleted file mode 100644 index fda818fc..00000000 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/dao/aaf/test/JU_RoleDAO.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * ============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.dao.aaf.test; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertTrue; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.List; - -import org.junit.Test; -import org.onap.aaf.auth.dao.cass.PermDAO; -import org.onap.aaf.auth.dao.cass.RoleDAO; -import org.onap.aaf.auth.dao.cass.RoleDAO.Data; -import org.onap.aaf.auth.layer.Result; -import org.onap.aaf.misc.env.APIException; - - -public class JU_RoleDAO extends AbsJUCass { - - @Test - public void test() throws IOException, APIException { - RoleDAO rd = new RoleDAO(trans, cluster, AUTHZ); - try { - Data data = new RoleDAO.Data(); - data.ns = "com.test.ju_role"; - data.name = "role1"; - -// Bytification - ByteBuffer bb = data.bytify(); - Data bdata = new RoleDAO.Data(); - bdata.reconstitute(bb); - compare(data, bdata); - - // CREATE - Result rdc = rd.create(trans, data); - assertTrue(rdc.isOK()); - Result> rdrr; - try { - // READ - rdrr = rd.read(trans, data); - assertTrue(rdrr.isOKhasData()); - assertEquals(rdrr.value.size(),1); - Data d = rdrr.value.get(0); - assertEquals(d.perms.size(),0); - assertEquals(d.name,data.name); - assertEquals(d.ns,data.ns); - - PermDAO.Data perm = new PermDAO.Data(); - perm.ns = data.ns; - perm.type = "Perm"; - perm.instance = "perm1"; - perm.action = "write"; - - // ADD Perm - Result rdar = rd.addPerm(trans, data, perm); - assertTrue(rdar.isOK()); - rdrr = rd.read(trans, data); - assertTrue(rdrr.isOKhasData()); - assertEquals(rdrr.value.size(),1); - assertEquals(rdrr.value.get(0).perms.size(),1); - assertTrue(rdrr.value.get(0).perms.contains(perm.encode())); - - // DEL Perm - rdar = rd.delPerm(trans, data,perm); - assertTrue(rdar.isOK()); - rdrr = rd.read(trans, data); - assertTrue(rdrr.isOKhasData()); - assertEquals(rdrr.value.size(),1); - assertEquals(rdrr.value.get(0).perms.size(),0); - - // Add Child - Data data2 = new Data(); - data2.ns = data.ns; - data2.name = data.name + ".2"; - - rdc = rd.create(trans, data2); - assertTrue(rdc.isOK()); - try { - rdrr = rd.readChildren(trans, data.ns,data.name); - assertTrue(rdrr.isOKhasData()); - assertEquals(rdrr.value.size(),1); - assertEquals(rdrr.value.get(0).name,data.name + ".2"); - - rdrr = rd.readChildren(trans, data.ns,"*"); - assertTrue(rdrr.isOKhasData()); - assertEquals(rdrr.value.size(),2); - - } finally { - // Delete Child - rd.delete(trans, data2, true); - } - - } finally { - // DELETE - Result rddr = rd.delete(trans, data, true); - assertTrue(rddr.isOK()); - rdrr = rd.read(trans, data); - assertTrue(rdrr.isOK() && rdrr.isEmpty()); - assertEquals(rdrr.value.size(),0); - } - } finally { - rd.close(trans); - } - } - - private void compare(Data a, Data b) { - assertEquals(a.name,b.name); - assertEquals(a.description, b.description); - assertEquals(a.ns,b.ns); - assertEquals(a.perms(false).size(),b.perms(false).size()); - for(String p : a.perms(false)) { - assertTrue(b.perms(false).contains(p)); - } - } - -} diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLur.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLur.java deleted file mode 100644 index 79d30c4c..00000000 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFLur.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * ============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.direct.test; - -import static org.junit.Assert.assertTrue; - -import java.security.Principal; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.aaf.auth.dao.hl.Question; -import org.onap.aaf.auth.direct.DirectAAFLur; -import org.onap.aaf.auth.env.AuthzEnv; -import org.onap.aaf.cadi.Permission; -import org.powermock.modules.junit4.PowerMockRunner; -@RunWith(PowerMockRunner.class) -public class JU_DirectAAFLur { - -public static AuthzEnv env; -public static Question question; -public DirectAAFLur directAAFLur; - - - - @Before - public void setUp() - { - directAAFLur = new DirectAAFLur(env, question); - } - - @Test - public void testFish() - { - - Principal bait = null; - Permission pond=null; - directAAFLur.fish(bait, pond); - - assertTrue(true); - - } - -} diff --git a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFUserPass.java b/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFUserPass.java deleted file mode 100644 index 6a25d991..00000000 --- a/auth/auth-cass/src/test/java/org/onap/aaf/auth/direct/test/JU_DirectAAFUserPass.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * ============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.direct.test; - -import static org.junit.Assert.*; - -import org.junit.Before; -import org.junit.Test; - -import static org.mockito.Mockito.*; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; -import org.onap.aaf.auth.dao.hl.Question; -import org.onap.aaf.auth.direct.DirectAAFUserPass; -import org.onap.aaf.auth.env.AuthzEnv; -import org.onap.aaf.cadi.CredVal.Type; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; -import org.powermock.modules.junit4.PowerMockRunner; - -@RunWith(PowerMockRunner.class) -public class JU_DirectAAFUserPass { - - // TODO: Ian - This test is in shambles. fix it - - //public static AuthzEnv env; - //public static Question question; - public DirectAAFUserPass directAAFUserPass; - - @Mock - AuthzEnv env; - - @Mock - Question question; - - String user; - - Type type; - - byte[] pass; - - @Before - public void setUp() { - directAAFUserPass = new DirectAAFUserPass(env, question); - } - - @Test - public void testvalidate(){ - - // Boolean bolVal = directAAFUserPass.validate(user, type, pass); - // assertEquals((bolVal==null),true); - - assertTrue(true); - - } - - @Test - public void notYetTested() { - fail("Tests not yet implemented"); - } - -} -- cgit 1.2.3-korg