diff options
author | Instrumental <jonathan.gathman@att.com> | 2019-03-07 12:58:39 -0600 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2019-03-07 12:58:54 -0600 |
commit | a174f8ddbc5eb78a648fb68b33ef18cb64d81fda (patch) | |
tree | d27c01bcd63fd6a7bff00687c6f33423a3a40e8c /auth/auth-batch/src/test | |
parent | 9dc1cd2632d1dda9c8f072e99616e73e0517f1aa (diff) |
Improve Batches
Issue-ID: AAF-740
Change-Id: Ib3e8a3f977964eed2e992dc02154dd3bc90492df
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/auth-batch/src/test')
5 files changed, 23 insertions, 84 deletions
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_URFutureApproveExec.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_URFutureApproveExec.java index 35409042..58d52f7d 100644 --- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_URFutureApproveExec.java +++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/actions/test/JU_URFutureApproveExec.java @@ -131,7 +131,7 @@ public class JU_URFutureApproveExec { // TODO Auto-generated catch block e.printStackTrace(); } - Approval approval = new Approval(null, null, "", new Date(), "test", "", "", "", "", 0L); + Approval approval = new Approval(null, null, "", "test", "", "", "", "", 0L); List<Approval> approvalAL = new ArrayList<>(); Future futureObj = new Future(null, "", "", new Date(), new Date(), null); @@ -151,7 +151,7 @@ public class JU_URFutureApproveExec { // TODO Auto-generated catch block e.printStackTrace(); } - Approval approval = new Approval(null, null, "", new Date(), "test", "", "", "", "", 0L); + Approval approval = new Approval(null, null, "", "test", "", "", "", "", 0L); List<Approval> approvalAL = new ArrayList<>(); Future futureObj = new Future(null, "", "", new Date(), new Date(), null); @@ -171,7 +171,7 @@ public class JU_URFutureApproveExec { // TODO Auto-generated catch block e.printStackTrace(); } - Approval approval = new Approval(null, null, "", new Date(), "test", "", "", "", "", 0L); + Approval approval = new Approval(null, null, "", "test", "", "", "", "", 0L); List<Approval> approvalAL = new ArrayList<>(); Future futureObj = new Future(null, "", "", new Date(), new Date(), null); @@ -191,7 +191,7 @@ public class JU_URFutureApproveExec { // TODO Auto-generated catch block e.printStackTrace(); } - Approval approval = new Approval(null, null, "", new Date(), "test", "", "", "", "", 0L); + Approval approval = new Approval(null, null, "", "test", "", "", "", "", 0L); List<Approval> approvalAL = new ArrayList<>(); Future futureObj = new Future(null, "", "", new Date(), new Date(), null); @@ -211,7 +211,7 @@ public class JU_URFutureApproveExec { // TODO Auto-generated catch block e.printStackTrace(); } - Approval approval = new Approval(null, null, "", new Date(), "test", "", "", "", "", 0L); + Approval approval = new Approval(null, null, "", "test", "", "", "", "", 0L); List<Approval> approvalAL = new ArrayList<>(); Future futureObj = new Future(null, "", "", new Date(), new Date(), null); diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approval.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approval.java index 44c72763..2e51d076 100644 --- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approval.java +++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Approval.java @@ -27,14 +27,12 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.util.ArrayList; -import java.util.Date; import java.util.List; import java.util.UUID; import org.junit.Before; import org.junit.Test; import org.onap.aaf.auth.batch.helpers.Approval; -import org.onap.aaf.auth.batch.helpers.creators.RowCreator; import org.onap.aaf.auth.dao.cass.ApprovalDAO; import org.onap.aaf.auth.env.AuthzTrans; import org.onap.aaf.auth.layer.Result; @@ -47,15 +45,14 @@ public class JU_Approval { Approval approval; UUID id; UUID ticket; - Date date; + @Before public void setUp() { id = new UUID(0, 0); ticket = new UUID(0, 0); - date = new Date(); - approval = new Approval(id, ticket, "approver", date, "user", "memo", "operation", "status", "type", 100l); + approval = new Approval(id, ticket, "approver","user", "memo", "operation", "status", "type", 100l); } @Test @@ -72,15 +69,15 @@ public class JU_Approval { approval.expunge(); } - @Test - public void testGetLast_notified() { - Assert.assertTrue(approval.getLast_notified() instanceof Date); - } - - @Test - public void testSetLastNotified() { - approval.setLastNotified(date); - } +// @Test +// public void testGetLast_notified() { +// Assert.assertTrue(approval.getLast_notified() instanceof Date); +// } +// +// @Test +// public void testSetLastNotified() { +// approval.setLastNotified(date); +// } @Test public void testGetStatus() { @@ -144,31 +141,31 @@ public class JU_Approval { @Test public void testUpdateNonDryRun() { - approval = new Approval(id, ticket, "approver", date, "user", "memo", "operation", "status", "type", 100l); + approval = new Approval(id, ticket, "approver", "user", "memo", "operation", "status", "type", 100l); AuthzTrans trans = mock(AuthzTrans.class); ApprovalDAO dao = mock(ApprovalDAO.class); LogTarget target = mock(LogTarget.class); when(trans.info()).thenReturn(target); - approval.update(trans, dao, false); +// approval.update(trans, dao, false); } @Test public void testUpdateDryRun() { - approval = new Approval(id, ticket, "approver", date, "user", "memo", "operation", "status", "type", 100l); + approval = new Approval(id, ticket, "approver", "user", "memo", "operation", "status", "type", 100l); AuthzTrans trans = mock(AuthzTrans.class); ApprovalDAO dao = mock(ApprovalDAO.class); LogTarget target = mock(LogTarget.class); when(trans.info()).thenReturn(target); - approval.update(trans, dao, true); +// approval.update(trans, dao, true); } @Test public void testDelayDeleteDryRun() { - approval = new Approval(id, ticket, "approver", date, "user", "memo", "operation", "status", "type", 100l); + approval = new Approval(id, ticket, "approver", "user", "memo", "operation", "status", "type", 100l); AuthzTrans trans = mock(AuthzTrans.class); ApprovalDAO dao = mock(ApprovalDAO.class); LogTarget target = mock(LogTarget.class); @@ -182,7 +179,7 @@ public class JU_Approval { @Test public void testDelayDeleteNonDryRun() { - approval = new Approval(id, ticket, "approver", date, "user", "memo", "operation", "status", "type", 100l); + approval = new Approval(id, ticket, "approver", "user", "memo", "operation", "status", "type", 100l); AuthzTrans trans = mock(AuthzTrans.class); ApprovalDAO dao = mock(ApprovalDAO.class); LogTarget target = mock(LogTarget.class); @@ -198,7 +195,7 @@ public class JU_Approval { @Test public void testDelayDeleteResultNotOk() { - approval = new Approval(id, ticket, "approver", date, "user", "memo", "operation", "status", "type", 100l); + approval = new Approval(id, ticket, "approver", "user", "memo", "operation", "status", "type", 100l); AuthzTrans trans = mock(AuthzTrans.class); ApprovalDAO dao = mock(ApprovalDAO.class); LogTarget target = mock(LogTarget.class); @@ -212,14 +209,5 @@ public class JU_Approval { Approval.delayDelete(trans, dao, false, list, "text"); } - @Test - public void testv2() { - Approval.v2_0_17.create(RowCreator.getRow()); - - assertEquals( - "select id,ticket,approver,last_notified,user,memo,operation,status,type,WRITETIME(status) from authz.approval", - Approval.v2_0_17.select()); - - } } diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Future.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Future.java index 0db682ad..e551ce2b 100644 --- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Future.java +++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_Future.java @@ -36,7 +36,6 @@ import org.junit.Before; import org.junit.Test; import org.onap.aaf.auth.batch.helpers.Creator; import org.onap.aaf.auth.batch.helpers.Future; -import org.onap.aaf.auth.batch.helpers.creators.RowCreator; import org.onap.aaf.auth.dao.cass.FutureDAO; import org.onap.aaf.auth.env.AuthzTrans; import org.onap.aaf.auth.layer.Result; @@ -109,40 +108,6 @@ public class JU_Future { Assert.assertEquals(false, Future.pendingDelete(future)); } - @Test - public void testLoad() { - Session session = mock(Session.class); - Trans trans = mock(Trans.class); - @SuppressWarnings("unchecked") - Creator<Future> creator = (Creator<Future>)mock(Creator.class); - LogTarget target = mock(LogTarget.class); - TimeTaken tt = mock(TimeTaken.class); - ResultSet results = mock(ResultSet.class); - ArrayList<Row> rows = new ArrayList<Row>(); - Row row = RowCreator.getRow(); - rows.add(row); - - when(results.all()).thenReturn(rows); - when(trans.info()).thenReturn(target); - when(trans.start("Load Futures", Env.REMOTE)).thenReturn(tt); - when(trans.start("Process Futures", Env.SUB)).thenReturn(tt); - when(session.execute(any(SimpleStatement.class))).thenReturn(results); - when(creator.create(row)).thenReturn(future); - - Future.load(trans, session, creator); - } - - @Test - public void testV2() { - Future.v2_0_17.create(RowCreator.getRow()); - assertEquals(Future.v2_0_17.select(), "select id,memo,target,start,expires from authz.future"); - } - - @Test - public void testWithConstruct() { - Future.withConstruct.create(RowCreator.getRow()); - assertEquals(Future.withConstruct.select(), "select id,memo,target,start,expires,construct from authz.future"); - } @Test public void testDelayedDeleteWithDryRun() { diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_UserRole.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_UserRole.java index 6b7011c6..5b20ce22 100644 --- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_UserRole.java +++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_UserRole.java @@ -36,7 +36,6 @@ import org.junit.Test; import org.onap.aaf.auth.batch.actions.URDelete; import org.onap.aaf.auth.batch.helpers.Creator; import org.onap.aaf.auth.batch.helpers.UserRole; -import org.onap.aaf.auth.batch.helpers.creators.RowCreator; import org.onap.aaf.auth.dao.cass.UserRoleDAO; import org.onap.aaf.auth.env.AuthzTrans; import org.onap.aaf.misc.env.Env; @@ -153,11 +152,6 @@ public class JU_UserRole { userRole.actuateDeletionNow(trans, urd); } - @Test - public void testV2() { - UserRole.v2_0_11.create(RowCreator.getRow()); - assertEquals("select user,role,ns,rname,expires from authz.user_role", UserRole.v2_0_11.select()); - } @Test public void testLoad() { @@ -176,11 +170,6 @@ public class JU_UserRole { when(session.execute(any(SimpleStatement.class))).thenReturn(results); when(results.iterator()).thenReturn(rows.iterator()); - List<Row> list = new ArrayList<Row>(); - list.add(RowCreator.getRow()); - list.add(RowCreator.getRow()); - - UserRole.load(trans, session, creator, new UserRole.DataLoadVisitor()); } } diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_NotificationTest.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_NotificationTest.java index 79e4168e..f1cba0b7 100644 --- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_NotificationTest.java +++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/test/JU_NotificationTest.java @@ -33,7 +33,6 @@ import org.onap.aaf.auth.batch.actions.Message; import org.onap.aaf.auth.batch.helpers.Creator; import org.onap.aaf.auth.batch.helpers.Notification; import org.onap.aaf.auth.batch.helpers.Notification.TYPE; -import org.onap.aaf.auth.batch.helpers.creators.RowCreator; import org.onap.aaf.auth.env.AuthzTrans; import org.onap.aaf.misc.env.Env; import org.onap.aaf.misc.env.LogTarget; @@ -73,8 +72,6 @@ public class JU_NotificationTest { assertTrue(notification.update(trans, null, true)); assertTrue(notification.toString().contains("\"user\",\"CN\",")); - Notification.v2_0_18.create(RowCreator.getRow()); - assertEquals(Notification.v2_0_18.select(), "SELECT user,type,last,checksum FROM authz.notify LIMIT 100000"); } }
\ No newline at end of file |