Search in sources :

Example 11 with WorkbasketSummary

use of pro.taskana.WorkbasketSummary in project taskana by Taskana.

the class DistributionTargetsAccTest method testQueryDistributionSourcesThrowsNotAuthorized.

@WithAccessId(userName = "henry", groupNames = { "undefinedgroup" })
@Test(expected = NotAuthorizedException.class)
public void testQueryDistributionSourcesThrowsNotAuthorized() throws NotAuthorizedException, WorkbasketNotFoundException, InvalidWorkbasketException, SQLException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> distributionSources = workbasketService.getDistributionSources("WBI:100000000000000000000000000000000004");
    assertEquals(2, distributionSources.size());
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 12 with WorkbasketSummary

use of pro.taskana.WorkbasketSummary in project taskana by Taskana.

the class DistributionTargetsAccTest method testGetDistributionSourcesById.

@WithAccessId(userName = "user_2_2", groupNames = { "group_1", "group_2" })
@Test
public void testGetDistributionSourcesById() throws NotAuthorizedException, WorkbasketNotFoundException, InvalidWorkbasketException, SQLException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> distributionSources = workbasketService.getDistributionSources("WBI:100000000000000000000000000000000004");
    assertEquals(2, distributionSources.size());
    List<String> expectedIds = new ArrayList<>(Arrays.asList("WBI:100000000000000000000000000000000001", "WBI:100000000000000000000000000000000002"));
    for (WorkbasketSummary foundSummary : distributionSources) {
        assertTrue(expectedIds.contains(foundSummary.getId()));
    }
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) ArrayList(java.util.ArrayList) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 13 with WorkbasketSummary

use of pro.taskana.WorkbasketSummary in project taskana by Taskana.

the class DistributionTargetsAccTest method testAddDistributionTargetsFailsNotAuthorized.

@WithAccessId(userName = "user_2_2", groupNames = { "group_1", "group_2" })
@Test(expected = NotAuthorizedException.class)
public void testAddDistributionTargetsFailsNotAuthorized() throws NotAuthorizedException, WorkbasketNotFoundException, InvalidWorkbasketException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    Workbasket workbasket = workbasketService.getWorkbasket("GPK_KSC_1", "DOMAIN_A");
    List<WorkbasketSummary> distributionTargets = workbasketService.getDistributionTargets(workbasket.getId());
    assertEquals(4, distributionTargets.size());
    // add a new distribution target
    Workbasket newTarget = workbasketService.getWorkbasket("GPK_B_KSC_2", "DOMAIN_B");
    workbasketService.addDistributionTarget(workbasket.getId(), newTarget.getId());
    fail("NotAuthorizedException should have been thrown");
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) Workbasket(pro.taskana.Workbasket) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 14 with WorkbasketSummary

use of pro.taskana.WorkbasketSummary in project taskana by Taskana.

the class DistributionTargetsAccTest method testGetDistributionSourcesByKeyDomain.

@WithAccessId(userName = "user_2_2", groupNames = { "group_1", "group_2" })
@Test
public void testGetDistributionSourcesByKeyDomain() throws NotAuthorizedException, WorkbasketNotFoundException, InvalidWorkbasketException, SQLException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> distributionSources = workbasketService.getDistributionSources("TEAMLEAD_1", "DOMAIN_A");
    assertEquals(2, distributionSources.size());
    List<String> expectedIds = new ArrayList<>(Arrays.asList("WBI:100000000000000000000000000000000001", "WBI:100000000000000000000000000000000002"));
    for (WorkbasketSummary foundSummary : distributionSources) {
        assertTrue(expectedIds.contains(foundSummary.getId()));
    }
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) ArrayList(java.util.ArrayList) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Example 15 with WorkbasketSummary

use of pro.taskana.WorkbasketSummary in project taskana by Taskana.

the class DistributionTargetsAccTest method testQueryDistributionSourcesThrowsWorkbasketNotFound.

@WithAccessId(userName = "user_2_2", groupNames = { "group_1", "group_2" })
@Test(expected = WorkbasketNotFoundException.class)
public void testQueryDistributionSourcesThrowsWorkbasketNotFound() throws NotAuthorizedException, WorkbasketNotFoundException, InvalidWorkbasketException, SQLException {
    WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
    List<WorkbasketSummary> distributionSources = workbasketService.getDistributionSources("WBI:10dasgibtsdochnicht00000000000000004");
    assertEquals(2, distributionSources.size());
}
Also used : WorkbasketService(pro.taskana.WorkbasketService) WorkbasketSummary(pro.taskana.WorkbasketSummary) AbstractAccTest(acceptance.AbstractAccTest) Test(org.junit.Test) WithAccessId(pro.taskana.security.WithAccessId)

Aggregations

WorkbasketSummary (pro.taskana.WorkbasketSummary)66 Test (org.junit.Test)56 WorkbasketService (pro.taskana.WorkbasketService)53 AbstractAccTest (acceptance.AbstractAccTest)52 WithAccessId (pro.taskana.security.WithAccessId)51 ArrayList (java.util.ArrayList)15 Workbasket (pro.taskana.Workbasket)9 NotAuthorizedException (pro.taskana.exceptions.NotAuthorizedException)7 WorkbasketQuery (pro.taskana.WorkbasketQuery)5 Classification (pro.taskana.Classification)3 Task (pro.taskana.Task)3 InvalidArgumentException (pro.taskana.exceptions.InvalidArgumentException)3 WorkbasketNotFoundException (pro.taskana.exceptions.WorkbasketNotFoundException)3 Instant (java.time.Instant)2 Arrays (java.util.Arrays)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 PersistenceException (org.apache.ibatis.exceptions.PersistenceException)2 Ignore (org.junit.Ignore)2