Add test data

This commit is contained in:
BVier 2018-01-10 18:56:58 +01:00 committed by Holger Hagen
parent a368cdd8e4
commit 588c30887c
7 changed files with 54 additions and 100 deletions

View File

@ -18,8 +18,9 @@ public interface TaskQuery extends BaseQuery<Task> {
TaskQuery name(String... name);
/**
* Add your description for pattern matching to your query. It will be compared in SQL with the LIKE operator. You
* may use a wildcard like % to specify the pattern.
* Add your description for pattern matching to your query. It will be compared
* in SQL with the LIKE operator. You may use a wildcard like % to specify the
* pattern.
*
* @param description
* your description
@ -46,7 +47,8 @@ public interface TaskQuery extends BaseQuery<Task> {
TaskQuery state(TaskState... states);
/**
* Add your classification to your query. The classification query can be obtained from the ClassificationService
* Add your classification to your query. The classification query can be
* obtained from the ClassificationService
*
* @param classificationQuery
* the classification query
@ -72,7 +74,7 @@ public interface TaskQuery extends BaseQuery<Task> {
* the domain as String
* @return the query
*/
TaskQuery domain(String... domain);
TaskQuery domainIn(String... domain);
/**
* Add the owners to your query.
@ -84,7 +86,8 @@ public interface TaskQuery extends BaseQuery<Task> {
TaskQuery owner(String... owners);
/**
* Add the companies of the primary object reference for exact matching to your query.
* Add the companies of the primary object reference for exact matching to your
* query.
*
* @param companies
* the companies of your primary object reference
@ -93,8 +96,9 @@ public interface TaskQuery extends BaseQuery<Task> {
TaskQuery primaryObjectReferenceCompanyIn(String... companies);
/**
* Add the company of the primary object reference for pattern matching to your query. It will be compared in SQL
* with the LIKE operator. You may use a wildcard like % to specify the pattern.
* Add the company of the primary object reference for pattern matching to your
* query. It will be compared in SQL with the LIKE operator. You may use a
* wildcard like % to specify the pattern.
*
* @param company
* the company of your primary object reference
@ -103,7 +107,8 @@ public interface TaskQuery extends BaseQuery<Task> {
TaskQuery primaryObjectReferenceCompanyLike(String company);
/**
* Add the systems of the primary object reference for exact matching to your query.
* Add the systems of the primary object reference for exact matching to your
* query.
*
* @param systems
* the systems of your primary object reference
@ -112,8 +117,9 @@ public interface TaskQuery extends BaseQuery<Task> {
TaskQuery primaryObjectReferenceSystemIn(String... systems);
/**
* Add the system of the primary object reference for pattern matching to your query. It will be compared in SQL
* with the LIKE operator. You may use a wildcard like % to specify the pattern.
* Add the system of the primary object reference for pattern matching to your
* query. It will be compared in SQL with the LIKE operator. You may use a
* wildcard like % to specify the pattern.
*
* @param system
* the system of your primary object reference
@ -122,7 +128,8 @@ public interface TaskQuery extends BaseQuery<Task> {
TaskQuery primaryObjectReferenceSystemLike(String system);
/**
* Add the system instances of the primary object reference for exact matching to your query.
* Add the system instances of the primary object reference for exact matching
* to your query.
*
* @param systemInstances
* the system instances of your primary object reference
@ -131,8 +138,9 @@ public interface TaskQuery extends BaseQuery<Task> {
TaskQuery primaryObjectReferenceSystemInstanceIn(String... systemInstances);
/**
* Add the system instance of the primary object reference for pattern matching to your query. It will be compared
* in SQL with the LIKE operator. You may use a wildcard like % to specify the pattern.
* Add the system instance of the primary object reference for pattern matching
* to your query. It will be compared in SQL with the LIKE operator. You may use
* a wildcard like % to specify the pattern.
*
* @param systemInstance
* the system instance of your primary object reference
@ -141,7 +149,8 @@ public interface TaskQuery extends BaseQuery<Task> {
TaskQuery primaryObjectReferenceSystemInstanceLike(String systemInstance);
/**
* Add the types of the primary object reference for exact matching to your query.
* Add the types of the primary object reference for exact matching to your
* query.
*
* @param types
* the types your primary object reference
@ -150,8 +159,9 @@ public interface TaskQuery extends BaseQuery<Task> {
TaskQuery primaryObjectReferenceTypeIn(String... types);
/**
* Add the type of the primary object reference for pattern matching to your query. It will be compared in SQL with
* the LIKE operator. You may use a wildcard like % to specify the pattern.
* Add the type of the primary object reference for pattern matching to your
* query. It will be compared in SQL with the LIKE operator. You may use a
* wildcard like % to specify the pattern.
*
* @param type
* the type of your primary object reference
@ -160,7 +170,8 @@ public interface TaskQuery extends BaseQuery<Task> {
TaskQuery primaryObjectReferenceTypeLike(String type);
/**
* Add the values of the primary object reference for exact matching to your query.
* Add the values of the primary object reference for exact matching to your
* query.
*
* @param values
* the values of your primary object reference
@ -169,8 +180,9 @@ public interface TaskQuery extends BaseQuery<Task> {
TaskQuery primaryObjectReferenceValueIn(String... values);
/**
* Add the value of the primary object reference for pattern matching to your query. It will be compared in SQL with
* the LIKE operator. You may use a wildcard like % to specify the pattern.
* Add the value of the primary object reference for pattern matching to your
* query. It will be compared in SQL with the LIKE operator. You may use a
* wildcard like % to specify the pattern.
*
* @param value
* the value of your primary object reference
@ -182,7 +194,8 @@ public interface TaskQuery extends BaseQuery<Task> {
* Add the isRead flag to the query.
*
* @param isRead
* as Boolean. If null, it won't be integrated into the statement. You have to set false.
* as Boolean. If null, it won't be integrated into the statement.
* You have to set false.
* @return the query
*/
TaskQuery read(Boolean isRead);
@ -191,13 +204,15 @@ public interface TaskQuery extends BaseQuery<Task> {
* Add the isTransferred flag to the query.
*
* @param isTransferred
* as Boolean. If null, it won't be integrated into the statement. You have to set false.
* as Boolean. If null, it won't be integrated into the statement.
* You have to set false.
* @return the query
*/
TaskQuery transferred(Boolean isTransferred);
/**
* Filter the custom fields with this query. The scan will be run over all 10 fields.
* Filter the custom fields with this query. The scan will be run over all 10
* fields.
*
* @param customFields
* the value in the fields

View File

@ -91,7 +91,7 @@ public class TaskQueryImpl implements TaskQuery {
}
@Override
public TaskQuery domain(String... domain) {
public TaskQuery domainIn(String... domain) {
this.domain = domain;
return this;
}

View File

@ -1,7 +1,6 @@
package acceptance.task;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import java.sql.SQLException;
@ -415,8 +414,6 @@ public class CreateTaskAccTest extends AbstractAccTest {
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket workbasket = workbasketService.getWorkbasketByKey("USER_1_1");
workbasket.setDomain("domainXY");
workbasketService.updateWorkbasket(workbasket);
Task newTask = taskService.newTask();
newTask.setClassification(taskanaEngine.getClassificationService().getClassification("T2100", "DOMAIN_A"));
@ -425,80 +422,10 @@ public class CreateTaskAccTest extends AbstractAccTest {
Task createdTask = taskService.createTask(newTask);
assertNotNull(createdTask);
assertNotNull(createdTask.getDomain());
assertEquals(workbasket.getDomain(), createdTask.getDomain());
}
@WithAccessId(
userName = "user_1_1",
groupNames = { "group_1" })
@Test
public void testDomainChangingWhenTransferTask()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService();
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
Workbasket wb1 = workbasketService.getWorkbasketByKey("USER_1_1");
wb1.setDomain("domain1");
workbasketService.updateWorkbasket(wb1);
Workbasket wb2 = workbasketService.getWorkbasketByKey("USER_2_1");
wb2.setDomain("domain2");
workbasketService.updateWorkbasket(wb2);
Task newTask = taskService.newTask();
newTask.setClassification(taskanaEngine.getClassificationService().getClassification("T2100", "DOMAIN_A"));
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
newTask.setWorkbasketKey("USER_1_1");
Task createdTask = taskService.createTask(newTask);
String domain1 = createdTask.getDomain();
Task transferedTask = taskService.transfer(createdTask.getId(), "USER_2_1");
System.out.println(transferedTask.getDomain());
assertNotNull(transferedTask);
assertNotEquals(domain1, transferedTask.getDomain());
}
@WithAccessId(
userName = "user_1_1",
groupNames = { "group_1" })
@Test(expected = NotAuthorizedException.class)
public void testThrowsExceptionIfTransferWithNoTransferAuthorization()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask();
newTask.setClassification(taskanaEngine.getClassificationService().getClassification("T2100", "DOMAIN_A"));
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
newTask.setWorkbasketKey("USER_1_1");
Task createdTask = taskService.createTask(newTask);
taskService.transfer(createdTask.getId(), "TEAMLEAD_2");
}
@WithAccessId(
userName = "user123",
groupNames = { "group_1" })
@Test(expected = NotAuthorizedException.class)
public void testThrowsExceptionIfTransferWithNoAppendAuthorization()
throws SQLException, NotAuthorizedException, InvalidArgumentException, ClassificationNotFoundException,
WorkbasketNotFoundException, TaskAlreadyExistException, InvalidWorkbasketException, TaskNotFoundException {
TaskService taskService = taskanaEngine.getTaskService();
Task newTask = taskService.newTask();
newTask.setClassification(taskanaEngine.getClassificationService().getClassification("T2100", "DOMAIN_A"));
newTask.setPrimaryObjRef(createObjectReference("COMPANY_A", "SYSTEM_A", "INSTANCE_A", "VNR", "1234567"));
newTask.setWorkbasketKey("USER_1_1");
Task createdTask = taskService.createTask(newTask);
taskService.transfer(createdTask.getId(), "TEAMLEAD_2");
}
@AfterClass
public static void cleanUpClass() {
FileUtils.deleteRecursive("~/data", true);

View File

@ -47,7 +47,7 @@ public class QueryWorkbasketByPermissionAccTest extends AbstractAccTest {
List<Workbasket> results = workbasketService.createWorkbasketQuery()
.access(WorkbasketAuthorization.APPEND, "user_1_1", "group_1")
.list();
Assert.assertEquals(7L, results.size());
Assert.assertEquals(8L, results.size());
}
@Ignore

View File

@ -14,6 +14,8 @@ INSERT INTO TASK VALUES('12', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIME
INSERT INTO TASK VALUES('13', CURRENT_TIMESTAMP, null, null, CURRENT_TIMESTAMP, null, CURRENT_TIMESTAMP, 'Task12', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus massa turpis, pellentesque ut libero sit aet, malesuada suscipit dolor. Sed volutpat euismod felis sit amet molestie. Fusce ornare purus dui. ', 1, 'READY', '13', 'key2', 'domain2', 'BPI13', 'PBPI13', 'Frank', 'Company1', 'System1', 'Instance1', 'Type1', 'Value1', false, false, null, null, null, null, null, null, null, null, null, null, null);
INSERT INTO TASK VALUES('14', CURRENT_TIMESTAMP, null, null, CURRENT_TIMESTAMP, null, CURRENT_TIMESTAMP, 'Task6', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sagittis vulputate nibh ut malesuada. Etiam ac dictum tellus, nec cursus nunc. Curabitur velit eros, feugiat volutpat laoreet vitae, cursus eu dui. Nulla ut purus sem. Vivamus aliquet odio vitae erat cursus, vitae mattis urna mollis. Nam quam tellus, auctor id volutpat congue, viverra vitae ante. Duis nisi dolor, elementum et mattis at, maximus id velit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis eu condimentum risus. Praesent libero velit, facilisis sit amet maximus non, scelerisque ullamcorper leo. Ut sit amet iaculis eros. Mauris sagittis nibh lacus, at facilisis magna suscipit at. Aliquam finibus tempor odio id commodo. Vivamus aliquam, justo id porta imperdiet, mi.', 1, 'READY', '14', 'key1', 'domain1', 'BPI14', 'PBPI14', 'Frank', 'Company2', 'System2', 'Instance2', 'Type2', 'Value2', false, false, null, null, null, null, null, null, null, null, null, null, null);
INSERT INTO TASK VALUES('14', CURRENT_TIMESTAMP, null, null, CURRENT_TIMESTAMP, null, CURRENT_TIMESTAMP, 'Task6', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sagittis vulputate nibh ut malesuada. Etiam ac dictum tellus, nec cursus nunc. Curabitur velit eros, feugiat volutpat laoreet vitae, cursus eu dui. Nulla ut purus sem. Vivamus aliquet odio vitae erat cursus, vitae mattis urna mollis. Nam quam tellus, auctor id volutpat congue, viverra vitae ante. Duis nisi dolor, elementum et mattis at, maximus id velit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis eu condimentum risus. Praesent libero velit, facilisis sit amet maximus non, scelerisque ullamcorper leo. Ut sit amet iaculis eros. Mauris sagittis nibh lacus, at facilisis magna suscipit at. Aliquam finibus tempor odio id commodo. Vivamus aliquam, justo id porta imperdiet, mi.', 1, 'READY', '14', 'key1', 'DOMAIN_B', 'BPI14', 'PBPI14', 'Frank', 'Company2', 'System2', 'Instance2', 'Type2', 'Value2', false, false, null, null, null, null, null, null, null, null, null, null, null);
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000000', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, null, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, null, 'Task99', 'Lorem ipsum was n Quatsch dolor sit amet.', 1, 'READY', '11', 'key17', 'domain1', 'BPI21', 'PBPI21', 'Konrad', 'MyCompany1', 'MySystem1', 'MyInstance1', 'MyType1', 'MyValue1', true, false, null, null, null, null, null, null, null, null, null, null, null);
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000000', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, null, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, null, 'Task99', 'Lorem ipsum was n Quatsch dolor sit amet.', 1, 'READY', '11', 'USER_1_1', '', 'BPI21', 'PBPI21', 'Konrad', 'MyCompany1', 'MySystem1', 'MyInstance1', 'MyType1', 'MyValue1', true, false, null, null, null, null, null, null, null, null, null, null, null);
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000001', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, null, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, null, 'Task01', 'Lorem ipsum was n Quatsch dolor sit amet.', 2, 'READY', '12', 'USER_1_1', 'DOMAIN_A', 'BPI21', 'PBPI21', 'Konrad', 'MyCompany1', 'MySystem1', 'MyInstance1', 'MyType1', 'MyValue1', true, false, null, null, null, null, null, null, null, null, null, null, null);
INSERT INTO TASK VALUES('TKI:000000000000000000000000000000000002', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, null, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, null, 'Task02', 'Lorem ipsum was n Quatsch dolor sit amet. Aber stimmt.', 2, 'READY', '12', 'Gruppenpostkorb KSC B', 'DOMAIN_B', 'BPI21', 'PBPI21', 'Konrad', 'MyCompany1', 'MySystem1', 'MyInstance1', 'MyType1', 'MyValue1', true, false, null, null, null, null, null, null, null, null, null, null, null);

View File

@ -31,3 +31,8 @@ INSERT INTO WORKBASKET_ACCESS_LIST VALUES ('WAI:10000000000000000000000000000000
-- Cross team GPK access
INSERT INTO WORKBASKET_ACCESS_LIST VALUES ('WAI:100000000000000000000000000000000021', 'GPK_KSC', 'teamlead_1', true, true, true, true, true, true, true, true, true, true, true, true, true);
INSERT INTO WORKBASKET_ACCESS_LIST VALUES ('WAI:100000000000000000000000000000000022', 'GPK_KSC', 'teamlead_2', true, true, true, true, true, true, true, true, true, true, true, true, true);
-- Access to other domains
INSERT INTO WORKBASKET_ACCESS_LIST VALUES ('WAI:100000000000000000000000000000000023', 'GPK_B_KSC_1', 'group_1', true, false, true, true, false, false, false, false, false, false, false, false, false);
INSERT INTO WORKBASKET_ACCESS_LIST VALUES ('WAI:100000000000000000000000000000000024', 'GPK_B_KSC_2', 'group_2', true, false, true, true, false, false, false, false, false, false, false, false, false);

View File

@ -12,3 +12,8 @@ INSERT INTO WORKBASKET VALUES ('WBI:100000000000000000000000000000000006', 'USER
INSERT INTO WORKBASKET VALUES ('WBI:100000000000000000000000000000000007', 'USER_1_2', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'PPK User 2 KSC 1', 'DOMAIN_A', 'PERSONAL', 'PPK User 2 KSC 1', '', '', '', '', '', '', '', '', '');
INSERT INTO WORKBASKET VALUES ('WBI:100000000000000000000000000000000008', 'USER_2_1', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'PPK User 1 KSC 2', 'DOMAIN_A', 'PERSONAL', 'PPK User 1 KSC 2', '', '', '', '', '', '', '', '', '');
INSERT INTO WORKBASKET VALUES ('WBI:100000000000000000000000000000000009', 'USER_2_2', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'PPK User 2 KSC 2', 'DOMAIN_A', 'PERSONAL', 'PPK User 2 KSC 2', '', '', '', '', '', '', '', '', '');
-- KSC workbaskets Domain_B
INSERT INTO WORKBASKET VALUES ('WBI:100000000000000000000000000000000011', 'GPK_B_KSC', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Gruppenpostkorb KSC B', 'DOMAIN_B', 'GROUP', 'Gruppenpostkorb KSC', '', '', '', '', '', '', '', '', '');
INSERT INTO WORKBASKET VALUES ('WBI:100000000000000000000000000000000012', 'GPK_B_KSC_1', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Gruppenpostkorb KSC B1', 'DOMAIN_B', 'GROUP', 'Gruppenpostkorb KSC 1', '', '', '', '', '', '', '', '', '');
INSERT INTO WORKBASKET VALUES ('WBI:100000000000000000000000000000000013', 'GPK_B_KSC_2', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Gruppenpostkorb KSC B2', 'DOMAIN_B', 'GROUP', 'Gruppenpostkorb KSC 2', '', '', '', '', '', '', '', '', '');