Colour property in Mgmt API response for DS/SM type (#1174)

* Update name SP to hawkbit in api guide adocs

Signed-off-by: Natalia Kislicyn <natalia.kislicyn@bosch.io>

* fix javadoc class descriptions of existing resource/api classes

Signed-off-by: Natalia Kislicyn <natalia.kislicyn@bosch.io>

* Add color property to api response of ds/sw type

Signed-off-by: Natalia Kislicyn <natalia.kislicyn@bosch.io>

* Add color property to sw type test data & adapt rest docu

Signed-off-by: Natalia Kislicyn <natalia.kislicyn@bosch.io>

* Add missing property description for "colour" and "deleted"

Signed-off-by: Natalia Kislicyn <natalia.kislicyn@bosch.io>

* fix review findings

Signed-off-by: Natalia Kislicyn <natalia.kislicyn@bosch.io>
This commit is contained in:
Natalia Kislicyn
2021-09-02 10:09:17 +02:00
committed by GitHub
parent 42b1fc9439
commit b5fcb48ab1
25 changed files with 176 additions and 119 deletions

View File

@@ -15,7 +15,7 @@ toc::[]
=== Implementation notes
Handles the GET request of retrieving all distribution sets within SP. Required permission: READ_REPOSITORY
Handles the GET request of retrieving all distribution sets within Hawkbit. Required permission: READ_REPOSITORY
=== Get paged list of Distribution Sets
@@ -62,7 +62,7 @@ include::../errors/429.adoc[]
== POST /rest/v1/distributionsets
=== Implementation Notes
Handles the POST request of creating new distribution sets within SP. The request body must always be a list of sets. Required permission: CREATE_REPOSITORY
Handles the POST request of creating new distribution sets within Hawkbit. The request body must always be a list of sets. Required permission: CREATE_REPOSITORY
=== Create Distribution Sets
@@ -111,7 +111,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the DELETE request for a single Distribution Set within SP. Required permission: DELETE_REPOSITORY
Handles the DELETE request for a single Distribution Set within Hawkbit. Required permission: DELETE_REPOSITORY
=== Delete Distribution Set
@@ -151,7 +151,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the GET request of retrieving a single distribution set within SP. Required permission: READ_REPOSITORY
Handles the GET request of retrieving a single distribution set within Hawkbit. Required permission: READ_REPOSITORY
=== Get Distribution Set
@@ -196,7 +196,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the UPDATE request for a single Distribution Set within SP. Required permission: UPDATE_REPOSITORY
Handles the UPDATE request for a single Distribution Set within Hawkbit. Required permission: UPDATE_REPOSITORY
=== Updating a Distribution Set
@@ -246,7 +246,7 @@ include::../errors/429.adoc[]
== GET /rest/v1/distributionsets/{distributionSetId}/assignedSM
=== Implementation Notes
Handles the GET request of retrieving a single distribution set within SP. Required permission: READ_REPOSITORY
Handles the GET request of retrieving a single distribution set within Hawkbit. Required permission: READ_REPOSITORY
=== Get assigned Software Modules

View File

@@ -15,7 +15,7 @@ toc::[]
=== Implementation notes
Handles the GET request of retrieving all distribution set types withinfGET /rest/v1/distributionsettypes SP. Required Permission: READ_REPOSITORY
Handles the GET request of retrieving all distribution set types within Hawkbit. Required Permission: READ_REPOSITORY
=== Get distribution set types
@@ -63,7 +63,7 @@ include::../errors/429.adoc[]
=== Implementation notes
Handles the POST request for creating new distribution set types within SP. The request body must always be a list of types. Required Permission: CREATE_REPOSITORY
Handles the POST request for creating new distribution set types within Hawkbit. The request body must always be a list of types. Required Permission: CREATE_REPOSITORY
=== Create distribution set types
@@ -114,7 +114,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the DELETE request for a single distribution set type within SP. Required Permission: DELETE_REPOSITORY
Handles the DELETE request for a single distribution set type within Hawkbit. Required Permission: DELETE_REPOSITORY
=== Delete distribution set type
@@ -157,7 +157,7 @@ include::../errors/429.adoc[]
=== Implementation notes
Handles the GET request of retrieving a single distribution set type within SP. Required Permission: READ_REPOSITORY
Handles the GET request of retrieving a single distribution set type within Hawkbit. Required Permission: READ_REPOSITORY
=== Get distribution set type
@@ -203,7 +203,7 @@ include::../errors/429.adoc[]
=== Implementation notes
Handles the PUT request for a single distribution set type within SP. Required Permission: UPDATE_REPOSITORY
Handles the PUT request for a single distribution set type within Hawkbit. Required Permission: UPDATE_REPOSITORY
=== Update distribution set type
@@ -354,7 +354,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the DELETE request for removing a software module type from a single distribution set type within SP. Required Permission: DELETE_REPOSITORY
Handles the DELETE request for removing a software module type from a single distribution set type within Hawkbit. Required Permission: DELETE_REPOSITORY
Delete mandatory software module type.
@@ -541,8 +541,6 @@ include::../errors/429.adoc[]
== DELETE /rest/v1/distributionsettypes/{distributionSetTypeId}/optionalmoduletypes/{softwareModuleTypeId}
== DELETE /rest/v1/distributionsettypes/{distributionSetTypeId}/mandatorymoduletypes/{softwareModuleTypeId}
=== Implementation Notes
Handles DELETE request for removing an optional module from the distribution set type.Note that a DS type cannot be changed after it has been used by a DS. Required Permission: UPDATE_REPOSITORY and READ_REPOSITORY

View File

@@ -18,7 +18,7 @@ toc::[]
=== Implementation notes
Handles the GET request of retrieving all rollouts within SP. Required Permission: READ_ROLLOUT
Handles the GET request of retrieving all rollouts within Hawkbit. Required Permission: READ_ROLLOUT
=== Get paged list of Rollouts
@@ -65,7 +65,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the GET request of retrieving a single rollout within SP. Required Permission: READ_ROLLOUT
Handles the GET request of retrieving a single rollout within Hawkbit. Required Permission: READ_ROLLOUT
=== Get Rollout
@@ -108,7 +108,7 @@ include::../errors/429.adoc[]
== POST /rest/v1/rollouts
=== Implementation Notes
Handles the POST request of creating new rollout within SP. Required Permission: CREATE_ROLLOUT
Handles the POST request of creating new rollout within Hawkbit. Required Permission: CREATE_ROLLOUT
=== Create Rollout with defined amount of groups
@@ -182,7 +182,7 @@ include::../errors/429.adoc[]
== POST /rest/v1/rollouts/{rolloutId}/approve
=== Implementation Notes
Handles the POST request of approving a created rollout within SP.
Handles the POST request of approving a created rollout within Hawkbit.
Only possible if approval workflow is enabled in system configuration and rollout is in state WAITING_FOR_APPROVAL.
Required Permission: APPROVE_ROLLOUT
@@ -219,7 +219,7 @@ include::../errors/429.adoc[]
== POST /rest/v1/rollouts/{rolloutId}/deny
=== Implementation Notes
Handles the POST request of denying a created rollout within SP.
Handles the POST request of denying a created rollout within Hawkbit.
Only possible if approval workflow is enabled in system configuration and rollout is in state WAITING_FOR_APPROVAL.
Required Permission: APPROVE_ROLLOUT
@@ -257,7 +257,7 @@ include::../errors/429.adoc[]
== POST /rest/v1/rollouts/{rolloutId}/start
=== Implementation Notes
Handles the POST request of starting a created rollout within SP. Required Permission: HANDLE_ROLLOUT
Handles the POST request of starting a created rollout within Hawkbit. Required Permission: HANDLE_ROLLOUT
=== Start Rollout
@@ -293,7 +293,7 @@ include::../errors/429.adoc[]
== POST /rest/v1/rollouts/{rolloutId}/pause
=== Implementation Notes
Handles the POST request of pausing a running rollout within SP. Required Permission: HANDLE_ROLLOUT
Handles the POST request of pausing a running rollout within Hawkbit. Required Permission: HANDLE_ROLLOUT
=== Pause Rollout
@@ -326,7 +326,7 @@ include::../errors/429.adoc[]
== POST /rest/v1/rollouts/{rolloutId}/resume
=== Implementation Notes
Handles the POST request of resuming a paused rollout within SP. Required Permission: HANDLE_ROLLOUT
Handles the POST request of resuming a paused rollout within Hawkbit. Required Permission: HANDLE_ROLLOUT
=== Resume Rollout
@@ -360,7 +360,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the DELETE request of deleting a rollout within SP. Required Permission: DELETE_ROLLOUT
Handles the DELETE request of deleting a rollout within Hawkbit. Required Permission: DELETE_ROLLOUT
=== Deleting a rollout
@@ -400,7 +400,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the GET request of retrieving all deploy groups of a specific rollout within SP. Required Permission: READ_ROLLOUT
Handles the GET request of retrieving all deploy groups of a specific rollout within Hawkbit. Required Permission: READ_ROLLOUT
=== Get Deploy Groups
@@ -452,7 +452,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the GET request of a single deploy group of a specific rollout within SP. Required Permission: READ_ROLLOUT
Handles the GET request of a single deploy group of a specific rollout within Hawkbit. Required Permission: READ_ROLLOUT
=== Get Deploy Groups
@@ -496,7 +496,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the GET request of retrieving all targets of a single deploy group of a specific rollout within SP. Required Permissions: READ_ROLLOUT, READ_TARGET.
Handles the GET request of retrieving all targets of a single deploy group of a specific rollout within Hawkbit. Required Permissions: READ_ROLLOUT, READ_TARGET.
=== Get Deploy Group Targets

View File

@@ -69,7 +69,7 @@ include::../errors/429.adoc[]
=== Implementation notes
The SP server might cancel an operation, e.g. an unfinished update has a sucessor. It is up to the provisiong target to decide to accept the cancelation or reject it.
The Hawkbit server might cancel an operation, e.g. an unfinished update has a sucessor. It is up to the provisiong target to decide to accept the cancelation or reject it.
=== Cancel an action

View File

@@ -15,7 +15,7 @@ toc::[]
=== Implementation notes
Handles the GET request of retrieving all softwaremodules within SP. Required Permission: READ_REPOSITORY
Handles the GET request of retrieving all softwaremodules within Hawkbit. Required Permission: READ_REPOSITORY
=== Get software modules
@@ -63,7 +63,7 @@ include::../errors/429.adoc[]
=== Implementation notes
Handles the POST request of creating new software modules within SP. The request body must always be a list of modules. Required Permission: CREATE_REPOSITORY
Handles the POST request of creating new software modules within Hawkbit. The request body must always be a list of modules. Required Permission: CREATE_REPOSITORY
=== Create software modules
@@ -112,7 +112,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the DELETE request for a single softwaremodule within SP. Required Permission: DELETE_REPOSITORY
Handles the DELETE request for a single softwaremodule within Hawkbit. Required Permission: DELETE_REPOSITORY
=== Delete software module
@@ -155,7 +155,7 @@ include::../errors/429.adoc[]
=== Implementation notes
Handles the GET request of retrieving a single softwaremodule within SP. Required Permission: READ_REPOSITORY
Handles the GET request of retrieving a single softwaremodule within Hawkbit. Required Permission: READ_REPOSITORY
=== Get software module
@@ -202,7 +202,7 @@ include::../errors/429.adoc[]
=== Implementation notes
Handles the PUT request for a single softwaremodule within SP. Required Permission: UPDATE_REPOSITORY
Handles the PUT request for a single softwaremodule within Hawkbit. Required Permission: UPDATE_REPOSITORY
=== Update software module
@@ -358,7 +358,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the DELETE request for a single SoftwareModule within SP. Required Permission: DELETE_REPOSITORY
Handles the DELETE request for a single SoftwareModule within Hawkbit. Required Permission: DELETE_REPOSITORY
=== Delete arifact

View File

@@ -15,7 +15,7 @@ toc::[]
=== Implementation notes
Handles the GET request of retrieving all software module types within SP. Required Permission: READ_REPOSITORY
Handles the GET request of retrieving all software module types within Hawkbit. Required Permission: READ_REPOSITORY
=== Get software module types
@@ -63,7 +63,7 @@ include::../errors/429.adoc[]
=== Implementation notes
Handles the POST request of creating new software module types within SP. The request body must always be a list of module types. Required Permission: CREATE_REPOSITORY
Handles the POST request of creating new software module types within Hawkbit. The request body must always be a list of module types. Required Permission: CREATE_REPOSITORY
=== Creating software module types
@@ -112,7 +112,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the DELETE request for a single software module type within SP. Required Permission: DELETE_REPOSITORY
Handles the DELETE request for a single software module type within Hawkbit. Required Permission: DELETE_REPOSITORY
=== Delete software module type
@@ -153,7 +153,7 @@ include::../errors/429.adoc[]
=== Implementation notes
Handles the GET request of retrieving a single software module type within SP. Required Permission: READ_REPOSITORY
Handles the GET request of retrieving a single software module type within Hawkbit. Required Permission: READ_REPOSITORY
=== Accessing a software module type
@@ -197,7 +197,7 @@ include::../errors/429.adoc[]
=== Implementation notes
Handles the PUT request for a single software module type within SP. Required Permission: UPDATE_REPOSITORY
Handles the PUT request for a single software module type within Hawkbit. Required Permission: UPDATE_REPOSITORY
=== Updating a software module types

View File

@@ -16,7 +16,7 @@ toc::[]
=== Implementation notes
Handles the GET request of retrieving all target filter queries within SP. Required permission: READ_TARGET
Handles the GET request of retrieving all target filter queries within Hawkbit. Required permission: READ_TARGET
=== Get paged list of target filter queries
@@ -66,7 +66,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the POST request to create a new target filter query within SP. Required permission: CREATE_TARGET
Handles the POST request to create a new target filter query within Hawkbit. Required permission: CREATE_TARGET
=== Create a target filter query
@@ -112,7 +112,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the DELETE request of deleting a target filter query within SP. Required permission: DELETE_TARGET
Handles the DELETE request of deleting a target filter query within Hawkbit. Required permission: DELETE_TARGET
=== Deleting a target
@@ -153,7 +153,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the GET request of retrieving a single target filter query within SP. Required permission: READ_TARGET
Handles the GET request of retrieving a single target filter query within Hawkbit. Required permission: READ_TARGET
=== Get single target
@@ -198,7 +198,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the PUT request of updating a target filter query within SP. Required permission: UPDATE_TARGET
Handles the PUT request of updating a target filter query within Hawkbit. Required permission: UPDATE_TARGET
=== Update a target

View File

@@ -16,7 +16,7 @@ toc::[]
=== Implementation notes
Handles the GET request of retrieving all targets within SP. Required permission: READ_TARGET
Handles the GET request of retrieving all targets within Hawkbit. Required permission: READ_TARGET
=== Get paged list of targets
@@ -66,7 +66,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the POST request of creating new targets within SP. The request body must always be a list of targets. Required Permission: CREATE_TARGET
Handles the POST request of creating new targets within Hawkbit. The request body must always be a list of targets. Required Permission: CREATE_TARGET
=== Create list of targets
@@ -112,7 +112,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the DELETE request of deleting a single target within SP. Required Permission: DELETE_TARGET
Handles the DELETE request of deleting a single target within Hawkbit. Required Permission: DELETE_TARGET
=== Deleting a target
@@ -153,7 +153,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the GET request of retrieving a single target within SP. Required Permission: READ_TARGET
Handles the GET request of retrieving a single target within Hawkbit. Required Permission: READ_TARGET
=== Get single target
@@ -198,7 +198,7 @@ include::../errors/429.adoc[]
=== Implementation Notes
Handles the PUT request of updating a target within SP. Required Permission: UPDATE_TARGET
Handles the PUT request of updating a target within Hawkbit. Required Permission: UPDATE_TARGET
=== Update a target

View File

@@ -19,7 +19,7 @@ public final class ApiModelPropertiesGeneric {
public static final String ITEM_ID = "The technical identifier " + ENDING;
public static final String NAME = "The name" + ENDING;
public static final String DESCRPTION = "The description" + ENDING;
public static final String COLOUR = "The colour" + ENDING + ". In HEX format, e.g. #800080";
public static final String COLOUR = "The colour" + ENDING;
public static final String DELETED = "Deleted flag, used for soft deleted entities";
public static final String CREATED_BY = "Entity was originally created by (User, AMQP-Controller, anonymous etc.)";

View File

@@ -84,6 +84,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
fieldWithPath("content[].lastModifiedBy")
.description(ApiModelPropertiesGeneric.LAST_MODIFIED_BY).type("String"),
fieldWithPath("content[].name").description(ApiModelPropertiesGeneric.NAME),
fieldWithPath("content[].deleted").description(ApiModelPropertiesGeneric.DELETED),
fieldWithPath("content[]._links.self").ignored())));
}
@@ -91,8 +92,9 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
@Description("Handles the GET request of retrieving all distribution set types within SP with a defined page size and offset, sortet by name in descending order and filtered down to all targets which name starts with 'a'. Required Permission: READ_REPOSITORY.")
public void getDistributionSetTypesWithParameters() throws Exception {
distributionSetTypeManagement.update(entityFactory.distributionSetType()
.update(testdataFactory.createDistributionSet().getType().getId()).description("Desc1234"));
distributionSetTypeManagement.update(
entityFactory.distributionSetType().update(testdataFactory.createDistributionSet().getType().getId())
.description("Desc1234").colour("rgb(86,37,99)"));
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())
@@ -110,7 +112,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
final List<DistributionSetType> types = new ArrayList<>();
types.add(entityFactory.distributionSetType().create().key("test1").name("TestName1").description("Desc1")
.mandatory(osType).optional(runtimeType).build());
.colour("rgb(86,37,99)").mandatory(osType).optional(runtimeType).build());
mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING)
.content(JsonBuilder.distributionSetTypesCreateValidFieldsOnly(types))
@@ -122,15 +124,16 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
requestFieldWithPath("[]name").description(ApiModelPropertiesGeneric.NAME),
optionalRequestFieldWithPath("[]description")
.description(ApiModelPropertiesGeneric.DESCRPTION),
optionalRequestFieldWithPath("[]colour")
.description(ApiModelPropertiesGeneric.COLOUR),
optionalRequestFieldWithPath("[]mandatorymodules")
.description(MgmtApiModelProperties.DS_TYPE_MANDATORY_MODULES),
optionalRequestFieldWithPath("[]optionalmodules")
.description(MgmtApiModelProperties.DS_TYPE_OPTIONAL_MODULES)),
responseFields(
fieldWithPath("[]createdBy").description(ApiModelPropertiesGeneric.CREATED_BY),
fieldWithPath("[]createdAt").description(ApiModelPropertiesGeneric.CREATED_AT),
fieldWithPath("[].description")
fieldWithPath("[]description")
.description(ApiModelPropertiesGeneric.DESCRPTION),
fieldWithPath("[]key").description(MgmtApiModelProperties.DS_TYPE_KEY),
fieldWithPath("[]id").description(ApiModelPropertiesGeneric.ITEM_ID),
@@ -140,14 +143,17 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
.description(ApiModelPropertiesGeneric.LAST_MODIFIED_BY).type("String"),
fieldWithPath("[]name").description(ApiModelPropertiesGeneric.NAME),
fieldWithPath("[]deleted").description(ApiModelPropertiesGeneric.DELETED),
fieldWithPath("[]colour")
.description(ApiModelPropertiesGeneric.COLOUR),
fieldWithPath("[]_links.self").ignored())));
}
@Test
@Description("Handles the GET request of retrieving a single distribution set type within SP. Required Permission: READ_REPOSITORY")
public void deleteDistributionSetType() throws Exception {
final DistributionSetType testType = distributionSetTypeManagement.update(entityFactory.distributionSetType()
.update(testdataFactory.createDistributionSet().getType().getId()).description("Desc1234"));
final DistributionSetType testType = distributionSetTypeManagement.update(
entityFactory.distributionSetType().update(testdataFactory.createDistributionSet().getType().getId())
.description("Desc1234").colour("rgb(86,37,99)"));
mockMvc.perform(delete(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}",
testType.getId())).andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
@@ -160,7 +166,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
public void getDistributionSetType() throws Exception {
final DistributionSetType testType = distributionSetTypeManagement.update(entityFactory.distributionSetType()
.update(testdataFactory.createDistributionSet().getType().getId()).description("Desc1234"));
.update(testdataFactory.createDistributionSet().getType().getId()).description("Desc1234").colour("rgb(86,37,99)"));
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}",
testType.getId()).accept(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
@@ -179,6 +185,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
.type("String"),
fieldWithPath("name").description(ApiModelPropertiesGeneric.NAME),
fieldWithPath("deleted").description(ApiModelPropertiesGeneric.DELETED),
fieldWithPath("colour").description(ApiModelPropertiesGeneric.COLOUR),
fieldWithPath("_links.self").ignored(),
fieldWithPath("_links.mandatorymodules")
.description(MgmtApiModelProperties.LINK_TO_MANDATORY_SMT),
@@ -206,7 +213,8 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
public void putDistributionSetType() throws Exception {
final DistributionSetType testType = distributionSetTypeManagement.update(entityFactory.distributionSetType()
.update(testdataFactory.createDistributionSet().getType().getId()).description("Desc1234"));
final String body = new JSONObject().put("description", "an updated desription").toString();
final String body = new JSONObject().put("description", "an updated description")
.put("colour", "rgb(106,178,83)").toString();
this.mockMvc
.perform(put(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}",
@@ -216,7 +224,8 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
pathParameters(parameterWithName("distributionSetTypeId")
.description(ApiModelPropertiesGeneric.ITEM_ID)),
requestFields(
requestFieldWithPath("description").description(ApiModelPropertiesGeneric.DESCRPTION)),
optionalRequestFieldWithPath("description").description(ApiModelPropertiesGeneric.DESCRPTION),
optionalRequestFieldWithPath("colour").description(ApiModelPropertiesGeneric.COLOUR)),
responseFields(fieldWithPath("createdBy").description(ApiModelPropertiesGeneric.CREATED_BY),
fieldWithPath("createdAt").description(ApiModelPropertiesGeneric.CREATED_AT),
fieldWithPath("description").description(ApiModelPropertiesGeneric.DESCRPTION),
@@ -228,6 +237,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
.type("String"),
fieldWithPath("name").description(ApiModelPropertiesGeneric.NAME),
fieldWithPath("deleted").description(ApiModelPropertiesGeneric.DELETED),
fieldWithPath("colour").description(ApiModelPropertiesGeneric.COLOUR),
fieldWithPath("_links.self").ignored(),
fieldWithPath("_links.mandatorymodules")
.description(MgmtApiModelProperties.LINK_TO_MANDATORY_SMT),
@@ -240,8 +250,9 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
@WithUser(principal = "uploadTester", allSpPermissions = true)
@Description("Handles the GET request of retrieving the list of mandatory software module types in that distribution set type. Required Permission: READ_REPOSITORY.")
public void getMandatoryModules() throws Exception {
final DistributionSetType testType = distributionSetTypeManagement.create(entityFactory.distributionSetType()
.create().key("test1").name("TestName1").description("Desc1").mandatory(osType).optional(runtimeType));
final DistributionSetType testType = distributionSetTypeManagement
.create(entityFactory.distributionSetType().create().key("test1").name("TestName1").description("Desc1")
.colour("rgb(86,37,99)").mandatory(osType).optional(runtimeType));
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
+ "/{distributionSetTypeId}/mandatorymoduletypes", testType.getId()).accept(MediaType.APPLICATION_JSON))
@@ -273,8 +284,8 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
+ "Note that a DS type cannot be changed after it has been used by a DS. Required Permission: "
+ SpPermission.UPDATE_REPOSITORY + " and " + SpPermission.READ_REPOSITORY)
public void postMandatoryModule() throws Exception {
final DistributionSetType testType = distributionSetTypeManagement.create(
entityFactory.distributionSetType().create().key("test1").name("TestName1").description("Desc1"));
final DistributionSetType testType = distributionSetTypeManagement.create(entityFactory.distributionSetType()
.create().key("test1").name("TestName1").description("Desc1").colour("rgb(86,37,99)"));
mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
+ "/{distributionSetTypeId}/mandatorymoduletypes", testType.getId())
@@ -291,8 +302,9 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
+ "Note that a DS type cannot be changed after it has been used by a DS. Required permissions: "
+ SpPermission.UPDATE_REPOSITORY + " and " + SpPermission.READ_REPOSITORY)
public void deleteMandatoryModule() throws Exception {
final DistributionSetType testType = distributionSetTypeManagement.create(entityFactory.distributionSetType()
.create().key("test1").name("TestName1").description("Desc1").mandatory(osType).optional(runtimeType));
final DistributionSetType testType = distributionSetTypeManagement
.create(entityFactory.distributionSetType().create().key("test1").name("TestName1").description("Desc1")
.colour("rgb(86,37,99)").mandatory(osType).optional(runtimeType));
mockMvc.perform(delete(
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
+ "/{distributionSetTypeId}/mandatorymoduletypes/{softwareModuleTypeId}",
@@ -308,8 +320,9 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
@Description("Handles the GET request of retrieving the single mandatory software module type in that distribution set type. Required Permission: "
+ SpPermission.READ_REPOSITORY)
public void getMandatoryModule() throws Exception {
final DistributionSetType testType = distributionSetTypeManagement.create(entityFactory.distributionSetType()
.create().key("test1").name("TestName1").description("Desc1").mandatory(osType).optional(runtimeType));
final DistributionSetType testType = distributionSetTypeManagement
.create(entityFactory.distributionSetType().create().key("test1").name("TestName1").description("Desc1")
.colour("rgb(86,37,99)").mandatory(osType).optional(runtimeType));
mockMvc.perform(get(
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
@@ -338,8 +351,9 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
@Description("Handles the GET request of retrieving the list of optional software module types in that distribution set type. Required Permission: "
+ SpPermission.READ_REPOSITORY)
public void getOptionalModules() throws Exception {
final DistributionSetType testType = distributionSetTypeManagement.create(entityFactory.distributionSetType()
.create().key("test1").name("TestName1").description("Desc1").mandatory(osType).optional(runtimeType));
final DistributionSetType testType = distributionSetTypeManagement
.create(entityFactory.distributionSetType().create().key("test1").name("TestName1").description("Desc1")
.colour("rgb(86,37,99)").mandatory(osType).optional(runtimeType));
mockMvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
+ "/{distributionSetTypeId}/optionalmoduletypes", testType.getId()).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
@@ -350,6 +364,7 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
responseFields(fieldWithPath("[]createdBy").description(ApiModelPropertiesGeneric.CREATED_BY),
fieldWithPath("[]createdAt").description(ApiModelPropertiesGeneric.CREATED_AT),
fieldWithPath("[]description").description(ApiModelPropertiesGeneric.DESCRPTION),
fieldWithPath("[]colour").description(ApiModelPropertiesGeneric.COLOUR),
fieldWithPath("[]key").description(MgmtApiModelProperties.SM_TYPE_KEY),
fieldWithPath("[]maxAssignments")
.description(MgmtApiModelProperties.SMT_MAX_ASSIGNMENTS),
@@ -368,8 +383,8 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
+ "Note that a DS type cannot be changed after it has been used by a DS. Required Permission: "
+ SpPermission.UPDATE_REPOSITORY + " and " + SpPermission.READ_REPOSITORY)
public void postOptionalModule() throws Exception {
final DistributionSetType testType = distributionSetTypeManagement.create(
entityFactory.distributionSetType().create().key("test1").name("TestName1").description("Desc1"));
final DistributionSetType testType = distributionSetTypeManagement.create(entityFactory.distributionSetType()
.create().key("test1").name("TestName1").description("Desc1").colour("rgb(86,37,99)"));
mockMvc.perform(post(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
+ "/{distributionSetTypeId}/optionalmoduletypes", testType.getId())
.content("{\"id\":" + appType.getId() + "}").contentType(MediaType.APPLICATION_JSON))
@@ -386,8 +401,9 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
+ "Note that a DS type cannot be changed after it has been used by a DS. Required Permission: "
+ SpPermission.UPDATE_REPOSITORY + " and " + SpPermission.READ_REPOSITORY)
public void deleteOptionalModule() throws Exception {
final DistributionSetType testType = distributionSetTypeManagement.create(entityFactory.distributionSetType()
.create().key("test1").name("TestName1").description("Desc1").mandatory(osType).optional(runtimeType));
final DistributionSetType testType = distributionSetTypeManagement
.create(entityFactory.distributionSetType().create().key("test1").name("TestName1").description("Desc1")
.colour("rgb(86,37,99)").mandatory(osType).optional(runtimeType));
mockMvc.perform(delete(
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
+ "/{distributionSetTypeId}/optionalmoduletypes/{softwareModuleTypeId}",
@@ -402,8 +418,9 @@ public class DistributionSetTypesDocumentationTest extends AbstractApiRestDocume
@Description("Handles the GET request of retrieving the single optional software module type in that distribution set type. Required Permission: "
+ SpPermission.READ_REPOSITORY)
public void getOptionalModule() throws Exception {
final DistributionSetType testType = distributionSetTypeManagement.create(entityFactory.distributionSetType()
.create().key("test1").name("TestName1").description("Desc1").mandatory(osType).optional(appType));
final DistributionSetType testType = distributionSetTypeManagement
.create(entityFactory.distributionSetType().create().key("test1").name("TestName1").description("Desc1")
.colour("rgb(86,37,99)").mandatory(osType).optional(appType));
mockMvc.perform(get(
MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING

View File

@@ -58,7 +58,7 @@ public class SoftwaremoduleTypesDocumentationTest extends AbstractApiRestDocumen
final SoftwareModuleType testType = testdataFactory.findOrCreateSoftwareModuleType("test123");
softwareModuleTypeManagement
.update(entityFactory.softwareModuleType().update(testType.getId()).description("Desc1234"));
.update(entityFactory.softwareModuleType().update(testType.getId()).description("Desc1234").colour("rgb(106,178,83)"));
mockMvc.perform(get(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
@@ -75,6 +75,7 @@ public class SoftwaremoduleTypesDocumentationTest extends AbstractApiRestDocumen
fieldWithPath("content[].lastModifiedBy")
.description(ApiModelPropertiesGeneric.LAST_MODIFIED_BY).type("String"),
fieldWithPath("content[].name").description(ApiModelPropertiesGeneric.NAME),
fieldWithPath("content[].deleted").description(ApiModelPropertiesGeneric.DELETED),
fieldWithPath("content[]._links.self").ignored())));
}
@@ -84,7 +85,7 @@ public class SoftwaremoduleTypesDocumentationTest extends AbstractApiRestDocumen
public void getSoftwareModuleTypesWithParameters() throws Exception {
final SoftwareModuleType testType = testdataFactory.findOrCreateSoftwareModuleType("test123");
softwareModuleTypeManagement
.update(entityFactory.softwareModuleType().update(testType.getId()).description("Desc1234"));
.update(entityFactory.softwareModuleType().update(testType.getId()).description("Desc1234").colour("rgb(106,178,83)"));
mockMvc.perform(get(
MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING + "?limit=10&sort=name:ASC&offset=0&q=name==a")
@@ -100,7 +101,7 @@ public class SoftwaremoduleTypesDocumentationTest extends AbstractApiRestDocumen
public void postSoftwareModuleTypes() throws Exception {
final List<SoftwareModuleType> types = Arrays.asList(entityFactory.softwareModuleType().create().key("test1")
.name("TestName1").description("Desc1").build());
.name("TestName1").description("Desc1").colour("rgb(106,178,83)").build());
this.mockMvc
.perform(post(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING)
@@ -109,18 +110,19 @@ public class SoftwaremoduleTypesDocumentationTest extends AbstractApiRestDocumen
.andDo(MockMvcResultPrinter.print())
.andDo(this.document.document(
requestFields(
requestFieldWithPath("[]key").description(MgmtApiModelProperties.SMT_KEY),
requestFieldWithPath("[]name").description(ApiModelPropertiesGeneric.NAME),
requestFieldWithPath("[]maxAssignments").description(MgmtApiModelProperties.SM_MAX_ASSIGNMENTS),
optionalRequestFieldWithPath("[]description")
.description(ApiModelPropertiesGeneric.DESCRPTION),
optionalRequestFieldWithPath("[]key").description(MgmtApiModelProperties.SMT_KEY),
optionalRequestFieldWithPath("[]maxAssignments")
.description(MgmtApiModelProperties.SM_MAX_ASSIGNMENTS),
requestFieldWithPath("[]name").description(ApiModelPropertiesGeneric.NAME)),
optionalRequestFieldWithPath("[]colour").description(ApiModelPropertiesGeneric.COLOUR)),
responseFields(fieldWithPath("[]key").description(MgmtApiModelProperties.SMT_KEY),
fieldWithPath("[]maxAssignments")
.description(MgmtApiModelProperties.SMT_MAX_ASSIGNMENTS),
fieldWithPath("[]createdBy").description(ApiModelPropertiesGeneric.CREATED_BY),
fieldWithPath("[]createdAt").description(ApiModelPropertiesGeneric.CREATED_AT),
fieldWithPath("[]description").description(ApiModelPropertiesGeneric.DESCRPTION),
fieldWithPath("[]colour").description(ApiModelPropertiesGeneric.COLOUR),
fieldWithPath("[]deleted").description(ApiModelPropertiesGeneric.DELETED),
fieldWithPath("[]id").description(ApiModelPropertiesGeneric.ITEM_ID),
fieldWithPath("[]lastModifiedAt")
@@ -138,7 +140,7 @@ public class SoftwaremoduleTypesDocumentationTest extends AbstractApiRestDocumen
@Description("Handles the DELETE request for a single software module Type within SP. Required Permission: DELETE_REPOSITORY.")
public void deleteSoftwareModuleType() throws Exception {
final SoftwareModuleType testType = softwareModuleTypeManagement.create(
entityFactory.softwareModuleType().create().key("test1").name("TestName1").description("Desc1"));
entityFactory.softwareModuleType().create().key("test1").name("TestName1").description("Desc1").colour("rgb(106,178,83)"));
assertThat(softwareModuleTypeManagement.count()).isEqualTo(4);
this.mockMvc
.perform(delete(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING + "/{softwareModuleTypeID}",
@@ -155,7 +157,7 @@ public class SoftwaremoduleTypesDocumentationTest extends AbstractApiRestDocumen
public void getSoftwareModuleType() throws Exception {
final SoftwareModuleType testType = testdataFactory.findOrCreateSoftwareModuleType("test123");
softwareModuleTypeManagement
.update(entityFactory.softwareModuleType().update(testType.getId()).description("Desc1234"));
.update(entityFactory.softwareModuleType().update(testType.getId()).description("Desc1234").colour("rgb(106,178,83)"));
this.mockMvc
.perform(get(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING + "/{softwareModuleTypeID}",
@@ -169,6 +171,7 @@ public class SoftwaremoduleTypesDocumentationTest extends AbstractApiRestDocumen
fieldWithPath("createdBy").description(ApiModelPropertiesGeneric.CREATED_BY),
fieldWithPath("createdAt").description(ApiModelPropertiesGeneric.CREATED_AT),
fieldWithPath("description").description(ApiModelPropertiesGeneric.DESCRPTION),
fieldWithPath("colour").description(ApiModelPropertiesGeneric.COLOUR),
fieldWithPath("deleted").description(ApiModelPropertiesGeneric.DELETED),
fieldWithPath("id").description(ApiModelPropertiesGeneric.ITEM_ID),
fieldWithPath("lastModifiedAt").description(ApiModelPropertiesGeneric.LAST_MODIFIED_AT)
@@ -185,7 +188,7 @@ public class SoftwaremoduleTypesDocumentationTest extends AbstractApiRestDocumen
public void putSoftwareModuleType() throws Exception {
final SoftwareModuleType testType = testdataFactory.findOrCreateSoftwareModuleType("test123");
final String body = new JSONObject().put("description", "a new description").toString();
final String body = new JSONObject().put("description", "a new description").put("colour", "rgb(86,37,99)").toString();
this.mockMvc
.perform(put(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING + "/{softwareModuleTypeID}",
@@ -195,12 +198,14 @@ public class SoftwaremoduleTypesDocumentationTest extends AbstractApiRestDocumen
pathParameters(parameterWithName("softwareModuleTypeID")
.description(ApiModelPropertiesGeneric.ITEM_ID)),
requestFields(
requestFieldWithPath("description").description(ApiModelPropertiesGeneric.DESCRPTION)),
optionalRequestFieldWithPath("description").description(ApiModelPropertiesGeneric.DESCRPTION),
optionalRequestFieldWithPath("colour").description(ApiModelPropertiesGeneric.COLOUR)),
responseFields(fieldWithPath("key").description(MgmtApiModelProperties.SMT_KEY),
fieldWithPath("maxAssignments").description(MgmtApiModelProperties.SMT_MAX_ASSIGNMENTS),
fieldWithPath("createdBy").description(ApiModelPropertiesGeneric.CREATED_BY),
fieldWithPath("createdAt").description(ApiModelPropertiesGeneric.CREATED_AT),
fieldWithPath("description").description(ApiModelPropertiesGeneric.DESCRPTION),
fieldWithPath("colour").description(ApiModelPropertiesGeneric.COLOUR),
fieldWithPath("deleted").description(ApiModelPropertiesGeneric.DELETED),
fieldWithPath("id").description(ApiModelPropertiesGeneric.ITEM_ID),
fieldWithPath("lastModifiedAt").description(ApiModelPropertiesGeneric.LAST_MODIFIED_AT)

View File

@@ -218,6 +218,7 @@ public class TargetTypesDocumentationTest extends AbstractApiRestDocumentation {
fieldWithPath("[]key").description(MgmtApiModelProperties.DS_TYPE_KEY),
fieldWithPath("[]name").description(ApiModelPropertiesGeneric.NAME),
fieldWithPath("[]description").description(ApiModelPropertiesGeneric.DESCRPTION),
fieldWithPath("[]colour").description(ApiModelPropertiesGeneric.COLOUR),
fieldWithPath("[]createdAt").description(ApiModelPropertiesGeneric.CREATED_AT),
fieldWithPath("[]createdBy").description(ApiModelPropertiesGeneric.CREATED_BY),
fieldWithPath("[]lastModifiedAt")
@@ -226,7 +227,6 @@ public class TargetTypesDocumentationTest extends AbstractApiRestDocumentation {
.description(ApiModelPropertiesGeneric.LAST_MODIFIED_BY).type("String"),
fieldWithPath("[]deleted").description(ApiModelPropertiesGeneric.DELETED),
fieldWithPath("[]_links.self").ignored())));
}
@Test
@@ -268,6 +268,6 @@ public class TargetTypesDocumentationTest extends AbstractApiRestDocumentation {
.andDo(this.document.document(pathParameters(
parameterWithName("targetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID),
parameterWithName("distributionSetTypeId").description(ApiModelPropertiesGeneric.ITEM_ID))));
}
}