use of com.yahoo.athenz.zms.store.jdbc.JDBCConnection in project athenz by yahoo.
the class JDBCConnectionTest method testListDomainTemplatesException.
@Test
public void testListDomainTemplatesException() throws Exception {
JDBCConnection jdbcConn = new JDBCConnection(mockConn, true);
Mockito.when(mockPrepStmt.executeQuery()).thenThrow(new SQLException("failed operation", "state", 1001));
try {
jdbcConn.listDomainTemplates("my-domain");
fail();
} catch (Exception ex) {
assertTrue(true);
}
jdbcConn.close();
}
use of com.yahoo.athenz.zms.store.jdbc.JDBCConnection in project athenz by yahoo.
the class JDBCConnectionTest method testVerifyDomainAccountUniquenessPass.
@Test
public void testVerifyDomainAccountUniquenessPass() throws Exception {
Mockito.when(mockResultSet.next()).thenReturn(true).thenReturn(false);
Mockito.doReturn("iaas.athenz").when(mockResultSet).getString(1);
JDBCConnection jdbcConn = new JDBCConnection(mockConn, true);
jdbcConn.verifyDomainAccountUniqueness("iaas.athenz", "12345", "unitTest");
jdbcConn.close();
}
use of com.yahoo.athenz.zms.store.jdbc.JDBCConnection in project athenz by yahoo.
the class JDBCConnectionTest method testDeleteDomainException.
@Test
public void testDeleteDomainException() throws Exception {
JDBCConnection jdbcConn = new JDBCConnection(mockConn, true);
Mockito.when(mockPrepStmt.executeUpdate()).thenThrow(new SQLException("failed operation", "state", 1001));
try {
jdbcConn.deleteDomain("my-domain");
fail();
} catch (Exception ex) {
assertTrue(true);
}
jdbcConn.close();
}
use of com.yahoo.athenz.zms.store.jdbc.JDBCConnection in project athenz by yahoo.
the class JDBCConnectionTest method testUpdateDomainModTimestampException.
@Test
public void testUpdateDomainModTimestampException() throws Exception {
JDBCConnection jdbcConn = new JDBCConnection(mockConn, true);
Mockito.when(mockPrepStmt.executeUpdate()).thenThrow(new SQLException("failed operation", "state", 1001));
try {
jdbcConn.updateDomainModTimestamp("my-domain");
fail();
} catch (Exception ex) {
assertTrue(true);
}
jdbcConn.close();
}
use of com.yahoo.athenz.zms.store.jdbc.JDBCConnection in project athenz by yahoo.
the class JDBCConnectionTest method testGetDomainModTimestampFailure.
@Test
public void testGetDomainModTimestampFailure() throws Exception {
Mockito.when(mockResultSet.next()).thenReturn(false);
JDBCConnection jdbcConn = new JDBCConnection(mockConn, true);
long modTime = jdbcConn.getDomainModTimestamp("my-domain");
assertEquals(0, modTime);
Mockito.verify(mockPrepStmt, times(1)).setString(1, "my-domain");
jdbcConn.close();
}
Aggregations