TSK-65: Fix tests because of failure and update UserPrincipal

This commit is contained in:
Konstantin Kläger 2017-12-08 09:33:06 +01:00
parent 6ed308a767
commit 150508e8e9
3 changed files with 8 additions and 10 deletions

View File

@ -13,10 +13,7 @@ public class UserPrincipal implements Principal {
this.name = name; this.name = name;
} }
public void setName(String name) { @Override
this.name = name;
}
public String getName() { public String getName() {
return this.name; return this.name;
} }

View File

@ -109,13 +109,14 @@ public class TaskServiceImplIntAutocommitTest {
throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException { throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException {
TaskanaEngineConfiguration taskanaEngineConfiguration = new TaskanaEngineConfiguration(null, false, false); TaskanaEngineConfiguration taskanaEngineConfiguration = new TaskanaEngineConfiguration(null, false, false);
TaskanaEngine te = taskanaEngineConfiguration.buildTaskanaEngine(); TaskanaEngine te = taskanaEngineConfiguration.buildTaskanaEngine();
((TaskanaEngineImpl) te).setConnectionManagementMode(ConnectionManagementMode.AUTOCOMMIT);
TaskServiceImpl taskServiceImpl = (TaskServiceImpl) te.getTaskService(); TaskServiceImpl taskServiceImpl = (TaskServiceImpl) te.getTaskService();
Workbasket wb = new Workbasket(); Workbasket wb = new Workbasket();
wb.setName("workbasket"); wb.setName("workbasket");
taskanaEngine.getWorkbasketService().createWorkbasket(wb); te.getWorkbasketService().createWorkbasket(wb);
Classification classification = new Classification(); Classification classification = new Classification();
taskanaEngine.getClassificationService().addClassification(classification); te.getClassificationService().addClassification(classification);
Task task = new Task(); Task task = new Task();
task.setName("Unit Test Task"); task.setName("Unit Test Task");

View File

@ -92,12 +92,12 @@ public class TaskServiceImplIntExplicitTest {
} }
@Test @Test
public void testTaskService() throws Throwable { public void testCreateTask() throws Throwable {
try { try {
Subject.doAs(subject, new PrivilegedExceptionAction<Object>() { Subject.doAs(subject, new PrivilegedExceptionAction<Object>() {
@Override @Override
public Object run() throws TaskNotFoundException, WorkbasketNotFoundException, FileNotFoundException, NotAuthorizedException, SQLException, ClassificationNotFoundException { public Object run() throws TaskNotFoundException, WorkbasketNotFoundException, FileNotFoundException, NotAuthorizedException, SQLException, ClassificationNotFoundException {
do_testTaskService(); do_testCreateTask();
return null; return null;
} }
}); });
@ -106,7 +106,7 @@ public class TaskServiceImplIntExplicitTest {
} }
} }
public void do_testTaskService() throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException { public void do_testCreateTask() throws FileNotFoundException, SQLException, TaskNotFoundException, NotAuthorizedException, WorkbasketNotFoundException, ClassificationNotFoundException {
Connection connection = dataSource.getConnection(); Connection connection = dataSource.getConnection();
taskanaEngineImpl.setConnection(connection); taskanaEngineImpl.setConnection(connection);
@ -193,7 +193,7 @@ public class TaskServiceImplIntExplicitTest {
ClassificationServiceImpl classificationServiceImpl = (ClassificationServiceImpl) te.getClassificationService(); ClassificationServiceImpl classificationServiceImpl = (ClassificationServiceImpl) te.getClassificationService();
Workbasket workbasket = new Workbasket(); Workbasket workbasket = new Workbasket();
workbasket.setName("workbasket"); workbasket.setName("workbasket99");
Classification classification = new Classification(); Classification classification = new Classification();
workbasketServiceImpl.createWorkbasket(workbasket); workbasketServiceImpl.createWorkbasket(workbasket);
classificationServiceImpl.addClassification(classification); classificationServiceImpl.addClassification(classification);