use of org.eclipse.che.api.project.server.ProjectRegistry 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.ProjectRegistry in project che by eclipse.
the class PomReconcilerTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
Provider<ProjectRegistry> projectRegistryProvider = (Provider<ProjectRegistry>) mock(Provider.class);
when(projectRegistryProvider.get()).thenReturn(projectRegistry);
MavenServerManagerTest.MyMavenServerProgressNotifier mavenNotifier = new MavenServerManagerTest.MyMavenServerProgressNotifier();
MavenTerminal terminal = new MavenTerminal() {
@Override
public void print(int level, String message, Throwable throwable) throws RemoteException {
System.out.println(message);
if (throwable != null) {
throwable.printStackTrace();
}
}
};
File localRepository = new File(new File("target/localRepo").getAbsolutePath());
localRepository.mkdirs();
mavenServerManager.setLocalRepository(localRepository);
MavenWrapperManager wrapperManager = new MavenWrapperManager(mavenServerManager);
projectManager = new MavenProjectManager(wrapperManager, mavenServerManager, terminal, mavenNotifier, new EclipseWorkspaceProvider());
ClasspathManager classpathManager = new ClasspathManager(root.getAbsolutePath(), wrapperManager, projectManager, terminal, mavenNotifier);
mavenWorkspace = new MavenWorkspace(projectManager, mavenNotifier, new MavenExecutorService(), projectRegistryProvider, new MavenCommunication() {
@Override
public void sendUpdateMassage(Set<MavenProject> updated, List<MavenProject> removed) {
}
@Override
public void sendNotification(NotificationMessage message) {
System.out.println(message.toString());
}
@Override
public void send(JsonObject object, MessageType type) {
}
}, classpathManager, eventService, new EclipseWorkspaceProvider());
}
use of org.eclipse.che.api.project.server.ProjectRegistry in project che by eclipse.
the class WorkspaceTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
Provider<ProjectRegistry> projectRegistryProvider = (Provider<ProjectRegistry>) mock(Provider.class);
when(projectRegistryProvider.get()).thenReturn(projectRegistry);
MavenServerManagerTest.MyMavenServerProgressNotifier mavenNotifier = new MavenServerManagerTest.MyMavenServerProgressNotifier();
MavenTerminal terminal = new MavenTerminal() {
@Override
public void print(int level, String message, Throwable throwable) throws RemoteException {
System.out.println(message);
if (throwable != null) {
throwable.printStackTrace();
}
}
};
MavenWrapperManager wrapperManager = new MavenWrapperManager(mavenServerManager);
mavenProjectManager = new MavenProjectManager(wrapperManager, mavenServerManager, terminal, mavenNotifier, new EclipseWorkspaceProvider());
mavenWorkspace = new MavenWorkspace(mavenProjectManager, mavenNotifier, new MavenExecutorService(), projectRegistryProvider, new MavenCommunication() {
@Override
public void sendUpdateMassage(Set<MavenProject> updated, List<MavenProject> removed) {
}
@Override
public void sendNotification(NotificationMessage message) {
System.out.println(message.toString());
}
@Override
public void send(JsonObject object, MessageType type) {
}
}, new ClasspathManager(root.getAbsolutePath(), wrapperManager, mavenProjectManager, terminal, mavenNotifier), eventService, new EclipseWorkspaceProvider());
}
use of org.eclipse.che.api.project.server.ProjectRegistry in project che by eclipse.
the class ClasspathManagerTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
Provider<ProjectRegistry> projectRegistryProvider = (Provider<ProjectRegistry>) mock(Provider.class);
when(projectRegistryProvider.get()).thenReturn(projectRegistry);
MavenServerManagerTest.MyMavenServerProgressNotifier mavenNotifier = new MavenServerManagerTest.MyMavenServerProgressNotifier();
MavenTerminal terminal = (level, message, throwable) -> {
System.out.println(message);
if (throwable != null) {
throwable.printStackTrace();
}
};
localRepository = new File(new File("target/localRepo").getAbsolutePath());
localRepository.mkdirs();
mavenServerManager.setLocalRepository(localRepository);
MavenWrapperManager wrapperManager = new MavenWrapperManager(mavenServerManager);
mavenProjectManager = new MavenProjectManager(wrapperManager, mavenServerManager, terminal, mavenNotifier, new EclipseWorkspaceProvider());
classpathManager = new ClasspathManager(root.getAbsolutePath(), wrapperManager, mavenProjectManager, terminal, mavenNotifier);
mavenWorkspace = new MavenWorkspace(mavenProjectManager, mavenNotifier, new MavenExecutorService(), projectRegistryProvider, new MavenCommunication() {
@Override
public void sendUpdateMassage(Set<MavenProject> updated, List<MavenProject> removed) {
}
@Override
public void sendNotification(NotificationMessage message) {
System.out.println(message.toString());
}
@Override
public void send(JsonObject object, MessageType type) {
}
}, classpathManager, eventService, new EclipseWorkspaceProvider());
}
use of org.eclipse.che.api.project.server.ProjectRegistry in project che by eclipse.
the class WorkspaceRoot method getProjects.
@Override
public IProject[] getProjects() {
ProjectRegistry projectRegistry = workspace.getProjectRegistry();
List<IProject> projects = new ArrayList<>();
List<RegisteredProject> rootProjects = projectRegistry.getProjects();
for (RegisteredProject rootProject : rootProjects) {
Project project = new Project(new Path(rootProject.getPath()), workspace);
projects.add(project);
}
return projects.toArray(new IProject[projects.size()]);
}
Aggregations