Search in sources :

Example 1 with RefactoringQueryServiceImpl

use of org.kie.workbench.common.services.refactoring.backend.server.query.RefactoringQueryServiceImpl in project kie-wb-common by kiegroup.

the class BaseLibraryIndexingTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() throws IOException {
    if (!created) {
        final String repositoryName = getRepositoryName();
        final String path = createTempDirectory().getAbsolutePath();
        System.setProperty("org.uberfire.nio.git.dir", path);
        System.setProperty("org.uberfire.nio.git.daemon.enabled", "false");
        System.setProperty("org.uberfire.nio.git.ssh.enabled", "false");
        System.setProperty("org.uberfire.sys.repo.monitor.disabled", "true");
        System.out.println(".niogit: " + path);
        final URI newRepo = URI.create("git://" + repositoryName);
        try {
            IOService ioService = ioService();
            ioService.newFileSystem(newRepo, new HashMap<>());
            // Don't ask, but we need to write a single file first in order for indexing to work
            basePath = getDirectoryPath().resolveSibling("someNewOtherPath");
            ioService().write(basePath.resolve("dummy"), "<none>");
        } catch (final Exception e) {
            e.printStackTrace();
            logger.warn("Failed to initialize IOService instance: " + e.getClass().getSimpleName() + ": " + e.getMessage(), e);
        } finally {
            created = true;
        }
        final Instance<NamedQuery> namedQueriesProducer = mock(Instance.class);
        when(namedQueriesProducer.iterator()).thenReturn(getQueries().iterator());
        service = new RefactoringQueryServiceImpl(config, new NamedQueries(namedQueriesProducer));
        service.init();
    }
}
Also used : IOService(org.uberfire.io.IOService) NamedQueries(org.kie.workbench.common.services.refactoring.backend.server.query.NamedQueries) NamedQuery(org.kie.workbench.common.services.refactoring.backend.server.query.NamedQuery) URI(java.net.URI) IOException(java.io.IOException) RefactoringQueryServiceImpl(org.kie.workbench.common.services.refactoring.backend.server.query.RefactoringQueryServiceImpl) Before(org.junit.Before)

Example 2 with RefactoringQueryServiceImpl

use of org.kie.workbench.common.services.refactoring.backend.server.query.RefactoringQueryServiceImpl in project kie-wb-common by kiegroup.

the class BaseIndexingTest method setup.

@Before
public void setup() throws IOException {
    if (!created) {
        final String repositoryName = getRepositoryName();
        final String path = createTempDirectory().getAbsolutePath();
        System.setProperty("org.uberfire.nio.git.dir", path);
        System.setProperty("org.uberfire.nio.git.daemon.enabled", "false");
        System.setProperty("org.uberfire.nio.git.ssh.enabled", "false");
        System.setProperty("org.uberfire.sys.repo.monitor.disabled", "true");
        System.out.println(".niogit: " + path);
        final URI newRepo = URI.create("git://" + repositoryName);
        try {
            IOService ioService = ioService();
            ioService.newFileSystem(newRepo, new HashMap<String, Object>());
            // Don't ask, but we need to write a single file first in order for indexing to work
            basePath = getDirectoryPath().resolveSibling("someNewOtherPath");
            ioService().write(basePath.resolve("dummy"), "<none>");
        } catch (final Exception e) {
            e.printStackTrace();
            logger.warn("Failed to initialize IOService instance: " + e.getClass().getSimpleName() + ": " + e.getMessage(), e);
        } finally {
            created = true;
        }
        final Instance<NamedQuery> namedQueriesProducer = mock(Instance.class);
        when(namedQueriesProducer.iterator()).thenReturn(getQueries().iterator());
        service = new RefactoringQueryServiceImpl(getConfig(), new NamedQueries(namedQueriesProducer));
        service.init();
    }
}
Also used : IOService(org.uberfire.io.IOService) NamedQueries(org.kie.workbench.common.services.refactoring.backend.server.query.NamedQueries) NamedQuery(org.kie.workbench.common.services.refactoring.backend.server.query.NamedQuery) URI(java.net.URI) IOException(java.io.IOException) RefactoringQueryServiceImpl(org.kie.workbench.common.services.refactoring.backend.server.query.RefactoringQueryServiceImpl) Before(org.junit.Before)

Aggregations

IOException (java.io.IOException)2 URI (java.net.URI)2 Before (org.junit.Before)2 NamedQueries (org.kie.workbench.common.services.refactoring.backend.server.query.NamedQueries)2 NamedQuery (org.kie.workbench.common.services.refactoring.backend.server.query.NamedQuery)2 RefactoringQueryServiceImpl (org.kie.workbench.common.services.refactoring.backend.server.query.RefactoringQueryServiceImpl)2 IOService (org.uberfire.io.IOService)2