use of com.enonic.xp.project.Project in project xp by enonic.
the class ProjectServiceImplTest method list_with_content_manager_permissions.
@Test
void list_with_content_manager_permissions() {
doCreateProjectAsAdmin(ProjectName.from("test-project1"));
contentManagerContext().runWith(() -> {
final Projects projects = projectService.list();
assertEquals(1, projects.getSize());
assertTrue(projects.stream().anyMatch(project -> project.getName().equals(ProjectName.from(ContentConstants.CONTENT_REPO_ID))));
});
}
use of com.enonic.xp.project.Project in project xp by enonic.
the class ProjectServiceImplTest method modify.
@Test
void modify() {
doCreateProjectAsAdmin(ProjectName.from("test-project"));
adminContext().runWith(() -> {
projectService.modify(ModifyProjectParams.create().name(ProjectName.from("test-project")).description("new description").displayName("new display name").build());
final Project modifiedProject = projectService.get(ProjectName.from("test-project"));
assertEquals("new description", modifiedProject.getDescription());
assertEquals("new display name", modifiedProject.getDisplayName());
});
}
use of com.enonic.xp.project.Project in project xp by enonic.
the class ProjectServiceImplTest method get_empty_default_project_data.
@Test
void get_empty_default_project_data() {
adminContext().runWith(() -> {
final Project pro = projectService.get(ProjectName.from(ContentConstants.CONTENT_REPO_ID));
assertEquals(ProjectConstants.DEFAULT_PROJECT.getDescription(), pro.getDescription());
assertEquals(ProjectConstants.DEFAULT_PROJECT.getDisplayName(), pro.getDisplayName());
assertEquals(ProjectConstants.DEFAULT_PROJECT.getIcon(), pro.getIcon());
assertEquals(ProjectConstants.DEFAULT_PROJECT.getParent(), pro.getParent());
});
}
use of com.enonic.xp.project.Project in project xp by enonic.
the class ProjectServiceImplTest method list_with_content_admin_permissions.
@Test
void list_with_content_admin_permissions() {
doCreateProjectAsAdmin(ProjectName.from("test-project1"));
doCreateProjectAsAdmin(ProjectName.from("test-project2"));
doCreateProjectAsAdmin(ProjectName.from("test-project3"));
contentAdminContext().runWith(() -> {
final Projects projects = projectService.list();
assertEquals(4, projects.getSize());
assertTrue(projects.stream().anyMatch(project -> project.getName().equals(ProjectName.from(ContentConstants.CONTENT_REPO_ID))));
});
}
use of com.enonic.xp.project.Project in project xp by enonic.
the class ProjectServiceImplTest method get_without_permissions.
@Test
void get_without_permissions() {
final Project createdProject = doCreateProjectAsAdmin(ProjectName.from("test-project"));
final RuntimeException ex = Assertions.assertThrows(RuntimeException.class, () -> projectService.get(createdProject.getName()));
assertEquals("Denied [user:system:test-user] user access to [test-project] project for [get] operation", ex.getMessage());
}
Aggregations