Update Spring Boot to 2.3.2

-Update Spring Cloud to Hoxton.SR7
-Replace ResourceSupport by RepresentationModel (Spring Hateoas 1.0)
-Replace ControllerLinkBuilder by WebMvcLinkBuilder (Spring Hateoas 1.0)
-Move getId() from Identifiable to BaseEntity (Spring Hateoas 1.0)
-Remove hamcrest.Factory
-Use static Sort.by reference
-Place http security anyRequest().authenticated()
-Replace MockMvcRequestBuilders.fileUpload by MockMvcRequestBuilders.multipart
-Deprecate MEDIA_TYPE_CBOR_UTF8
-Replace MEDIA_TYPE_CBOR_UTF8 by MEDIA_TYPE_CBOR in tests
-Replace HAL_JSON_UTF8 by HAL_JSON in tests
-Replace APPLICATION_JSON_UTF8 by APPLICATION_JSON in tests
-Use org.mockito.junit.MockitoJUnitRunner
-Remove overridden dependency versions
-Removing not needed comments in pom.xml
-Downgrade flyway-core to be MySQL 5.6 compatible
-Add maven-site-plugin since it was removed with spring-boot 2.3
-Set servlet encoding properties
-Introducing Test that verifies the charset inside the content-type of a response
-Add @DirtiesContext to CorsTest and ContentTypeTest
-Add content-type mockmvc test with adapted mockmvc config
-Move encoding.force property to test class
-Switch expected and actual parameter values in content-type test
-Delete deprecated content-type test with TestRestTemplate
-Exclude JUnit5 from spring-boot-starter-test
-Upgrade allure-junit4 to 2.13.5
-Add aspectjweaver 1.9.6 to surefire test execution
-Add flyway-core version to property
-Use getRequiredLink() within MgmtBaseEntity.getId()

Signed-off-by: Ammar Bikic <ammar.bikic@bosch.io>
This commit is contained in:
Ammar Bikic
2020-01-30 13:44:25 +01:00
parent e6b5f480da
commit 28b65a290d
106 changed files with 664 additions and 419 deletions

View File

@@ -15,7 +15,7 @@
<parent>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-rest-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
<version>0.4.0-SNAPSHOT</version>
</parent>
<artifactId>hawkbit-rest-docs</artifactId>
<name>hawkbit :: REST :: Documentation</name>

View File

@@ -107,7 +107,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest
final String json = mapper.writeValueAsString(Arrays.asList(bodyPut));
this.mockMvc
.perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING).content(json)
.contentType(MediaType.APPLICATION_JSON_UTF8))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated()).andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(getRequestFieldsTag(true), getResponseFieldsTag(true)));
}
@@ -123,7 +123,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest
this.mockMvc
.perform(
put(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/{distributionsetTagId}", tagId)
.content(json).contentType(MediaType.APPLICATION_JSON_UTF8))
.content(json).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(
pathParameters(parameterWithName("distributionsetTagId")
@@ -146,7 +146,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest
final Long tagId = createDistributionSetTagId();
this.mockMvc
.perform(delete(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/{distributionsetTagId}",
tagId).contentType(MediaType.APPLICATION_JSON_UTF8))
tagId).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(pathParameters(
parameterWithName("distributionsetTagId").description(ApiModelPropertiesGeneric.ITEM_ID))));
@@ -162,7 +162,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest
this.mockMvc
.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING
+ MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING, tag.getId())
.contentType(MediaType.APPLICATION_JSON_UTF8))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(
pathParameters(parameterWithName("distributionsetTagId")
@@ -187,7 +187,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest
this.mockMvc
.perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING
+ MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING
+ "/toggleTagAssignment", tagId).content(json).contentType(MediaType.APPLICATION_JSON_UTF8))
+ "/toggleTagAssignment", tagId).content(json).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(
pathParameters(parameterWithName("distributionsetTagId")
@@ -210,7 +210,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest
this.mockMvc
.perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING
+ MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING, tagId).content(json)
.contentType(MediaType.APPLICATION_JSON_UTF8))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(
pathParameters(parameterWithName("distributionsetTagId")
@@ -227,7 +227,7 @@ public class DistributionSetTagResourceDocumentationTest extends AbstractApiRest
.perform(delete(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING
+ MgmtRestConstants.DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING
+ "/{distributionsetId}", tagId, distributionSet.getId())
.contentType(MediaType.APPLICATION_JSON_UTF8))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(pathParameters(
parameterWithName("distributionsetTagId").description(ApiModelPropertiesGeneric.ITEM_ID),

View File

@@ -71,7 +71,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
mockMvc.perform(
get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.total", equalTo(4)))
.andDo(this.document.document(responseFields(
fieldWithPath("size").type(JsonFieldType.NUMBER).description(ApiModelPropertiesGeneric.SIZE),
@@ -99,7 +99,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON)
.param("offset", "1").param("limit", "2").param("sort", "name:DESC").param("q", "name==a*"))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(this.document.document(getFilterRequestParamter()));
}
@@ -117,7 +117,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING)
.content(JsonBuilder.distributionSetTypesCreateValidFieldsOnly(types))
.contentType(MediaType.APPLICATION_JSON_UTF8).accept(MediaType.APPLICATION_JSON))
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated()).andDo(
this.document.document(
requestFields(
@@ -213,7 +213,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
this.mockMvc
.perform(put(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}",
testType.getId()).content(body).contentType(MediaType.APPLICATION_JSON_UTF8))
testType.getId()).content(body).contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andDo(this.document.document(
pathParameters(parameterWithName("distributionSetTypeId")
@@ -249,7 +249,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
+ "/{distributionSetTypeId}/mandatorymoduletypes", testType.getId()).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(this.document.document(
pathParameters(parameterWithName("distributionSetTypeId")
@@ -281,7 +281,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
+ "/{distributionSetTypeId}/mandatorymoduletypes", testType.getId())
.content("{\"id\":" + osType.getId() + "}").contentType(MediaType.APPLICATION_JSON_UTF8))
.content("{\"id\":" + osType.getId() + "}").contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andDo(this.document.document(
pathParameters(parameterWithName("distributionSetTypeId")
@@ -299,7 +299,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
mockMvc.perform(delete(
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
+ "/{distributionSetTypeId}/mandatorymoduletypes/{softwareModuleTypeId}",
testType.getId(), osType.getId()).contentType(MediaType.APPLICATION_JSON_UTF8))
testType.getId(), osType.getId()).contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andDo(this.document.document(pathParameters(
parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID),
@@ -317,7 +317,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
mockMvc.perform(get(
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
+ "/{distributionSetTypeId}/mandatorymoduletypes/{softwareModuleTypeId}",
testType.getId(), osType.getId()).contentType(MediaType.APPLICATION_JSON_UTF8))
testType.getId(), osType.getId()).contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andDo(this.document.document(pathParameters(
parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID),
@@ -346,7 +346,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
+ "/{distributionSetTypeId}/optionalmoduletypes", testType.getId()).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(this.document.document(
pathParameters(parameterWithName("distributionSetTypeId")
.description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -375,7 +375,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
entityFactory.distributionSetType().create().key("test1").name("TestName1").description("Desc1"));
mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
+ "/{distributionSetTypeId}/optionalmoduletypes", testType.getId())
.content("{\"id\":" + appType.getId() + "}").contentType(MediaType.APPLICATION_JSON_UTF8))
.content("{\"id\":" + appType.getId() + "}").contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andDo(this.document.document(
pathParameters(parameterWithName("distributionSetTypeId")
@@ -394,7 +394,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
mockMvc.perform(delete(
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
+ "/{distributionSetTypeId}/optionalmoduletypes/{softwareModuleTypeId}",
testType.getId(), appType.getId()).contentType(MediaType.APPLICATION_JSON_UTF8))
testType.getId(), appType.getId()).contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andDo(this.document.document(pathParameters(
parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID),
@@ -411,7 +411,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
mockMvc.perform(get(
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
+ "/{distributionSetTypeId}/optionalmoduletypes/{softwareModuleTypeId}",
testType.getId(), appType.getId()).contentType(MediaType.APPLICATION_JSON_UTF8))
testType.getId(), appType.getId()).contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andDo(this.document.document(pathParameters(
parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID),

View File

@@ -74,7 +74,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}", set.getId())
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(this.document.document(
pathParameters(
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -88,7 +88,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(this.document.document(responseFields(
fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS),
fieldWithPath("size").type(JsonFieldType.NUMBER).description(ApiModelPropertiesGeneric.SIZE),
@@ -125,7 +125,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING).param("offset", "1").param("limit", "2")
.param("sort", "version:DESC").param("q", "name==testDS*").accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(this.document.document(getFilterRequestParamter()));
}
@@ -164,7 +164,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
this.mockMvc
.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/")
.content(JsonBuilder.distributionSetsCreateValidFieldsOnly(sets))
.contentType(MediaType.APPLICATION_JSON_UTF8))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated()).andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(
requestFields(requestFieldWithPath("[]name").description(ApiModelPropertiesGeneric.NAME),
@@ -188,9 +188,9 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
mockMvc.perform(put(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}", set.getId())
.content(JsonBuilder.distributionSetUpdateValidFieldsOnly(update))
.contentType(MediaType.APPLICATION_JSON_UTF8).accept(MediaType.APPLICATION_JSON))
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(this.document.document(
pathParameters(
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -217,7 +217,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedTargets",
set.getId()).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(this.document.document(
pathParameters(
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -242,7 +242,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
mockMvc.perform(get(
MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/autoAssignTargetFilters",
set.getId()).accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(this.document.document(
pathParameters(
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -267,7 +267,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
.param("offset", "1").param("limit", "2").param("sort", "name:DESC").param("q", "name==*1")
.accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(this.document.document(requestParameters(
parameterWithName("limit").attributes(key("type").value("query"))
.description(ApiModelPropertiesGeneric.LIMIT),
@@ -291,7 +291,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
.param("offset", "1").param("limit", "2").param("sort", "name:DESC")
.param("q", "controllerId==target*").accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(this.document.document(requestParameters(
parameterWithName("limit").attributes(key("type").value("query"))
.description(ApiModelPropertiesGeneric.LIMIT),
@@ -317,7 +317,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
.param("offset", "1").param("limit", "2").param("sort", "name:DESC")
.param("q", "controllerId==target*").accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(this.document.document(requestParameters(
parameterWithName("limit").attributes(key("type").value("query"))
.description(ApiModelPropertiesGeneric.LIMIT),
@@ -342,7 +342,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/installedTargets",
set.getId()).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(this.document.document(
pathParameters(
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -376,7 +376,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
this.mockMvc
.perform(post(
MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedTargets",
set.getId()).content(list.toString()).contentType(MediaType.APPLICATION_JSON_UTF8))
set.getId()).content(list.toString()).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(
pathParameters(
@@ -432,7 +432,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
// post assignment
mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedSM",
disSet.getId()).contentType(MediaType.APPLICATION_JSON_UTF8).content(list.toString()))
disSet.getId()).contentType(MediaType.APPLICATION_JSON).content(list.toString()))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andDo(this.document.document(
pathParameters(
@@ -450,7 +450,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING
+ "/{distributionSetId}/assignedSM/{softwareModuleId}",
set.getId(), set.findFirstModuleByType(osType).get().getId())
.contentType(MediaType.APPLICATION_JSON_UTF8))
.contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andDo(this.document.document(pathParameters(
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID),
@@ -467,7 +467,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
// post assignment
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedSM",
set.getId()).accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(this.document.document(
pathParameters(
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -501,7 +501,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + set.getId() + "/assignedSM")
.param("offset", "1").param("limit", "2").param("sort", "version:DESC").param("q", "name==one*")
.accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(this.document.document(requestParameters(
parameterWithName("limit").attributes(key("type").value("query"))
.description(ApiModelPropertiesGeneric.LIMIT),
@@ -525,7 +525,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata",
testDS.getId())).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
pathParameters(
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -554,7 +554,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{dsId}/metadata", testDS.getId())
.param("offset", "1").param("limit", "2").param("sort", "key:DESC").param("q", "key==known*"))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
requestParameters(
parameterWithName("limit").attributes(key("type").value("query"))
@@ -610,7 +610,7 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
mockMvc.perform(put(
MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata/{metadatakey}",
testDS.getId(), knownKey).contentType(MediaType.APPLICATION_JSON_UTF8).content(jsonObject.toString()))
testDS.getId(), knownKey).contentType(MediaType.APPLICATION_JSON).content(jsonObject.toString()))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andDo(this.document.document(
pathParameters(
@@ -662,9 +662,9 @@ public class DistributionSetsDocumentationTest extends AbstractApiRestDocumentat
jsonArray.put(new JSONObject().put("key", knownKey2).put("value", knownValue2));
mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata",
testDS.getId()).contentType(MediaType.APPLICATION_JSON_UTF8).content(jsonArray.toString()))
testDS.getId()).contentType(MediaType.APPLICATION_JSON).content(jsonArray.toString()))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
pathParameters(
parameterWithName("distributionSetId").description(ApiModelPropertiesGeneric.ITEM_ID)),

View File

@@ -86,7 +86,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
mockMvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING).accept(MediaTypes.HAL_JSON_VALUE))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(getRolloutResponseFields(true, false,
fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS),
fieldWithPath("size").type(JsonFieldType.NUMBER).description(ApiModelPropertiesGeneric.SIZE),
@@ -102,7 +102,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
mockMvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING).param("offset", "0").param("limit", "2")
.param("sort", "id:DESC").param("q", "name==exampleRollout*").accept(MediaTypes.HAL_JSON_VALUE))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(getFilterRequestParamter()));
}
@@ -167,7 +167,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
mockMvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}", rollout.getId())
.accept(MediaTypes.HAL_JSON_VALUE)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(getRolloutResponseFields(false, true),
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID))));
}
@@ -195,9 +195,9 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
post(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING)
.content(JsonBuilder.rollout(name, description, groupSize, dsId, targetFilter,
rolloutGroupConditions, type))
.contentType(MediaTypes.HAL_JSON_UTF8).accept(MediaTypes.HAL_JSON_VALUE))
.contentType(MediaTypes.HAL_JSON).accept(MediaTypes.HAL_JSON_VALUE))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(requestFields(
requestFieldWithPath("name").description(ApiModelPropertiesGeneric.NAME),
requestFieldWithPathMandatoryInMultiAssignMode("weight").type(JsonFieldType.NUMBER)
@@ -285,7 +285,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
rolloutGroupConditions, rolloutGroups))
.contentType(MediaType.APPLICATION_JSON).accept(MediaTypes.HAL_JSON_VALUE))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
requestFields(requestFieldWithPath("name").description(ApiModelPropertiesGeneric.NAME),
requestFieldWithPathMandatoryInMultiAssignMode("weight")
@@ -448,7 +448,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
mockMvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups", rollout.getId())
.accept(MediaTypes.HAL_JSON_VALUE)).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
getRolloutDeployGroupResponseFields(true, false,
fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS),
@@ -469,7 +469,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
mockMvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups/{deployGroupId}",
rollout.getId(), firstRolloutGroup.getId()).accept(MediaTypes.HAL_JSON_VALUE))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(getRolloutDeployGroupResponseFields(false, true),
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID),
parameterWithName("deployGroupId").description(ApiModelPropertiesGeneric.ITEM_ID))));
@@ -557,7 +557,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
.param("sort", "id:DESC").param("q", "id==" + firstRolloutGroup.getId())
.accept(MediaTypes.HAL_JSON_VALUE))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID),
parameterWithName("deployGroupId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -576,7 +576,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups/{deployGroupId}/targets",
rollout.getId(), firstRolloutGroup.getId()).accept(MediaTypes.HAL_JSON_VALUE))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID),
parameterWithName("deployGroupId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -626,7 +626,7 @@ public class RolloutResourceDocumentationTest extends AbstractApiRestDocumentati
.param("sort", "name:ASC").param("q", "controllerId==exampleTarget0")
.accept(MediaTypes.HAL_JSON_VALUE))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
pathParameters(parameterWithName("rolloutId").description(ApiModelPropertiesGeneric.ITEM_ID),
parameterWithName("deployGroupId").description(ApiModelPropertiesGeneric.ITEM_ID)),

View File

@@ -110,7 +110,7 @@ public class SoftwaremoduleTypesDocumentationTest extends AbstractApiRestDocumen
this.mockMvc
.perform(post(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING)
.content(JsonBuilder.softwareModuleTypesCreatableFieldsOnly(types))
.contentType(MediaType.APPLICATION_JSON_UTF8).accept(MediaType.APPLICATION_JSON))
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(
requestFields(
@@ -194,7 +194,7 @@ public class SoftwaremoduleTypesDocumentationTest extends AbstractApiRestDocumen
this.mockMvc
.perform(put(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING + "/{softwareModuleTypeID}",
testType.getId()).content(body.toString()).contentType(MediaType.APPLICATION_JSON_UTF8))
testType.getId()).content(body.toString()).contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andDo(this.document.document(
pathParameters(parameterWithName("softwareModuleTypeID")

View File

@@ -78,7 +78,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
.update(entityFactory.softwareModule().update(sm2.getId()).description("a description"));
mockMvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING)).andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk()).andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(status().isOk()).andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(responseFields(
fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS),
fieldWithPath("size").type(JsonFieldType.NUMBER).description(ApiModelPropertiesGeneric.SIZE),
@@ -114,7 +114,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
.param("limit", "2").param("sort", "version:DESC").param("q", "name==SM*"))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(getFilterRequestParamter()));
}
@@ -130,9 +130,9 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
final List<SoftwareModule> modules = Arrays.asList(os, ah);
mockMvc.perform(post(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING)
.content(JsonBuilder.softwareModulesCreatableFieldsOnly(modules)).contentType(MediaTypes.HAL_JSON_UTF8))
.content(JsonBuilder.softwareModulesCreatableFieldsOnly(modules)).contentType(MediaTypes.HAL_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
requestFields(requestFieldWithPath("[]name").description(ApiModelPropertiesGeneric.NAME),
optionalRequestFieldWithPath("[]description")
@@ -179,7 +179,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
mockMvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}", sm.getId()))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
pathParameters(
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -211,9 +211,9 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
.vendor("another Vendor").description("a new description").type(Constants.SMT_DEFAULT_OS_KEY).build();
mockMvc.perform(put(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}", sm.getId())
.content(JsonBuilder.softwareModuleUpdatableFieldsOnly(update)).contentType(MediaTypes.HAL_JSON_UTF8))
.content(JsonBuilder.softwareModuleUpdatableFieldsOnly(update)).contentType(MediaTypes.HAL_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
pathParameters(
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -251,7 +251,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
mockMvc.perform(
get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts", sm.getId()))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
pathParameters(
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -282,11 +282,9 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
final byte random[] = RandomStringUtils.random(5).getBytes();
final MockMultipartFile file = new MockMultipartFile("file", "origFilename", null, random);
mockMvc.perform(
fileUpload(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts",
sm.getId()).file(file))
mockMvc.perform(fileUpload(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts", sm.getId()).file(file))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
pathParameters(
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -318,12 +316,11 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
final byte random[] = RandomStringUtils.random(5).getBytes();
final MockMultipartFile file = new MockMultipartFile("file", "origFilename", null, random);
mockMvc.perform(
fileUpload(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts",
mockMvc.perform(fileUpload(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts",
sm.getId()).file(file).param("filename", "filename").param("file", "s")
.param("md5sum", "md5sum").param("sha1sum", "sha1sum"))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andDo(this.document.document(requestParameters(
parameterWithName("filename").description(MgmtApiModelProperties.ARTIFACT_PROVIDED_FILENAME),
parameterWithName("file").description(MgmtApiModelProperties.ARTIFACT_PROVIDED_FILE),
@@ -365,7 +362,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts/{artifactId}",
sm.getId(), artifact.getId()))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
pathParameters(
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID),
@@ -424,7 +421,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
mockMvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata",
module.getId())).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
pathParameters(
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -456,7 +453,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
module.getId()).param("offset", "1").param("limit", "2").param("sort", "key:DESC").param("q",
"key==known*"))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
pathParameters(
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -485,9 +482,9 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
jsonArray.put(new JSONObject().put("key", knownKey2).put("value", knownValue2).put("targetVisible", true));
mockMvc.perform(post(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata",
module.getId()).contentType(MediaTypes.HAL_JSON_UTF8).content(jsonArray.toString()))
module.getId()).contentType(MediaTypes.HAL_JSON).content(jsonArray.toString()))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
pathParameters(
parameterWithName("softwareModuleId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -569,7 +566,7 @@ public class SoftwaremodulesDocumentationTest extends AbstractApiRestDocumentati
mockMvc.perform(
put(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata/{metadataKey}",
module.getId(), knownKey).contentType(MediaTypes.HAL_JSON_UTF8).content(jsonObject.toString()))
module.getId(), knownKey).contentType(MediaTypes.HAL_JSON).content(jsonObject.toString()))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andDo(this.document.document(
pathParameters(parameterWithName("softwareModuleId")

View File

@@ -124,7 +124,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
final String target = createTargetJsonForPostRequest("123456", "controllerId", "test");
mockMvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING)
.contentType(MediaType.APPLICATION_JSON_UTF8).content(target)).andExpect(status().isCreated())
.contentType(MediaType.APPLICATION_JSON).content(target)).andExpect(status().isCreated())
.andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(requestFields(
requestFieldWithPath("[]controllerId").description(ApiModelPropertiesGeneric.ITEM_ID),
@@ -183,7 +183,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
final String targetAsJson = createJsonTarget(targetId, "newTargetName", "I've been updated");
mockMvc.perform(put(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}", target.getControllerId())
.contentType(MediaType.APPLICATION_JSON_UTF8).content(targetAsJson)).andExpect(status().isOk())
.contentType(MediaType.APPLICATION_JSON).content(targetAsJson)).andExpect(status().isOk())
.andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -414,7 +414,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
mockMvc.perform(
put(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/" + MgmtRestConstants.TARGET_V1_ACTIONS
+ "/{actionId}", targetId, actionId).content(this.objectMapper.writeValueAsString(body))
.contentType(MediaType.APPLICATION_JSON_UTF8))
.contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andDo(this.document.document(
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID),
@@ -514,7 +514,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
mockMvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/"
+ MgmtRestConstants.TARGET_V1_ASSIGNED_DISTRIBUTION_SET, targetId).content(body)
.contentType(MediaType.APPLICATION_JSON_UTF8))
.contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andDo(this.document.document(
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -558,7 +558,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
enableMultiAssignments();
mockMvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/"
+ MgmtRestConstants.TARGET_V1_ASSIGNED_DISTRIBUTION_SET, targetId).content(body.toString())
.contentType(MediaType.APPLICATION_JSON_UTF8))
.contentType(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andDo(this.document.document(
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -649,7 +649,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
mockMvc.perform(
get(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata", testTarget.getControllerId()))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
responseFields(fieldWithPath("total").description(ApiModelPropertiesGeneric.TOTAL_ELEMENTS),
@@ -678,7 +678,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
get(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata", testTarget.getControllerId())
.param("offset", "1").param("limit", "2").param("sort", "key:DESC").param("q", "key==known*"))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
requestParameters(
parameterWithName("limit").attributes(key("type").value("query"))
@@ -732,7 +732,7 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
mockMvc.perform(put(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata/{metadatakey}",
testTarget.getControllerId(), knownKey)
.contentType(MediaType.APPLICATION_JSON_UTF8).content(jsonObject.toString()))
.contentType(MediaType.APPLICATION_JSON).content(jsonObject.toString()))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andDo(this.document.document(
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID),
@@ -782,9 +782,9 @@ public class TargetResourceDocumentationTest extends AbstractApiRestDocumentatio
mockMvc.perform(
post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata", testTarget.getControllerId())
.contentType(MediaType.APPLICATION_JSON_UTF8).content(jsonArray.toString()))
.contentType(MediaType.APPLICATION_JSON).content(jsonArray.toString()))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(content().contentType(MediaTypes.HAL_JSON))
.andDo(this.document.document(
pathParameters(parameterWithName("targetId").description(ApiModelPropertiesGeneric.ITEM_ID)),
requestFields(requestFieldWithPath("[]key").description(MgmtApiModelProperties.META_DATA_KEY),

View File

@@ -110,7 +110,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta
final String json = mapper.writeValueAsString(Arrays.asList(bodyPut));
this.mockMvc
.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING).content(json)
.contentType(MediaType.APPLICATION_JSON_UTF8))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated()).andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(getRequestFieldsTargetTag(true), getResponseFieldTargetTag(true)));
}
@@ -128,7 +128,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta
this.mockMvc
.perform(put(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/{targetTagId}", tagId).content(json)
.contentType(MediaType.APPLICATION_JSON_UTF8))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(
pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -142,7 +142,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta
final Long tagId = createTargetTagId();
this.mockMvc
.perform(delete(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/{targetTagId}", tagId)
.contentType(MediaType.APPLICATION_JSON_UTF8))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(pathParameters(
parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID))));
@@ -159,7 +159,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta
this.mockMvc
.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING
+ MgmtRestConstants.TARGET_TAG_TARGETS_REQUEST_MAPPING, tag.getId())
.contentType(MediaType.APPLICATION_JSON_UTF8))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(
pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -185,7 +185,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta
this.mockMvc
.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING
+ MgmtRestConstants.TARGET_TAG_TARGETS_REQUEST_MAPPING + "/toggleTagAssignment", tagId)
.content(json).contentType(MediaType.APPLICATION_JSON_UTF8))
.content(json).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(
pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -208,7 +208,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta
this.mockMvc
.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING
+ MgmtRestConstants.TARGET_TAG_TARGETS_REQUEST_MAPPING, tagId).content(json)
.contentType(MediaType.APPLICATION_JSON_UTF8))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(
pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID)),
@@ -225,7 +225,7 @@ public class TargetTagResourceDocumentationTest extends AbstractApiRestDocumenta
.perform(delete(
MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING
+ MgmtRestConstants.TARGET_TAG_TARGETS_REQUEST_MAPPING + "/{controllerId}",
tagId, target.getControllerId()).contentType(MediaType.APPLICATION_JSON_UTF8))
tagId, target.getControllerId()).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk()).andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(
pathParameters(parameterWithName("targetTagId").description(ApiModelPropertiesGeneric.ITEM_ID),