TSK-1031: update Spring Boot to 2.2.4.RELEASE except Hateoas.
This commit is contained in:
parent
e6f8883e49
commit
007f268be5
|
|
@ -32,6 +32,17 @@
|
|||
<groupId>pro.taskana.simplehistory</groupId>
|
||||
<artifactId>taskana-simplehistory-rest-spring</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.hateoas</groupId>
|
||||
<artifactId>spring-hateoas</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.hateoas</groupId>
|
||||
<artifactId>spring-hateoas</artifactId>
|
||||
<version>${version.spring.hateos}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
@ -44,6 +55,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.plugin</groupId>
|
||||
<artifactId>spring-plugin-core</artifactId>
|
||||
<version>${version.spring.core}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
|
|
|
|||
|
|
@ -32,6 +32,17 @@
|
|||
<groupId>pro.taskana.simplehistory</groupId>
|
||||
<artifactId>taskana-simplehistory-rest-spring</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.hateoas</groupId>
|
||||
<artifactId>spring-hateoas</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.hateoas</groupId>
|
||||
<artifactId>spring-hateoas</artifactId>
|
||||
<version>${version.spring.hateos}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
@ -49,6 +60,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.plugin</groupId>
|
||||
<artifactId>spring-plugin-core</artifactId>
|
||||
<version>${version.spring.core}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
|
|
|
|||
|
|
@ -1,12 +1,7 @@
|
|||
package pro.taskana;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
|
@ -45,6 +40,7 @@ import pro.taskana.workbasket.api.WorkbasketService;
|
|||
import pro.taskana.workbasket.api.WorkbasketType;
|
||||
import pro.taskana.workbasket.api.exceptions.InvalidWorkbasketException;
|
||||
import pro.taskana.workbasket.api.exceptions.WorkbasketAlreadyExistException;
|
||||
import pro.taskana.workbasket.api.exceptions.WorkbasketInUseException;
|
||||
import pro.taskana.workbasket.api.exceptions.WorkbasketNotFoundException;
|
||||
import pro.taskana.workbasket.internal.WorkbasketImpl;
|
||||
|
||||
|
|
@ -52,12 +48,12 @@ import pro.taskana.workbasket.internal.WorkbasketImpl;
|
|||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(
|
||||
classes = TaskanaConfigTestApplication.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
properties = "spring.main.allow-bean-definition-overriding=true")
|
||||
@ActiveProfiles({"inmemorydb", "dev"})
|
||||
@Import({TransactionalJobsConfiguration.class})
|
||||
class TaskanaTransactionIntTest {
|
||||
|
||||
private static final int POOL_TIME_TO_WAIT = 50;
|
||||
@Autowired TaskanaTransactionProvider<Object> springTransactionProvider;
|
||||
@Autowired private TestRestTemplate restTemplate;
|
||||
@Autowired private DataSource dataSource;
|
||||
|
|
@ -75,7 +71,7 @@ class TaskanaTransactionIntTest {
|
|||
@Test
|
||||
void testTaskanaSchema() {
|
||||
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/schema", String.class);
|
||||
assertThat(responseEntity.getBody(), is("TASKANA"));
|
||||
assertThat(responseEntity.getBody()).isEqualTo("TASKANA");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -84,7 +80,7 @@ class TaskanaTransactionIntTest {
|
|||
|
||||
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/transaction", String.class);
|
||||
System.err.println("response: " + responseEntity.getBody());
|
||||
assertThat(responseEntity.getBody(), containsString("workbaskets: 1"));
|
||||
assertThat(responseEntity.getBody()).containsSequence("workbaskets: 1");
|
||||
|
||||
assertAfter(1, 0);
|
||||
}
|
||||
|
|
@ -96,7 +92,7 @@ class TaskanaTransactionIntTest {
|
|||
ResponseEntity<String> responseEntity =
|
||||
restTemplate.getForEntity("/transaction?rollback={rollback}", String.class, "true");
|
||||
System.err.println("result: " + responseEntity.getBody());
|
||||
assertThat(responseEntity.getBody(), containsString("workbaskets: 1"));
|
||||
assertThat(responseEntity.getBody()).containsSequence("workbaskets: 1");
|
||||
|
||||
assertAfter(0, 0);
|
||||
}
|
||||
|
|
@ -108,7 +104,7 @@ class TaskanaTransactionIntTest {
|
|||
ResponseEntity<String> responseEntity =
|
||||
restTemplate.getForEntity("/transaction-many", String.class);
|
||||
System.err.println("response: " + responseEntity.getBody());
|
||||
assertThat(responseEntity.getBody(), containsString("workbaskets: 3"));
|
||||
assertThat(responseEntity.getBody()).containsSequence("workbaskets: 3");
|
||||
|
||||
assertAfter(3, 0);
|
||||
}
|
||||
|
|
@ -120,7 +116,7 @@ class TaskanaTransactionIntTest {
|
|||
ResponseEntity<String> responseEntity =
|
||||
restTemplate.getForEntity("/transaction-many?rollback={rollback}", String.class, "true");
|
||||
System.err.println("result: " + responseEntity.getBody());
|
||||
assertThat(responseEntity.getBody(), containsString("workbaskets: 3"));
|
||||
assertThat(responseEntity.getBody()).containsSequence("workbaskets: 3");
|
||||
|
||||
assertAfter(0, 0);
|
||||
}
|
||||
|
|
@ -131,8 +127,8 @@ class TaskanaTransactionIntTest {
|
|||
|
||||
ResponseEntity<String> responseEntity = restTemplate.getForEntity("/customdb", String.class);
|
||||
System.err.println("response: " + responseEntity.getBody());
|
||||
assertThat(responseEntity.getBody(), containsString("workbaskets: 2"));
|
||||
assertThat(responseEntity.getBody(), containsString("tests: 2"));
|
||||
assertThat(responseEntity.getBody()).containsSequence("workbaskets: 2");
|
||||
assertThat(responseEntity.getBody()).containsSequence("tests: 2");
|
||||
|
||||
assertAfter(2, 2);
|
||||
}
|
||||
|
|
@ -144,8 +140,8 @@ class TaskanaTransactionIntTest {
|
|||
ResponseEntity<String> responseEntity =
|
||||
restTemplate.getForEntity("/customdb?rollback={rollback}", String.class, "true");
|
||||
System.err.println("response: " + responseEntity.getBody());
|
||||
assertThat(responseEntity.getBody(), containsString("workbaskets: 2"));
|
||||
assertThat(responseEntity.getBody(), containsString("tests: 2"));
|
||||
assertThat(responseEntity.getBody()).containsSequence("workbaskets: 2");
|
||||
assertThat(responseEntity.getBody()).containsSequence("tests: 2");
|
||||
|
||||
assertAfter(0, 0);
|
||||
}
|
||||
|
|
@ -158,19 +154,19 @@ class TaskanaTransactionIntTest {
|
|||
final TaskanaEngineImpl taskanaEngineImpl = (TaskanaEngineImpl) taskanaEngine;
|
||||
try (Connection connection = dataSource.getConnection()) {
|
||||
|
||||
assertNotEquals(connection.getSchema(), "PUBLIC");
|
||||
assertThat(connection.getSchema()).isNotEqualTo("PUBLIC");
|
||||
jdbcTemplate.execute("INSERT INTO CUSTOMDB.TEST VALUES ('1', 'test')");
|
||||
jdbcTemplate.execute("INSERT INTO CUSTOMDB.TEST VALUES ('2', 'test2')");
|
||||
int result = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM CUSTOMDB.TEST", Integer.class);
|
||||
assertEquals(2, result);
|
||||
assertThat(result).isEqualTo(2);
|
||||
Workbasket wbCreated =
|
||||
taskanaEngine
|
||||
.getWorkbasketService()
|
||||
.createWorkbasket(createWorkBasket("key1", "workbasket1"));
|
||||
Workbasket wb = taskanaEngineImpl.getWorkbasketService().getWorkbasket(wbCreated.getId());
|
||||
assertNotNull(wb);
|
||||
assertThat(wb).isNotNull();
|
||||
result = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM CUSTOMDB.TEST", Integer.class);
|
||||
assertEquals(2, result);
|
||||
assertThat(result).isEqualTo(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -189,8 +185,8 @@ class TaskanaTransactionIntTest {
|
|||
taskService.createTask(createTask("key2", "TEST"));
|
||||
taskService.createTask(createTask("key3", "TEST"));
|
||||
|
||||
assertEquals(workbasketService.createWorkbasketQuery().count(), 3);
|
||||
assertEquals(taskService.createTaskQuery().count(), 3);
|
||||
assertThat(workbasketService.createWorkbasketQuery().count()).isEqualTo(3);
|
||||
assertThat(taskService.createTaskQuery().count()).isEqualTo(3);
|
||||
|
||||
List<TaskSummary> tasks =
|
||||
taskService
|
||||
|
|
@ -216,27 +212,19 @@ class TaskanaTransactionIntTest {
|
|||
new TaskCleanupJob(taskanaEngine, springTransactionProvider, null);
|
||||
taskCleanupJob.run();
|
||||
|
||||
tasks =
|
||||
taskService
|
||||
.createTaskQuery()
|
||||
.workbasketKeyDomainIn(new KeyDomain("key3", "DOMAIN_A"))
|
||||
.list();
|
||||
taskService.claim(tasks.get(0).getId());
|
||||
taskService.completeTask(tasks.get(0).getId());
|
||||
|
||||
try {
|
||||
assertThatThrownBy(() ->
|
||||
workbasketService.deleteWorkbasket(
|
||||
workbasketService.getWorkbasket("key3", "DOMAIN_A").getId());
|
||||
} catch (TaskanaException ex) {
|
||||
assertEquals(ex.getMessage().contains("contains non-completed tasks"), true);
|
||||
}
|
||||
workbasketService.getWorkbasket("key3", "DOMAIN_A").getId()))
|
||||
.isInstanceOf(WorkbasketInUseException.class)
|
||||
.hasMessageContaining("contains 1 non-completed tasks");
|
||||
|
||||
WorkbasketCleanupJob job =
|
||||
new WorkbasketCleanupJob(taskanaEngine, springTransactionProvider, null);
|
||||
job.run();
|
||||
|
||||
assertNull(workbasketService.getWorkbasket("key1", "DOMAIN_A"));
|
||||
assertNull(workbasketService.getWorkbasket("key2", "DOMAIN_A"));
|
||||
assertThat(workbasketService.getWorkbasket("key1", "DOMAIN_A")).isNull();
|
||||
assertThat(workbasketService.getWorkbasket("key2", "DOMAIN_A")).isNull();
|
||||
assertThat(workbasketService.getWorkbasket("key3", "DOMAIN_A")).isNotNull();
|
||||
|
||||
} catch (TaskanaException e) {
|
||||
e.printStackTrace();
|
||||
|
|
@ -265,14 +253,12 @@ class TaskanaTransactionIntTest {
|
|||
|
||||
private void assertWorkbaskets(String assertion, int value) {
|
||||
int workbaskets = getWorkbaskets();
|
||||
System.err.println(assertion + " workbaskets: " + workbaskets);
|
||||
assertThat(workbaskets, is(value));
|
||||
assertThat(workbaskets).isEqualTo(value);
|
||||
}
|
||||
|
||||
private void assertCustomdbTests(String assertion, int value) {
|
||||
int tests = getCustomdbTests();
|
||||
System.err.println(assertion + " tests: " + tests);
|
||||
assertThat(tests, is(value));
|
||||
assertThat(tests).isEqualTo(value);
|
||||
}
|
||||
|
||||
private int getWorkbaskets() {
|
||||
|
|
|
|||
11
pom.xml
11
pom.xml
|
|
@ -50,13 +50,14 @@
|
|||
<version.sonatype>1.6.8</version.sonatype>
|
||||
|
||||
<!-- spring dependencies -->
|
||||
<version.spring>5.0.5.RELEASE</version.spring>
|
||||
<version.spring>5.2.3.RELEASE</version.spring>
|
||||
<version.spring.security>5.2.1.RELEASE</version.spring.security>
|
||||
<version.spring.core>2.0.0.RELEASE</version.spring.core>
|
||||
<version.spring.boot>2.0.2.RELEASE</version.spring.boot>
|
||||
<version.spring.boot>2.2.4.RELEASE</version.spring.boot>
|
||||
<version.spring.restdocs>2.0.2.RELEASE</version.spring.restdocs>
|
||||
<version.spring.mybatis>2.0.3</version.spring.mybatis>
|
||||
<version.spring.ldap>2.3.2.RELEASE</version.spring.ldap>
|
||||
<version.spring.hateos>0.24.0.RELEASE</version.spring.hateos>
|
||||
<version.spring.ldap>2.3.2.RELEASE</version.spring.ldap>
|
||||
|
||||
<!-- wildfly dependencies -->
|
||||
<version.wildfly>11.0.0.Final</version.wildfly>
|
||||
|
|
@ -72,7 +73,7 @@
|
|||
<version.assertj>3.15.0</version.assertj>
|
||||
<version.junit.jupiter>5.6.0</version.junit.jupiter>
|
||||
<version.log4j>2.13.0</version.log4j>
|
||||
<version.archunit>0.13.1</version.archunit>
|
||||
<version.archunit>0.13.0</version.archunit>
|
||||
<version.mockito>3.2.4</version.mockito>
|
||||
<version.junit.mockito>3.2.4</version.junit.mockito>
|
||||
<!-- byte buddy 1.9.7+ is needed to solve dependency errors with spring mock tests see LdapClientTest -->
|
||||
|
|
@ -87,7 +88,7 @@
|
|||
<!-- database driver versions -->
|
||||
<version.h2>1.4.200</version.h2>
|
||||
<version.db2>11.1.1.1</version.db2>
|
||||
<version.postgres>42.2.10</version.postgres>
|
||||
<version.postgres>42.2.9</version.postgres>
|
||||
<!-- used by jacoco to collect coverage -->
|
||||
<argLine></argLine>
|
||||
</properties>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.plugin</groupId>
|
||||
<artifactId>spring-plugin-core</artifactId>
|
||||
<version>${version.spring.core}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ldap</groupId>
|
||||
|
|
@ -71,6 +72,17 @@
|
|||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-rest-spring-example-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.hateoas</groupId>
|
||||
<artifactId>spring-hateoas</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.hateoas</groupId>
|
||||
<artifactId>spring-hateoas</artifactId>
|
||||
<version>${version.spring.hateos}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
logging.level.pro.taskana=INFO
|
||||
logging.level.pro.taskana=DEBUG
|
||||
server.servlet.context-path=/taskana
|
||||
### logging.level.org.springframework=DEBUG
|
||||
######## Taskana DB #######
|
||||
|
|
@ -53,6 +53,9 @@ spring.resources.cache.cachecontrol.cache-private=true
|
|||
####### for upload of big workbasket- or classification-files
|
||||
spring.servlet.multipart.max-file-size=10MB
|
||||
spring.servlet.multipart.max-request-size=10MB
|
||||
|
||||
spring.main.allow-bean-definition-overriding=true
|
||||
|
||||
server.tomcat.max-http-post-size=-1
|
||||
server.tomcat.max-save-post-size=-1
|
||||
server.tomcat.max-swallow-size=-1
|
||||
|
|
|
|||
|
|
@ -30,6 +30,17 @@
|
|||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-rest-spring</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.hateoas</groupId>
|
||||
<artifactId>spring-hateoas</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.hateoas</groupId>
|
||||
<artifactId>spring-hateoas</artifactId>
|
||||
<version>${version.spring.hateos}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
|
|
@ -54,6 +65,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.plugin</groupId>
|
||||
<artifactId>spring-plugin-core</artifactId>
|
||||
<version>${version.spring.core}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ldap</groupId>
|
||||
|
|
@ -65,11 +77,9 @@
|
|||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
<version>${version.spring.boot}</version>
|
||||
</dependency>
|
||||
<!--
|
||||
Since taskana-web packs its content in /static, we do not have to unpack it again.
|
||||
However, when any local change has to be done to that folder you have to copy
|
||||
target/classes/static manually from taskana-web.
|
||||
-->
|
||||
<!-- Since taskana-web packs its content in /static, we do not have
|
||||
to unpack it again. However, when any local change has to be done to that
|
||||
folder you have to copy target/classes/static manually from taskana-web. -->
|
||||
<dependency>
|
||||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-web</artifactId>
|
||||
|
|
@ -92,7 +102,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-test</artifactId>
|
||||
<version>${version.spring}</version>
|
||||
<version>${version.spring.security}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
@ -101,24 +111,6 @@
|
|||
<version>${version.h2}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>${version.junit.jupiter}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${version.junit.jupiter}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
<version>${version.junit.jupiter}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ldap</groupId>
|
||||
<artifactId>spring-ldap-test</artifactId>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import org.springframework.web.util.UriComponentsBuilder;
|
|||
@Component
|
||||
public class RestHelper {
|
||||
|
||||
public static final RestTemplate template = getRestTemplate();
|
||||
@Autowired Environment environment;
|
||||
|
||||
public String toUrl(String relativeUrl, Object... uriVariables) {
|
||||
|
|
@ -25,7 +26,8 @@ public class RestHelper {
|
|||
.scheme("http")
|
||||
.host("127.0.0.1")
|
||||
.port(environment.getProperty("local.server.port"))
|
||||
.build(uriVariables)
|
||||
.build(false)
|
||||
.expand(uriVariables)
|
||||
.toString();
|
||||
}
|
||||
|
||||
|
|
@ -47,6 +49,14 @@ public class RestHelper {
|
|||
return headers;
|
||||
}
|
||||
|
||||
public HttpHeaders getHeadersBusinessAdmin() {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
// businessadmin:businessadmin
|
||||
headers.add("Authorization", "Basic YnVzaW5lc3NhZG1pbjpidXNpbmVzc2FkbWlu");
|
||||
headers.add("Content-Type", "application/hal+json");
|
||||
return headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a REST template which is capable of dealing with responses in HAL format.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package pro.taskana.jobs;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import java.time.Instant;
|
||||
|
|
@ -38,11 +37,13 @@ import pro.taskana.task.api.Task;
|
|||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(
|
||||
classes = RestConfiguration.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
properties = "spring.main.allow-bean-definition-overriding=true")
|
||||
class AsyncUpdateJobIntTest {
|
||||
|
||||
private static final String CLASSIFICATION_ID = "CLI:100000000000000000000000000000000003";
|
||||
|
||||
@SuppressWarnings("checkstyle:DeclarationOrder")
|
||||
static RestTemplate template;
|
||||
|
||||
@Autowired ClassificationResourceAssembler classificationResourceAssembler;
|
||||
|
|
@ -69,9 +70,9 @@ class AsyncUpdateJobIntTest {
|
|||
new HttpEntity<String>(restHelper.getHeaders()),
|
||||
ParameterizedTypeReference.forType(ClassificationResource.class));
|
||||
|
||||
assertNotNull(response.getBody());
|
||||
assertThat(response.getBody()).isNotNull();
|
||||
ClassificationResource classification = response.getBody();
|
||||
assertNotNull(classification.getLink(Link.REL_SELF));
|
||||
assertThat(classification.getLink(Link.REL_SELF)).isNotNull();
|
||||
|
||||
// 2nd step: modify classification and trigger update
|
||||
classification.removeLinks();
|
||||
|
|
@ -95,13 +96,13 @@ class AsyncUpdateJobIntTest {
|
|||
new HttpEntity<String>(restHelper.getHeaders()),
|
||||
ParameterizedTypeReference.forType(ClassificationResource.class));
|
||||
|
||||
assertNotNull(repeatedResponse.getBody());
|
||||
assertThat(repeatedResponse.getBody()).isNotNull();
|
||||
|
||||
ClassificationResource modifiedClassificationResource = repeatedResponse.getBody();
|
||||
Classification modifiedClassification =
|
||||
classificationResourceAssembler.toModel(modifiedClassificationResource);
|
||||
|
||||
assertFalse(before.isAfter(modifiedClassification.getModified()));
|
||||
assertThat(before).isBefore(modifiedClassification.getModified());
|
||||
|
||||
List<String> affectedTasks =
|
||||
new ArrayList<>(
|
||||
|
|
@ -162,7 +163,6 @@ class AsyncUpdateJobIntTest {
|
|||
Task task = taskResourceAssembler.toModel(taskResource);
|
||||
|
||||
Instant modified = task.getModified();
|
||||
boolean isAfterOrEquals = before.isAfter(modified) || before.equals(modified);
|
||||
assertFalse("Task " + task.getId() + " has not been refreshed.", isAfterOrEquals);
|
||||
assertThat(before).as("Task " + task.getId() + " has not been refreshed.").isBefore(modified);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package pro.taskana.ldap;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
|
@ -20,7 +20,8 @@ import pro.taskana.rest.resource.AccessIdResource;
|
|||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(
|
||||
classes = RestConfiguration.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
properties = "spring.main.allow-bean-definition-overriding=true")
|
||||
class LdapTest {
|
||||
|
||||
@Autowired private LdapClient ldapClient;
|
||||
|
|
@ -30,7 +31,7 @@ class LdapTest {
|
|||
if (ldapClient.useLdap()) {
|
||||
List<AccessIdResource> usersAndGroups = ldapClient.searchUsersAndGroups("ser0");
|
||||
System.out.println("#### found " + LoggerUtils.listToString(usersAndGroups));
|
||||
assertEquals(50, usersAndGroups.size());
|
||||
assertThat(usersAndGroups.size()).isEqualTo(50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,86 +0,0 @@
|
|||
package pro.taskana.rest;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import pro.taskana.RestHelper;
|
||||
import pro.taskana.ldap.LdapCacheTestImpl;
|
||||
import pro.taskana.rest.resource.AccessIdResource;
|
||||
|
||||
/** Test AccessIdValidation. */
|
||||
@ActiveProfiles({"test"})
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(
|
||||
classes = RestConfiguration.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
class AccessIdValidationControllerIntTest {
|
||||
|
||||
static RestTemplate template;
|
||||
@Autowired RestHelper restHelper;
|
||||
|
||||
@BeforeAll
|
||||
static void init() {
|
||||
template = RestHelper.getRestTemplate();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetMatches() {
|
||||
AccessIdController.setLdapCache(new LdapCacheTestImpl());
|
||||
HttpEntity<String> request = new HttpEntity<String>(restHelper.getHeaders());
|
||||
ResponseEntity<List<AccessIdResource>> response =
|
||||
template.exchange(
|
||||
restHelper.toUrl(Mapping.URL_ACCESSID) + "?search-for=ali",
|
||||
HttpMethod.GET,
|
||||
request,
|
||||
ParameterizedTypeReference.forType(AccessIdListResource.class));
|
||||
|
||||
List<AccessIdResource> body = response.getBody();
|
||||
assertNotNull(body);
|
||||
assertEquals(3, body.size());
|
||||
List<String> expectedIds =
|
||||
new ArrayList<>(Arrays.asList("Tralisch, Thea", "Bert, Ali", "Mente, Ali"));
|
||||
for (AccessIdResource accessId : body) {
|
||||
assertTrue(expectedIds.contains(accessId.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testBadRequestWhenSearchForIsTooShort() {
|
||||
AccessIdController.setLdapCache(new LdapCacheTestImpl());
|
||||
HttpEntity<String> request = new HttpEntity<String>(restHelper.getHeaders());
|
||||
try {
|
||||
template.exchange(
|
||||
restHelper.toUrl(Mapping.URL_ACCESSID) + "?search-for=al",
|
||||
HttpMethod.GET,
|
||||
request,
|
||||
ParameterizedTypeReference.forType(List.class));
|
||||
} catch (HttpClientErrorException e) {
|
||||
assertEquals(HttpStatus.BAD_REQUEST, e.getStatusCode());
|
||||
assertTrue(e.getResponseBodyAsString().contains("Minimum searchFor length ="));
|
||||
}
|
||||
}
|
||||
|
||||
static class AccessIdListResource extends ArrayList<AccessIdResource> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>taskana-rest-spring-example-wildfly</artifactId>
|
||||
|
|
@ -64,10 +65,22 @@
|
|||
<groupId>pro.taskana</groupId>
|
||||
<artifactId>taskana-rest-spring-example-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.hateoas</groupId>
|
||||
<artifactId>spring-hateoas</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.hateoas</groupId>
|
||||
<artifactId>spring-hateoas</artifactId>
|
||||
<version>${version.spring.hateos}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.plugin</groupId>
|
||||
<artifactId>spring-plugin-core</artifactId>
|
||||
<version>${version.spring.core}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
|
|
@ -98,24 +111,6 @@
|
|||
<version>${version.assertj}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>${version.junit.jupiter}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${version.junit.jupiter}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
<version>${version.junit.jupiter}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-client</artifactId>
|
||||
|
|
@ -128,7 +123,8 @@
|
|||
<artifactId>arquillian</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Brought in via Arquillian BOM, see dependencyManagement section above -->
|
||||
<!-- Brought in via Arquillian BOM, see dependencyManagement section
|
||||
above -->
|
||||
<dependency>
|
||||
<groupId>org.jboss.arquillian.junit</groupId>
|
||||
<artifactId>arquillian-junit-container</artifactId>
|
||||
|
|
@ -152,10 +148,10 @@
|
|||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<!-- Reading properties from file and use then as data source properties
|
||||
is a pending improvement of Jboss development team check out -> https://issues.jboss.org/browse/WFMP-70
|
||||
That's why we are including postgres connection properties directly in this
|
||||
pom file. -->
|
||||
<!-- Reading properties from file and use then as data source
|
||||
properties is a pending improvement of Jboss development team check out ->
|
||||
https://issues.jboss.org/browse/WFMP-70 That's why we are including postgres
|
||||
connection properties directly in this pom file. -->
|
||||
<properties>
|
||||
<driver-class>org.postgresql.Driver</driver-class>
|
||||
<connection-url>jdbc:postgresql://localhost:50102/postgres</connection-url>
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ spring.resources.cache.cachecontrol.cache-private=true
|
|||
####### for upload of big workbasket- or classification-files
|
||||
spring.servlet.multipart.max-file-size=10MB
|
||||
spring.servlet.multipart.max-request-size=10MB
|
||||
|
||||
spring.main.allow-bean-definition-overriding=true
|
||||
|
||||
server.tomcat.max-http-post-size=-1
|
||||
server.tomcat.max-save-post-size=-1
|
||||
server.tomcat.max-swallow-size=-1
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-test</artifactId>
|
||||
<version>${version.spring}</version>
|
||||
<version>${version.spring.security}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
@ -139,18 +139,6 @@
|
|||
<version>${version.spring.restdocs}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>${version.mockito}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-junit-jupiter</artifactId>
|
||||
<version>${version.junit.mockito}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.bytebuddy</groupId>
|
||||
<artifactId>byte-buddy</artifactId>
|
||||
|
|
@ -169,24 +157,6 @@
|
|||
<version>${version.h2}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>${version.junit.jupiter}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${version.junit.jupiter}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
<version>${version.junit.jupiter}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -322,3 +322,4 @@ public class ClassificationController extends AbstractPagingController {
|
|||
return query;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,4 +74,5 @@ public class RestConfiguration {
|
|||
public HandlerInstantiator handlerInstantiator(ApplicationContext context) {
|
||||
return new SpringHandlerInstantiator(context.getAutowireCapableBeanFactory());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.hateoas.Resources;
|
||||
import org.springframework.hateoas.config.EnableHypermediaSupport;
|
||||
import org.springframework.hateoas.config.EnableHypermediaSupport.HypermediaType;
|
||||
|
|
@ -121,7 +122,7 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
return response;
|
||||
}
|
||||
|
||||
@GetMapping(path = Mapping.URL_WORKBASKET_ID)
|
||||
@GetMapping(path = Mapping.URL_WORKBASKET_ID, produces = MediaTypes.HAL_JSON_UTF8_VALUE)
|
||||
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
||||
public ResponseEntity<WorkbasketResource> getWorkbasket(
|
||||
@PathVariable(value = "workbasketId") String workbasketId)
|
||||
|
|
@ -308,6 +309,7 @@ public class WorkbasketController extends AbstractPagingController {
|
|||
throws WorkbasketNotFoundException, NotAuthorizedException {
|
||||
LOGGER.debug(
|
||||
"Entry to removeDistributionTargetForWorkbasketId(workbasketId= {})", targetWorkbasketId);
|
||||
|
||||
List<WorkbasketSummary> sourceWorkbaskets =
|
||||
workbasketService.getDistributionSources(targetWorkbasketId);
|
||||
for (WorkbasketSummary source : sourceWorkbaskets) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ public class RestHelper {
|
|||
.scheme("http")
|
||||
.host("127.0.0.1")
|
||||
.port(environment.getProperty("local.server.port"))
|
||||
.build(uriVariables)
|
||||
.build(false)
|
||||
.expand(uriVariables)
|
||||
.toString();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,5 +20,6 @@ import pro.taskana.rest.RestConfiguration;
|
|||
@ExtendWith(SpringExtension.class)
|
||||
@SpringBootTest(
|
||||
classes = RestConfiguration.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
properties = "spring.main.allow-bean-definition-overriding=true")
|
||||
public @interface TaskanaSpringBootTest {}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,17 @@
|
|||
package pro.taskana.rest;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import pro.taskana.RestHelper;
|
||||
|
|
@ -36,7 +39,7 @@ class AccessIdControllerIntTest {
|
|||
HttpMethod.GET,
|
||||
restHelper.defaultRequest(),
|
||||
ParameterizedTypeReference.forType(List.class));
|
||||
assertEquals(1, response.getBody().size());
|
||||
assertThat(response.getBody().size()).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -47,6 +50,42 @@ class AccessIdControllerIntTest {
|
|||
HttpMethod.GET,
|
||||
restHelper.defaultRequest(),
|
||||
ParameterizedTypeReference.forType(List.class));
|
||||
assertEquals(1, response.getBody().size());
|
||||
assertThat(response.getBody().size()).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetMatches() {
|
||||
ResponseEntity<List<AccessIdResource>> response =
|
||||
template.exchange(
|
||||
restHelper.toUrl(Mapping.URL_ACCESSID) + "?search-for=ali",
|
||||
HttpMethod.GET,
|
||||
restHelper.defaultRequest(),
|
||||
ParameterizedTypeReference.forType(AccessIdListResource.class));
|
||||
|
||||
List<AccessIdResource> body = response.getBody();
|
||||
assertThat(body).isNotNull();
|
||||
assertThat(body.size()).isEqualTo(3);
|
||||
assertThat(body)
|
||||
.extracting(AccessIdResource::getName)
|
||||
.containsExactlyInAnyOrder("Tralisch, Thea", "Bert, Ali", "Mente, Ali");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testBadRequestWhenSearchForIsTooShort() {
|
||||
try {
|
||||
template.exchange(
|
||||
restHelper.toUrl(Mapping.URL_ACCESSID) + "?search-for=al",
|
||||
HttpMethod.GET,
|
||||
restHelper.defaultRequest(),
|
||||
ParameterizedTypeReference.forType(List.class));
|
||||
} catch (HttpClientErrorException e) {
|
||||
assertThat(HttpStatus.BAD_REQUEST).isEqualTo(e.getStatusCode());
|
||||
assertThat(e.getResponseBodyAsString()).containsSequence("Minimum searchFor length =");
|
||||
}
|
||||
}
|
||||
|
||||
static class AccessIdListResource extends ArrayList<AccessIdResource> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
package pro.taskana.rest;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
|
|
@ -35,6 +32,18 @@ class ClassificationControllerIntTest {
|
|||
static RestTemplate template = RestHelper.getRestTemplate();
|
||||
@Autowired RestHelper restHelper;
|
||||
|
||||
@Test
|
||||
void testGetClassification() {
|
||||
ResponseEntity<ClassificationResource> response =
|
||||
template.exchange(
|
||||
restHelper.toUrl(
|
||||
Mapping.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000002"),
|
||||
HttpMethod.GET,
|
||||
restHelper.defaultRequest(),
|
||||
ParameterizedTypeReference.forType(ClassificationResource.class));
|
||||
assertThat(response.getBody().getLink(Link.REL_SELF)).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetAllClassifications() {
|
||||
ResponseEntity<ClassificationSummaryListResource> response =
|
||||
|
|
@ -43,7 +52,7 @@ class ClassificationControllerIntTest {
|
|||
HttpMethod.GET,
|
||||
restHelper.defaultRequest(),
|
||||
ParameterizedTypeReference.forType(ClassificationSummaryListResource.class));
|
||||
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
||||
assertThat(response.getBody().getLink(Link.REL_SELF)).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -54,8 +63,8 @@ class ClassificationControllerIntTest {
|
|||
HttpMethod.GET,
|
||||
restHelper.defaultRequest(),
|
||||
ParameterizedTypeReference.forType(ClassificationSummaryListResource.class));
|
||||
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
||||
assertEquals(13, response.getBody().getContent().size());
|
||||
assertThat(response.getBody().getLink(Link.REL_SELF)).isNotNull();
|
||||
assertThat(response.getBody().getContent().size()).isEqualTo(13);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -67,15 +76,11 @@ class ClassificationControllerIntTest {
|
|||
HttpMethod.GET,
|
||||
restHelper.defaultRequest(),
|
||||
ParameterizedTypeReference.forType(ClassificationSummaryListResource.class));
|
||||
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
||||
assertTrue(
|
||||
response
|
||||
.getBody()
|
||||
.getLink(Link.REL_SELF)
|
||||
.getHref()
|
||||
.endsWith("/api/v1/classifications?domain=DOMAIN_A&sort-by=key&order=asc"));
|
||||
assertEquals(17, response.getBody().getContent().size());
|
||||
assertEquals("A12", response.getBody().getContent().iterator().next().key);
|
||||
assertThat(response.getBody().getLink(Link.REL_SELF)).isNotNull();
|
||||
assertThat(response.getBody().getLink(Link.REL_SELF).getHref())
|
||||
.endsWith("/api/v1/classifications?domain=DOMAIN_A&sort-by=key&order=asc");
|
||||
assertThat(response.getBody().getContent().size()).isEqualTo(17);
|
||||
assertThat(response.getBody().getContent().iterator().next().key).isEqualTo("A12");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -87,21 +92,17 @@ class ClassificationControllerIntTest {
|
|||
HttpMethod.GET,
|
||||
restHelper.defaultRequest(),
|
||||
ParameterizedTypeReference.forType(ClassificationSummaryListResource.class));
|
||||
assertEquals(5, response.getBody().getContent().size());
|
||||
assertEquals("L1050", response.getBody().getContent().iterator().next().key);
|
||||
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
||||
assertTrue(
|
||||
response
|
||||
.getBody()
|
||||
.getLink(Link.REL_SELF)
|
||||
.getHref()
|
||||
assertThat(response.getBody().getContent().size()).isEqualTo(5);
|
||||
assertThat(response.getBody().getContent().iterator().next().key).isEqualTo("L1050");
|
||||
assertThat(response.getBody().getLink(Link.REL_SELF)).isNotNull();
|
||||
assertThat(response.getBody().getLink(Link.REL_SELF).getHref())
|
||||
.endsWith(
|
||||
"/api/v1/classifications?"
|
||||
+ "domain=DOMAIN_A&sort-by=key&order=asc&page=2&page-size=5"));
|
||||
assertNotNull(response.getBody().getLink(Link.REL_FIRST));
|
||||
assertNotNull(response.getBody().getLink(Link.REL_LAST));
|
||||
assertNotNull(response.getBody().getLink(Link.REL_NEXT));
|
||||
assertNotNull(response.getBody().getLink(Link.REL_PREVIOUS));
|
||||
+ "domain=DOMAIN_A&sort-by=key&order=asc&page=2&page-size=5");
|
||||
assertThat(response.getBody().getLink(Link.REL_FIRST)).isNotNull();
|
||||
assertThat(response.getBody().getLink(Link.REL_LAST)).isNotNull();
|
||||
assertThat(response.getBody().getLink(Link.REL_NEXT)).isNotNull();
|
||||
assertThat(response.getBody().getLink(Link.REL_PREVIOUS)).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -119,8 +120,8 @@ class ClassificationControllerIntTest {
|
|||
new HttpEntity<>(newClassification, restHelper.getHeaders()),
|
||||
ParameterizedTypeReference.forType(ClassificationResource.class));
|
||||
|
||||
assertNotNull(responseEntity);
|
||||
assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode());
|
||||
assertThat(responseEntity).isNotNull();
|
||||
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||
|
||||
newClassification =
|
||||
"{\"classificationId\":\"\",\"category\":\"MANUAL\","
|
||||
|
|
@ -134,7 +135,7 @@ class ClassificationControllerIntTest {
|
|||
new HttpEntity<>(newClassification, restHelper.getHeaders()),
|
||||
ParameterizedTypeReference.forType(ClassificationResource.class));
|
||||
|
||||
assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode());
|
||||
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -153,8 +154,8 @@ class ClassificationControllerIntTest {
|
|||
new HttpEntity<>(newClassification, restHelper.getHeaders()),
|
||||
ParameterizedTypeReference.forType(ClassificationResource.class));
|
||||
|
||||
assertNotNull(responseEntity);
|
||||
assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode());
|
||||
assertThat(responseEntity).isNotNull();
|
||||
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -173,8 +174,8 @@ class ClassificationControllerIntTest {
|
|||
new HttpEntity<>(newClassification, restHelper.getHeaders()),
|
||||
ParameterizedTypeReference.forType(ClassificationResource.class));
|
||||
|
||||
assertNotNull(responseEntity);
|
||||
assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode());
|
||||
assertThat(responseEntity).isNotNull();
|
||||
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -192,8 +193,8 @@ class ClassificationControllerIntTest {
|
|||
new HttpEntity<>(newClassification, restHelper.getHeaders()),
|
||||
ParameterizedTypeReference.forType(ClassificationResource.class));
|
||||
|
||||
assertNotNull(responseEntity);
|
||||
assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode());
|
||||
assertThat(responseEntity).isNotNull();
|
||||
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||
|
||||
ResponseEntity<ClassificationSummaryListResource> response =
|
||||
template.exchange(
|
||||
|
|
@ -201,7 +202,7 @@ class ClassificationControllerIntTest {
|
|||
HttpMethod.GET,
|
||||
restHelper.defaultRequest(),
|
||||
ParameterizedTypeReference.forType(ClassificationSummaryListResource.class));
|
||||
assertNotNull(response.getBody().getLink(Link.REL_SELF));
|
||||
assertThat(response.getBody().getLink(Link.REL_SELF)).isNotNull();
|
||||
boolean foundClassificationCreated = false;
|
||||
for (ClassificationSummaryResource classification : response.getBody().getContent()) {
|
||||
if ("NEW_CLASS_P2".equals(classification.getKey())
|
||||
|
|
@ -211,7 +212,7 @@ class ClassificationControllerIntTest {
|
|||
}
|
||||
}
|
||||
|
||||
assertEquals(true, foundClassificationCreated);
|
||||
assertThat(foundClassificationCreated).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -223,18 +224,15 @@ class ClassificationControllerIntTest {
|
|||
+ "\"type\":\"TASK\",\"parentId\":\"CLI:200000000000000000000000000000000015\","
|
||||
+ "\"parentKey\":\"T2000\"}";
|
||||
|
||||
HttpClientErrorException e =
|
||||
Assertions.assertThrows(
|
||||
HttpClientErrorException.class,
|
||||
assertThatThrownBy(
|
||||
() ->
|
||||
template.exchange(
|
||||
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS),
|
||||
HttpMethod.POST,
|
||||
new HttpEntity<>(newClassification, restHelper.getHeaders()),
|
||||
ParameterizedTypeReference.forType(ClassificationResource.class)));
|
||||
|
||||
assertNotNull(e);
|
||||
assertEquals(HttpStatus.BAD_REQUEST, e.getStatusCode());
|
||||
ParameterizedTypeReference.forType(ClassificationResource.class)))
|
||||
.isInstanceOf(HttpClientErrorException.class)
|
||||
.hasFieldOrPropertyWithValue("statusCode", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -245,18 +243,15 @@ class ClassificationControllerIntTest {
|
|||
+ "\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS\","
|
||||
+ "\"name\":\"new classification\",\"type\":\"TASK\"}";
|
||||
|
||||
HttpClientErrorException e =
|
||||
Assertions.assertThrows(
|
||||
HttpClientErrorException.class,
|
||||
() ->
|
||||
assertThatThrownBy(() ->
|
||||
template.exchange(
|
||||
restHelper.toUrl(Mapping.URL_CLASSIFICATIONS),
|
||||
HttpMethod.POST,
|
||||
new HttpEntity<>(newClassification, restHelper.getHeaders()),
|
||||
ParameterizedTypeReference.forType(ClassificationResource.class)));
|
||||
|
||||
assertNotNull(e);
|
||||
assertEquals(HttpStatus.BAD_REQUEST, e.getStatusCode());
|
||||
ParameterizedTypeReference.forType(ClassificationResource.class)))
|
||||
.isInstanceOf(HttpClientErrorException.class)
|
||||
.extracting(ex -> ((HttpClientErrorException)ex).getStatusCode())
|
||||
.isEqualTo(HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -270,7 +265,7 @@ class ClassificationControllerIntTest {
|
|||
HttpMethod.GET,
|
||||
request,
|
||||
ParameterizedTypeReference.forType(ClassificationSummaryResource.class));
|
||||
assertEquals("Zustimmungserklärung", response.getBody().name);
|
||||
assertThat(response.getBody().name).isEqualTo("Zustimmungserklärung");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -285,17 +280,15 @@ class ClassificationControllerIntTest {
|
|||
HttpMethod.DELETE,
|
||||
request,
|
||||
ParameterizedTypeReference.forType(ClassificationSummaryResource.class));
|
||||
assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode());
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
|
||||
|
||||
assertThrows(
|
||||
HttpClientErrorException.class,
|
||||
() -> {
|
||||
assertThatThrownBy(() ->
|
||||
template.exchange(
|
||||
restHelper.toUrl(
|
||||
Mapping.URL_CLASSIFICATIONS_ID, "CLI:200000000000000000000000000000000004"),
|
||||
HttpMethod.GET,
|
||||
request,
|
||||
ParameterizedTypeReference.forType(ClassificationSummaryResource.class));
|
||||
});
|
||||
ParameterizedTypeReference.forType(ClassificationSummaryResource.class)))
|
||||
.isInstanceOf(HttpClientErrorException.class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue