use of org.eclipse.che.api.project.server.RegisteredProject.Problem in project che by eclipse.
the class ProjectManagerWriteTest method testCreateProjectWithInvalidAttribute.
@Test
public void testCreateProjectWithInvalidAttribute() throws Exception {
// SPECS:
// Project will be created with problem code = 13(Value for required attribute is not initialized)
// when required attribute is not initialized
final String path = "/testCreateProjectInvalidAttributes";
final String projectType = "pt2";
final NewProjectConfig config = new NewProjectConfigImpl(path, projectType, null, "name", "descr", null, null, null);
pm.createProject(config, null);
RegisteredProject project = projectRegistry.getProject(path);
assertNotNull(project);
assertNotNull(pm.getProjectsRoot().getChild(path));
assertEquals(projectType, project.getType());
List<Problem> problems = project.getProblems();
assertNotNull(problems);
assertFalse(problems.isEmpty());
assertEquals(1, problems.size());
assertEquals(13, problems.get(0).code);
}
use of org.eclipse.che.api.project.server.RegisteredProject.Problem in project che by eclipse.
the class ProjectManagerWriteTest method shouldCreateBatchProjectsWithoutMixinPTWhenThisOneIsUnregistered.
@Test
public void shouldCreateBatchProjectsWithoutMixinPTWhenThisOneIsUnregistered() throws Exception {
// If declared mixin PT is not registered, project is created w/o it, with Problem 12
final String projectPath = "/testProject";
final String mixinPType = "unregistered";
final NewProjectConfig config = createProjectConfigObject("projectName", projectPath, BaseProjectType.ID, null);
config.getMixins().add(mixinPType);
final List<NewProjectConfig> configs = new ArrayList<>(1);
configs.add(config);
pm.createBatchProjects(configs, false, new ProjectOutputLineConsumerFactory("ws", 300));
final RegisteredProject project = projectRegistry.getProject(projectPath);
final List<Problem> problems = project.getProblems();
checkProjectExist(projectPath);
assertEquals(1, problems.size());
assertEquals(12, problems.get(0).code);
assertTrue(project.getMixins().isEmpty());
assertEquals(1, projectRegistry.getProjects().size());
}
use of org.eclipse.che.api.project.server.RegisteredProject.Problem in project che by eclipse.
the class ProjectManagerWriteTest method testUpdateProjectWithProvidedAttributes.
@Test
public void testUpdateProjectWithProvidedAttributes() throws Exception {
// SPECS: Project should be updated with problem code = 13 when value for required attribute is not initialized
Map<String, List<String>> attributes = new HashMap<>();
attributes.put("pt2-var2", new AttributeValue("test").getList());
ProjectConfig pc = new NewProjectConfigImpl("/testUpdateProject", "pt2", null, "name", "descr", attributes, null, null);
pm.createProject(pc, null);
pc = new NewProjectConfigImpl("/testUpdateProject", "pt3", null, "updatedName", "descr", attributes, null, null);
RegisteredProject project = pm.updateProject(pc);
final List<Problem> problems = project.getProblems();
assertNotNull(problems);
assertFalse(problems.isEmpty());
assertEquals(1, problems.size());
assertEquals(13, problems.get(0).code);
}
use of org.eclipse.che.api.project.server.RegisteredProject.Problem in project che by eclipse.
the class ProjectTypes method addTransient.
void addTransient(FolderEntry projectFolder) {
for (ProjectTypeDef pt : projectTypeRegistry.getProjectTypes()) {
// NOTE: Only mixable types allowed
if (pt.isMixable() && !pt.isPersisted() && pt.resolveSources(projectFolder).matched()) {
all.put(pt.getId(), pt);
mixins.put(pt.getId(), pt);
for (Attribute attr : pt.getAttributes()) {
final String attrName = attr.getName();
if (attributeDefs.containsKey(attrName)) {
problems.add(new Problem(ATTRIBUTE_NAME_PROBLEM, format("Attribute name conflict. Duplicated attributes detected for %s. " + "Attribute %s declared in %s already declared in %s. Skipped.", projectPath, attrName, pt.getId(), attributeDefs.get(attrName).getProjectType())));
}
attributeDefs.put(attrName, attr);
}
}
}
}
Aggregations