diff --git a/src/main/java/org/openepics/names/rest/api/v1/INames.java b/src/main/java/org/openepics/names/rest/api/v1/INames.java index 126152963cfed94bc746ef915a93bda7997ab21c..382e008613e45bee169046b90bc45cee074f8d37 100644 --- a/src/main/java/org/openepics/names/rest/api/v1/INames.java +++ b/src/main/java/org/openepics/names/rest/api/v1/INames.java @@ -25,6 +25,7 @@ import org.openepics.names.rest.beans.NameElement; import org.openepics.names.util.response.Response; import org.openepics.names.util.response.ResponseBoolean; import org.openepics.names.util.response.ResponseBooleanList; +import org.openepics.names.util.response.ResponsePageNameElements; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PutMapping; @@ -145,16 +146,16 @@ public interface INames { /** * Find valid names (search). - * Return list of name elements. + * Return paged list of name elements. * * @param deleted if deleted-only names are to be included (false for non-deleted-only names, true for deleted-only names, not used for both cases) * @param queryFields search fields * @param queryValues search values corresponding to search fields * @param orderBy order by field * @param isAsc sort order, ascending or descending - * @param offset offset, page starting from 0 - * @param limit limit, page size - * @return list of name elements + * @param page page starting from 0, offset + * @param pageSize page size, limit + * @return paged list of name elements */ @Operation( summary = "Find valid names (search)", @@ -162,32 +163,32 @@ public interface INames { + "Return array of name elements." ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of name elements.", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = NameElement.class)))), + @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of name elements.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageNameElements.class))), @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) }) @RequestMapping( method = RequestMethod.GET, produces = {"application/json"}) - public List<NameElement> readNames( + public ResponsePageNameElements readNames( @Parameter(in = ParameterIn.QUERY, description = "if deleted-only names are to be included, false for non-deleted-only names, true for deleted-only names, not used for both cases") @RequestParam(required = false) Boolean deleted, @Parameter(in = ParameterIn.QUERY, description = "search fields") @RequestParam(required = false) FieldName[] queryFields, @Parameter(in = ParameterIn.QUERY, description = "search values corresponding to search fields") @RequestParam(required = false) String[] queryValues, @Parameter(in = ParameterIn.QUERY, description = "order by field") @RequestParam(required = false) FieldName orderBy, @Parameter(in = ParameterIn.QUERY, description = "sort order, ascending or descending") @RequestParam(required = false) Boolean isAsc, - @Parameter(in = ParameterIn.QUERY, description = "offset, page starting from 0") @RequestParam(required = false) Integer offset, - @Parameter(in = ParameterIn.QUERY, description = "limit, page size") @RequestParam(required = false) Integer limit); + @Parameter(in = ParameterIn.QUERY, description = "page starting from 0, offset") @RequestParam(required = false) Integer page, + @Parameter(in = ParameterIn.QUERY, description = "page size, limit") @RequestParam(required = false) Integer pageSize); /** * Find valid names by name or uuid (search). - * Return list of name elements. + * Return paged list of name elements. * * @param name name or uuid to search for * @param orderBy order by field * @param isAsc sort order, ascending or descending - * @param offset offset, page starting from 0 - * @param limit limit, page size - * @return list of name elements + * @param page page starting from 0, offset + * @param pageSize page size, limit + * @return paged list of name elements */ @Operation( summary = "Find valid names by name or uuid (search)", @@ -195,7 +196,7 @@ public interface INames { + "Return array of name elements." ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of name elements.", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = NameElement.class)))), + @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of name elements.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageNameElements.class))), @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) }) @@ -203,23 +204,23 @@ public interface INames { value = "/{name}", method = RequestMethod.GET, produces = {"application/json"}) - public List<NameElement> readNames( + public ResponsePageNameElements readNames( @Parameter(in = ParameterIn.PATH, description = "name or uuid to search for") @PathVariable("name") String name, @Parameter(in = ParameterIn.QUERY, description = "order by field") @RequestParam(required = false) FieldName orderBy, @Parameter(in = ParameterIn.QUERY, description = "sort order, ascending or descending") @RequestParam(required = false) Boolean isAsc, - @Parameter(in = ParameterIn.QUERY, description = "offset, page starting from 0") @RequestParam(required = false) Integer offset, - @Parameter(in = ParameterIn.QUERY, description = "limit, page size") @RequestParam(required = false) Integer limit); + @Parameter(in = ParameterIn.QUERY, description = "page starting from 0, offset") @RequestParam(required = false) Integer page, + @Parameter(in = ParameterIn.QUERY, description = "page size, limit") @RequestParam(required = false) Integer pageSize); /** * Find valid names by system structure mnemonic path (search). - * Return list of name elements. + * Return paged list of name elements. * * @param mnemonicpath mnemonic path to search for * @param orderBy order by field * @param isAsc sort order, ascending or descending - * @param offset offset, page starting from 0 - * @param limit limit, page size - * @return list of name elements + * @param page page starting from 0, offset + * @param pageSize page size, limit + * @return paged list of name elements */ @Operation( summary = "Find valid names by system structure mnemonic path (search)", @@ -227,7 +228,7 @@ public interface INames { + "Return array of name elements." ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of name elements.", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = NameElement.class)))), + @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of name elements.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageNameElements.class))), @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) }) @@ -235,23 +236,23 @@ public interface INames { value = "/systemstructure/{mnemonicpath}", method = RequestMethod.GET, produces = {"application/json"}) - public List<NameElement> readNamesSystemStructure( + public ResponsePageNameElements readNamesSystemStructure( @Parameter(in = ParameterIn.PATH, description = "mnemonic path to search for") @PathVariable("mnemonicpath") String mnemonicpath, @Parameter(in = ParameterIn.QUERY, description = "order by field") @RequestParam(required = false) FieldName orderBy, @Parameter(in = ParameterIn.QUERY, description = "sort order, ascending or descending") @RequestParam(required = false) Boolean isAsc, - @Parameter(in = ParameterIn.QUERY, description = "offset, page starting from 0") @RequestParam(required = false) Integer offset, - @Parameter(in = ParameterIn.QUERY, description = "limit, page size") @RequestParam(required = false) Integer limit); + @Parameter(in = ParameterIn.QUERY, description = "page starting from 0, offset") @RequestParam(required = false) Integer page, + @Parameter(in = ParameterIn.QUERY, description = "page size, limit") @RequestParam(required = false) Integer pageSize); /** * Find valid names by device structure mnemonic path (search). - * Return list of name elements. + * Return paged list of name elements. * * @param mnemonicpath mnemonic path to search for * @param orderBy order by field * @param isAsc sort order, ascending or descending - * @param offset offset, page starting from 0 - * @param limit limit, page size - * @return list of name elements + * @param page page starting from 0, offset + * @param pageSize page size, limit + * @return paged list of name elements */ @Operation( summary = "Find valid names by device structure mnemonic path (search)", @@ -259,7 +260,7 @@ public interface INames { + "Return array of name elements." ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of name elements.", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = NameElement.class)))), + @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of name elements.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageNameElements.class))), @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) }) @@ -267,23 +268,23 @@ public interface INames { value = "/devicestructure/{mnemonicpath}", method = RequestMethod.GET, produces = {"application/json"}) - public List<NameElement> readNamesDeviceStructure( + public ResponsePageNameElements readNamesDeviceStructure( @Parameter(in = ParameterIn.PATH, description = "mnemonic path to search for") @PathVariable("mnemonicpath") String mnemonicpath, @Parameter(in = ParameterIn.QUERY, description = "order by field") @RequestParam(required = false) FieldName orderBy, @Parameter(in = ParameterIn.QUERY, description = "sort order, ascending or descending") @RequestParam(required = false) Boolean isAsc, - @Parameter(in = ParameterIn.QUERY, description = "offset, page starting from 0") @RequestParam(required = false) Integer offset, - @Parameter(in = ParameterIn.QUERY, description = "limit, page size") @RequestParam(required = false) Integer limit); + @Parameter(in = ParameterIn.QUERY, description = "page starting from 0, offset") @RequestParam(required = false) Integer page, + @Parameter(in = ParameterIn.QUERY, description = "page size, limit") @RequestParam(required = false) Integer pageSize); /** * Find history for name by uuid (exact match). - * Return list of name elements. + * Return paged list of name elements. * * @param uuid uuid to find history for * @param orderBy order by field * @param isAsc sort order, ascending or descending - * @param offset offset, page starting from 0 - * @param limit limit, page size - * @return list of name elements + * @param page page starting from 0, offset + * @param pageSize page size, limit + * @return paged list of name elements */ @Operation( summary = "Find history for name by uuid (exact match)", @@ -291,7 +292,7 @@ public interface INames { + "Return array of name elements." ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of name elements.", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = NameElement.class)))), + @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of name elements.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageNameElements.class))), @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) }) @@ -299,12 +300,12 @@ public interface INames { value = "/history/{uuid}", method = RequestMethod.GET, produces = {"application/json"}) - public List<NameElement> readNamesHistory( + public ResponsePageNameElements readNamesHistory( @Parameter(in = ParameterIn.PATH, description = "uuid to find history for") @PathVariable("uuid") String uuid, @Parameter(in = ParameterIn.QUERY, description = "order by field") @RequestParam(required = false) FieldName orderBy, @Parameter(in = ParameterIn.QUERY, description = "sort order, ascending or descending") @RequestParam(required = false) Boolean isAsc, - @Parameter(in = ParameterIn.QUERY, description = "offset, page starting from 0") @RequestParam(required = false) Integer offset, - @Parameter(in = ParameterIn.QUERY, description = "limit, page size") @RequestParam(required = false) Integer limit); + @Parameter(in = ParameterIn.QUERY, description = "page starting from 0, offset") @RequestParam(required = false) Integer page, + @Parameter(in = ParameterIn.QUERY, description = "page size, limit") @RequestParam(required = false) Integer pageSize); // ---------------------------------------------------------------------------------------------------- diff --git a/src/main/java/org/openepics/names/rest/api/v1/IStructures.java b/src/main/java/org/openepics/names/rest/api/v1/IStructures.java index 1a480ce20be203064eda4af3f8d4d634383feb6f..24c2d5b9ffc1fd62a240231f6fb3475e85a4338b 100644 --- a/src/main/java/org/openepics/names/rest/api/v1/IStructures.java +++ b/src/main/java/org/openepics/names/rest/api/v1/IStructures.java @@ -27,6 +27,7 @@ import org.openepics.names.rest.beans.Type; import org.openepics.names.util.response.Response; import org.openepics.names.util.response.ResponseBoolean; import org.openepics.names.util.response.ResponseBooleanList; +import org.openepics.names.util.response.ResponsePageStructureElements; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -160,7 +161,7 @@ public interface IStructures { /** * Find valid structures (search). - * Return list of structure elements. + * Return paged list of structure elements. * * @param type type of structure to search in * @param statuses statuses of structures to search for @@ -169,9 +170,9 @@ public interface IStructures { * @param queryValues search values corresponding to search fields * @param orderBy order by field * @param isAsc sort order, ascending or descending - * @param offset offset, page starting from 0 - * @param limit limit, page size - * @return list of structure elements + * @param page page starting from 0, offset + * @param pageSize page size, limit + * @return paged list of structure elements */ @Operation( summary = "Find valid structures (search)", @@ -179,7 +180,7 @@ public interface IStructures { + "Return list of structure elements." ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of structure elements.", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), + @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of structure elements.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageStructureElements.class))), @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) }) @@ -188,7 +189,7 @@ public interface IStructures { method = RequestMethod.GET, produces = {"application/json"}) @GetMapping - public List<StructureElement> readStructures( + public ResponsePageStructureElements readStructures( @Parameter(in = ParameterIn.PATH, description = "type of structure to search in") @PathVariable("type") Type type, @Parameter(in = ParameterIn.QUERY, description = "statuses of structures to search for") @RequestParam(required = false) Status[] statuses, @Parameter(in = ParameterIn.QUERY, description = "if deleted-only names are to be included, false for non-deleted-only names, true for deleted-only names, not used for both cases") @RequestParam(required = false) Boolean deleted, @@ -196,26 +197,27 @@ public interface IStructures { @Parameter(in = ParameterIn.QUERY, description = "search values corresponding to search fields") @RequestParam(required = false) String[] queryValues, @Parameter(in = ParameterIn.QUERY, description = "order by field") @RequestParam(required = false) FieldStructure orderBy, @Parameter(in = ParameterIn.QUERY, description = "sort order, ascending or descending") @RequestParam(required = false) Boolean isAsc, - @Parameter(in = ParameterIn.QUERY, description = "offset, page starting from 0") @RequestParam(required = false) Integer offset, - @Parameter(in = ParameterIn.QUERY, description = "limit, page size") @RequestParam(required = false) Integer limit); + @Parameter(in = ParameterIn.QUERY, description = "page starting from 0, offset") @RequestParam(required = false) Integer page, + @Parameter(in = ParameterIn.QUERY, description = "page size, limit") @RequestParam(required = false) Integer pageSize); /** * Find valid children structures by type and parent uuid (exact match). + * Return paged list of structure elements. * * @param type type of structure to search in * @param uuid uuid to find structure for * @param orderBy order by field * @param isAsc sort order, ascending or descending - * @param offset offset, page starting from 0 - * @param limit limit, page size - * @return list of structure elements + * @param page page starting from 0, offset + * @param pageSize page size, limit + * @return paged list of structure elements */ @Operation( summary = "Find valid children structures by type and parent uuid (exact match)", description = "Find valid children structures by type and parent uuid (exact match)." ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of structure elements.", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), + @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of structure elements.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageStructureElements.class))), @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) }) @@ -224,24 +226,24 @@ public interface IStructures { method = RequestMethod.GET, produces = {"application/json"}) @GetMapping - public List<StructureElement> readStructuresChildren( + public ResponsePageStructureElements readStructuresChildren( @Parameter(in = ParameterIn.PATH, description = "type of structure to search in") @PathVariable("type") Type type, @Parameter(in = ParameterIn.PATH, description = "uuid to find structure for") @PathVariable("uuid") String uuid, @Parameter(in = ParameterIn.QUERY, description = "order by field") @RequestParam(required = false) FieldStructure orderBy, @Parameter(in = ParameterIn.QUERY, description = "sort order, ascending or descending") @RequestParam(required = false) Boolean isAsc, - @Parameter(in = ParameterIn.QUERY, description = "offset, page starting from 0") @RequestParam(required = false) Integer offset, - @Parameter(in = ParameterIn.QUERY, description = "limit, page size") @RequestParam(required = false) Integer limit); + @Parameter(in = ParameterIn.QUERY, description = "page starting from 0, offset") @RequestParam(required = false) Integer page, + @Parameter(in = ParameterIn.QUERY, description = "page size, limit") @RequestParam(required = false) Integer pageSize); /** * Find valid structures by mnemonic (search). - * Return list of structure elements. + * Return paged list of structure elements. * * @param mnemonic mnemonic to search for * @param orderBy order by field * @param isAsc sort order, ascending or descending - * @param offset offset, page starting from 0 - * @param limit limit, page size - * @return list of structure elements + * @param page page starting from 0, offset + * @param pageSize page size, limit + * @return paged list of structure elements */ @Operation( summary = "Find valid structures by mnemonic (search)", @@ -249,7 +251,7 @@ public interface IStructures { + "Return list of structure elements." ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of structure elements.", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), + @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of structure elements.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageStructureElements.class))), @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) }) @@ -258,23 +260,23 @@ public interface IStructures { method = RequestMethod.GET, produces = {"application/json"}) @GetMapping - public List<StructureElement> readStructuresMnemonic( + public ResponsePageStructureElements readStructuresMnemonic( @Parameter(in = ParameterIn.PATH, description = "mnemonic to search for") @PathVariable("mnemonic") String mnemonic, @Parameter(in = ParameterIn.QUERY, description = "order by field") @RequestParam(required = false) FieldStructure orderBy, @Parameter(in = ParameterIn.QUERY, description = "sort order, ascending or descending") @RequestParam(required = false) Boolean isAsc, - @Parameter(in = ParameterIn.QUERY, description = "offset, page starting from 0") @RequestParam(required = false) Integer offset, - @Parameter(in = ParameterIn.QUERY, description = "limit, page size") @RequestParam(required = false) Integer limit); + @Parameter(in = ParameterIn.QUERY, description = "page starting from 0, offset") @RequestParam(required = false) Integer page, + @Parameter(in = ParameterIn.QUERY, description = "page size, limit") @RequestParam(required = false) Integer pageSize); /** * Find valid structures by mnemonic path (search). - * Return list of structure elements. + * Return paged list of structure elements. * * @param mnemonicpath mnemonic path to search for * @param orderBy order by field * @param isAsc sort order, ascending or descending - * @param offset offset, page starting from 0 - * @param limit limit, page size - * @return list of structure elements + * @param page page starting from 0, offset + * @param pageSize page size, limit + * @return paged list of structure elements */ @Operation( summary = "Find valid structures by mnemonic path (search)", @@ -282,7 +284,7 @@ public interface IStructures { + "Return list of structure elements." ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of structure elements.", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), + @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of structure elements.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageStructureElements.class))), @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) }) @@ -291,24 +293,24 @@ public interface IStructures { method = RequestMethod.GET, produces = {"application/json"}) @GetMapping - public List<StructureElement> readStructuresMnemonicpath( + public ResponsePageStructureElements readStructuresMnemonicpath( @Parameter(in = ParameterIn.PATH, description = "mnemonic path to search for") @PathVariable("mnemonicpath") String mnemonicpath, @Parameter(in = ParameterIn.QUERY, description = "order by field") @RequestParam(required = false) FieldStructure orderBy, @Parameter(in = ParameterIn.QUERY, description = "sort order, ascending or descending") @RequestParam(required = false) Boolean isAsc, - @Parameter(in = ParameterIn.QUERY, description = "offset, page starting from 0") @RequestParam(required = false) Integer offset, - @Parameter(in = ParameterIn.QUERY, description = "limit, page size") @RequestParam(required = false) Integer limit); + @Parameter(in = ParameterIn.QUERY, description = "page starting from 0, offset") @RequestParam(required = false) Integer page, + @Parameter(in = ParameterIn.QUERY, description = "page size, limit") @RequestParam(required = false) Integer pageSize); /** * Find history for structure by uuid (exact match). - * Return list of structure elements. + * Return paged list of structure elements. * * @param uuid uuid to find history for * @param type type of structure to search in * @param orderBy order by field * @param isAsc sort order, ascending or descending - * @param offset offset, page starting from 0 - * @param limit limit, page size - * @return list of structure elements + * @param page page starting from 0, offset + * @param pageSize page size, limit + * @return paged list of structure elements */ @Operation( summary = "Find history for structure by uuid (exact match)", @@ -316,7 +318,7 @@ public interface IStructures { + "Return list of structure elements." ) @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of structure elements.", content = @Content(mediaType = "application/json", array = @ArraySchema(schema = @Schema(implementation = StructureElement.class)))), + @ApiResponse(responseCode = "200", description = "Method completed OK. Return array of structure elements.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = ResponsePageStructureElements.class))), @ApiResponse(responseCode = "400", description = "Bad request. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))), @ApiResponse(responseCode = "500", description = "Internal server error. Message and details are available.", content = @Content(mediaType = "application/json", schema = @Schema(implementation = Response.class))) }) @@ -324,13 +326,13 @@ public interface IStructures { value = "/history/{uuid}", method = RequestMethod.GET, produces = {"application/json"}) - public List<StructureElement> readStructuresHistory( + public ResponsePageStructureElements readStructuresHistory( @Parameter(in = ParameterIn.PATH, description = "uuid to find structure for") @PathVariable("uuid") String uuid, @Parameter(in = ParameterIn.QUERY, description = "type of structure to search in") @RequestParam(required = false) Type type, @Parameter(in = ParameterIn.QUERY, description = "order by field") @RequestParam(required = false) FieldStructure orderBy, @Parameter(in = ParameterIn.QUERY, description = "sort order, ascending or descending") @RequestParam(required = false) Boolean isAsc, - @Parameter(in = ParameterIn.QUERY, description = "offset, page starting from 0") @RequestParam(required = false) Integer offset, - @Parameter(in = ParameterIn.QUERY, description = "limit, page size") @RequestParam(required = false) Integer limit); + @Parameter(in = ParameterIn.QUERY, description = "page starting from 0, offset") @RequestParam(required = false) Integer page, + @Parameter(in = ParameterIn.QUERY, description = "page size, limit") @RequestParam(required = false) Integer pageSize); // ---------------------------------------------------------------------------------------------------- diff --git a/src/main/java/org/openepics/names/rest/controller/NamesController.java b/src/main/java/org/openepics/names/rest/controller/NamesController.java index f8cd4174e1a528cceb387953fc9ea9642a2553e6..c0871c6f2165f00040cd7f840556b6f8dfc344cc 100644 --- a/src/main/java/org/openepics/names/rest/controller/NamesController.java +++ b/src/main/java/org/openepics/names/rest/controller/NamesController.java @@ -32,6 +32,7 @@ import org.openepics.names.util.ServiceHttpStatusException; import org.openepics.names.util.response.Response; import org.openepics.names.util.response.ResponseBoolean; import org.openepics.names.util.response.ResponseBooleanList; +import org.openepics.names.util.response.ResponsePageNameElements; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.http.HttpStatus; @@ -86,13 +87,13 @@ public class NamesController implements INames { // ---------------------------------------------------------------------------------------------------- @Override - public List<NameElement> readNames( + public ResponsePageNameElements readNames( Boolean deleted, FieldName[] queryFields, String[] queryValues, - FieldName orderBy, Boolean isAsc, Integer offset, Integer limit) { + FieldName orderBy, Boolean isAsc, Integer page, Integer pageSize) { try { return namesService.readNames( deleted, queryFields, queryValues, - orderBy, isAsc, offset, limit); + orderBy, isAsc, page, pageSize); } catch (ServiceHttpStatusException e) { LogUtil.logServiceHttpStatusException(LOGGER, Level.SEVERE, e); LogUtil.logStackTraceElements(LOGGER, Level.SEVERE, e); @@ -105,11 +106,11 @@ public class NamesController implements INames { } @Override - public List<NameElement> readNames( + public ResponsePageNameElements readNames( String name, - FieldName orderBy, Boolean isAsc, Integer offset, Integer limit) { + FieldName orderBy, Boolean isAsc, Integer page, Integer pageSize) { try { - return namesService.readNames(name, orderBy, isAsc, offset, limit); + return namesService.readNames(name, orderBy, isAsc, page, pageSize); } catch (ServiceHttpStatusException e) { LogUtil.logServiceHttpStatusException(LOGGER, Level.SEVERE, e); LogUtil.logStackTraceElements(LOGGER, Level.SEVERE, e); @@ -122,11 +123,11 @@ public class NamesController implements INames { } @Override - public List<NameElement> readNamesSystemStructure( + public ResponsePageNameElements readNamesSystemStructure( String mnemonicpath, - FieldName orderBy, Boolean isAsc, Integer offset, Integer limit) { + FieldName orderBy, Boolean isAsc, Integer page, Integer pageSize) { try { - return namesService.readNamesSystemStructure(mnemonicpath, orderBy, isAsc, offset, limit); + return namesService.readNamesSystemStructure(mnemonicpath, orderBy, isAsc, page, pageSize); } catch (ServiceHttpStatusException e) { LogUtil.logServiceHttpStatusException(LOGGER, Level.SEVERE, e); LogUtil.logStackTraceElements(LOGGER, Level.SEVERE, e); @@ -139,11 +140,11 @@ public class NamesController implements INames { } @Override - public List<NameElement> readNamesDeviceStructure( + public ResponsePageNameElements readNamesDeviceStructure( String mnemonicpath, - FieldName orderBy, Boolean isAsc, Integer offset, Integer limit) { + FieldName orderBy, Boolean isAsc, Integer page, Integer pageSize) { try { - return namesService.readNamesDeviceStructure(mnemonicpath, orderBy, isAsc, offset, limit); + return namesService.readNamesDeviceStructure(mnemonicpath, orderBy, isAsc, page, pageSize); } catch (ServiceHttpStatusException e) { LogUtil.logServiceHttpStatusException(LOGGER, Level.SEVERE, e); LogUtil.logStackTraceElements(LOGGER, Level.SEVERE, e); @@ -156,11 +157,11 @@ public class NamesController implements INames { } @Override - public List<NameElement> readNamesHistory( + public ResponsePageNameElements readNamesHistory( String uuid, - FieldName orderBy, Boolean isAsc, Integer offset, Integer limit) { + FieldName orderBy, Boolean isAsc, Integer page, Integer pageSize) { try { - return namesService.readNamesHistory(uuid, orderBy, isAsc, offset, limit); + return namesService.readNamesHistory(uuid, orderBy, isAsc, page, pageSize); } catch (ServiceHttpStatusException e) { LogUtil.logServiceHttpStatusException(LOGGER, Level.SEVERE, e); LogUtil.logStackTraceElements(LOGGER, Level.SEVERE, e); diff --git a/src/main/java/org/openepics/names/rest/controller/StructuresController.java b/src/main/java/org/openepics/names/rest/controller/StructuresController.java index 9599570394b742545f7bff90b56c6d72118fb64d..83f684a24aac395eb5d3770dd591e0bbf0b285b6 100644 --- a/src/main/java/org/openepics/names/rest/controller/StructuresController.java +++ b/src/main/java/org/openepics/names/rest/controller/StructuresController.java @@ -34,6 +34,7 @@ import org.openepics.names.util.ServiceHttpStatusException; import org.openepics.names.util.response.Response; import org.openepics.names.util.response.ResponseBoolean; import org.openepics.names.util.response.ResponseBooleanList; +import org.openepics.names.util.response.ResponsePageStructureElements; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.http.HttpStatus; @@ -95,13 +96,13 @@ public class StructuresController implements IStructures { // ---------------------------------------------------------------------------------------------------- @Override - public List<StructureElement> readStructures( + public ResponsePageStructureElements readStructures( Type type, Status[] statuses, Boolean deleted, FieldStructure[] queryFields, String[] queryValues, - FieldStructure orderBy, Boolean isAsc, Integer offset, Integer limit) { + FieldStructure orderBy, Boolean isAsc, Integer page, Integer pageSize) { try { return structuresService.readStructures( type, statuses, deleted, queryFields, queryValues, - orderBy, isAsc, offset, limit); + orderBy, isAsc, page, pageSize); } catch (ServiceHttpStatusException e) { LogUtil.logServiceHttpStatusException(LOGGER, Level.SEVERE, e); LogUtil.logStackTraceElements(LOGGER, Level.SEVERE, e); @@ -114,13 +115,13 @@ public class StructuresController implements IStructures { } @Override - public List<StructureElement> readStructuresChildren( + public ResponsePageStructureElements readStructuresChildren( Type type, String uuid, - FieldStructure orderBy, Boolean isAsc, Integer offset, Integer limit) { + FieldStructure orderBy, Boolean isAsc, Integer page, Integer pageSize) { try { return structuresService.readStructuresChildren( type, uuid, - orderBy, isAsc, offset, limit); + orderBy, isAsc, page, pageSize); } catch (ServiceHttpStatusException e) { LogUtil.logServiceHttpStatusException(LOGGER, Level.SEVERE, e); LogUtil.logStackTraceElements(LOGGER, Level.SEVERE, e); @@ -133,11 +134,11 @@ public class StructuresController implements IStructures { } @Override - public List<StructureElement> readStructuresMnemonic( + public ResponsePageStructureElements readStructuresMnemonic( String mnemonic, - FieldStructure orderBy, Boolean isAsc, Integer offset, Integer limit) { + FieldStructure orderBy, Boolean isAsc, Integer page, Integer pageSize) { try { - return structuresService.readStructuresMnemonic(mnemonic, orderBy, isAsc, offset, limit); + return structuresService.readStructuresMnemonic(mnemonic, orderBy, isAsc, page, pageSize); } catch (ServiceHttpStatusException e) { LogUtil.logServiceHttpStatusException(LOGGER, Level.SEVERE, e); LogUtil.logStackTraceElements(LOGGER, Level.SEVERE, e); @@ -150,11 +151,11 @@ public class StructuresController implements IStructures { } @Override - public List<StructureElement> readStructuresMnemonicpath( + public ResponsePageStructureElements readStructuresMnemonicpath( String mnemonicpath, - FieldStructure orderBy, Boolean isAsc, Integer offset, Integer limit) { + FieldStructure orderBy, Boolean isAsc, Integer page, Integer pageSize) { try { - return structuresService.readStructuresMnemonicpath(mnemonicpath, orderBy, isAsc, offset, limit); + return structuresService.readStructuresMnemonicpath(mnemonicpath, orderBy, isAsc, page, pageSize); } catch (ServiceHttpStatusException e) { LogUtil.logServiceHttpStatusException(LOGGER, Level.SEVERE, e); LogUtil.logStackTraceElements(LOGGER, Level.SEVERE, e); @@ -167,13 +168,13 @@ public class StructuresController implements IStructures { } @Override - public List<StructureElement> readStructuresHistory( + public ResponsePageStructureElements readStructuresHistory( String uuid, Type type, - FieldStructure orderBy, Boolean isAsc, Integer offset, Integer limit) { + FieldStructure orderBy, Boolean isAsc, Integer page, Integer pageSize) { try { return structuresService.readStructuresHistory( uuid, type, - orderBy, isAsc, offset, limit); + orderBy, isAsc, page, pageSize); } catch (ServiceHttpStatusException e) { LogUtil.logServiceHttpStatusException(LOGGER, Level.SEVERE, e); LogUtil.logStackTraceElements(LOGGER, Level.SEVERE, e); diff --git a/src/main/java/org/openepics/names/service/NamesService.java b/src/main/java/org/openepics/names/service/NamesService.java index 0c16cee50b79c802fe385863974bb24b31088da2..d8141f78cd61ce9f8d1847f5dbb4ce7da6ada2bd 100644 --- a/src/main/java/org/openepics/names/service/NamesService.java +++ b/src/main/java/org/openepics/names/service/NamesService.java @@ -48,6 +48,7 @@ import org.openepics.names.util.HolderIRepositories; import org.openepics.names.util.HolderSystemDeviceStructure; import org.openepics.names.util.NameElementUtil; import org.openepics.names.util.ValidateUtil; +import org.openepics.names.util.response.ResponsePageNameElements; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; @@ -141,13 +142,13 @@ public class NamesService { // ---------------------------------------------------------------------------------------------------- - public List<NameElement> readNames( + public ResponsePageNameElements readNames( Boolean deleted, FieldName[] queryFields, String[] queryValues, FieldName orderBy, Boolean isAsc, Integer offset, Integer limit) { return readNames(deleted, queryFields, queryValues, Boolean.FALSE, orderBy, isAsc, offset, limit); } - public List<NameElement> readNames( + public ResponsePageNameElements readNames( Boolean deleted, FieldName[] queryFields, String[] queryValues, Boolean includeHistory, FieldName orderBy, Boolean isAsc, Integer offset, Integer limit) { @@ -187,17 +188,19 @@ public class NamesService { // do List<Name> names = nameRepository.readNames(deleted, queryFields, queryValues, includeHistory, orderBy, isAsc, offset, limit); + Long totalCount = nameRepository.countNames(deleted, queryFields, queryValues, includeHistory); final List<NameElement> nameElements = Lists.newArrayList(); for (Name name : names) { nameElements.add(NameElementUtil.getNameElement(name)); } - LOGGER.log(Level.INFO, "readNames, nameElements.size: " + nameElements.size()); - return nameElements; + ResponsePageNameElements response = new ResponsePageNameElements(nameElements, totalCount, nameElements.size(), offset, limit); + LOGGER.log(Level.INFO, "readNames, response: " + response); + return response; } - public List<NameElement> readNames( + public ResponsePageNameElements readNames( String name, FieldName orderBy, Boolean isAsc, Integer offset, Integer limit) { @@ -221,16 +224,16 @@ public class NamesService { Name latestByUuid = holderIRepositories.getNameRepository().findLatestByUuid(name); if (latestByUuid != null) { nameElements.add(NameElementUtil.getNameElement(latestByUuid)); + return new ResponsePageNameElements(nameElements, Long.valueOf(nameElements.size()), nameElements.size(), offset, limit); } } catch (IllegalArgumentException e) { - nameElements.addAll(readNames(false, new FieldName[] {FieldName.NAME}, new String[] {name}, orderBy, isAsc, offset, limit)); + return readNames(false, new FieldName[] {FieldName.NAME}, new String[] {name}, orderBy, isAsc, offset, limit); } - LOGGER.log(Level.INFO, "readNames, nameElements.size: " + nameElements.size()); - return nameElements; + return new ResponsePageNameElements(); } - public List<NameElement> readNamesSystemStructure( + public ResponsePageNameElements readNamesSystemStructure( String mnemonicpath, FieldName orderBy, Boolean isAsc, Integer offset, Integer limit) { @@ -250,7 +253,7 @@ public class NamesService { return readNames(false, new FieldName[] {FieldName.SYSTEMSTRUCTURE}, new String[] {mnemonicpath}, orderBy, isAsc, offset, limit); } - public List<NameElement> readNamesDeviceStructure( + public ResponsePageNameElements readNamesDeviceStructure( String mnemonicpath, FieldName orderBy, Boolean isAsc, Integer offset, Integer limit) { @@ -270,7 +273,7 @@ public class NamesService { return readNames(false, new FieldName[] {FieldName.DEVICESTRUCTURE}, new String[] {mnemonicpath}, orderBy, isAsc, offset, limit); } - public List<NameElement> readNamesHistory( + public ResponsePageNameElements readNamesHistory( String uuid, FieldName orderBy, Boolean isAsc, Integer offset, Integer limit) { LOGGER.log(Level.INFO, "readNamesHistory, uuid: " + uuid); @@ -288,18 +291,15 @@ public class NamesService { ValidateUtil.validateInputUuid(uuid); // do - List<NameElement> nameElements = readNames(null, new FieldName[] {FieldName.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit); - - Collections.sort(nameElements, new Comparator<NameElement>() { - @Override - public int compare(NameElement e1, NameElement e2) { - return e1.getWhen().compareTo(e2.getWhen()); - } + ResponsePageNameElements response = readNames(null, new FieldName[] {FieldName.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit); + Collections.sort(response.getList(), new Comparator<NameElement>() { + @Override + public int compare(NameElement e1, NameElement e2) { + return e1.getWhen().compareTo(e2.getWhen()); + } }); - LOGGER.log(Level.INFO, "readNamesHistory, nameElements.size: " + nameElements.size()); - - return nameElements; + return response; } // ---------------------------------------------------------------------------------------------------- diff --git a/src/main/java/org/openepics/names/service/StructuresService.java b/src/main/java/org/openepics/names/service/StructuresService.java index cfe87fc9f9fa98df5ef953d99173ff6e552efff1..8cc888f82fc530cb4ca990d4db192b7d0704fea3 100644 --- a/src/main/java/org/openepics/names/service/StructuresService.java +++ b/src/main/java/org/openepics/names/service/StructuresService.java @@ -59,6 +59,7 @@ import org.openepics.names.util.HolderSystemDeviceStructure; import org.openepics.names.util.StructureElementUtil; import org.openepics.names.util.StructureElementUtil.StructureChoice; import org.openepics.names.util.ValidateUtil; +import org.openepics.names.util.response.ResponsePageStructureElements; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -255,14 +256,14 @@ public class StructuresService { // ---------------------------------------------------------------------------------------------------- - public List<StructureElement> readStructures( + public ResponsePageStructureElements readStructures( Type type, Status[] statuses, Boolean deleted, FieldStructure[] queryFields, String[] queryValues, FieldStructure orderBy, Boolean isAsc, Integer offset, Integer limit) { return readStructures(type, statuses, deleted, queryFields, queryValues, Boolean.FALSE, orderBy, isAsc, offset, limit, StructureChoice.STRUCTURE); } //need to have public static enum StructureChoice {HISTORY, STRUCTURE}; - public List<StructureElement> readStructures( + public ResponsePageStructureElements readStructures( Type type, Status[] statuses, Boolean deleted, FieldStructure[] queryFields, String[] queryValues, Boolean includeHistory, FieldStructure orderBy, Boolean isAsc, Integer offset, Integer limit, StructureChoice structureChoice) { @@ -315,12 +316,14 @@ public class StructuresService { // do final List<StructureElement> structureElements = Lists.newArrayList(); + Long totalCount = null; if (Type.SYSTEMGROUP.equals(type)) { List<SystemGroup> systemGroups = holderRepositories.getSystemGroupRepository().readSystemGroups( statuses, deleted, queryFields, queryValues, includeHistory, orderBy, isAsc, offset, limit); + totalCount = holderRepositories.getSystemGroupRepository().countSystemGroups(statuses, deleted, queryFields, queryValues, includeHistory); LOGGER.log(Level.INFO, "readStructures, systemGroups.size: " + systemGroups.size()); structureElements.addAll(StructureElementUtil.getStructureElementsForSystemGroups(systemGroups, holder, structureChoice)); } else if (Type.SYSTEM.equals(type)) { @@ -329,6 +332,7 @@ public class StructuresService { includeHistory, orderBy, isAsc, offset, limit); + totalCount = holderRepositories.getSystemRepository().countSystems(statuses, deleted, queryFields, queryValues, includeHistory); LOGGER.log(Level.INFO, "readStructures, systems.size: " + systems.size()); structureElements.addAll(StructureElementUtil.getStructureElementsForSystems(systems, holder, structureChoice)); } else if (Type.SUBSYSTEM.equals(type)) { @@ -337,6 +341,7 @@ public class StructuresService { includeHistory, orderBy, isAsc, offset, limit); + totalCount = holderRepositories.getSubsystemRepository().countSubsystems(statuses, deleted, queryFields, queryValues, includeHistory); LOGGER.log(Level.INFO, "readStructures, subsystems.size: " + subsystems.size()); structureElements.addAll(StructureElementUtil.getStructureElementsForSubsystems(subsystems, holder, structureChoice)); } else if (Type.DISCIPLINE.equals(type)) { @@ -345,6 +350,7 @@ public class StructuresService { includeHistory, orderBy, isAsc, offset, limit); + totalCount = holderRepositories.getDisciplineRepository().countDisciplines(statuses, deleted, queryFields, queryValues, includeHistory); LOGGER.log(Level.INFO, "readStructures, disciplines.size: " + disciplines.size()); structureElements.addAll(StructureElementUtil.getStructureElementsForDisciplines(disciplines, holder, structureChoice)); } else if (Type.DEVICEGROUP.equals(type)) { @@ -353,6 +359,7 @@ public class StructuresService { includeHistory, orderBy, isAsc, offset, limit); + totalCount = holderRepositories.getDeviceGroupRepository().countDeviceGroups(statuses, deleted, queryFields, queryValues, includeHistory); LOGGER.log(Level.INFO, "readStructures, deviceGroups.size: " + deviceGroups.size()); structureElements.addAll(StructureElementUtil.getStructureElementsForDeviceGroups(deviceGroups, holder, structureChoice)); } else if (Type.DEVICETYPE.equals(type)) { @@ -361,15 +368,17 @@ public class StructuresService { includeHistory, orderBy, isAsc, offset, limit); + totalCount = holderRepositories.getDeviceTypeRepository().countDeviceTypes(statuses, deleted, queryFields, queryValues, includeHistory); LOGGER.log(Level.INFO, "readStructures, deviceTypes.size: " + deviceTypes.size()); structureElements.addAll(StructureElementUtil.getStructureElementsForDeviceTypes(deviceTypes, holder, structureChoice)); } - LOGGER.log(Level.INFO, "readStructures, structureElements.size: " + structureElements.size()); - return structureElements; + ResponsePageStructureElements response = new ResponsePageStructureElements(structureElements, totalCount, structureElements.size(), offset, limit); + LOGGER.log(Level.INFO, "readStructures, response: " + response); + return response; } - public List<StructureElement> readStructuresChildren( + public ResponsePageStructureElements readStructuresChildren( Type type, String uuid, FieldStructure orderBy, Boolean isAsc, Integer offset, Integer limit) { @@ -388,25 +397,30 @@ public class StructuresService { ValidateUtil.validateInputUuid(uuid); // do - List<StructureElement> structureElements = Lists.newArrayList(); if (Type.SYSTEMGROUP.equals(type)) { - structureElements.addAll(readStructures(Type.SYSTEM, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.PARENT}, new String[] {uuid}, orderBy, isAsc, offset, limit)); + return readStructures(Type.SYSTEM, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.PARENT}, new String[] {uuid}, orderBy, isAsc, offset, limit); } else if (Type.SYSTEM.equals(type)) { - structureElements.addAll(readStructures(Type.SUBSYSTEM, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.PARENT}, new String[] {uuid}, orderBy, isAsc, offset, limit)); + return readStructures(Type.SUBSYSTEM, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.PARENT}, new String[] {uuid}, orderBy, isAsc, offset, limit); } else if (Type.SUBSYSTEM.equals(type)) { // no children in structures } else if (Type.DISCIPLINE.equals(type)) { - structureElements.addAll(readStructures(Type.DEVICEGROUP, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.PARENT}, new String[] {uuid}, orderBy, isAsc, offset, limit)); + return readStructures(Type.DEVICEGROUP, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.PARENT}, new String[] {uuid}, orderBy, isAsc, offset, limit); } else if (Type.DEVICEGROUP.equals(type)) { - structureElements.addAll(readStructures(Type.DEVICETYPE, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.PARENT}, new String[] {uuid}, orderBy, isAsc, offset, limit)); + return readStructures(Type.DEVICETYPE, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.PARENT}, new String[] {uuid}, orderBy, isAsc, offset, limit); } else if (Type.DEVICETYPE.equals(type)) { // no children in structures } - LOGGER.log(Level.INFO, "readStructuresChildren, structureElements.size: " + structureElements.size()); - return structureElements; + + ResponsePageStructureElements response = new ResponsePageStructureElements(); + response.setTotalCount(0L); + response.setListSize(0); + response.setPage(offset); + response.setPageSize(limit); + + return new ResponsePageStructureElements(); } - public List<StructureElement> readStructuresMnemonic( + public ResponsePageStructureElements readStructuresMnemonic( String mnemonic, FieldStructure orderBy, Boolean isAsc, Integer offset, Integer limit) { @@ -421,20 +435,27 @@ public class StructuresService { ValidateUtil.validateInputMnemonic(mnemonic); // do - List<StructureElement> structureElements = Lists.newArrayList(); - structureElements.addAll(readStructures(Type.SYSTEMGROUP, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONIC}, new String[] {mnemonic}, orderBy, isAsc, offset, limit)); - structureElements.addAll(readStructures(Type.SYSTEM, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONIC}, new String[] {mnemonic}, orderBy, isAsc, offset, limit)); - structureElements.addAll(readStructures(Type.SUBSYSTEM, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONIC}, new String[] {mnemonic}, orderBy, isAsc, offset, limit)); - structureElements.addAll(readStructures(Type.DISCIPLINE, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONIC}, new String[] {mnemonic}, orderBy, isAsc, offset, limit)); - structureElements.addAll(readStructures(Type.DEVICEGROUP, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONIC}, new String[] {mnemonic}, orderBy, isAsc, offset, limit)); - structureElements.addAll(readStructures(Type.DEVICETYPE, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONIC}, new String[] {mnemonic}, orderBy, isAsc, offset, limit)); + // TODO handle orderBy, isAsc, offset, limit - // TODO handle orderBy, isAsc, offset, limit + ResponsePageStructureElements responseSystemGroup = readStructures(Type.SYSTEMGROUP, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONIC}, new String[] {mnemonic}, orderBy, isAsc, offset, limit); + ResponsePageStructureElements responseSystem = readStructures(Type.SYSTEM, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONIC}, new String[] {mnemonic}, orderBy, isAsc, offset, limit); + ResponsePageStructureElements responseSubsystem = readStructures(Type.SUBSYSTEM, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONIC}, new String[] {mnemonic}, orderBy, isAsc, offset, limit); + ResponsePageStructureElements responseDiscipline = readStructures(Type.DISCIPLINE, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONIC}, new String[] {mnemonic}, orderBy, isAsc, offset, limit); + ResponsePageStructureElements responseDeviceGroup = readStructures(Type.DEVICEGROUP, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONIC}, new String[] {mnemonic}, orderBy, isAsc, offset, limit); + ResponsePageStructureElements responseDeviceType = readStructures(Type.DEVICETYPE, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONIC}, new String[] {mnemonic}, orderBy, isAsc, offset, limit); - return structureElements; + List<StructureElement> structureElements = Lists.newArrayList(); + structureElements.addAll(responseSystemGroup.getList()); + structureElements.addAll(responseSystem.getList()); + structureElements.addAll(responseSubsystem.getList()); + structureElements.addAll(responseDiscipline.getList()); + structureElements.addAll(responseDeviceGroup.getList()); + structureElements.addAll(responseDeviceType.getList()); + + return new ResponsePageStructureElements(structureElements, Long.valueOf(structureElements.size()), structureElements.size(), 0, structureElements.size()); } - public List<StructureElement> readStructuresMnemonicpath( + public ResponsePageStructureElements readStructuresMnemonicpath( String mnemonicpath, FieldStructure orderBy, Boolean isAsc, Integer offset, Integer limit) { @@ -449,17 +470,24 @@ public class StructuresService { ValidateUtil.validateInputMnemonic(mnemonicpath); // do - List<StructureElement> structureElements = Lists.newArrayList(); - structureElements.addAll(readStructures(Type.SYSTEMGROUP, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONICPATH}, new String[] {mnemonicpath}, orderBy, isAsc, offset, limit)); - structureElements.addAll(readStructures(Type.SYSTEM, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONICPATH}, new String[] {mnemonicpath}, orderBy, isAsc, offset, limit)); - structureElements.addAll(readStructures(Type.SUBSYSTEM, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONICPATH}, new String[] {mnemonicpath}, orderBy, isAsc, offset, limit)); - structureElements.addAll(readStructures(Type.DISCIPLINE, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONICPATH}, new String[] {mnemonicpath}, orderBy, isAsc, offset, limit)); - structureElements.addAll(readStructures(Type.DEVICEGROUP, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONICPATH}, new String[] {mnemonicpath}, orderBy, isAsc, offset, limit)); - structureElements.addAll(readStructures(Type.DEVICETYPE, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONICPATH}, new String[] {mnemonicpath}, orderBy, isAsc, offset, limit)); + // TODO handle orderBy, isAsc, offset, limit - // TODO handle orderBy, isAsc, offset, limit + ResponsePageStructureElements responseSystemGroup = readStructures(Type.SYSTEMGROUP, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONICPATH}, new String[] {mnemonicpath}, orderBy, isAsc, offset, limit); + ResponsePageStructureElements responseSystem = readStructures(Type.SYSTEM, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONICPATH}, new String[] {mnemonicpath}, orderBy, isAsc, offset, limit); + ResponsePageStructureElements responseSubsystem = readStructures(Type.SUBSYSTEM, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONICPATH}, new String[] {mnemonicpath}, orderBy, isAsc, offset, limit); + ResponsePageStructureElements responseDiscipline = readStructures(Type.DISCIPLINE, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONICPATH}, new String[] {mnemonicpath}, orderBy, isAsc, offset, limit); + ResponsePageStructureElements responseDeviceGroup = readStructures(Type.DEVICEGROUP, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONICPATH}, new String[] {mnemonicpath}, orderBy, isAsc, offset, limit); + ResponsePageStructureElements responseDeviceType = readStructures(Type.DEVICETYPE, new Status[] {Status.APPROVED}, false, new FieldStructure[] {FieldStructure.MNEMONICPATH}, new String[] {mnemonicpath}, orderBy, isAsc, offset, limit); - return structureElements; + List<StructureElement> structureElements = Lists.newArrayList(); + structureElements.addAll(responseSystemGroup.getList()); + structureElements.addAll(responseSystem.getList()); + structureElements.addAll(responseSubsystem.getList()); + structureElements.addAll(responseDiscipline.getList()); + structureElements.addAll(responseDeviceGroup.getList()); + structureElements.addAll(responseDeviceType.getList()); + + return new ResponsePageStructureElements(structureElements, Long.valueOf(structureElements.size()), structureElements.size(), 0, structureElements.size()); } /** @@ -469,7 +497,7 @@ public class StructuresService { * @param type type * @return list of structure elements */ - public List<StructureElement> readStructuresHistory( + public ResponsePageStructureElements readStructuresHistory( String uuid, Type type, FieldStructure orderBy, Boolean isAsc, Integer offset, Integer limit) { @@ -500,39 +528,52 @@ public class StructuresService { // do final List<StructureElement> structureElements = Lists.newArrayList(); + ResponsePageStructureElements response = null; if (type_either) { if (type_systemGroup) { - structureElements.addAll(readStructures(Type.SYSTEMGROUP, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY)); + response = readStructures(Type.SYSTEMGROUP, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY); } else if (type_system) { - structureElements.addAll(readStructures(Type.SYSTEM, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY)); + response = readStructures(Type.SYSTEM, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY); } else if (type_subsystem) { - structureElements.addAll(readStructures(Type.SUBSYSTEM, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY)); + response = readStructures(Type.SUBSYSTEM, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY); } else if (type_discipline) { - structureElements.addAll(readStructures(Type.DISCIPLINE, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY)); + response = readStructures(Type.DISCIPLINE, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY); } else if (type_deviceGroup) { - structureElements.addAll(readStructures(Type.DEVICEGROUP, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY)); + response = readStructures(Type.DEVICEGROUP, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY); } else if (type_deviceType) { - structureElements.addAll(readStructures(Type.DEVICETYPE, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY)); + response = readStructures(Type.DEVICETYPE, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY); } } else { // go through all structures and see if / where uuid is found + // uuid in 0 or 1 of structures + + ResponsePageStructureElements responseSystemGroup = readStructures(Type.SYSTEMGROUP, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY); + ResponsePageStructureElements responseSystem = readStructures(Type.SYSTEM, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY); + ResponsePageStructureElements responseSubsystem = readStructures(Type.SUBSYSTEM, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY); + ResponsePageStructureElements responseDiscipline = readStructures(Type.DISCIPLINE, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY); + ResponsePageStructureElements responseDeviceGroup = readStructures(Type.DEVICEGROUP, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY); + ResponsePageStructureElements responseDeviceType = readStructures(Type.DEVICETYPE, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY); + + structureElements.addAll(responseSystemGroup.getList()); + structureElements.addAll(responseSystem.getList()); + structureElements.addAll(responseSubsystem.getList()); + structureElements.addAll(responseDiscipline.getList()); + structureElements.addAll(responseDeviceGroup.getList()); + structureElements.addAll(responseDeviceType.getList()); + + // uuid is in max one structure + response = new ResponsePageStructureElements(structureElements, Long.valueOf(structureElements.size()), structureElements.size(), offset, limit); - structureElements.addAll(readStructures(Type.SYSTEMGROUP, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY)); - structureElements.addAll(readStructures(Type.SYSTEM, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY)); - structureElements.addAll(readStructures(Type.SUBSYSTEM, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY)); - structureElements.addAll(readStructures(Type.DISCIPLINE, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY)); - structureElements.addAll(readStructures(Type.DEVICEGROUP, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY)); - structureElements.addAll(readStructures(Type.DEVICETYPE, null, null, new FieldStructure[] {FieldStructure.UUID}, new String[] {uuid}, Boolean.TRUE, orderBy, isAsc, offset, limit, StructureChoice.HISTORY)); } - Collections.sort(structureElements, new Comparator<StructureElement>() { + Collections.sort(response.getList(), new Comparator<StructureElement>() { @Override public int compare(StructureElement e1, StructureElement e2) { return e1.getWhen().compareTo(e2.getWhen()); } }); - return structureElements; + return response; } // ---------------------------------------------------------------------------------------------------- diff --git a/src/main/java/org/openepics/names/util/response/Response.java b/src/main/java/org/openepics/names/util/response/Response.java index 491bb9539a737971e911060848618ee2cb6016f6..6629789596a5a70f5c6b5149cb5da44ce5b6d971 100644 --- a/src/main/java/org/openepics/names/util/response/Response.java +++ b/src/main/java/org/openepics/names/util/response/Response.java @@ -35,10 +35,18 @@ public class Response { private String message = null; private String details = null; + /** + * Constructor. + */ public Response() { HEADER_JSON.add(Response.CONTENT_TYPE, Response.APP_JSON); } + /** + * Constructor. + * + * @param message response message + */ public Response(String message) { this(); @@ -46,6 +54,12 @@ public class Response { this.details = ""; } + /** + * Constructor. + * + * @param message response message + * @param details response details + */ public Response(String message, String details) { this(); @@ -53,16 +67,38 @@ public class Response { this.details = details; } + /** + * Return response message. + * + * @return response message + */ public String getMessage() { return this.message; } + + /** + * Set response message. + * + * @param message response message + */ public void setMessage(String message) { this.message = message; } + /** + * Return response details. + * + * @return response details + */ public String getDetails() { return this.details; } + + /** + * Set response details. + * + * @param details response details + */ public void setDetails(String details) { this.details = details; } diff --git a/src/main/java/org/openepics/names/util/response/ResponseBoolean.java b/src/main/java/org/openepics/names/util/response/ResponseBoolean.java index 5077279aaf4282ac36ce9b4d9f519a4b1c45c875..a9f92e7d2d7b4abfee3417289a020df0da16e8d7 100644 --- a/src/main/java/org/openepics/names/util/response/ResponseBoolean.java +++ b/src/main/java/org/openepics/names/util/response/ResponseBoolean.java @@ -25,29 +25,55 @@ package org.openepics.names.util.response; */ public class ResponseBoolean extends Response { - private Boolean response = null; + private Boolean value = null; + /** + * Constructor. + */ public ResponseBoolean() { super("", ""); } - public ResponseBoolean(Boolean response) { + /** + * Constructor. + * + * @param value response value + */ + public ResponseBoolean(Boolean value) { this(); - this.response = response; + this.value = value; } - public ResponseBoolean(Boolean response, String message) { + /** + * Constructor. + * + * @param value response value + * @param message response message + */ + public ResponseBoolean(Boolean value, String message) { super(message, ""); - this.response = response; + this.value = value; } - public ResponseBoolean(Boolean response, String message, String details) { + /** + * Constructor. + * + * @param value response value + * @param message response message + * @param details response details + */ + public ResponseBoolean(Boolean value, String message, String details) { super(message, details); - this.response = response; + this.value = value; } - public Boolean getResponse() { - return this.response; + /** + * Return response value. + * + * @return response value + */ + public Boolean getValue() { + return this.value; } } diff --git a/src/main/java/org/openepics/names/util/response/ResponseBooleanList.java b/src/main/java/org/openepics/names/util/response/ResponseBooleanList.java index ccffcc09ede2086a35070baffff0141505976d61..f5e287e37e3789fb78a60ff1f9d071736645879a 100644 --- a/src/main/java/org/openepics/names/util/response/ResponseBooleanList.java +++ b/src/main/java/org/openepics/names/util/response/ResponseBooleanList.java @@ -29,41 +29,88 @@ import com.google.common.collect.Lists; */ public class ResponseBooleanList extends ResponseBoolean { - private List<ResponseBoolean> responses = Lists.newArrayList(); + private List<ResponseBoolean> list = Lists.newArrayList(); + /** + * Constructor. + */ public ResponseBooleanList() { super(); } - public ResponseBooleanList(Boolean response) { - super(response); + /** + * Constructor. + * + * @param value response value + */ + public ResponseBooleanList(Boolean value) { + super(value); } - public ResponseBooleanList(Boolean response, String message) { - super(response, message, ""); + /** + * Constructor. + * + * @param value response value + * @param message response message + */ + public ResponseBooleanList(Boolean value, String message) { + super(value, message, ""); } - public ResponseBooleanList(Boolean response, String message, String details) { - super(response, message, details); + /** + *Constructor. + * + * @param value response value + * @param message response message + * @param details response details + */ + public ResponseBooleanList(Boolean value, String message, String details) { + super(value, message, details); } - public ResponseBooleanList(List<ResponseBoolean> responses, Boolean response) { - super(response); - this.responses = responses; + /** + * Constructor. + * + * @param list list of response boolean objects + * @param value response value + */ + public ResponseBooleanList(List<ResponseBoolean> list, Boolean value) { + super(value); + this.list = list; } - public ResponseBooleanList(List<ResponseBoolean> responses, Boolean response, String message) { - super(response, message, ""); - this.responses = responses; + /** + * Constructor. + * + * @param list list of response boolean objects + * @param value response value + * @param message response message + */ + public ResponseBooleanList(List<ResponseBoolean> list, Boolean value, String message) { + super(value, message, ""); + this.list = list; } - public ResponseBooleanList(List<ResponseBoolean> responses, Boolean response, String message, String details) { - super(response, message, details); - this.responses = responses; + /** + * Constructor. + * + * @param list list of response boolean objects + * @param value response value + * @param message response message + * @param details response details + */ + public ResponseBooleanList(List<ResponseBoolean> list, Boolean value, String message, String details) { + super(value, message, details); + this.list = list; } - public List<ResponseBoolean> getResponses() { - return this.responses; + /** + * Return list of response boolean objects. + * + * @return list of response boolean objects + */ + public List<ResponseBoolean> getList() { + return this.list; } } diff --git a/src/main/java/org/openepics/names/util/response/ResponsePage.java b/src/main/java/org/openepics/names/util/response/ResponsePage.java new file mode 100644 index 0000000000000000000000000000000000000000..16e463898516faf8b3a6982f2552781ea954b5a0 --- /dev/null +++ b/src/main/java/org/openepics/names/util/response/ResponsePage.java @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2022 European Spallation Source ERIC. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package org.openepics.names.util.response; + +/** + * This class is used to ensure response to request origin are handled in a uniform way. + * + * @author Lars Johansson + */ +public abstract class ResponsePage extends Response { + + // note + // offset - page + // limit - page size + + private Long totalCount; + private Integer listSize; + private Integer page; + private Integer pageSize; + + /** + * Constructor. + */ + public ResponsePage() { + super("", ""); + } + + /** + * Constructor. + * + * @param message response message + */ + public ResponsePage(String message) { + super(message, ""); + } + + /** + * Constructor. + * + * @param message response message + * @param details response details + */ + public ResponsePage(String message, String details) { + super(message, details); + } + + /** + * Return total count. + * + * @return total count + */ + public Long getTotalCount() { + return totalCount; + } + + /** + * Set total count. + * + * @param totalCount total count + */ + public void setTotalCount(Long totalCount) { + this.totalCount = totalCount; + } + + /** + * Return list size. + * + * @return list size + */ + public Integer getListSize() { + return listSize; + } + + /** + * Set list size. + * + * @param listSize list size + */ + public void setListSize(Integer listSize) { + this.listSize = listSize; + } + + /** + * Return page. + * + * @return page + */ + public Integer getPage() { + return page; + } + + /** + * Set page. + * + * @param page page + */ + public void setPage(Integer page) { + this.page = page; + } + + /** + * Return page size. + * + * @return page size + */ + public Integer getPageSize() { + return pageSize; + } + + /** + * Set page size. + * + * @param pageSize page size + */ + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + +} diff --git a/src/main/java/org/openepics/names/util/response/ResponsePageNameElements.java b/src/main/java/org/openepics/names/util/response/ResponsePageNameElements.java new file mode 100644 index 0000000000000000000000000000000000000000..b556ff4f022e1488ee6fca106e0b493da7c0b163 --- /dev/null +++ b/src/main/java/org/openepics/names/util/response/ResponsePageNameElements.java @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2022 European Spallation Source ERIC. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package org.openepics.names.util.response; + +import java.util.List; + +import org.openepics.names.rest.beans.NameElement; + +import com.google.common.collect.Lists; + +/** + * This class is used to ensure response to request origin are handled in a uniform way. + * + * @author Lars Johansson + */ +public class ResponsePageNameElements extends ResponsePage { + + private List<NameElement> list = Lists.newArrayList(); + + /** + * Constructor. + */ + public ResponsePageNameElements() { + super("", ""); + } + + /** + * Constructor. + * + * @param list list of name elements + */ + public ResponsePageNameElements(List<NameElement> list) { + this(); + this.list = list; + } + + /** + * Constructor. + * + * @param list list of name elements + * @param message response message + */ + public ResponsePageNameElements(List<NameElement> list, String message) { + super(message, ""); + this.list = list; + } + + /** + * Constructor. + * + * @param list list of name elements + * @param message response message + * @param details response details + */ + public ResponsePageNameElements(List<NameElement> list, String message, String details) { + super(message, details); + this.list = list; + } + + /** + * Constructor. + * + * @param list list of name elements + * @param totalCount total count + * @param listSize list size + * @param page page + * @param pageSize page size + */ + public ResponsePageNameElements(List<NameElement> list, Long totalCount, Integer listSize, Integer page, Integer pageSize) { + this(list); + super.setTotalCount(totalCount); + super.setListSize(listSize); + super.setPage(page); + super.setPageSize(pageSize); + } + + /** + * Return list of name elements. + * + * @return list of name elements + */ + public List<NameElement> getList() { + return this.list; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + sb.append("\"message\": " + getMessage()); + sb.append(", \"details\": " + getDetails()); + sb.append(", \"totalCount\": " + getTotalCount()); + sb.append(", \"listSize\": " + getListSize()); + sb.append(", \"page\": " + getPage()); + sb.append(", \"pageSize\": " + getPageSize()); + sb.append("}"); + return sb.toString(); + } + +} diff --git a/src/main/java/org/openepics/names/util/response/ResponsePageStructureElements.java b/src/main/java/org/openepics/names/util/response/ResponsePageStructureElements.java new file mode 100644 index 0000000000000000000000000000000000000000..72a6c6c81b7c27ef85eaf944fe04d4fccca87ff2 --- /dev/null +++ b/src/main/java/org/openepics/names/util/response/ResponsePageStructureElements.java @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2022 European Spallation Source ERIC. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package org.openepics.names.util.response; + +import java.util.List; + +import org.openepics.names.rest.beans.StructureElement; + +import com.google.common.collect.Lists; + +/** + * This class is used to ensure response to request origin are handled in a uniform way. + * + * @author Lars Johansson + */ +public class ResponsePageStructureElements extends ResponsePage { + + private List<StructureElement> list = Lists.newArrayList(); + + /** + * Constructor. + */ + public ResponsePageStructureElements() { + super("", ""); + super.setTotalCount(0L); + super.setListSize(0); + super.setPage(0); + super.setPageSize(0); + } + + /** + * Constructor. + * + * @param list list of structure elements + */ + public ResponsePageStructureElements(List<StructureElement> list) { + super("", ""); + this.list = list; + } + + /** + * Constructor. + * + * @param list list of structure elements + * @param message response message + */ + public ResponsePageStructureElements(List<StructureElement> list, String message) { + super(message, ""); + this.list = list; + } + + /** + * Constructor. + * + * @param list list of structure elements + * @param message response message + * @param details response details + */ + public ResponsePageStructureElements(List<StructureElement> list, String message, String details) { + super(message, details); + this.list = list; + } + + /** + * Constructor. + * + * @param list list of structure elements + * @param totalCount total count + * @param listSize list size + * @param page page + * @param pageSize page size + */ + public ResponsePageStructureElements(List<StructureElement> list, Long totalCount, Integer listSize, Integer page, Integer pageSize) { + this(list); + super.setTotalCount(totalCount); + super.setListSize(listSize); + super.setPage(page); + super.setPageSize(pageSize); + } + + /** + * Return list of structure elements. + * + * @return list of structure elements + */ + public List<StructureElement> getList() { + return this.list; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + sb.append("\"message\": " + getMessage()); + sb.append(", \"details\": " + getDetails()); + sb.append(", \"totalCount\": " + getTotalCount()); + sb.append(", \"listSize\": " + getListSize()); + sb.append(", \"page\": " + getPage()); + sb.append(", \"pageSize\": " + getPageSize()); + sb.append("}"); + return sb.toString(); + } + +} diff --git a/src/test/java/org/openepics/names/docker/ITUtil.java b/src/test/java/org/openepics/names/docker/ITUtil.java index d256ad73d0301ef42480ca631c318752ce5b5968..bf26ddc842141d87c70112a9a061abd4709ded04 100644 --- a/src/test/java/org/openepics/names/docker/ITUtil.java +++ b/src/test/java/org/openepics/names/docker/ITUtil.java @@ -265,7 +265,7 @@ public class ITUtil { */ static void assertEqualsResponseBoolean(ResponseBoolean actual, Boolean expectedResponse) { assertNotNull(actual); - assertEquals(expectedResponse, actual.getResponse()); + assertEquals(expectedResponse, actual.getValue()); } /** * Assert response boolean available with empty message. @@ -305,7 +305,7 @@ public class ITUtil { */ static void assertEqualsResponseBoolean(ResponseBooleanList actual, Boolean expectedResponse) { assertNotNull(actual); - assertEquals(expectedResponse, actual.getResponse()); + assertEquals(expectedResponse, actual.getValue()); } /** * Assert response boolean list available with empty message. diff --git a/src/test/java/org/openepics/names/docker/ITUtilNameStructureElement.java b/src/test/java/org/openepics/names/docker/ITUtilNameStructureElement.java index 603d9b6f91858e7ee1988050544cbe5ce07f21c5..bf8acd085dc4864c915f90c662335a82fe4044d9 100644 --- a/src/test/java/org/openepics/names/docker/ITUtilNameStructureElement.java +++ b/src/test/java/org/openepics/names/docker/ITUtilNameStructureElement.java @@ -35,6 +35,8 @@ import org.openepics.names.rest.beans.Status; import org.openepics.names.rest.beans.StructureElement; import org.openepics.names.rest.beans.Type; import org.openepics.names.util.response.ResponseBooleanList; +import org.openepics.names.util.response.ResponsePageNameElements; +import org.openepics.names.util.response.ResponsePageStructureElements; import com.fasterxml.jackson.databind.ObjectMapper; @@ -92,6 +94,31 @@ public class ITUtilNameStructureElement { // ---------------------------------------------------------------------------------------------------- + /** + * Assert that response page with list of name elements has expected length. + * + * @param actual response page with list of name elements + * @param expectedLength expected length of list + */ + static void assertContentLength(ResponsePageNameElements actual, int expectedLength) { + assertNotNull(actual); + assertEquals(expectedLength, actual.getList().size()); + assertEquals(expectedLength, actual.getListSize()); + } + + /** + * Assert that response page with list of name elements has length one and name element is available. + * + * @param actual response page with list of name elements + * @return name element + */ + static NameElement assertContentLengthOne(ResponsePageNameElements actual) { + assertContentLength(actual, 1); + assertNotNull(actual.getList().get(0)); + return actual.getList().get(0); + } + // ---------------------------------------------------------------------------------------------------- + /** * Assert that array of name elements has expected length. * @@ -326,6 +353,32 @@ public class ITUtilNameStructureElement { // ---------------------------------------------------------------------------------------------------- + /** + * Assert that response page with list of structure elements has expected length. + * + * @param actual response page with list of structure elements + * @param expectedLength expected length of list + */ + static void assertContentLength(ResponsePageStructureElements actual, int expectedLength) { + assertNotNull(actual); + assertEquals(expectedLength, actual.getList().size()); + assertEquals(expectedLength, actual.getListSize()); + } + + /** + * Assert that response page with list of structure elements has length one and structure element is available. + * + * @param actual response page with list of structure elements + * @return structure element + */ + static StructureElement assertContentLengthOne(ResponsePageStructureElements actual) { + assertContentLength(actual, 1); + assertNotNull(actual.getList().get(0)); + return actual.getList().get(0); + } + + // ---------------------------------------------------------------------------------------------------- + /** * Assert that array of structure elements has expected length. * diff --git a/src/test/java/org/openepics/names/docker/NamesIT.java b/src/test/java/org/openepics/names/docker/NamesIT.java index 50b2a8f081cc41fa23ec51e52ba046b5cb5a1933..3d4225e9042a5ec79e6f9219f1989ae257f280d3 100644 --- a/src/test/java/org/openepics/names/docker/NamesIT.java +++ b/src/test/java/org/openepics/names/docker/NamesIT.java @@ -39,6 +39,7 @@ import org.openepics.names.rest.beans.Type; import org.openepics.names.util.response.Response; import org.openepics.names.util.response.ResponseBoolean; import org.openepics.names.util.response.ResponseBooleanList; +import org.openepics.names.util.response.ResponsePageNameElements; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -949,111 +950,111 @@ public class NamesIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; - NameElement[] readNameElements = null; + ResponsePageNameElements responsePageNameElements = null; // read response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - assertTrue(readNameElements.length >= 8); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + assertTrue(responsePageNameElements.getListSize() >= 8); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "?queryFields=UUID&queryValues=" + uuid.toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - ITUtilNameStructureElement.assertContentLength(readNameElements, 1); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageNameElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "?queryFields=NAMEEQUIVALENCE&queryValues=RFQ-10%25"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - assertTrue(readNameElements.length >= 8); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + assertTrue(responsePageNameElements.getListSize() >= 8); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "?deleted=false"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - assertTrue(readNameElements.length >= 6); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + assertTrue(responsePageNameElements.getListSize() >= 6); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "?deleted=true"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - assertTrue(readNameElements.length >= 2); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + assertTrue(responsePageNameElements.getListSize() >= 2); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "/RFQ-010:EMR-FS-005"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - ITUtilNameStructureElement.assertContentLength(readNameElements, 1); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageNameElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "/RFQ-010:EMR-FS-0"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - ITUtilNameStructureElement.assertContentLength(readNameElements, 0); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageNameElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "/RFQ-010:EMR-FS-0__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - assertTrue(readNameElements.length >= 6); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + assertTrue(responsePageNameElements.getListSize() >= 6); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "/RFQ-010:EMR-FS-0%25"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - assertTrue(readNameElements.length >= 6); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + assertTrue(responsePageNameElements.getListSize() >= 6); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "/systemstructure/RFQ-010"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - assertTrue(readNameElements.length >= 6); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + assertTrue(responsePageNameElements.getListSize() >= 6); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "/systemstructure/RFQ-0"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - ITUtilNameStructureElement.assertContentLength(readNameElements, 0); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageNameElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "/systemstructure/RFQ-0__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - assertTrue(readNameElements.length >= 6); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + assertTrue(responsePageNameElements.getListSize() >= 6); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "/systemstructure/RFQ-N1U1"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - ITUtilNameStructureElement.assertContentLength(readNameElements, 0); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageNameElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "/devicestructure/EMR-FS"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - assertTrue(readNameElements.length >= 6); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + assertTrue(responsePageNameElements.getListSize() >= 6); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "/devicestructure/EMR-F"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - ITUtilNameStructureElement.assertContentLength(readNameElements, 0); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageNameElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "/devicestructure/EMR-F_"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - assertTrue(readNameElements.length >= 6); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + assertTrue(responsePageNameElements.getListSize() >= 6); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "/devicestructure/EMR-TT"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - ITUtilNameStructureElement.assertContentLength(readNameElements, 0); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageNameElements, 0); // history response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "/history/" + systemRFQ.toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - ITUtilNameStructureElement.assertContentLength(readNameElements, 0); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageNameElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "/history/" + uuid.toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - ITUtilNameStructureElement.assertContentLength(readNameElements, 3); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageNameElements, 3); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_NAMES + "/history/" + uuid2.toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readNameElements = mapper.readValue(response[1], NameElement[].class); - ITUtilNameStructureElement.assertContentLength(readNameElements, 1); + responsePageNameElements = mapper.readValue(response[1], ResponsePageNameElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageNameElements, 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -1080,7 +1081,7 @@ public class NamesIT { ITUtil.assertResponseLength2CodeOK(response); ResponseBoolean responseEntity = mapper.readValue(response[1], ResponseBoolean.class); assertNotNull(responseEntity); - assertFalse(responseEntity.getResponse()); + assertFalse(responseEntity.getValue()); } catch (IOException e) { fail(); } @@ -1095,7 +1096,7 @@ public class NamesIT { ITUtil.assertResponseLength2CodeOK(response); ResponseBoolean responseEntity = mapper.readValue(response[1], ResponseBoolean.class); assertNotNull(responseEntity); - assertFalse(responseEntity.getResponse()); + assertFalse(responseEntity.getValue()); } catch (IOException e) { fail(); } @@ -1110,7 +1111,7 @@ public class NamesIT { ITUtil.assertResponseLength2CodeOK(response); ResponseBoolean responseEntity = mapper.readValue(response[1], ResponseBoolean.class); assertNotNull(responseEntity); - assertFalse(responseEntity.getResponse()); + assertFalse(responseEntity.getValue()); } catch (IOException e) { fail(); } diff --git a/src/test/java/org/openepics/names/docker/StructuresDeviceGroupIT.java b/src/test/java/org/openepics/names/docker/StructuresDeviceGroupIT.java index 183a337a15547588afba84322cf72a302d83b7f4..9a5ed1e1d634283a86f8fc7c02b2fe2789c34d72 100644 --- a/src/test/java/org/openepics/names/docker/StructuresDeviceGroupIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresDeviceGroupIT.java @@ -38,6 +38,7 @@ import org.openepics.names.rest.beans.Type; import org.openepics.names.util.response.Response; import org.openepics.names.util.response.ResponseBoolean; import org.openepics.names.util.response.ResponseBooleanList; +import org.openepics.names.util.response.ResponsePageStructureElements; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -1249,9 +1250,10 @@ public class StructuresDeviceGroupIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement approvedStructureElement = null; int length = 0; @@ -1268,75 +1270,75 @@ public class StructuresDeviceGroupIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Di"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // approve approvedStructureElement = ITUtilNameStructureElement.assertApprove(structureElement); @@ -1344,75 +1346,75 @@ public class StructuresDeviceGroupIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?queryFields=UUID&queryValues=" + approvedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Di"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + approvedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -1435,9 +1437,10 @@ public class StructuresDeviceGroupIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement cancelledStructureElement = null; int length = 0; @@ -1454,75 +1457,75 @@ public class StructuresDeviceGroupIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Di"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // cancel cancelledStructureElement = ITUtilNameStructureElement.assertCancel(structureElement); @@ -1530,75 +1533,75 @@ public class StructuresDeviceGroupIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?queryFields=UUID&queryValues=" + cancelledStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Di"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + cancelledStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -1621,9 +1624,10 @@ public class StructuresDeviceGroupIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement rejectedStructureElement = null; int length = 0; @@ -1640,75 +1644,75 @@ public class StructuresDeviceGroupIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLengthOne(readStructureElements); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLengthOne(responsePageStructureElements); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Di"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // reject rejectedStructureElement = ITUtilNameStructureElement.assertReject(structureElement); @@ -1716,75 +1720,75 @@ public class StructuresDeviceGroupIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?queryFields=UUID&queryValues=" + rejectedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Di"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + rejectedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -2154,7 +2158,7 @@ public class StructuresDeviceGroupIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; - StructureElement[] readStructureElements = null; + ResponsePageStructureElements responsePageStructureElements = null; // from first structure element assertNotNull(uuid); @@ -2162,113 +2166,113 @@ public class StructuresDeviceGroupIT { // 30, not 45 or 60 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 30); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 30); // 5, not 10 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=PENDING&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); // 20, not 35 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=APPROVED&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 20); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 20); // 0, not 5 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=CANCELLED&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); // 5, not 10 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=REJECTED&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); // 25, not 30 or 45 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?statuses=PENDING&statuses=APPROVED&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 25); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 25); // 15, not 30 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?deleted=false&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 15); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 15); // 0, not 5 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?deleted=false&statuses=PENDING&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?deleted=false&statuses=APPROVED&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 15); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 15); // 0, not 5 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?deleted=false&statuses=CANCELLED&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); // 0, not 5 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?deleted=false&statuses=REJECTED&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); // 15, not 20 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?deleted=false&statuses=PENDING&statuses=APPROVED&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 15); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 15); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?deleted=true&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 15); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 15); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?deleted=true&statuses=PENDING&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?deleted=true&statuses=APPROVED&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?deleted=true&statuses=CANCELLED&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?deleted=true&statuses=REJECTED&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICEGROUP?deleted=true&statuses=PENDING&statuses=APPROVED&queryFields=MNEMONICPATH&queryValues=Di2"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 10); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 10); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/children/DEVICEGROUP/" + uuid.toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/children/DISCIPLINE/" + disciplineUuid.toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { diff --git a/src/test/java/org/openepics/names/docker/StructuresDeviceTypeIT.java b/src/test/java/org/openepics/names/docker/StructuresDeviceTypeIT.java index 5935255907359c819f098cc17949bc719adafbb8..c4d3f80dfdb6b2bda9783e3e7df8495e9ff5f97e 100644 --- a/src/test/java/org/openepics/names/docker/StructuresDeviceTypeIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresDeviceTypeIT.java @@ -38,6 +38,7 @@ import org.openepics.names.rest.beans.Type; import org.openepics.names.util.response.Response; import org.openepics.names.util.response.ResponseBoolean; import org.openepics.names.util.response.ResponseBooleanList; +import org.openepics.names.util.response.ResponsePageStructureElements; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -1260,9 +1261,10 @@ public class StructuresDeviceTypeIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement approvedStructureElement = null; int length = 0; @@ -1279,75 +1281,75 @@ public class StructuresDeviceTypeIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Di-Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // approve approvedStructureElement = ITUtilNameStructureElement.assertApprove(structureElement); @@ -1355,75 +1357,75 @@ public class StructuresDeviceTypeIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?queryFields=UUID&queryValues=" + approvedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Di-Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + approvedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -1446,9 +1448,10 @@ public class StructuresDeviceTypeIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement cancelledStructureElement = null; int length = 0; @@ -1465,75 +1468,75 @@ public class StructuresDeviceTypeIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Di-Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // cancel cancelledStructureElement = ITUtilNameStructureElement.assertCancel(structureElement); @@ -1541,75 +1544,75 @@ public class StructuresDeviceTypeIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?queryFields=UUID&queryValues=" + cancelledStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Di-Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + cancelledStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -1632,9 +1635,10 @@ public class StructuresDeviceTypeIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement rejectedStructureElement = null; int length = 0; @@ -1651,75 +1655,75 @@ public class StructuresDeviceTypeIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLengthOne(readStructureElements); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLengthOne(responsePageStructureElements); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Di-Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // reject rejectedStructureElement = ITUtilNameStructureElement.assertReject(structureElement); @@ -1727,75 +1731,75 @@ public class StructuresDeviceTypeIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?queryFields=UUID&queryValues=" + rejectedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Di-Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + rejectedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -2165,7 +2169,7 @@ public class StructuresDeviceTypeIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; - StructureElement[] readStructureElements = null; + ResponsePageStructureElements responsePageStructureElements = null; // from first structure element assertNotNull(uuid); @@ -2173,110 +2177,110 @@ public class StructuresDeviceTypeIT { // 45, not 60 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 45); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 45); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=PENDING&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 10); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 10); // 20, not 35 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 20); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 20); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=REJECTED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 10); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 10); // 30, not 45 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?statuses=PENDING&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 30); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 30); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?deleted=false&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 30); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 30); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?deleted=false&statuses=PENDING&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?deleted=false&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 15); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 15); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?deleted=false&statuses=CANCELLED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?deleted=false&statuses=REJECTED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?deleted=false&statuses=PENDING&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 20); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 20); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?deleted=true&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 15); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 15); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?deleted=true&statuses=PENDING&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?deleted=true&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?deleted=true&statuses=CANCELLED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?deleted=true&statuses=REJECTED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DEVICETYPE?deleted=true&statuses=PENDING&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 10); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 10); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/children/DEVICETYPE/" + uuid.toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/children/DEVICEGROUP/" + deviceGroupUuid.toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/children/DISCIPLINE/" + disciplineUuid.toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { diff --git a/src/test/java/org/openepics/names/docker/StructuresDisciplineIT.java b/src/test/java/org/openepics/names/docker/StructuresDisciplineIT.java index e33d1c1e3a6478c61a2825515898438230cfce2b..28eed8a5ec1df398059f798cf821d6397656e8fb 100644 --- a/src/test/java/org/openepics/names/docker/StructuresDisciplineIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresDisciplineIT.java @@ -37,6 +37,7 @@ import org.openepics.names.rest.beans.Type; import org.openepics.names.util.response.Response; import org.openepics.names.util.response.ResponseBoolean; import org.openepics.names.util.response.ResponseBooleanList; +import org.openepics.names.util.response.ResponsePageStructureElements; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -1194,9 +1195,10 @@ public class StructuresDisciplineIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement approvedStructureElement = null; int length = 0; @@ -1213,70 +1215,70 @@ public class StructuresDisciplineIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // approve approvedStructureElement = ITUtilNameStructureElement.assertApprove(structureElement); @@ -1284,70 +1286,70 @@ public class StructuresDisciplineIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?queryFields=UUID&queryValues=" + approvedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + approvedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -1370,9 +1372,10 @@ public class StructuresDisciplineIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement cancelledStructureElement = null; int length = 0; @@ -1389,70 +1392,70 @@ public class StructuresDisciplineIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // cancel cancelledStructureElement = ITUtilNameStructureElement.assertCancel(structureElement); @@ -1460,70 +1463,70 @@ public class StructuresDisciplineIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?queryFields=UUID&queryValues=" + cancelledStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + cancelledStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -1546,9 +1549,10 @@ public class StructuresDisciplineIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement rejectedStructureElement = null; int length = 0; @@ -1565,70 +1569,70 @@ public class StructuresDisciplineIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLengthOne(readStructureElements); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLengthOne(responsePageStructureElements); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // reject rejectedStructureElement = ITUtilNameStructureElement.assertReject(structureElement); @@ -1636,70 +1640,70 @@ public class StructuresDisciplineIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?queryFields=UUID&queryValues=" + rejectedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + rejectedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -2069,7 +2073,7 @@ public class StructuresDisciplineIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; - StructureElement[] readStructureElements = null; + ResponsePageStructureElements responsePageStructureElements = null; // from first structure element assertNotNull(uuid); @@ -2077,100 +2081,100 @@ public class StructuresDisciplineIT { // 45, not 60 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 45); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 45); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=PENDING&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 10); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 10); // 20, not 35 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 20); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 20); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=REJECTED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 10); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 10); // 30, not 45 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?statuses=PENDING&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 30); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 30); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?deleted=false&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 30); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 30); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?deleted=false&statuses=PENDING&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?deleted=false&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 15); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 15); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?deleted=false&statuses=CANCELLED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?deleted=false&statuses=REJECTED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?deleted=false&statuses=PENDING&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 20); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 20); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?deleted=true&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 15); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 15); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?deleted=true&statuses=PENDING&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?deleted=true&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?deleted=true&statuses=CANCELLED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?deleted=true&statuses=REJECTED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/DISCIPLINE?deleted=true&statuses=PENDING&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 10); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 10); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/children/DISCIPLINE/" + uuid.toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); } catch (IOException e) { fail(); } catch (Exception e) { diff --git a/src/test/java/org/openepics/names/docker/StructuresSubsystemIT.java b/src/test/java/org/openepics/names/docker/StructuresSubsystemIT.java index fdb0a831e329acb9ba23574d00eb8894f453280a..6a70eba593ddc44edefd973f3f24010c8b481be9 100644 --- a/src/test/java/org/openepics/names/docker/StructuresSubsystemIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresSubsystemIT.java @@ -38,6 +38,7 @@ import org.openepics.names.rest.beans.Type; import org.openepics.names.util.response.Response; import org.openepics.names.util.response.ResponseBoolean; import org.openepics.names.util.response.ResponseBooleanList; +import org.openepics.names.util.response.ResponsePageStructureElements; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -1276,9 +1277,10 @@ public class StructuresSubsystemIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement approvedStructureElement = null; int length = 0; @@ -1295,75 +1297,75 @@ public class StructuresSubsystemIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Sg-Sys-Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // approve approvedStructureElement = ITUtilNameStructureElement.assertApprove(structureElement); @@ -1371,75 +1373,75 @@ public class StructuresSubsystemIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?queryFields=UUID&queryValues=" + approvedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Sg-Sys-Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + approvedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -1462,9 +1464,10 @@ public class StructuresSubsystemIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement cancelledStructureElement = null; int length = 0; @@ -1481,75 +1484,75 @@ public class StructuresSubsystemIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Sg-Sys-Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // cancel cancelledStructureElement = ITUtilNameStructureElement.assertCancel(structureElement); @@ -1557,75 +1560,75 @@ public class StructuresSubsystemIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?queryFields=UUID&queryValues=" + cancelledStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Sg-Sys-Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + cancelledStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -1648,9 +1651,10 @@ public class StructuresSubsystemIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement rejectedStructureElement = null; int length = 0; @@ -1667,75 +1671,75 @@ public class StructuresSubsystemIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLengthOne(readStructureElements); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLengthOne(responsePageStructureElements); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Sg-Sys-Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // reject rejectedStructureElement = ITUtilNameStructureElement.assertReject(structureElement); @@ -1743,75 +1747,75 @@ public class StructuresSubsystemIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?queryFields=UUID&queryValues=" + rejectedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Sg-Sys-Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + rejectedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -2181,7 +2185,7 @@ public class StructuresSubsystemIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; - StructureElement[] readStructureElements = null; + ResponsePageStructureElements responsePageStructureElements = null; // from first structure element assertNotNull(uuid); @@ -2189,110 +2193,110 @@ public class StructuresSubsystemIT { // 45, not 60 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 45); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 45); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=PENDING&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 10); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 10); // 20, not 35 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 20); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 20); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=REJECTED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 10); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 10); // 30, not 45 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?statuses=PENDING&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 30); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 30); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?deleted=false&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 30); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 30); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?deleted=false&statuses=PENDING&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?deleted=false&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 15); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 15); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?deleted=false&statuses=CANCELLED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?deleted=false&statuses=REJECTED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?deleted=false&statuses=PENDING&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 20); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 20); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?deleted=true&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 15); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 15); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?deleted=true&statuses=PENDING&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?deleted=true&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?deleted=true&statuses=CANCELLED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?deleted=true&statuses=REJECTED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SUBSYSTEM?deleted=true&statuses=PENDING&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 10); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 10); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/children/SUBSYSTEM/" + uuid.toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/children/SYSTEM/" + systemUuid.toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/children/SYSTEMGROUP/" + systemGroupUuid.toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { diff --git a/src/test/java/org/openepics/names/docker/StructuresSystemGroupIT.java b/src/test/java/org/openepics/names/docker/StructuresSystemGroupIT.java index 8ba7ad9ef167f7a62760c04b9b0ff09a922c7f42..ac97a11c44ea30a2724911294fd6f3312ac3d31b 100644 --- a/src/test/java/org/openepics/names/docker/StructuresSystemGroupIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresSystemGroupIT.java @@ -38,6 +38,7 @@ import org.openepics.names.rest.beans.Type; import org.openepics.names.util.response.Response; import org.openepics.names.util.response.ResponseBoolean; import org.openepics.names.util.response.ResponseBooleanList; +import org.openepics.names.util.response.ResponsePageStructureElements; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -1248,9 +1249,10 @@ public class StructuresSystemGroupIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement approvedStructureElement = null; int length = 0; @@ -1267,70 +1269,70 @@ public class StructuresSystemGroupIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // approve approvedStructureElement = ITUtilNameStructureElement.assertApprove(structureElement); @@ -1338,70 +1340,70 @@ public class StructuresSystemGroupIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?queryFields=UUID&queryValues=" + approvedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + approvedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -1424,9 +1426,10 @@ public class StructuresSystemGroupIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement cancelledStructureElement = null; int length = 0; @@ -1443,70 +1446,70 @@ public class StructuresSystemGroupIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // cancel cancelledStructureElement = ITUtilNameStructureElement.assertCancel(structureElement); @@ -1514,70 +1517,70 @@ public class StructuresSystemGroupIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?queryFields=UUID&queryValues=" + cancelledStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + cancelledStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -1600,9 +1603,10 @@ public class StructuresSystemGroupIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement rejectedStructureElement = null; int length = 0; @@ -1619,70 +1623,70 @@ public class StructuresSystemGroupIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLengthOne(readStructureElements); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLengthOne(responsePageStructureElements); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // reject rejectedStructureElement = ITUtilNameStructureElement.assertReject(structureElement); @@ -1690,70 +1694,70 @@ public class StructuresSystemGroupIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?queryFields=UUID&queryValues=" + rejectedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + rejectedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -2123,7 +2127,7 @@ public class StructuresSystemGroupIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; - StructureElement[] readStructureElements = null; + ResponsePageStructureElements responsePageStructureElements = null; // from first structure element assertNotNull(uuid); @@ -2131,100 +2135,100 @@ public class StructuresSystemGroupIT { // 45, not 60 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 45); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 45); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=PENDING&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 10); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 10); // 20, not 35 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 20); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 20); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=REJECTED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 10); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 10); // 30, not 45 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?statuses=PENDING&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 30); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 30); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?deleted=false&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 30); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 30); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?deleted=false&statuses=PENDING&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?deleted=false&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 15); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 15); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?deleted=false&statuses=CANCELLED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?deleted=false&statuses=REJECTED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?deleted=false&statuses=PENDING&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 20); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 20); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?deleted=true&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 15); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 15); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?deleted=true&statuses=PENDING&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?deleted=true&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?deleted=true&statuses=CANCELLED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?deleted=true&statuses=REJECTED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEMGROUP?deleted=true&statuses=PENDING&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 10); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 10); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/children/SYSTEMGROUP/" + uuid.toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); } catch (IOException e) { fail(); } catch (Exception e) { diff --git a/src/test/java/org/openepics/names/docker/StructuresSystemIT.java b/src/test/java/org/openepics/names/docker/StructuresSystemIT.java index a2a5bfcf16f4b52fb8b43ba31ea1cb60ecc9949e..b2cfff4e70c1b875a5e8eed8bb6f9739f253e7b1 100644 --- a/src/test/java/org/openepics/names/docker/StructuresSystemIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresSystemIT.java @@ -38,6 +38,7 @@ import org.openepics.names.rest.beans.Type; import org.openepics.names.util.response.Response; import org.openepics.names.util.response.ResponseBoolean; import org.openepics.names.util.response.ResponseBooleanList; +import org.openepics.names.util.response.ResponsePageStructureElements; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -1262,9 +1263,10 @@ public class StructuresSystemIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement approvedStructureElement = null; int length = 0; @@ -1281,75 +1283,75 @@ public class StructuresSystemIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Sg-Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // approve approvedStructureElement = ITUtilNameStructureElement.assertApprove(structureElement); @@ -1357,75 +1359,75 @@ public class StructuresSystemIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?queryFields=UUID&queryValues=" + approvedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Sg-Rsha"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + approvedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -1448,9 +1450,10 @@ public class StructuresSystemIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement cancelledStructureElement = null; int length = 0; @@ -1467,75 +1470,75 @@ public class StructuresSystemIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Sg-Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // cancel cancelledStructureElement = ITUtilNameStructureElement.assertCancel(structureElement); @@ -1543,75 +1546,75 @@ public class StructuresSystemIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?queryFields=UUID&queryValues=" + cancelledStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Sg-Rshc"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + cancelledStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -1634,9 +1637,10 @@ public class StructuresSystemIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; + ResponsePageStructureElements responsePageStructureElements = null; + StructureElement structureElement = null; StructureElement createdStructureElement = null; - StructureElement[] readStructureElements = null; StructureElement rejectedStructureElement = null; int length = 0; @@ -1653,75 +1657,75 @@ public class StructuresSystemIT { // read (1) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - length = readStructureElements.length; + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + length = responsePageStructureElements.getListSize(); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?queryFields=UUID&queryValues=" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLengthOne(readStructureElements); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLengthOne(responsePageStructureElements); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Sg-Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + createdStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); // reject rejectedStructureElement = ITUtilNameStructureElement.assertReject(structureElement); @@ -1729,75 +1733,75 @@ public class StructuresSystemIT { // read (2) response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertNotNull(readStructureElements); - assertTrue(readStructureElements.length >= 1); - assertEquals(length, readStructureElements.length); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertNotNull(responsePageStructureElements); + assertTrue(responsePageStructureElements.getListSize() >= 1); + assertEquals(length, responsePageStructureElements.getListSize()); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=PENDING"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=APPROVED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=CANCELLED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=REJECTED"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=PENDING&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=APPROVED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=REJECTED&queryFields=MNEMONIC&queryValues=Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?queryFields=UUID&queryValues=" + rejectedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 1); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonic/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/mnemonicpath/Sg-Rshr"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/history/" + rejectedStructureElement.getUuid().toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) { @@ -2167,7 +2171,7 @@ public class StructuresSystemIT { ObjectMapper mapper = new ObjectMapper(); String[] response = null; - StructureElement[] readStructureElements = null; + ResponsePageStructureElements responsePageStructureElements = null; // from first structure element assertNotNull(uuid); @@ -2175,105 +2179,105 @@ public class StructuresSystemIT { // 45, not 60 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 45); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 45); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=PENDING&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 10); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 10); // 20, not 35 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 20); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 20); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=CANCELLED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=REJECTED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 10); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 10); // 30, not 45 response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?statuses=PENDING&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 30); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 30); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?deleted=false&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 30); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 30); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?deleted=false&statuses=PENDING&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?deleted=false&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 15); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 15); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?deleted=false&statuses=CANCELLED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?deleted=false&statuses=REJECTED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?deleted=false&statuses=PENDING&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 20); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 20); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?deleted=true&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 15); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 15); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?deleted=true&statuses=PENDING&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?deleted=true&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?deleted=true&statuses=CANCELLED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?deleted=true&statuses=REJECTED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 5); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 5); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/SYSTEM?deleted=true&statuses=PENDING&statuses=APPROVED&queryFields=MNEMONIC&queryValues=A__"); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 10); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 10); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/children/SYSTEM/" + uuid.toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - ITUtilNameStructureElement.assertContentLength(readStructureElements, 0); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + ITUtilNameStructureElement.assertContentLength(responsePageStructureElements, 0); response = ITUtil.doGetJson(ITUtil.HTTP_IP_PORT_NAMING_API_V1_STRUCTURES + "/children/SYSTEMGROUP/" + systemGroupUuid.toString()); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); - readStructureElements = mapper.readValue(response[1], StructureElement[].class); - assertTrue(readStructureElements.length >= 1); + responsePageStructureElements = mapper.readValue(response[1], ResponsePageStructureElements.class); + assertTrue(responsePageStructureElements.getListSize() >= 1); } catch (IOException e) { fail(); } catch (Exception e) {