Search in sources :

Example 1 with ProjectHandlerRegistry

use of org.eclipse.che.api.project.server.handlers.ProjectHandlerRegistry in project che by eclipse.

the class BaseTest method initProjectApi.

@BeforeClass
protected void initProjectApi() throws Exception {
    JavaPlugin javaPlugin = new JavaPlugin(wsPath + "/set", null, null);
    EventService eventService = new EventService();
    TestWorkspaceHolder workspaceHolder = new TestWorkspaceHolder();
    if (root == null)
        root = new File(wsPath);
    if (root.exists()) {
        IoUtil.deleteRecursive(root);
    }
    root.mkdir();
    File indexDir = new File(INDEX_PATH);
    if (indexDir.exists()) {
        IoUtil.deleteRecursive(indexDir);
    }
    indexDir.mkdir();
    Set<PathMatcher> filters = new HashSet<>();
    filters.add(path -> true);
    FSLuceneSearcherProvider sProvider = new FSLuceneSearcherProvider(indexDir, filters);
    vfsProvider = new LocalVirtualFileSystemProvider(root, sProvider);
    ProjectTypeRegistry projectTypeRegistry = new ProjectTypeRegistry(new HashSet<>());
    projectTypeRegistry.registerProjectType(new JavaProjectType(new JavaValueProviderFactory()));
    projectTypeRegistry.registerProjectType(new PlainJavaProjectType(new PlainJavaValueProviderFactory()));
    ProjectHandlerRegistry projectHandlerRegistry = new ProjectHandlerRegistry(new HashSet<>());
    projectRegistry = new ProjectRegistry(workspaceHolder, vfsProvider, projectTypeRegistry, projectHandlerRegistry, eventService);
    projectRegistry.initProjects();
    ProjectImporterRegistry importerRegistry = new ProjectImporterRegistry(new HashSet<>());
    FileWatcherNotificationHandler fileWatcherNotificationHandler = new DefaultFileWatcherNotificationHandler(vfsProvider);
    FileTreeWatcher fileTreeWatcher = new FileTreeWatcher(root, new HashSet<>(), fileWatcherNotificationHandler);
    projectManager = new ProjectManager(vfsProvider, projectTypeRegistry, projectRegistry, projectHandlerRegistry, importerRegistry, fileWatcherNotificationHandler, fileTreeWatcher, new TestWorkspaceHolder(new ArrayList<>()), mock(FileWatcherManager.class));
    ResourcesPlugin plugin = new ResourcesPlugin("target/index", wsPath, () -> projectRegistry, () -> projectManager);
    plugin.start();
    javaPlugin.start();
}
Also used : ProjectTypeRegistry(org.eclipse.che.api.project.server.type.ProjectTypeRegistry) ProjectHandlerRegistry(org.eclipse.che.api.project.server.handlers.ProjectHandlerRegistry) PlainJavaProjectType(org.eclipse.che.plugin.java.plain.server.projecttype.PlainJavaProjectType) JavaValueProviderFactory(org.eclipse.che.plugin.java.server.projecttype.JavaValueProviderFactory) PlainJavaValueProviderFactory(org.eclipse.che.plugin.java.plain.server.projecttype.PlainJavaValueProviderFactory) FileWatcherNotificationHandler(org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationHandler) DefaultFileWatcherNotificationHandler(org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler) ProjectImporterRegistry(org.eclipse.che.api.project.server.importer.ProjectImporterRegistry) JavaPlugin(org.eclipse.jdt.internal.ui.JavaPlugin) LocalVirtualFileSystemProvider(org.eclipse.che.api.vfs.impl.file.LocalVirtualFileSystemProvider) EventService(org.eclipse.che.api.core.notification.EventService) ProjectManager(org.eclipse.che.api.project.server.ProjectManager) PathMatcher(java.nio.file.PathMatcher) DefaultFileWatcherNotificationHandler(org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler) ResourcesPlugin(org.eclipse.core.resources.ResourcesPlugin) PlainJavaValueProviderFactory(org.eclipse.che.plugin.java.plain.server.projecttype.PlainJavaValueProviderFactory) ProjectRegistry(org.eclipse.che.api.project.server.ProjectRegistry) FileTreeWatcher(org.eclipse.che.api.vfs.impl.file.FileTreeWatcher) File(java.io.File) JavaProjectType(org.eclipse.che.plugin.java.server.projecttype.JavaProjectType) PlainJavaProjectType(org.eclipse.che.plugin.java.plain.server.projecttype.PlainJavaProjectType) HashSet(java.util.HashSet) FSLuceneSearcherProvider(org.eclipse.che.api.vfs.search.impl.FSLuceneSearcherProvider) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with ProjectHandlerRegistry

use of org.eclipse.che.api.project.server.handlers.ProjectHandlerRegistry in project che by eclipse.

the class WsAgentTestBase method setUp.

public void setUp() throws Exception {
    if (workspaceHolder == null)
        workspaceHolder = new TestWorkspaceHolder();
    if (root == null)
        root = new File(FS_PATH);
    if (root.exists()) {
        IoUtil.deleteRecursive(root);
    }
    root.mkdir();
    File indexDir = new File(INDEX_PATH);
    if (indexDir.exists()) {
        IoUtil.deleteRecursive(indexDir);
    }
    indexDir.mkdir();
    Set<PathMatcher> filters = new HashSet<>();
    filters.add(path -> true);
    FSLuceneSearcherProvider sProvider = new FSLuceneSearcherProvider(indexDir, filters);
    vfsProvider = new LocalVirtualFileSystemProvider(root, sProvider);
    projectTypeRegistry = new ProjectTypeRegistry(new HashSet<>());
    projectTypeRegistry.registerProjectType(new PT1());
    projectHandlerRegistry = new ProjectHandlerRegistry(new HashSet<>());
    this.eventService = new EventService();
    projectRegistry = new ProjectRegistry(workspaceHolder, vfsProvider, projectTypeRegistry, projectHandlerRegistry, eventService);
    projectRegistry.initProjects();
    this.importerRegistry = new ProjectImporterRegistry(new HashSet<>());
    fileWatcherNotificationHandler = new DefaultFileWatcherNotificationHandler(vfsProvider);
    fileTreeWatcher = new FileTreeWatcher(root, new HashSet<>(), fileWatcherNotificationHandler);
    fileWatcherManager = mock(FileWatcherManager.class);
    TestWorkspaceHolder wsHolder = new TestWorkspaceHolder();
    pm = new ProjectManager(vfsProvider, projectTypeRegistry, projectRegistry, projectHandlerRegistry, importerRegistry, fileWatcherNotificationHandler, fileTreeWatcher, wsHolder, fileWatcherManager);
    pm.initWatcher();
}
Also used : ProjectTypeRegistry(org.eclipse.che.api.project.server.type.ProjectTypeRegistry) ProjectHandlerRegistry(org.eclipse.che.api.project.server.handlers.ProjectHandlerRegistry) ProjectImporterRegistry(org.eclipse.che.api.project.server.importer.ProjectImporterRegistry) LocalVirtualFileSystemProvider(org.eclipse.che.api.vfs.impl.file.LocalVirtualFileSystemProvider) EventService(org.eclipse.che.api.core.notification.EventService) FileWatcherManager(org.eclipse.che.api.vfs.watcher.FileWatcherManager) PathMatcher(java.nio.file.PathMatcher) DefaultFileWatcherNotificationHandler(org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler) FileTreeWatcher(org.eclipse.che.api.vfs.impl.file.FileTreeWatcher) File(java.io.File) HashSet(java.util.HashSet) FSLuceneSearcherProvider(org.eclipse.che.api.vfs.search.impl.FSLuceneSearcherProvider)

Example 3 with ProjectHandlerRegistry

use of org.eclipse.che.api.project.server.handlers.ProjectHandlerRegistry in project che by eclipse.

the class ProjectManagerReadTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    new File(root, "/fromFolder").mkdir();
    new File(root, "/normal").mkdir();
    new File(root, "/normal/module").mkdir();
    List<ProjectConfig> projects = new ArrayList<>();
    projects.add(DtoFactory.newDto(ProjectConfigDto.class).withPath("/normal").withName("project1Name").withType("primary1"));
    projects.add(DtoFactory.newDto(ProjectConfigDto.class).withPath("/fromConfig").withName("").withType("primary1"));
    projects.add(DtoFactory.newDto(ProjectConfigDto.class).withPath("/normal/module").withName("project1Name").withType("primary1"));
    workspaceHolder = new TestWorkspaceHolder(projects);
    ProjectTypeRegistry projectTypeRegistry = new ProjectTypeRegistry(new HashSet<>());
    projectTypeRegistry.registerProjectType(new PT1());
    projectTypeRegistry.registerProjectType(new PT3());
    ProjectHandlerRegistry projectHandlerRegistry = new ProjectHandlerRegistry(new HashSet<>());
    projectRegistry = new ProjectRegistry(workspaceHolder, vfsProvider, projectTypeRegistry, projectHandlerRegistry, eventService);
    projectRegistry.initProjects();
    pm = new ProjectManager(vfsProvider, projectTypeRegistry, projectRegistry, projectHandlerRegistry, null, fileWatcherNotificationHandler, fileTreeWatcher, workspaceHolder, fileWatcherManager);
    pm.initWatcher();
}
Also used : ProjectConfig(org.eclipse.che.api.core.model.project.ProjectConfig) ProjectTypeRegistry(org.eclipse.che.api.project.server.type.ProjectTypeRegistry) ProjectHandlerRegistry(org.eclipse.che.api.project.server.handlers.ProjectHandlerRegistry) ArrayList(java.util.ArrayList) File(java.io.File) Before(org.junit.Before)

Example 4 with ProjectHandlerRegistry

use of org.eclipse.che.api.project.server.handlers.ProjectHandlerRegistry in project che by eclipse.

the class BaseTest method initProjectApi.

@BeforeMethod
protected void initProjectApi() throws Exception {
    mavenServerManager = new MavenServerManager(mavenServerPath);
    workspaceHolder = new TestWorkspaceHolder();
    if (root == null)
        root = new File(wsPath);
    if (root.exists()) {
        IoUtil.deleteRecursive(root);
    }
    root.mkdir();
    File indexDir = new File(INDEX_PATH);
    if (indexDir.exists()) {
        IoUtil.deleteRecursive(indexDir);
    }
    indexDir.mkdir();
    Set<PathMatcher> filters = new HashSet<>();
    filters.add(path -> true);
    FSLuceneSearcherProvider sProvider = new FSLuceneSearcherProvider(indexDir, filters);
    vfsProvider = new LocalVirtualFileSystemProvider(root, sProvider);
    projectTypeRegistry = new ProjectTypeRegistry(new HashSet<>());
    projectTypeRegistry.registerProjectType(new TestProjectType());
    projectTypeRegistry.registerProjectType(new JavaProjectType(new JavaValueProviderFactory()));
    projectTypeRegistry.registerProjectType(new MavenProjectType(new MavenValueProviderFactory()));
    projectHandlerRegistry = new ProjectHandlerRegistry(new HashSet<>());
    projectRegistry = new ProjectRegistry(workspaceHolder, vfsProvider, projectTypeRegistry, projectHandlerRegistry, eventService);
    projectRegistry.initProjects();
    importerRegistry = new ProjectImporterRegistry(new HashSet<>());
    fileWatcherNotificationHandler = new DefaultFileWatcherNotificationHandler(vfsProvider);
    fileTreeWatcher = new FileTreeWatcher(root, new HashSet<>(), fileWatcherNotificationHandler);
    pm = new ProjectManager(vfsProvider, projectTypeRegistry, projectRegistry, projectHandlerRegistry, importerRegistry, fileWatcherNotificationHandler, fileTreeWatcher, new TestWorkspaceHolder(new ArrayList<>()), mock(FileWatcherManager.class));
    plugin = new ResourcesPlugin("target/index", wsPath, () -> projectRegistry, () -> pm);
    plugin.start();
    javaPlugin.start();
}
Also used : ProjectTypeRegistry(org.eclipse.che.api.project.server.type.ProjectTypeRegistry) MavenProjectType(org.eclipse.che.plugin.maven.server.projecttype.MavenProjectType) ProjectHandlerRegistry(org.eclipse.che.api.project.server.handlers.ProjectHandlerRegistry) JavaValueProviderFactory(org.eclipse.che.plugin.java.server.projecttype.JavaValueProviderFactory) ProjectImporterRegistry(org.eclipse.che.api.project.server.importer.ProjectImporterRegistry) LocalVirtualFileSystemProvider(org.eclipse.che.api.vfs.impl.file.LocalVirtualFileSystemProvider) ProjectManager(org.eclipse.che.api.project.server.ProjectManager) PathMatcher(java.nio.file.PathMatcher) DefaultFileWatcherNotificationHandler(org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler) ResourcesPlugin(org.eclipse.core.resources.ResourcesPlugin) ProjectRegistry(org.eclipse.che.api.project.server.ProjectRegistry) FileTreeWatcher(org.eclipse.che.api.vfs.impl.file.FileTreeWatcher) File(java.io.File) JavaProjectType(org.eclipse.che.plugin.java.server.projecttype.JavaProjectType) HashSet(java.util.HashSet) FSLuceneSearcherProvider(org.eclipse.che.api.vfs.search.impl.FSLuceneSearcherProvider) MavenValueProviderFactory(org.eclipse.che.plugin.maven.server.projecttype.MavenValueProviderFactory) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 5 with ProjectHandlerRegistry

use of org.eclipse.che.api.project.server.handlers.ProjectHandlerRegistry in project che by eclipse.

the class JavaDebuggerTest method initProjectApi.

@BeforeClass
protected void initProjectApi() throws Exception {
    TestWorkspaceHolder workspaceHolder = new TestWorkspaceHolder(new ArrayList<>());
    File root = new File("target/test-classes/workspace");
    assertTrue(root.exists());
    File indexDir = new File("target/fs_index");
    assertTrue(indexDir.mkdirs());
    Set<PathMatcher> filters = new HashSet<>();
    filters.add(path -> true);
    FSLuceneSearcherProvider sProvider = new FSLuceneSearcherProvider(indexDir, filters);
    EventService eventService = new EventService();
    LocalVirtualFileSystemProvider vfsProvider = new LocalVirtualFileSystemProvider(root, sProvider);
    ProjectTypeRegistry projectTypeRegistry = new ProjectTypeRegistry(new HashSet<>());
    projectTypeRegistry.registerProjectType(new JavaProjectType(new JavaValueProviderFactory()));
    ProjectHandlerRegistry projectHandlerRegistry = new ProjectHandlerRegistry(new HashSet<>());
    ProjectRegistry projectRegistry = new ProjectRegistry(workspaceHolder, vfsProvider, projectTypeRegistry, projectHandlerRegistry, eventService);
    projectRegistry.initProjects();
    ProjectImporterRegistry importerRegistry = new ProjectImporterRegistry(new HashSet<>());
    FileWatcherNotificationHandler fileWatcherNotificationHandler = new DefaultFileWatcherNotificationHandler(vfsProvider);
    FileTreeWatcher fileTreeWatcher = new FileTreeWatcher(root, new HashSet<>(), fileWatcherNotificationHandler);
    ProjectManager projectManager = new ProjectManager(vfsProvider, projectTypeRegistry, projectRegistry, projectHandlerRegistry, importerRegistry, fileWatcherNotificationHandler, fileTreeWatcher, workspaceHolder, mock(FileWatcherManager.class));
    ResourcesPlugin resourcesPlugin = new ResourcesPlugin("target/index", root.getAbsolutePath(), () -> projectRegistry, () -> projectManager);
    resourcesPlugin.start();
    JavaPlugin javaPlugin = new JavaPlugin(root.getAbsolutePath() + "/.settings", resourcesPlugin, projectRegistry);
    javaPlugin.start();
    projectRegistry.setProjectType("test", "java", false);
    JavaModelManager.getDeltaState().initializeRoots(true);
    events = new ArrayBlockingQueue<>(10);
    Map<String, String> connectionProperties = ImmutableMap.of("host", "localhost", "port", System.getProperty("debug.port"));
    JavaDebuggerFactory factory = new JavaDebuggerFactory();
    debugger = factory.create(connectionProperties, events::add);
}
Also used : ProjectTypeRegistry(org.eclipse.che.api.project.server.type.ProjectTypeRegistry) FileWatcherNotificationHandler(org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationHandler) DefaultFileWatcherNotificationHandler(org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler) ProjectImporterRegistry(org.eclipse.che.api.project.server.importer.ProjectImporterRegistry) JavaPlugin(org.eclipse.jdt.internal.ui.JavaPlugin) ResourcesPlugin(org.eclipse.core.resources.ResourcesPlugin) ProjectRegistry(org.eclipse.che.api.project.server.ProjectRegistry) JavaProjectType(org.eclipse.che.plugin.java.server.projecttype.JavaProjectType) HashSet(java.util.HashSet) ProjectHandlerRegistry(org.eclipse.che.api.project.server.handlers.ProjectHandlerRegistry) JavaValueProviderFactory(org.eclipse.che.plugin.java.server.projecttype.JavaValueProviderFactory) LocalVirtualFileSystemProvider(org.eclipse.che.api.vfs.impl.file.LocalVirtualFileSystemProvider) EventService(org.eclipse.che.api.core.notification.EventService) ProjectManager(org.eclipse.che.api.project.server.ProjectManager) FileWatcherManager(org.eclipse.che.api.vfs.watcher.FileWatcherManager) PathMatcher(java.nio.file.PathMatcher) DefaultFileWatcherNotificationHandler(org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler) FileTreeWatcher(org.eclipse.che.api.vfs.impl.file.FileTreeWatcher) File(java.io.File) FSLuceneSearcherProvider(org.eclipse.che.api.vfs.search.impl.FSLuceneSearcherProvider) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

ProjectHandlerRegistry (org.eclipse.che.api.project.server.handlers.ProjectHandlerRegistry)7 ProjectTypeRegistry (org.eclipse.che.api.project.server.type.ProjectTypeRegistry)7 File (java.io.File)6 HashSet (java.util.HashSet)6 PathMatcher (java.nio.file.PathMatcher)5 EventService (org.eclipse.che.api.core.notification.EventService)5 ProjectImporterRegistry (org.eclipse.che.api.project.server.importer.ProjectImporterRegistry)5 DefaultFileWatcherNotificationHandler (org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler)5 FileTreeWatcher (org.eclipse.che.api.vfs.impl.file.FileTreeWatcher)5 LocalVirtualFileSystemProvider (org.eclipse.che.api.vfs.impl.file.LocalVirtualFileSystemProvider)5 FSLuceneSearcherProvider (org.eclipse.che.api.vfs.search.impl.FSLuceneSearcherProvider)5 ProjectManager (org.eclipse.che.api.project.server.ProjectManager)3 ProjectRegistry (org.eclipse.che.api.project.server.ProjectRegistry)3 FileWatcherNotificationHandler (org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationHandler)3 JavaProjectType (org.eclipse.che.plugin.java.server.projecttype.JavaProjectType)3 JavaValueProviderFactory (org.eclipse.che.plugin.java.server.projecttype.JavaValueProviderFactory)3 ResourcesPlugin (org.eclipse.core.resources.ResourcesPlugin)3 ProjectTypeDef (org.eclipse.che.api.project.server.type.ProjectTypeDef)2 FileWatcherManager (org.eclipse.che.api.vfs.watcher.FileWatcherManager)2 JavaPlugin (org.eclipse.jdt.internal.ui.JavaPlugin)2