use of org.wso2.carbon.consent.mgt.core.internal.ConsentManagerComponentDataHolder in project carbon-identity-framework by wso2.
the class SSOConsentServiceImplTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
initiateH2Base();
DataSource dataSource = mock(DataSource.class);
mockStatic(ConsentManagerComponentDataHolder.class);
ConsentManagerComponentDataHolder componentDataHolder = mock(ConsentManagerComponentDataHolder.class);
when(ConsentManagerComponentDataHolder.getInstance()).thenReturn(componentDataHolder);
when(componentDataHolder.getDataSource()).thenReturn(dataSource);
connection = getConnection();
Connection spyConnection = spyConnection(connection);
when(dataSource.getConnection()).thenReturn(spyConnection);
mockStatic(IdentityConfigParser.class);
mockStatic(OMElement.class);
when(IdentityConfigParser.getInstance()).thenReturn(mockConfigParser);
when(IdentityConfigParser.getInstance().getConfigElement(CONFIG_ELEM_CONSENT)).thenReturn(consentElement);
ssoConsentService = new SSOConsentServiceImpl();
String carbonHome = Paths.get(System.getProperty("user.dir"), "target", "test-classes").toString();
System.setProperty(CarbonBaseConstants.CARBON_HOME, carbonHome);
System.setProperty(CarbonBaseConstants.CARBON_CONFIG_DIR_PATH, Paths.get(carbonHome, "conf").toString());
}
Aggregations