use of org.wso2.carbon.apimgt.impl.dao.CertificateMgtDAO in project carbon-apimgt by wso2.
the class CertificateManagerImplTest method init.
@BeforeClass
public static void init() throws XMLStreamException {
PowerMockito.mockStatic(CertificateMgtDAO.class);
certificateMgtDAO = Mockito.mock(CertificateMgtDAO.class);
PowerMockito.when(CertificateMgtDAO.getInstance()).thenReturn(certificateMgtDAO);
System.setProperty("javax.net.ssl.trustStore", CertificateManagerImplTest.class.getClassLoader().getResource("security/client-truststore.jks").getPath());
System.setProperty(JAVAX_NET_SSL_TRUST_STORE_PASSWORD_PROPERTY, JAVAX_SSL_TRUST_STORE_PASSWORD);
TestUtils.initConfigurationContextService(true);
certificateManager = CertificateManagerImpl.getInstance();
System.setProperty(CARBON_HOME, "");
PowerMockito.mockStatic(CarbonContext.class);
CarbonContext carbonContext = Mockito.mock(CarbonContext.class);
PowerMockito.when(CarbonContext.getThreadLocalCarbonContext()).thenReturn(carbonContext);
Mockito.when(carbonContext.getTenantDomain()).thenReturn(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
Mockito.when(carbonContext.getTenantId()).thenReturn(MultitenantConstants.SUPER_TENANT_ID);
}
use of org.wso2.carbon.apimgt.impl.dao.CertificateMgtDAO in project carbon-apimgt by wso2.
the class CertificateMgtDaoTest method setUp.
@Before
public void setUp() throws APIManagerDatabaseException, APIManagementException, SQLException, XMLStreamException, IOException, NamingException {
String dbConfigPath = System.getProperty("APIManagerDBConfigurationPath");
APIManagerConfiguration config = new APIManagerConfiguration();
initializeDatabase(dbConfigPath);
config.load(dbConfigPath);
ServiceReferenceHolder.getInstance().setAPIManagerConfigurationService(new APIManagerConfigurationServiceImpl(config));
APIMgtDBUtil.initialize();
certificateMgtDAO = CertificateMgtDAO.getInstance();
}
Aggregations