TSK-1597: Unified HTTP Request in Rest Tests
This commit is contained in:
parent
afb1f3e640
commit
98987d2e54
|
@ -16,7 +16,6 @@ import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.test.annotation.DirtiesContext;
|
import org.springframework.test.annotation.DirtiesContext;
|
||||||
import org.springframework.web.client.HttpClientErrorException;
|
import org.springframework.web.client.HttpClientErrorException;
|
||||||
import org.springframework.web.client.RestTemplate;
|
|
||||||
|
|
||||||
import pro.taskana.classification.rest.models.ClassificationRepresentationModel;
|
import pro.taskana.classification.rest.models.ClassificationRepresentationModel;
|
||||||
import pro.taskana.classification.rest.models.ClassificationSummaryPagedRepresentationModel;
|
import pro.taskana.classification.rest.models.ClassificationSummaryPagedRepresentationModel;
|
||||||
|
@ -41,18 +40,18 @@ class ClassificationControllerIntTest {
|
||||||
CLASSIFICATION_SUMMARY_REPRESENTATION_MODEL_TYPE =
|
CLASSIFICATION_SUMMARY_REPRESENTATION_MODEL_TYPE =
|
||||||
new ParameterizedTypeReference<ClassificationSummaryRepresentationModel>() {};
|
new ParameterizedTypeReference<ClassificationSummaryRepresentationModel>() {};
|
||||||
|
|
||||||
static RestTemplate template = RestHelper.TEMPLATE;
|
|
||||||
@Autowired RestHelper restHelper;
|
@Autowired RestHelper restHelper;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetClassification() {
|
void testGetClassification() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(
|
||||||
|
RestEndpoints.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000002");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<ClassificationRepresentationModel> response =
|
ResponseEntity<ClassificationRepresentationModel> response =
|
||||||
template.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
||||||
restHelper.toUrl(
|
|
||||||
RestEndpoints.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000002"),
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
assertThat(response.getHeaders().getContentType()).isEqualTo(MediaTypes.HAL_JSON);
|
assertThat(response.getHeaders().getContentType()).isEqualTo(MediaTypes.HAL_JSON);
|
||||||
|
@ -60,25 +59,24 @@ class ClassificationControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetAllClassifications() {
|
void testGetAllClassifications() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS);
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<ClassificationSummaryPagedRepresentationModel> response =
|
ResponseEntity<ClassificationSummaryPagedRepresentationModel> response =
|
||||||
template.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, CLASSIFICATION_SUMMARY_PAGE_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
CLASSIFICATION_SUMMARY_PAGE_MODEL_TYPE);
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetAllClassificationsFilterByCustomAttribute() {
|
void testGetAllClassificationsFilterByCustomAttribute() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS) + "?domain=DOMAIN_A&custom-1-like=RVNR";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<ClassificationSummaryPagedRepresentationModel> response =
|
ResponseEntity<ClassificationSummaryPagedRepresentationModel> response =
|
||||||
template.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, CLASSIFICATION_SUMMARY_PAGE_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS)
|
|
||||||
+ "?domain=DOMAIN_A&custom-1-like=RVNR",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
CLASSIFICATION_SUMMARY_PAGE_MODEL_TYPE);
|
|
||||||
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
|
@ -87,13 +85,14 @@ class ClassificationControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetAllClassificationsKeepingFilters() {
|
void testGetAllClassificationsKeepingFilters() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS)
|
||||||
|
+ "?domain=DOMAIN_A&sort-by=KEY&order=ASCENDING";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<ClassificationSummaryPagedRepresentationModel> response =
|
ResponseEntity<ClassificationSummaryPagedRepresentationModel> response =
|
||||||
template.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, CLASSIFICATION_SUMMARY_PAGE_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS)
|
|
||||||
+ "?domain=DOMAIN_A&sort-by=KEY&order=ASCENDING",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
CLASSIFICATION_SUMMARY_PAGE_MODEL_TYPE);
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
assertThat(response.getBody().getRequiredLink(IanaLinkRelations.SELF).getHref())
|
assertThat(response.getBody().getRequiredLink(IanaLinkRelations.SELF).getHref())
|
||||||
|
@ -104,13 +103,14 @@ class ClassificationControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetSecondPageSortedByKey() {
|
void testGetSecondPageSortedByKey() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS)
|
||||||
|
+ "?domain=DOMAIN_A&sort-by=KEY&order=ASCENDING&page-size=5&page=2";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<ClassificationSummaryPagedRepresentationModel> response =
|
ResponseEntity<ClassificationSummaryPagedRepresentationModel> response =
|
||||||
template.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, CLASSIFICATION_SUMMARY_PAGE_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS)
|
|
||||||
+ "?domain=DOMAIN_A&sort-by=KEY&order=ASCENDING&page-size=5&page=2",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
CLASSIFICATION_SUMMARY_PAGE_MODEL_TYPE);
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getContent()).hasSize(5);
|
assertThat(response.getBody().getContent()).hasSize(5);
|
||||||
assertThat(response.getBody().getContent().iterator().next().getKey()).isEqualTo("L1050");
|
assertThat(response.getBody().getContent().iterator().next().getKey()).isEqualTo("L1050");
|
||||||
|
@ -132,14 +132,12 @@ class ClassificationControllerIntTest {
|
||||||
"{\"classificationId\":\"\",\"category\":\"MANUAL\","
|
"{\"classificationId\":\"\",\"category\":\"MANUAL\","
|
||||||
+ "\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS\","
|
+ "\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS\","
|
||||||
+ "\"name\":\"new classification\",\"type\":\"TASK\", \"serviceLevel\":\"P1D\"}";
|
+ "\"name\":\"new classification\",\"type\":\"TASK\", \"serviceLevel\":\"P1D\"}";
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS);
|
||||||
|
HttpEntity<String> auth =
|
||||||
|
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<ClassificationRepresentationModel> responseEntity =
|
ResponseEntity<ClassificationRepresentationModel> responseEntity =
|
||||||
template.exchange(
|
TEMPLATE.exchange(url, HttpMethod.POST, auth, CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
|
|
||||||
HttpMethod.POST,
|
|
||||||
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1()),
|
|
||||||
CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
|
||||||
|
|
||||||
assertThat(responseEntity).isNotNull();
|
assertThat(responseEntity).isNotNull();
|
||||||
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||||
|
|
||||||
|
@ -147,14 +145,11 @@ class ClassificationControllerIntTest {
|
||||||
"{\"classificationId\":\"\",\"category\":\"MANUAL\","
|
"{\"classificationId\":\"\",\"category\":\"MANUAL\","
|
||||||
+ "\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS_2\","
|
+ "\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS_2\","
|
||||||
+ "\"name\":\"new classification\",\"type\":\"TASK\", \"serviceLevel\":\"P1D\"}";
|
+ "\"name\":\"new classification\",\"type\":\"TASK\", \"serviceLevel\":\"P1D\"}";
|
||||||
|
HttpEntity<String> auth2 =
|
||||||
|
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
responseEntity =
|
responseEntity =
|
||||||
template.exchange(
|
TEMPLATE.exchange(url, HttpMethod.POST, auth2, CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
|
|
||||||
HttpMethod.POST,
|
|
||||||
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1()),
|
|
||||||
CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
|
||||||
|
|
||||||
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,14 +160,13 @@ class ClassificationControllerIntTest {
|
||||||
"{\"classificationId\":\"\",\"category\":\"MANUAL\","
|
"{\"classificationId\":\"\",\"category\":\"MANUAL\","
|
||||||
+ "\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS\","
|
+ "\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS\","
|
||||||
+ "\"name\":\"new classification\",\"type\":\"TASK\"}";
|
+ "\"name\":\"new classification\",\"type\":\"TASK\"}";
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS);
|
||||||
|
HttpEntity<String> auth = new HttpEntity<>(newClassification, restHelper.getHeadersUser_1_1());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
template.exchange(
|
TEMPLATE.exchange(url, HttpMethod.POST, auth, CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
|
};
|
||||||
HttpMethod.POST,
|
|
||||||
new HttpEntity<>(newClassification, restHelper.getHeadersUser_1_1()),
|
|
||||||
CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
|
||||||
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.isInstanceOf(HttpClientErrorException.class)
|
.isInstanceOf(HttpClientErrorException.class)
|
||||||
|
@ -188,13 +182,12 @@ class ClassificationControllerIntTest {
|
||||||
+ "\"domain\":\"DOMAIN_B\",\"key\":\"NEW_CLASS_P1\","
|
+ "\"domain\":\"DOMAIN_B\",\"key\":\"NEW_CLASS_P1\","
|
||||||
+ "\"name\":\"new classification\",\"type\":\"TASK\",\"serviceLevel\":\"P1D\","
|
+ "\"name\":\"new classification\",\"type\":\"TASK\",\"serviceLevel\":\"P1D\","
|
||||||
+ "\"parentId\":\"CLI:200000000000000000000000000000000015\"}";
|
+ "\"parentId\":\"CLI:200000000000000000000000000000000015\"}";
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS);
|
||||||
|
HttpEntity<String> auth =
|
||||||
|
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<ClassificationRepresentationModel> responseEntity =
|
ResponseEntity<ClassificationRepresentationModel> responseEntity =
|
||||||
template.exchange(
|
TEMPLATE.exchange(url, HttpMethod.POST, auth, CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
|
|
||||||
HttpMethod.POST,
|
|
||||||
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1()),
|
|
||||||
CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
|
||||||
|
|
||||||
assertThat(responseEntity).isNotNull();
|
assertThat(responseEntity).isNotNull();
|
||||||
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||||
|
@ -208,13 +201,12 @@ class ClassificationControllerIntTest {
|
||||||
"{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_B\","
|
"{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_B\","
|
||||||
+ "\"key\":\"NEW_CLASS_P2\",\"name\":\"new classification\","
|
+ "\"key\":\"NEW_CLASS_P2\",\"name\":\"new classification\","
|
||||||
+ "\"type\":\"TASK\",\"parentKey\":\"T2100\",\"serviceLevel\":\"P1D\"}";
|
+ "\"type\":\"TASK\",\"parentKey\":\"T2100\",\"serviceLevel\":\"P1D\"}";
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS);
|
||||||
|
HttpEntity<String> auth =
|
||||||
|
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<ClassificationRepresentationModel> responseEntity =
|
ResponseEntity<ClassificationRepresentationModel> responseEntity =
|
||||||
template.exchange(
|
TEMPLATE.exchange(url, HttpMethod.POST, auth, CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
|
|
||||||
HttpMethod.POST,
|
|
||||||
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1()),
|
|
||||||
CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
|
||||||
|
|
||||||
assertThat(responseEntity).isNotNull();
|
assertThat(responseEntity).isNotNull();
|
||||||
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||||
|
@ -227,23 +219,18 @@ class ClassificationControllerIntTest {
|
||||||
"{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_A\","
|
"{\"classificationId\":\"\",\"category\":\"MANUAL\",\"domain\":\"DOMAIN_A\","
|
||||||
+ "\"key\":\"NEW_CLASS_P2\",\"name\":\"new classification\","
|
+ "\"key\":\"NEW_CLASS_P2\",\"name\":\"new classification\","
|
||||||
+ "\"type\":\"TASK\",\"parentKey\":\"T2100\",\"serviceLevel\":\"P1D\"}";
|
+ "\"type\":\"TASK\",\"parentKey\":\"T2100\",\"serviceLevel\":\"P1D\"}";
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS);
|
||||||
|
HttpEntity<String> auth =
|
||||||
|
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<ClassificationRepresentationModel> responseEntity =
|
ResponseEntity<ClassificationRepresentationModel> responseEntity =
|
||||||
template.exchange(
|
TEMPLATE.exchange(url, HttpMethod.POST, auth, CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
|
|
||||||
HttpMethod.POST,
|
|
||||||
new HttpEntity<>(newClassification, restHelper.getHeadersTeamlead_1()),
|
|
||||||
CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
|
||||||
|
|
||||||
assertThat(responseEntity).isNotNull();
|
assertThat(responseEntity).isNotNull();
|
||||||
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.CREATED);
|
||||||
|
|
||||||
|
HttpEntity<Object> auth2 = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
ResponseEntity<ClassificationSummaryPagedRepresentationModel> response =
|
ResponseEntity<ClassificationSummaryPagedRepresentationModel> response =
|
||||||
template.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth2, CLASSIFICATION_SUMMARY_PAGE_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
CLASSIFICATION_SUMMARY_PAGE_MODEL_TYPE);
|
|
||||||
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
|
@ -269,14 +256,15 @@ class ClassificationControllerIntTest {
|
||||||
+ "\"key\":\"NEW_CLASS_P3\",\"name\":\"new classification\","
|
+ "\"key\":\"NEW_CLASS_P3\",\"name\":\"new classification\","
|
||||||
+ "\"type\":\"TASK\",\"parentId\":\"CLI:200000000000000000000000000000000015\","
|
+ "\"type\":\"TASK\",\"parentId\":\"CLI:200000000000000000000000000000000015\","
|
||||||
+ "\"parentKey\":\"T2000\",\"serviceLevel\":\"P1D\"}";
|
+ "\"parentKey\":\"T2000\",\"serviceLevel\":\"P1D\"}";
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS);
|
||||||
|
HttpEntity<String> auth =
|
||||||
|
new HttpEntity<>(newClassification, restHelper.getHeadersBusinessAdmin());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
template.exchange(
|
TEMPLATE.exchange(url, HttpMethod.POST, auth, CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
|
};
|
||||||
HttpMethod.POST,
|
|
||||||
new HttpEntity<>(newClassification, restHelper.getHeadersBusinessAdmin()),
|
|
||||||
CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.isInstanceOf(HttpClientErrorException.class)
|
.isInstanceOf(HttpClientErrorException.class)
|
||||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||||
|
@ -290,14 +278,15 @@ class ClassificationControllerIntTest {
|
||||||
"{\"classificationId\":\"someId\",\"category\":\"MANUAL\","
|
"{\"classificationId\":\"someId\",\"category\":\"MANUAL\","
|
||||||
+ "\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS\","
|
+ "\"domain\":\"DOMAIN_A\",\"key\":\"NEW_CLASS\","
|
||||||
+ "\"name\":\"new classification\",\"type\":\"TASK\",\"serviceLevel\":\"P1D\"}";
|
+ "\"name\":\"new classification\",\"type\":\"TASK\",\"serviceLevel\":\"P1D\"}";
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS);
|
||||||
|
HttpEntity<String> auth =
|
||||||
|
new HttpEntity<>(newClassification, restHelper.getHeadersBusinessAdmin());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
template.exchange(
|
TEMPLATE.exchange(url, HttpMethod.POST, auth, CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS),
|
};
|
||||||
HttpMethod.POST,
|
|
||||||
new HttpEntity<>(newClassification, restHelper.getHeadersBusinessAdmin()),
|
|
||||||
CLASSIFICATION_REPRESENTATION_MODEL_TYPE);
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.isInstanceOf(HttpClientErrorException.class)
|
.isInstanceOf(HttpClientErrorException.class)
|
||||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||||
|
@ -306,15 +295,15 @@ class ClassificationControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetClassificationWithSpecialCharacter() {
|
void testGetClassificationWithSpecialCharacter() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(
|
||||||
|
RestEndpoints.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000009");
|
||||||
|
HttpEntity<String> auth = new HttpEntity<>(restHelper.getHeadersAdmin());
|
||||||
|
|
||||||
HttpEntity<String> request = new HttpEntity<>(restHelper.getHeadersAdmin());
|
|
||||||
ResponseEntity<ClassificationSummaryRepresentationModel> response =
|
ResponseEntity<ClassificationSummaryRepresentationModel> response =
|
||||||
template.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(
|
url, HttpMethod.GET, auth, CLASSIFICATION_SUMMARY_REPRESENTATION_MODEL_TYPE);
|
||||||
RestEndpoints.URL_CLASSIFICATIONS_ID, "CLI:100000000000000000000000000000000009"),
|
|
||||||
HttpMethod.GET,
|
|
||||||
request,
|
|
||||||
CLASSIFICATION_SUMMARY_REPRESENTATION_MODEL_TYPE);
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getName()).isEqualTo("Zustimmungserklärung");
|
assertThat(response.getBody().getName()).isEqualTo("Zustimmungserklärung");
|
||||||
}
|
}
|
||||||
|
@ -322,43 +311,37 @@ class ClassificationControllerIntTest {
|
||||||
@Test
|
@Test
|
||||||
@DirtiesContext
|
@DirtiesContext
|
||||||
void testDeleteClassification() {
|
void testDeleteClassification() {
|
||||||
HttpEntity<String> request = new HttpEntity<>(restHelper.getHeadersBusinessAdmin());
|
String url =
|
||||||
|
restHelper.toUrl(
|
||||||
|
RestEndpoints.URL_CLASSIFICATIONS_ID, "CLI:200000000000000000000000000000000004");
|
||||||
|
HttpEntity<String> auth = new HttpEntity<>(restHelper.getHeadersBusinessAdmin());
|
||||||
|
|
||||||
ResponseEntity<ClassificationSummaryRepresentationModel> response =
|
ResponseEntity<ClassificationSummaryRepresentationModel> response =
|
||||||
template.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(
|
url, HttpMethod.DELETE, auth, CLASSIFICATION_SUMMARY_REPRESENTATION_MODEL_TYPE);
|
||||||
RestEndpoints.URL_CLASSIFICATIONS_ID, "CLI:200000000000000000000000000000000004"),
|
|
||||||
HttpMethod.DELETE,
|
|
||||||
request,
|
|
||||||
CLASSIFICATION_SUMMARY_REPRESENTATION_MODEL_TYPE);
|
|
||||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
|
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() ->
|
||||||
template.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(
|
url, HttpMethod.GET, auth, CLASSIFICATION_SUMMARY_REPRESENTATION_MODEL_TYPE);
|
||||||
RestEndpoints.URL_CLASSIFICATIONS_ID,
|
|
||||||
"CLI:200000000000000000000000000000000004"),
|
|
||||||
HttpMethod.GET,
|
|
||||||
request,
|
|
||||||
CLASSIFICATION_SUMMARY_REPRESENTATION_MODEL_TYPE);
|
|
||||||
assertThatThrownBy(httpCall).isInstanceOf(HttpClientErrorException.class);
|
assertThatThrownBy(httpCall).isInstanceOf(HttpClientErrorException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ThrowException_When_ProvidingInvalidFilterParams() {
|
void should_ThrowException_When_ProvidingInvalidFilterParams() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS)
|
||||||
|
+ "?domain=DOMAIN_A"
|
||||||
|
+ "&illegalParam=illegal"
|
||||||
|
+ "&anotherIllegalParam=stillIllegal"
|
||||||
|
+ "&sort-by=NAME&order=DESCENDING&page-size=5&page=2";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, CLASSIFICATION_SUMMARY_PAGE_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS)
|
};
|
||||||
+ "?domain=DOMAIN_A"
|
|
||||||
+ "&illegalParam=illegal"
|
|
||||||
+ "&anotherIllegalParam=stillIllegal"
|
|
||||||
+ "&sort-by=NAME&order=DESCENDING&page-size=5&page=2",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
CLASSIFICATION_SUMMARY_PAGE_MODEL_TYPE);
|
|
||||||
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.isInstanceOf(HttpClientErrorException.class)
|
.isInstanceOf(HttpClientErrorException.class)
|
||||||
|
|
|
@ -50,6 +50,12 @@ import pro.taskana.common.test.rest.TaskanaSpringBootTest;
|
||||||
@TestMethodOrder(OrderAnnotation.class)
|
@TestMethodOrder(OrderAnnotation.class)
|
||||||
class ClassificationDefinitionControllerIntTest {
|
class ClassificationDefinitionControllerIntTest {
|
||||||
|
|
||||||
|
private static final ParameterizedTypeReference<
|
||||||
|
ClassificationDefinitionCollectionRepresentationModel>
|
||||||
|
CLASSIFICATION_DEFINITION_COLLECTION =
|
||||||
|
new ParameterizedTypeReference<
|
||||||
|
ClassificationDefinitionCollectionRepresentationModel>() {};
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationController.class);
|
private static final Logger LOGGER = LoggerFactory.getLogger(ClassificationController.class);
|
||||||
|
|
||||||
private final RestHelper restHelper;
|
private final RestHelper restHelper;
|
||||||
|
@ -72,13 +78,12 @@ class ClassificationDefinitionControllerIntTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(1) // since the import tests adds Classifications this has to be tested first.
|
@Order(1) // since the import tests adds Classifications this has to be tested first.
|
||||||
void should_ExportAllClassifications_When_ExportIsRequested() {
|
void should_ExportAllClassifications_When_ExportIsRequested() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_DEFINITIONS) + "?domain=DOMAIN_B";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
ResponseEntity<ClassificationDefinitionCollectionRepresentationModel> response =
|
ResponseEntity<ClassificationDefinitionCollectionRepresentationModel> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, CLASSIFICATION_DEFINITION_COLLECTION);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_DEFINITIONS) + "?domain=DOMAIN_B",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ParameterizedTypeReference.forType(
|
|
||||||
ClassificationDefinitionCollectionRepresentationModel.class));
|
|
||||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
|
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getContent())
|
assertThat(response.getBody().getContent())
|
||||||
|
@ -94,13 +99,13 @@ class ClassificationDefinitionControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_NotContainAnyLinks_When_ExportIsRequested() {
|
void should_NotContainAnyLinks_When_ExportIsRequested() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_DEFINITIONS) + "?domain=DOMAIN_B";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<ClassificationDefinitionCollectionRepresentationModel> response =
|
ResponseEntity<ClassificationDefinitionCollectionRepresentationModel> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, CLASSIFICATION_DEFINITION_COLLECTION);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_DEFINITIONS) + "?domain=DOMAIN_B",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ParameterizedTypeReference.forType(
|
|
||||||
ClassificationDefinitionCollectionRepresentationModel.class));
|
|
||||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
|
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isPresent();
|
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isPresent();
|
||||||
|
@ -113,13 +118,12 @@ class ClassificationDefinitionControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ExportNothing_When_DomainIsUnknown() {
|
void should_ExportNothing_When_DomainIsUnknown() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_DEFINITIONS) + "?domain=ADdfe";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<ClassificationDefinitionCollectionRepresentationModel> response =
|
ResponseEntity<ClassificationDefinitionCollectionRepresentationModel> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, CLASSIFICATION_DEFINITION_COLLECTION);
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_DEFINITIONS) + "?domain=ADdfe",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ParameterizedTypeReference.forType(
|
|
||||||
ClassificationDefinitionCollectionRepresentationModel.class));
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getContent()).isEmpty();
|
assertThat(response.getBody().getContent()).isEmpty();
|
||||||
}
|
}
|
||||||
|
@ -414,7 +418,7 @@ class ClassificationDefinitionControllerIntTest {
|
||||||
LOGGER.debug("Start Import");
|
LOGGER.debug("Start Import");
|
||||||
File tmpFile = File.createTempFile("test", ".tmp");
|
File tmpFile = File.createTempFile("test", ".tmp");
|
||||||
try (FileOutputStream out = new FileOutputStream(tmpFile);
|
try (FileOutputStream out = new FileOutputStream(tmpFile);
|
||||||
OutputStreamWriter writer = new OutputStreamWriter(out, StandardCharsets.UTF_8); ) {
|
OutputStreamWriter writer = new OutputStreamWriter(out, StandardCharsets.UTF_8)) {
|
||||||
mapper.writeValue(writer, clList);
|
mapper.writeValue(writer, clList);
|
||||||
}
|
}
|
||||||
MultiValueMap<String, FileSystemResource> body = new LinkedMultiValueMap<>();
|
MultiValueMap<String, FileSystemResource> body = new LinkedMultiValueMap<>();
|
||||||
|
|
|
@ -34,13 +34,14 @@ class AccessIdControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testQueryGroupsByDn() {
|
void testQueryGroupsByDn() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID)
|
||||||
|
+ "?search-for=cn=ksc-users,cn=groups,OU=Test,O=TASKANA";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, ACCESS_ID_LIST_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID)
|
|
||||||
+ "?search-for=cn=ksc-users,cn=groups,OU=Test,O=TASKANA",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ACCESS_ID_LIST_TYPE);
|
|
||||||
assertThat(response.getBody())
|
assertThat(response.getBody())
|
||||||
.isNotNull()
|
.isNotNull()
|
||||||
.extracting(AccessIdRepresentationModel::getAccessId)
|
.extracting(AccessIdRepresentationModel::getAccessId)
|
||||||
|
@ -50,13 +51,14 @@ class AccessIdControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testQueryUserByDn() {
|
void testQueryUserByDn() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID)
|
||||||
|
+ "?search-for=uid=teamlead-1,cn=users,OU=Test,O=TASKANA";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, ACCESS_ID_LIST_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID)
|
|
||||||
+ "?search-for=uid=teamlead-1,cn=users,OU=Test,O=TASKANA",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ACCESS_ID_LIST_TYPE);
|
|
||||||
assertThat(response.getBody())
|
assertThat(response.getBody())
|
||||||
.isNotNull()
|
.isNotNull()
|
||||||
.extracting(AccessIdRepresentationModel::getAccessId)
|
.extracting(AccessIdRepresentationModel::getAccessId)
|
||||||
|
@ -66,12 +68,12 @@ class AccessIdControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testQueryGroupsByCn() {
|
void testQueryGroupsByCn() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=ksc-use";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, ACCESS_ID_LIST_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=ksc-use",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ACCESS_ID_LIST_TYPE);
|
|
||||||
assertThat(response.getBody())
|
assertThat(response.getBody())
|
||||||
.isNotNull()
|
.isNotNull()
|
||||||
.extracting(AccessIdRepresentationModel::getAccessId)
|
.extracting(AccessIdRepresentationModel::getAccessId)
|
||||||
|
@ -81,23 +83,23 @@ class AccessIdControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ReturnEmptyResults_ifInvalidCharacterIsUsedInCondition() {
|
void should_ReturnEmptyResults_ifInvalidCharacterIsUsedInCondition() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=ksc-teamleads,cn=groups";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, ACCESS_ID_LIST_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=ksc-teamleads,cn=groups",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ACCESS_ID_LIST_TYPE);
|
|
||||||
assertThat(response.getBody()).isNotNull().isEmpty();
|
assertThat(response.getBody()).isNotNull().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetMatches() {
|
void testGetMatches() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=rig";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, ACCESS_ID_LIST_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=rig",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ACCESS_ID_LIST_TYPE);
|
|
||||||
|
|
||||||
assertThat(response.getBody())
|
assertThat(response.getBody())
|
||||||
.isNotNull()
|
.isNotNull()
|
||||||
|
@ -107,12 +109,11 @@ class AccessIdControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ReturnAccessIdWithUmlauten_ifBased64EncodedUserIsLookedUp() {
|
void should_ReturnAccessIdWithUmlauten_ifBased64EncodedUserIsLookedUp() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=läf";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, ACCESS_ID_LIST_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=läf",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ACCESS_ID_LIST_TYPE);
|
|
||||||
|
|
||||||
assertThat(response.getBody())
|
assertThat(response.getBody())
|
||||||
.isNotNull()
|
.isNotNull()
|
||||||
|
@ -122,13 +123,15 @@ class AccessIdControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ThrowException_When_SearchForIsTooShort() {
|
void should_ThrowException_When_SearchForIsTooShort() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=al";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=al",
|
url, HttpMethod.GET, auth, ParameterizedTypeReference.forType(List.class));
|
||||||
HttpMethod.GET,
|
};
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ParameterizedTypeReference.forType(List.class));
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.isInstanceOf(HttpClientErrorException.class)
|
.isInstanceOf(HttpClientErrorException.class)
|
||||||
.hasMessageContaining("Minimum Length is")
|
.hasMessageContaining("Minimum Length is")
|
||||||
|
@ -138,12 +141,11 @@ class AccessIdControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ReturnAccessIdsOfGroupsTheAccessIdIsMemberOf_ifAccessIdOfUserIsGiven() {
|
void should_ReturnAccessIdsOfGroupsTheAccessIdIsMemberOf_ifAccessIdOfUserIsGiven() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_ACCESS_ID_GROUPS) + "?access-id=teamlead-2";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, ACCESS_ID_LIST_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID_GROUPS) + "?access-id=teamlead-2",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ACCESS_ID_LIST_TYPE);
|
|
||||||
|
|
||||||
assertThat(response.getBody())
|
assertThat(response.getBody())
|
||||||
.isNotNull()
|
.isNotNull()
|
||||||
|
@ -159,12 +161,11 @@ class AccessIdControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ValidateAccessIdWithEqualsFilterAndReturnAccessIdsOfGroupsTheAccessIdIsMemberOf() {
|
void should_ValidateAccessIdWithEqualsFilterAndReturnAccessIdsOfGroupsTheAccessIdIsMemberOf() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_ACCESS_ID_GROUPS) + "?access-id=user-2-1";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, ACCESS_ID_LIST_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID_GROUPS) + "?access-id=user-2-1",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ACCESS_ID_LIST_TYPE);
|
|
||||||
|
|
||||||
assertThat(response.getBody())
|
assertThat(response.getBody())
|
||||||
.isNotNull()
|
.isNotNull()
|
||||||
|
@ -178,14 +179,14 @@ class AccessIdControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ReturnBadRequest_ifAccessIdOfUserContainsInvalidCharacter() {
|
void should_ReturnBadRequest_ifAccessIdOfUserContainsInvalidCharacter() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID_GROUPS) + "?access-id=teamlead-2,cn=users";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ThrowingCallable call =
|
ThrowingCallable call =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, ACCESS_ID_LIST_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID_GROUPS)
|
};
|
||||||
+ "?access-id=teamlead-2,cn=users",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ACCESS_ID_LIST_TYPE);
|
|
||||||
|
|
||||||
assertThatThrownBy(call)
|
assertThatThrownBy(call)
|
||||||
.isInstanceOf(HttpClientErrorException.class)
|
.isInstanceOf(HttpClientErrorException.class)
|
||||||
|
@ -196,14 +197,14 @@ class AccessIdControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ReturnAccessIdsOfGroupsTheAccessIdIsMemberOf_ifAccessIdOfGroupIsGiven() {
|
void should_ReturnAccessIdsOfGroupsTheAccessIdIsMemberOf_ifAccessIdOfGroupIsGiven() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID_GROUPS)
|
||||||
|
+ "?access-id=cn=Organisationseinheit KSC 1,"
|
||||||
|
+ "cn=Organisationseinheit KSC,cn=organisation,OU=Test,O=TASKANA";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
ResponseEntity<List<AccessIdRepresentationModel>> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, ACCESS_ID_LIST_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID_GROUPS)
|
|
||||||
+ "?access-id=cn=Organisationseinheit KSC 1,"
|
|
||||||
+ "cn=Organisationseinheit KSC,cn=organisation,OU=Test,O=TASKANA",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ACCESS_ID_LIST_TYPE);
|
|
||||||
|
|
||||||
assertThat(response.getBody())
|
assertThat(response.getBody())
|
||||||
.isNotNull()
|
.isNotNull()
|
||||||
|
@ -214,13 +215,13 @@ class AccessIdControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ThrowNotAuthorizedException_ifCallerOfGroupRetrievalIsNotAdminOrBusinessAdmin() {
|
void should_ThrowNotAuthorizedException_ifCallerOfGroupRetrievalIsNotAdminOrBusinessAdmin() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_ACCESS_ID_GROUPS) + "?access-id=teamlead-2";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersUser_1_1());
|
||||||
|
|
||||||
ThrowingCallable call =
|
ThrowingCallable call =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, ACCESS_ID_LIST_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID_GROUPS) + "?access-id=teamlead-2",
|
};
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersUser_1_1()),
|
|
||||||
ACCESS_ID_LIST_TYPE);
|
|
||||||
|
|
||||||
assertThatThrownBy(call)
|
assertThatThrownBy(call)
|
||||||
.isInstanceOf(HttpClientErrorException.class)
|
.isInstanceOf(HttpClientErrorException.class)
|
||||||
|
@ -230,13 +231,13 @@ class AccessIdControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ThrowNotAuthorizedException_ifCallerOfValidationIsNotAdminOrBusinessAdmin() {
|
void should_ThrowNotAuthorizedException_ifCallerOfValidationIsNotAdminOrBusinessAdmin() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=al";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersUser_1_1());
|
||||||
|
|
||||||
ThrowingCallable call =
|
ThrowingCallable call =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, ACCESS_ID_LIST_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_ACCESS_ID) + "?search-for=al",
|
};
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersUser_1_1()),
|
|
||||||
ACCESS_ID_LIST_TYPE);
|
|
||||||
|
|
||||||
assertThatThrownBy(call)
|
assertThatThrownBy(call)
|
||||||
.isInstanceOf(HttpClientErrorException.class)
|
.isInstanceOf(HttpClientErrorException.class)
|
||||||
|
|
|
@ -28,14 +28,19 @@ class GeneralExceptionHandlingTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDeleteNonExisitingClassificationExceptionIsLogged() {
|
void testDeleteNonExisitingClassificationExceptionIsLogged() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS_ID, "non-existing-id");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATIONS_ID, "non-existing-id"),
|
url,
|
||||||
HttpMethod.DELETE,
|
HttpMethod.DELETE,
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
auth,
|
||||||
ParameterizedTypeReference.forType(
|
ParameterizedTypeReference.forType(
|
||||||
ClassificationSummaryPagedRepresentationModel.class));
|
ClassificationSummaryPagedRepresentationModel.class));
|
||||||
|
};
|
||||||
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.isInstanceOf(HttpClientErrorException.class)
|
.isInstanceOf(HttpClientErrorException.class)
|
||||||
.hasMessageContaining("non-existing-id");
|
.hasMessageContaining("non-existing-id");
|
||||||
|
|
|
@ -31,45 +31,48 @@ class TaskanaEngineControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testDomains() {
|
void testDomains() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_DOMAIN);
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<List<String>> response =
|
ResponseEntity<List<String>> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(RestEndpoints.URL_DOMAIN),
|
url, HttpMethod.GET, auth, ParameterizedTypeReference.forType(List.class));
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ParameterizedTypeReference.forType(List.class));
|
|
||||||
assertThat(response.getBody()).contains("DOMAIN_A");
|
assertThat(response.getBody()).contains("DOMAIN_A");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testClassificationTypes() {
|
void testClassificationTypes() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_TYPES);
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<List<String>> response =
|
ResponseEntity<List<String>> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_TYPES),
|
url, HttpMethod.GET, auth, ParameterizedTypeReference.forType(List.class));
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ParameterizedTypeReference.forType(List.class));
|
|
||||||
assertThat(response.getBody()).containsExactlyInAnyOrder("TASK", "DOCUMENT");
|
assertThat(response.getBody()).containsExactlyInAnyOrder("TASK", "DOCUMENT");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testClassificationCategories() {
|
void testClassificationCategories() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_CATEGORIES);
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<List<String>> response =
|
ResponseEntity<List<String>> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(RestEndpoints.URL_CLASSIFICATION_CATEGORIES),
|
url, HttpMethod.GET, auth, ParameterizedTypeReference.forType(List.class));
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ParameterizedTypeReference.forType(List.class));
|
|
||||||
assertThat(response.getBody())
|
assertThat(response.getBody())
|
||||||
.containsExactlyInAnyOrder("MANUAL", "EXTERNAL", "AUTOMATIC", "PROCESS", "EXTERNAL");
|
.containsExactlyInAnyOrder("MANUAL", "EXTERNAL", "AUTOMATIC", "PROCESS", "EXTERNAL");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetCurrentUserInfo() {
|
void testGetCurrentUserInfo() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_CURRENT_USER);
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<TaskanaUserInfoRepresentationModel> response =
|
ResponseEntity<TaskanaUserInfoRepresentationModel> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(RestEndpoints.URL_CURRENT_USER),
|
url,
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
auth,
|
||||||
ParameterizedTypeReference.forType(TaskanaUserInfoRepresentationModel.class));
|
ParameterizedTypeReference.forType(TaskanaUserInfoRepresentationModel.class));
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getUserId()).isEqualTo("teamlead-1");
|
assertThat(response.getBody().getUserId()).isEqualTo("teamlead-1");
|
||||||
|
|
|
@ -20,26 +20,26 @@ import pro.taskana.monitor.rest.models.ReportRepresentationModel;
|
||||||
@TaskanaSpringBootTest
|
@TaskanaSpringBootTest
|
||||||
class MonitorControllerIntTest {
|
class MonitorControllerIntTest {
|
||||||
|
|
||||||
|
private static final ParameterizedTypeReference<ReportRepresentationModel> REPORT_MODEL =
|
||||||
|
new ParameterizedTypeReference<ReportRepresentationModel>() {};
|
||||||
|
|
||||||
@Autowired RestHelper restHelper;
|
@Autowired RestHelper restHelper;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ReturnAllOpenTasksByState_When_QueryingForAWorkbasketAndReadyAndClaimedState() {
|
void should_ReturnAllOpenTasksByState_When_QueryingForAWorkbasketAndReadyAndClaimedState() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(RestEndpoints.URL_MONITOR_TASKS_STATUS_REPORT)
|
||||||
|
+ "?workbasket-ids=WBI:100000000000000000000000000000000007"
|
||||||
|
+ "&states=READY&states=CLAIMED";
|
||||||
|
HttpEntity<String> auth = new HttpEntity<>(restHelper.getHeadersAdmin());
|
||||||
|
|
||||||
HttpEntity<String> request = new HttpEntity<>(restHelper.getHeadersAdmin());
|
|
||||||
ResponseEntity<ReportRepresentationModel> response =
|
ResponseEntity<ReportRepresentationModel> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, REPORT_MODEL);
|
||||||
restHelper.toUrl(RestEndpoints.URL_MONITOR_TASKS_STATUS_REPORT)
|
|
||||||
+ "?workbasket-ids=WBI:100000000000000000000000000000000007"
|
|
||||||
+ "&states=READY&states=CLAIMED",
|
|
||||||
HttpMethod.GET,
|
|
||||||
request,
|
|
||||||
ParameterizedTypeReference.forType(ReportRepresentationModel.class));
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat((response.getBody()).getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat((response.getBody()).getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
|
|
||||||
int totalOpenTasks = response.getBody().getSumRow().get(0).getTotal();
|
int totalOpenTasks = response.getBody().getSumRow().get(0).getTotal();
|
||||||
assertThat(totalOpenTasks).isEqualTo(15);
|
assertThat(totalOpenTasks).isEqualTo(15);
|
||||||
|
|
||||||
int[] tasksPerState = response.getBody().getSumRow().get(0).getCells();
|
int[] tasksPerState = response.getBody().getSumRow().get(0).getCells();
|
||||||
// should be 2 READY, 13 CLAIMED
|
// should be 2 READY, 13 CLAIMED
|
||||||
int[] expectedTasksPerState = new int[] {2, 13};
|
int[] expectedTasksPerState = new int[] {2, 13};
|
||||||
|
@ -48,19 +48,20 @@ class MonitorControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ReturnAllOpenTasksByState_When_QueryingForSpecificWbAndStateReadyAndMinimumPrio() {
|
void should_ReturnAllOpenTasksByState_When_QueryingForSpecificWbAndStateReadyAndMinimumPrio() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_MONITOR_TASKS_STATUS_REPORT);
|
||||||
|
HttpEntity<String> auth = new HttpEntity<>(restHelper.getHeadersAdmin());
|
||||||
|
|
||||||
HttpEntity<String> request = new HttpEntity<>(restHelper.getHeadersAdmin());
|
|
||||||
ResponseEntity<ReportRepresentationModel> response =
|
ResponseEntity<ReportRepresentationModel> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(RestEndpoints.URL_MONITOR_TASKS_STATUS_REPORT)
|
url
|
||||||
+ "?workbasket-ids=WBI:100000000000000000000000000000000007"
|
+ "?workbasket-ids=WBI:100000000000000000000000000000000007"
|
||||||
+ "&states=READY&priority-minimum=1",
|
+ "&states=READY&priority-minimum=1",
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
request,
|
auth,
|
||||||
ParameterizedTypeReference.forType(ReportRepresentationModel.class));
|
REPORT_MODEL);
|
||||||
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat((response.getBody()).getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat((response.getBody()).getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
|
|
||||||
int[] tasksInStateReady = response.getBody().getSumRow().get(0).getCells();
|
int[] tasksInStateReady = response.getBody().getSumRow().get(0).getCells();
|
||||||
// should be 2 READY
|
// should be 2 READY
|
||||||
int[] expectedTasksPerState = new int[] {2};
|
int[] expectedTasksPerState = new int[] {2};
|
||||||
|
|
|
@ -30,6 +30,8 @@ class TaskCommentControllerIntTest {
|
||||||
private static final ParameterizedTypeReference<TaskCommentCollectionRepresentationModel>
|
private static final ParameterizedTypeReference<TaskCommentCollectionRepresentationModel>
|
||||||
TASK_COMMENT_PAGE_MODEL_TYPE =
|
TASK_COMMENT_PAGE_MODEL_TYPE =
|
||||||
new ParameterizedTypeReference<TaskCommentCollectionRepresentationModel>() {};
|
new ParameterizedTypeReference<TaskCommentCollectionRepresentationModel>() {};
|
||||||
|
private static final ParameterizedTypeReference<TaskCommentRepresentationModel>
|
||||||
|
TASK_COMMENT_TYPE = new ParameterizedTypeReference<TaskCommentRepresentationModel>() {};
|
||||||
|
|
||||||
private final RestHelper restHelper;
|
private final RestHelper restHelper;
|
||||||
|
|
||||||
|
@ -40,17 +42,14 @@ class TaskCommentControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_FailToReturnTaskComment_When_TaskCommentIsNotExisting() {
|
void should_FailToReturnTaskComment_When_TaskCommentIsNotExisting() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_TASK_COMMENT, "Non existing task comment Id");
|
||||||
String urlToNonExistingTaskComment =
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersAdmin());
|
||||||
restHelper.toUrl(RestEndpoints.URL_TASK_COMMENT, "Non existing task comment Id");
|
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_COMMENT_TYPE);
|
||||||
urlToNonExistingTaskComment,
|
};
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersAdmin()),
|
|
||||||
ParameterizedTypeReference.forType(TaskCommentRepresentationModel.class));
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||||
.isEqualTo(HttpStatus.NOT_FOUND);
|
.isEqualTo(HttpStatus.NOT_FOUND);
|
||||||
|
@ -58,18 +57,16 @@ class TaskCommentControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_FailToReturnTaskComments_When_TaskIstNotVisible() {
|
void should_FailToReturnTaskComments_When_TaskIstNotVisible() {
|
||||||
|
String url =
|
||||||
String urlToNotVisibleTask =
|
|
||||||
restHelper.toUrl(
|
restHelper.toUrl(
|
||||||
RestEndpoints.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000004");
|
RestEndpoints.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000004");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersUser_1_1());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||||
urlToNotVisibleTask,
|
};
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersUser_1_1()),
|
|
||||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||||
.isEqualTo(HttpStatus.FORBIDDEN);
|
.isEqualTo(HttpStatus.FORBIDDEN);
|
||||||
|
@ -77,61 +74,45 @@ class TaskCommentControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ReturnSortedAndOrederedTaskCommentsSortedByModified_When_UsingSortAndOrderParams() {
|
void should_ReturnSortedAndOrederedTaskCommentsSortedByModified_When_UsingSortAndOrderParams() {
|
||||||
|
|
||||||
String url =
|
String url =
|
||||||
restHelper.toUrl(
|
restHelper.toUrl(
|
||||||
RestEndpoints.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000000");
|
RestEndpoints.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000000");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersAdmin());
|
||||||
|
|
||||||
|
String url1 = url + "?sort-by=MODIFIED&order=DESCENDING";
|
||||||
ResponseEntity<TaskCommentCollectionRepresentationModel>
|
ResponseEntity<TaskCommentCollectionRepresentationModel>
|
||||||
getTaskCommentsSortedByModifiedOrderedByDescendingResponse =
|
getTaskCommentsSortedByModifiedOrderedByDescendingResponse =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url1, HttpMethod.GET, auth, TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||||
url + "?sort-by=MODIFIED&order=DESCENDING",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersAdmin()),
|
|
||||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
|
||||||
|
|
||||||
assertThat(getTaskCommentsSortedByModifiedOrderedByDescendingResponse.getBody()).isNotNull();
|
assertThat(getTaskCommentsSortedByModifiedOrderedByDescendingResponse.getBody()).isNotNull();
|
||||||
assertThat(getTaskCommentsSortedByModifiedOrderedByDescendingResponse.getBody().getContent())
|
assertThat(getTaskCommentsSortedByModifiedOrderedByDescendingResponse.getBody().getContent())
|
||||||
.hasSize(3)
|
.hasSize(3)
|
||||||
.extracting(TaskCommentRepresentationModel::getModified)
|
.extracting(TaskCommentRepresentationModel::getModified)
|
||||||
.isSortedAccordingTo(Comparator.reverseOrder());
|
.isSortedAccordingTo(Comparator.reverseOrder());
|
||||||
|
|
||||||
|
String url2 = url + "?sort-by=MODIFIED";
|
||||||
ResponseEntity<TaskCommentCollectionRepresentationModel>
|
ResponseEntity<TaskCommentCollectionRepresentationModel>
|
||||||
getTaskCommentsSortedByModifiedOrderedByAscendingResponse =
|
getTaskCommentsSortedByModifiedOrderedByAscendingResponse =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url2, HttpMethod.GET, auth, TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||||
url + "?sort-by=MODIFIED",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersAdmin()),
|
|
||||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
|
||||||
|
|
||||||
assertThat(getTaskCommentsSortedByModifiedOrderedByAscendingResponse.getBody()).isNotNull();
|
assertThat(getTaskCommentsSortedByModifiedOrderedByAscendingResponse.getBody()).isNotNull();
|
||||||
assertThat(getTaskCommentsSortedByModifiedOrderedByAscendingResponse.getBody().getContent())
|
assertThat(getTaskCommentsSortedByModifiedOrderedByAscendingResponse.getBody().getContent())
|
||||||
.hasSize(3)
|
.hasSize(3)
|
||||||
.extracting(TaskCommentRepresentationModel::getModified)
|
.extracting(TaskCommentRepresentationModel::getModified)
|
||||||
.isSortedAccordingTo(Comparator.naturalOrder());
|
.isSortedAccordingTo(Comparator.naturalOrder());
|
||||||
|
|
||||||
|
String url3 = url + "?sort-by=CREATED&order=DESCENDING";
|
||||||
ResponseEntity<TaskCommentCollectionRepresentationModel>
|
ResponseEntity<TaskCommentCollectionRepresentationModel>
|
||||||
getTaskCommentsSortedByCreatedOrderedByDescendingResponse =
|
getTaskCommentsSortedByCreatedOrderedByDescendingResponse =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url3, HttpMethod.GET, auth, TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||||
url + "?sort-by=CREATED&order=DESCENDING",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersAdmin()),
|
|
||||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
|
||||||
|
|
||||||
assertThat(getTaskCommentsSortedByCreatedOrderedByDescendingResponse.getBody()).isNotNull();
|
assertThat(getTaskCommentsSortedByCreatedOrderedByDescendingResponse.getBody()).isNotNull();
|
||||||
assertThat(getTaskCommentsSortedByCreatedOrderedByDescendingResponse.getBody().getContent())
|
assertThat(getTaskCommentsSortedByCreatedOrderedByDescendingResponse.getBody().getContent())
|
||||||
.hasSize(3)
|
.hasSize(3)
|
||||||
.extracting(TaskCommentRepresentationModel::getCreated)
|
.extracting(TaskCommentRepresentationModel::getCreated)
|
||||||
.isSortedAccordingTo(Comparator.reverseOrder());
|
.isSortedAccordingTo(Comparator.reverseOrder());
|
||||||
|
|
||||||
|
String url4 = url + "?sort-by=CREATED";
|
||||||
ResponseEntity<TaskCommentCollectionRepresentationModel>
|
ResponseEntity<TaskCommentCollectionRepresentationModel>
|
||||||
getTaskCommentsSortedByCreatedOrderedByAscendingResponse =
|
getTaskCommentsSortedByCreatedOrderedByAscendingResponse =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url4, HttpMethod.GET, auth, TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||||
url + "?sort-by=CREATED",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersAdmin()),
|
|
||||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
|
||||||
|
|
||||||
assertThat(getTaskCommentsSortedByCreatedOrderedByAscendingResponse.getBody()).isNotNull();
|
assertThat(getTaskCommentsSortedByCreatedOrderedByAscendingResponse.getBody()).isNotNull();
|
||||||
assertThat(getTaskCommentsSortedByCreatedOrderedByAscendingResponse.getBody().getContent())
|
assertThat(getTaskCommentsSortedByCreatedOrderedByAscendingResponse.getBody().getContent())
|
||||||
.hasSize(3)
|
.hasSize(3)
|
||||||
|
@ -141,18 +122,20 @@ class TaskCommentControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ThrowException_When_UsingInvalidSortParam() {
|
void should_ThrowException_When_UsingInvalidSortParam() {
|
||||||
|
|
||||||
String url =
|
String url =
|
||||||
restHelper.toUrl(
|
restHelper.toUrl(
|
||||||
RestEndpoints.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000000");
|
RestEndpoints.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000000");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersUser_1_1());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
url + "?sort-by=invalidSortParam",
|
url + "?sort-by=invalidSortParam",
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
new HttpEntity<>(restHelper.getHeadersUser_1_1()),
|
auth,
|
||||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||||
|
};
|
||||||
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||||
.isEqualTo(HttpStatus.BAD_REQUEST);
|
.isEqualTo(HttpStatus.BAD_REQUEST);
|
||||||
|
@ -160,18 +143,16 @@ class TaskCommentControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_FailToReturnTaskComment_When_TaskIstNotVisible() {
|
void should_FailToReturnTaskComment_When_TaskIstNotVisible() {
|
||||||
|
String url =
|
||||||
String urlToNotVisibleTask =
|
|
||||||
restHelper.toUrl(
|
restHelper.toUrl(
|
||||||
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000012");
|
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000012");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersUser_1_2());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_COMMENT_TYPE);
|
||||||
urlToNotVisibleTask,
|
};
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersUser_1_2()),
|
|
||||||
ParameterizedTypeReference.forType(TaskCommentRepresentationModel.class));
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||||
.isEqualTo(HttpStatus.FORBIDDEN);
|
.isEqualTo(HttpStatus.FORBIDDEN);
|
||||||
|
@ -179,21 +160,21 @@ class TaskCommentControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_FailToCreateTaskComment_When_TaskIsNotVisible() {
|
void should_FailToCreateTaskComment_When_TaskIsNotVisible() {
|
||||||
|
|
||||||
TaskCommentRepresentationModel taskCommentRepresentationModelToCreate =
|
TaskCommentRepresentationModel taskCommentRepresentationModelToCreate =
|
||||||
new TaskCommentRepresentationModel();
|
new TaskCommentRepresentationModel();
|
||||||
taskCommentRepresentationModelToCreate.setTaskId("TKI:000000000000000000000000000000000000");
|
taskCommentRepresentationModelToCreate.setTaskId("TKI:000000000000000000000000000000000000");
|
||||||
taskCommentRepresentationModelToCreate.setTextField("newly created task comment");
|
taskCommentRepresentationModelToCreate.setTextField("newly created task comment");
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(
|
||||||
|
RestEndpoints.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000000");
|
||||||
|
HttpEntity<TaskCommentRepresentationModel> auth =
|
||||||
|
new HttpEntity<>(taskCommentRepresentationModelToCreate, restHelper.getHeadersUser_b_1());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.POST, auth, TASK_COMMENT_TYPE);
|
||||||
restHelper.toUrl(
|
};
|
||||||
RestEndpoints.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000000"),
|
|
||||||
HttpMethod.POST,
|
|
||||||
new HttpEntity<>(
|
|
||||||
taskCommentRepresentationModelToCreate, restHelper.getHeadersUser_b_1()),
|
|
||||||
ParameterizedTypeReference.forType(TaskCommentRepresentationModel.class));
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||||
.isEqualTo(HttpStatus.FORBIDDEN);
|
.isEqualTo(HttpStatus.FORBIDDEN);
|
||||||
|
@ -201,20 +182,19 @@ class TaskCommentControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_FailToCreateTaskComment_When_TaskIdIsNonExisting() {
|
void should_FailToCreateTaskComment_When_TaskIdIsNonExisting() {
|
||||||
|
|
||||||
TaskCommentRepresentationModel taskCommentRepresentationModelToCreate =
|
TaskCommentRepresentationModel taskCommentRepresentationModelToCreate =
|
||||||
new TaskCommentRepresentationModel();
|
new TaskCommentRepresentationModel();
|
||||||
taskCommentRepresentationModelToCreate.setTaskId("DefinatelyNotExistingId");
|
taskCommentRepresentationModelToCreate.setTaskId("DefinatelyNotExistingId");
|
||||||
taskCommentRepresentationModelToCreate.setTextField("newly created task comment");
|
taskCommentRepresentationModelToCreate.setTextField("newly created task comment");
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_TASK_COMMENTS, "DefinatelyNotExistingId");
|
||||||
|
HttpEntity<TaskCommentRepresentationModel> auth =
|
||||||
|
new HttpEntity<>(taskCommentRepresentationModelToCreate, restHelper.getHeadersAdmin());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.POST, auth, TASK_COMMENT_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_TASK_COMMENTS, "DefinatelyNotExistingId"),
|
};
|
||||||
HttpMethod.POST,
|
|
||||||
new HttpEntity<>(
|
|
||||||
taskCommentRepresentationModelToCreate, restHelper.getHeadersAdmin()),
|
|
||||||
ParameterizedTypeReference.forType(TaskCommentRepresentationModel.class));
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||||
.isEqualTo(HttpStatus.NOT_FOUND);
|
.isEqualTo(HttpStatus.NOT_FOUND);
|
||||||
|
@ -225,13 +205,10 @@ class TaskCommentControllerIntTest {
|
||||||
String url =
|
String url =
|
||||||
restHelper.toUrl(
|
restHelper.toUrl(
|
||||||
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000");
|
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersAdmin());
|
||||||
|
|
||||||
ResponseEntity<TaskCommentRepresentationModel> getTaskCommentResponse =
|
ResponseEntity<TaskCommentRepresentationModel> getTaskCommentResponse =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_COMMENT_TYPE);
|
||||||
url,
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersAdmin()),
|
|
||||||
ParameterizedTypeReference.forType(TaskCommentRepresentationModel.class));
|
|
||||||
TaskCommentRepresentationModel taskCommentToUpdate = getTaskCommentResponse.getBody();
|
TaskCommentRepresentationModel taskCommentToUpdate = getTaskCommentResponse.getBody();
|
||||||
assertThat(taskCommentToUpdate).isNotNull();
|
assertThat(taskCommentToUpdate).isNotNull();
|
||||||
assertThat(taskCommentToUpdate.getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(taskCommentToUpdate.getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
|
@ -239,14 +216,13 @@ class TaskCommentControllerIntTest {
|
||||||
assertThat(taskCommentToUpdate.getTextField()).isEqualTo("some text in textfield");
|
assertThat(taskCommentToUpdate.getTextField()).isEqualTo("some text in textfield");
|
||||||
|
|
||||||
taskCommentToUpdate.setModified(Instant.now());
|
taskCommentToUpdate.setModified(Instant.now());
|
||||||
|
HttpEntity<TaskCommentRepresentationModel> auth2 =
|
||||||
|
new HttpEntity<>(taskCommentToUpdate, restHelper.getHeadersUser_1_1());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.PUT, auth2, TASK_COMMENT_TYPE);
|
||||||
url,
|
};
|
||||||
HttpMethod.PUT,
|
|
||||||
new HttpEntity<>(taskCommentToUpdate, restHelper.getHeadersUser_1_1()),
|
|
||||||
ParameterizedTypeReference.forType(TaskCommentRepresentationModel.class));
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||||
.isEqualTo(HttpStatus.CONFLICT);
|
.isEqualTo(HttpStatus.CONFLICT);
|
||||||
|
@ -257,13 +233,10 @@ class TaskCommentControllerIntTest {
|
||||||
String url =
|
String url =
|
||||||
restHelper.toUrl(
|
restHelper.toUrl(
|
||||||
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000");
|
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersUser_1_1());
|
||||||
|
|
||||||
ResponseEntity<TaskCommentRepresentationModel> getTaskCommentResponse =
|
ResponseEntity<TaskCommentRepresentationModel> getTaskCommentResponse =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_COMMENT_TYPE);
|
||||||
url,
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersUser_1_1()),
|
|
||||||
ParameterizedTypeReference.forType(TaskCommentRepresentationModel.class));
|
|
||||||
TaskCommentRepresentationModel taskComment = getTaskCommentResponse.getBody();
|
TaskCommentRepresentationModel taskComment = getTaskCommentResponse.getBody();
|
||||||
assertThat(taskComment).isNotNull();
|
assertThat(taskComment).isNotNull();
|
||||||
assertThat(taskComment.getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(taskComment.getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
|
@ -271,14 +244,13 @@ class TaskCommentControllerIntTest {
|
||||||
assertThat(taskComment.getTextField()).isEqualTo("some text in textfield");
|
assertThat(taskComment.getTextField()).isEqualTo("some text in textfield");
|
||||||
|
|
||||||
taskComment.setTextField("updated textfield");
|
taskComment.setTextField("updated textfield");
|
||||||
|
HttpEntity<TaskCommentRepresentationModel> auth2 =
|
||||||
|
new HttpEntity<>(taskComment, restHelper.getHeadersUser_1_2());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.PUT, auth2, TASK_COMMENT_TYPE);
|
||||||
url,
|
};
|
||||||
HttpMethod.PUT,
|
|
||||||
new HttpEntity<>(taskComment, restHelper.getHeadersUser_1_2()),
|
|
||||||
ParameterizedTypeReference.forType(TaskCommentRepresentationModel.class));
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||||
.isEqualTo(HttpStatus.FORBIDDEN);
|
.isEqualTo(HttpStatus.FORBIDDEN);
|
||||||
|
@ -286,17 +258,13 @@ class TaskCommentControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_FailToUpdateTaskComment_When_TaskCommentIdInResourceDoesNotMatchPathVariable() {
|
void should_FailToUpdateTaskComment_When_TaskCommentIdInResourceDoesNotMatchPathVariable() {
|
||||||
|
|
||||||
String url =
|
String url =
|
||||||
restHelper.toUrl(
|
restHelper.toUrl(
|
||||||
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000");
|
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000000");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersAdmin());
|
||||||
|
|
||||||
ResponseEntity<TaskCommentRepresentationModel> getTaskCommentResponse =
|
ResponseEntity<TaskCommentRepresentationModel> getTaskCommentResponse =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_COMMENT_TYPE);
|
||||||
url,
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersAdmin()),
|
|
||||||
ParameterizedTypeReference.forType(TaskCommentRepresentationModel.class));
|
|
||||||
assertThat(getTaskCommentResponse.getBody()).isNotNull();
|
assertThat(getTaskCommentResponse.getBody()).isNotNull();
|
||||||
assertThat(getTaskCommentResponse.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(getTaskCommentResponse.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
assertThat(getTaskCommentResponse.getBody().getCreator()).isEqualTo("user-1-1");
|
assertThat(getTaskCommentResponse.getBody().getCreator()).isEqualTo("user-1-1");
|
||||||
|
@ -306,15 +274,13 @@ class TaskCommentControllerIntTest {
|
||||||
getTaskCommentResponse.getBody();
|
getTaskCommentResponse.getBody();
|
||||||
taskCommentRepresentationModelToUpdate.setTextField("updated text");
|
taskCommentRepresentationModelToUpdate.setTextField("updated text");
|
||||||
taskCommentRepresentationModelToUpdate.setTaskCommentId("DifferentTaskCommentId");
|
taskCommentRepresentationModelToUpdate.setTaskCommentId("DifferentTaskCommentId");
|
||||||
|
HttpEntity<TaskCommentRepresentationModel> auth2 =
|
||||||
|
new HttpEntity<>(taskCommentRepresentationModelToUpdate, restHelper.getHeadersUser_1_1());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.PUT, auth2, TASK_COMMENT_TYPE);
|
||||||
url,
|
};
|
||||||
HttpMethod.PUT,
|
|
||||||
new HttpEntity<>(
|
|
||||||
taskCommentRepresentationModelToUpdate, restHelper.getHeadersUser_1_1()),
|
|
||||||
ParameterizedTypeReference.forType(TaskCommentRepresentationModel.class));
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||||
.isEqualTo(HttpStatus.BAD_REQUEST);
|
.isEqualTo(HttpStatus.BAD_REQUEST);
|
||||||
|
@ -322,29 +288,23 @@ class TaskCommentControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_FailToDeleteTaskComment_When_UserHasNoAuthorization() {
|
void should_FailToDeleteTaskComment_When_UserHasNoAuthorization() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(
|
||||||
|
RestEndpoints.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000001");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersUser_1_2());
|
||||||
|
|
||||||
ResponseEntity<TaskCommentCollectionRepresentationModel>
|
ResponseEntity<TaskCommentCollectionRepresentationModel>
|
||||||
getTaskCommentsBeforeDeleteionResponse =
|
getTaskCommentsBeforeDeleteionResponse =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, TASK_COMMENT_PAGE_MODEL_TYPE);
|
||||||
restHelper.toUrl(
|
|
||||||
RestEndpoints.URL_TASK_COMMENTS, "TKI:000000000000000000000000000000000001"),
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersUser_1_2()),
|
|
||||||
TASK_COMMENT_PAGE_MODEL_TYPE);
|
|
||||||
assertThat(getTaskCommentsBeforeDeleteionResponse.getBody()).isNotNull();
|
assertThat(getTaskCommentsBeforeDeleteionResponse.getBody()).isNotNull();
|
||||||
assertThat(getTaskCommentsBeforeDeleteionResponse.getBody().getContent()).hasSize(2);
|
assertThat(getTaskCommentsBeforeDeleteionResponse.getBody().getContent()).hasSize(2);
|
||||||
|
|
||||||
String url =
|
String url2 =
|
||||||
restHelper.toUrl(
|
restHelper.toUrl(
|
||||||
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000004");
|
RestEndpoints.URL_TASK_COMMENT, "TCI:000000000000000000000000000000000004");
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> TEMPLATE.exchange(url2, HttpMethod.DELETE, auth, TASK_COMMENT_TYPE);
|
||||||
TEMPLATE.exchange(
|
|
||||||
url,
|
|
||||||
HttpMethod.DELETE,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersUser_1_2()),
|
|
||||||
ParameterizedTypeReference.forType(TaskCommentRepresentationModel.class));
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.isInstanceOf(HttpClientErrorException.class)
|
.isInstanceOf(HttpClientErrorException.class)
|
||||||
.hasMessageContaining("TaskComment creator and current user must match.")
|
.hasMessageContaining("TaskComment creator and current user must match.")
|
||||||
|
@ -356,14 +316,13 @@ class TaskCommentControllerIntTest {
|
||||||
void should_FailToDeleteTaskComment_When_TaskCommentIsNotExisting() {
|
void should_FailToDeleteTaskComment_When_TaskCommentIsNotExisting() {
|
||||||
|
|
||||||
String url = restHelper.toUrl(RestEndpoints.URL_TASK_COMMENT, "NotExistingTaskComment");
|
String url = restHelper.toUrl(RestEndpoints.URL_TASK_COMMENT, "NotExistingTaskComment");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersAdmin());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.DELETE, auth, TASK_COMMENT_TYPE);
|
||||||
url,
|
};
|
||||||
HttpMethod.DELETE,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersAdmin()),
|
|
||||||
ParameterizedTypeReference.forType(TaskCommentRepresentationModel.class));
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||||
.isEqualTo(HttpStatus.NOT_FOUND);
|
.isEqualTo(HttpStatus.NOT_FOUND);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -45,12 +45,12 @@ class WorkbasketAccessItemControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetAllWorkbasketAccessItems() {
|
void testGetAllWorkbasketAccessItems() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS);
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<WorkbasketAccessItemPagedRepresentationModel> response =
|
ResponseEntity<WorkbasketAccessItemPagedRepresentationModel> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS),
|
url, HttpMethod.GET, auth, WORKBASKET_ACCESS_ITEM_PAGED_REPRESENTATION_MODEL_TYPE);
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
WORKBASKET_ACCESS_ITEM_PAGED_REPRESENTATION_MODEL_TYPE);
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
}
|
}
|
||||||
|
@ -59,12 +59,12 @@ class WorkbasketAccessItemControllerIntTest {
|
||||||
void testGetWorkbasketAccessItemsKeepingFilters() {
|
void testGetWorkbasketAccessItemsKeepingFilters() {
|
||||||
String parameters =
|
String parameters =
|
||||||
"?sort-by=WORKBASKET_KEY&order=ASCENDING&page-size=9&access-id=user-1-1&page=1";
|
"?sort-by=WORKBASKET_KEY&order=ASCENDING&page-size=9&access-id=user-1-1&page=1";
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS) + parameters;
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<WorkbasketAccessItemPagedRepresentationModel> response =
|
ResponseEntity<WorkbasketAccessItemPagedRepresentationModel> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS) + parameters,
|
url, HttpMethod.GET, auth, WORKBASKET_ACCESS_ITEM_PAGED_REPRESENTATION_MODEL_TYPE);
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
WORKBASKET_ACCESS_ITEM_PAGED_REPRESENTATION_MODEL_TYPE);
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
assertThat(
|
assertThat(
|
||||||
|
@ -80,12 +80,12 @@ class WorkbasketAccessItemControllerIntTest {
|
||||||
void testGetSecondPageSortedByWorkbasketKey() {
|
void testGetSecondPageSortedByWorkbasketKey() {
|
||||||
String parameters =
|
String parameters =
|
||||||
"?sort-by=WORKBASKET_KEY&order=ASCENDING&page=2&page-size=9&access-id=user-1-1";
|
"?sort-by=WORKBASKET_KEY&order=ASCENDING&page=2&page-size=9&access-id=user-1-1";
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS) + parameters;
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<WorkbasketAccessItemPagedRepresentationModel> response =
|
ResponseEntity<WorkbasketAccessItemPagedRepresentationModel> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS) + parameters,
|
url, HttpMethod.GET, auth, WORKBASKET_ACCESS_ITEM_PAGED_REPRESENTATION_MODEL_TYPE);
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
WORKBASKET_ACCESS_ITEM_PAGED_REPRESENTATION_MODEL_TYPE);
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getContent()).hasSize(1);
|
assertThat(response.getBody().getContent()).hasSize(1);
|
||||||
assertThat(response.getBody().getContent().iterator().next().getAccessId())
|
assertThat(response.getBody().getContent().iterator().next().getAccessId())
|
||||||
|
@ -108,33 +108,32 @@ class WorkbasketAccessItemControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_DeleteAllAccessItemForUser_ifValidAccessIdOfUserIsSupplied() {
|
void should_DeleteAllAccessItemForUser_ifValidAccessIdOfUserIsSupplied() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS) + "?access-id=teamlead-2";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
String parameters = "?access-id=teamlead-2";
|
|
||||||
ResponseEntity<Void> response =
|
ResponseEntity<Void> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS) + parameters,
|
url, HttpMethod.DELETE, auth, ParameterizedTypeReference.forType(Void.class));
|
||||||
HttpMethod.DELETE,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ParameterizedTypeReference.forType(Void.class));
|
|
||||||
assertThat(response.getBody()).isNull();
|
assertThat(response.getBody()).isNull();
|
||||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
|
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ThrowException_When_ProvidingInvalidFilterParams() {
|
void should_ThrowException_When_ProvidingInvalidFilterParams() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS)
|
||||||
|
+ "?access-id=teamlead-2"
|
||||||
|
+ "&illegalParam=illegal"
|
||||||
|
+ "&anotherIllegalParam=stillIllegal"
|
||||||
|
+ "&sort-by=WORKBASKET_KEY&order=DESCENDING&page-size=5&page=2";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS)
|
url, HttpMethod.GET, auth, WORKBASKET_ACCESS_ITEM_PAGED_REPRESENTATION_MODEL_TYPE);
|
||||||
+ "?access-id=teamlead-2"
|
};
|
||||||
+ "&illegalParam=illegal"
|
|
||||||
+ "&anotherIllegalParam=stillIllegal"
|
|
||||||
+ "&sort-by=WORKBASKET_KEY&order=DESCENDING&page-size=5&page=2",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
WORKBASKET_ACCESS_ITEM_PAGED_REPRESENTATION_MODEL_TYPE);
|
|
||||||
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.isInstanceOf(HttpClientErrorException.class)
|
.isInstanceOf(HttpClientErrorException.class)
|
||||||
.hasMessageContaining(
|
.hasMessageContaining(
|
||||||
|
@ -153,19 +152,23 @@ class WorkbasketAccessItemControllerIntTest {
|
||||||
|
|
||||||
ThrowingConsumer<String> test =
|
ThrowingConsumer<String> test =
|
||||||
accessId -> {
|
accessId -> {
|
||||||
String parameters = "?access-id=" + accessId;
|
String url =
|
||||||
|
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS)
|
||||||
|
+ "?access-id="
|
||||||
|
+ accessId;
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ACCESS_ITEMS) + parameters,
|
url, HttpMethod.DELETE, auth, ParameterizedTypeReference.forType(Void.class));
|
||||||
HttpMethod.DELETE,
|
};
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
ParameterizedTypeReference.forType(Void.class));
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.isInstanceOf(HttpClientErrorException.class)
|
.isInstanceOf(HttpClientErrorException.class)
|
||||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||||
.isEqualTo(HttpStatus.BAD_REQUEST);
|
.isEqualTo(HttpStatus.BAD_REQUEST);
|
||||||
};
|
};
|
||||||
|
|
||||||
return DynamicTest.stream(accessIds.iterator(), s -> String.format("for user '%s'", s), test);
|
return DynamicTest.stream(accessIds.iterator(), s -> String.format("for user '%s'", s), test);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,12 +61,11 @@ class WorkbasketControllerIntTest {
|
||||||
final String url =
|
final String url =
|
||||||
restHelper.toUrl(
|
restHelper.toUrl(
|
||||||
RestEndpoints.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000006");
|
RestEndpoints.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000006");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<WorkbasketRepresentationModel> response =
|
ResponseEntity<WorkbasketRepresentationModel> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, WORKBASKET_REPRESENTATION_MODEL_TYPE);
|
||||||
url,
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
WORKBASKET_REPRESENTATION_MODEL_TYPE);
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF))
|
assertThat(response.getBody().getLink(IanaLinkRelations.SELF))
|
||||||
|
@ -76,24 +75,24 @@ class WorkbasketControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetAllWorkbaskets() {
|
void testGetAllWorkbaskets() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_WORKBASKET);
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<WorkbasketSummaryPagedRepresentationModel> response =
|
ResponseEntity<WorkbasketSummaryPagedRepresentationModel> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET),
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetAllWorkbasketsBusinessAdminHasOpenPermission() {
|
void testGetAllWorkbasketsBusinessAdminHasOpenPermission() {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_WORKBASKET) + "?required-permission=OPEN";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<WorkbasketSummaryPagedRepresentationModel> response =
|
ResponseEntity<WorkbasketSummaryPagedRepresentationModel> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET) + "?required-permission=OPEN",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getRequiredLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(response.getBody().getRequiredLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
assertThat(response.getBody().getContent()).hasSize(6);
|
assertThat(response.getBody().getContent()).hasSize(6);
|
||||||
|
@ -102,12 +101,12 @@ class WorkbasketControllerIntTest {
|
||||||
@Test
|
@Test
|
||||||
void testGetAllWorkbasketsKeepingFilters() {
|
void testGetAllWorkbasketsKeepingFilters() {
|
||||||
String parameters = "?type=PERSONAL&sort-by=KEY&order=DESCENDING";
|
String parameters = "?type=PERSONAL&sort-by=KEY&order=DESCENDING";
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_WORKBASKET) + parameters;
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<WorkbasketSummaryPagedRepresentationModel> response =
|
ResponseEntity<WorkbasketSummaryPagedRepresentationModel> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET) + parameters,
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
assertThat(
|
assertThat(
|
||||||
|
@ -121,34 +120,30 @@ class WorkbasketControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testUpdateWorkbasketWithConcurrentModificationShouldThrowException() {
|
void testUpdateWorkbasketWithConcurrentModificationShouldThrowException() {
|
||||||
|
String url =
|
||||||
String workbasketId = "WBI:100000000000000000000000000000000001";
|
restHelper.toUrl(
|
||||||
|
RestEndpoints.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000001");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<WorkbasketRepresentationModel> initialWorkbasketResourceRequestResponse =
|
ResponseEntity<WorkbasketRepresentationModel> initialWorkbasketResourceRequestResponse =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, WORKBASKET_REPRESENTATION_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ID, workbasketId),
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
WORKBASKET_REPRESENTATION_MODEL_TYPE);
|
|
||||||
|
|
||||||
WorkbasketRepresentationModel workbasketRepresentationModel =
|
WorkbasketRepresentationModel workbasketRepresentationModel =
|
||||||
initialWorkbasketResourceRequestResponse.getBody();
|
initialWorkbasketResourceRequestResponse.getBody();
|
||||||
|
|
||||||
assertThat(workbasketRepresentationModel).isNotNull();
|
assertThat(workbasketRepresentationModel).isNotNull();
|
||||||
|
|
||||||
workbasketRepresentationModel.setKey("GPK_KSC");
|
workbasketRepresentationModel.setKey("GPK_KSC");
|
||||||
workbasketRepresentationModel.setDomain("DOMAIN_A");
|
workbasketRepresentationModel.setDomain("DOMAIN_A");
|
||||||
workbasketRepresentationModel.setType(WorkbasketType.PERSONAL);
|
workbasketRepresentationModel.setType(WorkbasketType.PERSONAL);
|
||||||
workbasketRepresentationModel.setName("was auch immer");
|
workbasketRepresentationModel.setName("was auch immer");
|
||||||
workbasketRepresentationModel.setOwner("Joerg");
|
workbasketRepresentationModel.setOwner("Joerg");
|
||||||
workbasketRepresentationModel.setModified(Instant.now());
|
workbasketRepresentationModel.setModified(Instant.now());
|
||||||
|
HttpEntity<WorkbasketRepresentationModel> auth2 =
|
||||||
|
new HttpEntity<>(workbasketRepresentationModel, restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.PUT, auth2, WORKBASKET_REPRESENTATION_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ID, workbasketId),
|
};
|
||||||
HttpMethod.PUT,
|
|
||||||
new HttpEntity<>(workbasketRepresentationModel, restHelper.getHeadersTeamlead_1()),
|
|
||||||
WORKBASKET_REPRESENTATION_MODEL_TYPE);
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||||
.isEqualTo(HttpStatus.CONFLICT);
|
.isEqualTo(HttpStatus.CONFLICT);
|
||||||
|
@ -156,16 +151,16 @@ class WorkbasketControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testUpdateWorkbasketOfNonExistingWorkbasketShouldThrowException() {
|
void testUpdateWorkbasketOfNonExistingWorkbasketShouldThrowException() {
|
||||||
|
String url =
|
||||||
String workbasketId = "WBI:100004857400039500000999999999999999";
|
restHelper.toUrl(
|
||||||
|
RestEndpoints.URL_WORKBASKET_ID, "WBI:100004857400039500000999999999999999");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersBusinessAdmin());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, WORKBASKET_REPRESENTATION_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ID, workbasketId),
|
};
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersBusinessAdmin()),
|
|
||||||
WORKBASKET_REPRESENTATION_MODEL_TYPE);
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.isInstanceOf(HttpClientErrorException.class)
|
.isInstanceOf(HttpClientErrorException.class)
|
||||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||||
|
@ -174,14 +169,13 @@ class WorkbasketControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetSecondPageSortedByKey() {
|
void testGetSecondPageSortedByKey() {
|
||||||
|
|
||||||
String parameters = "?sort-by=KEY&order=DESCENDING&page-size=5&page=2";
|
String parameters = "?sort-by=KEY&order=DESCENDING&page-size=5&page=2";
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_WORKBASKET) + parameters;
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<WorkbasketSummaryPagedRepresentationModel> response =
|
ResponseEntity<WorkbasketSummaryPagedRepresentationModel> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET) + parameters,
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getContent()).hasSize(5);
|
assertThat(response.getBody().getContent()).hasSize(5);
|
||||||
assertThat(response.getBody().getContent().iterator().next().getKey()).isEqualTo("USER-1-1");
|
assertThat(response.getBody().getContent().iterator().next().getKey()).isEqualTo("USER-1-1");
|
||||||
|
@ -201,29 +195,28 @@ class WorkbasketControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testMarkWorkbasketForDeletionAsBusinessAdminWithoutExplicitReadPermission() {
|
void testMarkWorkbasketForDeletionAsBusinessAdminWithoutExplicitReadPermission() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(
|
||||||
|
RestEndpoints.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000005");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersBusinessAdmin());
|
||||||
|
|
||||||
String workbasketID = "WBI:100000000000000000000000000000000005";
|
ResponseEntity<?> response = TEMPLATE.exchange(url, HttpMethod.DELETE, auth, Void.class);
|
||||||
|
|
||||||
ResponseEntity<?> response =
|
|
||||||
TEMPLATE.exchange(
|
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ID, workbasketID),
|
|
||||||
HttpMethod.DELETE,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersBusinessAdmin()),
|
|
||||||
Void.class);
|
|
||||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.ACCEPTED);
|
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.ACCEPTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void statusCode423ShouldBeReturnedIfWorkbasketContainsNonCompletedTasks() {
|
void statusCode423ShouldBeReturnedIfWorkbasketContainsNonCompletedTasks() {
|
||||||
String workbasketWithNonCompletedTasks = "WBI:100000000000000000000000000000000004";
|
String url =
|
||||||
|
restHelper.toUrl(
|
||||||
|
RestEndpoints.URL_WORKBASKET_ID, "WBI:100000000000000000000000000000000004");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersBusinessAdmin());
|
||||||
|
|
||||||
ThrowingCallable call =
|
ThrowingCallable call =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.DELETE, auth, Void.class);
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_ID, workbasketWithNonCompletedTasks),
|
};
|
||||||
HttpMethod.DELETE,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersBusinessAdmin()),
|
|
||||||
Void.class);
|
|
||||||
assertThatThrownBy(call)
|
assertThatThrownBy(call)
|
||||||
.isInstanceOf(HttpClientErrorException.class)
|
.isInstanceOf(HttpClientErrorException.class)
|
||||||
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
.extracting(ex -> ((HttpClientErrorException) ex).getStatusCode())
|
||||||
|
@ -232,24 +225,23 @@ class WorkbasketControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testRemoveWorkbasketAsDistributionTarget() {
|
void testRemoveWorkbasketAsDistributionTarget() {
|
||||||
ResponseEntity<?> response =
|
String url =
|
||||||
TEMPLATE.exchange(
|
restHelper.toUrl(
|
||||||
restHelper.toUrl(
|
RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION,
|
||||||
RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION,
|
"WBI:100000000000000000000000000000000007");
|
||||||
"WBI:100000000000000000000000000000000007"),
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
HttpMethod.DELETE,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
ResponseEntity<?> response = TEMPLATE.exchange(url, HttpMethod.DELETE, auth, Void.class);
|
||||||
Void.class);
|
|
||||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
|
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
|
||||||
|
|
||||||
|
String url2 =
|
||||||
|
restHelper.toUrl(
|
||||||
|
RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION,
|
||||||
|
"WBI:100000000000000000000000000000000002");
|
||||||
ResponseEntity<DistributionTargetsCollectionRepresentationModel> response2 =
|
ResponseEntity<DistributionTargetsCollectionRepresentationModel> response2 =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(
|
url2, HttpMethod.GET, auth, DISTRIBUTION_TARGETS_COLLECTION_REPRESENTATION_MODEL_TYPE);
|
||||||
RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION,
|
|
||||||
"WBI:100000000000000000000000000000000002"),
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
DISTRIBUTION_TARGETS_COLLECTION_REPRESENTATION_MODEL_TYPE);
|
|
||||||
assertThat(response2.getStatusCode()).isEqualTo(HttpStatus.OK);
|
assertThat(response2.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||||
assertThat(response2.getBody()).isNotNull();
|
assertThat(response2.getBody()).isNotNull();
|
||||||
assertThat(response2.getBody().getContent())
|
assertThat(response2.getBody().getContent())
|
||||||
|
@ -259,14 +251,16 @@ class WorkbasketControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetWorkbasketAccessItems() {
|
void testGetWorkbasketAccessItems() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(
|
||||||
|
RestEndpoints.URL_WORKBASKET_ID_ACCESS_ITEMS,
|
||||||
|
"WBI:100000000000000000000000000000000005");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<WorkbasketAccessItemCollectionRepresentationModel> response =
|
ResponseEntity<WorkbasketAccessItemCollectionRepresentationModel> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(
|
url, HttpMethod.GET, auth, WORKBASKET_ACCESS_ITEM_COLLECTION_REPRESENTATION_TYPE);
|
||||||
RestEndpoints.URL_WORKBASKET_ID_ACCESS_ITEMS,
|
|
||||||
"WBI:100000000000000000000000000000000005"),
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
WORKBASKET_ACCESS_ITEM_COLLECTION_REPRESENTATION_TYPE);
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
assertThat(response.getHeaders().getContentType()).isEqualTo(MediaTypes.HAL_JSON);
|
assertThat(response.getHeaders().getContentType()).isEqualTo(MediaTypes.HAL_JSON);
|
||||||
|
@ -275,14 +269,16 @@ class WorkbasketControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetWorkbasketDistributionTargets() {
|
void testGetWorkbasketDistributionTargets() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(
|
||||||
|
RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION,
|
||||||
|
"WBI:100000000000000000000000000000000001");
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ResponseEntity<DistributionTargetsCollectionRepresentationModel> response =
|
ResponseEntity<DistributionTargetsCollectionRepresentationModel> response =
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(
|
||||||
restHelper.toUrl(
|
url, HttpMethod.GET, auth, DISTRIBUTION_TARGETS_COLLECTION_REPRESENTATION_MODEL_TYPE);
|
||||||
RestEndpoints.URL_WORKBASKET_ID_DISTRIBUTION,
|
|
||||||
"WBI:100000000000000000000000000000000001"),
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
DISTRIBUTION_TARGETS_COLLECTION_REPRESENTATION_MODEL_TYPE);
|
|
||||||
assertThat(response.getBody()).isNotNull();
|
assertThat(response.getBody()).isNotNull();
|
||||||
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
assertThat(response.getBody().getLink(IanaLinkRelations.SELF)).isNotNull();
|
||||||
assertThat(response.getHeaders().getContentType()).isEqualTo(MediaTypes.HAL_JSON);
|
assertThat(response.getHeaders().getContentType()).isEqualTo(MediaTypes.HAL_JSON);
|
||||||
|
@ -291,18 +287,18 @@ class WorkbasketControllerIntTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void should_ThrowException_When_ProvidingInvalidFilterParams() {
|
void should_ThrowException_When_ProvidingInvalidFilterParams() {
|
||||||
|
String url =
|
||||||
|
restHelper.toUrl(RestEndpoints.URL_WORKBASKET)
|
||||||
|
+ "?type=PERSONAL"
|
||||||
|
+ "&illegalParam=illegal"
|
||||||
|
+ "&anotherIllegalParam=stillIllegal"
|
||||||
|
+ "&sort-by=KEY&order=DESCENDING&page-size=5&page=2";
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
ThrowingCallable httpCall =
|
ThrowingCallable httpCall =
|
||||||
() ->
|
() -> {
|
||||||
TEMPLATE.exchange(
|
TEMPLATE.exchange(url, HttpMethod.GET, auth, WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET)
|
};
|
||||||
+ "?type=PERSONAL"
|
|
||||||
+ "&illegalParam=illegal"
|
|
||||||
+ "&anotherIllegalParam=stillIllegal"
|
|
||||||
+ "&sort-by=KEY&order=DESCENDING&page-size=5&page=2",
|
|
||||||
HttpMethod.GET,
|
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
|
||||||
WORKBASKET_SUMMARY_PAGE_MODEL_TYPE);
|
|
||||||
|
|
||||||
assertThatThrownBy(httpCall)
|
assertThatThrownBy(httpCall)
|
||||||
.isInstanceOf(HttpClientErrorException.class)
|
.isInstanceOf(HttpClientErrorException.class)
|
||||||
|
|
|
@ -271,10 +271,13 @@ class WorkbasketDefinitionControllerIntTest {
|
||||||
|
|
||||||
private ResponseEntity<WorkbasketDefinitionCollectionRepresentationModel>
|
private ResponseEntity<WorkbasketDefinitionCollectionRepresentationModel>
|
||||||
executeExportRequestForDomain(String domain) {
|
executeExportRequestForDomain(String domain) {
|
||||||
|
String url = restHelper.toUrl(RestEndpoints.URL_WORKBASKET_DEFINITIONS) + "?domain=" + domain;
|
||||||
|
HttpEntity<Object> auth = new HttpEntity<>(restHelper.getHeadersTeamlead_1());
|
||||||
|
|
||||||
return TEMPLATE.exchange(
|
return TEMPLATE.exchange(
|
||||||
restHelper.toUrl(RestEndpoints.URL_WORKBASKET_DEFINITIONS) + "?domain=" + domain,
|
url,
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
new HttpEntity<>(restHelper.getHeadersTeamlead_1()),
|
auth,
|
||||||
ParameterizedTypeReference.forType(
|
ParameterizedTypeReference.forType(
|
||||||
WorkbasketDefinitionCollectionRepresentationModel.class));
|
WorkbasketDefinitionCollectionRepresentationModel.class));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue