Search in sources :

Example 1 with CertificateMgtDAO

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);
}
Also used : CertificateMgtDAO(org.wso2.carbon.apimgt.impl.dao.CertificateMgtDAO) PrivilegedCarbonContext(org.wso2.carbon.context.PrivilegedCarbonContext) CarbonContext(org.wso2.carbon.context.CarbonContext) BeforeClass(org.junit.BeforeClass)

Example 2 with CertificateMgtDAO

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();
}
Also used : APIManagerConfiguration(org.wso2.carbon.apimgt.impl.APIManagerConfiguration) APIManagerConfigurationServiceImpl(org.wso2.carbon.apimgt.impl.APIManagerConfigurationServiceImpl) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 BeforeClass (org.junit.BeforeClass)1 APIManagerConfiguration (org.wso2.carbon.apimgt.impl.APIManagerConfiguration)1 APIManagerConfigurationServiceImpl (org.wso2.carbon.apimgt.impl.APIManagerConfigurationServiceImpl)1 CertificateMgtDAO (org.wso2.carbon.apimgt.impl.dao.CertificateMgtDAO)1 CarbonContext (org.wso2.carbon.context.CarbonContext)1 PrivilegedCarbonContext (org.wso2.carbon.context.PrivilegedCarbonContext)1