use of com.yahoo.athenz.zms.Policy in project athenz by yahoo.
the class JDBCConnectionTest method testInsertPolicy.
@Test
public void testInsertPolicy() throws Exception {
JDBCConnection jdbcConn = new JDBCConnection(mockConn, true);
Policy policy = new Policy().setName("my-domain:policy.policy1");
Mockito.doReturn(1).when(mockPrepStmt).executeUpdate();
Mockito.when(mockResultSet.next()).thenReturn(true);
// return domain id
Mockito.doReturn(5).when(mockResultSet).getInt(1);
boolean requestSuccess = jdbcConn.insertPolicy("my-domain", policy);
assertTrue(requestSuccess);
Mockito.verify(mockPrepStmt, times(1)).setString(1, "my-domain");
Mockito.verify(mockPrepStmt, times(1)).setString(1, "policy1");
Mockito.verify(mockPrepStmt, times(1)).setInt(2, 5);
jdbcConn.close();
}
Aggregations