Fix new line after @Test (#2486)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -26,7 +26,8 @@ class PagedListTest {
|
||||
/**
|
||||
* Ensures that a null payload entity throws an exception.
|
||||
*/
|
||||
@Test void createListWithNullContentThrowsException() {
|
||||
@Test
|
||||
void createListWithNullContentThrowsException() {
|
||||
assertThatThrownBy(() -> new PagedList<>(null, 0))
|
||||
.isInstanceOf(NullPointerException.class);
|
||||
}
|
||||
@@ -34,7 +35,8 @@ class PagedListTest {
|
||||
/**
|
||||
* Create list with payload and verify content.
|
||||
*/
|
||||
@Test void createListWithContent() {
|
||||
@Test
|
||||
void createListWithContent() {
|
||||
final long knownTotal = 2;
|
||||
final List<String> knownContentList = new ArrayList<>();
|
||||
knownContentList.add("content1");
|
||||
@@ -46,7 +48,8 @@ class PagedListTest {
|
||||
/**
|
||||
* Create list with payload and verify size values.
|
||||
*/
|
||||
@Test void createListWithSmallerTotalThanContentSizeIsOk() {
|
||||
@Test
|
||||
void createListWithSmallerTotalThanContentSizeIsOk() {
|
||||
final long knownTotal = 0;
|
||||
final List<String> knownContentList = new ArrayList<>();
|
||||
knownContentList.add("content1");
|
||||
|
||||
@@ -33,7 +33,8 @@ class MgmtTargetAssignmentResponseBodyTest {
|
||||
/**
|
||||
* Tests that the ActionIds are serialized correctly in MgmtTargetAssignmentResponseBody
|
||||
*/
|
||||
@Test void testActionIdsSerialization() throws IOException {
|
||||
@Test
|
||||
void testActionIdsSerialization() throws IOException {
|
||||
final MgmtTargetAssignmentResponseBody responseBody = generateResponseBody();
|
||||
final ObjectMapper objectMapper = new ObjectMapper();
|
||||
final String responseBodyAsString = objectMapper.writeValueAsString(responseBody);
|
||||
|
||||
@@ -64,21 +64,24 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Handles the GET request of retrieving a specific action.
|
||||
*/
|
||||
@Test public void getAction() throws Exception {
|
||||
@Test
|
||||
void getAction() throws Exception {
|
||||
getAction(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving a specific action with external reference.
|
||||
*/
|
||||
@Test public void getActionExtRef() throws Exception {
|
||||
@Test
|
||||
void getActionExtRef() throws Exception {
|
||||
getAction(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that actions can be filtered based on action status.
|
||||
*/
|
||||
@Test void filterActionsByStatus() throws Exception {
|
||||
@Test
|
||||
void filterActionsByStatus() throws Exception {
|
||||
|
||||
// prepare test
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
@@ -116,7 +119,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that actions can be filtered based on the detailed action status.
|
||||
*/
|
||||
@Test void filterActionsByDetailStatus() throws Exception {
|
||||
@Test
|
||||
void filterActionsByDetailStatus() throws Exception {
|
||||
// prepare test
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
assignDistributionSet(dsA, Collections.singletonList(testdataFactory.createTarget("knownTargetId")));
|
||||
@@ -154,7 +158,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that actions can be filtered based on extRef.
|
||||
*/
|
||||
@Test void filterActionsByExternalRef() throws Exception {
|
||||
@Test
|
||||
void filterActionsByExternalRef() throws Exception {
|
||||
// prepare test
|
||||
final String knownTargetId = "targetId";
|
||||
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
|
||||
@@ -198,7 +203,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that actions can be filtered based on the action status code that was reported last.
|
||||
*/
|
||||
@Test void filterActionsByLastStatusCode() throws Exception {
|
||||
@Test
|
||||
void filterActionsByLastStatusCode() throws Exception {
|
||||
// assign a distribution set to three targets
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
final DistributionSetAssignmentResult assignmentResult = assignDistributionSet(dsA,
|
||||
@@ -234,7 +240,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that actions can be filtered based on distribution set fields.
|
||||
*/
|
||||
@Test void filterActionsByDistributionSet() throws Exception {
|
||||
@Test
|
||||
void filterActionsByDistributionSet() throws Exception {
|
||||
// prepare test
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
assignDistributionSet(ds, Collections.singletonList(testdataFactory.createTarget("knownTargetId")));
|
||||
@@ -280,7 +287,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that actions can be filtered based on rollout fields.
|
||||
*/
|
||||
@Test void filterActionsByRollout() throws Exception {
|
||||
@Test
|
||||
void filterActionsByRollout() throws Exception {
|
||||
// prepare test
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet();
|
||||
final Target target0 = testdataFactory.createTarget("t0");
|
||||
@@ -322,7 +330,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that actions can be filtered based on target fields.
|
||||
*/
|
||||
@Test void filterActionsByTargetProperties() throws Exception {
|
||||
@Test
|
||||
void filterActionsByTargetProperties() throws Exception {
|
||||
// prepare test
|
||||
final Target target = testdataFactory.createTarget("knownTargetId", "knownTargetName", "http://0.0.0.0");
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("");
|
||||
@@ -337,21 +346,24 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that all available actions are returned if the complete collection is requested.
|
||||
*/
|
||||
@Test void getActions() throws Exception {
|
||||
@Test
|
||||
void getActions() throws Exception {
|
||||
getActions(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that all available actions (whit ext refs) are returned if the complete collection is requested.
|
||||
*/
|
||||
@Test void getActionsExtRef() throws Exception {
|
||||
@Test
|
||||
void getActionsExtRef() throws Exception {
|
||||
getActions(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that a full representation of all actions is returned if the collection is requested for representation mode 'full'.
|
||||
*/
|
||||
@Test void getActionsFullRepresentation() throws Exception {
|
||||
@Test
|
||||
void getActionsFullRepresentation() throws Exception {
|
||||
final String knownTargetId = "targetId";
|
||||
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
|
||||
|
||||
@@ -394,7 +406,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that the get request for actions returns an empty collection if no assignments have been done yet.
|
||||
*/
|
||||
@Test void getActionsWithEmptyResult() throws Exception {
|
||||
@Test
|
||||
void getActionsWithEmptyResult() throws Exception {
|
||||
mvc.perform(get(MgmtRestConstants.ACTION_V1_REQUEST_MAPPING))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -406,7 +419,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies paging is respected as expected.
|
||||
*/
|
||||
@Test void getMultipleActionsWithPagingLimitRequestParameter() throws Exception {
|
||||
@Test
|
||||
void getMultipleActionsWithPagingLimitRequestParameter() throws Exception {
|
||||
final String knownTargetId = "targetId";
|
||||
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
|
||||
|
||||
@@ -458,7 +472,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that the actions resource is read-only.
|
||||
*/
|
||||
@Test void invalidRequestsOnActionResource() throws Exception {
|
||||
@Test
|
||||
void invalidRequestsOnActionResource() throws Exception {
|
||||
final String knownTargetId = "targetId";
|
||||
|
||||
generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
|
||||
@@ -478,7 +493,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that the correct action is returned
|
||||
*/
|
||||
@Test void shouldRetrieveCorrectActionById() throws Exception {
|
||||
@Test
|
||||
void shouldRetrieveCorrectActionById() throws Exception {
|
||||
final String knownTargetId = "targetId";
|
||||
|
||||
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
|
||||
@@ -493,7 +509,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that NOT_FOUND is returned when there is no such action.
|
||||
*/
|
||||
@Test void requestActionThatDoesNotExistsLeadsToNotFound() throws Exception {
|
||||
@Test
|
||||
void requestActionThatDoesNotExistsLeadsToNotFound() throws Exception {
|
||||
mvc.perform(get(MgmtRestConstants.ACTION_V1_REQUEST_MAPPING + "/" + 101))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNotFound());
|
||||
|
||||
@@ -87,7 +87,8 @@ class MgmtBasicAuthResourceTest {
|
||||
/**
|
||||
* Test of userinfo api with basic auth validation
|
||||
*/
|
||||
@Test @WithUser(principal = TEST_USER, authorities = {"READ", "WRITE", "DELETE"})
|
||||
@Test
|
||||
@WithUser(principal = TEST_USER, authorities = {"READ", "WRITE", "DELETE"})
|
||||
void validateBasicAuthWithUserDetails() throws Exception {
|
||||
withSecurityMock().perform(get(MgmtRestConstants.AUTH_V1_REQUEST_MAPPING))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -103,7 +104,8 @@ class MgmtBasicAuthResourceTest {
|
||||
/**
|
||||
* Test of userinfo api with invalid basic auth fails
|
||||
*/
|
||||
@Test void validateBasicAuthFailsWithInvalidCredentials() throws Exception {
|
||||
@Test
|
||||
void validateBasicAuthFailsWithInvalidCredentials() throws Exception {
|
||||
defaultMock.perform(get(MgmtRestConstants.AUTH_V1_REQUEST_MAPPING)
|
||||
.header(HttpHeaders.AUTHORIZATION, getBasicAuth("wrongUser", "wrongSecret")))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
|
||||
@@ -56,7 +56,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* The response of a POST request shall contain charset=utf-8
|
||||
*/
|
||||
@Test public void postDistributionSet_ContentTypeJsonUtf8_woAccept() throws Exception {
|
||||
@Test
|
||||
void postDistributionSet_ContentTypeJsonUtf8_woAccept() throws Exception {
|
||||
final MvcResult result = mvc.perform(
|
||||
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
|
||||
Collections.singletonList(ds)))
|
||||
@@ -72,7 +73,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* The response of a POST request shall contain charset=utf-8
|
||||
*/
|
||||
@Test public void postDistributionSet_ContentTypeJsonUtf8_wAcceptJson() throws Exception {
|
||||
@Test
|
||||
void postDistributionSet_ContentTypeJsonUtf8_wAcceptJson() throws Exception {
|
||||
final MvcResult result = mvc.perform(
|
||||
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
|
||||
Collections.singletonList(ds)))
|
||||
@@ -88,7 +90,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* The response of a POST request shall contain charset=utf-8
|
||||
*/
|
||||
@Test public void postDistributionSet_ContentTypeJsonUtf8_wAcceptJsonUtf8() throws Exception {
|
||||
@Test
|
||||
void postDistributionSet_ContentTypeJsonUtf8_wAcceptJsonUtf8() throws Exception {
|
||||
final MvcResult result = mvc.perform(
|
||||
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
|
||||
Collections.singletonList(ds)))
|
||||
@@ -104,7 +107,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* The response of a POST request shall contain charset=utf-8
|
||||
*/
|
||||
@Test public void postDistributionSet_ContentTypeJsonUtf8_wAcceptHalJson() throws Exception {
|
||||
@Test
|
||||
void postDistributionSet_ContentTypeJsonUtf8_wAcceptHalJson() throws Exception {
|
||||
final MvcResult result = mvc.perform(
|
||||
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
|
||||
Collections.singletonList(ds)))
|
||||
@@ -120,7 +124,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* The response of a POST request shall contain charset=utf-8
|
||||
*/
|
||||
@Test public void postDistributionSet_ContentTypeJson_woAccept() throws Exception {
|
||||
@Test
|
||||
void postDistributionSet_ContentTypeJson_woAccept() throws Exception {
|
||||
final MvcResult result = mvc.perform(
|
||||
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
|
||||
Collections.singletonList(ds)))
|
||||
@@ -136,7 +141,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* The response of a POST request shall contain charset=utf-8
|
||||
*/
|
||||
@Test public void postDistributionSet_ContentTypeJson_wAcceptJson() throws Exception {
|
||||
@Test
|
||||
void postDistributionSet_ContentTypeJson_wAcceptJson() throws Exception {
|
||||
final MvcResult result = mvc.perform(
|
||||
post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).content(JsonBuilder.distributionSets(
|
||||
Collections.singletonList(ds)))
|
||||
@@ -152,7 +158,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* The response of a POST request shall contain charset=utf-8
|
||||
*/
|
||||
@Test public void postDistributionSet_ContentTypeJson_wAcceptJsonUtf8() throws Exception {
|
||||
@Test
|
||||
void postDistributionSet_ContentTypeJson_wAcceptJsonUtf8() throws Exception {
|
||||
final MvcResult result = mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING)
|
||||
.content(JsonBuilder.distributionSets(Collections.singletonList(ds))).contentType(MediaType.APPLICATION_JSON)
|
||||
.accept(MediaType.APPLICATION_JSON_UTF8))
|
||||
@@ -167,7 +174,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* The response of a POST request shall contain charset=utf-8
|
||||
*/
|
||||
@Test public void postDistributionSet_ContentTypeJson_wAcceptHalJson() throws Exception {
|
||||
@Test
|
||||
void postDistributionSet_ContentTypeJson_wAcceptHalJson() throws Exception {
|
||||
final MvcResult result = mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING)
|
||||
.content(JsonBuilder.distributionSets(Collections.singletonList(ds))).contentType(MediaType.APPLICATION_JSON)
|
||||
.accept(MediaTypes.HAL_JSON))
|
||||
@@ -182,7 +190,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* The response of a GET request shall contain charset=utf-8
|
||||
*/
|
||||
@Test public void getDistributionSet_woAccept() throws Exception {
|
||||
@Test
|
||||
void getDistributionSet_woAccept() throws Exception {
|
||||
final MvcResult result = mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -194,7 +203,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* The response of a GET request shall contain charset=utf-8
|
||||
*/
|
||||
@Test public void getDistributionSet_wAcceptJson() throws Exception {
|
||||
@Test
|
||||
void getDistributionSet_wAcceptJson() throws Exception {
|
||||
final MvcResult result = mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -206,7 +216,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* The response of a GET request shall contain charset=utf-8
|
||||
*/
|
||||
@Test public void getDistributionSet_wAcceptJsonUtf8() throws Exception {
|
||||
@Test
|
||||
void getDistributionSet_wAcceptJsonUtf8() throws Exception {
|
||||
final MvcResult result = mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON_UTF8))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -218,7 +229,8 @@ public class MgmtContentTypeTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* The response of a GET request shall contain charset=utf-8
|
||||
*/
|
||||
@Test public void getDistributionSet_wAcceptHalJson() throws Exception {
|
||||
@Test
|
||||
void getDistributionSet_wAcceptHalJson() throws Exception {
|
||||
final MvcResult result = mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).accept(MediaTypes.HAL_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
|
||||
@@ -87,7 +87,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* This test verifies the call of all Software Modules that are assigned to a Distribution Set through the RESTful API.
|
||||
*/
|
||||
@Test void getSoftwareModules() throws Exception {
|
||||
@Test
|
||||
void getSoftwareModules() throws Exception {
|
||||
// Create DistributionSet with three software modules
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("SMTest");
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + set.getId() + "/assignedSM"))
|
||||
@@ -99,7 +100,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Handles the GET request of retrieving assigned software modules of a single distribution set within SP with given page size and offset including sorting by version descending and filter down to all sets which name starts with 'one'.
|
||||
*/
|
||||
@Test void getSoftwareModulesWithParameters() throws Exception {
|
||||
@Test
|
||||
void getSoftwareModulesWithParameters() throws Exception {
|
||||
final DistributionSet set = testdataFactory.createUpdatedDistributionSet();
|
||||
|
||||
// post assignment
|
||||
@@ -114,7 +116,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* This test verifies the deletion of a assigned Software Module of a Distribution Set can not be achieved when that Distribution Set has been assigned or installed to a target.
|
||||
*/
|
||||
@Test void deleteFailureWhenDistributionSetInUse() throws Exception {
|
||||
@Test
|
||||
void deleteFailureWhenDistributionSetInUse() throws Exception {
|
||||
// create DisSet
|
||||
final DistributionSet disSet = testdataFactory.createDistributionSetWithNoSoftwareModules("Eris", "560a");
|
||||
final List<Long> smIDs = new ArrayList<>();
|
||||
@@ -159,7 +162,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* This test verifies that the assignment of a Software Module to a Distribution Set can not be achieved when that Distribution Set has been assigned or installed to a target.
|
||||
*/
|
||||
@Test void assignmentFailureWhenAssigningToUsedDistributionSet() throws Exception {
|
||||
@Test
|
||||
void assignmentFailureWhenAssigningToUsedDistributionSet() throws Exception {
|
||||
// create DisSet
|
||||
final DistributionSet disSet = testdataFactory.createDistributionSetWithNoSoftwareModules("Mars", "686,980");
|
||||
final List<Long> smIDs = new ArrayList<>();
|
||||
@@ -203,7 +207,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* This test verifies the assignment of Software Modules to a Distribution Set through the RESTful API.
|
||||
*/
|
||||
@Test void assignSoftwareModuleToDistributionSet() throws Exception {
|
||||
@Test
|
||||
void assignSoftwareModuleToDistributionSet() throws Exception {
|
||||
// create DisSet
|
||||
final DistributionSet disSet = testdataFactory.createDistributionSetWithNoSoftwareModules("Jupiter", "398,88");
|
||||
// Test if size is 0
|
||||
@@ -275,7 +280,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* This test verifies the removal of Software Modules of a Distribution Set through the RESTful API.
|
||||
*/
|
||||
@Test void unassignSoftwareModuleFromDistributionSet() throws Exception {
|
||||
@Test
|
||||
void unassignSoftwareModuleFromDistributionSet() throws Exception {
|
||||
// Create DistributionSet with three software modules
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("Venus");
|
||||
int amountOfSM = set.getModules().size();
|
||||
@@ -299,7 +305,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that multi target assignment through API is reflected by the repository.
|
||||
*/
|
||||
@Test void assignMultipleTargetsToDistributionSet() throws Exception {
|
||||
@Test
|
||||
void assignMultipleTargetsToDistributionSet() throws Exception {
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
|
||||
// prepare targets
|
||||
@@ -323,7 +330,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that targets can be assigned even if the specified controller IDs are in different case (e.g. 'TARGET1' instead of 'target1'.
|
||||
*/
|
||||
@Test void assignTargetsToDistributionSetIgnoreCase() throws Exception {
|
||||
@Test
|
||||
void assignTargetsToDistributionSetIgnoreCase() throws Exception {
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
|
||||
// prepare targets
|
||||
@@ -347,7 +355,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Trying to create a DS from already marked as deleted type - should get as response 400 Bad Request
|
||||
*/
|
||||
@Test void createDsFromAlreadyMarkedAsDeletedType() throws Exception {
|
||||
@Test
|
||||
void createDsFromAlreadyMarkedAsDeletedType() throws Exception {
|
||||
final SoftwareModule softwareModule = testdataFactory.createSoftwareModule("exampleKey");
|
||||
final DistributionSetType type = testdataFactory.findOrCreateDistributionSetType(
|
||||
"testKey", "testType", Collections.singletonList(softwareModule.getType()),
|
||||
@@ -388,7 +397,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that multi target assignment is protected by our getMaxTargetDistributionSetAssignmentsPerManualAssignment quota.
|
||||
*/
|
||||
@Test void assignMultipleTargetsToDistributionSetUntilQuotaIsExceeded() throws Exception {
|
||||
@Test
|
||||
void assignMultipleTargetsToDistributionSetUntilQuotaIsExceeded() throws Exception {
|
||||
final int maxActions = quotaManagement.getMaxTargetDistributionSetAssignmentsPerManualAssignment();
|
||||
final List<Target> targets = testdataFactory.createTargets(maxActions + 1);
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet();
|
||||
@@ -412,7 +422,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that the 'max actions per target' quota is enforced if the distribution set assignment of a target is changed permanently
|
||||
*/
|
||||
@Test void changeDistributionSetAssignmentForTargetUntilQuotaIsExceeded() throws Exception {
|
||||
@Test
|
||||
void changeDistributionSetAssignmentForTargetUntilQuotaIsExceeded() throws Exception {
|
||||
|
||||
// create one target
|
||||
final Target testTarget = testdataFactory.createTarget("trg1");
|
||||
@@ -439,7 +450,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that offline reported multi target assignment through API is reflected by the repository.
|
||||
*/
|
||||
@Test void offlineAssignmentOfMultipleTargetsToDistributionSet() throws Exception {
|
||||
@Test
|
||||
void offlineAssignmentOfMultipleTargetsToDistributionSet() throws Exception {
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
final List<Target> targets = testdataFactory.createTargets(5);
|
||||
final JSONArray list = new JSONArray();
|
||||
@@ -470,7 +482,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Assigns multiple targets to distribution set with only maintenance schedule.
|
||||
*/
|
||||
@Test void assignMultipleTargetsToDistributionSetWithMaintenanceWindowStartOnly() throws Exception {
|
||||
@Test
|
||||
void assignMultipleTargetsToDistributionSetWithMaintenanceWindowStartOnly() throws Exception {
|
||||
// prepare distribution set
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
// prepare targets
|
||||
@@ -488,7 +501,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Assigns multiple targets to distribution set with only maintenance window duration.
|
||||
*/
|
||||
@Test void assignMultipleTargetsToDistributionSetWithMaintenanceWindowEndOnly() throws Exception {
|
||||
@Test
|
||||
void assignMultipleTargetsToDistributionSetWithMaintenanceWindowEndOnly() throws Exception {
|
||||
// prepare distribution set
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
// prepare targets
|
||||
@@ -506,7 +520,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Assigns multiple targets to distribution set with valid maintenance window.
|
||||
*/
|
||||
@Test void assignMultipleTargetsToDistributionSetWithValidMaintenanceWindow() throws Exception {
|
||||
@Test
|
||||
void assignMultipleTargetsToDistributionSetWithValidMaintenanceWindow() throws Exception {
|
||||
// prepare distribution set
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
// prepare targets
|
||||
@@ -525,7 +540,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Assigns multiple targets to distribution set with last maintenance window scheduled before current time.
|
||||
*/
|
||||
@Test void assignMultipleTargetsToDistributionSetWithMaintenanceWindowEndTimeBeforeStartTime() throws Exception {
|
||||
@Test
|
||||
void assignMultipleTargetsToDistributionSetWithMaintenanceWindowEndTimeBeforeStartTime() throws Exception {
|
||||
// prepare distribution set
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
// prepare targets
|
||||
@@ -544,7 +560,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Assigns multiple targets to distribution set with and without maintenance window.
|
||||
*/
|
||||
@Test void assignMultipleTargetsToDistributionSetWithAndWithoutMaintenanceWindow() throws Exception {
|
||||
@Test
|
||||
void assignMultipleTargetsToDistributionSetWithAndWithoutMaintenanceWindow() throws Exception {
|
||||
// prepare distribution set
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
// prepare targets
|
||||
@@ -572,7 +589,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Assigning distribution set to the list of targets with a non-existing one leads to successful assignment of valid targets, while not found targets are silently ignored.
|
||||
*/
|
||||
@Test void assignNotExistingTargetToDistributionSet() throws Exception {
|
||||
@Test
|
||||
void assignNotExistingTargetToDistributionSet() throws Exception {
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
|
||||
final String[] knownTargetIds = new String[] { "1", "2", "3" };
|
||||
@@ -593,7 +611,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that assigned targets of DS are returned as reflected by the repository.
|
||||
*/
|
||||
@Test void getAssignedTargetsOfDistributionSet() throws Exception {
|
||||
@Test
|
||||
void getAssignedTargetsOfDistributionSet() throws Exception {
|
||||
// prepare distribution set
|
||||
final String knownTargetId = "knownTargetId1";
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
@@ -609,7 +628,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Handles the GET request for retrieving assigned targets of a single distribution set with a defined page size and offset, sorted by name in descending order and filtered down to all targets which controllerID starts with 'target'.
|
||||
*/
|
||||
@Test void getAssignedTargetsOfDistributionSetWithParameters() throws Exception {
|
||||
@Test
|
||||
void getAssignedTargetsOfDistributionSetWithParameters() throws Exception {
|
||||
final DistributionSet set = testdataFactory.createUpdatedDistributionSet();
|
||||
|
||||
assignDistributionSet(set, testdataFactory.createTargets(5, "targetMisc", "Test targets for query"))
|
||||
@@ -627,7 +647,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that assigned targets of DS are returned as persisted in the repository.
|
||||
*/
|
||||
@Test void getAssignedTargetsOfDistributionSetIsEmpty() throws Exception {
|
||||
@Test
|
||||
void getAssignedTargetsOfDistributionSetIsEmpty() throws Exception {
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
mvc.perform(get(
|
||||
MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/assignedTargets"))
|
||||
@@ -639,7 +660,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that installed targets of DS are returned as persisted in the repository.
|
||||
*/
|
||||
@Test void getInstalledTargetsOfDistributionSet() throws Exception {
|
||||
@Test
|
||||
void getInstalledTargetsOfDistributionSet() throws Exception {
|
||||
// prepare distribution set
|
||||
final String knownTargetId = "knownTargetId1";
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
@@ -663,7 +685,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Handles the GET request for retrieving installed targets of a single distribution set with a defined page size and offset, sortet by name in descending order and filtered down to all targets which controllerID starts with 'target'.
|
||||
*/
|
||||
@Test void getInstalledTargetsOfDistributionSetWithParameters() throws Exception {
|
||||
@Test
|
||||
void getInstalledTargetsOfDistributionSetWithParameters() throws Exception {
|
||||
final DistributionSet set = testdataFactory.createUpdatedDistributionSet();
|
||||
|
||||
final List<Target> targets = assignDistributionSet(set,
|
||||
@@ -682,7 +705,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that target filters with auto assign DS are returned as persisted in the repository.
|
||||
*/
|
||||
@Test void getAutoAssignTargetFiltersOfDistributionSet() throws Exception {
|
||||
@Test
|
||||
void getAutoAssignTargetFiltersOfDistributionSet() throws Exception {
|
||||
// prepare distribution set
|
||||
final String knownFilterName = "a";
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
@@ -704,7 +728,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Handles the GET request for retrieving assigned target filter queries of a single distribution set with a defined page size and offset, sorted by name in descending order and filtered down to all targets with a name that ends with '1'.
|
||||
*/
|
||||
@Test void ggetAutoAssignTargetFiltersOfDistributionSetWithParameters() throws Exception {
|
||||
@Test
|
||||
void ggetAutoAssignTargetFiltersOfDistributionSetWithParameters() throws Exception {
|
||||
final DistributionSet set = testdataFactory.createUpdatedDistributionSet();
|
||||
targetFilterQueryManagement.create(entityFactory.targetFilterQuery().create().name("filter1").query("name==a")
|
||||
.autoAssignDistributionSet(set));
|
||||
@@ -721,7 +746,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that an error is returned when the query is invalid.
|
||||
*/
|
||||
@Test void getAutoAssignTargetFiltersOfDSWithInvalidFilter() throws Exception {
|
||||
@Test
|
||||
void getAutoAssignTargetFiltersOfDSWithInvalidFilter() throws Exception {
|
||||
// prepare distribution set
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
final String invalidQuery = "unknownField=le=42";
|
||||
@@ -734,7 +760,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that target filters with auto assign DS are returned according to the query.
|
||||
*/
|
||||
@Test void getMultipleAutoAssignTargetFiltersOfDistributionSet() throws Exception {
|
||||
@Test
|
||||
void getMultipleAutoAssignTargetFiltersOfDistributionSet() throws Exception {
|
||||
final String filterNamePrefix = "filter-";
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
final String query = "name==" + filterNamePrefix + "*";
|
||||
@@ -752,7 +779,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that no target filters are returned according to the non matching query.
|
||||
*/
|
||||
@Test void getEmptyAutoAssignTargetFiltersOfDistributionSet() throws Exception {
|
||||
@Test
|
||||
void getEmptyAutoAssignTargetFiltersOfDistributionSet() throws Exception {
|
||||
final String filterNamePrefix = "filter-";
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
final String query = "name==doesNotExist";
|
||||
@@ -768,7 +796,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that DS in repository are listed with proper paging properties.
|
||||
*/
|
||||
@Test void getDistributionSetsWithoutAdditionalRequestParameters() throws Exception {
|
||||
@Test
|
||||
void getDistributionSetsWithoutAdditionalRequestParameters() throws Exception {
|
||||
final int sets = 5;
|
||||
createDistributionSetsAlphabetical(sets);
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING))
|
||||
@@ -782,7 +811,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that DS in repository are listed with proper paging results with paging limit parameter.
|
||||
*/
|
||||
@Test void getDistributionSetsWithPagingLimitRequestParameter() throws Exception {
|
||||
@Test
|
||||
void getDistributionSetsWithPagingLimitRequestParameter() throws Exception {
|
||||
final int sets = 5;
|
||||
final int limitSize = 1;
|
||||
createDistributionSetsAlphabetical(sets);
|
||||
@@ -798,7 +828,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that DS in repository are listed with proper paging results with paging limit and offset parameter.
|
||||
*/
|
||||
@Test void getDistributionSetsWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||
@Test
|
||||
void getDistributionSetsWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||
final int sets = 5;
|
||||
final int offsetParam = 2;
|
||||
final int expectedSize = sets - offsetParam;
|
||||
@@ -955,7 +986,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that DS deletion request to API is reflected by the repository.
|
||||
*/
|
||||
@Test void deleteUnassignedistributionSet() throws Exception {
|
||||
@Test
|
||||
void deleteUnassignedistributionSet() throws Exception {
|
||||
// prepare test data
|
||||
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
|
||||
|
||||
@@ -976,7 +1008,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that DS deletion request to API on an entity that does not exist results in NOT_FOUND.
|
||||
*/
|
||||
@Test void deleteDistributionSetThatDoesNotExistLeadsToNotFound() throws Exception {
|
||||
@Test
|
||||
void deleteDistributionSetThatDoesNotExistLeadsToNotFound() throws Exception {
|
||||
mvc.perform(delete("/rest/v1/distributionsets/1234"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNotFound());
|
||||
@@ -985,7 +1018,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that assigned DS deletion request to API is reflected by the repository by means of deleted flag set.
|
||||
*/
|
||||
@Test void deleteAssignedDistributionSet() throws Exception {
|
||||
@Test
|
||||
void deleteAssignedDistributionSet() throws Exception {
|
||||
// prepare test data
|
||||
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
|
||||
|
||||
@@ -1016,7 +1050,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that DS property update request to API is reflected by the repository.
|
||||
*/
|
||||
@Test void updateDistributionSet() throws Exception {
|
||||
@Test
|
||||
void updateDistributionSet() throws Exception {
|
||||
// prepare test data
|
||||
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
|
||||
|
||||
@@ -1046,7 +1081,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that DS property update on requiredMigrationStep fails if DS is assigned to a target.
|
||||
*/
|
||||
@Test void updateRequiredMigrationStepFailsIfDistributionSetisInUse() throws Exception {
|
||||
@Test
|
||||
void updateRequiredMigrationStepFailsIfDistributionSetisInUse() throws Exception {
|
||||
|
||||
// prepare test data
|
||||
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
|
||||
@@ -1072,7 +1108,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that the server reacts properly to invalid requests (URI, Media Type, Methods) with correct reponses.
|
||||
*/
|
||||
@Test void invalidRequestsOnDistributionSetsResource() throws Exception {
|
||||
@Test
|
||||
void invalidRequestsOnDistributionSetsResource() throws Exception {
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("one");
|
||||
|
||||
final List<DistributionSet> sets = new ArrayList<>();
|
||||
@@ -1134,7 +1171,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that the metadata creation through API is reflected by the repository.
|
||||
*/
|
||||
@Test void createMetadata() throws Exception {
|
||||
@Test
|
||||
void createMetadata() throws Exception {
|
||||
final DistributionSet testDS = testdataFactory.createDistributionSet("one");
|
||||
|
||||
final String knownKey1 = "known.key.1.1";
|
||||
@@ -1177,7 +1215,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that a metadata update through API is reflected by the repository.
|
||||
*/
|
||||
@Test void updateMetadata() throws Exception {
|
||||
@Test
|
||||
void updateMetadata() throws Exception {
|
||||
// prepare and create metadata for update
|
||||
final String knownKey = "knownKey";
|
||||
final String knownValue = "knownValue";
|
||||
@@ -1199,7 +1238,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that a metadata entry deletion through API is reflected by the repository.
|
||||
*/
|
||||
@Test void deleteMetadata() throws Exception {
|
||||
@Test
|
||||
void deleteMetadata() throws Exception {
|
||||
// prepare and create metadata for deletion
|
||||
final String knownKey = "knownKey";
|
||||
final String knownValue = "knownValue";
|
||||
@@ -1222,7 +1262,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that DS metadata deletion request to API on an entity that does not exist results in NOT_FOUND.
|
||||
*/
|
||||
@Test void deleteMetadataThatDoesNotExistLeadsToNotFound() throws Exception {
|
||||
@Test
|
||||
void deleteMetadataThatDoesNotExistLeadsToNotFound() throws Exception {
|
||||
// prepare and create metadata for deletion
|
||||
final String knownKey = "knownKey";
|
||||
final String knownValue = "knownValue";
|
||||
@@ -1243,7 +1284,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that a metadata entry selection through API reflects the repository content.
|
||||
*/
|
||||
@Test void getMetadataKey() throws Exception {
|
||||
@Test
|
||||
void getMetadataKey() throws Exception {
|
||||
// prepare and create metadata
|
||||
final String knownKey = "knownKey";
|
||||
final String knownValue = "knownValue";
|
||||
@@ -1260,7 +1302,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Get a paged list of meta data for a distribution set with standard page size.
|
||||
*/
|
||||
@Test void getMetadata() throws Exception {
|
||||
@Test
|
||||
void getMetadata() throws Exception {
|
||||
final int totalMetadata = 4;
|
||||
final String knownKeyPrefix = "knownKey";
|
||||
final String knownValuePrefix = "knownValue";
|
||||
@@ -1278,7 +1321,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that a DS search with query parameters returns the expected result.
|
||||
*/
|
||||
@Test void searchDistributionSetRsql() throws Exception {
|
||||
@Test
|
||||
void searchDistributionSetRsql() throws Exception {
|
||||
final String dsSuffix = "test";
|
||||
final int amount = 10;
|
||||
testdataFactory.createDistributionSets(dsSuffix, amount);
|
||||
@@ -1300,7 +1344,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that a DS search with complete==true parameter returns only DS that are actually completely filled with mandatory modules.
|
||||
*/
|
||||
@Test void filterDistributionSetComplete() throws Exception {
|
||||
@Test
|
||||
void filterDistributionSetComplete() throws Exception {
|
||||
final int amount = 10;
|
||||
testdataFactory.createDistributionSets(amount);
|
||||
distributionSetManagement
|
||||
@@ -1318,7 +1363,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Ensures that a DS assigned target search with controllerId==1 parameter returns only the target with the given ID.
|
||||
*/
|
||||
@Test void searchDistributionSetAssignedTargetsRsql() throws Exception {
|
||||
@Test
|
||||
void searchDistributionSetAssignedTargetsRsql() throws Exception {
|
||||
// prepare distribution set
|
||||
final Set<DistributionSet> createDistributionSetsAlphabetical = createDistributionSetsAlphabetical(1);
|
||||
final DistributionSet createdDs = createDistributionSetsAlphabetical.iterator().next();
|
||||
@@ -1405,7 +1451,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* A request for assigning a target multiple times results in a Bad Request when multiassignment is disabled.
|
||||
*/
|
||||
@Test void multiAssignmentRequestNotAllowedIfDisabled() throws Exception {
|
||||
@Test
|
||||
void multiAssignmentRequestNotAllowedIfDisabled() throws Exception {
|
||||
final String targetId = testdataFactory.createTarget().getControllerId();
|
||||
final Long dsId = testdataFactory.createDistributionSet().getId();
|
||||
|
||||
@@ -1422,7 +1469,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Identical assignments in a single request are removed when multiassignment is disabled.
|
||||
*/
|
||||
@Test void identicalAssignmentInRequestAreRemovedIfMultiassignmentsDisabled() throws Exception {
|
||||
@Test
|
||||
void identicalAssignmentInRequestAreRemovedIfMultiassignmentsDisabled() throws Exception {
|
||||
final String targetId = testdataFactory.createTarget().getControllerId();
|
||||
final Long dsId = testdataFactory.createDistributionSet().getId();
|
||||
|
||||
@@ -1440,7 +1488,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Assigning targets multiple times to a DS in one request works in multiassignment mode.
|
||||
*/
|
||||
@Test void multiAssignment() throws Exception {
|
||||
@Test
|
||||
void multiAssignment() throws Exception {
|
||||
final List<String> targetIds = testdataFactory.createTargets(2).stream().map(Target::getControllerId)
|
||||
.toList();
|
||||
final Long dsId = testdataFactory.createDistributionSet().getId();
|
||||
@@ -1462,7 +1511,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* An assignment request containing a weight is only accepted when weight is valide and multi assignment is on.
|
||||
*/
|
||||
@Test void weightValidation() throws Exception {
|
||||
@Test
|
||||
void weightValidation() throws Exception {
|
||||
final String targetId = testdataFactory.createTarget().getControllerId();
|
||||
final Long dsId = testdataFactory.createDistributionSet().getId();
|
||||
final int weight = 78;
|
||||
@@ -1494,7 +1544,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Request to get the count of all Rollouts by status for specific Distribution set
|
||||
*/
|
||||
@Test void statisticsForRolloutsCountByStatus() throws Exception {
|
||||
@Test
|
||||
void statisticsForRolloutsCountByStatus() throws Exception {
|
||||
testdataFactory.createTargets("targets", 4);
|
||||
DistributionSet ds1 = testdataFactory.createDistributionSet("DS1");
|
||||
DistributionSet ds2 = testdataFactory.createDistributionSet("DS2");
|
||||
@@ -1528,7 +1579,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Request to get the count of all Actions by status for specific Distribution set
|
||||
*/
|
||||
@Test void statisticsForActionsCountByStatus() throws Exception {
|
||||
@Test
|
||||
void statisticsForActionsCountByStatus() throws Exception {
|
||||
testdataFactory.createTargets("targets", 4);
|
||||
|
||||
DistributionSet ds1 = testdataFactory.createDistributionSet("DS1");
|
||||
@@ -1560,7 +1612,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Request to get the count of all Auto Assignments for specific Distribution set
|
||||
*/
|
||||
@Test void statisticsForAutoAssignmentsCount() throws Exception {
|
||||
@Test
|
||||
void statisticsForAutoAssignmentsCount() throws Exception {
|
||||
testdataFactory.createTargets("targets", 4);
|
||||
DistributionSet ds1 = testdataFactory.createDistributionSet("DS1");
|
||||
DistributionSet ds2 = testdataFactory.createDistributionSet("DS2");
|
||||
@@ -1593,7 +1646,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Request to get full Statistics for specific Distribution set
|
||||
*/
|
||||
@Test void statisticsForDistributionSet() throws Exception {
|
||||
@Test
|
||||
void statisticsForDistributionSet() throws Exception {
|
||||
testdataFactory.createTargets("targets", 4);
|
||||
testdataFactory.createTargets("autoAssignments", 4);
|
||||
DistributionSet ds1 = testdataFactory.createDistributionSet("DS1");
|
||||
@@ -1630,7 +1684,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Verify invalidation of distribution sets that removes distribution sets from auto assignments, stops rollouts and cancels assignments
|
||||
*/
|
||||
@Test void invalidateDistributionSet() throws Exception {
|
||||
@Test
|
||||
void invalidateDistributionSet() throws Exception {
|
||||
final DistributionSet distributionSet = testdataFactory.createDistributionSet();
|
||||
final List<Target> targets = testdataFactory.createTargets(5, "invalidateDistributionSet");
|
||||
assignDistributionSet(distributionSet, targets);
|
||||
@@ -1665,7 +1720,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Tests the lock. It is verified that the distribution set can be marked as locked through update operation.
|
||||
*/
|
||||
@Test void lockDistributionSet() throws Exception {
|
||||
@Test
|
||||
void lockDistributionSet() throws Exception {
|
||||
// prepare test data
|
||||
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
|
||||
|
||||
@@ -1688,7 +1744,8 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
/**
|
||||
* Tests the unlock.
|
||||
*/
|
||||
@Test void unlockDistributionSet() throws Exception {
|
||||
@Test
|
||||
void unlockDistributionSet() throws Exception {
|
||||
// prepare test data
|
||||
assertThat(distributionSetManagement.findByCompleted(true, PAGE)).isEmpty();
|
||||
|
||||
|
||||
@@ -60,7 +60,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
/**
|
||||
* Verifies that a paged result list of DS tags reflects the content on the repository side.
|
||||
*/
|
||||
@Test @ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
|
||||
@Test
|
||||
@ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
|
||||
void getDistributionSetTags() throws Exception {
|
||||
final List<DistributionSetTag> tags = testdataFactory.createDistributionSetTags(2);
|
||||
final DistributionSetTag assigned = tags.get(0);
|
||||
@@ -82,7 +83,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
/**
|
||||
* Handles the GET request of retrieving all distribution set tags based by parameter
|
||||
*/
|
||||
@Test void getDistributionSetTagsWithParameters() throws Exception {
|
||||
@Test
|
||||
void getDistributionSetTagsWithParameters() throws Exception {
|
||||
testdataFactory.createDistributionSetTags(2);
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "?limit=10&sort=name:ASC&offset=0&q=name==DsTag"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -92,7 +94,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
/**
|
||||
* Verifies that a paged result list of DS tags reflects the content on the repository side when filtered by distribution set id.
|
||||
*/
|
||||
@Test void getDistributionSetTagsByDistributionSetId() throws Exception {
|
||||
@Test
|
||||
void getDistributionSetTagsByDistributionSetId() throws Exception {
|
||||
final List<DistributionSetTag> tags = testdataFactory.createDistributionSetTags(2);
|
||||
final DistributionSetTag tag1 = tags.get(0);
|
||||
final DistributionSetTag tag2 = tags.get(1);
|
||||
@@ -132,7 +135,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
/**
|
||||
* Verifies that a paged result list of DS tags reflects the content on the repository side when filtered by distribution set id field AND tag field.
|
||||
*/
|
||||
@Test void getDistributionSetTagsByDistributionSetIdAndTagDescription() throws Exception {
|
||||
@Test
|
||||
void getDistributionSetTagsByDistributionSetIdAndTagDescription() throws Exception {
|
||||
final List<DistributionSetTag> tags = testdataFactory.createDistributionSetTags(2);
|
||||
final DistributionSetTag tag1 = tags.get(0);
|
||||
final DistributionSetTag tag2 = tags.get(1);
|
||||
@@ -161,7 +165,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
/**
|
||||
* Verifies that a single result of a DS tag reflects the content on the repository side.
|
||||
*/
|
||||
@Test @ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
|
||||
@Test
|
||||
@ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
|
||||
void getDistributionSetTag() throws Exception {
|
||||
final List<DistributionSetTag> tags = testdataFactory.createDistributionSetTags(2);
|
||||
final DistributionSetTag assigned = tags.get(0);
|
||||
@@ -180,7 +185,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
/**
|
||||
* Verifies that created DS tags are stored in the repository as send to the API.
|
||||
*/
|
||||
@Test @ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
|
||||
@Test
|
||||
@ExpectEvents({ @Expect(type = DistributionSetTagCreatedEvent.class, count = 2) })
|
||||
void createDistributionSetTags() throws Exception {
|
||||
final Tag tagOne = entityFactory.tag().create().colour("testcol1").description("its a test1").name("thetest1")
|
||||
.build();
|
||||
@@ -211,7 +217,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
/**
|
||||
* Verifies that an updated DS tag is stored in the repository as send to the API.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetTagUpdatedEvent.class, count = 1) })
|
||||
void updateDistributionSetTag() throws Exception {
|
||||
@@ -241,7 +248,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
/**
|
||||
* Verifies that the delete call is reflected by the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetTagDeletedEvent.class, count = 1) })
|
||||
void deleteDistributionSetTag() throws Exception {
|
||||
@@ -258,7 +266,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
/**
|
||||
* Ensures that assigned DS to tag in repository are listed with proper paging results.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 5),
|
||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 5) })
|
||||
@@ -279,7 +288,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
/**
|
||||
* Ensures that assigned DS to tag in repository are listed with proper paging results with paging limit parameter.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 5),
|
||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 5) })
|
||||
@@ -302,7 +312,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
/**
|
||||
* Ensures that assigned DS to tag in repository are listed with proper paging results with paging limit and offset parameter.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 5),
|
||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 5) })
|
||||
@@ -328,7 +339,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
/**
|
||||
* Verifies that tag assignments done through tag API command are correctly stored in the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 1) })
|
||||
@@ -348,7 +360,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
/**
|
||||
* Verifies that tag assignments done through tag API command are correctly stored in the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
|
||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 2) })
|
||||
@@ -370,7 +383,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
/**
|
||||
* Verifies that tag unassignments done through tag API command are correctly stored in the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 2),
|
||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 3) })
|
||||
@@ -396,7 +410,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
/**
|
||||
* Verifies that tag unassignments done through tag API command are correctly stored in the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 3),
|
||||
@Expect(type = DistributionSetUpdatedEvent.class, count = 5) })
|
||||
@@ -423,7 +438,8 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
/**
|
||||
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = DistributionSetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 2) })
|
||||
void assignDistributionSetsNotFound() throws Exception {
|
||||
|
||||
@@ -406,7 +406,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
/**
|
||||
* Handles the GET request of retrieving all distribution set types within SP based on parameter.
|
||||
*/
|
||||
@Test void getDistributionSetTypesWithParameter() throws Exception {
|
||||
@Test
|
||||
void getDistributionSetTypesWithParameter() throws Exception {
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
||||
+ "?limit=10&sort=name:ASC&offset=0&q=name==a"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -434,7 +435,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
/**
|
||||
* Ensures that DS type deletion request to API on an entity that does not exist results in NOT_FOUND.
|
||||
*/
|
||||
@Test void deleteDistributionSetTypeThatDoesNotExistLeadsToNotFound() throws Exception {
|
||||
@Test
|
||||
void deleteDistributionSetTypeThatDoesNotExistLeadsToNotFound() throws Exception {
|
||||
mvc.perform(delete("/rest/v1/distributionsettypes/1234"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNotFound());
|
||||
@@ -476,7 +478,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
/**
|
||||
* Checks the correct behaviour of /rest/v1/distributionsettypes/{ID} PUT requests.
|
||||
*/
|
||||
@Test void updateDistributionSetTypeColourDescriptionAndNameUntouched() throws Exception {
|
||||
@Test
|
||||
void updateDistributionSetTypeColourDescriptionAndNameUntouched() throws Exception {
|
||||
final DistributionSetType testType = distributionSetTypeManagement.create(entityFactory.distributionSetType()
|
||||
.create().key("test123").name("TestName123").description("Desc123").colour("col"));
|
||||
|
||||
@@ -498,7 +501,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
/**
|
||||
* Handles the PUT request for a single distribution set type within SP.
|
||||
*/
|
||||
@Test void updateDistributionSetTypeDescriptionAndColor() throws Exception {
|
||||
@Test
|
||||
void updateDistributionSetTypeDescriptionAndColor() throws Exception {
|
||||
final DistributionSetType testType = distributionSetTypeManagement.update(entityFactory.distributionSetType()
|
||||
.update(testdataFactory.createDistributionSet().getType().getId()).description("Desc1234"));
|
||||
final String body = new JSONObject()
|
||||
@@ -515,7 +519,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
/**
|
||||
* Tests the update of the deletion flag. It is verfied that the distribution set type can't be marked as deleted through update operation.
|
||||
*/
|
||||
@Test void updateDistributionSetTypeDeletedFlag() throws Exception {
|
||||
@Test
|
||||
void updateDistributionSetTypeDeletedFlag() throws Exception {
|
||||
final DistributionSetType testType = distributionSetTypeManagement
|
||||
.create(entityFactory.distributionSetType().create().key("test123").name("TestName123").colour("col"));
|
||||
|
||||
@@ -532,7 +537,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
/**
|
||||
* Checks the correct behaviour of /rest/v1/distributionsettypes GET requests with paging.
|
||||
*/
|
||||
@Test void getDistributionSetTypesWithoutAddtionalRequestParameters() throws Exception {
|
||||
@Test
|
||||
void getDistributionSetTypesWithoutAddtionalRequestParameters() throws Exception {
|
||||
|
||||
// 4 types overall (3 hawkbit tenant default, 1 test default
|
||||
final int types = 4;
|
||||
@@ -547,7 +553,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
/**
|
||||
* Checks the correct behaviour of /rest/v1/distributionsettypes GET requests with paging.
|
||||
*/
|
||||
@Test void getDistributionSetTypesWithPagingLimitRequestParameter() throws Exception {
|
||||
@Test
|
||||
void getDistributionSetTypesWithPagingLimitRequestParameter() throws Exception {
|
||||
|
||||
final int types = DEFAULT_DS_TYPES;
|
||||
final int limitSize = 1;
|
||||
@@ -563,7 +570,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
/**
|
||||
* Checks the correct behaviour of /rest/v1/distributionsettypes GET requests with paging.
|
||||
*/
|
||||
@Test void getDistributionSetTypesWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||
@Test
|
||||
void getDistributionSetTypesWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||
final int types = DEFAULT_DS_TYPES;
|
||||
final int offsetParam = 2;
|
||||
final int expectedSize = types - offsetParam;
|
||||
@@ -580,7 +588,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
/**
|
||||
* Ensures that the server is behaving as expected on invalid requests (wrong media type, wrong ID etc.).
|
||||
*/
|
||||
@Test void invalidRequestsOnDistributionSetTypesResource() throws Exception {
|
||||
@Test
|
||||
void invalidRequestsOnDistributionSetTypesResource() throws Exception {
|
||||
final SoftwareModuleType testSmType = softwareModuleTypeManagement
|
||||
.create(entityFactory.softwareModuleType().create().key("test123").name("TestName123"));
|
||||
|
||||
@@ -694,7 +703,8 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
/**
|
||||
* Search erquest of software module types.
|
||||
*/
|
||||
@Test void searchDistributionSetTypeRsql() throws Exception {
|
||||
@Test
|
||||
void searchDistributionSetTypeRsql() throws Exception {
|
||||
distributionSetTypeManagement
|
||||
.create(entityFactory.distributionSetType().create().key("test123").name("TestName123"));
|
||||
distributionSetTypeManagement
|
||||
|
||||
@@ -94,7 +94,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Handles the GET request of retrieving a single rollout.
|
||||
*/
|
||||
@Test public void getRollout() throws Exception {
|
||||
@Test
|
||||
void getRollout() throws Exception {
|
||||
enableMultiAssignments();
|
||||
approvalStrategy.setApprovalNeeded(true);
|
||||
try {
|
||||
@@ -130,7 +131,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Handles the GET request of retrieving a all targets of a specific deploy group of a rollout.
|
||||
*/
|
||||
@Test public void getRolloutDeployGroupTargetsWithParameters() throws Exception {
|
||||
@Test
|
||||
void getRolloutDeployGroupTargetsWithParameters() throws Exception {
|
||||
testdataFactory.createTargets(4, "rollout", "description");
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
final Rollout rollout = createRollout("rollout1", 2, dsA.getId(), "controllerId==rollout*");
|
||||
@@ -149,7 +151,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Handles the POST request of approving a rollout.
|
||||
*/
|
||||
@Test public void approveRollout() throws Exception {
|
||||
@Test
|
||||
void approveRollout() throws Exception {
|
||||
approvalStrategy.setApprovalNeeded(true);
|
||||
try {
|
||||
testdataFactory.createTargets(4, "rollout", "description");
|
||||
@@ -186,7 +189,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Check if approvalDecidedBy and approvalRemark are present when rollout is approved
|
||||
*/
|
||||
@Test public void validateIfApprovalFieldsArePresentAfterApproval() throws Exception {
|
||||
@Test
|
||||
void validateIfApprovalFieldsArePresentAfterApproval() throws Exception {
|
||||
approvalStrategy.setApprovalNeeded(true);
|
||||
approvalStrategy.setApproveDecidedBy("testUser");
|
||||
final int amountTargets = 2;
|
||||
@@ -218,7 +222,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Retry rollout test scenario
|
||||
*/
|
||||
@Test public void retryRolloutTest() throws Exception {
|
||||
@Test
|
||||
void retryRolloutTest() throws Exception {
|
||||
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
final List<Target> successTargets = testdataFactory.createTargets("retryRolloutTargetSuccess-", 6);
|
||||
@@ -288,7 +293,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Retrying a running rollout should not be allowed.
|
||||
*/
|
||||
@Test public void retryNotFinishedRolloutShouldNotBeAllowed() throws Exception {
|
||||
@Test
|
||||
void retryNotFinishedRolloutShouldNotBeAllowed() throws Exception {
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
testdataFactory.createTargets("retryRolloutTarget-", 10);
|
||||
postRollout("rolloutToBeRetried", 1, dsA.getId(), "id==retryRolloutTarget*", 10, Action.ActionType.FORCED);
|
||||
@@ -307,7 +313,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Retrying a non-existing rollout should lead to NOT FOUND.
|
||||
*/
|
||||
@Test public void retryNonExistingRolloutShouldLeadToNotFound() throws Exception {
|
||||
@Test
|
||||
void retryNonExistingRolloutShouldLeadToNotFound() throws Exception {
|
||||
mvc.perform(post("/rest/v1/rollouts/{rolloutId}/retry", 6782623))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNotFound());
|
||||
@@ -316,7 +323,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that creating rollout with wrong body returns bad request
|
||||
*/
|
||||
@Test void createRolloutWithInvalidBodyReturnsBadRequest() throws Exception {
|
||||
@Test
|
||||
void createRolloutWithInvalidBodyReturnsBadRequest() throws Exception {
|
||||
mvc.perform(post("/rest/v1/rollouts").content("invalid body").contentType(MediaType.APPLICATION_JSON)
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -327,7 +335,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that creating rollout with insufficient permission returns forbidden
|
||||
*/
|
||||
@Test @WithUser(allSpPermissions = true, removeFromAllPermission = "CREATE_ROLLOUT")
|
||||
@Test
|
||||
@WithUser(allSpPermissions = true, removeFromAllPermission = "CREATE_ROLLOUT")
|
||||
void createRolloutWithInsufficientPermissionReturnsForbidden() throws Exception {
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
mvc.perform(post("/rest/v1/rollouts")
|
||||
@@ -341,7 +350,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that creating rollout with not existing distribution set returns not found
|
||||
*/
|
||||
@Test void createRolloutWithNotExistingDistributionSetReturnsNotFound() throws Exception {
|
||||
@Test
|
||||
void createRolloutWithNotExistingDistributionSetReturnsNotFound() throws Exception {
|
||||
mvc.perform(post("/rest/v1/rollouts").content(JsonBuilder.rollout("name", "desc", 10, 1234, "name==test", null))
|
||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -352,7 +362,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that creating rollout with not valid formed target filter query returns bad request
|
||||
*/
|
||||
@Test void createRolloutWithNotWellFormedFilterReturnsBadRequest() throws Exception {
|
||||
@Test
|
||||
void createRolloutWithNotWellFormedFilterReturnsBadRequest() throws Exception {
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
mvc.perform(post("/rest/v1/rollouts")
|
||||
.content(JsonBuilder.rollout("name", "desc", 5, dsA.getId(), "name=test", null))
|
||||
@@ -366,7 +377,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that the repository refuses to create rollout without a defined target filter set.
|
||||
*/
|
||||
@Test void missingTargetFilterQueryInRollout() throws Exception {
|
||||
@Test
|
||||
void missingTargetFilterQueryInRollout() throws Exception {
|
||||
|
||||
final String targetFilterQuery = null;
|
||||
|
||||
@@ -384,7 +396,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that rollout can be created
|
||||
*/
|
||||
@Test void createRollout() throws Exception {
|
||||
@Test
|
||||
void createRollout() throws Exception {
|
||||
testdataFactory.createTargets(20, "target", "rollout");
|
||||
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
@@ -394,7 +407,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that rollout cannot be created if too many rollout groups are specified.
|
||||
*/
|
||||
@Test void createRolloutWithTooManyRolloutGroups() throws Exception {
|
||||
@Test
|
||||
void createRolloutWithTooManyRolloutGroups() throws Exception {
|
||||
|
||||
final int maxGroups = quotaManagement.getMaxRolloutGroupsPerRollout();
|
||||
testdataFactory.createTargets(20, "target", "rollout");
|
||||
@@ -414,7 +428,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that rollout cannot be created if the 'max targets per rollout group' quota would be violated for one of the groups.
|
||||
*/
|
||||
@Test void createRolloutFailsIfRolloutGroupQuotaIsViolated() throws Exception {
|
||||
@Test
|
||||
void createRolloutFailsIfRolloutGroupQuotaIsViolated() throws Exception {
|
||||
|
||||
final int maxTargets = quotaManagement.getMaxTargetsPerRolloutGroup();
|
||||
testdataFactory.createTargets(maxTargets + 1, "target", "rollout");
|
||||
@@ -434,7 +449,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that rollout can be created with groups
|
||||
*/
|
||||
@Test void createRolloutWithGroupDefinitions() throws Exception {
|
||||
@Test
|
||||
void createRolloutWithGroupDefinitions() throws Exception {
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("ro");
|
||||
|
||||
final int amountTargets = 10;
|
||||
@@ -464,7 +480,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing dynamic rollouts with default dynamic group definition
|
||||
*/
|
||||
@Test void createDynamicRolloutWithDefaultDynamicGroupDefinition() throws Exception {
|
||||
@Test
|
||||
void createDynamicRolloutWithDefaultDynamicGroupDefinition() throws Exception {
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("ro");
|
||||
|
||||
final int amountTargets = 10;
|
||||
@@ -548,7 +565,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that no rollout with groups that have illegal percentages can be created
|
||||
*/
|
||||
@Test void createRolloutWithTooLowPercentage() throws Exception {
|
||||
@Test
|
||||
void createRolloutWithTooLowPercentage() throws Exception {
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("ro2");
|
||||
|
||||
final int amountTargets = 10;
|
||||
@@ -575,7 +593,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that no rollout with groups that have illegal percentages can be created
|
||||
*/
|
||||
@Test void createRolloutWithTooHighPercentage() throws Exception {
|
||||
@Test
|
||||
void createRolloutWithTooHighPercentage() throws Exception {
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("ro2");
|
||||
|
||||
final int amountTargets = 10;
|
||||
@@ -602,7 +621,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that rollout can be updated
|
||||
*/
|
||||
@Test void updateRollout() throws Exception {
|
||||
@Test
|
||||
void updateRollout() throws Exception {
|
||||
testdataFactory.createTargets(4, "rollout", "description");
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
// create a running rollout for the created targets
|
||||
@@ -629,7 +649,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing the empty list is returned if no rollout exists
|
||||
*/
|
||||
@Test void noRolloutReturnsEmptyList() throws Exception {
|
||||
@Test
|
||||
void noRolloutReturnsEmptyList() throws Exception {
|
||||
mvc.perform(get("/rest/v1/rollouts").accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -641,7 +662,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Retrieves single rollout from management API including extra data that is delivered only for single rollout access.
|
||||
*/
|
||||
@Test void retrieveSingleRollout() throws Exception {
|
||||
@Test
|
||||
void retrieveSingleRollout() throws Exception {
|
||||
testdataFactory.createTargets(20, "rollout", "rollout");
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
|
||||
@@ -661,7 +683,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Retrieves the list of rollouts with representation mode 'full'.
|
||||
*/
|
||||
@Test void retrieveRolloutListFullRepresentation() throws Exception {
|
||||
@Test
|
||||
void retrieveRolloutListFullRepresentation() throws Exception {
|
||||
testdataFactory.createTargets(20, "rollout", "rollout");
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
|
||||
@@ -704,7 +727,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Retrieves the list of rollouts with representation mode 'full'.
|
||||
*/
|
||||
@Test void retrieveRolloutListFullRepresentationWithFilter() throws Exception {
|
||||
@Test
|
||||
void retrieveRolloutListFullRepresentationWithFilter() throws Exception {
|
||||
testdataFactory.createTargets(20, "rollout", "rollout");
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
|
||||
@@ -804,7 +828,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Confirmation required flag will be read from the Rollout, if specified.
|
||||
*/
|
||||
@Test void verifyRolloutGroupWillUseRolloutPropertyFirst() throws Exception {
|
||||
@Test
|
||||
void verifyRolloutGroupWillUseRolloutPropertyFirst() throws Exception {
|
||||
enableConfirmationFlow();
|
||||
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("ro");
|
||||
@@ -848,7 +873,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Confirmation required flag will be read from the tenant config (confirmation flow state), if never specified.
|
||||
*/
|
||||
@Test void verifyRolloutGroupWillUseConfigIfNotProvidedWithRollout() throws Exception {
|
||||
@Test
|
||||
void verifyRolloutGroupWillUseConfigIfNotProvidedWithRollout() throws Exception {
|
||||
enableConfirmationFlow();
|
||||
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("ro");
|
||||
@@ -892,7 +918,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that rollout paged list contains rollouts
|
||||
*/
|
||||
@Test void rolloutPagedListContainsAllRollouts() throws Exception {
|
||||
@Test
|
||||
void rolloutPagedListContainsAllRollouts() throws Exception {
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
|
||||
testdataFactory.createTargets(20, "target", "rollout");
|
||||
@@ -955,7 +982,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing representation mode of rollout paged list
|
||||
*/
|
||||
@Test void rolloutPagedListRepresentationMode() throws Exception {
|
||||
@Test
|
||||
void rolloutPagedListRepresentationMode() throws Exception {
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
|
||||
testdataFactory.createTargets(20, "target", "rollout");
|
||||
@@ -974,7 +1002,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that rollout paged list is limited by the query param limit
|
||||
*/
|
||||
@Test void rolloutPagedListIsLimitedToQueryParam() throws Exception {
|
||||
@Test
|
||||
void rolloutPagedListIsLimitedToQueryParam() throws Exception {
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
|
||||
testdataFactory.createTargets(20, "target", "rollout");
|
||||
@@ -1043,7 +1072,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* The relation between deploy group and rollout should be validated.
|
||||
*/
|
||||
@Test void deployGroupsShouldValidateRelationWithRollout() throws Exception {
|
||||
@Test
|
||||
void deployGroupsShouldValidateRelationWithRollout() throws Exception {
|
||||
// setup
|
||||
final int amountTargets = 8;
|
||||
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
|
||||
@@ -1073,7 +1103,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that starting the rollout switches the state to starting and then to running
|
||||
*/
|
||||
@Test void startingRolloutSwitchesIntoRunningState() throws Exception {
|
||||
@Test
|
||||
void startingRolloutSwitchesIntoRunningState() throws Exception {
|
||||
// setup
|
||||
final int amountTargets = 20;
|
||||
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
|
||||
@@ -1110,7 +1141,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that pausing the rollout switches the state to paused
|
||||
*/
|
||||
@Test void pausingRolloutSwitchesIntoPausedState() throws Exception {
|
||||
@Test
|
||||
void pausingRolloutSwitchesIntoPausedState() throws Exception {
|
||||
// setup
|
||||
final int amountTargets = 20;
|
||||
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
|
||||
@@ -1144,7 +1176,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that resuming the rollout switches the state to running
|
||||
*/
|
||||
@Test void resumingRolloutSwitchesIntoRunningState() throws Exception {
|
||||
@Test
|
||||
void resumingRolloutSwitchesIntoRunningState() throws Exception {
|
||||
// setup
|
||||
final int amountTargets = 20;
|
||||
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
|
||||
@@ -1183,7 +1216,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that an already started rollout cannot be started again and returns bad request
|
||||
*/
|
||||
@Test void startingAlreadyStartedRolloutReturnsBadRequest() throws Exception {
|
||||
@Test
|
||||
void startingAlreadyStartedRolloutReturnsBadRequest() throws Exception {
|
||||
// setup
|
||||
final int amountTargets = 20;
|
||||
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
|
||||
@@ -1210,7 +1244,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that resuming a rollout which is not started leads to bad request
|
||||
*/
|
||||
@Test void resumingNotStartedRolloutReturnsBadRequest() throws Exception {
|
||||
@Test
|
||||
void resumingNotStartedRolloutReturnsBadRequest() throws Exception {
|
||||
// setup
|
||||
final int amountTargets = 20;
|
||||
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
|
||||
@@ -1229,7 +1264,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that starting rollout the first rollout group is in running state
|
||||
*/
|
||||
@Test void startingRolloutFirstRolloutGroupIsInRunningState() throws Exception {
|
||||
@Test
|
||||
void startingRolloutFirstRolloutGroupIsInRunningState() throws Exception {
|
||||
// setup
|
||||
final int amountTargets = 10;
|
||||
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
|
||||
@@ -1296,7 +1332,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that the targets of rollout group can be retrieved
|
||||
*/
|
||||
@Test void retrieveTargetsFromRolloutGroup() throws Exception {
|
||||
@Test
|
||||
void retrieveTargetsFromRolloutGroup() throws Exception {
|
||||
// setup
|
||||
final int amountTargets = 10;
|
||||
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
|
||||
@@ -1322,7 +1359,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that the targets of rollout group can be retrieved with rsql query param
|
||||
*/
|
||||
@Test void retrieveTargetsFromRolloutGroupWithQuery() throws Exception {
|
||||
@Test
|
||||
void retrieveTargetsFromRolloutGroupWithQuery() throws Exception {
|
||||
// setup
|
||||
final int amountTargets = 10;
|
||||
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
|
||||
@@ -1351,7 +1389,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that the targets of rollout group can be retrieved after the rollout has been started
|
||||
*/
|
||||
@Test void retrieveTargetsFromRolloutGroupAfterRolloutIsStarted() throws Exception {
|
||||
@Test
|
||||
void retrieveTargetsFromRolloutGroupAfterRolloutIsStarted() throws Exception {
|
||||
// setup
|
||||
final int amountTargets = 10;
|
||||
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
|
||||
@@ -1382,7 +1421,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Start the rollout in async mode
|
||||
*/
|
||||
@Test void startingRolloutSwitchesIntoRunningStateAsync() throws Exception {
|
||||
@Test
|
||||
void startingRolloutSwitchesIntoRunningStateAsync() throws Exception {
|
||||
|
||||
final int amountTargets = 50;
|
||||
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
|
||||
@@ -1406,7 +1446,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Deletion of a rollout
|
||||
*/
|
||||
@Test void deleteRollout() throws Exception {
|
||||
@Test
|
||||
void deleteRollout() throws Exception {
|
||||
final int amountTargets = 10;
|
||||
testdataFactory.createTargets(amountTargets, "rolloutDelete", "rolloutDelete");
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
@@ -1424,7 +1465,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Soft deletion of a rollout: soft deletion appears when already running rollout is being deleted
|
||||
*/
|
||||
@Test void deleteRunningRollout() throws Exception {
|
||||
@Test
|
||||
void deleteRunningRollout() throws Exception {
|
||||
final Rollout rollout = testdataFactory.createSoftDeletedRollout("softDeletedRollout");
|
||||
|
||||
mvc.perform(get("/rest/v1/rollouts/{rolloutid}", rollout.getId()))
|
||||
@@ -1438,7 +1480,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that rollout paged list with rsql parameter
|
||||
*/
|
||||
@Test void getRolloutWithRSQLParam() throws Exception {
|
||||
@Test
|
||||
void getRolloutWithRSQLParam() throws Exception {
|
||||
|
||||
final int amountTargetsRollout1 = 25;
|
||||
final int amountTargetsRollout2 = 25;
|
||||
@@ -1485,7 +1528,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that rolloutgroup paged list with rsql parameter
|
||||
*/
|
||||
@Test void retrieveRolloutGroupsForSpecificRolloutWithRSQLParam() throws Exception {
|
||||
@Test
|
||||
void retrieveRolloutGroupsForSpecificRolloutWithRSQLParam() throws Exception {
|
||||
// setup
|
||||
final int amountTargets = 20;
|
||||
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
|
||||
@@ -1529,7 +1573,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Testing that the list of rollout groups can be requested with representation mode 'full'.
|
||||
*/
|
||||
@Test void retrieveRolloutGroupsFullRepresentation() throws Exception {
|
||||
@Test
|
||||
void retrieveRolloutGroupsFullRepresentation() throws Exception {
|
||||
|
||||
testdataFactory.createTargets(20, "rollout", "rollout");
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
@@ -1568,7 +1613,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that a DOWNLOAD_ONLY rollout is possible
|
||||
*/
|
||||
@Test void createDownloadOnlyRollout() throws Exception {
|
||||
@Test
|
||||
void createDownloadOnlyRollout() throws Exception {
|
||||
testdataFactory.createTargets(20, "target", "rollout");
|
||||
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
@@ -1578,7 +1624,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* A rollout create request containing a weight is always accepted when weight is valid.
|
||||
*/
|
||||
@Test void weightValidation() throws Exception {
|
||||
@Test
|
||||
void weightValidation() throws Exception {
|
||||
testdataFactory.createTargets(4, "rollout", "description");
|
||||
final Long dsId = testdataFactory.createDistributionSet().getId();
|
||||
final int weight = 66;
|
||||
@@ -1614,7 +1661,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Trigger next rollout group
|
||||
*/
|
||||
@Test void triggeringNextGroupRollout() throws Exception {
|
||||
@Test
|
||||
void triggeringNextGroupRollout() throws Exception {
|
||||
// setup
|
||||
final int amountTargets = 20;
|
||||
testdataFactory.createTargets(amountTargets, "rollout", "rollout");
|
||||
@@ -1637,7 +1685,8 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Trigger next rollout group if rollout is in wrong state
|
||||
*/
|
||||
@Test void triggeringNextGroupRolloutWrongState() throws Exception {
|
||||
@Test
|
||||
void triggeringNextGroupRolloutWrongState() throws Exception {
|
||||
final int amountTargets = 3;
|
||||
final List<Target> targets = testdataFactory.createTargets(amountTargets, "rollout");
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
|
||||
@@ -100,7 +100,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Trying to create a SM from already marked as deleted type - should get as response 400 Bad Request
|
||||
*/
|
||||
@Test public void createSMFromAlreadyMarkedAsDeletedType() throws Exception {
|
||||
@Test
|
||||
void createSMFromAlreadyMarkedAsDeletedType() throws Exception {
|
||||
final String SM_TYPE = "someSmType";
|
||||
final SoftwareModule sm = testdataFactory.createSoftwareModule(SM_TYPE);
|
||||
testdataFactory.findOrCreateDistributionSetType(
|
||||
@@ -138,7 +139,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Handles the GET request of retrieving all meta data of artifacts assigned to a software module (in full representation mode including a download URL by the artifact provider).
|
||||
*/
|
||||
@Test public void getArtifactsWithParameters() throws Exception {
|
||||
@Test
|
||||
void getArtifactsWithParameters() throws Exception {
|
||||
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
|
||||
|
||||
final byte[] random = randomBytes(5);
|
||||
@@ -156,7 +158,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Get a paged list of meta data for a software module.
|
||||
*/
|
||||
@Test public void getMetadata() throws Exception {
|
||||
@Test
|
||||
void getMetadata() throws Exception {
|
||||
final int totalMetadata = 4;
|
||||
final String knownKeyPrefix = "knownKey";
|
||||
final String knownValuePrefix = "knownValue";
|
||||
@@ -177,7 +180,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Get a paged list of meta data for a software module with defined page size and sorting by name descending and key starting with 'known'.
|
||||
*/
|
||||
@Test public void getMetadataWithParameters() throws Exception {
|
||||
@Test
|
||||
void getMetadataWithParameters() throws Exception {
|
||||
final int totalMetadata = 4;
|
||||
final String knownKeyPrefix = "knownKey";
|
||||
final String knownValuePrefix = "knownValue";
|
||||
@@ -199,7 +203,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Get a single meta data value for a meta data key.
|
||||
*/
|
||||
@Test public void getMetadataValue() throws Exception {
|
||||
@Test
|
||||
void getMetadataValue() throws Exception {
|
||||
|
||||
// prepare and create metadata
|
||||
final String knownKey = "knownKey";
|
||||
@@ -217,7 +222,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Tests the update of software module metadata. It is verfied that only the selected fields for the update are really updated and the modification values are filled (i.e. updated by and at).
|
||||
*/
|
||||
@Test @WithUser(principal = "smUpdateTester", allSpPermissions = true)
|
||||
@Test
|
||||
@WithUser(principal = "smUpdateTester", allSpPermissions = true)
|
||||
void updateSoftwareModuleOnlyDescriptionAndVendorNameUntouched() throws Exception {
|
||||
final String knownSWName = "name1";
|
||||
final String knownSWVersion = "version1";
|
||||
@@ -272,7 +278,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Tests the update of the deletion flag. It is verified that the software module can't be marked as deleted through update operation.
|
||||
*/
|
||||
@Test @WithUser(principal = "smUpdateTester", allSpPermissions = true)
|
||||
@Test
|
||||
@WithUser(principal = "smUpdateTester", allSpPermissions = true)
|
||||
void updateSoftwareModuleDeletedFlag() throws Exception {
|
||||
final String knownSWName = "name1";
|
||||
final String knownSWVersion = "version1";
|
||||
@@ -309,7 +316,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Tests the lock. It is verified that the software module can be marked as locked through update operation.
|
||||
*/
|
||||
@Test @WithUser(principal = "smUpdateTester", allSpPermissions = true)
|
||||
@Test
|
||||
@WithUser(principal = "smUpdateTester", allSpPermissions = true)
|
||||
void lockSoftwareModule() throws Exception {
|
||||
final SoftwareModule sm = softwareModuleManagement.create(
|
||||
entityFactory.softwareModule().create().type(osType).name("name1").version("version1"));
|
||||
@@ -342,7 +350,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Tests the unlock.
|
||||
*/
|
||||
@Test @WithUser(principal = "smUpdateTester", allSpPermissions = true)
|
||||
@Test
|
||||
@WithUser(principal = "smUpdateTester", allSpPermissions = true)
|
||||
void unlockSoftwareModule() throws Exception {
|
||||
final SoftwareModule sm = softwareModuleManagement.create(
|
||||
entityFactory.softwareModule().create().type(osType).name("name1").version("version1"));
|
||||
@@ -378,7 +387,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Tests the upload of an artifact binary. The upload is executed and the content checked in the repository for completeness.
|
||||
*/
|
||||
@Test void uploadArtifact() throws Exception {
|
||||
@Test
|
||||
void uploadArtifact() throws Exception {
|
||||
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
|
||||
|
||||
// create test file
|
||||
@@ -420,7 +430,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies that artifacts which exceed the configured maximum size cannot be uploaded.
|
||||
*/
|
||||
@Test void uploadArtifactFailsIfTooLarge() throws Exception {
|
||||
@Test
|
||||
void uploadArtifactFailsIfTooLarge() throws Exception {
|
||||
final SoftwareModule sm = testdataFactory.createSoftwareModule("quota", "quota", false);
|
||||
final long maxSize = quotaManagement.getMaxArtifactSize();
|
||||
|
||||
@@ -441,7 +452,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies that artifact with invalid filename cannot be uploaded to prevent cross site scripting.
|
||||
*/
|
||||
@Test void uploadArtifactFailsIfFilenameInvalide() throws Exception {
|
||||
@Test
|
||||
void uploadArtifactFailsIfFilenameInvalide() throws Exception {
|
||||
final SoftwareModule sm = testdataFactory.createSoftwareModule("quota", "quota", false);
|
||||
final String illegalFilename = "<img src=ernw onerror=alert(1)>.xml";
|
||||
|
||||
@@ -458,7 +470,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies that the system does not accept empty artifact uploads. Expected response: BAD REQUEST
|
||||
*/
|
||||
@Test void emptyUploadArtifact() throws Exception {
|
||||
@Test
|
||||
void emptyUploadArtifact() throws Exception {
|
||||
assertThat(softwareModuleManagement.findAll(PAGE)).isEmpty();
|
||||
assertThat(artifactManagement.count()).isZero();
|
||||
|
||||
@@ -475,7 +488,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies that the system does not accept identical artifacts uploads for the same software module. Expected response: CONFLICT
|
||||
*/
|
||||
@Test void duplicateUploadArtifact() throws Exception {
|
||||
@Test
|
||||
void duplicateUploadArtifact() throws Exception {
|
||||
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
|
||||
|
||||
final byte[] random = randomBytes(5 * 1024);
|
||||
@@ -503,7 +517,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* verifies that option to upload artifacts with a custom defined by metadata, i.e. not the file name of the binary itself.
|
||||
*/
|
||||
@Test void uploadArtifactWithCustomName() throws Exception {
|
||||
@Test
|
||||
void uploadArtifactWithCustomName() throws Exception {
|
||||
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
|
||||
assertThat(artifactManagement.count()).isZero();
|
||||
|
||||
@@ -531,7 +546,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies that the system refuses upload of an artifact where the provided hash sums do not match. Expected result: BAD REQUEST
|
||||
*/
|
||||
@Test void uploadArtifactWithHashCheck() throws Exception {
|
||||
@Test
|
||||
void uploadArtifactWithHashCheck() throws Exception {
|
||||
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
|
||||
assertThat(artifactManagement.count()).isZero();
|
||||
|
||||
@@ -594,7 +610,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies that only a limited number of artifacts can be uploaded for one software module.
|
||||
*/
|
||||
@Test void uploadArtifactsUntilQuotaExceeded() throws Exception {
|
||||
@Test
|
||||
void uploadArtifactsUntilQuotaExceeded() throws Exception {
|
||||
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
|
||||
final long maxArtifacts = quotaManagement.getMaxArtifactsPerSoftwareModule();
|
||||
|
||||
@@ -637,7 +654,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies that artifacts can only be added as long as the artifact storage quota is not exceeded.
|
||||
*/
|
||||
@Test void uploadArtifactsUntilStorageQuotaExceeded() throws Exception {
|
||||
@Test
|
||||
void uploadArtifactsUntilStorageQuotaExceeded() throws Exception {
|
||||
|
||||
final long storageLimit = quotaManagement.getMaxArtifactStorage();
|
||||
|
||||
@@ -686,7 +704,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Tests binary download of an artifact including verfication that the downloaded binary is consistent and that the etag header is as expected identical to the SHA1 hash of the file.
|
||||
*/
|
||||
@Test void downloadArtifact() throws Exception {
|
||||
@Test
|
||||
void downloadArtifact() throws Exception {
|
||||
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
|
||||
|
||||
final int artifactSize = 5 * 1024;
|
||||
@@ -707,7 +726,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies the listing of one defined artifact assigned to a given software module. That includes the artifact metadata and download links.
|
||||
*/
|
||||
@Test void getArtifact() throws Exception {
|
||||
@Test
|
||||
void getArtifact() throws Exception {
|
||||
// prepare data for test
|
||||
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
|
||||
|
||||
@@ -777,7 +797,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies the listing of an artifact that belongs to a soft deleted software module.
|
||||
*/
|
||||
@Test void getArtifactSoftDeleted() throws Exception {
|
||||
@Test
|
||||
void getArtifactSoftDeleted() throws Exception {
|
||||
// prepare data for test
|
||||
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs("softDeleted");
|
||||
final Artifact artifact = testdataFactory.createArtifacts(sm.getId()).get(0);
|
||||
@@ -805,7 +826,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies the listing of all artifacts assigned to a software module. That includes the artifact metadata.
|
||||
*/
|
||||
@Test void getArtifacts() throws Exception {
|
||||
@Test
|
||||
void getArtifacts() throws Exception {
|
||||
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
|
||||
|
||||
final int artifactSize = 5 * 1024;
|
||||
@@ -891,7 +913,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies that the system refuses unsupported request types and answers as defined to them, e.g. NOT FOUND on a non existing resource. Or a HTTP POST for updating a resource results in METHOD NOT ALLOWED etc.
|
||||
*/
|
||||
@Test void invalidRequestsOnArtifactResource() throws Exception {
|
||||
@Test
|
||||
void invalidRequestsOnArtifactResource() throws Exception {
|
||||
|
||||
final int artifactSize = 5 * 1024;
|
||||
final byte[] random = randomBytes(artifactSize);
|
||||
@@ -948,7 +971,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Tests the deletion of an artifact including verification that the artifact is actually erased in the repository and removed from the software module.
|
||||
*/
|
||||
@Test void deleteArtifact() throws Exception {
|
||||
@Test
|
||||
void deleteArtifact() throws Exception {
|
||||
// Create 1 SM
|
||||
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
|
||||
|
||||
@@ -983,7 +1007,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies that the system refuses unsupported request types and answers as defined to them, e.g. NOT FOUND on a non existing resource. Or a HTTP POST for updating a resource results in METHOD NOT ALLOWED etc.
|
||||
*/
|
||||
@Test void invalidRequestsOnSoftwareModulesResource() throws Exception {
|
||||
@Test
|
||||
void invalidRequestsOnSoftwareModulesResource() throws Exception {
|
||||
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
|
||||
|
||||
final List<SoftwareModule> modules = Collections.singletonList(sm);
|
||||
@@ -1050,7 +1075,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Test of modules retrieval without any parameters. Will return all modules in the system as defined by standard page size.
|
||||
*/
|
||||
@Test void getSoftwareModulesWithoutAdditionalRequestParameters() throws Exception {
|
||||
@Test
|
||||
void getSoftwareModulesWithoutAdditionalRequestParameters() throws Exception {
|
||||
final int modules = 5;
|
||||
createSoftwareModulesAlphabetical(modules);
|
||||
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING))
|
||||
@@ -1064,7 +1090,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Test of modules retrieval with paging limit parameter. Will return all modules in the system as defined by given page size.
|
||||
*/
|
||||
@Test void detSoftwareModulesWithPagingLimitRequestParameter() throws Exception {
|
||||
@Test
|
||||
void detSoftwareModulesWithPagingLimitRequestParameter() throws Exception {
|
||||
final int modules = 5;
|
||||
final int limitSize = 1;
|
||||
createSoftwareModulesAlphabetical(modules);
|
||||
@@ -1080,7 +1107,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Test of modules retrieval with paging limit offset parameters. Will return all modules in the system as defined by given page size starting from given offset.
|
||||
*/
|
||||
@Test void getSoftwareModulesWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||
@Test
|
||||
void getSoftwareModulesWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||
final int modules = 5;
|
||||
final int offsetParam = 2;
|
||||
final int expectedSize = modules - offsetParam;
|
||||
@@ -1135,7 +1163,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Test the various filter parameters, e.g. filter by name or type of the module.
|
||||
*/
|
||||
@Test void getSoftwareModulesWithFilterParameters() throws Exception {
|
||||
@Test
|
||||
void getSoftwareModulesWithFilterParameters() throws Exception {
|
||||
final SoftwareModule os1 = testdataFactory.createSoftwareModuleOs("1");
|
||||
final SoftwareModule app1 = testdataFactory.createSoftwareModuleApp("1");
|
||||
testdataFactory.createSoftwareModuleOs("2");
|
||||
@@ -1201,7 +1230,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies that the system answers as defined in case of a wrong filter parameter syntax. Expected result: BAD REQUEST with error description.
|
||||
*/
|
||||
@Test void getSoftwareModulesWithSyntaxErrorFilterParameter() throws Exception {
|
||||
@Test
|
||||
void getSoftwareModulesWithSyntaxErrorFilterParameter() throws Exception {
|
||||
mvc.perform(get("/rest/v1/softwaremodules?q=wrongFIQLSyntax").accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isBadRequest())
|
||||
@@ -1211,7 +1241,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies that the system answers as defined in case of a non existing field used in filter. Expected result: BAD REQUEST with error description.
|
||||
*/
|
||||
@Test void getSoftwareModulesWithUnknownFieldErrorFilterParameter() throws Exception {
|
||||
@Test
|
||||
void getSoftwareModulesWithUnknownFieldErrorFilterParameter() throws Exception {
|
||||
mvc.perform(get("/rest/v1/softwaremodules?q=wrongField==abc").accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isBadRequest())
|
||||
@@ -1326,7 +1357,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies successfull deletion of software modules that are not in use, i.e. assigned to a DS.
|
||||
*/
|
||||
@Test void deleteUnassignedSoftwareModule() throws Exception {
|
||||
@Test
|
||||
void deleteUnassignedSoftwareModule() throws Exception {
|
||||
|
||||
final SoftwareModule sm = testdataFactory.createSoftwareModuleOs();
|
||||
|
||||
@@ -1351,7 +1383,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies successfull deletion of a software module that is in use, i.e. assigned to a DS which should result in movinf the module to the archive.
|
||||
*/
|
||||
@Test void deleteAssignedSoftwareModule() throws Exception {
|
||||
@Test
|
||||
void deleteAssignedSoftwareModule() throws Exception {
|
||||
final DistributionSet ds1 = testdataFactory.createDistributionSet("a");
|
||||
|
||||
final int artifactSize = 5 * 1024;
|
||||
@@ -1386,7 +1419,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies the successful creation of metadata and the enforcement of the meta data quota.
|
||||
*/
|
||||
@Test void createMetadata() throws Exception {
|
||||
@Test
|
||||
void createMetadata() throws Exception {
|
||||
final String knownKey1 = "knownKey1";
|
||||
final String knownValue1 = "knownValue1";
|
||||
final String knownKey2 = "knownKey2";
|
||||
@@ -1429,7 +1463,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies the successful update of metadata based on given key.
|
||||
*/
|
||||
@Test void updateMetadataKey() throws Exception {
|
||||
@Test
|
||||
void updateMetadataKey() throws Exception {
|
||||
// prepare and create metadata for update
|
||||
final String knownKey = "knownKey";
|
||||
final String knownValue = "knownValue";
|
||||
@@ -1456,7 +1491,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Verifies the successful deletion of metadata entry.
|
||||
*/
|
||||
@Test void deleteMetadata() throws Exception {
|
||||
@Test
|
||||
void deleteMetadata() throws Exception {
|
||||
// prepare and create metadata for deletion
|
||||
final String knownKey = "knownKey";
|
||||
final String knownValue = "knownValue";
|
||||
@@ -1476,7 +1512,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Ensures that module metadata deletion request to API on an entity that does not exist results in NOT_FOUND.
|
||||
*/
|
||||
@Test void deleteModuleMetadataThatDoesNotExistLeadsToNotFound() throws Exception {
|
||||
@Test
|
||||
void deleteModuleMetadataThatDoesNotExistLeadsToNotFound() throws Exception {
|
||||
// prepare and create metadata for deletion
|
||||
final String knownKey = "knownKey";
|
||||
final String knownValue = "knownValue";
|
||||
@@ -1499,7 +1536,8 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
/**
|
||||
* Ensures that module deletion request to API on an entity that does not exist results in NOT_FOUND.
|
||||
*/
|
||||
@Test void deleteSoftwareModuleThatDoesNotExistLeadsToNotFound() throws Exception {
|
||||
@Test
|
||||
void deleteSoftwareModuleThatDoesNotExistLeadsToNotFound() throws Exception {
|
||||
mvc.perform(delete("/rest/v1/softwaremodules/1234"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNotFound());
|
||||
|
||||
@@ -274,7 +274,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
/**
|
||||
* Ensures that module type deletion request to API on an entity that does not exist results in NOT_FOUND.
|
||||
*/
|
||||
@Test public void deleteSoftwareModuleTypeThatDoesNotExistLeadsToNotFound() throws Exception {
|
||||
@Test
|
||||
void deleteSoftwareModuleTypeThatDoesNotExistLeadsToNotFound() throws Exception {
|
||||
mvc.perform(delete("/rest/v1/softwaremoduletypes/1234"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNotFound());
|
||||
@@ -312,7 +313,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
/**
|
||||
* Checks the correct behaviour of /rest/v1/softwaremoduletypes/{ID} PUT requests.
|
||||
*/
|
||||
@Test public void updateSoftwareModuleTypeColourDescriptionAndNameUntouched() throws Exception {
|
||||
@Test
|
||||
void updateSoftwareModuleTypeColourDescriptionAndNameUntouched() throws Exception {
|
||||
final SoftwareModuleType testType = createTestType();
|
||||
|
||||
final String body = new JSONObject().put("id", testType.getId()).put("description", "foobardesc")
|
||||
@@ -333,7 +335,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
/**
|
||||
* Tests the update of the deletion flag. It is verfied that the software module type can't be marked as deleted through update operation.
|
||||
*/
|
||||
@Test public void updateSoftwareModuleTypeDeletedFlag() throws Exception {
|
||||
@Test
|
||||
void updateSoftwareModuleTypeDeletedFlag() throws Exception {
|
||||
SoftwareModuleType testType = createTestType();
|
||||
|
||||
final String body = new JSONObject().put("id", testType.getId()).put("deleted", true).toString();
|
||||
@@ -354,7 +357,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
/**
|
||||
* Checks the correct behaviour of /rest/v1/softwaremoduletypes GET requests with paging.
|
||||
*/
|
||||
@Test public void getSoftwareModuleTypesWithoutAddtionalRequestParameters() throws Exception {
|
||||
@Test
|
||||
void getSoftwareModuleTypesWithoutAddtionalRequestParameters() throws Exception {
|
||||
final int types = 3;
|
||||
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -367,7 +371,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
/**
|
||||
* Checks the correct behaviour of /rest/v1/softwaremoduletypes GET requests with paging.
|
||||
*/
|
||||
@Test public void getSoftwareModuleTypesWithPagingLimitRequestParameter() throws Exception {
|
||||
@Test
|
||||
void getSoftwareModuleTypesWithPagingLimitRequestParameter() throws Exception {
|
||||
final int types = 3;
|
||||
final int limitSize = 1;
|
||||
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING)
|
||||
@@ -382,7 +387,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
/**
|
||||
* Checks the correct behaviour of /rest/v1/softwaremoduletypes GET requests with paging.
|
||||
*/
|
||||
@Test public void getSoftwareModuleTypesWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||
@Test
|
||||
void getSoftwareModuleTypesWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||
final int types = 3;
|
||||
final int offsetParam = 2;
|
||||
final int expectedSize = types - offsetParam;
|
||||
@@ -399,7 +405,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
/**
|
||||
* Ensures that the server is behaving as expected on invalid requests (wrong media type, wrong ID etc.).
|
||||
*/
|
||||
@Test public void invalidRequestsOnSoftwaremoduleTypesResource() throws Exception {
|
||||
@Test
|
||||
void invalidRequestsOnSoftwaremoduleTypesResource() throws Exception {
|
||||
final SoftwareModuleType testType = createTestType();
|
||||
|
||||
final List<SoftwareModuleType> types = Collections.singletonList(testType);
|
||||
@@ -460,7 +467,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
/**
|
||||
* Search erquest of software module types.
|
||||
*/
|
||||
@Test public void searchSoftwareModuleTypeRsql() throws Exception {
|
||||
@Test
|
||||
void searchSoftwareModuleTypeRsql() throws Exception {
|
||||
softwareModuleTypeManagement.create(entityFactory.softwareModuleType().create().key("test123")
|
||||
.name("TestName123").description("Desc123").maxAssignments(5));
|
||||
softwareModuleTypeManagement.create(entityFactory.softwareModuleType().create().key("test1234")
|
||||
|
||||
@@ -94,7 +94,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Handles the GET request of retrieving all target filter queries within SP.
|
||||
*/
|
||||
@Test public void getTargetFilterQueries() throws Exception {
|
||||
@Test
|
||||
void getTargetFilterQueries() throws Exception {
|
||||
final String filterName = "filter_01";
|
||||
createSingleTargetFilterQuery(filterName, "name==test_01");
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING))
|
||||
@@ -105,7 +106,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Handles the GET request of retrieving all target filter queries within SP based by parameter. Required Permission: READ_TARGET.
|
||||
*/
|
||||
@Test public void getTargetFilterQueriesWithParameters() throws Exception {
|
||||
@Test
|
||||
void getTargetFilterQueriesWithParameters() throws Exception {
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "?limit=10&sort=name:ASC&offset=0&q=name==*1"))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(MockMvcResultPrinter.print());
|
||||
@@ -114,7 +116,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Handles the POST request of creating a new target filter query within SP.
|
||||
*/
|
||||
@Test public void createTargetFilterQuery() throws Exception {
|
||||
@Test
|
||||
void createTargetFilterQuery() throws Exception {
|
||||
final String name = "test_02";
|
||||
final String filterQuery = "name==test_02";
|
||||
final String body = new JSONObject()
|
||||
@@ -130,7 +133,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Ensures that deletion is executed if permitted.
|
||||
*/
|
||||
@Test public void deleteTargetFilterQueryReturnsOK() throws Exception {
|
||||
@Test
|
||||
void deleteTargetFilterQueryReturnsOK() throws Exception {
|
||||
final String filterName = "filter_01";
|
||||
final TargetFilterQuery filterQuery = createSingleTargetFilterQuery(filterName, "name==test_01");
|
||||
|
||||
@@ -143,7 +147,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Ensures that deletion is refused with not found if target does not exist.
|
||||
*/
|
||||
@Test public void deleteTargetWhichDoesNotExistsLeadsToEntityNotFound() throws Exception {
|
||||
@Test
|
||||
void deleteTargetWhichDoesNotExistsLeadsToEntityNotFound() throws Exception {
|
||||
final String notExistingId = "4395";
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + notExistingId))
|
||||
@@ -153,7 +158,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Ensures that update is refused with not found if target does not exist.
|
||||
*/
|
||||
@Test public void updateTargetWhichDoesNotExistsLeadsToEntityNotFound() throws Exception {
|
||||
@Test
|
||||
void updateTargetWhichDoesNotExistsLeadsToEntityNotFound() throws Exception {
|
||||
final String notExistingId = "4395";
|
||||
mvc.perform(put(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + notExistingId).content("{}")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
@@ -164,7 +170,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Ensures that update request is reflected by repository.
|
||||
*/
|
||||
@Test public void updateTargetFilterQueryQuery() throws Exception {
|
||||
@Test
|
||||
void updateTargetFilterQueryQuery() throws Exception {
|
||||
final String filterName = "filter_02";
|
||||
final String filterQuery = "name==test_02";
|
||||
final String filterQuery2 = "name==test_02_changed";
|
||||
@@ -190,7 +197,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Ensures that update request is reflected by repository.
|
||||
*/
|
||||
@Test public void updateTargetFilterQueryName() throws Exception {
|
||||
@Test
|
||||
void updateTargetFilterQueryName() throws Exception {
|
||||
final String filterName = "filter_03";
|
||||
final String filterName2 = "filter_03_changed";
|
||||
final String filterQuery = "name==test_03";
|
||||
@@ -217,7 +225,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Ensures that request returns list of filters in defined format.
|
||||
*/
|
||||
@Test public void getTargetFilterQueryWithoutAdditionalRequestParameters() throws Exception {
|
||||
@Test
|
||||
void getTargetFilterQueryWithoutAdditionalRequestParameters() throws Exception {
|
||||
final int knownTargetAmount = 3;
|
||||
final String idA = "a";
|
||||
final String idB = "b";
|
||||
@@ -248,7 +257,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Ensures that request returns list of filters in defined format in size reduced by given limit parameter.
|
||||
*/
|
||||
@Test public void getTargetWithPagingLimitRequestParameter() throws Exception {
|
||||
@Test
|
||||
void getTargetWithPagingLimitRequestParameter() throws Exception {
|
||||
final int limitSize = 1;
|
||||
final int knownTargetAmount = 3;
|
||||
final String idA = "a";
|
||||
@@ -317,7 +327,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Ensures that request returns list of filters in defined format in size reduced by given limit and offset parameter.
|
||||
*/
|
||||
@Test public void getTargetWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||
@Test
|
||||
void getTargetWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||
final int knownTargetAmount = 5;
|
||||
final int offsetParam = 2;
|
||||
final int expectedSize = knownTargetAmount - offsetParam;
|
||||
@@ -354,7 +365,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Ensures that a single target filter query can be retrieved via its id.
|
||||
*/
|
||||
@Test public void getSingleTarget() throws Exception {
|
||||
@Test
|
||||
void getSingleTarget() throws Exception {
|
||||
// create first a target which can be retrieved by rest interface
|
||||
final String knownQuery = "name==test01";
|
||||
final String knownName = "someName";
|
||||
@@ -375,7 +387,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Ensures that the retrieval of a non-existing target filter query results in a HTTP Not found error (404).
|
||||
*/
|
||||
@Test public void getSingleTargetNoExistsResponseNotFound() throws Exception {
|
||||
@Test
|
||||
void getSingleTargetNoExistsResponseNotFound() throws Exception {
|
||||
final String targetIdNotExists = "546546";
|
||||
// test
|
||||
|
||||
@@ -393,7 +406,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Ensures that the creation of a target filter query based on an invalid request payload results in a HTTP Bad Request error (400).
|
||||
*/
|
||||
@Test public void createTargetFilterQueryWithBadPayloadBadRequest() throws Exception {
|
||||
@Test
|
||||
void createTargetFilterQueryWithBadPayloadBadRequest() throws Exception {
|
||||
final String notJson = "abc";
|
||||
|
||||
final MvcResult mvcResult = mvc
|
||||
@@ -415,7 +429,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Ensures that the creation of a target filter query based on an invalid RSQL query results in a HTTP Bad Request error (400).
|
||||
*/
|
||||
@Test public void createTargetFilterWithInvalidQuery() throws Exception {
|
||||
@Test
|
||||
void createTargetFilterWithInvalidQuery() throws Exception {
|
||||
final String invalidQuery = "name=abc";
|
||||
final String body = new JSONObject().put("query", invalidQuery).put("name", "invalidFilter").toString();
|
||||
|
||||
@@ -524,7 +539,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Handles the GET request of retrieving a the auto assign distribution set of a target filter query within SP.
|
||||
*/
|
||||
@Test public void getAssignDS() throws Exception {
|
||||
@Test
|
||||
void getAssignDS() throws Exception {
|
||||
final TargetFilterQuery filterQuery = createSingleTargetFilterQuery("filter_01", "name==test_01");
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("ds");
|
||||
targetFilterQueryManagement
|
||||
@@ -540,7 +556,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Handles the POST request of setting a distribution set for auto assignment within SP.
|
||||
*/
|
||||
@Test public void createAutoAssignDS() throws Exception {
|
||||
@Test
|
||||
void createAutoAssignDS() throws Exception {
|
||||
enableMultiAssignments();
|
||||
enableConfirmationFlow();
|
||||
|
||||
@@ -560,7 +577,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Handles the DELETE request of deleting the auto assign distribution set from a target filter query within SP.
|
||||
*/
|
||||
@Test public void deleteAutoAssignDS() throws Exception {
|
||||
@Test
|
||||
void deleteAutoAssignDS() throws Exception {
|
||||
final String filterName = "filter_01";
|
||||
final TargetFilterQuery filterQuery = createSingleTargetFilterQuery(filterName, "name==test_01");
|
||||
mvc
|
||||
@@ -574,7 +592,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* Ensures that the deletion of auto-assignment distribution set works as intended, deleting the auto-assignment action type as well
|
||||
*/
|
||||
@Test public void deleteAutoAssignDistributionSetOfTargetFilterQuery() throws Exception {
|
||||
@Test
|
||||
void deleteAutoAssignDistributionSetOfTargetFilterQuery() throws Exception {
|
||||
final String knownQuery = "name==test06";
|
||||
final String knownName = "filter06";
|
||||
final String dsName = "testDS";
|
||||
@@ -610,7 +629,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
/**
|
||||
* An auto assignment containing a weight is only accepted when weight is valide and multi assignment is on.
|
||||
*/
|
||||
@Test public void weightValidation() throws Exception {
|
||||
@Test
|
||||
void weightValidation() throws Exception {
|
||||
final Long filterId = createSingleTargetFilterQuery("filter1", "name==*").getId();
|
||||
final Long dsId = testdataFactory.createDistributionSet().getId();
|
||||
|
||||
|
||||
@@ -148,7 +148,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that when targetType value of -1 is provided the target type is unassigned from the target.
|
||||
*/
|
||||
@Test void updateTargetAndUnassignTargetType() throws Exception {
|
||||
@Test
|
||||
void updateTargetAndUnassignTargetType() throws Exception {
|
||||
final String knownControllerId = "123";
|
||||
final String knownNewAddress = "amqp://test123/foobar";
|
||||
final String knownNameNotModify = "controllerName";
|
||||
@@ -186,7 +187,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that when targetType value of -1 is provided the target type is unassigned from the target when updating multiple fields in target object.
|
||||
*/
|
||||
@Test void updateTargetNameAndUnassignTargetType() throws Exception {
|
||||
@Test
|
||||
void updateTargetNameAndUnassignTargetType() throws Exception {
|
||||
final String knownControllerId = "123";
|
||||
final String knownNewAddress = "amqp://test123/foobar";
|
||||
final String knownNameNotModify = "controllerName";
|
||||
@@ -227,7 +229,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Handles the GET request of retrieving all targets within SP..
|
||||
*/
|
||||
@Test void getTargets() throws Exception {
|
||||
@Test
|
||||
void getTargets() throws Exception {
|
||||
enableConfirmationFlow();
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING))
|
||||
.andExpect(status().isOk())
|
||||
@@ -237,7 +240,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Handles the GET request of retrieving all targets within SP based by parameter.
|
||||
*/
|
||||
@Test void getTargetsWithParameters() throws Exception {
|
||||
@Test
|
||||
void getTargetsWithParameters() throws Exception {
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "?limit=10&sort=name:ASC&offset=0&q=name==a"))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(MockMvcResultPrinter.print());
|
||||
@@ -246,7 +250,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Handles the POST request to activate auto-confirm on a target. Payload can be provided to specify more details about the operation.
|
||||
*/
|
||||
@Test void postActivateAutoConfirm() throws Exception {
|
||||
@Test
|
||||
void postActivateAutoConfirm() throws Exception {
|
||||
final Target testTarget = testdataFactory.createTarget("targetId");
|
||||
|
||||
final MgmtTargetAutoConfirmUpdate body = new MgmtTargetAutoConfirmUpdate("custom_initiator_value",
|
||||
@@ -262,7 +267,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Handles the POST request to deactivate auto-confirm on a target.
|
||||
*/
|
||||
@Test void postDeactivateAutoConfirm() throws Exception {
|
||||
@Test
|
||||
void postDeactivateAutoConfirm() throws Exception {
|
||||
final Target testTarget = testdataFactory.createTarget("targetId");
|
||||
confirmationManagement.activateAutoConfirmation(testTarget.getControllerId(), null, null);
|
||||
|
||||
@@ -275,7 +281,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Test confirmation of single Action with confirm status. Check that Action goes into Running status with appropriate messages and status code
|
||||
*/
|
||||
@Test void updateActionConfirmationWithConfirm() throws Exception {
|
||||
@Test
|
||||
void updateActionConfirmationWithConfirm() throws Exception {
|
||||
final int expectedStatusCode = 210;
|
||||
final String expectedStatusMessage1 = "some-custom-message1";
|
||||
final String expectedStatusMessage2 = "some-custom-message2";
|
||||
@@ -287,7 +294,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Test confirmation of single Action with deny status. Check that Action stays in WAIT_FOR_CONFIRMATION status with appropriate messages and status code
|
||||
*/
|
||||
@Test void updateActionConfirmationWithDeny() throws Exception {
|
||||
@Test
|
||||
void updateActionConfirmationWithDeny() throws Exception {
|
||||
final int expectedStatusCode = 410;
|
||||
final String expectedStatusMessage1 = "some-error-custom-message1";
|
||||
final String expectedStatusMessage2 = "some-error-custom-message2";
|
||||
@@ -299,7 +307,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Test confirmation of single Action with wrong ControllerId - e.g. the given Action is not assigned to the given Target - confirmation call must fail.
|
||||
*/
|
||||
@Test void updateActionConfirmationFailsIfActionNotAssignedToTarget() throws Exception {
|
||||
@Test
|
||||
void updateActionConfirmationFailsIfActionNotAssignedToTarget() throws Exception {
|
||||
final int payloadCallCode = 200;
|
||||
final String payloadCallMessage1 = "random1";
|
||||
final String payloadCallMessage2 = "random2";
|
||||
@@ -373,7 +382,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that actions list is in expected order.
|
||||
*/
|
||||
@Test void getActionStatusReturnsCorrectType() throws Exception {
|
||||
@Test
|
||||
void getActionStatusReturnsCorrectType() throws Exception {
|
||||
final int limitSize = 2;
|
||||
final String knownTargetId = "targetId";
|
||||
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
|
||||
@@ -405,7 +415,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that security token is not returned if user does not have READ_TARGET_SEC_TOKEN permission.
|
||||
*/
|
||||
@Test @WithUser(allSpPermissions = false, authorities = { SpPermission.READ_TARGET, SpPermission.CREATE_TARGET })
|
||||
@Test
|
||||
@WithUser(allSpPermissions = false, authorities = { SpPermission.READ_TARGET, SpPermission.CREATE_TARGET })
|
||||
void securityTokenIsNotInResponseIfMissingPermission() throws Exception {
|
||||
|
||||
final String knownControllerId = "knownControllerId";
|
||||
@@ -419,7 +430,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that security token is returned if user does have READ_TARGET_SEC_TOKEN permission.
|
||||
*/
|
||||
@Test @WithUser(allSpPermissions = false, authorities = { SpPermission.READ_TARGET, SpPermission.CREATE_TARGET,
|
||||
@Test
|
||||
@WithUser(allSpPermissions = false, authorities = { SpPermission.READ_TARGET, SpPermission.CREATE_TARGET,
|
||||
SpPermission.READ_TARGET_SEC_TOKEN })
|
||||
void securityTokenIsInResponseWithCorrectPermission() throws Exception {
|
||||
|
||||
@@ -434,7 +446,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that that IP address is in result as stored in the repository.
|
||||
*/
|
||||
@Test void addressAndIpAddressInTargetResult() throws Exception {
|
||||
@Test
|
||||
void addressAndIpAddressInTargetResult() throws Exception {
|
||||
// prepare targets with IP
|
||||
final String knownControllerId1 = "0815";
|
||||
final String knownControllerId2 = "4711";
|
||||
@@ -461,7 +474,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that actions history is returned as defined by filter status==pending,status==finished.
|
||||
*/
|
||||
@Test void searchActionsRsql() throws Exception {
|
||||
@Test
|
||||
void searchActionsRsql() throws Exception {
|
||||
|
||||
// prepare test
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
@@ -503,7 +517,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a deletion of an active action results in cancellation triggered.
|
||||
*/
|
||||
@Test void cancelActionOK() throws Exception {
|
||||
@Test
|
||||
void cancelActionOK() throws Exception {
|
||||
// prepare test
|
||||
final Target tA = createTargetAndStartAction();
|
||||
|
||||
@@ -531,7 +546,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that method not allowed is returned if cancellation is triggered on already canceled action.
|
||||
*/
|
||||
@Test void cancelAndCancelActionIsNotAllowed() throws Exception {
|
||||
@Test
|
||||
void cancelAndCancelActionIsNotAllowed() throws Exception {
|
||||
// prepare test
|
||||
final Target tA = createTargetAndStartAction();
|
||||
|
||||
@@ -554,7 +570,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Force Quit an Action, which is already canceled. Expected Result is an HTTP response code 204.
|
||||
*/
|
||||
@Test void forceQuitAnCanceledActionReturnsOk() throws Exception {
|
||||
@Test
|
||||
void forceQuitAnCanceledActionReturnsOk() throws Exception {
|
||||
|
||||
final Target tA = createTargetAndStartAction();
|
||||
|
||||
@@ -578,7 +595,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Force Quit an Action, which is not canceled. Expected Result is an HTTP response code 405.
|
||||
*/
|
||||
@Test void forceQuitAnNotCanceledActionReturnsMethodNotAllowed() throws Exception {
|
||||
@Test
|
||||
void forceQuitAnNotCanceledActionReturnsMethodNotAllowed() throws Exception {
|
||||
|
||||
final Target tA = createTargetAndStartAction();
|
||||
|
||||
@@ -594,7 +612,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that deletion is executed if permitted.
|
||||
*/
|
||||
@Test void deleteTargetReturnsOK() throws Exception {
|
||||
@Test
|
||||
void deleteTargetReturnsOK() throws Exception {
|
||||
final String knownControllerId = "knownControllerIdDelete";
|
||||
testdataFactory.createTarget(knownControllerId);
|
||||
|
||||
@@ -607,7 +626,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that deletion is refused with not found if target does not exist.
|
||||
*/
|
||||
@Test void deleteTargetWhichDoesNotExistsLeadsToNotFound() throws Exception {
|
||||
@Test
|
||||
void deleteTargetWhichDoesNotExistsLeadsToNotFound() throws Exception {
|
||||
final String knownControllerId = "knownControllerIdDelete";
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + knownControllerId))
|
||||
@@ -617,7 +637,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that update is refused with not found if target does not exist.
|
||||
*/
|
||||
@Test void updateTargetWhichDoesNotExistsLeadsToNotFound() throws Exception {
|
||||
@Test
|
||||
void updateTargetWhichDoesNotExistsLeadsToNotFound() throws Exception {
|
||||
final String knownControllerId = "knownControllerIdUpdate";
|
||||
mvc.perform(put(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + knownControllerId).content("{}")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
@@ -628,7 +649,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that target update request is reflected by repository.
|
||||
*/
|
||||
@Test void updateTargetDescription() throws Exception {
|
||||
@Test
|
||||
void updateTargetDescription() throws Exception {
|
||||
final String knownControllerId = "123";
|
||||
final String knownNewDescription = "a new desc updated over rest";
|
||||
final String knownNameNotModify = "nameNotModify";
|
||||
@@ -654,7 +676,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that target update request fails is updated value fails against a constraint.
|
||||
*/
|
||||
@Test void updateTargetDescriptionFailsIfInvalidLength() throws Exception {
|
||||
@Test
|
||||
void updateTargetDescriptionFailsIfInvalidLength() throws Exception {
|
||||
final String knownControllerId = "123";
|
||||
final String knownNewDescription = randomString(513);
|
||||
final String knownNameNotModify = "nameNotModify";
|
||||
@@ -676,7 +699,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that target update request is reflected by repository.
|
||||
*/
|
||||
@Test void updateTargetSecurityToken() throws Exception {
|
||||
@Test
|
||||
void updateTargetSecurityToken() throws Exception {
|
||||
final String knownControllerId = "123";
|
||||
final String knownNewToken = "6567576565";
|
||||
final String knownNameNotModify = "nameNotModify";
|
||||
@@ -702,7 +726,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that target update request is reflected by repository.
|
||||
*/
|
||||
@Test void updateTargetAddress() throws Exception {
|
||||
@Test
|
||||
void updateTargetAddress() throws Exception {
|
||||
final String knownControllerId = "123";
|
||||
final String knownNewAddress = "amqp://test123/foobar";
|
||||
final String knownNameNotModify = "nameNotModify";
|
||||
@@ -728,7 +753,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that target query returns list of targets in defined format.
|
||||
*/
|
||||
@Test void getTargetWithoutAdditionalRequestParameters() throws Exception {
|
||||
@Test
|
||||
void getTargetWithoutAdditionalRequestParameters() throws Exception {
|
||||
final int knownTargetAmount = 3;
|
||||
final String idA = "a";
|
||||
final String idB = "b";
|
||||
@@ -773,7 +799,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that target query returns list of targets in defined format in size reduced by given limit parameter.
|
||||
*/
|
||||
@Test void getTargetWithPagingLimitRequestParameter() throws Exception {
|
||||
@Test
|
||||
void getTargetWithPagingLimitRequestParameter() throws Exception {
|
||||
final int knownTargetAmount = 3;
|
||||
final int limitSize = 1;
|
||||
createTargetsAlphabetical(knownTargetAmount);
|
||||
@@ -800,7 +827,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that target query returns list of targets in defined format in size reduced by given limit and offset parameter.
|
||||
*/
|
||||
@Test void getTargetWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||
@Test
|
||||
void getTargetWithPagingLimitAndOffsetRequestParameter() throws Exception {
|
||||
final int knownTargetAmount = 5;
|
||||
final int offsetParam = 2;
|
||||
final int expectedSize = knownTargetAmount - offsetParam;
|
||||
@@ -847,7 +875,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that the get request for a target works.
|
||||
*/
|
||||
@Test void getSingleTarget() throws Exception {
|
||||
@Test
|
||||
void getSingleTarget() throws Exception {
|
||||
// create first a target which can be retrieved by rest interface
|
||||
final String knownControllerId = "1";
|
||||
final String knownName = "someName";
|
||||
@@ -873,7 +902,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that target get request returns a not found if the target does not exits.
|
||||
*/
|
||||
@Test void getSingleTargetNoExistsResponseNotFound() throws Exception {
|
||||
@Test
|
||||
void getSingleTargetNoExistsResponseNotFound() throws Exception {
|
||||
|
||||
final String targetIdNotExists = "bubu";
|
||||
|
||||
@@ -892,7 +922,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that get request for asigned distribution sets returns no count if no distribution set has been assigned.
|
||||
*/
|
||||
@Test void getAssignedDistributionSetOfTargetIsEmpty() throws Exception {
|
||||
@Test
|
||||
void getAssignedDistributionSetOfTargetIsEmpty() throws Exception {
|
||||
// create first a target which can be retrieved by rest interface
|
||||
final String knownControllerId = "1";
|
||||
final String knownName = "someName";
|
||||
@@ -908,7 +939,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that the get request for asigned distribution sets works.
|
||||
*/
|
||||
@Test void getAssignedDistributionSetOfTarget() throws Exception {
|
||||
@Test
|
||||
void getAssignedDistributionSetOfTarget() throws Exception {
|
||||
// create first a target which can be retrieved by rest interface
|
||||
final String knownControllerId = "1";
|
||||
final String knownName = "someName";
|
||||
@@ -967,7 +999,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that get request for installed distribution sets returns no count if no distribution set has been installed.
|
||||
*/
|
||||
@Test void getInstalledDistributionSetOfTargetIsEmpty() throws Exception {
|
||||
@Test
|
||||
void getInstalledDistributionSetOfTargetIsEmpty() throws Exception {
|
||||
// create first a target which can be retrieved by rest interface
|
||||
final String knownControllerId = "1";
|
||||
final String knownName = "someName";
|
||||
@@ -981,7 +1014,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a target creation with empty name and a controllerId that exceeds the name length limitation is successful and the name gets truncated.
|
||||
*/
|
||||
@Test void createTargetWithEmptyNameAndLongControllerId() throws Exception {
|
||||
@Test
|
||||
void createTargetWithEmptyNameAndLongControllerId() throws Exception {
|
||||
final String randomString = randomString(JpaTarget.CONTROLLER_ID_MAX_SIZE);
|
||||
|
||||
final Target target = entityFactory.target().create().controllerId(randomString).build();
|
||||
@@ -1003,7 +1037,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that post request for creating a target with no payload returns a bad request.
|
||||
*/
|
||||
@Test void createTargetWithoutPayloadBadRequest() throws Exception {
|
||||
@Test
|
||||
void createTargetWithoutPayloadBadRequest() throws Exception {
|
||||
|
||||
final MvcResult mvcResult = mvc
|
||||
.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING).contentType(MediaType.APPLICATION_JSON))
|
||||
@@ -1023,7 +1058,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that post request for creating a target with invalid payload returns a bad request.
|
||||
*/
|
||||
@Test void createTargetWithBadPayloadBadRequest() throws Exception {
|
||||
@Test
|
||||
void createTargetWithBadPayloadBadRequest() throws Exception {
|
||||
final String notJson = "abc";
|
||||
|
||||
final MvcResult mvcResult = mvc
|
||||
@@ -1045,7 +1081,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that a mandatory properties of new targets are validated as not null.
|
||||
*/
|
||||
@Test void createTargetWithMissingMandatoryPropertyBadRequest() throws Exception {
|
||||
@Test
|
||||
void createTargetWithMissingMandatoryPropertyBadRequest() throws Exception {
|
||||
final MvcResult mvcResult = mvc
|
||||
.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING).content("[{\"name\":\"id1\"}]")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
@@ -1065,7 +1102,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that a properties of new targets are validated as in allowed size range.
|
||||
*/
|
||||
@Test void createTargetWithInvalidPropertyBadRequest() throws Exception {
|
||||
@Test
|
||||
void createTargetWithInvalidPropertyBadRequest() throws Exception {
|
||||
final Target test1 = entityFactory.target().create().controllerId("id1")
|
||||
.name(randomString(NamedEntity.NAME_MAX_SIZE + 1)).build();
|
||||
|
||||
@@ -1089,7 +1127,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a post request for creating multiple targets works.
|
||||
*/
|
||||
@Test void createTargetsListReturnsSuccessful() throws Exception {
|
||||
@Test
|
||||
void createTargetsListReturnsSuccessful() throws Exception {
|
||||
final Target test1 = entityFactory.target().create().controllerId("id1").name("testname1")
|
||||
.securityToken("token").address("amqp://test123/foobar").description("testid1").build();
|
||||
final Target test2 = entityFactory.target().create().controllerId("id2").name("testname2")
|
||||
@@ -1143,7 +1182,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a post request for creating one target within a list works.
|
||||
*/
|
||||
@Test void createTargetsSingleEntryListReturnsSuccessful() throws Exception {
|
||||
@Test
|
||||
void createTargetsSingleEntryListReturnsSuccessful() throws Exception {
|
||||
final String knownName = "someName";
|
||||
final String knownControllerId = "controllerId1";
|
||||
final String knownDescription = "someDescription";
|
||||
@@ -1165,7 +1205,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a post request for creating the same target again leads to a conflict response.
|
||||
*/
|
||||
@Test void createTargetsSingleEntryListDoubleReturnConflict() throws Exception {
|
||||
@Test
|
||||
void createTargetsSingleEntryListDoubleReturnConflict() throws Exception {
|
||||
final String knownName = "someName";
|
||||
final String knownControllerId = "controllerId1";
|
||||
final String knownDescription = "someDescription";
|
||||
@@ -1198,7 +1239,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that the get request for action of a target returns no actions if nothing has happened.
|
||||
*/
|
||||
@Test void getActionWithEmptyResult() throws Exception {
|
||||
@Test
|
||||
void getActionWithEmptyResult() throws Exception {
|
||||
final String knownTargetId = "targetId";
|
||||
testdataFactory.createTarget(knownTargetId);
|
||||
|
||||
@@ -1214,7 +1256,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that the expected response is returned for update action.
|
||||
*/
|
||||
@Test void getUpdateAction() throws Exception {
|
||||
@Test
|
||||
void getUpdateAction() throws Exception {
|
||||
final String knownTargetId = "targetId";
|
||||
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
|
||||
|
||||
@@ -1238,7 +1281,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that the expected response is returned for update action with maintenance window.
|
||||
*/
|
||||
@Test void getUpdateActionWithMaintenanceWindow() throws Exception {
|
||||
@Test
|
||||
void getUpdateActionWithMaintenanceWindow() throws Exception {
|
||||
final String knownTargetId = "targetId";
|
||||
final String schedule = getTestSchedule(10);
|
||||
final String duration = getTestDuration(10);
|
||||
@@ -1270,7 +1314,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that the expected response is returned when update action was cancelled.
|
||||
*/
|
||||
@Test void getCancelAction() throws Exception {
|
||||
@Test
|
||||
void getCancelAction() throws Exception {
|
||||
final String knownTargetId = "targetId";
|
||||
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
|
||||
|
||||
@@ -1294,7 +1339,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that the expected response is returned when update action with maintenance window was cancelled.
|
||||
*/
|
||||
@Test void getCancelActionWithMaintenanceWindow() throws Exception {
|
||||
@Test
|
||||
void getCancelActionWithMaintenanceWindow() throws Exception {
|
||||
final String knownTargetId = "targetId";
|
||||
final String schedule = getTestSchedule(10);
|
||||
final String duration = getTestDuration(10);
|
||||
@@ -1326,21 +1372,24 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that the expected response of getting actions of a target is returned.
|
||||
*/
|
||||
@Test void getActions() throws Exception {
|
||||
@Test
|
||||
void getActions() throws Exception {
|
||||
getActions(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that the expected response of getting actions (with ext refs) of a target is returned.
|
||||
*/
|
||||
@Test void getActionsExtRef() throws Exception {
|
||||
@Test
|
||||
void getActionsExtRef() throws Exception {
|
||||
getActions(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that the expected response of getting actions with maintenance window of a target is returned.
|
||||
*/
|
||||
@Test void getActionsWithMaintenanceWindow() throws Exception {
|
||||
@Test
|
||||
void getActionsWithMaintenanceWindow() throws Exception {
|
||||
final String knownTargetId = "targetId";
|
||||
final String schedule = getTestSchedule(10);
|
||||
final String duration = getTestDuration(10);
|
||||
@@ -1380,7 +1429,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that the API returns the status list with expected content.
|
||||
*/
|
||||
@Test void getActionsStatus() throws Exception {
|
||||
@Test
|
||||
void getActionsStatus() throws Exception {
|
||||
final String knownTargetId = "targetId";
|
||||
final Action action = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId).get(0);
|
||||
// retrieve list in default descending order for actionstaus entries
|
||||
@@ -1410,7 +1460,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that the API returns the status list with expected content sorted by reportedAt field.
|
||||
*/
|
||||
@Test void getActionsStatusSortedByReportedAt() throws Exception {
|
||||
@Test
|
||||
void getActionsStatusSortedByReportedAt() throws Exception {
|
||||
final String knownTargetId = "targetId";
|
||||
final Action action = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId).get(0);
|
||||
final List<ActionStatus> actionStatus = deploymentManagement.findActionStatusByAction(action.getId(), PAGE)
|
||||
@@ -1459,7 +1510,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that the API returns the status list with expected content split into two pages.
|
||||
*/
|
||||
@Test void getActionsStatusWithPagingLimitRequestParameter() throws Exception {
|
||||
@Test
|
||||
void getActionsStatusWithPagingLimitRequestParameter() throws Exception {
|
||||
final String knownTargetId = "targetId";
|
||||
|
||||
final Action action = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId).get(0);
|
||||
@@ -1502,7 +1554,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies getting multiple actions with the paging request parameter.
|
||||
*/
|
||||
@Test void getActionsWithPagingLimitRequestParameter() throws Exception {
|
||||
@Test
|
||||
void getActionsWithPagingLimitRequestParameter() throws Exception {
|
||||
final String knownTargetId = "targetId";
|
||||
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
|
||||
|
||||
@@ -1544,7 +1597,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that an action is switched from soft to forced if requested by management API
|
||||
*/
|
||||
@Test void updateAction() throws Exception {
|
||||
@Test
|
||||
void updateAction() throws Exception {
|
||||
final Target target = testdataFactory.createTarget();
|
||||
final DistributionSet set = testdataFactory.createDistributionSet();
|
||||
final Long actionId = getFirstAssignedActionId(
|
||||
@@ -1652,7 +1706,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that a DOWNLOAD_ONLY DS to target assignment is properly handled
|
||||
*/
|
||||
@Test void assignDownloadOnlyDistributionSetToTarget() throws Exception {
|
||||
@Test
|
||||
void assignDownloadOnlyDistributionSetToTarget() throws Exception {
|
||||
final Target target = testdataFactory.createTarget();
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("one");
|
||||
|
||||
@@ -1736,7 +1791,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Assigns distribution set to target with only maintenance schedule.
|
||||
*/
|
||||
@Test void assignDistributionSetToTargetWithMaintenanceWindowStartTimeOnly() throws Exception {
|
||||
@Test
|
||||
void assignDistributionSetToTargetWithMaintenanceWindowStartTimeOnly() throws Exception {
|
||||
|
||||
final Target target = testdataFactory.createTarget("fsdfsd");
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("one");
|
||||
@@ -1753,7 +1809,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Assigns distribution set to target with only maintenance window duration.
|
||||
*/
|
||||
@Test void assignDistributionSetToTargetWithMaintenanceWindowEndTimeOnly() throws Exception {
|
||||
@Test
|
||||
void assignDistributionSetToTargetWithMaintenanceWindowEndTimeOnly() throws Exception {
|
||||
|
||||
final Target target = testdataFactory.createTarget("fsdfsd");
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("one");
|
||||
@@ -1770,7 +1827,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Assigns distribution set to target with valid maintenance window.
|
||||
*/
|
||||
@Test void assignDistributionSetToTargetWithValidMaintenanceWindow() throws Exception {
|
||||
@Test
|
||||
void assignDistributionSetToTargetWithValidMaintenanceWindow() throws Exception {
|
||||
|
||||
final Target target = testdataFactory.createTarget("fsdfsd");
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("one");
|
||||
@@ -1789,7 +1847,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Assigns distribution set to target with maintenance window next execution start (should be ignored, calculated automaticaly based on schedule, duration and timezone)
|
||||
*/
|
||||
@Test void assignDistributionSetToTargetWithMaintenanceWindowNextExecutionStart() throws Exception {
|
||||
@Test
|
||||
void assignDistributionSetToTargetWithMaintenanceWindowNextExecutionStart() throws Exception {
|
||||
|
||||
final Target target = testdataFactory.createTarget("fsdfsd");
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("one");
|
||||
@@ -1815,7 +1874,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Assigns distribution set to target with last maintenance window scheduled before current time.
|
||||
*/
|
||||
@Test void assignDistributionSetToTargetWithMaintenanceWindowEndTimeBeforeStartTime() throws Exception {
|
||||
@Test
|
||||
void assignDistributionSetToTargetWithMaintenanceWindowEndTimeBeforeStartTime() throws Exception {
|
||||
|
||||
final Target target = testdataFactory.createTarget("fsdfsd");
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("one");
|
||||
@@ -1974,7 +2034,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Request update of Controller Attributes.
|
||||
*/
|
||||
@Test void triggerControllerAttributesUpdate() throws Exception {
|
||||
@Test
|
||||
void triggerControllerAttributesUpdate() throws Exception {
|
||||
// create target with attributes
|
||||
final String knownTargetId = "targetIdNeedsUpdate";
|
||||
final Map<String, String> knownControllerAttrs = new HashMap<>();
|
||||
@@ -2038,7 +2099,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that the metadata creation through API is reflected by the repository.
|
||||
*/
|
||||
@Test void createMetadata() throws Exception {
|
||||
@Test
|
||||
void createMetadata() throws Exception {
|
||||
final String knownControllerId = "targetIdWithMetadata";
|
||||
testdataFactory.createTarget(knownControllerId);
|
||||
|
||||
@@ -2082,7 +2144,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a metadata update through API is reflected by the repository.
|
||||
*/
|
||||
@Test void updateMetadata() throws Exception {
|
||||
@Test
|
||||
void updateMetadata() throws Exception {
|
||||
final String knownControllerId = "targetIdWithMetadata";
|
||||
final String updateValue = "valueForUpdate";
|
||||
|
||||
@@ -2103,7 +2166,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a metadata entry deletion through API is reflected by the repository.
|
||||
*/
|
||||
@Test void deleteMetadata() throws Exception {
|
||||
@Test
|
||||
void deleteMetadata() throws Exception {
|
||||
final String knownControllerId = "targetIdWithMetadata";
|
||||
|
||||
setupTargetWithMetadata(knownControllerId, KNOWN_KEY, KNOWN_VALUE);
|
||||
@@ -2123,7 +2187,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that target metadata deletion request to API on an entity that does not exist results in NOT_FOUND.
|
||||
*/
|
||||
@Test void deleteMetadataThatDoesNotExistLeadsToNotFound() throws Exception {
|
||||
@Test
|
||||
void deleteMetadataThatDoesNotExistLeadsToNotFound() throws Exception {
|
||||
final String knownControllerId = "targetIdWithMetadata";
|
||||
|
||||
setupTargetWithMetadata(knownControllerId, KNOWN_KEY, KNOWN_VALUE);
|
||||
@@ -2142,7 +2207,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a metadata entry selection through API reflects the repository content.
|
||||
*/
|
||||
@Test void getMetadataKey() throws Exception {
|
||||
@Test
|
||||
void getMetadataKey() throws Exception {
|
||||
final String knownControllerId = "targetIdWithMetadata";
|
||||
|
||||
setupTargetWithMetadata(knownControllerId, KNOWN_KEY, KNOWN_VALUE);
|
||||
@@ -2157,7 +2223,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a metadata entry paged list selection through API reflectes the repository content.
|
||||
*/
|
||||
@Test void getMetadata() throws Exception {
|
||||
@Test
|
||||
void getMetadata() throws Exception {
|
||||
final String knownControllerId = "targetIdWithMetadata";
|
||||
|
||||
final int totalMetadata = 10;
|
||||
@@ -2194,7 +2261,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* A request for assigning multiple DS to a target results in a Bad Request when multiassignment in disabled.
|
||||
*/
|
||||
@Test void multiAssignmentRequestNotAllowedIfDisabled() throws Exception {
|
||||
@Test
|
||||
void multiAssignmentRequestNotAllowedIfDisabled() throws Exception {
|
||||
final String targetId = testdataFactory.createTarget().getControllerId();
|
||||
final List<Long> dsIds = testdataFactory.createDistributionSets(2).stream().map(DistributionSet::getId)
|
||||
.toList();
|
||||
@@ -2211,7 +2279,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Passing an array in assignment request is allowed if multiassignment is disabled and array size in 1.
|
||||
*/
|
||||
@Test void multiAssignmentRequestAllowedIfDisabledButHasSizeOne() throws Exception {
|
||||
@Test
|
||||
void multiAssignmentRequestAllowedIfDisabledButHasSizeOne() throws Exception {
|
||||
final String targetId = testdataFactory.createTarget().getControllerId();
|
||||
final Long dsId = testdataFactory.createDistributionSet().getId();
|
||||
|
||||
@@ -2225,7 +2294,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Identical assignments in a single request are removed when multiassignment in disabled.
|
||||
*/
|
||||
@Test void identicalAssignmentInRequestAreRemovedIfMultiassignmentsDisabled() throws Exception {
|
||||
@Test
|
||||
void identicalAssignmentInRequestAreRemovedIfMultiassignmentsDisabled() throws Exception {
|
||||
final String targetId = testdataFactory.createTarget().getControllerId();
|
||||
final Long dsId = testdataFactory.createDistributionSet().getId();
|
||||
|
||||
@@ -2242,7 +2312,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Assign multiple DSs to a target in one request with multiassignments enabled.
|
||||
*/
|
||||
@Test void multiAssignment() throws Exception {
|
||||
@Test
|
||||
void multiAssignment() throws Exception {
|
||||
final String targetId = testdataFactory.createTarget().getControllerId();
|
||||
final List<Long> dsIds = testdataFactory.createDistributionSets(2).stream().map(DistributionSet::getId)
|
||||
.toList();
|
||||
@@ -2261,7 +2332,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* An assignment request containing a weight is only accepted when weight is valid and multi assignment is on.
|
||||
*/
|
||||
@Test void weightValidation() throws Exception {
|
||||
@Test
|
||||
void weightValidation() throws Exception {
|
||||
final String targetId = testdataFactory.createTarget().getControllerId();
|
||||
final Long dsId = testdataFactory.createDistributionSet().getId();
|
||||
final int weight = 98;
|
||||
@@ -2288,7 +2360,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* An assignment request containing a valid weight when multi assignment is off.
|
||||
*/
|
||||
@Test void weightWithSingleAssignment() throws Exception {
|
||||
@Test
|
||||
void weightWithSingleAssignment() throws Exception {
|
||||
final String targetId = testdataFactory.createTarget().getControllerId();
|
||||
final Long dsId = testdataFactory.createDistributionSet().getId();
|
||||
|
||||
@@ -2303,7 +2376,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* An assignment request containing a valid weight when multi assignment is on.
|
||||
*/
|
||||
@Test void weightWithMultiAssignment() throws Exception {
|
||||
@Test
|
||||
void weightWithMultiAssignment() throws Exception {
|
||||
final String targetId = testdataFactory.createTarget().getControllerId();
|
||||
final Long dsId = testdataFactory.createDistributionSet().getId();
|
||||
final int weight = 98;
|
||||
@@ -2324,7 +2398,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Get weight of action
|
||||
*/
|
||||
@Test void getActionWeight() throws Exception {
|
||||
@Test
|
||||
void getActionWeight() throws Exception {
|
||||
final String targetId = testdataFactory.createTarget().getControllerId();
|
||||
final Long dsId = testdataFactory.createDistributionSet().getId();
|
||||
final int customWeightHigh = 800;
|
||||
@@ -2346,7 +2421,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* An action provides information of the rollout it was created for (if any).
|
||||
*/
|
||||
@Test void getActionWithRolloutInfo() throws Exception {
|
||||
@Test
|
||||
void getActionWithRolloutInfo() throws Exception {
|
||||
|
||||
// setup
|
||||
final int amountTargets = 10;
|
||||
@@ -2384,7 +2460,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a post request for creating targets with target type works.
|
||||
*/
|
||||
@Test void createTargetsWithTargetType() throws Exception {
|
||||
@Test
|
||||
void createTargetsWithTargetType() throws Exception {
|
||||
final TargetType type1 = testdataFactory.createTargetType("typeWithDs",
|
||||
Collections.singletonList(standardDsType));
|
||||
final TargetType type2 = testdataFactory.createTargetType("typeWithOutDs",
|
||||
@@ -2454,7 +2531,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a post request for creating target with target type works.
|
||||
*/
|
||||
@Test void createTargetWithExistingTargetType() throws Exception {
|
||||
@Test
|
||||
void createTargetWithExistingTargetType() throws Exception {
|
||||
// create target type
|
||||
final List<TargetType> targetTypes = testdataFactory.createTargetTypes("targettype", 1);
|
||||
assertThat(targetTypes).hasSize(1);
|
||||
@@ -2478,7 +2556,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a put request for updating targets with target type works.
|
||||
*/
|
||||
@Test void updateTargetTypeInTarget() throws Exception {
|
||||
@Test
|
||||
void updateTargetTypeInTarget() throws Exception {
|
||||
// create target type
|
||||
final List<TargetType> targetTypes = testdataFactory.createTargetTypes("targettype", 2);
|
||||
assertThat(targetTypes).hasSize(2);
|
||||
@@ -2502,7 +2581,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a post request for creating targets with unknown target type fails.
|
||||
*/
|
||||
@Test void addingNonExistingTargetTypeInTargetShouldFail() throws Exception {
|
||||
@Test
|
||||
void addingNonExistingTargetTypeInTargetShouldFail() throws Exception {
|
||||
final long unknownTargetTypeId = 999;
|
||||
final String errorMsg = String.format("TargetType with given identifier {%s} does not exist.",
|
||||
unknownTargetTypeId);
|
||||
@@ -2525,7 +2605,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a post request for assign target type to target works.
|
||||
*/
|
||||
@Test void assignTargetTypeToTarget() throws Exception {
|
||||
@Test
|
||||
void assignTargetTypeToTarget() throws Exception {
|
||||
// create target type
|
||||
final TargetType targetType = testdataFactory.findOrCreateTargetType("targettype");
|
||||
assertThat(targetType).isNotNull();
|
||||
@@ -2548,7 +2629,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a post request for assign a invalid target type to target fails.
|
||||
*/
|
||||
@Test void assignInvalidTargetTypeToTargetFails() throws Exception {
|
||||
@Test
|
||||
void assignInvalidTargetTypeToTargetFails() throws Exception {
|
||||
// Invalid target type ID
|
||||
final long invalidTargetTypeId = 999;
|
||||
|
||||
@@ -2582,7 +2664,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that a delete request for unassign target type from target works.
|
||||
*/
|
||||
@Test void unassignTargetTypeFromTarget() throws Exception {
|
||||
@Test
|
||||
void unassignTargetTypeFromTarget() throws Exception {
|
||||
// create target type
|
||||
final List<TargetType> targetTypes = testdataFactory.createTargetTypes("targettype", 1);
|
||||
assertThat(targetTypes).hasSize(1);
|
||||
@@ -2745,7 +2828,8 @@ class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Verifies that the status code that was reported in the last action status update is correctly exposed via the action.
|
||||
*/
|
||||
@Test void lastActionStatusCode() throws Exception {
|
||||
@Test
|
||||
void lastActionStatusCode() throws Exception {
|
||||
|
||||
// prepare test
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
|
||||
@@ -62,7 +62,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Verifies that a paged result list of target tags reflects the content on the repository side.
|
||||
*/
|
||||
@Test @ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
|
||||
@Test
|
||||
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
|
||||
public void getTargetTags() throws Exception {
|
||||
final List<TargetTag> tags = testdataFactory.createTargetTags(2, "");
|
||||
final TargetTag assigned = tags.get(0);
|
||||
@@ -85,7 +86,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Handles the GET request of retrieving all targets tags within SP based by parameter
|
||||
*/
|
||||
@Test public void getTargetTagsWithParameters() throws Exception {
|
||||
@Test
|
||||
void getTargetTagsWithParameters() throws Exception {
|
||||
testdataFactory.createTargetTags(2, "");
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "?limit=10&sort=name:ASC&offset=0&q=name==targetTag"))
|
||||
.andExpect(status().isOk())
|
||||
@@ -95,7 +97,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Verifies that a page result when listing tags reflects on the content in the repository when filtered by 2 fields - one tag field and one target field
|
||||
*/
|
||||
@Test public void getTargetTagsFilteredByColor() throws Exception {
|
||||
@Test
|
||||
void getTargetTagsFilteredByColor() throws Exception {
|
||||
final String controllerId1 = "controllerTestId1";
|
||||
final String controllerId2 = "controllerTestId2";
|
||||
testdataFactory.createTarget(controllerId1);
|
||||
@@ -126,7 +129,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Verifies that a single result of a target tag reflects the content on the repository side.
|
||||
*/
|
||||
@Test @ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
|
||||
@Test
|
||||
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
|
||||
public void getTargetTag() throws Exception {
|
||||
final List<TargetTag> tags = testdataFactory.createTargetTags(2, "");
|
||||
final TargetTag assigned = tags.get(0);
|
||||
@@ -146,7 +150,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Verifies that created target tags are stored in the repository as send to the API.
|
||||
*/
|
||||
@Test @ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
|
||||
@Test
|
||||
@ExpectEvents({ @Expect(type = TargetTagCreatedEvent.class, count = 2) })
|
||||
public void createTargetTags() throws Exception {
|
||||
final Tag tagOne = entityFactory.tag().create().colour("testcol1").description("its a test1").name("thetest1")
|
||||
.build();
|
||||
@@ -177,7 +182,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Verifies that an updated target tag is stored in the repository as send to the API.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetTagUpdatedEvent.class, count = 1) })
|
||||
public void updateTargetTag() throws Exception {
|
||||
@@ -207,7 +213,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Verifies that the delete call is reflected by the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetTagDeletedEvent.class, count = 1) })
|
||||
public void deleteTargetTag() throws Exception {
|
||||
@@ -224,7 +231,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Ensures that assigned targets to tag in repository are listed with proper paging results.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 5),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 5) })
|
||||
@@ -245,7 +253,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Ensures that assigned DS to tag in repository are listed with proper paging results with paging limit parameter.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 5),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 5) })
|
||||
@@ -268,7 +277,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Ensures that assigned targets to tag in repository are listed with proper paging results with paging limit and offset parameter.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 5),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 5) })
|
||||
@@ -294,7 +304,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Verifies that tag assignments done through tag API command are correctly stored in the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 1) })
|
||||
@@ -314,7 +325,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 2),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 2) })
|
||||
@@ -338,7 +350,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 2) })
|
||||
public void assignTargetsNotFound() throws Exception {
|
||||
@@ -378,7 +391,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 2),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 2) })
|
||||
@@ -421,7 +435,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 2),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 2) })
|
||||
@@ -455,7 +470,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Verifies that tag unassignments done through tag API command are correctly stored in the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 2),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 3) })
|
||||
@@ -480,7 +496,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Verifies that tag unassignments (multi targets) done through tag API command are correctly stored in the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 3),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 5) })
|
||||
@@ -507,7 +524,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 2),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 2) })
|
||||
@@ -551,7 +569,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 2),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 4) })
|
||||
@@ -595,7 +614,8 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
/**
|
||||
* Verifies that tag assignments (multi targets) done through tag API command are correctly stored in the repository.
|
||||
*/
|
||||
@Test @ExpectEvents({
|
||||
@Test
|
||||
@ExpectEvents({
|
||||
@Expect(type = TargetTagCreatedEvent.class, count = 1),
|
||||
@Expect(type = TargetCreatedEvent.class, count = 2),
|
||||
@Expect(type = TargetUpdatedEvent.class, count = 4) })
|
||||
|
||||
@@ -503,7 +503,8 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Ensures that the server is behaving as expected on invalid requests (wrong media type, wrong ID etc.).
|
||||
*/
|
||||
@Test void invalidRequestsOnTargetTypesResource() throws Exception {
|
||||
@Test
|
||||
void invalidRequestsOnTargetTypesResource() throws Exception {
|
||||
String typeName = "TestTypeInvalidReq";
|
||||
final TargetType testType = createTestTargetTypeInDB(typeName, Collections.singletonList(standardDsType));
|
||||
|
||||
@@ -604,7 +605,8 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
/**
|
||||
* Search request of target types.
|
||||
*/
|
||||
@Test void searchTargetTypeRsql() throws Exception {
|
||||
@Test
|
||||
void searchTargetTypeRsql() throws Exception {
|
||||
targetTypeManagement.create(entityFactory.targetType().create().name("TestName123"));
|
||||
targetTypeManagement.create(entityFactory.targetType().create().name("TestName1234"));
|
||||
|
||||
|
||||
@@ -51,7 +51,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
/**
|
||||
* Handles GET request for receiving all tenant specific configurations.
|
||||
*/
|
||||
@Test public void getTenantConfigurations() throws Exception {
|
||||
@Test
|
||||
void getTenantConfigurations() throws Exception {
|
||||
mvc.perform(get(MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -64,7 +65,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
/**
|
||||
* Handles GET request for receiving a tenant specific configuration.
|
||||
*/
|
||||
@Test public void getTenantConfiguration() throws Exception {
|
||||
@Test
|
||||
void getTenantConfiguration() throws Exception {
|
||||
//Test TenantConfiguration property
|
||||
mvc.perform(get(MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}",
|
||||
TenantConfigurationProperties.TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY))
|
||||
@@ -75,7 +77,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
/**
|
||||
* Handles GET request for receiving (TenantMetadata - DefaultDsType) a tenant specific configuration.
|
||||
*/
|
||||
@Test public void getTenantMetadata() throws Exception {
|
||||
@Test
|
||||
void getTenantMetadata() throws Exception {
|
||||
//Test TenantMetadata property
|
||||
mvc.perform(get(MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}",
|
||||
DEFAULT_DISTRIBUTION_SET_TYPE_KEY))
|
||||
@@ -87,7 +90,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
/**
|
||||
* Handles PUT request for settings values in tenant specific configuration.
|
||||
*/
|
||||
@Test public void putTenantConfiguration() throws Exception {
|
||||
@Test
|
||||
void putTenantConfiguration() throws Exception {
|
||||
final MgmtSystemTenantConfigurationValueRequest bodyPut = new MgmtSystemTenantConfigurationValueRequest();
|
||||
bodyPut.setValue("exampleToken");
|
||||
final ObjectMapper mapper = new ObjectMapper();
|
||||
@@ -103,7 +107,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
/**
|
||||
* Handles PUT request for settings values (TenantMetadata - DefaultDsType) in tenant specific configuration, which is TenantMetadata
|
||||
*/
|
||||
@Test public void putTenantMetadata() throws Exception {
|
||||
@Test
|
||||
void putTenantMetadata() throws Exception {
|
||||
final MgmtSystemTenantConfigurationValueRequest bodyPut = new MgmtSystemTenantConfigurationValueRequest();
|
||||
|
||||
long updatedTestDefaultDsType = createTestDistributionSetType();
|
||||
@@ -126,7 +131,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
/**
|
||||
* Update DefaultDistributionSetType Fails if given DistributionSetType ID does not exist.
|
||||
*/
|
||||
@Test public void putTenantMetadataFails() throws Exception {
|
||||
@Test
|
||||
void putTenantMetadataFails() throws Exception {
|
||||
long oldDefaultDsType = getActualDefaultDsType();
|
||||
//try an invalid input
|
||||
String newDefaultDsType = new JSONObject().put("value", true).toString();
|
||||
@@ -142,7 +148,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
/**
|
||||
* The 'multi.assignments.enabled' property must not be changed to false.
|
||||
*/
|
||||
@Test public void deactivateMultiAssignment() throws Exception {
|
||||
@Test
|
||||
void deactivateMultiAssignment() throws Exception {
|
||||
final String bodyActivate = new JSONObject().put("value", true).toString();
|
||||
final String bodyDeactivate = new JSONObject().put("value", false).toString();
|
||||
|
||||
@@ -160,7 +167,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
/**
|
||||
* The Batch configuration should not be applied, because of invalid TenantConfiguration props
|
||||
*/
|
||||
@Test public void changeBatchConfigurationShouldFailOnInvalidTenantConfiguration() throws Exception {
|
||||
@Test
|
||||
void changeBatchConfigurationShouldFailOnInvalidTenantConfiguration() throws Exception {
|
||||
//in this scenario
|
||||
// some TenantConfiguration are not valid,
|
||||
// TenantMetadata - DefaultDSType ID is valid,
|
||||
@@ -176,7 +184,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
/**
|
||||
* The Batch configuration should not be applied, because of invalid TenantMetadata (DefaultDistributionSetType)
|
||||
*/
|
||||
@Test public void changeBatchConfigurationShouldOnInvalidTenantMetadata() throws Exception {
|
||||
@Test
|
||||
void changeBatchConfigurationShouldOnInvalidTenantMetadata() throws Exception {
|
||||
//in this scenario
|
||||
// all TenantConfiguration have valid and new values - using old values, inverted
|
||||
// TenantMetadata - DefaultDSType ID is invalid
|
||||
@@ -208,7 +217,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
/**
|
||||
* The Batch configuration should be applied
|
||||
*/
|
||||
@Test public void changeBatchConfiguration() throws Exception {
|
||||
@Test
|
||||
void changeBatchConfiguration() throws Exception {
|
||||
long updatedDistributionSetType = createTestDistributionSetType();
|
||||
boolean updatedRolloutApprovalEnabled = true;
|
||||
boolean updatedAuthGatewayTokenEnabled = true;
|
||||
@@ -242,7 +252,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
/**
|
||||
* The 'repository.actions.autoclose.enabled' property must not be modified if Multi-Assignments is enabled.
|
||||
*/
|
||||
@Test public void autoCloseCannotBeModifiedIfMultiAssignmentIsEnabled() throws Exception {
|
||||
@Test
|
||||
void autoCloseCannotBeModifiedIfMultiAssignmentIsEnabled() throws Exception {
|
||||
final String bodyActivate = new JSONObject().put("value", true).toString();
|
||||
final String bodyDeactivate = new JSONObject().put("value", false).toString();
|
||||
|
||||
@@ -268,7 +279,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
/**
|
||||
* Handles DELETE request deleting a tenant specific configuration.
|
||||
*/
|
||||
@Test public void deleteTenantConfiguration() throws Exception {
|
||||
@Test
|
||||
void deleteTenantConfiguration() throws Exception {
|
||||
mvc.perform(delete(MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}",
|
||||
TenantConfigurationProperties.TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -278,7 +290,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
/**
|
||||
* Tests DELETE request must Fail for TenantMetadata properties.
|
||||
*/
|
||||
@Test public void deleteTenantMetadataFail() throws Exception {
|
||||
@Test
|
||||
void deleteTenantMetadataFail() throws Exception {
|
||||
mvc.perform(delete(MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}",
|
||||
DEFAULT_DISTRIBUTION_SET_TYPE_KEY))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -288,7 +301,8 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
/**
|
||||
* Handles GET request for receiving all tenant specific configurations depending on read gateway token permissions.
|
||||
*/
|
||||
@Test void getTenantConfigurationReadGWToken() throws Exception {
|
||||
@Test
|
||||
void getTenantConfigurationReadGWToken() throws Exception {
|
||||
SecurityContextSwitch.runAs(SecurityContextSwitch.withUser("tenant_admin", SpPermission.TENANT_CONFIGURATION), () -> {
|
||||
tenantConfigurationManagement.addOrUpdateConfiguration(
|
||||
TenantConfigurationProperties.TenantConfigurationKey.AUTHENTICATION_MODE_GATEWAY_SECURITY_TOKEN_KEY,
|
||||
|
||||
@@ -38,7 +38,8 @@ class SortUtilityTest {
|
||||
/**
|
||||
* Ascending sorting based on name.
|
||||
*/
|
||||
@Test void parseSortParam1() {
|
||||
@Test
|
||||
void parseSortParam1() {
|
||||
final List<Order> parse = SortUtility.parse(TargetFields.class, SORT_PARAM_1);
|
||||
assertThat(parse).as("Count of parsing parameter").hasSize(1);
|
||||
}
|
||||
@@ -46,7 +47,8 @@ class SortUtilityTest {
|
||||
/**
|
||||
* Ascending sorting based on name and descending sorting based on description.
|
||||
*/
|
||||
@Test void parseSortParam2() {
|
||||
@Test
|
||||
void parseSortParam2() {
|
||||
final List<Order> parse = SortUtility.parse(TargetFields.class, SORT_PARAM_2);
|
||||
assertThat(parse).as("Count of parsing parameter").hasSize(2);
|
||||
}
|
||||
@@ -54,7 +56,8 @@ class SortUtilityTest {
|
||||
/**
|
||||
* Sorting with wrong syntax leads to SortParameterSyntaxErrorException.
|
||||
*/
|
||||
@Test void parseWrongSyntaxParam() {
|
||||
@Test
|
||||
void parseWrongSyntaxParam() {
|
||||
assertThrows(SortParameterSyntaxErrorException.class,
|
||||
() -> SortUtility.parse(TargetFields.class, SYNTAX_FAILURE_SORT_PARAM));
|
||||
}
|
||||
@@ -62,7 +65,8 @@ class SortUtilityTest {
|
||||
/**
|
||||
* Sorting based on name with case sensitive is possible.
|
||||
*/
|
||||
@Test @SuppressWarnings("squid:S2699") // assert no error
|
||||
@Test
|
||||
@SuppressWarnings("squid:S2699") // assert no error
|
||||
void parsingIsNotCaseSensitive() {
|
||||
SortUtility.parse(TargetFields.class, CASE_INSENSITIVE_DIRECTION_PARAM);
|
||||
SortUtility.parse(TargetFields.class, CASE_INSENSITIVE_DIRECTION_PARAM_1);
|
||||
@@ -71,7 +75,8 @@ class SortUtilityTest {
|
||||
/**
|
||||
* Sorting with unknown direction order leads to SortParameterUnsupportedDirectionException.
|
||||
*/
|
||||
@Test void parseWrongDirectionParam() {
|
||||
@Test
|
||||
void parseWrongDirectionParam() {
|
||||
assertThrows(SortParameterUnsupportedDirectionException.class,
|
||||
() -> SortUtility.parse(TargetFields.class, WRONG_DIRECTION_PARAM));
|
||||
}
|
||||
@@ -79,7 +84,8 @@ class SortUtilityTest {
|
||||
/**
|
||||
* Sorting with unknown field leads to SortParameterUnsupportedFieldException.
|
||||
*/
|
||||
@Test void parseWrongFieldParam() {
|
||||
@Test
|
||||
void parseWrongFieldParam() {
|
||||
assertThrows(SortParameterUnsupportedFieldException.class,
|
||||
() -> SortUtility.parse(TargetFields.class, WRONG_FIELD_PARAM));
|
||||
}
|
||||
|
||||
@@ -28,21 +28,24 @@ class AllowedHostNamesTest extends AbstractSecurityTest {
|
||||
/**
|
||||
* Tests whether a RequestRejectedException is thrown when not allowed host is used
|
||||
*/
|
||||
@Test void allowedHostNameWithNotAllowedHost() throws Exception {
|
||||
@Test
|
||||
void allowedHostNameWithNotAllowedHost() throws Exception {
|
||||
mvc.perform(get("/").header(HttpHeaders.HOST, "www.google.com")).andExpect(status().isBadRequest());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether request is redirected when allowed host is used
|
||||
*/
|
||||
@Test void allowedHostNameWithAllowedHost() throws Exception {
|
||||
@Test
|
||||
void allowedHostNameWithAllowedHost() throws Exception {
|
||||
mvc.perform(get("/").header(HttpHeaders.HOST, "localhost")).andExpect(status().is3xxRedirection());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether request without allowed host name and with ignored path end up with a client error
|
||||
*/
|
||||
@Test void notAllowedHostnameWithIgnoredPath() throws Exception {
|
||||
@Test
|
||||
void notAllowedHostnameWithIgnoredPath() throws Exception {
|
||||
mvc.perform(get("/index.html").header(HttpHeaders.HOST, "www.google.com"))
|
||||
.andExpect(status().is4xxClientError());
|
||||
}
|
||||
|
||||
@@ -46,7 +46,8 @@ class CorsTest extends AbstractSecurityTest {
|
||||
/**
|
||||
* Ensures that Cors is working.
|
||||
*/
|
||||
@Test @WithUser(authorities = SpRole.TENANT_ADMIN, autoCreateTenant = false)
|
||||
@Test
|
||||
@WithUser(authorities = SpRole.TENANT_ADMIN, autoCreateTenant = false)
|
||||
void validateCorsRequest() throws Exception {
|
||||
performOptionsRequestToRestWithOrigin(ALLOWED_ORIGIN_FIRST).andExpect(status().isOk())
|
||||
.andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, ALLOWED_ORIGIN_FIRST));
|
||||
|
||||
@@ -30,7 +30,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
|
||||
/**
|
||||
* Tests whether request fail if a role is forbidden for the user
|
||||
*/
|
||||
@Test @WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
|
||||
@Test
|
||||
@WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
|
||||
void failIfNoRole() throws Exception {
|
||||
mvc.perform(get("/rest/v1/distributionsets")).andExpect(result ->
|
||||
assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.FORBIDDEN.value()));
|
||||
@@ -39,7 +40,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
|
||||
/**
|
||||
* Tests whether request succeed if a role is granted for the user
|
||||
*/
|
||||
@Test @WithUser(authorities = { SpPermission.READ_REPOSITORY }, autoCreateTenant = false)
|
||||
@Test
|
||||
@WithUser(authorities = { SpPermission.READ_REPOSITORY }, autoCreateTenant = false)
|
||||
void successIfHasRole() throws Exception {
|
||||
mvc.perform(get("/rest/v1/distributionsets")).andExpect(result ->
|
||||
assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value()));
|
||||
@@ -48,7 +50,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
|
||||
/**
|
||||
* Tests whether request succeed if a role is granted for the user
|
||||
*/
|
||||
@Test @WithUser(authorities = { SpRole.TENANT_ADMIN }, autoCreateTenant = false)
|
||||
@Test
|
||||
@WithUser(authorities = { SpRole.TENANT_ADMIN }, autoCreateTenant = false)
|
||||
void successIfHasTenantAdminRole() throws Exception {
|
||||
mvc.perform(get("/rest/v1/distributionsets")).andExpect(result ->
|
||||
assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value()));
|
||||
@@ -57,7 +60,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
|
||||
/**
|
||||
* Tests whether read tenant config request fail if a tenant config (or read read) is not granted for the user
|
||||
*/
|
||||
@Test @WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
|
||||
@Test
|
||||
@WithUser(authorities = { SpPermission.READ_TARGET }, autoCreateTenant = false)
|
||||
void onlyDSIfNoTenantConfig() throws Exception {
|
||||
mvc.perform(get("/rest/v1/system/configs")).andExpect(result -> {
|
||||
// returns default DS type because of READ_TARGET
|
||||
@@ -70,7 +74,8 @@ class PreAuthorizeEnabledTest extends AbstractSecurityTest {
|
||||
/**
|
||||
* Tests whether read tenant config request succeed if a tenant config (not read explicitly) is granted for the user
|
||||
*/
|
||||
@Test @WithUser(authorities = { SpPermission.TENANT_CONFIGURATION }, autoCreateTenant = false)
|
||||
@Test
|
||||
@WithUser(authorities = { SpPermission.TENANT_CONFIGURATION }, autoCreateTenant = false)
|
||||
void successIfHasTenantConfig() throws Exception {
|
||||
mvc.perform(get("/rest/v1/system/configs")).andExpect(result ->
|
||||
assertThat(result.getResponse().getStatus()).isEqualTo(HttpStatus.OK.value()));
|
||||
|
||||
Reference in New Issue
Block a user