Search in sources :

Example 1 with ExecutorService

use of no.cantara.docsite.executor.ExecutorService in project SourceCodePortal by Cantara.

the class Application method initialize.

public static Application initialize(DynamicConfiguration configuration, int port) {
    String host = configuration.evaluateToString("http.host");
    CacheStore cacheStore = CacheInitializer.initialize(configuration);
    ExecutorService executorService = ExecutorService.create();
    ScheduledExecutorService scheduledExecutorService = ScheduledExecutorService.create(configuration, executorService, cacheStore);
    RepositoryConfigLoader configLoader = new RepositoryConfigLoader(configuration, cacheStore);
    ApplicationController applicationController = new ApplicationController(configuration.evaluateToString("http.cors.allow.origin"), configuration.evaluateToString("http.cors.allow.header"), configuration.evaluateToBoolean("http.cors.allow.origin.test"), port, configuration, executorService, scheduledExecutorService, cacheStore);
    return new Application(configuration, host, port, executorService, scheduledExecutorService, cacheStore, configLoader, applicationController);
}
Also used : ScheduledExecutorService(no.cantara.docsite.executor.ScheduledExecutorService) ApplicationController(no.cantara.docsite.controller.ApplicationController) ScheduledExecutorService(no.cantara.docsite.executor.ScheduledExecutorService) ExecutorService(no.cantara.docsite.executor.ExecutorService) CacheStore(no.cantara.docsite.cache.CacheStore) RepositoryConfigLoader(no.cantara.docsite.domain.config.RepositoryConfigLoader)

Example 2 with ExecutorService

use of no.cantara.docsite.executor.ExecutorService in project SourceCodePortal by Cantara.

the class GitHubPageServiceTest method testName.

@Ignore
// (enabled = false)
@Test
public void testName() {
    ExecutorService executorService = ExecutorService.create();
    executorService.start();
    DynamicConfiguration configuration = configuration();
    CacheStore cacheStore = cacheStore(configuration);
    RepositoryConfigLoader loader = new RepositoryConfigLoader(configuration, cacheStore);
    loader.load();
    cacheStore.getRepositories().forEach(rg -> {
        // TODO lookup CacheGroupKey for CacheKey and pass that to worker task
        // TODO use CacheGroupKey for pages
        // executorService.queue(new FetchPageTask(configuration, executorService, cacheStore, rg.getKey(), rg.getValue().readmeURL));
        LOG.trace("{} - {}", rg.getKey(), rg.getValue().apiReadmeURL.getExternalURL());
    // cacheStore.getReadmeContents().get(cacheStore.getCacheKeys().get(rg.getKey().asCacheKey()));
    });
    executorService.shutdown();
}
Also used : DynamicConfiguration(no.ssb.config.DynamicConfiguration) StoreBasedDynamicConfiguration(no.ssb.config.StoreBasedDynamicConfiguration) ExecutorService(no.cantara.docsite.executor.ExecutorService) CacheStore(no.cantara.docsite.cache.CacheStore) RepositoryConfigLoader(no.cantara.docsite.domain.config.RepositoryConfigLoader) Ignore(org.testng.annotations.Ignore) RepositoryConfigLoaderTest(no.cantara.docsite.domain.config.RepositoryConfigLoaderTest) Test(org.testng.annotations.Test)

Example 3 with ExecutorService

use of no.cantara.docsite.executor.ExecutorService in project SourceCodePortal by Cantara.

the class RepositoryConfigLoaderTest method testRepositoryConfig.

@Test(enabled = false)
public void testRepositoryConfig() throws Exception {
    ExecutorService executorService = ExecutorService.create();
    executorService.start();
    DynamicConfiguration configuration = configuration();
    CacheStore cacheStore = cacheStore(configuration);
    RepositoryConfigLoader service = new RepositoryConfigLoader(configuration, cacheStore);
    service.load();
    assertTrue(cacheStore.getRepositoryGroupsByGroupId("SourceCodePortal-t").size() > 1);
    assertTrue(cacheStore.getRepositoryGroupsByGroupId("Whydah-t").size() > 15);
    LOG.trace(JsonbFactory.prettyPrint(cacheStore.getConfiguredRepositories()));
}
Also used : DynamicConfiguration(no.ssb.config.DynamicConfiguration) StoreBasedDynamicConfiguration(no.ssb.config.StoreBasedDynamicConfiguration) ExecutorService(no.cantara.docsite.executor.ExecutorService) CacheStore(no.cantara.docsite.cache.CacheStore) Test(org.testng.annotations.Test)

Aggregations

CacheStore (no.cantara.docsite.cache.CacheStore)3 ExecutorService (no.cantara.docsite.executor.ExecutorService)3 RepositoryConfigLoader (no.cantara.docsite.domain.config.RepositoryConfigLoader)2 DynamicConfiguration (no.ssb.config.DynamicConfiguration)2 StoreBasedDynamicConfiguration (no.ssb.config.StoreBasedDynamicConfiguration)2 Test (org.testng.annotations.Test)2 ApplicationController (no.cantara.docsite.controller.ApplicationController)1 RepositoryConfigLoaderTest (no.cantara.docsite.domain.config.RepositoryConfigLoaderTest)1 ScheduledExecutorService (no.cantara.docsite.executor.ScheduledExecutorService)1 Ignore (org.testng.annotations.Ignore)1