TSK-329 (draft): method removed. Tests are not running.
This commit is contained in:
parent
e10cc3a0c9
commit
02effb36f3
|
@ -44,13 +44,6 @@ public interface WorkbasketService {
|
||||||
Workbasket getWorkbasket(String workbasketKey, String domain)
|
Workbasket getWorkbasket(String workbasketKey, String domain)
|
||||||
throws WorkbasketNotFoundException, NotAuthorizedException;
|
throws WorkbasketNotFoundException, NotAuthorizedException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all available Workbaskets without checking any permission.
|
|
||||||
*
|
|
||||||
* @return a list containing all Workbasket Summaries
|
|
||||||
*/
|
|
||||||
List<WorkbasketSummary> getWorkbaskets();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Workbasket.
|
* Create a new Workbasket.
|
||||||
*
|
*
|
||||||
|
|
|
@ -124,27 +124,6 @@ public class WorkbasketServiceImpl implements WorkbasketService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<WorkbasketSummary> getWorkbaskets() {
|
|
||||||
LOGGER.debug("entry to getWorkbaskets()");
|
|
||||||
List<WorkbasketSummary> workbaskets = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
taskanaEngine.openConnection();
|
|
||||||
List<WorkbasketSummaryImpl> workbasketImpls = workbasketMapper.findAll();
|
|
||||||
for (WorkbasketSummaryImpl workbasketSummaryImpl : workbasketImpls) {
|
|
||||||
workbaskets.add(workbasketSummaryImpl);
|
|
||||||
}
|
|
||||||
return workbaskets;
|
|
||||||
} finally {
|
|
||||||
taskanaEngine.returnConnection();
|
|
||||||
if (LOGGER.isDebugEnabled()) {
|
|
||||||
int numberOfResultObjects = workbaskets.size();
|
|
||||||
LOGGER.debug("exit from getWorkbaskets(). Returning {} resulting Objects: {} ", numberOfResultObjects,
|
|
||||||
LoggerUtils.listToString(workbaskets));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Workbasket createWorkbasket(Workbasket newWorkbasket)
|
public Workbasket createWorkbasket(Workbasket newWorkbasket)
|
||||||
throws InvalidWorkbasketException {
|
throws InvalidWorkbasketException {
|
||||||
|
|
|
@ -199,7 +199,8 @@ public interface QueryMapper {
|
||||||
|
|
||||||
@Select("<script>"
|
@Select("<script>"
|
||||||
+ "SELECT DISTINCT w.ID, w.KEY, w.NAME, w.DOMAIN, W.TYPE, w.DESCRIPTION, w.OWNER, w.ORG_LEVEL_1, w.ORG_LEVEL_2, w.ORG_LEVEL_3, w.ORG_LEVEL_4 from WORKBASKET w "
|
+ "SELECT DISTINCT w.ID, w.KEY, w.NAME, w.DOMAIN, W.TYPE, w.DESCRIPTION, w.OWNER, w.ORG_LEVEL_1, w.ORG_LEVEL_2, w.ORG_LEVEL_3, w.ORG_LEVEL_4 from WORKBASKET w "
|
||||||
+ "<if test='accessId != null'>LEFT OUTER JOIN WORKBASKET_ACCESS_LIST a on w.ID = a.WORKBASKET_ID</if> "
|
// + "<if test='accessId != null'>LEFT OUTER JOIN WORKBASKET_ACCESS_LIST a on w.ID = a.WORKBASKET_ID</if> "
|
||||||
|
+ "LEFT OUTER JOIN WORKBASKET_ACCESS_LIST a on w.ID = a.WORKBASKET_ID "
|
||||||
+ "<where>"
|
+ "<where>"
|
||||||
+ "<if test='ownerIn != null'>AND w.OWNER IN(<foreach item='item' collection='ownerIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='ownerIn != null'>AND w.OWNER IN(<foreach item='item' collection='ownerIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='ownerLike != null'>AND (<foreach item='item' collection='ownerLike' separator=' OR ' >UPPER(w.OWNER) LIKE #{item}</foreach>)</if> "
|
+ "<if test='ownerLike != null'>AND (<foreach item='item' collection='ownerLike' separator=' OR ' >UPPER(w.OWNER) LIKE #{item}</foreach>)</if> "
|
||||||
|
@ -233,7 +234,6 @@ public interface QueryMapper {
|
||||||
+ "<if test='orgLevel4Like != null'>AND (<foreach item='item' collection='orgLevel4Like' separator=' OR ' >UPPER(w.ORG_LEVEL_4) LIKE #{item}</foreach>)</if> "
|
+ "<if test='orgLevel4Like != null'>AND (<foreach item='item' collection='orgLevel4Like' separator=' OR ' >UPPER(w.ORG_LEVEL_4) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='authorization != null'>AND "
|
+ "<if test='authorization != null'>AND "
|
||||||
+ "<if test=\"authorization.name().equals('OPEN')\">PERM_OPEN</if> "
|
+ "<if test=\"authorization.name().equals('OPEN')\">PERM_OPEN</if> "
|
||||||
+ "<if test=\"authorization.name().equals('READ')\">PERM_READ</if>"
|
|
||||||
+ "<if test=\"authorization.name().equals('APPEND')\">PERM_APPEND</if>"
|
+ "<if test=\"authorization.name().equals('APPEND')\">PERM_APPEND</if>"
|
||||||
+ "<if test=\"authorization.name().equals('TRANSFER')\">PERM_TRANSFER</if>"
|
+ "<if test=\"authorization.name().equals('TRANSFER')\">PERM_TRANSFER</if>"
|
||||||
+ "<if test=\"authorization.name().equals('DISTRIBUTE')\">PERM_DISTRIBUTE</if>"
|
+ "<if test=\"authorization.name().equals('DISTRIBUTE')\">PERM_DISTRIBUTE</if>"
|
||||||
|
@ -250,6 +250,7 @@ public interface QueryMapper {
|
||||||
+ "<if test=\"authorization.name().equals('CUSTOM_11')\">PERM_CUSTOM_11</if>"
|
+ "<if test=\"authorization.name().equals('CUSTOM_11')\">PERM_CUSTOM_11</if>"
|
||||||
+ "<if test=\"authorization.name().equals('CUSTOM_12')\">PERM_CUSTOM_12</if> = 1 "
|
+ "<if test=\"authorization.name().equals('CUSTOM_12')\">PERM_CUSTOM_12</if> = 1 "
|
||||||
+ "</if>"
|
+ "</if>"
|
||||||
|
+ "AND a.PERM_READ = 1"
|
||||||
+ "</where>"
|
+ "</where>"
|
||||||
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='orderItem' collection='orderBy' separator=',' >${orderItem}</foreach></if> "
|
+ "<if test='!orderBy.isEmpty()'>ORDER BY <foreach item='orderItem' collection='orderBy' separator=',' >${orderItem}</foreach></if> "
|
||||||
+ "</script>")
|
+ "</script>")
|
||||||
|
@ -419,7 +420,8 @@ public interface QueryMapper {
|
||||||
|
|
||||||
@Select("<script>"
|
@Select("<script>"
|
||||||
+ "SELECT COUNT(ID) from WORKBASKET w "
|
+ "SELECT COUNT(ID) from WORKBASKET w "
|
||||||
+ "<if test='accessId != null'>LEFT OUTER JOIN WORKBASKET_ACCESS_LIST a on w.ID = a.WORKBASKET_ID</if> "
|
// + "<if test='accessId != null'>LEFT OUTER JOIN WORKBASKET_ACCESS_LIST a on w.ID = a.WORKBASKET_ID</if> "
|
||||||
|
+ "LEFT OUTER JOIN WORKBASKET_ACCESS_LIST a on w.ID = a.WORKBASKET_ID "
|
||||||
+ "<where>"
|
+ "<where>"
|
||||||
+ "<if test='ownerIn != null'>AND w.OWNER IN(<foreach item='item' collection='ownerIn' separator=',' >#{item}</foreach>)</if> "
|
+ "<if test='ownerIn != null'>AND w.OWNER IN(<foreach item='item' collection='ownerIn' separator=',' >#{item}</foreach>)</if> "
|
||||||
+ "<if test='ownerLike != null'>AND (<foreach item='item' collection='ownerLike' separator=' OR ' >UPPER(w.OWNER) LIKE #{item}</foreach>)</if> "
|
+ "<if test='ownerLike != null'>AND (<foreach item='item' collection='ownerLike' separator=' OR ' >UPPER(w.OWNER) LIKE #{item}</foreach>)</if> "
|
||||||
|
@ -453,7 +455,6 @@ public interface QueryMapper {
|
||||||
+ "<if test='orgLevel4Like != null'>AND (<foreach item='item' collection='orgLevel4Like' separator=' OR ' >UPPER(w.ORG_LEVEL_4) LIKE #{item}</foreach>)</if> "
|
+ "<if test='orgLevel4Like != null'>AND (<foreach item='item' collection='orgLevel4Like' separator=' OR ' >UPPER(w.ORG_LEVEL_4) LIKE #{item}</foreach>)</if> "
|
||||||
+ "<if test='authorization != null'>AND "
|
+ "<if test='authorization != null'>AND "
|
||||||
+ "<if test=\"authorization.name().equals('OPEN')\">PERM_OPEN</if> "
|
+ "<if test=\"authorization.name().equals('OPEN')\">PERM_OPEN</if> "
|
||||||
+ "<if test=\"authorization.name().equals('READ')\">PERM_READ</if>"
|
|
||||||
+ "<if test=\"authorization.name().equals('APPEND')\">PERM_APPEND</if>"
|
+ "<if test=\"authorization.name().equals('APPEND')\">PERM_APPEND</if>"
|
||||||
+ "<if test=\"authorization.name().equals('TRANSFER')\">PERM_TRANSFER</if>"
|
+ "<if test=\"authorization.name().equals('TRANSFER')\">PERM_TRANSFER</if>"
|
||||||
+ "<if test=\"authorization.name().equals('DISTRIBUTE')\">PERM_DISTRIBUTE</if>"
|
+ "<if test=\"authorization.name().equals('DISTRIBUTE')\">PERM_DISTRIBUTE</if>"
|
||||||
|
@ -470,6 +471,7 @@ public interface QueryMapper {
|
||||||
+ "<if test=\"authorization.name().equals('CUSTOM_11')\">PERM_CUSTOM_11</if>"
|
+ "<if test=\"authorization.name().equals('CUSTOM_11')\">PERM_CUSTOM_11</if>"
|
||||||
+ "<if test=\"authorization.name().equals('CUSTOM_12')\">PERM_CUSTOM_12</if> = 1 "
|
+ "<if test=\"authorization.name().equals('CUSTOM_12')\">PERM_CUSTOM_12</if> = 1 "
|
||||||
+ "</if>"
|
+ "</if>"
|
||||||
|
+ "AND PERM_READ = 1"
|
||||||
+ "</where>"
|
+ "</where>"
|
||||||
+ "</script>")
|
+ "</script>")
|
||||||
Long countQueryWorkbaskets(WorkbasketQueryImpl workbasketQuery);
|
Long countQueryWorkbaskets(WorkbasketQueryImpl workbasketQuery);
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
package acceptance.workbasket;
|
package acceptance.workbasket;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
import acceptance.AbstractAccTest;
|
import acceptance.AbstractAccTest;
|
||||||
import pro.taskana.Workbasket;
|
import pro.taskana.Workbasket;
|
||||||
|
import pro.taskana.WorkbasketAccessItem;
|
||||||
import pro.taskana.WorkbasketService;
|
import pro.taskana.WorkbasketService;
|
||||||
import pro.taskana.exceptions.InvalidArgumentException;
|
import pro.taskana.exceptions.InvalidArgumentException;
|
||||||
import pro.taskana.exceptions.InvalidWorkbasketException;
|
import pro.taskana.exceptions.InvalidWorkbasketException;
|
||||||
|
@ -17,9 +19,10 @@ import pro.taskana.exceptions.NotAuthorizedException;
|
||||||
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
import pro.taskana.exceptions.WorkbasketNotFoundException;
|
||||||
import pro.taskana.impl.WorkbasketType;
|
import pro.taskana.impl.WorkbasketType;
|
||||||
import pro.taskana.security.JAASRunner;
|
import pro.taskana.security.JAASRunner;
|
||||||
|
import pro.taskana.security.WithAccessId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acceptance test for all "get workbasket" scenarios.
|
* Acceptance test for all "create workbasket" scenarios.
|
||||||
*/
|
*/
|
||||||
@RunWith(JAASRunner.class)
|
@RunWith(JAASRunner.class)
|
||||||
public class CreateWorkbasketAccTest extends AbstractAccTest {
|
public class CreateWorkbasketAccTest extends AbstractAccTest {
|
||||||
|
@ -28,19 +31,33 @@ public class CreateWorkbasketAccTest extends AbstractAccTest {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@WithAccessId(
|
||||||
|
userName = "user_1_2",
|
||||||
|
groupNames = {"group_1"})
|
||||||
@Test
|
@Test
|
||||||
public void testCreateWorkbasket()
|
public void testCreateWorkbasket()
|
||||||
throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
|
throws SQLException, NotAuthorizedException, InvalidArgumentException, WorkbasketNotFoundException,
|
||||||
InvalidWorkbasketException {
|
InvalidWorkbasketException {
|
||||||
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
WorkbasketService workbasketService = taskanaEngine.getWorkbasketService();
|
||||||
|
int before = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list().size();
|
||||||
|
|
||||||
int before = workbasketService.getWorkbaskets().size();
|
Workbasket workbasket = workbasketService.newWorkbasket("NT1234", "DOMAIN_A");
|
||||||
Workbasket workbasket = workbasketService.newWorkbasket("key", "novatec");
|
|
||||||
workbasket.setName("Megabasket");
|
workbasket.setName("Megabasket");
|
||||||
workbasket.setType(WorkbasketType.GROUP);
|
workbasket.setType(WorkbasketType.GROUP);
|
||||||
workbasket.setOrgLevel1("company");
|
workbasket.setOrgLevel1("company");
|
||||||
workbasketService.createWorkbasket(workbasket);
|
workbasket = workbasketService.createWorkbasket(workbasket);
|
||||||
Assert.assertEquals(before + 1, workbasketService.getWorkbaskets().size());
|
WorkbasketAccessItem wbai = workbasketService.newWorkbasketAccessItem(workbasket.getId(), "user_1_2");
|
||||||
|
wbai.setPermRead(true);
|
||||||
|
workbasketService.createWorkbasketAuthorization(wbai);
|
||||||
|
|
||||||
|
int after = workbasketService.createWorkbasketQuery().domainIn("DOMAIN_A").list().size();
|
||||||
|
assertEquals(before + 1, after);
|
||||||
|
Workbasket createdWorkbasket = workbasketService.getWorkbasket("NT1234", "DOMAIN_A");
|
||||||
|
assertNotNull(createdWorkbasket);
|
||||||
|
assertNotNull(createdWorkbasket.getId());
|
||||||
|
Workbasket createdWorkbasket2 = workbasketService.getWorkbasket(createdWorkbasket.getId());
|
||||||
|
assertNotNull(createdWorkbasket);
|
||||||
|
assertEquals(createdWorkbasket, createdWorkbasket2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -91,23 +91,10 @@ public class WorkbasketServiceImplIntAutocommitTest {
|
||||||
now = Instant.now();
|
now = Instant.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testInsertWorkbasket()
|
|
||||||
throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketNotFoundException {
|
|
||||||
int before = workBasketService.getWorkbaskets().size();
|
|
||||||
WorkbasketImpl workbasket = (WorkbasketImpl) workBasketService.newWorkbasket("key", "novatec");
|
|
||||||
String id1 = IdGenerator.generateWithPrefix("TWB");
|
|
||||||
workbasket.setId(id1);
|
|
||||||
workbasket.setName("Megabasket");
|
|
||||||
workbasket.setType(WorkbasketType.GROUP);
|
|
||||||
workBasketService.createWorkbasket(workbasket);
|
|
||||||
Assert.assertEquals(before + 1, workBasketService.getWorkbaskets().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSelectAllWorkbaskets()
|
public void testSelectAllWorkbaskets()
|
||||||
throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketNotFoundException {
|
throws NotAuthorizedException, InvalidWorkbasketException, WorkbasketNotFoundException {
|
||||||
int before = workBasketService.getWorkbaskets().size();
|
int before = workBasketService.createWorkbasketQuery().list().size();
|
||||||
WorkbasketImpl workbasket0 = (WorkbasketImpl) workBasketService.newWorkbasket("key0", "novatec");
|
WorkbasketImpl workbasket0 = (WorkbasketImpl) workBasketService.newWorkbasket("key0", "novatec");
|
||||||
String id0 = IdGenerator.generateWithPrefix("TWB");
|
String id0 = IdGenerator.generateWithPrefix("TWB");
|
||||||
workbasket0.setId(id0);
|
workbasket0.setId(id0);
|
||||||
|
@ -126,7 +113,7 @@ public class WorkbasketServiceImplIntAutocommitTest {
|
||||||
workbasket2.setName("Hyperbasket");
|
workbasket2.setName("Hyperbasket");
|
||||||
workbasket2.setType(WorkbasketType.GROUP);
|
workbasket2.setType(WorkbasketType.GROUP);
|
||||||
workBasketService.createWorkbasket(workbasket2);
|
workBasketService.createWorkbasket(workbasket2);
|
||||||
Assert.assertEquals(before + THREE, workBasketService.getWorkbaskets().size());
|
Assert.assertEquals(before + THREE, workBasketService.createWorkbasketQuery().list().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithAccessId(userName = "Elena")
|
@WithAccessId(userName = "Elena")
|
||||||
|
|
|
@ -74,30 +74,13 @@ public class WorkbasketServiceImplIntExplicitTest {
|
||||||
cleaner.clearDb(dataSource, false);
|
cleaner.clearDb(dataSource, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testInsertWorkbasket()
|
|
||||||
throws NotAuthorizedException, SQLException, InvalidWorkbasketException, WorkbasketNotFoundException {
|
|
||||||
Connection connection = dataSource.getConnection();
|
|
||||||
taskanaEngineImpl.setConnection(connection);
|
|
||||||
workBasketService = taskanaEngine.getWorkbasketService();
|
|
||||||
int before = workBasketService.getWorkbaskets().size();
|
|
||||||
WorkbasketImpl workbasket = (WorkbasketImpl) workBasketService.newWorkbasket("key", "novatec");
|
|
||||||
String id1 = IdGenerator.generateWithPrefix("TWB");
|
|
||||||
workbasket.setId(id1);
|
|
||||||
workbasket.setName("Megabasket");
|
|
||||||
workbasket.setType(WorkbasketType.GROUP);
|
|
||||||
workBasketService.createWorkbasket(workbasket);
|
|
||||||
Assert.assertEquals(before + 1, workBasketService.getWorkbaskets().size());
|
|
||||||
taskanaEngineImpl.closeConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSelectAllWorkbaskets()
|
public void testSelectAllWorkbaskets()
|
||||||
throws NotAuthorizedException, SQLException, InvalidWorkbasketException, WorkbasketNotFoundException {
|
throws NotAuthorizedException, SQLException, InvalidWorkbasketException, WorkbasketNotFoundException {
|
||||||
Connection connection = dataSource.getConnection();
|
Connection connection = dataSource.getConnection();
|
||||||
taskanaEngineImpl.setConnection(connection);
|
taskanaEngineImpl.setConnection(connection);
|
||||||
workBasketService = taskanaEngine.getWorkbasketService();
|
workBasketService = taskanaEngine.getWorkbasketService();
|
||||||
int before = workBasketService.getWorkbaskets().size();
|
int before = workBasketService.createWorkbasketQuery().list().size();
|
||||||
WorkbasketImpl workbasket0 = (WorkbasketImpl) workBasketService.newWorkbasket("key0", "novatec");
|
WorkbasketImpl workbasket0 = (WorkbasketImpl) workBasketService.newWorkbasket("key0", "novatec");
|
||||||
String id0 = IdGenerator.generateWithPrefix("TWB");
|
String id0 = IdGenerator.generateWithPrefix("TWB");
|
||||||
workbasket0.setId(id0);
|
workbasket0.setId(id0);
|
||||||
|
@ -116,7 +99,7 @@ public class WorkbasketServiceImplIntExplicitTest {
|
||||||
workbasket2.setName("Hyperbasket");
|
workbasket2.setName("Hyperbasket");
|
||||||
workbasket2.setType(WorkbasketType.GROUP);
|
workbasket2.setType(WorkbasketType.GROUP);
|
||||||
workBasketService.createWorkbasket(workbasket2);
|
workBasketService.createWorkbasket(workbasket2);
|
||||||
Assert.assertEquals(before + THREE, workBasketService.getWorkbaskets().size());
|
Assert.assertEquals(before + THREE, workBasketService.createWorkbasketQuery().list().size());
|
||||||
connection.commit();
|
connection.commit();
|
||||||
taskanaEngineImpl.closeConnection();
|
taskanaEngineImpl.closeConnection();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue