TSK-73 Create Workbasket
This commit is contained in:
parent
9c6f2db7eb
commit
407a4a33d8
|
@ -40,9 +40,8 @@ public class TaskanaRestTest {
|
||||||
public Response startTask() throws NotAuthorizedException, WorkbasketNotFoundException,
|
public Response startTask() throws NotAuthorizedException, WorkbasketNotFoundException,
|
||||||
ClassificationNotFoundException, ClassificationAlreadyExistException, InvalidWorkbasketException,
|
ClassificationNotFoundException, ClassificationAlreadyExistException, InvalidWorkbasketException,
|
||||||
TaskAlreadyExistException, InvalidArgumentException {
|
TaskAlreadyExistException, InvalidArgumentException {
|
||||||
Workbasket workbasket = taskanaEjb.getWorkbasketService().newWorkbasket();
|
Workbasket workbasket = taskanaEjb.getWorkbasketService().newWorkbasket("key");
|
||||||
workbasket.setName("wb");
|
workbasket.setName("wb");
|
||||||
workbasket.setKey("key");
|
|
||||||
workbasket.setDomain("cdiDomain");
|
workbasket.setDomain("cdiDomain");
|
||||||
workbasket.setType(WorkbasketType.PERSONAL);
|
workbasket.setType(WorkbasketType.PERSONAL);
|
||||||
taskanaEjb.getWorkbasketService().createWorkbasket(workbasket);
|
taskanaEjb.getWorkbasketService().createWorkbasket(workbasket);
|
||||||
|
|
|
@ -45,6 +45,7 @@ public interface BaseQuery<T> {
|
||||||
* amount of elements for this page.
|
* amount of elements for this page.
|
||||||
* @return resulList for the current query starting at X and returning max Y elements.
|
* @return resulList for the current query starting at X and returning max Y elements.
|
||||||
* @throws NotAuthorizedException
|
* @throws NotAuthorizedException
|
||||||
|
* if the user is not authorized to perform this query
|
||||||
*/
|
*/
|
||||||
default List<T> listPage(int pageNumber, int pageSize) throws NotAuthorizedException {
|
default List<T> listPage(int pageNumber, int pageSize) throws NotAuthorizedException {
|
||||||
int offset = (pageNumber < 0) ? 0 : (pageNumber * pageSize);
|
int offset = (pageNumber < 0) ? 0 : (pageNumber * pageSize);
|
||||||
|
|
|
@ -30,14 +30,6 @@ public interface Workbasket {
|
||||||
*/
|
*/
|
||||||
String getKey();
|
String getKey();
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the key of the workbasket.
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* the key of the workbasket
|
|
||||||
*/
|
|
||||||
void setKey(String key);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the domain of the workbasket.
|
* Returns the domain of the workbasket.
|
||||||
*
|
*
|
||||||
|
@ -75,14 +67,6 @@ public interface Workbasket {
|
||||||
*/
|
*/
|
||||||
Instant getModified();
|
Instant getModified();
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the time when the workbasket was modified the last time.
|
|
||||||
*
|
|
||||||
* @param modified
|
|
||||||
* as Instant
|
|
||||||
*/
|
|
||||||
void setModified(Instant modified);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the workbasket.
|
* Returns the name of the workbasket.
|
||||||
*
|
*
|
||||||
|
|
|
@ -56,13 +56,9 @@ public interface WorkbasketService {
|
||||||
* @return the created and persisted Workbasket
|
* @return the created and persisted Workbasket
|
||||||
* @throws InvalidWorkbasketException
|
* @throws InvalidWorkbasketException
|
||||||
* If a required property of the Workbasket is not set.
|
* If a required property of the Workbasket is not set.
|
||||||
* @throws WorkbasketNotFoundException
|
|
||||||
* If the to be created work basket references a distribution target that does not exist.
|
|
||||||
* @throws NotAuthorizedException
|
|
||||||
* If the current user or group does not have the permissions for interactions.
|
|
||||||
*/
|
*/
|
||||||
Workbasket createWorkbasket(Workbasket workbasket)
|
Workbasket createWorkbasket(Workbasket workbasket)
|
||||||
throws InvalidWorkbasketException, WorkbasketNotFoundException, NotAuthorizedException;
|
throws InvalidWorkbasketException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a Workbasket.
|
* Update a Workbasket.
|
||||||
|
@ -163,9 +159,11 @@ public interface WorkbasketService {
|
||||||
/**
|
/**
|
||||||
* Returns a new workbasket which is not persisted.
|
* Returns a new workbasket which is not persisted.
|
||||||
*
|
*
|
||||||
|
* @param key
|
||||||
|
* the workbasket key used to identify the workbasket
|
||||||
* @return newWorkbasket
|
* @return newWorkbasket
|
||||||
*/
|
*/
|
||||||
Workbasket newWorkbasket();
|
Workbasket newWorkbasket(String key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a set with all permissions of the current user at this workbasket.
|
* Returns a set with all permissions of the current user at this workbasket.
|
||||||
|
|
|
@ -46,7 +46,6 @@ public class WorkbasketImpl implements Workbasket {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setKey(String key) {
|
public void setKey(String key) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +64,6 @@ public class WorkbasketImpl implements Workbasket {
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setModified(Instant modified) {
|
public void setModified(Instant modified) {
|
||||||
this.modified = modified;
|
this.modified = modified;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Workbasket createWorkbasket(Workbasket newWorkbasket)
|
public Workbasket createWorkbasket(Workbasket newWorkbasket)
|
||||||
throws InvalidWorkbasketException, WorkbasketNotFoundException, NotAuthorizedException {
|
throws InvalidWorkbasketException {
|
||||||
LOGGER.debug("entry to createtWorkbasket(workbasket)", newWorkbasket);
|
LOGGER.debug("entry to createtWorkbasket(workbasket)", newWorkbasket);
|
||||||
Workbasket result = null;
|
Workbasket result = null;
|
||||||
WorkbasketImpl workbasket = (WorkbasketImpl) newWorkbasket;
|
WorkbasketImpl workbasket = (WorkbasketImpl) newWorkbasket;
|
||||||
|
@ -379,8 +379,10 @@ public class WorkbasketServiceImpl implements WorkbasketService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Workbasket newWorkbasket() {
|
public Workbasket newWorkbasket(String key) {
|
||||||
return new WorkbasketImpl();
|
WorkbasketImpl wb = new WorkbasketImpl();
|
||||||
|
wb.setKey(key);
|
||||||
|
return wb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -526,6 +528,9 @@ public class WorkbasketServiceImpl implements WorkbasketService {
|
||||||
throws NotAuthorizedException {
|
throws NotAuthorizedException {
|
||||||
LOGGER.debug("entry to checkAuthorization(workbasketId = {}, workbasketAuthorization = {})", workbasketKey,
|
LOGGER.debug("entry to checkAuthorization(workbasketId = {}, workbasketAuthorization = {})", workbasketKey,
|
||||||
workbasketAuthorization);
|
workbasketAuthorization);
|
||||||
|
if ((workbasketAuthorization == null && workbasketKey == null) || workbasketAuthorization == null) {
|
||||||
|
throw new SystemException("checkAuthorization was called with an invalid parameter combination");
|
||||||
|
}
|
||||||
boolean isAuthorized = false;
|
boolean isAuthorized = false;
|
||||||
try {
|
try {
|
||||||
taskanaEngine.openConnection();
|
taskanaEngine.openConnection();
|
||||||
|
@ -556,7 +561,7 @@ public class WorkbasketServiceImpl implements WorkbasketService {
|
||||||
"checkAuthorizationImpl was called with both workbasketKey and workbasketId set to null");
|
"checkAuthorizationImpl was called with both workbasketKey and workbasketId set to null");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accessItems.size() <= 0) {
|
if (accessItems.isEmpty()) {
|
||||||
throw new NotAuthorizedException("Not authorized. Authorization '" + workbasketAuthorization.name()
|
throw new NotAuthorizedException("Not authorized. Authorization '" + workbasketAuthorization.name()
|
||||||
+ "' on workbasket '" + workbasketKey + "' is needed.");
|
+ "' on workbasket '" + workbasketKey + "' is needed.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class UpdateTaskAccTest extends AbstractAccTest {
|
||||||
Assert.assertEquals("7654321", updatedTask.getPrimaryObjRef().getValue());
|
Assert.assertEquals("7654321", updatedTask.getPrimaryObjRef().getValue());
|
||||||
Assert.assertNotNull(updatedTask.getCreated());
|
Assert.assertNotNull(updatedTask.getCreated());
|
||||||
Assert.assertNotNull(updatedTask.getModified());
|
Assert.assertNotNull(updatedTask.getModified());
|
||||||
Assert.assertTrue(modifiedOriginal.isBefore(updatedTask.getModified()));
|
Assert.assertFalse(modifiedOriginal.isAfter(updatedTask.getModified()));
|
||||||
Assert.assertNotEquals(updatedTask.getCreated(), updatedTask.getModified());
|
Assert.assertNotEquals(updatedTask.getCreated(), updatedTask.getModified());
|
||||||
Assert.assertEquals(task.getCreated(), updatedTask.getCreated());
|
Assert.assertEquals(task.getCreated(), updatedTask.getCreated());
|
||||||
Assert.assertEquals(task.isRead(), updatedTask.isRead());
|
Assert.assertEquals(task.isRead(), updatedTask.isRead());
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
package acceptance.workbasket;
|
||||||
|
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import acceptance.AbstractAccTest;
|
||||||
|
import pro.taskana.Workbasket;
|
||||||
|
import pro.taskana.WorkbasketService;
|
||||||
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
|
import pro.taskana.exceptions.InvalidWorkbasketException;
|
||||||
|
import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
|
import pro.taskana.model.WorkbasketType;
|
||||||
|
import pro.taskana.security.JAASRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acceptance test for all "get workbasket" scenarios.
|
||||||
|
*/
|
||||||
|
@RunWith(JAASRunner.class)
|
||||||
|
public class CreateWorkbasketAccTest extends AbstractAccTest {
|
||||||
|
|
||||||
|
public CreateWorkbasketAccTest() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateWorkbasket()
|
||||||
|
throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
|
||||||
|
InvalidWorkbasketException {
|
||||||
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
|
|
||||||
|
int before = workbasketService.getWorkbaskets().size();
|
||||||
|
Workbasket workbasket = workbasketService.newWorkbasket("key");
|
||||||
|
workbasket.setName("Megabasket");
|
||||||
|
workbasket.setType(WorkbasketType.GROUP);
|
||||||
|
workbasket.setDomain("novatec");
|
||||||
|
workbasket.setOrgLevel1("company");
|
||||||
|
workbasketService.createWorkbasket(workbasket);
|
||||||
|
Assert.assertEquals(before + 1, workbasketService.getWorkbaskets().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateWorkbasketWithMissingRequiredField()
|
||||||
|
throws WorkbasketNotFoundException, NotAuthorizedException {
|
||||||
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
|
|
||||||
|
Workbasket workbasket = workbasketService.newWorkbasket(null);
|
||||||
|
workbasket.setName("Megabasket");
|
||||||
|
workbasket.setType(WorkbasketType.GROUP);
|
||||||
|
workbasket.setDomain("novatec");
|
||||||
|
workbasket.setOrgLevel1("company");
|
||||||
|
try { // missing key
|
||||||
|
workbasketService.createWorkbasket(workbasket);
|
||||||
|
fail("InvalidWorkbasketException was expected");
|
||||||
|
} catch (InvalidWorkbasketException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
workbasket = workbasketService.newWorkbasket("key");
|
||||||
|
workbasket.setType(WorkbasketType.GROUP);
|
||||||
|
workbasket.setDomain("novatec");
|
||||||
|
workbasket.setOrgLevel1("company");
|
||||||
|
try { // missing name
|
||||||
|
workbasketService.createWorkbasket(workbasket);
|
||||||
|
fail("InvalidWorkbasketException was expected");
|
||||||
|
} catch (InvalidWorkbasketException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
workbasket = workbasketService.newWorkbasket("key");
|
||||||
|
workbasket.setName("Megabasket");
|
||||||
|
workbasket.setDomain("novatec");
|
||||||
|
workbasket.setOrgLevel1("company");
|
||||||
|
try { // missing type
|
||||||
|
workbasketService.createWorkbasket(workbasket);
|
||||||
|
fail("InvalidWorkbasketException was expected");
|
||||||
|
} catch (InvalidWorkbasketException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
workbasket = workbasketService.newWorkbasket("key");
|
||||||
|
workbasket.setName("Megabasket");
|
||||||
|
workbasket.setType(WorkbasketType.GROUP);
|
||||||
|
workbasket.setOrgLevel1("company");
|
||||||
|
try { // missing domain
|
||||||
|
workbasketService.createWorkbasket(workbasket);
|
||||||
|
fail("InvalidWorkbasketException was expected");
|
||||||
|
} catch (InvalidWorkbasketException e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -128,7 +128,7 @@ public class TaskMonitorServiceImplTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetTotalNumbersOfWorkbasketLevelReport() {
|
public void testGetTotalNumbersOfWorkbasketLevelReport() {
|
||||||
Workbasket workbasket = new WorkbasketImpl();
|
WorkbasketImpl workbasket = new WorkbasketImpl();
|
||||||
workbasket.setName("workbasket");
|
workbasket.setName("workbasket");
|
||||||
workbasket.setKey("wb1");
|
workbasket.setKey("wb1");
|
||||||
List<Workbasket> workbaskets = Arrays.asList(workbasket);
|
List<Workbasket> workbaskets = Arrays.asList(workbasket);
|
||||||
|
@ -157,7 +157,7 @@ public class TaskMonitorServiceImplTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetWorkbasketLevelReportWithReportLineItemDefinitions() {
|
public void testGetWorkbasketLevelReportWithReportLineItemDefinitions() {
|
||||||
Workbasket workbasket = new WorkbasketImpl();
|
WorkbasketImpl workbasket = new WorkbasketImpl();
|
||||||
workbasket.setName("workbasket");
|
workbasket.setName("workbasket");
|
||||||
workbasket.setKey("wb1");
|
workbasket.setKey("wb1");
|
||||||
List<Workbasket> workbaskets = Arrays.asList(workbasket);
|
List<Workbasket> workbaskets = Arrays.asList(workbasket);
|
||||||
|
@ -191,7 +191,7 @@ public class TaskMonitorServiceImplTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetTotalNumbersOfCatgoryReport() {
|
public void testGetTotalNumbersOfCatgoryReport() {
|
||||||
Workbasket workbasket = new WorkbasketImpl();
|
WorkbasketImpl workbasket = new WorkbasketImpl();
|
||||||
workbasket.setName("workbasket");
|
workbasket.setName("workbasket");
|
||||||
workbasket.setKey("wb1");
|
workbasket.setKey("wb1");
|
||||||
List<Workbasket> workbaskets = Arrays.asList(workbasket);
|
List<Workbasket> workbaskets = Arrays.asList(workbasket);
|
||||||
|
@ -220,7 +220,7 @@ public class TaskMonitorServiceImplTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetCategoryReportWithReportLineItemDefinitions() {
|
public void testGetCategoryReportWithReportLineItemDefinitions() {
|
||||||
Workbasket workbasket = new WorkbasketImpl();
|
WorkbasketImpl workbasket = new WorkbasketImpl();
|
||||||
workbasket.setName("workbasket");
|
workbasket.setName("workbasket");
|
||||||
workbasket.setKey("wb1");
|
workbasket.setKey("wb1");
|
||||||
List<Workbasket> workbaskets = Arrays.asList(workbasket);
|
List<Workbasket> workbaskets = Arrays.asList(workbasket);
|
||||||
|
|
|
@ -102,8 +102,7 @@ public class TaskServiceImplIntAutocommitTest {
|
||||||
WorkbasketNotFoundException, NotAuthorizedException, ClassificationNotFoundException,
|
WorkbasketNotFoundException, NotAuthorizedException, ClassificationNotFoundException,
|
||||||
ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException,
|
ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException,
|
||||||
InvalidArgumentException {
|
InvalidArgumentException {
|
||||||
Workbasket wb = workbasketService.newWorkbasket();
|
Workbasket wb = workbasketService.newWorkbasket("workbasket");
|
||||||
wb.setKey("workbasket");
|
|
||||||
wb.setName("workbasket");
|
wb.setName("workbasket");
|
||||||
wb.setType(WorkbasketType.GROUP);
|
wb.setType(WorkbasketType.GROUP);
|
||||||
wb.setDomain("novatec");
|
wb.setDomain("novatec");
|
||||||
|
@ -130,11 +129,10 @@ public class TaskServiceImplIntAutocommitTest {
|
||||||
throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException,
|
throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException,
|
||||||
WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException,
|
WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException,
|
||||||
TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException {
|
TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException {
|
||||||
Workbasket wb = workbasketService.newWorkbasket();
|
Workbasket wb = workbasketService.newWorkbasket("wb1k1");
|
||||||
wb.setName("sdf");
|
wb.setName("sdf");
|
||||||
wb.setType(WorkbasketType.GROUP);
|
wb.setType(WorkbasketType.GROUP);
|
||||||
wb.setDomain("novatec");
|
wb.setDomain("novatec");
|
||||||
wb.setKey("wb1k1");
|
|
||||||
taskanaEngine.getWorkbasketService().createWorkbasket(wb);
|
taskanaEngine.getWorkbasketService().createWorkbasket(wb);
|
||||||
|
|
||||||
Classification classification = classificationService.newClassification("novatec", "TEST", "t1");
|
Classification classification = classificationService.newClassification("novatec", "TEST", "t1");
|
||||||
|
@ -168,8 +166,7 @@ public class TaskServiceImplIntAutocommitTest {
|
||||||
((TaskanaEngineImpl) te).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
|
((TaskanaEngineImpl) te).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
|
||||||
TaskServiceImpl taskServiceImpl = (TaskServiceImpl) te.getTaskService();
|
TaskServiceImpl taskServiceImpl = (TaskServiceImpl) te.getTaskService();
|
||||||
|
|
||||||
Workbasket wb = workbasketService.newWorkbasket();
|
Workbasket wb = workbasketService.newWorkbasket("workbasket");
|
||||||
wb.setKey("workbasket");
|
|
||||||
wb.setName("workbasket");
|
wb.setName("workbasket");
|
||||||
wb.setType(WorkbasketType.GROUP);
|
wb.setType(WorkbasketType.GROUP);
|
||||||
wb.setDomain("novatec");
|
wb.setDomain("novatec");
|
||||||
|
@ -191,8 +188,7 @@ public class TaskServiceImplIntAutocommitTest {
|
||||||
public void should_ReturnList_when_BuilderIsUsed() throws SQLException, NotAuthorizedException,
|
public void should_ReturnList_when_BuilderIsUsed() throws SQLException, NotAuthorizedException,
|
||||||
WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException,
|
WorkbasketNotFoundException, ClassificationNotFoundException, ClassificationAlreadyExistException,
|
||||||
TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, SystemException {
|
TaskAlreadyExistException, InvalidWorkbasketException, InvalidArgumentException, SystemException {
|
||||||
Workbasket wb = workbasketService.newWorkbasket();
|
Workbasket wb = workbasketService.newWorkbasket("key");
|
||||||
wb.setKey("key");
|
|
||||||
wb.setName("workbasket");
|
wb.setName("workbasket");
|
||||||
wb.setType(WorkbasketType.GROUP);
|
wb.setType(WorkbasketType.GROUP);
|
||||||
wb.setDomain("novatec");
|
wb.setDomain("novatec");
|
||||||
|
@ -227,8 +223,7 @@ public class TaskServiceImplIntAutocommitTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldReturnTaskSummaryListWithValues() throws Exception {
|
public void shouldReturnTaskSummaryListWithValues() throws Exception {
|
||||||
Workbasket dummyWorkbasket = workbasketService.newWorkbasket();
|
Workbasket dummyWorkbasket = workbasketService.newWorkbasket("Dummy-Key");
|
||||||
dummyWorkbasket.setKey("Dummy-Key");
|
|
||||||
dummyWorkbasket.setName("Dummy-Basket");
|
dummyWorkbasket.setName("Dummy-Basket");
|
||||||
dummyWorkbasket.setType(WorkbasketType.GROUP);
|
dummyWorkbasket.setType(WorkbasketType.GROUP);
|
||||||
dummyWorkbasket.setDomain("novatec");
|
dummyWorkbasket.setDomain("novatec");
|
||||||
|
@ -266,8 +261,7 @@ public class TaskServiceImplIntAutocommitTest {
|
||||||
@Test(expected = WorkbasketNotFoundException.class)
|
@Test(expected = WorkbasketNotFoundException.class)
|
||||||
public void shouldThrowWorkbasketNotFoundExceptionByInvalidWorkbasketParameter()
|
public void shouldThrowWorkbasketNotFoundExceptionByInvalidWorkbasketParameter()
|
||||||
throws WorkbasketNotFoundException, InvalidWorkbasketException, NotAuthorizedException {
|
throws WorkbasketNotFoundException, InvalidWorkbasketException, NotAuthorizedException {
|
||||||
WorkbasketImpl wb = (WorkbasketImpl) workbasketService.newWorkbasket();
|
WorkbasketImpl wb = (WorkbasketImpl) workbasketService.newWorkbasket("key");
|
||||||
wb.setKey("key");
|
|
||||||
wb.setName("wb");
|
wb.setName("wb");
|
||||||
wb.setType(WorkbasketType.GROUP);
|
wb.setType(WorkbasketType.GROUP);
|
||||||
wb.setDomain("novatec");
|
wb.setDomain("novatec");
|
||||||
|
@ -292,19 +286,18 @@ public class TaskServiceImplIntAutocommitTest {
|
||||||
final int sleepTime = 100;
|
final int sleepTime = 100;
|
||||||
|
|
||||||
// Source Workbasket
|
// Source Workbasket
|
||||||
wb = (WorkbasketImpl) workbasketService.newWorkbasket();
|
wb = (WorkbasketImpl) workbasketService.newWorkbasket("key1");
|
||||||
wb.setName("Basic-Workbasket");
|
wb.setName("Basic-Workbasket");
|
||||||
wb.setDescription("Just used as base WB for Task here");
|
wb.setDescription("Just used as base WB for Task here");
|
||||||
wb.setKey("key1");
|
|
||||||
wb.setDomain("domain");
|
wb.setDomain("domain");
|
||||||
wb.setType(WorkbasketType.GROUP);
|
wb.setType(WorkbasketType.GROUP);
|
||||||
wb.setOwner("The Tester ID");
|
wb.setOwner("The Tester ID");
|
||||||
sourceWB = workbasketService.createWorkbasket(wb);
|
sourceWB = workbasketService.createWorkbasket(wb);
|
||||||
|
|
||||||
// Destination Workbasket
|
// Destination Workbasket
|
||||||
wb = (WorkbasketImpl) workbasketService.newWorkbasket();
|
wb = (WorkbasketImpl) workbasketService.newWorkbasket("k1");
|
||||||
wb.setName("Desination-WorkBasket");
|
wb.setName("Desination-WorkBasket");
|
||||||
wb.setKey("k1");
|
|
||||||
wb.setDomain("domain");
|
wb.setDomain("domain");
|
||||||
wb.setType(WorkbasketType.CLEARANCE);
|
wb.setType(WorkbasketType.CLEARANCE);
|
||||||
wb.setDescription("Destination WB where Task should be transfered to");
|
wb.setDescription("Destination WB where Task should be transfered to");
|
||||||
|
@ -369,33 +362,32 @@ public class TaskServiceImplIntAutocommitTest {
|
||||||
classification.setName("Transfert-Task Classification");
|
classification.setName("Transfert-Task Classification");
|
||||||
classificationService.createClassification(classification);
|
classificationService.createClassification(classification);
|
||||||
|
|
||||||
WorkbasketImpl wb = (WorkbasketImpl) workbasketService.newWorkbasket();
|
WorkbasketImpl wb = (WorkbasketImpl) workbasketService.newWorkbasket("k5");
|
||||||
wb.setName("BASE WB");
|
wb.setName("BASE WB");
|
||||||
wb.setDescription("Normal base WB");
|
wb.setDescription("Normal base WB");
|
||||||
wb.setOwner(user);
|
wb.setOwner(user);
|
||||||
wb.setKey("k5");
|
|
||||||
wb.setDomain("test-domain");
|
wb.setDomain("test-domain");
|
||||||
wb.setType(WorkbasketType.TOPIC);
|
wb.setType(WorkbasketType.TOPIC);
|
||||||
wb = (WorkbasketImpl) workbasketService.createWorkbasket(wb);
|
wb = (WorkbasketImpl) workbasketService.createWorkbasket(wb);
|
||||||
createWorkbasketWithSecurity(wb, wb.getOwner(), true, true, true, true);
|
createWorkbasketWithSecurity(wb, wb.getOwner(), true, true, true, true);
|
||||||
|
|
||||||
WorkbasketImpl wbNoAppend = (WorkbasketImpl) workbasketService.newWorkbasket();
|
WorkbasketImpl wbNoAppend = (WorkbasketImpl) workbasketService.newWorkbasket("key77");
|
||||||
wbNoAppend.setName("Test-Security-WorkBasket-APPEND");
|
wbNoAppend.setName("Test-Security-WorkBasket-APPEND");
|
||||||
wbNoAppend.setDescription("Workbasket without permission APPEND on Task");
|
wbNoAppend.setDescription("Workbasket without permission APPEND on Task");
|
||||||
wbNoAppend.setOwner(user);
|
wbNoAppend.setOwner(user);
|
||||||
wbNoAppend.setDomain("d2");
|
wbNoAppend.setDomain("d2");
|
||||||
wbNoAppend.setType(WorkbasketType.PERSONAL);
|
wbNoAppend.setType(WorkbasketType.PERSONAL);
|
||||||
wbNoAppend.setKey("key77");
|
|
||||||
wbNoAppend = (WorkbasketImpl) workbasketService.createWorkbasket(wbNoAppend);
|
wbNoAppend = (WorkbasketImpl) workbasketService.createWorkbasket(wbNoAppend);
|
||||||
createWorkbasketWithSecurity(wbNoAppend, wbNoAppend.getOwner(), true, true, false, true);
|
createWorkbasketWithSecurity(wbNoAppend, wbNoAppend.getOwner(), true, true, false, true);
|
||||||
|
|
||||||
WorkbasketImpl wbNoTransfer = (WorkbasketImpl) workbasketService.newWorkbasket();
|
WorkbasketImpl wbNoTransfer = (WorkbasketImpl) workbasketService.newWorkbasket("k99");
|
||||||
wbNoTransfer.setName("Test-Security-WorkBasket-TRANSFER");
|
wbNoTransfer.setName("Test-Security-WorkBasket-TRANSFER");
|
||||||
wbNoTransfer.setDescription("Workbasket without permission TRANSFER on Task");
|
wbNoTransfer.setDescription("Workbasket without permission TRANSFER on Task");
|
||||||
wbNoTransfer.setOwner(user);
|
wbNoTransfer.setOwner(user);
|
||||||
wbNoTransfer.setDomain("test-domain");
|
wbNoTransfer.setDomain("test-domain");
|
||||||
wbNoTransfer.setType(WorkbasketType.CLEARANCE);
|
wbNoTransfer.setType(WorkbasketType.CLEARANCE);
|
||||||
wbNoTransfer.setKey("k99");
|
|
||||||
wbNoTransfer = (WorkbasketImpl) workbasketService.createWorkbasket(wbNoTransfer);
|
wbNoTransfer = (WorkbasketImpl) workbasketService.createWorkbasket(wbNoTransfer);
|
||||||
createWorkbasketWithSecurity(wbNoTransfer, wbNoTransfer.getOwner(), true, true, true, false);
|
createWorkbasketWithSecurity(wbNoTransfer, wbNoTransfer.getOwner(), true, true, true, false);
|
||||||
|
|
||||||
|
@ -441,8 +433,7 @@ public class TaskServiceImplIntAutocommitTest {
|
||||||
WorkbasketNotFoundException, NotAuthorizedException, ClassificationNotFoundException,
|
WorkbasketNotFoundException, NotAuthorizedException, ClassificationNotFoundException,
|
||||||
ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException,
|
ClassificationAlreadyExistException, TaskAlreadyExistException, InvalidWorkbasketException,
|
||||||
InvalidArgumentException {
|
InvalidArgumentException {
|
||||||
Workbasket wb = workbasketService.newWorkbasket();
|
Workbasket wb = workbasketService.newWorkbasket("workbasket");
|
||||||
wb.setKey("workbasket");
|
|
||||||
wb.setName("workbasket");
|
wb.setName("workbasket");
|
||||||
wb.setType(WorkbasketType.GROUP);
|
wb.setType(WorkbasketType.GROUP);
|
||||||
wb.setDomain("novatec");
|
wb.setDomain("novatec");
|
||||||
|
|
|
@ -111,10 +111,10 @@ public class TaskServiceImplIntExplicitTest {
|
||||||
|
|
||||||
generateSampleAccessItems();
|
generateSampleAccessItems();
|
||||||
|
|
||||||
WorkbasketImpl workbasket = (WorkbasketImpl) workbasketService.newWorkbasket();
|
WorkbasketImpl workbasket = (WorkbasketImpl) workbasketService.newWorkbasket("k1");
|
||||||
workbasket.setName("workbasket");
|
workbasket.setName("workbasket");
|
||||||
workbasket.setId("1"); // set id manually for authorization tests
|
workbasket.setId("1"); // set id manually for authorization tests
|
||||||
workbasket.setKey("k1");
|
|
||||||
workbasket.setType(WorkbasketType.GROUP);
|
workbasket.setType(WorkbasketType.GROUP);
|
||||||
workbasket.setDomain("novatec");
|
workbasket.setDomain("novatec");
|
||||||
Classification classification = classificationService.newClassification("novatec", "TEST", "type1");
|
Classification classification = classificationService.newClassification("novatec", "TEST", "type1");
|
||||||
|
@ -185,9 +185,9 @@ public class TaskServiceImplIntExplicitTest {
|
||||||
WorkbasketServiceImpl workBasketServiceImpl = (WorkbasketServiceImpl) te.getWorkbasketService();
|
WorkbasketServiceImpl workBasketServiceImpl = (WorkbasketServiceImpl) te.getWorkbasketService();
|
||||||
ClassificationServiceImpl classificationServiceImpl = (ClassificationServiceImpl) te.getClassificationService();
|
ClassificationServiceImpl classificationServiceImpl = (ClassificationServiceImpl) te.getClassificationService();
|
||||||
|
|
||||||
Workbasket workbasket = workbasketService.newWorkbasket();
|
Workbasket workbasket = workbasketService.newWorkbasket("K99");
|
||||||
workbasket.setName("workbasket");
|
workbasket.setName("workbasket");
|
||||||
workbasket.setKey("K99");
|
|
||||||
workbasket.setName("workbasket99");
|
workbasket.setName("workbasket99");
|
||||||
workbasket.setType(WorkbasketType.GROUP);
|
workbasket.setType(WorkbasketType.GROUP);
|
||||||
workbasket.setDomain("novatec");
|
workbasket.setDomain("novatec");
|
||||||
|
@ -242,11 +242,11 @@ public class TaskServiceImplIntExplicitTest {
|
||||||
|
|
||||||
Instant tomorrow = Instant.now().plus(Duration.ofDays(1L));
|
Instant tomorrow = Instant.now().plus(Duration.ofDays(1L));
|
||||||
|
|
||||||
Workbasket wb = workbasketService.newWorkbasket();
|
Workbasket wb = workbasketService.newWorkbasket("k1");
|
||||||
wb.setDomain("novatec");
|
wb.setDomain("novatec");
|
||||||
wb.setName("wbk1");
|
wb.setName("wbk1");
|
||||||
wb.setType(WorkbasketType.PERSONAL);
|
wb.setType(WorkbasketType.PERSONAL);
|
||||||
wb.setKey("k1");
|
|
||||||
workbasketService.createWorkbasket(wb);
|
workbasketService.createWorkbasket(wb);
|
||||||
|
|
||||||
Task test = taskServiceImpl.newTask("k1");
|
Task test = taskServiceImpl.newTask("k1");
|
||||||
|
@ -306,9 +306,8 @@ public class TaskServiceImplIntExplicitTest {
|
||||||
|
|
||||||
generateSampleAccessItems();
|
generateSampleAccessItems();
|
||||||
|
|
||||||
Workbasket wb = workbasketService.newWorkbasket();
|
Workbasket wb = workbasketService.newWorkbasket("WB NR.1");
|
||||||
wb.setName("dummy-WB");
|
wb.setName("dummy-WB");
|
||||||
wb.setKey("WB NR.1");
|
|
||||||
wb.setDomain("nova");
|
wb.setDomain("nova");
|
||||||
wb.setType(WorkbasketType.PERSONAL);
|
wb.setType(WorkbasketType.PERSONAL);
|
||||||
wb = workbasketService.createWorkbasket(wb);
|
wb = workbasketService.createWorkbasket(wb);
|
||||||
|
@ -335,12 +334,11 @@ public class TaskServiceImplIntExplicitTest {
|
||||||
|
|
||||||
generateSampleAccessItems();
|
generateSampleAccessItems();
|
||||||
|
|
||||||
WorkbasketImpl workbasket = (WorkbasketImpl) workbasketService.newWorkbasket();
|
WorkbasketImpl workbasket = (WorkbasketImpl) workbasketService.newWorkbasket("k1");
|
||||||
workbasket.setName("workbasket");
|
workbasket.setName("workbasket");
|
||||||
Classification classification = classificationService.newClassification("novatec", "TEST", "t1");
|
Classification classification = classificationService.newClassification("novatec", "TEST", "t1");
|
||||||
classificationService.createClassification(classification);
|
classificationService.createClassification(classification);
|
||||||
workbasket.setId("1"); // set id manually for authorization tests
|
workbasket.setId("1"); // set id manually for authorization tests
|
||||||
workbasket.setKey("k1");
|
|
||||||
workbasket.setType(WorkbasketType.GROUP);
|
workbasket.setType(WorkbasketType.GROUP);
|
||||||
workbasket.setDomain("novatec");
|
workbasket.setDomain("novatec");
|
||||||
workbasket = (WorkbasketImpl) workbasketService.createWorkbasket(workbasket);
|
workbasket = (WorkbasketImpl) workbasketService.createWorkbasket(workbasket);
|
||||||
|
@ -389,12 +387,11 @@ public class TaskServiceImplIntExplicitTest {
|
||||||
taskanaEngineImpl.setConnection(connection);
|
taskanaEngineImpl.setConnection(connection);
|
||||||
|
|
||||||
// Source Workbasket
|
// Source Workbasket
|
||||||
wb = (WorkbasketImpl) workbasketService.newWorkbasket();
|
wb = (WorkbasketImpl) workbasketService.newWorkbasket("sourceWbKey");
|
||||||
wb.setName("Basic-Workbasket");
|
wb.setName("Basic-Workbasket");
|
||||||
wb.setDescription("Just used as base WB for Task here");
|
wb.setDescription("Just used as base WB for Task here");
|
||||||
wb.setOwner(user);
|
wb.setOwner(user);
|
||||||
wb.setDomain("domain");
|
wb.setDomain("domain");
|
||||||
wb.setKey("sourceWbKey");
|
|
||||||
wb.setType(WorkbasketType.PERSONAL);
|
wb.setType(WorkbasketType.PERSONAL);
|
||||||
sourceWB = workbasketService.createWorkbasket(wb);
|
sourceWB = workbasketService.createWorkbasket(wb);
|
||||||
|
|
||||||
|
@ -402,13 +399,13 @@ public class TaskServiceImplIntExplicitTest {
|
||||||
createWorkbasketWithSecurity(sourceWB, sourceWB.getOwner(), true, true, true, true);
|
createWorkbasketWithSecurity(sourceWB, sourceWB.getOwner(), true, true, true, true);
|
||||||
|
|
||||||
// Destination Workbasket
|
// Destination Workbasket
|
||||||
wb = (WorkbasketImpl) workbasketService.newWorkbasket();
|
wb = (WorkbasketImpl) workbasketService.newWorkbasket("wb2Key");
|
||||||
wb.setName("Desination-WorkBasket");
|
wb.setName("Desination-WorkBasket");
|
||||||
wb.setDescription("Destination WB where Task should be transfered to");
|
wb.setDescription("Destination WB where Task should be transfered to");
|
||||||
wb.setOwner(user);
|
wb.setOwner(user);
|
||||||
wb.setDomain("domain");
|
wb.setDomain("domain");
|
||||||
wb.setType(WorkbasketType.TOPIC);
|
wb.setType(WorkbasketType.TOPIC);
|
||||||
wb.setKey("wb2Key");
|
|
||||||
destinationWB = workbasketService.createWorkbasket(wb);
|
destinationWB = workbasketService.createWorkbasket(wb);
|
||||||
createWorkbasketWithSecurity(destinationWB, destinationWB.getOwner(), false, true, true, true);
|
createWorkbasketWithSecurity(destinationWB, destinationWB.getOwner(), false, true, true, true);
|
||||||
|
|
||||||
|
@ -476,31 +473,29 @@ public class TaskServiceImplIntExplicitTest {
|
||||||
classification.setName("Transfert-Task Classification");
|
classification.setName("Transfert-Task Classification");
|
||||||
classificationService.createClassification(classification);
|
classificationService.createClassification(classification);
|
||||||
|
|
||||||
WorkbasketImpl wb = (WorkbasketImpl) workbasketService.newWorkbasket();
|
WorkbasketImpl wb = (WorkbasketImpl) workbasketService.newWorkbasket("wbKey1");
|
||||||
wb.setName("BASE WB");
|
wb.setName("BASE WB");
|
||||||
wb.setDescription("Normal base WB");
|
wb.setDescription("Normal base WB");
|
||||||
wb.setOwner(user);
|
wb.setOwner(user);
|
||||||
wb.setKey("wbKey1");
|
|
||||||
wb.setDomain("test-domain");
|
wb.setDomain("test-domain");
|
||||||
wb.setType(WorkbasketType.GROUP);
|
wb.setType(WorkbasketType.GROUP);
|
||||||
wb = (WorkbasketImpl) workbasketService.createWorkbasket(wb);
|
wb = (WorkbasketImpl) workbasketService.createWorkbasket(wb);
|
||||||
createWorkbasketWithSecurity(wb, wb.getOwner(), true, true, true, true);
|
createWorkbasketWithSecurity(wb, wb.getOwner(), true, true, true, true);
|
||||||
|
|
||||||
WorkbasketImpl wbNoAppend = (WorkbasketImpl) workbasketService.newWorkbasket();
|
WorkbasketImpl wbNoAppend = (WorkbasketImpl) workbasketService.newWorkbasket("keyNoAppend");
|
||||||
wbNoAppend.setName("Test-Security-WorkBasket-APPEND");
|
wbNoAppend.setName("Test-Security-WorkBasket-APPEND");
|
||||||
wbNoAppend.setDescription("Workbasket without permission APPEND on Task");
|
wbNoAppend.setDescription("Workbasket without permission APPEND on Task");
|
||||||
wbNoAppend.setOwner(user);
|
wbNoAppend.setOwner(user);
|
||||||
wbNoAppend.setKey("keyNoAppend");
|
|
||||||
wbNoAppend.setDomain("anotherDomain");
|
wbNoAppend.setDomain("anotherDomain");
|
||||||
wbNoAppend.setType(WorkbasketType.CLEARANCE);
|
wbNoAppend.setType(WorkbasketType.CLEARANCE);
|
||||||
wbNoAppend = (WorkbasketImpl) workbasketService.createWorkbasket(wbNoAppend);
|
wbNoAppend = (WorkbasketImpl) workbasketService.createWorkbasket(wbNoAppend);
|
||||||
createWorkbasketWithSecurity(wbNoAppend, wbNoAppend.getOwner(), true, true, false, true);
|
createWorkbasketWithSecurity(wbNoAppend, wbNoAppend.getOwner(), true, true, false, true);
|
||||||
|
|
||||||
WorkbasketImpl wbNoTransfer = (WorkbasketImpl) workbasketService.newWorkbasket();
|
WorkbasketImpl wbNoTransfer = (WorkbasketImpl) workbasketService.newWorkbasket("keyNoTransfer");
|
||||||
wbNoTransfer.setName("Test-Security-WorkBasket-TRANSFER");
|
wbNoTransfer.setName("Test-Security-WorkBasket-TRANSFER");
|
||||||
wbNoTransfer.setDescription("Workbasket without permission TRANSFER on Task");
|
wbNoTransfer.setDescription("Workbasket without permission TRANSFER on Task");
|
||||||
wbNoTransfer.setOwner(user);
|
wbNoTransfer.setOwner(user);
|
||||||
wbNoTransfer.setKey("keyNoTransfer");
|
|
||||||
wbNoTransfer.setDomain("test-domain");
|
wbNoTransfer.setDomain("test-domain");
|
||||||
wbNoTransfer.setType(WorkbasketType.GROUP);
|
wbNoTransfer.setType(WorkbasketType.GROUP);
|
||||||
wbNoTransfer = (WorkbasketImpl) workbasketService.createWorkbasket(wbNoTransfer);
|
wbNoTransfer = (WorkbasketImpl) workbasketService.createWorkbasket(wbNoTransfer);
|
||||||
|
@ -545,8 +540,7 @@ public class TaskServiceImplIntExplicitTest {
|
||||||
|
|
||||||
private Task generateDummyTask() throws ClassificationAlreadyExistException, ClassificationNotFoundException,
|
private Task generateDummyTask() throws ClassificationAlreadyExistException, ClassificationNotFoundException,
|
||||||
WorkbasketNotFoundException, InvalidWorkbasketException, NotAuthorizedException {
|
WorkbasketNotFoundException, InvalidWorkbasketException, NotAuthorizedException {
|
||||||
WorkbasketImpl workbasket = (WorkbasketImpl) workbasketService.newWorkbasket();
|
WorkbasketImpl workbasket = (WorkbasketImpl) workbasketService.newWorkbasket("wb");
|
||||||
workbasket.setKey("wb");
|
|
||||||
workbasket.setName("wb");
|
workbasket.setName("wb");
|
||||||
workbasket.setId("1"); // set id manually for authorization tests
|
workbasket.setId("1"); // set id manually for authorization tests
|
||||||
workbasket.setType(WorkbasketType.GROUP);
|
workbasket.setType(WorkbasketType.GROUP);
|
||||||
|
|
|
@ -89,10 +89,9 @@ public class WorkbasketServiceImplIntAutocommitTest {
|
||||||
public void testInsertWorkbasket()
|
public void testInsertWorkbasket()
|
||||||
throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketNotFoundException {
|
throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketNotFoundException {
|
||||||
int before = workBasketService.getWorkbaskets().size();
|
int before = workBasketService.getWorkbaskets().size();
|
||||||
WorkbasketImpl workbasket = (WorkbasketImpl) workBasketService.newWorkbasket();
|
WorkbasketImpl workbasket = (WorkbasketImpl) workBasketService.newWorkbasket("key");
|
||||||
String id1 = IdGenerator.generateWithPrefix("TWB");
|
String id1 = IdGenerator.generateWithPrefix("TWB");
|
||||||
workbasket.setId(id1);
|
workbasket.setId(id1);
|
||||||
workbasket.setKey("key");
|
|
||||||
workbasket.setName("Megabasket");
|
workbasket.setName("Megabasket");
|
||||||
workbasket.setType(WorkbasketType.GROUP);
|
workbasket.setType(WorkbasketType.GROUP);
|
||||||
workbasket.setDomain("novatec");
|
workbasket.setDomain("novatec");
|
||||||
|
@ -104,26 +103,23 @@ public class WorkbasketServiceImplIntAutocommitTest {
|
||||||
public void testSelectAllWorkbaskets()
|
public void testSelectAllWorkbaskets()
|
||||||
throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketNotFoundException {
|
throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketNotFoundException {
|
||||||
int before = workBasketService.getWorkbaskets().size();
|
int before = workBasketService.getWorkbaskets().size();
|
||||||
WorkbasketImpl workbasket0 = (WorkbasketImpl) workBasketService.newWorkbasket();
|
WorkbasketImpl workbasket0 = (WorkbasketImpl) workBasketService.newWorkbasket("key0");
|
||||||
String id0 = IdGenerator.generateWithPrefix("TWB");
|
String id0 = IdGenerator.generateWithPrefix("TWB");
|
||||||
workbasket0.setId(id0);
|
workbasket0.setId(id0);
|
||||||
workbasket0.setKey("key0");
|
|
||||||
workbasket0.setName("Superbasket");
|
workbasket0.setName("Superbasket");
|
||||||
workbasket0.setType(WorkbasketType.PERSONAL);
|
workbasket0.setType(WorkbasketType.PERSONAL);
|
||||||
workbasket0.setDomain("novatec");
|
workbasket0.setDomain("novatec");
|
||||||
workBasketService.createWorkbasket(workbasket0);
|
workBasketService.createWorkbasket(workbasket0);
|
||||||
WorkbasketImpl workbasket1 = (WorkbasketImpl) workBasketService.newWorkbasket();
|
WorkbasketImpl workbasket1 = (WorkbasketImpl) workBasketService.newWorkbasket("key1");
|
||||||
String id1 = IdGenerator.generateWithPrefix("TWB");
|
String id1 = IdGenerator.generateWithPrefix("TWB");
|
||||||
workbasket1.setId(id1);
|
workbasket1.setId(id1);
|
||||||
workbasket1.setKey("key1");
|
|
||||||
workbasket1.setName("Megabasket");
|
workbasket1.setName("Megabasket");
|
||||||
workbasket1.setType(WorkbasketType.GROUP);
|
workbasket1.setType(WorkbasketType.GROUP);
|
||||||
workbasket1.setDomain("novatec");
|
workbasket1.setDomain("novatec");
|
||||||
workBasketService.createWorkbasket(workbasket1);
|
workBasketService.createWorkbasket(workbasket1);
|
||||||
WorkbasketImpl workbasket2 = (WorkbasketImpl) workBasketService.newWorkbasket();
|
WorkbasketImpl workbasket2 = (WorkbasketImpl) workBasketService.newWorkbasket("key2");
|
||||||
String id2 = IdGenerator.generateWithPrefix("TWB");
|
String id2 = IdGenerator.generateWithPrefix("TWB");
|
||||||
workbasket2.setId(id2);
|
workbasket2.setId(id2);
|
||||||
workbasket2.setKey("key2");
|
|
||||||
workbasket2.setName("Hyperbasket");
|
workbasket2.setName("Hyperbasket");
|
||||||
workbasket2.setType(WorkbasketType.GROUP);
|
workbasket2.setType(WorkbasketType.GROUP);
|
||||||
workbasket2.setDomain("novatec");
|
workbasket2.setDomain("novatec");
|
||||||
|
@ -339,9 +335,8 @@ public class WorkbasketServiceImplIntAutocommitTest {
|
||||||
|
|
||||||
private void generateSampleDataForQuery()
|
private void generateSampleDataForQuery()
|
||||||
throws InvalidWorkbasketException, WorkbasketNotFoundException, NotAuthorizedException {
|
throws InvalidWorkbasketException, WorkbasketNotFoundException, NotAuthorizedException {
|
||||||
WorkbasketImpl basket1 = (WorkbasketImpl) workBasketService.newWorkbasket();
|
WorkbasketImpl basket1 = (WorkbasketImpl) workBasketService.newWorkbasket("k1");
|
||||||
basket1.setId("1");
|
basket1.setId("1");
|
||||||
basket1.setKey("k1");
|
|
||||||
basket1.setName("Basket1");
|
basket1.setName("Basket1");
|
||||||
basket1.setOwner("Eberhardt");
|
basket1.setOwner("Eberhardt");
|
||||||
basket1.setType(WorkbasketType.GROUP);
|
basket1.setType(WorkbasketType.GROUP);
|
||||||
|
@ -357,9 +352,8 @@ public class WorkbasketServiceImplIntAutocommitTest {
|
||||||
accessItem.setPermRead(true);
|
accessItem.setPermRead(true);
|
||||||
workBasketService.createWorkbasketAuthorization(accessItem);
|
workBasketService.createWorkbasketAuthorization(accessItem);
|
||||||
|
|
||||||
WorkbasketImpl basket2 = (WorkbasketImpl) workBasketService.newWorkbasket();
|
WorkbasketImpl basket2 = (WorkbasketImpl) workBasketService.newWorkbasket("k2");
|
||||||
basket2.setId("2");
|
basket2.setId("2");
|
||||||
basket2.setKey("k2");
|
|
||||||
basket2.setName("Basket2");
|
basket2.setName("Basket2");
|
||||||
basket2.setOwner("Konstantin");
|
basket2.setOwner("Konstantin");
|
||||||
basket2.setType(WorkbasketType.CLEARANCE);
|
basket2.setType(WorkbasketType.CLEARANCE);
|
||||||
|
@ -376,9 +370,8 @@ public class WorkbasketServiceImplIntAutocommitTest {
|
||||||
accessItem2.setPermOpen(true);
|
accessItem2.setPermOpen(true);
|
||||||
workBasketService.createWorkbasketAuthorization(accessItem2);
|
workBasketService.createWorkbasketAuthorization(accessItem2);
|
||||||
|
|
||||||
WorkbasketImpl basket3 = (WorkbasketImpl) workBasketService.newWorkbasket();
|
WorkbasketImpl basket3 = (WorkbasketImpl) workBasketService.newWorkbasket("k3");
|
||||||
basket3.setId("3");
|
basket3.setId("3");
|
||||||
basket3.setKey("k3");
|
|
||||||
basket3.setName("Basket3");
|
basket3.setName("Basket3");
|
||||||
basket3.setOwner("Holger");
|
basket3.setOwner("Holger");
|
||||||
basket3.setType(WorkbasketType.TOPIC);
|
basket3.setType(WorkbasketType.TOPIC);
|
||||||
|
@ -393,9 +386,8 @@ public class WorkbasketServiceImplIntAutocommitTest {
|
||||||
accessItem3.setPermAppend(true);
|
accessItem3.setPermAppend(true);
|
||||||
workBasketService.createWorkbasketAuthorization(accessItem3);
|
workBasketService.createWorkbasketAuthorization(accessItem3);
|
||||||
|
|
||||||
WorkbasketImpl basket4 = (WorkbasketImpl) workBasketService.newWorkbasket();
|
WorkbasketImpl basket4 = (WorkbasketImpl) workBasketService.newWorkbasket("k4");
|
||||||
basket4.setId("4");
|
basket4.setId("4");
|
||||||
basket4.setKey("k4");
|
|
||||||
basket4.setName("Basket4");
|
basket4.setName("Basket4");
|
||||||
basket4.setOwner("Holger");
|
basket4.setOwner("Holger");
|
||||||
basket4.setType(WorkbasketType.PERSONAL);
|
basket4.setType(WorkbasketType.PERSONAL);
|
||||||
|
@ -454,9 +446,8 @@ public class WorkbasketServiceImplIntAutocommitTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Workbasket createTestWorkbasket(String id, String key, String domain, String name, WorkbasketType type) {
|
private Workbasket createTestWorkbasket(String id, String key, String domain, String name, WorkbasketType type) {
|
||||||
WorkbasketImpl wb = (WorkbasketImpl) workBasketService.newWorkbasket();
|
WorkbasketImpl wb = (WorkbasketImpl) workBasketService.newWorkbasket(key);
|
||||||
wb.setId(id);
|
wb.setId(id);
|
||||||
wb.setKey(key);
|
|
||||||
wb.setDomain(domain);
|
wb.setDomain(domain);
|
||||||
wb.setName(name);
|
wb.setName(name);
|
||||||
wb.setDescription("Description of a Workbasket...");
|
wb.setDescription("Description of a Workbasket...");
|
||||||
|
|
|
@ -80,10 +80,9 @@ public class WorkbasketServiceImplIntExplicitTest {
|
||||||
taskanaEngineImpl.setConnection(connection);
|
taskanaEngineImpl.setConnection(connection);
|
||||||
workBasketService = taskanaEngine.getWorkbasketService();
|
workBasketService = taskanaEngine.getWorkbasketService();
|
||||||
int before = workBasketService.getWorkbaskets().size();
|
int before = workBasketService.getWorkbaskets().size();
|
||||||
WorkbasketImpl workbasket = (WorkbasketImpl) workBasketService.newWorkbasket();
|
WorkbasketImpl workbasket = (WorkbasketImpl) workBasketService.newWorkbasket("key");
|
||||||
String id1 = IdGenerator.generateWithPrefix("TWB");
|
String id1 = IdGenerator.generateWithPrefix("TWB");
|
||||||
workbasket.setId(id1);
|
workbasket.setId(id1);
|
||||||
workbasket.setKey("key");
|
|
||||||
workbasket.setName("Megabasket");
|
workbasket.setName("Megabasket");
|
||||||
workbasket.setType(WorkbasketType.GROUP);
|
workbasket.setType(WorkbasketType.GROUP);
|
||||||
workbasket.setDomain("novatec");
|
workbasket.setDomain("novatec");
|
||||||
|
@ -99,26 +98,23 @@ public class WorkbasketServiceImplIntExplicitTest {
|
||||||
taskanaEngineImpl.setConnection(connection);
|
taskanaEngineImpl.setConnection(connection);
|
||||||
workBasketService = taskanaEngine.getWorkbasketService();
|
workBasketService = taskanaEngine.getWorkbasketService();
|
||||||
int before = workBasketService.getWorkbaskets().size();
|
int before = workBasketService.getWorkbaskets().size();
|
||||||
WorkbasketImpl workbasket0 = (WorkbasketImpl) workBasketService.newWorkbasket();
|
WorkbasketImpl workbasket0 = (WorkbasketImpl) workBasketService.newWorkbasket("key0");
|
||||||
String id0 = IdGenerator.generateWithPrefix("TWB");
|
String id0 = IdGenerator.generateWithPrefix("TWB");
|
||||||
workbasket0.setId(id0);
|
workbasket0.setId(id0);
|
||||||
workbasket0.setKey("key0");
|
|
||||||
workbasket0.setName("Superbasket");
|
workbasket0.setName("Superbasket");
|
||||||
workbasket0.setType(WorkbasketType.GROUP);
|
workbasket0.setType(WorkbasketType.GROUP);
|
||||||
workbasket0.setDomain("novatec");
|
workbasket0.setDomain("novatec");
|
||||||
workBasketService.createWorkbasket(workbasket0);
|
workBasketService.createWorkbasket(workbasket0);
|
||||||
WorkbasketImpl workbasket1 = (WorkbasketImpl) workBasketService.newWorkbasket();
|
WorkbasketImpl workbasket1 = (WorkbasketImpl) workBasketService.newWorkbasket("key1");
|
||||||
String id1 = IdGenerator.generateWithPrefix("TWB");
|
String id1 = IdGenerator.generateWithPrefix("TWB");
|
||||||
workbasket1.setId(id1);
|
workbasket1.setId(id1);
|
||||||
workbasket1.setKey("key1");
|
|
||||||
workbasket1.setName("Megabasket");
|
workbasket1.setName("Megabasket");
|
||||||
workbasket1.setType(WorkbasketType.GROUP);
|
workbasket1.setType(WorkbasketType.GROUP);
|
||||||
workbasket1.setDomain("novatec");
|
workbasket1.setDomain("novatec");
|
||||||
workbasket1 = (WorkbasketImpl) workBasketService.createWorkbasket(workbasket1);
|
workbasket1 = (WorkbasketImpl) workBasketService.createWorkbasket(workbasket1);
|
||||||
WorkbasketImpl workbasket2 = (WorkbasketImpl) workBasketService.newWorkbasket();
|
WorkbasketImpl workbasket2 = (WorkbasketImpl) workBasketService.newWorkbasket("key2");
|
||||||
String id2 = IdGenerator.generateWithPrefix("TWB");
|
String id2 = IdGenerator.generateWithPrefix("TWB");
|
||||||
workbasket2.setId(id2);
|
workbasket2.setId(id2);
|
||||||
workbasket2.setKey("key2");
|
|
||||||
workbasket2.setName("Hyperbasket");
|
workbasket2.setName("Hyperbasket");
|
||||||
workbasket2.setType(WorkbasketType.GROUP);
|
workbasket2.setType(WorkbasketType.GROUP);
|
||||||
workbasket2.setDomain("novatec");
|
workbasket2.setDomain("novatec");
|
||||||
|
@ -135,10 +131,9 @@ public class WorkbasketServiceImplIntExplicitTest {
|
||||||
Connection connection = dataSource.getConnection();
|
Connection connection = dataSource.getConnection();
|
||||||
taskanaEngineImpl.setConnection(connection);
|
taskanaEngineImpl.setConnection(connection);
|
||||||
workBasketService = taskanaEngine.getWorkbasketService();
|
workBasketService = taskanaEngine.getWorkbasketService();
|
||||||
WorkbasketImpl workbasket = (WorkbasketImpl) workBasketService.newWorkbasket();
|
WorkbasketImpl workbasket = (WorkbasketImpl) workBasketService.newWorkbasket("key0");
|
||||||
String id0 = IdGenerator.generateWithPrefix("TWB");
|
String id0 = IdGenerator.generateWithPrefix("TWB");
|
||||||
workbasket.setId(id0);
|
workbasket.setId(id0);
|
||||||
workbasket.setKey("key0");
|
|
||||||
workbasket.setName("Superbasket");
|
workbasket.setName("Superbasket");
|
||||||
workbasket.setType(WorkbasketType.GROUP);
|
workbasket.setType(WorkbasketType.GROUP);
|
||||||
workbasket.setDomain("novatec");
|
workbasket.setDomain("novatec");
|
||||||
|
@ -299,9 +294,8 @@ public class WorkbasketServiceImplIntExplicitTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Workbasket createTestWorkbasket(String id, String key, String domain, String name, WorkbasketType type) {
|
private Workbasket createTestWorkbasket(String id, String key, String domain, String name, WorkbasketType type) {
|
||||||
WorkbasketImpl wb = (WorkbasketImpl) workBasketService.newWorkbasket();
|
WorkbasketImpl wb = (WorkbasketImpl) workBasketService.newWorkbasket(key);
|
||||||
wb.setId(id);
|
wb.setId(id);
|
||||||
wb.setKey(key);
|
|
||||||
wb.setDomain(domain);
|
wb.setDomain(domain);
|
||||||
wb.setName(name);
|
wb.setName(name);
|
||||||
wb.setDescription("Description of a Workbasket...");
|
wb.setDescription("Description of a Workbasket...");
|
||||||
|
|
|
@ -116,10 +116,9 @@ public class TaskanaTestController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Workbasket createWorkBasket(String key, String name) {
|
private Workbasket createWorkBasket(String key, String name) {
|
||||||
WorkbasketImpl workbasket = (WorkbasketImpl) taskanaEngine.getWorkbasketService().newWorkbasket();
|
WorkbasketImpl workbasket = (WorkbasketImpl) taskanaEngine.getWorkbasketService().newWorkbasket(key);
|
||||||
String id1 = IdGenerator.generateWithPrefix("TWB");
|
String id1 = IdGenerator.generateWithPrefix("TWB");
|
||||||
workbasket.setId(id1);
|
workbasket.setId(id1);
|
||||||
workbasket.setKey(key);
|
|
||||||
workbasket.setName(name);
|
workbasket.setName(name);
|
||||||
workbasket.setType(WorkbasketType.GROUP);
|
workbasket.setType(WorkbasketType.GROUP);
|
||||||
workbasket.setDomain("generali");
|
workbasket.setDomain("generali");
|
||||||
|
|
|
@ -27,7 +27,7 @@ import pro.taskana.model.WorkbasketAccessItem;
|
||||||
import pro.taskana.model.WorkbasketAuthorization;
|
import pro.taskana.model.WorkbasketAuthorization;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(path = "/v1/workbaskets", produces = { MediaType.APPLICATION_JSON_VALUE })
|
@RequestMapping(path = "/v1/workbaskets", produces = {MediaType.APPLICATION_JSON_VALUE})
|
||||||
public class WorkbasketController {
|
public class WorkbasketController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -110,10 +110,6 @@ public class WorkbasketController {
|
||||||
return new ResponseEntity<>(createdWorkbasket, HttpStatus.CREATED);
|
return new ResponseEntity<>(createdWorkbasket, HttpStatus.CREATED);
|
||||||
} catch (InvalidWorkbasketException e) {
|
} catch (InvalidWorkbasketException e) {
|
||||||
return new ResponseEntity<>(HttpStatus.CONFLICT);
|
return new ResponseEntity<>(HttpStatus.CONFLICT);
|
||||||
} catch (WorkbasketNotFoundException e) {
|
|
||||||
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
|
|
||||||
} catch (NotAuthorizedException e) {
|
|
||||||
return new ResponseEntity<>(HttpStatus.UNAUTHORIZED);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue