Search in sources :

Example 16 with ProjectTypeDef

use of org.eclipse.che.api.project.server.type.ProjectTypeDef in project che by eclipse.

the class SimpleGeneratorStrategyTest method prepareProject.

private void prepareProject() throws Exception {
    final String vfsUser = "dev";
    Set<ProjectTypeDef> pts = new HashSet<>();
    final ProjectTypeDef pt = new ProjectTypeDef("mytype", "mytype type", true, false) {
    };
    pts.add(pt);
    final ProjectTypeRegistry projectTypeRegistry = new ProjectTypeRegistry(pts);
    final EventService eventService = new EventService();
    //        final VirtualFileSystemRegistry vfsRegistry = new VirtualFileSystemRegistry();
    //        final MemoryFileSystemProvider memoryFileSystemProvider =
    //                new MemoryFileSystemProvider(workspace,
    //                                             eventService,
    //                                             new VirtualFileSystemUserContext() {
    //                    @Override
    //                    public VirtualFileSystemUser getVirtualFileSystemUser() {
    //                        return new VirtualFileSystemUser(vfsUser, vfsUserGroups);
    //                    }
    //                },
    //                                             vfsRegistry,
    //                                             SystemPathsFilter.ANY);
    //        vfsRegistry.registerProvider(workspace, memoryFileSystemProvider);
    WorkspaceDto usersWorkspaceMock = mock(WorkspaceDto.class);
    final ProjectConfigDto projectConfigDto = DtoFactory.getInstance().createDto(ProjectConfigDto.class).withPath("/my_project");
    WorkspaceConfigDto workspaceConfigMock = mock(WorkspaceConfigDto.class);
    when(usersWorkspaceMock.getConfig()).thenReturn(workspaceConfigMock);
    when(workspaceConfigMock.getProjects()).thenReturn(Collections.singletonList(projectConfigDto));
    ProjectHandlerRegistry handlerRegistry = new ProjectHandlerRegistry(new HashSet<>());
    //        pm = new ProjectManager(vfsRegistry,
    //                                       eventService,
    //                                       projectTypeRegistry,
    //                                       handlerRegistry,
    //                                       filterProvider,
    //                                       API_ENDPOINT,
    //                                       httpJsonRequestFactory);
    //        HttpJsonRequest httpJsonRequest = mock(HttpJsonRequest.class, new SelfReturningAnswer());
    //        when(httpJsonRequestFactory.fromLink(eq(DtoFactory.newDto(Link.class)
    //                                                          .withMethod("PUT")
    //                                                          .withHref(API_ENDPOINT + "/workspace/" + workspace + "/project"))))
    //                .thenReturn(httpJsonRequest);
    //        when(httpJsonRequestFactory.fromLink(eq(DtoFactory.newDto(Link.class)
    //                                                          .withMethod("GET")
    //                                                          .withHref(API_ENDPOINT + "/workspace/" + workspace))))
    //                .thenReturn(httpJsonRequest);
    //        when(httpJsonRequest.request()).thenReturn(httpJsonResponse);
    when(httpJsonResponse.asDto(WorkspaceDto.class)).thenReturn(usersWorkspaceMock);
    pm.createProject(DtoFactory.getInstance().createDto(ProjectConfigDto.class).withType(pt.getId()).withName("my_project").withPath("/my_project"), null);
}
Also used : ProjectTypeRegistry(org.eclipse.che.api.project.server.type.ProjectTypeRegistry) ProjectHandlerRegistry(org.eclipse.che.api.project.server.handlers.ProjectHandlerRegistry) ProjectConfigDto(org.eclipse.che.api.workspace.shared.dto.ProjectConfigDto) ProjectTypeDef(org.eclipse.che.api.project.server.type.ProjectTypeDef) EventService(org.eclipse.che.api.core.notification.EventService) WorkspaceDto(org.eclipse.che.api.workspace.shared.dto.WorkspaceDto) WorkspaceConfigDto(org.eclipse.che.api.workspace.shared.dto.WorkspaceConfigDto) HashSet(java.util.HashSet)

Aggregations

ProjectTypeDef (org.eclipse.che.api.project.server.type.ProjectTypeDef)16 HashSet (java.util.HashSet)10 ProjectTypeRegistry (org.eclipse.che.api.project.server.type.ProjectTypeRegistry)9 ArrayList (java.util.ArrayList)8 Test (org.testng.annotations.Test)6 ProjectConfigDto (org.eclipse.che.api.workspace.shared.dto.ProjectConfigDto)5 File (java.io.File)3 PathMatcher (java.nio.file.PathMatcher)3 Collections.singletonList (java.util.Collections.singletonList)3 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 LinkedHashSet (java.util.LinkedHashSet)3 LinkedList (java.util.LinkedList)3 List (java.util.List)3 Set (java.util.Set)3 Attribute (org.eclipse.che.api.core.model.project.type.Attribute)3 EventService (org.eclipse.che.api.core.notification.EventService)3 HttpJsonRequest (org.eclipse.che.api.core.rest.HttpJsonRequest)3 ProjectHandlerRegistry (org.eclipse.che.api.project.server.handlers.ProjectHandlerRegistry)3 SelfReturningAnswer (org.eclipse.che.commons.test.mockito.answer.SelfReturningAnswer)3