Search in sources :

Example 31 with Project

use of com.enonic.xp.project.Project in project xp by enonic.

the class ProjectsSyncTaskTest method syncAll.

@Test
void syncAll() {
    final Project parent = createProject("parent", null);
    final Project child1 = createProject("child1", "parent");
    final Project child2 = createProject("child2", "child1");
    when(projectService.list()).thenReturn(Projects.create().addAll(Set.of(parent, child1, child2)).build());
    ProjectsSyncTask.create().projectService(projectService).syncContentService(syncContentService).build().run(TaskId.from("taskId"), mock(ProgressReporter.class, withSettings().stubOnly()));
    verify(syncContentService, times(2)).syncProject(paramsCaptor.capture());
    final List<ProjectName> syncProjects = paramsCaptor.getAllValues().stream().map(ProjectSyncParams::getTargetProject).collect(Collectors.toList());
    assertThat(syncProjects).containsExactly(child1.getName(), child2.getName());
}
Also used : Project(com.enonic.xp.project.Project) ProjectName(com.enonic.xp.project.ProjectName) ProgressReporter(com.enonic.xp.task.ProgressReporter) Test(org.junit.jupiter.api.Test)

Aggregations

Project (com.enonic.xp.project.Project)31 Test (org.junit.jupiter.api.Test)19 AbstractNodeTest (com.enonic.xp.repo.impl.node.AbstractNodeTest)18 ProjectName (com.enonic.xp.project.ProjectName)9 ProjectPermissions (com.enonic.xp.project.ProjectPermissions)9 RepositoryId (com.enonic.xp.repository.RepositoryId)9 CreateProjectParams (com.enonic.xp.project.CreateProjectParams)7 ModifyProjectParams (com.enonic.xp.project.ModifyProjectParams)7 Repository (com.enonic.xp.repository.Repository)7 Context (com.enonic.xp.context.Context)6 ContextBuilder (com.enonic.xp.context.ContextBuilder)6 ProjectGraph (com.enonic.xp.project.ProjectGraph)6 RoleKeys (com.enonic.xp.security.RoleKeys)6 AuthenticationInfo (com.enonic.xp.security.auth.AuthenticationInfo)6 ByteSource (com.google.common.io.ByteSource)6 IOException (java.io.IOException)6 UncheckedIOException (java.io.UncheckedIOException)6 List (java.util.List)6 Collectors (java.util.stream.Collectors)6 CreateAttachment (com.enonic.xp.attachment.CreateAttachment)5