Search in sources :

Example 1 with IndexingManager

use of org.wso2.carbon.registry.indexing.IndexingManager in project carbon-apimgt by wso2.

the class CustomAPIIndexerTest method init.

@Before
public void init() throws RegistryException {
    PowerMockito.mockStatic(GovernanceUtils.class);
    PowerMockito.mockStatic(IndexingManager.class);
    IndexingManager indexingManager = Mockito.mock(IndexingManager.class);
    PowerMockito.when(IndexingManager.getInstance()).thenReturn(indexingManager);
    userRegistry = Mockito.mock(UserRegistry.class);
    Mockito.doReturn(userRegistry).when(indexingManager).getRegistry(Mockito.anyInt());
    Mockito.doReturn(true).when(userRegistry).resourceExists(Mockito.anyString());
    PowerMockito.when(GovernanceUtils.getGovernanceSystemRegistry(userRegistry)).thenReturn(userRegistry);
    String path = RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + "/api";
    file2Index = new AsyncIndexer.File2Index("".getBytes(), null, path, -1234, "");
    indexer = new CustomAPIIndexer();
}
Also used : IndexingManager(org.wso2.carbon.registry.indexing.IndexingManager) AsyncIndexer(org.wso2.carbon.registry.indexing.AsyncIndexer) UserRegistry(org.wso2.carbon.registry.core.session.UserRegistry) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 UserRegistry (org.wso2.carbon.registry.core.session.UserRegistry)1 AsyncIndexer (org.wso2.carbon.registry.indexing.AsyncIndexer)1 IndexingManager (org.wso2.carbon.registry.indexing.IndexingManager)1