use of org.eclipse.che.api.project.server.type.ProjectTypeRegistry in project che by eclipse.
the class ProjectTypesTest method testGetMixinsShouldReturnProjectTypeConstraintException.
//@Test(expectedExceptions = ProjectTypeConstraintException.class)
public void testGetMixinsShouldReturnProjectTypeConstraintException() throws Exception {
String otherPrimaryId = generate("projectType-", 3);
Set<ProjectTypeDef> pts = new HashSet<>();
pts.add(new PrimaryType());
pts.add(new PrimaryType(otherPrimaryId, generate("projectType-", 5)));
pts.add(new PersistedMixin());
ProjectTypeRegistry reg = new ProjectTypeRegistry(pts);
List<RegisteredProject.Problem> problems = new ArrayList<>();
new ProjectTypes(generate("projectPath-", 5), PrimaryType.PRIMARY_ID, Arrays.asList(PersistedMixin.PERSISTED_MIXIN_ID, otherPrimaryId), 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 ProjectTypesTest method testGetMixins.
@Test
public void testGetMixins() throws Exception {
Set<ProjectTypeDef> pts = new HashSet<>();
pts.add(new PrimaryType());
pts.add(new PersistedMixin());
ProjectTypeRegistry reg = new ProjectTypeRegistry(pts);
List<RegisteredProject.Problem> problems = new ArrayList<>();
ProjectTypes projectTypes = new ProjectTypes(generate("projectPath-", 5), PrimaryType.PRIMARY_ID, Collections.singletonList(PersistedMixin.PERSISTED_MIXIN_ID), reg, problems);
assertNotNull(projectTypes.getMixins());
assertEquals(projectTypes.getMixins().size(), 1);
assertTrue(projectTypes.getMixins().containsKey(PersistedMixin.PERSISTED_MIXIN_ID));
}
use of org.eclipse.che.api.project.server.type.ProjectTypeRegistry in project che by eclipse.
the class MavenProjectTypeTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
Set<ProjectTypeDef> projTypes = new HashSet<>();
projTypes.add(new JavaProjectType(new JavaValueProviderFactory()));
projTypes.add(new MavenProjectType(new MavenValueProviderFactory()));
ptRegistry = new ProjectTypeRegistry(projTypes);
Set<ProjectHandler> handlers = new HashSet<>();
handlers.add(new MavenProjectGenerator(Collections.<GeneratorStrategy>emptySet()));
httpJsonRequest = mock(HttpJsonRequest.class, new SelfReturningAnswer());
}
use of org.eclipse.che.api.project.server.type.ProjectTypeRegistry 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);
}
Aggregations