diff options
author | Instrumental <jonathan.gathman@att.com> | 2019-08-07 13:40:39 -0500 |
---|---|---|
committer | Instrumental <jonathan.gathman@att.com> | 2019-08-07 13:40:42 -0500 |
commit | 3d1706fcbe7f95830ff6fd23cf679ee55c6d0595 (patch) | |
tree | ff97f10380a44d9f81d536c066782af10f728687 /auth/auth-batch/src/test | |
parent | 321dce367d74092a0ba09930c3aa526abdbd5da8 (diff) |
Remove Tabs, per Jococo
Issue-ID: AAF-932
Change-Id: I3ab0ebcc082048d2d1424a58a90ea479fb005ee6
Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'auth/auth-batch/src/test')
7 files changed, 956 insertions, 956 deletions
diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_ApprovalSetTest.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_ApprovalSetTest.java index fe7bd6c5..10f7a2be 100644 --- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_ApprovalSetTest.java +++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/approvalsets/JU_ApprovalSetTest.java @@ -56,95 +56,95 @@ import com.datastax.driver.core.Session; public class JU_ApprovalSetTest { - @Mock + @Mock AuthzTrans trans; - @Mock - Cluster cluster; - @Mock - PropAccess access; - - @Mock - ApprovalSet actionObj; + @Mock + Cluster cluster; + @Mock + PropAccess access; + + @Mock + ApprovalSet actionObj; - @Mock - DataView dv; + @Mock + DataView dv; @Before public void setUp() throws APIException, IOException { - initMocks(this); - Session sessionObj=Mockito.mock(Session.class); - PreparedStatement psObj =Mockito.mock(PreparedStatement.class); - try { - Mockito.doReturn(Mockito.mock(LogTarget.class)).when(trans).init(); - Mockito.doReturn(Mockito.mock(LogTarget.class)).when(trans).warn(); - Mockito.doReturn(Mockito.mock(LogTarget.class)).when(trans).debug(); - Mockito.doReturn("10").when(trans).getProperty(Config.AAF_USER_EXPIRES, Config.AAF_USER_EXPIRES_DEF); - Mockito.doReturn(Mockito.mock(TimeTaken.class)).when(trans).start(Mockito.anyString(),Mockito.anyInt()); - Mockito.doReturn(sessionObj).when(cluster).connect("authz"); - Mockito.doReturn(psObj).when(sessionObj).prepare(Mockito.anyString()); - - Mockito.doReturn(Mockito.mock(ColumnDefinitions.class)).when(psObj).getVariables(); - Mockito.doReturn(Mockito.mock(PreparedId.class)).when(psObj).getPreparedId(); - Mockito.doReturn(Mockito.mock(Properties.class)).when(access).getProperties(); - Mockito.doReturn("test.test").when(access).getProperty(Config.AAF_ROOT_NS,"org.osaaf.aaf"); - Define.set(access); - GregorianCalendar start= new GregorianCalendar(); - actionObj = new ApprovalSet(start, "test", dv); - } catch (CadiException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + initMocks(this); + Session sessionObj=Mockito.mock(Session.class); + PreparedStatement psObj =Mockito.mock(PreparedStatement.class); + try { + Mockito.doReturn(Mockito.mock(LogTarget.class)).when(trans).init(); + Mockito.doReturn(Mockito.mock(LogTarget.class)).when(trans).warn(); + Mockito.doReturn(Mockito.mock(LogTarget.class)).when(trans).debug(); + Mockito.doReturn("10").when(trans).getProperty(Config.AAF_USER_EXPIRES, Config.AAF_USER_EXPIRES_DEF); + Mockito.doReturn(Mockito.mock(TimeTaken.class)).when(trans).start(Mockito.anyString(),Mockito.anyInt()); + Mockito.doReturn(sessionObj).when(cluster).connect("authz"); + Mockito.doReturn(psObj).when(sessionObj).prepare(Mockito.anyString()); + + Mockito.doReturn(Mockito.mock(ColumnDefinitions.class)).when(psObj).getVariables(); + Mockito.doReturn(Mockito.mock(PreparedId.class)).when(psObj).getPreparedId(); + Mockito.doReturn(Mockito.mock(Properties.class)).when(access).getProperties(); + Mockito.doReturn("test.test").when(access).getProperty(Config.AAF_ROOT_NS,"org.osaaf.aaf"); + Define.set(access); + GregorianCalendar start= new GregorianCalendar(); + actionObj = new ApprovalSet(start, "test", dv); + } catch (CadiException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } @Test - public void testPuntDate() { - actionObj.write(trans); - ApprovalDAO.Data dataObj = new ApprovalDAO.Data(); - - Result<FutureDAO.Data> rs1 = new Result<FutureDAO.Data>(null,0,"test",new Object[0]); - Mockito.doReturn(rs1).when(dv).insert(Mockito.any(AuthzTrans.class), Mockito.any(FutureDAO.Data.class)); - Mockito.doReturn(rs1).when(dv).insert(Mockito.any(AuthzTrans.class), Mockito.any(ApprovalDAO.Data.class)); - actionObj.ladd.add(dataObj); - Result<Void> retVal = actionObj.write(trans); - - rs1 = new Result<FutureDAO.Data>(null,1,"test",new Object[0]); - Mockito.doReturn(rs1).when(dv).insert(Mockito.any(AuthzTrans.class), Mockito.any(ApprovalDAO.Data.class)); - retVal = actionObj.write(trans); - assertTrue("Security - test".equals(retVal.details)); - - actionObj.ladd.add(dataObj); - retVal = actionObj.write(trans); - assertTrue(retVal.details.contains("Security - test")); + public void testPuntDate() { + actionObj.write(trans); + ApprovalDAO.Data dataObj = new ApprovalDAO.Data(); + + Result<FutureDAO.Data> rs1 = new Result<FutureDAO.Data>(null,0,"test",new Object[0]); + Mockito.doReturn(rs1).when(dv).insert(Mockito.any(AuthzTrans.class), Mockito.any(FutureDAO.Data.class)); + Mockito.doReturn(rs1).when(dv).insert(Mockito.any(AuthzTrans.class), Mockito.any(ApprovalDAO.Data.class)); + actionObj.ladd.add(dataObj); + Result<Void> retVal = actionObj.write(trans); + + rs1 = new Result<FutureDAO.Data>(null,1,"test",new Object[0]); + Mockito.doReturn(rs1).when(dv).insert(Mockito.any(AuthzTrans.class), Mockito.any(ApprovalDAO.Data.class)); + retVal = actionObj.write(trans); + assertTrue("Security - test".equals(retVal.details)); + + actionObj.ladd.add(dataObj); + retVal = actionObj.write(trans); + assertTrue(retVal.details.contains("Security - test")); - Mockito.doReturn(rs1).when(dv).insert(Mockito.any(AuthzTrans.class), Mockito.any(FutureDAO.Data.class)); - retVal = actionObj.write(trans); - assertTrue(retVal.details.contains("Security - test")); - - actionObj.setConstruct(null); - actionObj.setExpires(new GregorianCalendar()); - actionObj.setMemo(""); - actionObj.ladd = null; - actionObj.write(trans); - } + Mockito.doReturn(rs1).when(dv).insert(Mockito.any(AuthzTrans.class), Mockito.any(FutureDAO.Data.class)); + retVal = actionObj.write(trans); + assertTrue(retVal.details.contains("Security - test")); + + actionObj.setConstruct(null); + actionObj.setExpires(new GregorianCalendar()); + actionObj.setMemo(""); + actionObj.ladd = null; + actionObj.write(trans); + } @Test - public void testHasApprovals() { - assertFalse(actionObj.hasApprovals()); - - ApprovalDAO.Data dataObj = new ApprovalDAO.Data(); - actionObj.ladd.add(dataObj); - assertTrue(actionObj.hasApprovals()); + public void testHasApprovals() { + assertFalse(actionObj.hasApprovals()); + + ApprovalDAO.Data dataObj = new ApprovalDAO.Data(); + actionObj.ladd.add(dataObj); + assertTrue(actionObj.hasApprovals()); } @Test - public void testApprovers() { - Set<String> retVal = actionObj.approvers(); - assertTrue(retVal.size() == 0); - - ApprovalDAO.Data dataObj = new ApprovalDAO.Data(); - actionObj.ladd.add(dataObj); - retVal = actionObj.approvers(); - assertTrue(retVal.size() == 1); - + public void testApprovers() { + Set<String> retVal = actionObj.approvers(); + assertTrue(retVal.size() == 0); + + ApprovalDAO.Data dataObj = new ApprovalDAO.Data(); + actionObj.ladd.add(dataObj); + retVal = actionObj.approvers(); + assertTrue(retVal.size() == 1); + } } diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/creators/RowCreator.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/creators/RowCreator.java index 6902a426..96ac3844 100644 --- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/creators/RowCreator.java +++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/creators/RowCreator.java @@ -41,395 +41,395 @@ import com.google.common.reflect.TypeToken; public class RowCreator { - public static Row getRow() { - Row row = new Row() { - - @Override - public boolean isNull(int i) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean getBool(int i) { - // TODO Auto-generated method stub - return false; - } - - @Override - public byte getByte(int i) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public short getShort(int i) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getInt(int i) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public long getLong(int i) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public Date getTimestamp(int i) { - // TODO Auto-generated method stub - return null; - } - - @Override - public LocalDate getDate(int i) { - // TODO Auto-generated method stub - return null; - } - - @Override - public long getTime(int i) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public float getFloat(int i) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public double getDouble(int i) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public ByteBuffer getBytesUnsafe(int i) { - // TODO Auto-generated method stub - return null; - } - - @Override - public ByteBuffer getBytes(int i) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getString(int i) { - // TODO Auto-generated method stub - return null; - } - - @Override - public BigInteger getVarint(int i) { - // TODO Auto-generated method stub - return null; - } - - @Override - public BigDecimal getDecimal(int i) { - // TODO Auto-generated method stub - return null; - } - - @Override - public UUID getUUID(int i) { - // TODO Auto-generated method stub - return null; - } - - @Override - public InetAddress getInet(int i) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <T> List<T> getList(int i, Class<T> elementsClass) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <T> List<T> getList(int i, TypeToken<T> elementsType) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <T> Set<T> getSet(int i, Class<T> elementsClass) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <T> Set<T> getSet(int i, TypeToken<T> elementsType) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <K, V> Map<K, V> getMap(int i, Class<K> keysClass, Class<V> valuesClass) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <K, V> Map<K, V> getMap(int i, TypeToken<K> keysType, TypeToken<V> valuesType) { - // TODO Auto-generated method stub - return null; - } - - @Override - public UDTValue getUDTValue(int i) { - // TODO Auto-generated method stub - return null; - } - - @Override - public TupleValue getTupleValue(int i) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Object getObject(int i) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <T> T get(int i, Class<T> targetClass) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <T> T get(int i, TypeToken<T> targetType) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <T> T get(int i, TypeCodec<T> codec) { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean isNull(String name) { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean getBool(String name) { - // TODO Auto-generated method stub - return false; - } - - @Override - public byte getByte(String name) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public short getShort(String name) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getInt(String name) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public long getLong(String name) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public Date getTimestamp(String name) { - // TODO Auto-generated method stub - return null; - } - - @Override - public LocalDate getDate(String name) { - // TODO Auto-generated method stub - return null; - } - - @Override - public long getTime(String name) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public float getFloat(String name) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public double getDouble(String name) { - // TODO Auto-generated method stub - return 0; - } - - @Override - public ByteBuffer getBytesUnsafe(String name) { - // TODO Auto-generated method stub - return null; - } - - @Override - public ByteBuffer getBytes(String name) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getString(String name) { - // TODO Auto-generated method stub - return null; - } - - @Override - public BigInteger getVarint(String name) { - // TODO Auto-generated method stub - return null; - } - - @Override - public BigDecimal getDecimal(String name) { - // TODO Auto-generated method stub - return null; - } - - @Override - public UUID getUUID(String name) { - // TODO Auto-generated method stub - return null; - } - - @Override - public InetAddress getInet(String name) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <T> List<T> getList(String name, Class<T> elementsClass) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <T> List<T> getList(String name, TypeToken<T> elementsType) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <T> Set<T> getSet(String name, Class<T> elementsClass) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <T> Set<T> getSet(String name, TypeToken<T> elementsType) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <K, V> Map<K, V> getMap(String name, Class<K> keysClass, Class<V> valuesClass) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <K, V> Map<K, V> getMap(String name, TypeToken<K> keysType, TypeToken<V> valuesType) { - // TODO Auto-generated method stub - return null; - } - - @Override - public UDTValue getUDTValue(String name) { - // TODO Auto-generated method stub - return null; - } - - @Override - public TupleValue getTupleValue(String name) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Object getObject(String name) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <T> T get(String name, Class<T> targetClass) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <T> T get(String name, TypeToken<T> targetType) { - // TODO Auto-generated method stub - return null; - } - - @Override - public <T> T get(String name, TypeCodec<T> codec) { - // TODO Auto-generated method stub - return null; - } - - @Override - public ColumnDefinitions getColumnDefinitions() { - // TODO Auto-generated method stub - return null; - } - - @Override - public Token getToken(int i) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Token getToken(String name) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Token getPartitionKeyToken() { - // TODO Auto-generated method stub - return null; - } - - }; - return row; - } + public static Row getRow() { + Row row = new Row() { + + @Override + public boolean isNull(int i) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean getBool(int i) { + // TODO Auto-generated method stub + return false; + } + + @Override + public byte getByte(int i) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public short getShort(int i) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getInt(int i) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public long getLong(int i) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public Date getTimestamp(int i) { + // TODO Auto-generated method stub + return null; + } + + @Override + public LocalDate getDate(int i) { + // TODO Auto-generated method stub + return null; + } + + @Override + public long getTime(int i) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public float getFloat(int i) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public double getDouble(int i) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public ByteBuffer getBytesUnsafe(int i) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ByteBuffer getBytes(int i) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getString(int i) { + // TODO Auto-generated method stub + return null; + } + + @Override + public BigInteger getVarint(int i) { + // TODO Auto-generated method stub + return null; + } + + @Override + public BigDecimal getDecimal(int i) { + // TODO Auto-generated method stub + return null; + } + + @Override + public UUID getUUID(int i) { + // TODO Auto-generated method stub + return null; + } + + @Override + public InetAddress getInet(int i) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <T> List<T> getList(int i, Class<T> elementsClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <T> List<T> getList(int i, TypeToken<T> elementsType) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <T> Set<T> getSet(int i, Class<T> elementsClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <T> Set<T> getSet(int i, TypeToken<T> elementsType) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <K, V> Map<K, V> getMap(int i, Class<K> keysClass, Class<V> valuesClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <K, V> Map<K, V> getMap(int i, TypeToken<K> keysType, TypeToken<V> valuesType) { + // TODO Auto-generated method stub + return null; + } + + @Override + public UDTValue getUDTValue(int i) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TupleValue getTupleValue(int i) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Object getObject(int i) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <T> T get(int i, Class<T> targetClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <T> T get(int i, TypeToken<T> targetType) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <T> T get(int i, TypeCodec<T> codec) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean isNull(String name) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean getBool(String name) { + // TODO Auto-generated method stub + return false; + } + + @Override + public byte getByte(String name) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public short getShort(String name) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getInt(String name) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public long getLong(String name) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public Date getTimestamp(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public LocalDate getDate(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public long getTime(String name) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public float getFloat(String name) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public double getDouble(String name) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public ByteBuffer getBytesUnsafe(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ByteBuffer getBytes(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getString(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public BigInteger getVarint(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public BigDecimal getDecimal(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public UUID getUUID(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public InetAddress getInet(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <T> List<T> getList(String name, Class<T> elementsClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <T> List<T> getList(String name, TypeToken<T> elementsType) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <T> Set<T> getSet(String name, Class<T> elementsClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <T> Set<T> getSet(String name, TypeToken<T> elementsType) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <K, V> Map<K, V> getMap(String name, Class<K> keysClass, Class<V> valuesClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <K, V> Map<K, V> getMap(String name, TypeToken<K> keysType, TypeToken<V> valuesType) { + // TODO Auto-generated method stub + return null; + } + + @Override + public UDTValue getUDTValue(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TupleValue getTupleValue(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Object getObject(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <T> T get(String name, Class<T> targetClass) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <T> T get(String name, TypeToken<T> targetType) { + // TODO Auto-generated method stub + return null; + } + + @Override + public <T> T get(String name, TypeCodec<T> codec) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ColumnDefinitions getColumnDefinitions() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Token getToken(int i) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Token getToken(String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Token getPartitionKeyToken() { + // TODO Auto-generated method stub + return null; + } + + }; + return row; + } } 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 8fa20ef1..1b41f9ee 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 @@ -42,173 +42,173 @@ import junit.framework.Assert; public class JU_Approval { - Approval approval; - UUID id; - UUID ticket; - - - @Before - public void setUp() { - id = new UUID(0, 0); - ticket = new UUID(0, 0); - - approval = new Approval(id, ticket, "approver","user", "memo", "operation", "status", "type", 100l); - } - - @Test - public void testRoleFromMemo() { - Assert.assertNull(Approval.roleFromMemo(null)); - Assert.assertEquals("org.onap.ns.admin", - Approval.roleFromMemo(Approval.RE_VALIDATE_ADMIN + "org.onap.ns]")); - Assert.assertEquals("org.onap.ns.owner", Approval.roleFromMemo(Approval.RE_VALIDATE_OWNER + "org.onap.ns]")); - Assert.assertEquals("org.onap.ns.member", Approval.roleFromMemo(Approval.RE_APPROVAL_IN_ROLE - + "bob] + [org.onap.ns.member] - Expires 2018-12-25")); - } - - @Test - public void testExpunge() { - approval.expunge(); - } - -// @Test -// public void testGetLast_notified() { -// Assert.assertTrue(approval.getLast_notified() instanceof Date); -// } + Approval approval; + UUID id; + UUID ticket; + + + @Before + public void setUp() { + id = new UUID(0, 0); + ticket = new UUID(0, 0); + + approval = new Approval(id, ticket, "approver","user", "memo", "operation", "status", "type", 100l); + } + + @Test + public void testRoleFromMemo() { + Assert.assertNull(Approval.roleFromMemo(null)); + Assert.assertEquals("org.onap.ns.admin", + Approval.roleFromMemo(Approval.RE_VALIDATE_ADMIN + "org.onap.ns]")); + Assert.assertEquals("org.onap.ns.owner", Approval.roleFromMemo(Approval.RE_VALIDATE_OWNER + "org.onap.ns]")); + Assert.assertEquals("org.onap.ns.member", Approval.roleFromMemo(Approval.RE_APPROVAL_IN_ROLE + + "bob] + [org.onap.ns.member] - Expires 2018-12-25")); + } + + @Test + public void testExpunge() { + approval.expunge(); + } + +// @Test +// public void testGetLast_notified() { +// Assert.assertTrue(approval.getLast_notified() instanceof Date); +// } // -// @Test -// public void testSetLastNotified() { -// approval.setLastNotified(date); -// } - - @Test - public void testGetStatus() { - Assert.assertEquals("status", approval.getStatus()); - } - - @Test - public void testSetStatus() { - approval.setStatus("status"); - } - - @Test - public void testGetId() { - Assert.assertTrue(approval.getId() instanceof UUID); - } - - @Test - public void testGetTicket() { - Assert.assertTrue(approval.getTicket() instanceof UUID); - } - - @Test - public void testGetMemo() { - Assert.assertEquals("memo", approval.getMemo()); - } - - @Test - public void testGetOperation() { - Assert.assertEquals("operation", approval.getOperation()); - } - - @Test - public void testGetType() { - Assert.assertEquals("type", approval.getType()); - } - - @Test - public void testLapsed() { - approval.lapsed(); - } - - @Test - public void testGetRole() { - Assert.assertNull(approval.getRole()); - } - - @Test - public void testToString() { - Assert.assertEquals("user memo", approval.toString()); - } - - @Test - public void testResetLocalData() { - approval.resetLocalData(); - } - - @Test - public void testPendingDelete() { - Assert.assertFalse(approval.pendingDelete(approval)); - } - - @Test - public void testUpdateNonDryRun() { - 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); - } - - @Test - public void testUpdateDryRun() { - 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); - } - - @Test - public void testDelayDeleteDryRun() { - 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); - - List<Approval> list = new ArrayList<Approval>(); - list.add(approval); - Approval.delayDelete(trans, dao, true, list, "text"); - } - - @Test - public void testDelayDeleteNonDryRun() { - 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); - Result<Void> rv = Result.ok(); - when(dao.delete(any(AuthzTrans.class), any(ApprovalDAO.Data.class), any(Boolean.class))).thenReturn(rv); - - List<Approval> list = new ArrayList<Approval>(); - list.add(approval); - Approval.delayDelete(trans, dao, false, list, "text"); - } - - @Test - public void testDelayDeleteResultNotOk() { - 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); - Result<Void> rv = Result.err(new Exception()); - when(dao.delete(any(AuthzTrans.class), any(ApprovalDAO.Data.class), any(Boolean.class))).thenReturn(rv); - - List<Approval> list = new ArrayList<Approval>(); - list.add(approval); - Approval.delayDelete(trans, dao, false, list, "text"); - } +// @Test +// public void testSetLastNotified() { +// approval.setLastNotified(date); +// } + + @Test + public void testGetStatus() { + Assert.assertEquals("status", approval.getStatus()); + } + + @Test + public void testSetStatus() { + approval.setStatus("status"); + } + + @Test + public void testGetId() { + Assert.assertTrue(approval.getId() instanceof UUID); + } + + @Test + public void testGetTicket() { + Assert.assertTrue(approval.getTicket() instanceof UUID); + } + + @Test + public void testGetMemo() { + Assert.assertEquals("memo", approval.getMemo()); + } + + @Test + public void testGetOperation() { + Assert.assertEquals("operation", approval.getOperation()); + } + + @Test + public void testGetType() { + Assert.assertEquals("type", approval.getType()); + } + + @Test + public void testLapsed() { + approval.lapsed(); + } + + @Test + public void testGetRole() { + Assert.assertNull(approval.getRole()); + } + + @Test + public void testToString() { + Assert.assertEquals("user memo", approval.toString()); + } + + @Test + public void testResetLocalData() { + approval.resetLocalData(); + } + + @Test + public void testPendingDelete() { + Assert.assertFalse(approval.pendingDelete(approval)); + } + + @Test + public void testUpdateNonDryRun() { + 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); + } + + @Test + public void testUpdateDryRun() { + 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); + } + + @Test + public void testDelayDeleteDryRun() { + 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); + + List<Approval> list = new ArrayList<Approval>(); + list.add(approval); + Approval.delayDelete(trans, dao, true, list, "text"); + } + + @Test + public void testDelayDeleteNonDryRun() { + 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); + Result<Void> rv = Result.ok(); + when(dao.delete(any(AuthzTrans.class), any(ApprovalDAO.Data.class), any(Boolean.class))).thenReturn(rv); + + List<Approval> list = new ArrayList<Approval>(); + list.add(approval); + Approval.delayDelete(trans, dao, false, list, "text"); + } + + @Test + public void testDelayDeleteResultNotOk() { + 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); + Result<Void> rv = Result.err(new Exception()); + when(dao.delete(any(AuthzTrans.class), any(ApprovalDAO.Data.class), any(Boolean.class))).thenReturn(rv); + + List<Approval> list = new ArrayList<Approval>(); + list.add(approval); + Approval.delayDelete(trans, dao, false, list, "text"); + } } diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_ExpireRange.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_ExpireRange.java index 20d0dcba..81b7c965 100644 --- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_ExpireRange.java +++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_ExpireRange.java @@ -31,42 +31,42 @@ import org.onap.aaf.auth.batch.helpers.ExpireRange; import org.onap.aaf.cadi.PropAccess; public class JU_ExpireRange { - @Test - public void test() { - ExpireRange expRange = new ExpireRange(new PropAccess()); - Date now = expRange.now(); - - Set<String> names=expRange.names(); - assertTrue(names.contains("OneMonth")); - assertTrue(names.contains("OneWeek")); - assertTrue(names.contains("Delete")); - assertFalse(names.contains(null)); - assertFalse(names.contains("bogus")); - - ExpireRange.Range r; - GregorianCalendar gc = new GregorianCalendar(); - String[] all = new String[] {"ur","cred"}; - - // Test 3 weeks prior - gc.setTime(now); - gc.add(GregorianCalendar.WEEK_OF_MONTH,-3); - for(String rs : all) { - r = expRange.getRange(rs, gc.getTime()); - assertNotNull(r); - assertEquals("Delete",r.name()); - } - - // Test 1 week prior - gc.setTime(now); - gc.add(GregorianCalendar.WEEK_OF_MONTH,-1); - for(String rs : all) { - r = expRange.getRange(rs, gc.getTime()); - assertNull(r); - } - - // Test Today - r = expRange.getRange("cred", now); - assertNotNull(r); - } + @Test + public void test() { + ExpireRange expRange = new ExpireRange(new PropAccess()); + Date now = expRange.now(); + + Set<String> names=expRange.names(); + assertTrue(names.contains("OneMonth")); + assertTrue(names.contains("OneWeek")); + assertTrue(names.contains("Delete")); + assertFalse(names.contains(null)); + assertFalse(names.contains("bogus")); + + ExpireRange.Range r; + GregorianCalendar gc = new GregorianCalendar(); + String[] all = new String[] {"ur","cred"}; + + // Test 3 weeks prior + gc.setTime(now); + gc.add(GregorianCalendar.WEEK_OF_MONTH,-3); + for(String rs : all) { + r = expRange.getRange(rs, gc.getTime()); + assertNotNull(r); + assertEquals("Delete",r.name()); + } + + // Test 1 week prior + gc.setTime(now); + gc.add(GregorianCalendar.WEEK_OF_MONTH,-1); + for(String rs : all) { + r = expRange.getRange(rs, gc.getTime()); + assertNull(r); + } + + // Test Today + r = expRange.getRange("cred", now); + assertNotNull(r); + } } 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 e551ce2b..7a94b9f8 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 @@ -51,84 +51,84 @@ import com.datastax.driver.core.SimpleStatement; public class JU_Future { - Future future; - Date start; - Date expires; - ByteBuffer bBuff; - - @Before - public void setUp() { - UUID id = new UUID(0, 0); - start = new Date(); - expires = new Date(); - future = new Future(id, "Re-Validate Ownership for AAF Namespace '\'test\'test", "target", start, expires, - bBuff); - } - - @Test - public void testId() { - Assert.assertTrue(future.id() instanceof UUID); - } - - @Test - public void testMemo() { - Assert.assertEquals("Re-Validate Ownership for AAF Namespace '\'test\'test", future.memo()); - } - - @Test - public void testStart() { - Assert.assertTrue(future.start() instanceof Date); - } - - @Test - public void testExpires() { - Assert.assertTrue(future.expires() instanceof Date); - } - - @Test - public void testTarget() { - Assert.assertEquals("target", future.target()); - } - - @Test - public void testExpunge() { - future.expunge(); - } - - @Test - public void testCompareTo() { - future.compareTo(null); - future.compareTo(future); - } - - @Test - public void testResetLocalData() { - Future.resetLocalData(); - Assert.assertEquals(0, Future.sizeForDeletion()); - Assert.assertEquals(false, Future.pendingDelete(future)); - } - - - @Test - public void testDelayedDeleteWithDryRun() { - AuthzTrans trans = mock(AuthzTrans.class); - LogTarget target = mock(LogTarget.class); - - when(trans.info()).thenReturn(target); - - assertEquals(Result.ok().status, future.delayedDelete(trans, null, true, "text").status); - } - - @Test - public void testDelayedDeleteNonDryRun() { - AuthzTrans trans = mock(AuthzTrans.class); - LogTarget target = mock(LogTarget.class); - FutureDAO fd = mock(FutureDAO.class); - - when(trans.info()).thenReturn(target); - when(fd.delete(any(AuthzTrans.class), any(FutureDAO.Data.class), any(Boolean.class))).thenReturn(Result.ok()); - - assertEquals(Result.ok().status, future.delayedDelete(trans, fd, false, "text").status); - } + Future future; + Date start; + Date expires; + ByteBuffer bBuff; + + @Before + public void setUp() { + UUID id = new UUID(0, 0); + start = new Date(); + expires = new Date(); + future = new Future(id, "Re-Validate Ownership for AAF Namespace '\'test\'test", "target", start, expires, + bBuff); + } + + @Test + public void testId() { + Assert.assertTrue(future.id() instanceof UUID); + } + + @Test + public void testMemo() { + Assert.assertEquals("Re-Validate Ownership for AAF Namespace '\'test\'test", future.memo()); + } + + @Test + public void testStart() { + Assert.assertTrue(future.start() instanceof Date); + } + + @Test + public void testExpires() { + Assert.assertTrue(future.expires() instanceof Date); + } + + @Test + public void testTarget() { + Assert.assertEquals("target", future.target()); + } + + @Test + public void testExpunge() { + future.expunge(); + } + + @Test + public void testCompareTo() { + future.compareTo(null); + future.compareTo(future); + } + + @Test + public void testResetLocalData() { + Future.resetLocalData(); + Assert.assertEquals(0, Future.sizeForDeletion()); + Assert.assertEquals(false, Future.pendingDelete(future)); + } + + + @Test + public void testDelayedDeleteWithDryRun() { + AuthzTrans trans = mock(AuthzTrans.class); + LogTarget target = mock(LogTarget.class); + + when(trans.info()).thenReturn(target); + + assertEquals(Result.ok().status, future.delayedDelete(trans, null, true, "text").status); + } + + @Test + public void testDelayedDeleteNonDryRun() { + AuthzTrans trans = mock(AuthzTrans.class); + LogTarget target = mock(LogTarget.class); + FutureDAO fd = mock(FutureDAO.class); + + when(trans.info()).thenReturn(target); + when(fd.delete(any(AuthzTrans.class), any(FutureDAO.Data.class), any(Boolean.class))).thenReturn(Result.ok()); + + assertEquals(Result.ok().status, future.delayedDelete(trans, fd, false, "text").status); + } } diff --git a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_NS.java b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_NS.java index 1208ba92..3d71614b 100644 --- a/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_NS.java +++ b/auth/auth-batch/src/test/java/org/onap/aaf/auth/batch/helpers/test/JU_NS.java @@ -48,112 +48,112 @@ import junit.framework.Assert; public class JU_NS { - NS ns; - NSSplit nSSplit; - - @Before - public void setUp() { - ns = new NS("name", "description", "parent", 1, 1); - nSSplit = new NSSplit("string", 1); - } - - @Test - public void testToString() { - Assert.assertEquals("name", ns.toString()); - } - - @Test - public void testHashCode() { - Assert.assertEquals(3373707, ns.hashCode()); - } - - @Test - public void testEquals() { - Assert.assertEquals(true, ns.equals("name")); - Assert.assertEquals(false, ns.equals("name1")); - } - - @Test - public void testCompareTo() { - NS nsValid = new NS("name", "description", "parent", 1, 1); - Assert.assertEquals(0, ns.compareTo(nsValid)); - - NS nsInvalid = new NS("name1", "description", "parent", 1, 1); - Assert.assertEquals(-1, ns.compareTo(nsInvalid)); - } - - @Test - public void testDeriveParent() { - ns.deriveParent("d.ot.te.d"); - } - - @Test - public void testLoadWithoutNS() { - Trans trans = mock(Trans.class); - Session session = mock(Session.class); - Creator<NS> creator = 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(trans.info()).thenReturn(target); - when(trans.start("Read Namespaces", Env.REMOTE)).thenReturn(tt); - when(trans.start("Load Namespaces", Env.SUB)).thenReturn(tt); - when(session.execute(any(SimpleStatement.class))).thenReturn(results); - when(results.iterator()).thenReturn(rows.iterator()); - when(creator.create(row)).thenReturn(ns); - - NS.load(trans, session, creator); - } - - @Test - public void testLoadOne() { - Trans trans = mock(Trans.class); - Session session = mock(Session.class); - Creator<NS> creator = 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(trans.info()).thenReturn(target); - when(trans.start("Read Namespaces", Env.REMOTE)).thenReturn(tt); - when(trans.start("Load Namespaces", Env.SUB)).thenReturn(tt); - when(session.execute(any(SimpleStatement.class))).thenReturn(results); - when(results.iterator()).thenReturn(rows.iterator()); - when(creator.create(row)).thenReturn(ns); - - NS.loadOne(trans, session, creator, "text"); - } - - @Test - public void testCount() { - Trans trans = mock(Trans.class); - Session session = mock(Session.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(trans.info()).thenReturn(target); - when(trans.start("Count Namespaces", Env.REMOTE)).thenReturn(tt); - when(session.execute(any(SimpleStatement.class))).thenReturn(results); - when(results.one()).thenReturn(row); - - assertEquals(0, NS.count(trans, session)); - } - - @Test - public void testV2() { - NS.v2_0_11.create(RowCreator.getRow()); - assertEquals(NS.v2_0_11.select(), "SELECT name, description, parent, type, scope FROM authz.ns "); - } + NS ns; + NSSplit nSSplit; + + @Before + public void setUp() { + ns = new NS("name", "description", "parent", 1, 1); + nSSplit = new NSSplit("string", 1); + } + + @Test + public void testToString() { + Assert.assertEquals("name", ns.toString()); + } + + @Test + public void testHashCode() { + Assert.assertEquals(3373707, ns.hashCode()); + } + + @Test + public void testEquals() { + Assert.assertEquals(true, ns.equals("name")); + Assert.assertEquals(false, ns.equals("name1")); + } + + @Test + public void testCompareTo() { + NS nsValid = new NS("name", "description", "parent", 1, 1); + Assert.assertEquals(0, ns.compareTo(nsValid)); + + NS nsInvalid = new NS("name1", "description", "parent", 1, 1); + Assert.assertEquals(-1, ns.compareTo(nsInvalid)); + } + + @Test + public void testDeriveParent() { + ns.deriveParent("d.ot.te.d"); + } + + @Test + public void testLoadWithoutNS() { + Trans trans = mock(Trans.class); + Session session = mock(Session.class); + Creator<NS> creator = 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(trans.info()).thenReturn(target); + when(trans.start("Read Namespaces", Env.REMOTE)).thenReturn(tt); + when(trans.start("Load Namespaces", Env.SUB)).thenReturn(tt); + when(session.execute(any(SimpleStatement.class))).thenReturn(results); + when(results.iterator()).thenReturn(rows.iterator()); + when(creator.create(row)).thenReturn(ns); + + NS.load(trans, session, creator); + } + + @Test + public void testLoadOne() { + Trans trans = mock(Trans.class); + Session session = mock(Session.class); + Creator<NS> creator = 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(trans.info()).thenReturn(target); + when(trans.start("Read Namespaces", Env.REMOTE)).thenReturn(tt); + when(trans.start("Load Namespaces", Env.SUB)).thenReturn(tt); + when(session.execute(any(SimpleStatement.class))).thenReturn(results); + when(results.iterator()).thenReturn(rows.iterator()); + when(creator.create(row)).thenReturn(ns); + + NS.loadOne(trans, session, creator, "text"); + } + + @Test + public void testCount() { + Trans trans = mock(Trans.class); + Session session = mock(Session.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(trans.info()).thenReturn(target); + when(trans.start("Count Namespaces", Env.REMOTE)).thenReturn(tt); + when(session.execute(any(SimpleStatement.class))).thenReturn(results); + when(results.one()).thenReturn(row); + + assertEquals(0, NS.count(trans, session)); + } + + @Test + public void testV2() { + NS.v2_0_11.create(RowCreator.getRow()); + assertEquals(NS.v2_0_11.select(), "SELECT name, description, parent, type, scope FROM authz.ns "); + } } 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 ab531e90..50833d0f 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 @@ -49,106 +49,106 @@ import junit.framework.Assert; public class JU_UserRole { - UserRole userRole; - UserRole userRole1; - Date date; - PrintStream ds; - - @Before - public void setUp() { - date = new Date(); - userRole = new UserRole("user", "ns", "rname", date); - userRole = new UserRole("user", "role", "ns", "rname", date); - } - - @Test - public void testTotalLoaded() { - Assert.assertEquals(0, userRole.totalLoaded()); - } - - @Test - public void testDeleted() { - Assert.assertEquals(0, userRole.deleted()); - } - - @Test - public void testExpunge() { - userRole.expunge(); - } - - @Test - public void testSetDeleteStream() { - userRole.setDeleteStream(ds); - } - - @Test - public void testSetRecoverStream() { - userRole.setRecoverStream(ds); - } - - @Test - public void testUrdd() { - Assert.assertTrue(userRole.urdd() instanceof UserRoleDAO.Data); - } - - @Test - public void testUser() { - Assert.assertEquals("user", userRole.user()); - } - - @Test - public void testRole() { - Assert.assertEquals("role", userRole.role()); - } - - @Test - public void testNs() { - Assert.assertEquals("ns", userRole.ns()); - } - - @Test - public void testRName() { - Assert.assertEquals("rname", userRole.rname()); - } - - @Test - public void testExpires() { - Assert.assertEquals(date, userRole.expires()); - userRole.expires(date); - } - - @Test - public void testToString() { - Assert.assertTrue(userRole.toString() instanceof String); - } - - @Test - public void testGet() { - userRole.get("u", "r"); - } - - @Test - public void testResetLocalData() { - userRole.resetLocalData(); - } - - @Test - public void testLoad() { - Creator<UserRole> creator = mock(Creator.class); - Trans trans = mock(Trans.class); - Session session = mock(Session.class); - LogTarget target = mock(LogTarget.class); - TimeTaken tt = mock(TimeTaken.class); - ResultSet results = mock(ResultSet.class); - - List<Row> rows = new ArrayList<Row>(); - - when(trans.info()).thenReturn(target); - when(trans.start("Read UserRoles", Env.REMOTE)).thenReturn(tt); - when(trans.start("Load UserRole", Env.SUB)).thenReturn(tt); - when(session.execute(any(SimpleStatement.class))).thenReturn(results); - when(results.iterator()).thenReturn(rows.iterator()); - - } + UserRole userRole; + UserRole userRole1; + Date date; + PrintStream ds; + + @Before + public void setUp() { + date = new Date(); + userRole = new UserRole("user", "ns", "rname", date); + userRole = new UserRole("user", "role", "ns", "rname", date); + } + + @Test + public void testTotalLoaded() { + Assert.assertEquals(0, userRole.totalLoaded()); + } + + @Test + public void testDeleted() { + Assert.assertEquals(0, userRole.deleted()); + } + + @Test + public void testExpunge() { + userRole.expunge(); + } + + @Test + public void testSetDeleteStream() { + userRole.setDeleteStream(ds); + } + + @Test + public void testSetRecoverStream() { + userRole.setRecoverStream(ds); + } + + @Test + public void testUrdd() { + Assert.assertTrue(userRole.urdd() instanceof UserRoleDAO.Data); + } + + @Test + public void testUser() { + Assert.assertEquals("user", userRole.user()); + } + + @Test + public void testRole() { + Assert.assertEquals("role", userRole.role()); + } + + @Test + public void testNs() { + Assert.assertEquals("ns", userRole.ns()); + } + + @Test + public void testRName() { + Assert.assertEquals("rname", userRole.rname()); + } + + @Test + public void testExpires() { + Assert.assertEquals(date, userRole.expires()); + userRole.expires(date); + } + + @Test + public void testToString() { + Assert.assertTrue(userRole.toString() instanceof String); + } + + @Test + public void testGet() { + userRole.get("u", "r"); + } + + @Test + public void testResetLocalData() { + userRole.resetLocalData(); + } + + @Test + public void testLoad() { + Creator<UserRole> creator = mock(Creator.class); + Trans trans = mock(Trans.class); + Session session = mock(Session.class); + LogTarget target = mock(LogTarget.class); + TimeTaken tt = mock(TimeTaken.class); + ResultSet results = mock(ResultSet.class); + + List<Row> rows = new ArrayList<Row>(); + + when(trans.info()).thenReturn(target); + when(trans.start("Read UserRoles", Env.REMOTE)).thenReturn(tt); + when(trans.start("Load UserRole", Env.SUB)).thenReturn(tt); + when(session.execute(any(SimpleStatement.class))).thenReturn(results); + when(results.iterator()).thenReturn(rows.iterator()); + + } } |