use of org.wso2.carbon.idp.mgt.util.IdPManagementConstants.RESET_PROVISIONING_ENTITIES_ON_CONFIG_UPDATE in project carbon-identity-framework by wso2.
the class IdPManagementDAOTest method testUpdateIdP.
@Test(dataProvider = "updateIdPData")
public void testUpdateIdP(Object oldIdp, Object newIdp, int tenantId) throws Exception {
mockStatic(IdentityDatabaseUtil.class);
mockStatic(IdentityUtil.class);
try (Connection connection = getConnection(DB_NAME)) {
when(IdentityDatabaseUtil.getDBConnection(anyBoolean())).thenReturn(connection);
when(IdentityDatabaseUtil.getDBConnection()).thenReturn(connection);
when(IdentityUtil.getProperty(RESET_PROVISIONING_ENTITIES_ON_CONFIG_UPDATE)).thenReturn("false");
when(IdentityDatabaseUtil.getDataSource()).thenReturn(dataSourceMap.get(DB_NAME));
addTestIdps();
idPManagementDAO.updateIdP((IdentityProvider) newIdp, ((IdentityProvider) oldIdp), tenantId);
String newIdpName = ((IdentityProvider) newIdp).getIdentityProviderName();
IdentityProvider idpResult = idPManagementDAO.getIdPByName(connection, newIdpName, tenantId, TENANT_DOMAIN);
assertEquals(idpResult.getIdentityProviderName(), newIdpName);
}
}
use of org.wso2.carbon.idp.mgt.util.IdPManagementConstants.RESET_PROVISIONING_ENTITIES_ON_CONFIG_UPDATE in project carbon-identity-framework by wso2.
the class IdPManagementDAOTest method testUpdateIdPException.
@Test(dataProvider = "updateIdPData")
public void testUpdateIdPException(Object oldIdp, Object newIdp, int tenantId) throws Exception {
mockStatic(IdentityDatabaseUtil.class);
mockStatic(IdentityUtil.class);
try (Connection connection = getConnection(DB_NAME)) {
when(IdentityDatabaseUtil.getDBConnection(anyBoolean())).thenReturn(connection);
when(IdentityDatabaseUtil.getDBConnection()).thenReturn(connection);
when(IdentityUtil.getProperty(RESET_PROVISIONING_ENTITIES_ON_CONFIG_UPDATE)).thenReturn("false");
assertThrows(IdentityProviderManagementException.class, () -> idPManagementDAO.updateIdP((IdentityProvider) newIdp, ((IdentityProvider) oldIdp), tenantId));
}
}
Aggregations