use of org.eclipse.che.api.project.server.type.ProjectTypeRegistry 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();
}
use of org.eclipse.che.api.project.server.type.ProjectTypeRegistry 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();
}
use of org.eclipse.che.api.project.server.type.ProjectTypeRegistry in project che by eclipse.
the class ProjectTypesTest method testGetMixinsShouldNotReturnNotPersistedMixin.
@Test
public void testGetMixinsShouldNotReturnNotPersistedMixin() throws Exception {
Set<ProjectTypeDef> pts = new HashSet<>();
pts.add(new PrimaryType());
pts.add(new PersistedMixin());
pts.add(new NotPersistedMixin());
ProjectTypeRegistry reg = new ProjectTypeRegistry(pts);
List<RegisteredProject.Problem> problems = new ArrayList<>();
ProjectTypes projectTypes = new ProjectTypes(generate("projectPath-", 5), PrimaryType.PRIMARY_ID, Arrays.asList(PersistedMixin.PERSISTED_MIXIN_ID, NotPersistedMixin.NOT_PERSISTED_MIXIN_ID), reg, problems);
assertFalse(projectTypes.getMixins().containsKey(NotPersistedMixin.NOT_PERSISTED_MIXIN_ID));
assertEquals(problems.size(), 0);
}
use of org.eclipse.che.api.project.server.type.ProjectTypeRegistry in project che by eclipse.
the class ProjectTypesTest method testGetMixinsShouldReturnNotFoundException.
//@Test(expectedExceptions = NotFoundException.class)
public void testGetMixinsShouldReturnNotFoundException() throws Exception {
final String notFoundMixin = generate("notFoundMixin-", 5);
Set<ProjectTypeDef> pts = new HashSet<>();
pts.add(new PrimaryType());
pts.add(new PersistedMixin());
pts.add(new NotPersistedMixin());
ProjectTypeRegistry reg = new ProjectTypeRegistry(pts);
List<RegisteredProject.Problem> problems = new ArrayList<>();
new ProjectTypes(generate("projectPath-", 5), PrimaryType.PRIMARY_ID, Arrays.asList(notFoundMixin, PersistedMixin.PERSISTED_MIXIN_ID, NotPersistedMixin.NOT_PERSISTED_MIXIN_ID), reg, problems);
assertEquals(problems.size(), 1);
assertEquals(problems.get(0).code, 12);
}
use of org.eclipse.che.api.project.server.type.ProjectTypeRegistry 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();
}
Aggregations