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 2a7ee58677acfa8750f2507cabd10c0d026031ba..2b1f9ccc0929936c8fa7ababa8593aa7cd05895b 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 @@ -24,7 +24,9 @@ import org.openepics.names.rest.beans.FieldStructure; import org.openepics.names.rest.beans.Status; import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.StructureElement; -import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandConfirm; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; +import org.openepics.names.rest.beans.element.StructureElementCommandUpdate; import org.openepics.names.rest.beans.response.Response; import org.openepics.names.rest.beans.response.ResponseBoolean; import org.openepics.names.rest.beans.response.ResponseBooleanList; @@ -65,6 +67,12 @@ import io.swagger.v3.oas.annotations.tags.Tag; public interface IStructures { /* + StructureElementCommandCreate - type, parent, name, mnemonic, description, comment + StructureElementCommandUpdate - uuid, type, parent, name, mnemonic, description, comment + StructureElementCommandConfirm - uuid, type, comment + ---------------------------------------------------------------------------------------------------- + converted into StructureElementCommand + ---------------------------------------------------------------------------------------------------- StructureElementCommand - subset of StructureElement attributes StructureElement uuid (UUID) @@ -84,7 +92,7 @@ public interface IStructures { who (String) Methods - create POST /structures - createStructures (List<StructureElementCommand>) + create POST /structures - createStructures (List<StructureElementCommandCreate>) create POST /structures/upload - createStructures (MultipartFile) ---------------------------------------------------------------------------------------------------- read GET /structures/{type} - readStructures (Type, Status[], Boolean, String, String, String, String, String, String, String, FieldStructure, Boolean, Integer, Integer) @@ -98,24 +106,24 @@ public interface IStructures { read GET /structures/exists/{type}/{mnemonicPath} - existsStructure (Type, String) read GET /structures/isValidToCreate/{type}/{mnemonicPath} - isValidToCreateStructure (Type, String) ---------------------------------------------------------------------------------------------------- - read GET /structures/validateCreate - validateStructuresCreate (List<StructureElementCommand>) - read GET /structures/validateUpdate - validateStructuresUpdate (List<StructureElementCommand>) - read GET /structures/validateDelete - validateStructuresDelete (List<StructureElementCommand>) - read GET /structures/validateApprove - validateStructuresApprove (List<StructureElementCommand>) - read GET /structures/validateCancel - validateStructuresCancel (List<StructureElementCommand>) - read GET /structures/validateReject - validateStructuresReject (List<StructureElementCommand>) + read GET /structures/validateCreate - validateStructuresCreate (List<StructureElementCommandCreate>) + read GET /structures/validateUpdate - validateStructuresUpdate (List<StructureElementCommandUpdate>) + read GET /structures/validateDelete - validateStructuresDelete (List<StructureElementCommandConfirm>) + read GET /structures/validateApprove - validateStructuresApprove (List<StructureElementCommandConfirm>) + read GET /structures/validateCancel - validateStructuresCancel (List<StructureElementCommandConfirm>) + read GET /structures/validateReject - validateStructuresReject (List<StructureElementCommandConfirm>) ---------------------------------------------------------------------------------------------------- - update PUT /structures - updateStructures (List<StructureElementCommand>) + update PUT /structures - updateStructures (List<StructureElementCommandUpdate>) update PUT /structures/upload - updateStructures (MultipartFile) ---------------------------------------------------------------------------------------------------- - delete DELETE /structures - deleteStructures (List<StructureElementCommand>) + delete DELETE /structures - deleteStructures (List<StructureElementCommandConfirm>) delete DELETE /structures/upload - deleteStructures (MultipartFile) ---------------------------------------------------------------------------------------------------- - update PATCH /structures/approve - approveStructures (List<StructureElementCommand>) + update PATCH /structures/approve - approveStructures (List<StructureElementCommandConfirm>) update PATCH /structures/approve/upload - approveStructures (MultipartFile) - update PATCH /structures/cancel - cancelStructures (List<StructureElementCommand>) + update PATCH /structures/cancel - cancelStructures (List<StructureElementCommandConfirm>) update PATCH /structures/cancel/upload - cancelStructures (MultipartFile) - update PATCH /structures/reject - rejectStructures (List<StructureElementCommand>) + update PATCH /structures/reject - rejectStructures (List<StructureElementCommandConfirm>) update PATCH /structures/reject/upload - rejectStructures (MultipartFile) Note @@ -201,9 +209,9 @@ public interface IStructures { mediaType = "application/json", array = @ArraySchema( schema = @Schema( - implementation = StructureElementCommand.class, - requiredProperties = {"type","parent","name","mnemonic","description","comment"})))) - @RequestBody List<StructureElementCommand> structureElements); + implementation = StructureElementCommandCreate.class, + requiredProperties = {"type","name","description","comment"})))) + @RequestBody List<StructureElementCommandCreate> structureElementCommands); /** * Create (propose) structures by upload Excel file. @@ -710,6 +718,14 @@ public interface IStructures { * </ul> * </p> * + * <p> + * Note that method will always return false for DeviceGroup. Because DeviceGroup does not have mnemonic, + * its mnemonic path is the mnemonic of its parent (Discipline). However a query for mnemonic path + * for DeviceGroup is ambiguous as it lacks mnemonic. Purpose of method is to check is a particular entry + * exists in hierarchy of structures. Purpose of method is not to check if multiple entries match mnemonic path. + * Therefor method returns false for DeviceGroup. + * </p> + * * @param type type of structure to search in * @param mnemonicPath mnemonic path to find structure for * @return if mnemonic path exists in structure @@ -719,6 +735,12 @@ public interface IStructures { description = """ Return if mnemonic path exists in structure (exact match). Response is true if mnemonic path exists, false otherwise. + + Note that method will always return false for DeviceGroup. Because DeviceGroup does not have mnemonic, + its mnemonic path is the mnemonic of its parent (Discipline). However a query for mnemonic path + for DeviceGroup is ambiguous as it lacks mnemonic. Purpose of method is to check is a particular entry + exists in hierarchy of structures. Purpose of method is not to check if multiple entries match mnemonic path. + Therefor method returns false for DeviceGroup. """ ) @ApiResponses(value = { @@ -909,9 +931,9 @@ public interface IStructures { mediaType = "application/json", array = @ArraySchema( schema = @Schema( - implementation = StructureElementCommand.class, - requiredProperties = {"type","parent","name","mnemonic","description","comment"})))) - @RequestBody List<StructureElementCommand> structureElements); + implementation = StructureElementCommandCreate.class, + requiredProperties = {"type","name","description","comment"})))) + @RequestBody List<StructureElementCommandCreate> structureElementCommands); /** * Return if structures are valid to update (propose) by list of structure element commands. @@ -996,9 +1018,9 @@ public interface IStructures { mediaType = "application/json", array = @ArraySchema( schema = @Schema( - implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) - @RequestBody List<StructureElementCommand> structureElements); + implementation = StructureElementCommandUpdate.class, + requiredProperties = {"uuid","type","name","description","comment"})))) + @RequestBody List<StructureElementCommandUpdate> structureElementCommands); /** * Return if structures are valid to delete (propose) by list of structure element commands. @@ -1079,9 +1101,9 @@ public interface IStructures { mediaType = "application/json", array = @ArraySchema( schema = @Schema( - implementation = StructureElementCommand.class, + implementation = StructureElementCommandConfirm.class, requiredProperties = {"uuid","type","comment"})))) - @RequestBody List<StructureElementCommand> structureElements); + @RequestBody List<StructureElementCommandConfirm> structureElementCommands); /** * Return if structures are valid to approve by list of structure element commands. @@ -1111,10 +1133,6 @@ public interface IStructures { Required attributes: - uuid - type - - parent (System, Subsystem, DeviceGroup, DeviceType)(uuid) - - name - - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) - - description - comment """ ) @@ -1166,9 +1184,9 @@ public interface IStructures { mediaType = "application/json", array = @ArraySchema( schema = @Schema( - implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) - @RequestBody List<StructureElementCommand> structureElements); + implementation = StructureElementCommandConfirm.class, + requiredProperties = {"uuid","type","comment"})))) + @RequestBody List<StructureElementCommandConfirm> structureElementCommands); /** * Return if structures are valid to cancel by list of structure element commands. @@ -1198,10 +1216,6 @@ public interface IStructures { Required attributes: - uuid - type - - parent (System, Subsystem, DeviceGroup, DeviceType)(uuid) - - name - - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) - - description - comment """ ) @@ -1253,9 +1267,9 @@ public interface IStructures { mediaType = "application/json", array = @ArraySchema( schema = @Schema( - implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) - @RequestBody List<StructureElementCommand> structureElements); + implementation = StructureElementCommandConfirm.class, + requiredProperties = {"uuid","type","comment"})))) + @RequestBody List<StructureElementCommandConfirm> structureElementCommands); /** * Return if structures are valid to reject by list of structure element commands. @@ -1285,10 +1299,6 @@ public interface IStructures { Required attributes: - uuid - type - - parent (System, Subsystem, DeviceGroup, DeviceType)(uuid) - - name - - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) - - description - comment """ ) @@ -1340,9 +1350,9 @@ public interface IStructures { mediaType = "application/json", array = @ArraySchema( schema = @Schema( - implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) - @RequestBody List<StructureElementCommand> structureElements); + implementation = StructureElementCommandConfirm.class, + requiredProperties = {"uuid","type","comment"})))) + @RequestBody List<StructureElementCommandConfirm> structureElementCommands); // ---------------------------------------------------------------------------------------------------- @@ -1413,9 +1423,9 @@ public interface IStructures { mediaType = "application/json", array = @ArraySchema( schema = @Schema( - implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) - @RequestBody List<StructureElementCommand> structureElements); + implementation = StructureElementCommandUpdate.class, + requiredProperties = {"uuid","type","name","description","comment"})))) + @RequestBody List<StructureElementCommandUpdate> structureElementCommands); /** * Update (propose) structures by upload Excel file. @@ -1551,9 +1561,9 @@ public interface IStructures { mediaType = "application/json", array = @ArraySchema( schema = @Schema( - implementation = StructureElementCommand.class, + implementation = StructureElementCommandConfirm.class, requiredProperties = {"uuid","type","comment"})))) - @RequestBody List<StructureElementCommand> structureElements); + @RequestBody List<StructureElementCommandConfirm> structureElementCommands); /** * Delete (propose) structures by upload Excel file. @@ -1643,10 +1653,6 @@ public interface IStructures { Required attributes: - uuid - type - - parent (System, Subsystem, DeviceGroup, DeviceType)(uuid) - - name - - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) - - description - comment """ ) @@ -1695,9 +1701,9 @@ public interface IStructures { mediaType = "application/json", array = @ArraySchema( schema = @Schema( - implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) - @RequestBody List<StructureElementCommand> structureElements); + implementation = StructureElementCommandConfirm.class, + requiredProperties = {"uuid","type","comment"})))) + @RequestBody List<StructureElementCommandConfirm> structureElementCommands); /** * Approve structures (proposals) by upload Excel file. @@ -1723,10 +1729,6 @@ public interface IStructures { Required attributes: - uuid - type - - parent (System, Subsystem, DeviceGroup, DeviceType)(uuid) - - name - - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) - - description - comment """ ) @@ -1788,10 +1790,6 @@ public interface IStructures { Required attributes: - uuid - type - - parent (System, Subsystem, DeviceGroup, DeviceType)(uuid) - - name - - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) - - description - comment """ ) @@ -1840,9 +1838,9 @@ public interface IStructures { mediaType = "application/json", array = @ArraySchema( schema = @Schema( - implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) - @RequestBody List<StructureElementCommand> structureElements); + implementation = StructureElementCommandConfirm.class, + requiredProperties = {"uuid","type","comment"})))) + @RequestBody List<StructureElementCommandConfirm> structureElementCommands); /** * Cancel structures (proposals) by upload Excel file. @@ -1862,10 +1860,6 @@ public interface IStructures { Required attributes: - uuid - type - - parent (System, Subsystem, DeviceGroup, DeviceType)(uuid) - - name - - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) - - description - comment """ ) @@ -1927,10 +1921,6 @@ public interface IStructures { Required attributes: - uuid - type - - parent (System, Subsystem, DeviceGroup, DeviceType)(uuid) - - name - - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) - - description - comment """ ) @@ -1979,9 +1969,9 @@ public interface IStructures { mediaType = "application/json", array = @ArraySchema( schema = @Schema( - implementation = StructureElementCommand.class, - requiredProperties = {"uuid","type","parent","name","mnemonic","description","comment"})))) - @RequestBody List<StructureElementCommand> structureElements); + implementation = StructureElementCommandConfirm.class, + requiredProperties = {"uuid","type","comment"})))) + @RequestBody List<StructureElementCommandConfirm> structureElementCommands); /** * Reject structures (proposals) by upload Excel file. @@ -2001,10 +1991,6 @@ public interface IStructures { Required attributes: - uuid - type - - parent (System, Subsystem, DeviceGroup, DeviceType)(uuid) - - name - - mnemonic (System, Subsystem, Discipline, DeviceType, may be set for SystemGroup, not allowed for DeviceGroup) - - description - comment """ ) diff --git a/src/main/java/org/openepics/names/rest/beans/element/StructureElementCommandConfirm.java b/src/main/java/org/openepics/names/rest/beans/element/StructureElementCommandConfirm.java new file mode 100644 index 0000000000000000000000000000000000000000..736d78c3c39b603986610c3731d3ab1912b3d9d8 --- /dev/null +++ b/src/main/java/org/openepics/names/rest/beans/element/StructureElementCommandConfirm.java @@ -0,0 +1,121 @@ +package org.openepics.names.rest.beans.element; + +import java.io.Serializable; +import java.util.Objects; +import java.util.UUID; + +import org.openepics.names.rest.beans.Type; + +import io.swagger.v3.oas.annotations.media.Schema; + +public class StructureElementCommandConfirm implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 4363449987852744536L; + + @Schema(description = "Identity (uuid) of the structure entry. Value is created server-side.") + private UUID uuid; + @Schema(description = "Type of the structure entry. Valid values - SYSTEMGROUP, SYSTEM, SUBSYSTEM, DISCIPLINE, DEVICEGROUP, DEVICETYPE.") + private Type type; + @Schema(description = "Comment of the structure entry command.") + private String comment; + + /** + * Public constructor. + */ + public StructureElementCommandConfirm() { + } + + /** + * Public constructor. + * + * @param uuid uuid + * @param type type + * @param comment comment + */ + public StructureElementCommandConfirm( + UUID uuid, Type type, String comment) { + super(); + this.uuid = uuid; + this.type = type; + this.comment = comment; + } + + public UUID getUuid() { + return uuid; + } + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + public Type getType() { + return type; + } + public void setType(Type type) { + this.type = type; + } + public String getComment() { + return comment; + } + public void setComment(String comment) { + this.comment = comment; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + + return equals ((StructureElementCommandConfirm) obj); + } + + public boolean equals(StructureElementCommandConfirm other) { + if (other == null) + return false; + + if (!super.equals(other)) { + return false; + } + + if (getUuid() == null) { + if (other.getUuid() != null) + return false; + } else if (!getUuid().equals(other.getUuid())) + return false; + if (getType() == null) { + if (other.getType() != null) + return false; + } else if (!getType().equals(other.getType())) + return false; + if (getComment() == null) { + if (other.getComment() != null) + return false; + } else if (!getComment().equals(other.getComment())) + return false; + + return true; + } + + @Override + public int hashCode() { + return Objects.hash( + getUuid()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + sb.append("\"uuid\": " + getUuid()); + sb.append(", \"type\": " + getType()); + sb.append(", \"comment\": " + getComment()); + sb.append("}"); + return sb.toString(); + } + +} diff --git a/src/main/java/org/openepics/names/rest/beans/element/StructureElementCommandCreate.java b/src/main/java/org/openepics/names/rest/beans/element/StructureElementCommandCreate.java new file mode 100644 index 0000000000000000000000000000000000000000..190680a585828b3a828d128964a9d183e33a219f --- /dev/null +++ b/src/main/java/org/openepics/names/rest/beans/element/StructureElementCommandCreate.java @@ -0,0 +1,171 @@ +package org.openepics.names.rest.beans.element; + +import java.io.Serializable; +import java.util.Objects; +import java.util.UUID; + +import org.openepics.names.rest.beans.Type; + +import io.swagger.v3.oas.annotations.media.Schema; + +public class StructureElementCommandCreate implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 7866856977382945426L; + + @Schema(description = "Type of the structure entry. Valid values - SYSTEMGROUP, SYSTEM, SUBSYSTEM, DISCIPLINE, DEVICEGROUP, DEVICETYPE.") + private Type type; + @Schema(description = "Identity (uuid) for the structure entry parent (if the structure entry has a parent).") + private UUID parent; + @Schema(description = "Name of the structure entry.") + private String name; + @Schema(description = "Mnemonic of the structure entry.") + private String mnemonic; + @Schema(description = "Description of the structure entry.") + private String description; + @Schema(description = "Comment of the structure entry command.") + private String comment; + + /** + * Public constructor. + */ + public StructureElementCommandCreate() { + } + + /** + * Public constructor. + * + * @param type type + * @param parent parent uuid + * @param name name + * @param mnemonic mnemonic + * @param description description + * @param comment comment + */ + public StructureElementCommandCreate( + Type type, UUID parent, + String name, String mnemonic, + String description, String comment) { + super(); + this.type = type; + this.parent = parent; + this.name = name; + this.mnemonic = mnemonic; + this.description = description; + this.comment = comment; + } + + public Type getType() { + return type; + } + public void setType(Type type) { + this.type = type; + } + public UUID getParent() { + return parent; + } + public void setParent(UUID parent) { + this.parent = parent; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getMnemonic() { + return mnemonic; + } + public void setMnemonic(String mnemonic) { + this.mnemonic = mnemonic; + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public String getComment() { + return comment; + } + public void setComment(String comment) { + this.comment = comment; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + + return equals ((StructureElementCommandCreate) obj); + } + + public boolean equals(StructureElementCommandCreate other) { + if (other == null) + return false; + + if (!super.equals(other)) { + return false; + } + + if (getType() == null) { + if (other.getType() != null) + return false; + } else if (!getType().equals(other.getType())) + return false; + if (getParent() == null) { + if (other.getParent() != null) + return false; + } else if (!getParent().equals(other.getParent())) + return false; + if (getName() == null) { + if (other.getName() != null) + return false; + } else if (!getName().equals(other.getName())) + return false; + if (getMnemonic() == null) { + if (other.getMnemonic() != null) + return false; + } else if (!getMnemonic().equals(other.getMnemonic())) + return false; + if (getDescription() == null) { + if (other.getDescription() != null) + return false; + } else if (!getDescription().equals(other.getDescription())) + return false; + if (getComment() == null) { + if (other.getComment() != null) + return false; + } else if (!getComment().equals(other.getComment())) + return false; + + return true; + } + + @Override + public int hashCode() { + return Objects.hash( + getType(), getParent(), getName(), getMnemonic(), getDescription(), getComment()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + sb.append("\"type\": " + getType()); + sb.append(", \"parent\": " + getParent()); + sb.append(", \"name\": " + getName()); + sb.append(", \"mnemonic\": " + getMnemonic()); + sb.append(", \"description\": " + getDescription()); + sb.append(", \"comment\": " + getComment()); + sb.append("}"); + return sb.toString(); + } + +} diff --git a/src/main/java/org/openepics/names/rest/beans/element/StructureElementCommandUpdate.java b/src/main/java/org/openepics/names/rest/beans/element/StructureElementCommandUpdate.java new file mode 100644 index 0000000000000000000000000000000000000000..141bcc2c5b80ea61a01d89c2d97e245b7901e418 --- /dev/null +++ b/src/main/java/org/openepics/names/rest/beans/element/StructureElementCommandUpdate.java @@ -0,0 +1,102 @@ +package org.openepics.names.rest.beans.element; + +import java.io.Serializable; +import java.util.Objects; +import java.util.UUID; + +import org.openepics.names.rest.beans.Type; + +import io.swagger.v3.oas.annotations.media.Schema; + +public class StructureElementCommandUpdate extends StructureElementCommandCreate implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3346987084345524300L; + + @Schema(description = "Identity (uuid) of the structure entry. Value is created server-side.") + private UUID uuid; + + /** + * Public constructor. + */ + public StructureElementCommandUpdate() { + } + + /** + * Public constructor. + * + * @param uuid uuid + * @param type type + * @param parent parent uuid + * @param name name + * @param mnemonic mnemonic + * @param description description + * @param comment comment + */ + public StructureElementCommandUpdate( + UUID uuid, Type type, UUID parent, + String name, String mnemonic, + String description, String comment) { + super(type, parent, name, mnemonic, description, comment); + this.uuid = uuid; + } + + public UUID getUuid() { + return uuid; + } + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + + return equals ((StructureElementCommandUpdate) obj); + } + + public boolean equals(StructureElementCommandUpdate other) { + if (other == null) + return false; + + if (!super.equals(other)) { + return false; + } + + if (getUuid() == null) { + if (other.getUuid() != null) + return false; + } else if (!getUuid().equals(other.getUuid())) + return false; + + return true; + } + + @Override + public int hashCode() { + return Objects.hash(getUuid()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + sb.append("\"uuid\": " + getUuid()); + sb.append(", \"type\": " + getType()); + sb.append(", \"parent\": " + getParent()); + sb.append(", \"name\": " + getName()); + sb.append(", \"mnemonic\": " + getMnemonic()); + sb.append(", \"description\": " + getDescription()); + sb.append(", \"comment\": " + getComment()); + sb.append("}"); + return sb.toString(); + } + +} 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 24c13f22bb7188c5d5185e350e8fc5af32d10728..9b1cc6130e1244c0ad08a5c054eaf832dcb02269 100644 --- a/src/main/java/org/openepics/names/rest/controller/NamesController.java +++ b/src/main/java/org/openepics/names/rest/controller/NamesController.java @@ -100,7 +100,7 @@ public class NamesController implements INames { // create names try { - List<NameElementCommand> commands = NameElementUtil.getNameElementCommandsForCreate(nameElementCommands); + List<NameElementCommand> commands = NameElementUtil.convertCommandCreate2Command(nameElementCommands); namesService.validateNamesCreate(commands); return new ResponseEntity<>(namesService.createNames(commands, TextUtil.TEST_WHO), Response.getHeaderJson(), HttpStatus.CREATED); } catch (ServiceException e) { @@ -352,9 +352,10 @@ public class NamesController implements INames { @Override public ResponseEntity<ResponseBooleanList> validateNamesCreate(List<NameElementCommandCreate> nameElementCommands) { + // convert // validate - List<NameElementCommand> commands = NameElementUtil.getNameElementCommandsForCreate(nameElementCommands); + List<NameElementCommand> commands = NameElementUtil.convertCommandCreate2Command(nameElementCommands); boolean response = true; String reason = ""; List<ResponseBoolean> responses = Lists.newArrayList(); @@ -384,9 +385,10 @@ public class NamesController implements INames { @Override public ResponseEntity<ResponseBooleanList> validateNamesUpdate(List<NameElementCommandUpdate> nameElementCommands) { + // convert // validate - List<NameElementCommand> commands = NameElementUtil.getNameElementCommandsForUpdate(nameElementCommands); + List<NameElementCommand> commands = NameElementUtil.convertCommandUpdate2Command(nameElementCommands); boolean response = true; String reason = ""; List<ResponseBoolean> responses = Lists.newArrayList(); @@ -416,9 +418,10 @@ public class NamesController implements INames { @Override public ResponseEntity<ResponseBooleanList> validateNamesDelete(List<NameElementCommandConfirm> nameElementCommands) { + // convert // validate - List<NameElementCommand> commands = NameElementUtil.getNameElementCommandsForConfirm(nameElementCommands); + List<NameElementCommand> commands = NameElementUtil.convertCommandConfirm2Command(nameElementCommands); boolean response = true; String reason = ""; List<ResponseBoolean> responses = Lists.newArrayList(); @@ -456,7 +459,7 @@ public class NamesController implements INames { // update names try { - List<NameElementCommand> commands = NameElementUtil.getNameElementCommandsForUpdate(nameElementCommands); + List<NameElementCommand> commands = NameElementUtil.convertCommandUpdate2Command(nameElementCommands); namesService.validateNamesUpdate(commands); return namesService.updateNames(commands, TextUtil.TEST_WHO); } catch (ServiceException e) { @@ -514,7 +517,7 @@ public class NamesController implements INames { // delete names try { - List<NameElementCommand> commands = NameElementUtil.getNameElementCommandsForConfirm(nameElementCommands); + List<NameElementCommand> commands = NameElementUtil.convertCommandConfirm2Command(nameElementCommands); namesService.validateNamesDelete(commands); return namesService.deleteNames(commands, TextUtil.TEST_WHO); } catch (ServiceException 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 7f99ea794ff77de653994108f17d1a01da64c183..576496775442e5af7c1c5ef01bcded91727fd979 100644 --- a/src/main/java/org/openepics/names/rest/controller/StructuresController.java +++ b/src/main/java/org/openepics/names/rest/controller/StructuresController.java @@ -30,6 +30,9 @@ import org.openepics.names.rest.beans.Status; import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.StructureElement; import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandConfirm; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; +import org.openepics.names.rest.beans.element.StructureElementCommandUpdate; import org.openepics.names.rest.beans.response.Response; import org.openepics.names.rest.beans.response.ResponseBoolean; import org.openepics.names.rest.beans.response.ResponseBooleanList; @@ -37,6 +40,7 @@ import org.openepics.names.rest.beans.response.ResponsePageStructureElements; import org.openepics.names.service.LogService; import org.openepics.names.service.StructuresService; import org.openepics.names.util.ExcelUtil; +import org.openepics.names.util.StructureElementUtil; import org.openepics.names.util.TextUtil; import org.openepics.names.util.ValidateStructureElementUtil; import org.openepics.names.util.ValidateUtil; @@ -90,14 +94,16 @@ public class StructuresController implements IStructures { } @Override - public ResponseEntity<List<StructureElement>> createStructures(List<StructureElementCommand> structureElements) { + public ResponseEntity<List<StructureElement>> createStructures(List<StructureElementCommandCreate> structureElementCommands) { // validate authority - user & admin + // convert // validate // create structures try { - structuresService.validateStructuresCreate(structureElements); - return new ResponseEntity<>(structuresService.createStructures(structureElements, TextUtil.TEST_WHO), Response.getHeaderJson(), HttpStatus.CREATED); + List<StructureElementCommand> commands = StructureElementUtil.convertCommandCreate2Command(structureElementCommands); + structuresService.validateStructuresCreate(commands); + return new ResponseEntity<>(structuresService.createStructures(commands, TextUtil.TEST_WHO), Response.getHeaderJson(), HttpStatus.CREATED); } catch (ServiceException e) { logService.logServiceException(LOGGER, Level.WARNING, e); logService.logStackTraceElements(LOGGER, Level.WARNING, e); @@ -112,6 +118,7 @@ public class StructuresController implements IStructures { public ResponseEntity<Resource> createStructures(MultipartFile file) { // validate authority - user & admin // convert from input + // ( convert ) // validate // create structures // convert to output @@ -327,15 +334,19 @@ public class StructuresController implements IStructures { // ---------------------------------------------------------------------------------------------------- @Override - public ResponseEntity<ResponseBooleanList> validateStructuresCreate(List<StructureElementCommand> structureElements) { + public ResponseEntity<ResponseBooleanList> validateStructuresCreate(List<StructureElementCommandCreate> structureElementCommands) { + // convert // validate + List<StructureElementCommand> commands = StructureElementUtil.convertCommandCreate2Command(structureElementCommands); boolean response = true; String reason = ""; List<ResponseBoolean> responses = Lists.newArrayList(); - for (StructureElementCommand structureElement : structureElements) { + LOGGER.log(Level.INFO, "validateStructuresCreate, commands.size: " + commands.size()); + for (StructureElementCommand command : commands) { + LOGGER.log(Level.INFO, "validateStructuresCreate, command: " + command); try { - structuresService.validateStructuresCreate(structureElement); + structuresService.validateStructuresCreate(command); responses.add(new ResponseBoolean(Boolean.TRUE)); } catch (ServiceException e) { logService.logServiceException(LOGGER, Level.WARNING, e); @@ -358,15 +369,17 @@ public class StructuresController implements IStructures { } @Override - public ResponseEntity<ResponseBooleanList> validateStructuresUpdate(List<StructureElementCommand> structureElements) { + public ResponseEntity<ResponseBooleanList> validateStructuresUpdate(List<StructureElementCommandUpdate> structureElementCommands) { + // convert // validate + List<StructureElementCommand> commands = StructureElementUtil.convertCommandUpdate2Command(structureElementCommands); boolean response = true; String reason = ""; List<ResponseBoolean> responses = Lists.newArrayList(); - for (StructureElementCommand structureElement : structureElements) { + for (StructureElementCommand command : commands) { try { - structuresService.validateStructuresUpdate(structureElement); + structuresService.validateStructuresUpdate(command); responses.add(new ResponseBoolean(Boolean.TRUE)); } catch (ServiceException e) { logService.logServiceException(LOGGER, Level.WARNING, e); @@ -389,15 +402,17 @@ public class StructuresController implements IStructures { } @Override - public ResponseEntity<ResponseBooleanList> validateStructuresDelete(List<StructureElementCommand> structureElements) { + public ResponseEntity<ResponseBooleanList> validateStructuresDelete(List<StructureElementCommandConfirm> structureElementCommands) { + // convert // validate + List<StructureElementCommand> commands = StructureElementUtil.convertCommandConfirm2Command(structureElementCommands); boolean response = true; String reason = ""; List<ResponseBoolean> responses = Lists.newArrayList(); - for (StructureElementCommand structureElement : structureElements) { + for (StructureElementCommand command : commands) { try { - structuresService.validateStructuresDelete(structureElement); + structuresService.validateStructuresDelete(command); responses.add(new ResponseBoolean(Boolean.TRUE)); } catch (ServiceException e) { logService.logServiceException(LOGGER, Level.WARNING, e); @@ -420,15 +435,17 @@ public class StructuresController implements IStructures { } @Override - public ResponseEntity<ResponseBooleanList> validateStructuresApprove(List<StructureElementCommand> structureElements) { + public ResponseEntity<ResponseBooleanList> validateStructuresApprove(List<StructureElementCommandConfirm> structureElementCommands) { + // convert // validate + List<StructureElementCommand> commands = StructureElementUtil.convertCommandConfirm2Command(structureElementCommands); boolean response = true; String reason = ""; List<ResponseBoolean> responses = Lists.newArrayList(); - for (StructureElementCommand structureElement : structureElements) { + for (StructureElementCommand command : commands) { try { - structuresService.validateStructuresApprove(structureElement); + structuresService.validateStructuresApprove(command); responses.add(new ResponseBoolean(Boolean.TRUE)); } catch (ServiceException e) { logService.logServiceException(LOGGER, Level.WARNING, e); @@ -451,15 +468,16 @@ public class StructuresController implements IStructures { } @Override - public ResponseEntity<ResponseBooleanList> validateStructuresCancel(List<StructureElementCommand> structureElements) { + public ResponseEntity<ResponseBooleanList> validateStructuresCancel(List<StructureElementCommandConfirm> structureElementCommands) { // validate + List<StructureElementCommand> commands = StructureElementUtil.convertCommandConfirm2Command(structureElementCommands); boolean response = true; String reason = ""; List<ResponseBoolean> responses = Lists.newArrayList(); - for (StructureElementCommand structureElement : structureElements) { + for (StructureElementCommand command : commands) { try { - structuresService.validateStructuresCancel(structureElement); + structuresService.validateStructuresCancel(command); responses.add(new ResponseBoolean(Boolean.TRUE)); } catch (ServiceException e) { logService.logServiceException(LOGGER, Level.WARNING, e); @@ -482,15 +500,17 @@ public class StructuresController implements IStructures { } @Override - public ResponseEntity<ResponseBooleanList> validateStructuresReject(List<StructureElementCommand> structureElements) { + public ResponseEntity<ResponseBooleanList> validateStructuresReject(List<StructureElementCommandConfirm> structureElementCommands) { + // convert // validate + List<StructureElementCommand> commands = StructureElementUtil.convertCommandConfirm2Command(structureElementCommands); boolean response = true; String reason = ""; List<ResponseBoolean> responses = Lists.newArrayList(); - for (StructureElementCommand structureElement : structureElements) { + for (StructureElementCommand command : commands) { try { - structuresService.validateStructuresReject(structureElement); + structuresService.validateStructuresReject(command); responses.add(new ResponseBoolean(Boolean.TRUE)); } catch (ServiceException e) { logService.logServiceException(LOGGER, Level.WARNING, e); @@ -515,14 +535,16 @@ public class StructuresController implements IStructures { // ---------------------------------------------------------------------------------------------------- @Override - public List<StructureElement> updateStructures(List<StructureElementCommand> structureElements) { + public List<StructureElement> updateStructures(List<StructureElementCommandUpdate> structureElementCommands) { // validate authority - user & admin + // convert // validate // update structures try { - structuresService.validateStructuresUpdate(structureElements); - return structuresService.updateStructures(structureElements, TextUtil.TEST_WHO); + List<StructureElementCommand> commands = StructureElementUtil.convertCommandUpdate2Command(structureElementCommands); + structuresService.validateStructuresUpdate(commands); + return structuresService.updateStructures(commands, TextUtil.TEST_WHO); } catch (ServiceException e) { logService.logServiceException(LOGGER, Level.WARNING, e); logService.logStackTraceElements(LOGGER, Level.WARNING, e); @@ -537,6 +559,7 @@ public class StructuresController implements IStructures { public ResponseEntity<Resource> updateStructures(MultipartFile file) { // validate authority - user & admin // convert from input + // ( convert ) // validate // update structures // convert to output @@ -570,14 +593,16 @@ public class StructuresController implements IStructures { // ---------------------------------------------------------------------------------------------------- @Override - public List<StructureElement> deleteStructures(List<StructureElementCommand> structureElements) { + public List<StructureElement> deleteStructures(List<StructureElementCommandConfirm> structureElementCommands) { // validate authority - user & admin + // convert // validate // delete structures try { - structuresService.validateStructuresDelete(structureElements); - return structuresService.deleteStructures(structureElements, TextUtil.TEST_WHO); + List<StructureElementCommand> commands = StructureElementUtil.convertCommandConfirm2Command(structureElementCommands); + structuresService.validateStructuresDelete(commands); + return structuresService.deleteStructures(commands, TextUtil.TEST_WHO); } catch (ServiceException e) { logService.logServiceException(LOGGER, Level.WARNING, e); logService.logStackTraceElements(LOGGER, Level.WARNING, e); @@ -592,6 +617,7 @@ public class StructuresController implements IStructures { public ResponseEntity<Resource> deleteStructures(MultipartFile file) { // validate authority - user & admin // convert from input + // ( convert ) // validate // delete structures // convert to output @@ -625,14 +651,16 @@ public class StructuresController implements IStructures { // ---------------------------------------------------------------------------------------------------- @Override - public List<StructureElement> approveStructures(List<StructureElementCommand> structureElements) { + public List<StructureElement> approveStructures(List<StructureElementCommandConfirm> structureElementCommands) { // validate authority - admin + // convert // validate // approve structures try { - structuresService.validateStructuresApprove(structureElements); - return structuresService.approveStructures(structureElements, TextUtil.TEST_WHO); + List<StructureElementCommand> commands = StructureElementUtil.convertCommandConfirm2Command(structureElementCommands); + structuresService.validateStructuresApprove(commands); + return structuresService.approveStructures(commands, TextUtil.TEST_WHO); } catch (ServiceException e) { logService.logServiceException(LOGGER, Level.WARNING, e); logService.logStackTraceElements(LOGGER, Level.WARNING, e); @@ -647,6 +675,7 @@ public class StructuresController implements IStructures { public ResponseEntity<Resource> approveStructures(MultipartFile file) { // validate authority - admin // convert from input + // ( convert ) // validate // approve structures // convert to output @@ -678,14 +707,16 @@ public class StructuresController implements IStructures { } @Override - public List<StructureElement> cancelStructures(List<StructureElementCommand> structureElements) { + public List<StructureElement> cancelStructures(List<StructureElementCommandConfirm> structureElementCommands) { // validate authority - admin + // convert // validate // cancel structures try { - structuresService.validateStructuresCancel(structureElements); - return structuresService.cancelStructures(structureElements, TextUtil.TEST_WHO); + List<StructureElementCommand> commands = StructureElementUtil.convertCommandConfirm2Command(structureElementCommands); + structuresService.validateStructuresCancel(commands); + return structuresService.cancelStructures(commands, TextUtil.TEST_WHO); } catch (ServiceException e) { logService.logServiceException(LOGGER, Level.WARNING, e); logService.logStackTraceElements(LOGGER, Level.WARNING, e); @@ -700,6 +731,7 @@ public class StructuresController implements IStructures { public ResponseEntity<Resource> cancelStructures(MultipartFile file) { // validate authority - admin // convert from input + // ( convert ) // validate // cancel structures // convert to output @@ -731,14 +763,16 @@ public class StructuresController implements IStructures { } @Override - public List<StructureElement> rejectStructures(List<StructureElementCommand> structureElements) { + public List<StructureElement> rejectStructures(List<StructureElementCommandConfirm> structureElementCommands) { // validate authority - admin + // convert // validate // reject structures try { - structuresService.validateStructuresReject(structureElements); - return structuresService.rejectStructures(structureElements, TextUtil.TEST_WHO); + List<StructureElementCommand> commands = StructureElementUtil.convertCommandConfirm2Command(structureElementCommands); + structuresService.validateStructuresReject(commands); + return structuresService.rejectStructures(commands, TextUtil.TEST_WHO); } catch (ServiceException e) { logService.logServiceException(LOGGER, Level.WARNING, e); logService.logStackTraceElements(LOGGER, Level.WARNING, e); @@ -753,6 +787,7 @@ public class StructuresController implements IStructures { public ResponseEntity<Resource> rejectStructures(MultipartFile file) { // validate authority - admin // convert from input + // ( convert ) // validate // reject structures // convert to output diff --git a/src/main/java/org/openepics/names/service/DeviceGroupService.java b/src/main/java/org/openepics/names/service/DeviceGroupService.java index 06a6e15163c1f8bc44ce83f83782b64a1bf59196..f945cba2a70ce3f02dc8c757faa8a8833ddf1d0d 100644 --- a/src/main/java/org/openepics/names/service/DeviceGroupService.java +++ b/src/main/java/org/openepics/names/service/DeviceGroupService.java @@ -83,28 +83,32 @@ public class DeviceGroupService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification createStructure(StructureElementCommand structureElement, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { + public StructureElementNotification createStructure(StructureElementCommand structureElementCommand, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // create structure to pending, not latest, not deleted, with data // return // structure element for created structure // notification + // + // attributes + // type, parent, name, mnemonic, description, comment // note // namingConvention.equivalenceClassRepresentative return null for null input // rules for mnemonic - String mnemonic = structureElement.getMnemonic(); + String mnemonic = structureElementCommand.getMnemonic(); mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic; String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic); // create - DeviceGroup deviceGroup = new DeviceGroup(UUID.randomUUID(), structureElement.getParent(), - structureElement.getName(), mnemonic, equivalenceClassRepresentative, - structureElement.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, - when, username, structureElement.getComment()); + DeviceGroup deviceGroup = new DeviceGroup(UUID.randomUUID(), structureElementCommand.getParent(), + structureElementCommand.getName(), mnemonic, equivalenceClassRepresentative, + structureElementCommand.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, + when, username, structureElementCommand.getComment()); deviceGroupRepository.createDeviceGroup(deviceGroup); return new StructureElementNotification( @@ -113,29 +117,33 @@ public class DeviceGroupService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification updateStructure(StructureElementCommand structureElement, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { + public StructureElementNotification updateStructure(StructureElementCommand structureElementCommand, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // create structure to pending, not latest, not deleted, with data // find out previous // return // structure element for updated structure // notification + // + // attributes + // uuid, type, parent, name, mnemonic, description, comment // note // namingConvention.equivalenceClassRepresentative return null for null input // rules for mnemonic - String mnemonic = structureElement.getMnemonic(); + String mnemonic = structureElementCommand.getMnemonic(); mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic; String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic); // create - DeviceGroup deviceGroup = new DeviceGroup(structureElement.getUuid(), structureElement.getParent(), - structureElement.getName(), mnemonic, equivalenceClassRepresentative, - structureElement.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, - when, username, structureElement.getComment()); + DeviceGroup deviceGroup = new DeviceGroup(structureElementCommand.getUuid(), structureElementCommand.getParent(), + structureElementCommand.getName(), mnemonic, equivalenceClassRepresentative, + structureElementCommand.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, + when, username, structureElementCommand.getComment()); deviceGroupRepository.createDeviceGroup(deviceGroup); // previous @@ -148,18 +156,22 @@ public class DeviceGroupService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification deleteStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification deleteStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // create structure to pending, not latest, deleted, with data // return // structure element for deleted structure // notification + // + // attributes + // uuid, comment // find - List<DeviceGroup> deviceGroups = deviceGroupRepository.readDeviceGroups(Status.APPROVED, Boolean.FALSE, structureElement.getUuid().toString(), null, null, null, null, null, null); + List<DeviceGroup> deviceGroups = deviceGroupRepository.readDeviceGroups(Status.APPROVED, Boolean.FALSE, structureElementCommand.getUuid().toString(), null, null, null, null, null, null); if (ValidateUtil.isNullOrNotSize(deviceGroups, 1)) { return null; } @@ -169,7 +181,7 @@ public class DeviceGroupService { DeviceGroup deviceGroup = new DeviceGroup(toBeDeleted.getUuid(), toBeDeleted.getParentUuid(), toBeDeleted.getName(), toBeDeleted.getMnemonic(), toBeDeleted.getMnemonicEquivalence(), toBeDeleted.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.TRUE, - when, username, structureElement.getComment()); + when, username, structureElementCommand.getComment()); deviceGroupRepository.createDeviceGroup(deviceGroup); return new StructureElementNotification( @@ -178,10 +190,11 @@ public class DeviceGroupService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification approveStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification approveStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // update not latest // find @@ -204,8 +217,11 @@ public class DeviceGroupService { // return // structure element for approved structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); // find List<DeviceGroup> deviceGroups = deviceGroupRepository.readDeviceGroups(Status.APPROVED, Boolean.FALSE, uuid, null, null, null, null, null, null); @@ -226,7 +242,7 @@ public class DeviceGroupService { deviceGroup = deviceGroups.get(0); // approve - deviceGroup.setAttributesStatusProcessed(Status.APPROVED, when, username, structureElement.getComment()); + deviceGroup.setAttributesStatusProcessed(Status.APPROVED, when, username, structureElementCommand.getComment()); deviceGroup.setLatest(Boolean.TRUE); deviceGroupRepository.updateDeviceGroup(deviceGroup); @@ -239,16 +255,16 @@ public class DeviceGroupService { if (StructureCommand.DELETE.equals(structureCommandCUD)) { // not delete names - legacy names // delete sub structures - delete, approve - List<StructureElementCommand> structureElementCommands = Lists.newArrayList(); + List<StructureElementCommand> commands = Lists.newArrayList(); List<DeviceType> deviceTypes = iDeviceTypeRepository.findLatestNotDeletedByParent(uuid); for (DeviceType deviceType : deviceTypes) { - structureElementCommands.add(new StructureElementCommand(deviceType.getUuid(), Type.DEVICETYPE, null, null, null, null, StructuresService.DELETE_AFTER_APPROVE_STRUCTURE_CHANGE)); + commands.add(new StructureElementCommand(deviceType.getUuid(), Type.DEVICETYPE, null, null, null, null, StructuresService.DELETE_AFTER_APPROVE_STRUCTURE_CHANGE)); } - for (StructureElementCommand structureElementCommand : structureElementCommands) { - deviceTypeService.deleteStructure(structureElementCommand, when, username, holder); + for (StructureElementCommand command : commands) { + deviceTypeService.deleteStructure(command, when, username, holder); } - for (StructureElementCommand structureElementCommand : structureElementCommands) { - deviceTypeService.approveStructure(structureElementCommand, when, username, holder); + for (StructureElementCommand command : commands) { + deviceTypeService.approveStructure(command, when, username, holder); } } @@ -260,18 +276,22 @@ public class DeviceGroupService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification cancelStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification cancelStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // cancel - update structure to status CANCELLED // find out previous // return // structure element for created structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); // find List<DeviceGroup> deviceGroups = deviceGroupRepository.readDeviceGroups(Status.PENDING, null, uuid, null, null, null, null, null, null); @@ -281,7 +301,7 @@ public class DeviceGroupService { DeviceGroup deviceGroup = deviceGroups.get(0); // cancel - deviceGroup.setAttributesStatusProcessed(Status.CANCELLED, when, username, structureElement.getComment()); + deviceGroup.setAttributesStatusProcessed(Status.CANCELLED, when, username, structureElementCommand.getComment()); deviceGroupRepository.updateDeviceGroup(deviceGroup); // previous @@ -297,18 +317,22 @@ public class DeviceGroupService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification rejectStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification rejectStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // reject - update structure to status REJECTED // find out previous // return // structure element for created structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); // find List<DeviceGroup> deviceGroups = deviceGroupRepository.readDeviceGroups(Status.PENDING, null, uuid, null, null, null, null, null, null); @@ -318,7 +342,7 @@ public class DeviceGroupService { DeviceGroup deviceGroup = deviceGroups.get(0); // reject - deviceGroup.setAttributesStatusProcessed(Status.REJECTED, when, username, structureElement.getComment()); + deviceGroup.setAttributesStatusProcessed(Status.REJECTED, when, username, structureElementCommand.getComment()); deviceGroupRepository.updateDeviceGroup(deviceGroup); // previous diff --git a/src/main/java/org/openepics/names/service/DeviceTypeService.java b/src/main/java/org/openepics/names/service/DeviceTypeService.java index ca6defa6e23aee6eda6c0981e7ebd97bbdc196a4..3a2756b05f7cf30a8751a8c28200fa7d48b95990 100644 --- a/src/main/java/org/openepics/names/service/DeviceTypeService.java +++ b/src/main/java/org/openepics/names/service/DeviceTypeService.java @@ -76,28 +76,32 @@ public class DeviceTypeService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification createStructure(StructureElementCommand structureElement, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { + public StructureElementNotification createStructure(StructureElementCommand structureElementCommand, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // create structure to pending, not latest, not deleted, with data // return // structure element for created structure // notification + // + // attributes + // type, parent, name, mnemonic, description, comment // note // namingConvention.equivalenceClassRepresentative return null for null input // rules for mnemonic - String mnemonic = structureElement.getMnemonic(); + String mnemonic = structureElementCommand.getMnemonic(); mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic; String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic); // create - DeviceType deviceType = new DeviceType(UUID.randomUUID(), structureElement.getParent(), - structureElement.getName(), mnemonic, equivalenceClassRepresentative, - structureElement.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, - when, username, structureElement.getComment()); + DeviceType deviceType = new DeviceType(UUID.randomUUID(), structureElementCommand.getParent(), + structureElementCommand.getName(), mnemonic, equivalenceClassRepresentative, + structureElementCommand.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, + when, username, structureElementCommand.getComment()); deviceTypeRepository.createDeviceType(deviceType); return new StructureElementNotification( @@ -106,29 +110,33 @@ public class DeviceTypeService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification updateStructure(StructureElementCommand structureElement, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { + public StructureElementNotification updateStructure(StructureElementCommand structureElementCommand, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // create structure to pending, not latest, not deleted, with data // find out previous // return // structure element for updated structure // notification + // + // attributes + // uuid, type, parent, name, mnemonic, description, comment // note // namingConvention.equivalenceClassRepresentative return null for null input // rules for mnemonic - String mnemonic = structureElement.getMnemonic(); + String mnemonic = structureElementCommand.getMnemonic(); mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic; String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic); // create - DeviceType deviceType = new DeviceType(structureElement.getUuid(), structureElement.getParent(), - structureElement.getName(), mnemonic, equivalenceClassRepresentative, - structureElement.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, - when, username, structureElement.getComment()); + DeviceType deviceType = new DeviceType(structureElementCommand.getUuid(), structureElementCommand.getParent(), + structureElementCommand.getName(), mnemonic, equivalenceClassRepresentative, + structureElementCommand.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, + when, username, structureElementCommand.getComment()); deviceTypeRepository.createDeviceType(deviceType); // previous @@ -141,18 +149,22 @@ public class DeviceTypeService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification deleteStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification deleteStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // create structure to pending, not latest, deleted, with data // return // structure element for deleted structure // notification + // + // attributes + // uuid, comment // find - List<DeviceType> deviceTypes = deviceTypeRepository.readDeviceTypes(Status.APPROVED, Boolean.FALSE, structureElement.getUuid().toString(), null, null, null, null, null, null); + List<DeviceType> deviceTypes = deviceTypeRepository.readDeviceTypes(Status.APPROVED, Boolean.FALSE, structureElementCommand.getUuid().toString(), null, null, null, null, null, null); if (ValidateUtil.isNullOrNotSize(deviceTypes, 1)) { return null; } @@ -162,7 +174,7 @@ public class DeviceTypeService { DeviceType deviceType = new DeviceType(toBeDeleted.getUuid(), toBeDeleted.getParentUuid(), toBeDeleted.getName(), toBeDeleted.getMnemonic(), toBeDeleted.getMnemonicEquivalence(), toBeDeleted.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.TRUE, - when, username, structureElement.getComment()); + when, username, structureElementCommand.getComment()); deviceTypeRepository.createDeviceType(deviceType); return new StructureElementNotification( @@ -171,10 +183,11 @@ public class DeviceTypeService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification approveStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification approveStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // update not latest // find @@ -197,8 +210,11 @@ public class DeviceTypeService { // return // structure element for approved structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); // find List<DeviceType> deviceTypes = deviceTypeRepository.readDeviceTypes(Status.APPROVED, Boolean.FALSE, uuid, null, null, null, null, null, null); @@ -219,7 +235,7 @@ public class DeviceTypeService { deviceType = deviceTypes.get(0); // approve - deviceType.setAttributesStatusProcessed(Status.APPROVED, when, username, structureElement.getComment()); + deviceType.setAttributesStatusProcessed(Status.APPROVED, when, username, structureElementCommand.getComment()); deviceType.setLatest(Boolean.TRUE); deviceTypeRepository.updateDeviceType(deviceType); @@ -243,18 +259,22 @@ public class DeviceTypeService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification cancelStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification cancelStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // cancel - update structure to status CANCELLED // find out previous // return // structure element for created structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); List<DeviceType> deviceTypes = deviceTypeRepository.readDeviceTypes(Status.PENDING, null, uuid, null, null, null, null, null, null); if (ValidateUtil.isNullOrNotSize(deviceTypes, 1)) { @@ -263,7 +283,7 @@ public class DeviceTypeService { DeviceType deviceType = deviceTypes.get(0); // cancel - deviceType.setAttributesStatusProcessed(Status.CANCELLED, when, username, structureElement.getComment()); + deviceType.setAttributesStatusProcessed(Status.CANCELLED, when, username, structureElementCommand.getComment()); deviceTypeRepository.updateDeviceType(deviceType); // previous @@ -279,18 +299,22 @@ public class DeviceTypeService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification rejectStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification rejectStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // reject - update structure to status REJECTED // find out previous // return // structure element for created structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); // find List<DeviceType> deviceTypes = deviceTypeRepository.readDeviceTypes(Status.PENDING, null, uuid, null, null, null, null, null, null); @@ -300,7 +324,7 @@ public class DeviceTypeService { DeviceType deviceType = deviceTypes.get(0); // reject - deviceType.setAttributesStatusProcessed(Status.REJECTED, when, username, structureElement.getComment()); + deviceType.setAttributesStatusProcessed(Status.REJECTED, when, username, structureElementCommand.getComment()); deviceTypeRepository.updateDeviceType(deviceType); // previous diff --git a/src/main/java/org/openepics/names/service/DisciplineService.java b/src/main/java/org/openepics/names/service/DisciplineService.java index c84e3621ee2db8f0056c62dca9a212cfc75c12be..b6d4100c4e2f07becc988079eeb779ba6e2988c3 100644 --- a/src/main/java/org/openepics/names/service/DisciplineService.java +++ b/src/main/java/org/openepics/names/service/DisciplineService.java @@ -86,28 +86,32 @@ public class DisciplineService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification createStructure(StructureElementCommand structureElement, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { + public StructureElementNotification createStructure(StructureElementCommand structureElementCommand, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // create structure to pending, not latest, not deleted, with data // return // structure element for created structure // notification + // + // attributes + // type, parent, name, mnemonic, description, comment // note // namingConvention.equivalenceClassRepresentative return null for null input // rules for mnemonic - String mnemonic = structureElement.getMnemonic(); + String mnemonic = structureElementCommand.getMnemonic(); mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic; String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic); // create Discipline discipline = new Discipline(UUID.randomUUID(), - structureElement.getName(), mnemonic, equivalenceClassRepresentative, - structureElement.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, - when, username, structureElement.getComment()); + structureElementCommand.getName(), mnemonic, equivalenceClassRepresentative, + structureElementCommand.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, + when, username, structureElementCommand.getComment()); disciplineRepository.createDiscipline(discipline); return new StructureElementNotification( @@ -116,29 +120,33 @@ public class DisciplineService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification updateStructure(StructureElementCommand structureElement, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { + public StructureElementNotification updateStructure(StructureElementCommand structureElementCommand, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // create structure to pending, not latest, not deleted, with data // find out previous // return // structure element for updated structure // notification + // + // attributes + // uuid, type, parent, name, mnemonic, description, comment // note // namingConvention.equivalenceClassRepresentative return null for null input // rules for mnemonic - String mnemonic = structureElement.getMnemonic(); + String mnemonic = structureElementCommand.getMnemonic(); mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic; String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic); // create - Discipline discipline = new Discipline(structureElement.getUuid(), - structureElement.getName(), mnemonic, equivalenceClassRepresentative, - structureElement.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, - when, username, structureElement.getComment()); + Discipline discipline = new Discipline(structureElementCommand.getUuid(), + structureElementCommand.getName(), mnemonic, equivalenceClassRepresentative, + structureElementCommand.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, + when, username, structureElementCommand.getComment()); disciplineRepository.createDiscipline(discipline); // previous @@ -151,18 +159,22 @@ public class DisciplineService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification deleteStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification deleteStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // create structure to pending, not latest, deleted, with data // return // structure element for deleted structure // notification + // + // attributes + // uuid, comment // find - List<Discipline> disciplines = disciplineRepository.readDisciplines(Status.APPROVED, Boolean.FALSE, structureElement.getUuid().toString(), null, null, null, null, null); + List<Discipline> disciplines = disciplineRepository.readDisciplines(Status.APPROVED, Boolean.FALSE, structureElementCommand.getUuid().toString(), null, null, null, null, null); if (ValidateUtil.isNullOrNotSize(disciplines, 1)) { return null; } @@ -172,7 +184,7 @@ public class DisciplineService { Discipline discipline = new Discipline(toBeDeleted.getUuid(), toBeDeleted.getName(), toBeDeleted.getMnemonic(), toBeDeleted.getMnemonicEquivalence(), toBeDeleted.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.TRUE, - when, username, structureElement.getComment()); + when, username, structureElementCommand.getComment()); disciplineRepository.createDiscipline(discipline); return new StructureElementNotification( @@ -181,10 +193,11 @@ public class DisciplineService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification approveStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification approveStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // update not latest // find @@ -207,8 +220,11 @@ public class DisciplineService { // return // structure element for approved structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); List<Discipline> disciplines = disciplineRepository.readDisciplines(Status.APPROVED, Boolean.FALSE, uuid, null, null, null, null, null); Discipline discipline = null; @@ -228,7 +244,7 @@ public class DisciplineService { discipline = disciplines.get(0); // approve - discipline.setAttributesStatusProcessed(Status.APPROVED, when, username, structureElement.getComment()); + discipline.setAttributesStatusProcessed(Status.APPROVED, when, username, structureElementCommand.getComment()); discipline.setLatest(Boolean.TRUE); disciplineRepository.updateDiscipline(discipline); @@ -243,16 +259,16 @@ public class DisciplineService { } else if (StructureCommand.DELETE.equals(structureCommandCUD)) { // not delete names - legacy names // delete sub structures - delete, approve - List<StructureElementCommand> structureElementCommands = Lists.newArrayList(); + List<StructureElementCommand> commands = Lists.newArrayList(); List<DeviceGroup> deviceGroups = iDeviceGroupRepository.findLatestNotDeletedByParent(uuid); for (DeviceGroup deviceGroup : deviceGroups) { - structureElementCommands.add(new StructureElementCommand(deviceGroup.getUuid(), Type.DEVICEGROUP, null, null, null, null, StructuresService.DELETE_AFTER_APPROVE_STRUCTURE_CHANGE)); + commands.add(new StructureElementCommand(deviceGroup.getUuid(), Type.DEVICEGROUP, null, null, null, null, StructuresService.DELETE_AFTER_APPROVE_STRUCTURE_CHANGE)); } - for (StructureElementCommand structureElementCommand : structureElementCommands) { - deviceGroupService.deleteStructure(structureElementCommand, when, username, holder); + for (StructureElementCommand command : commands) { + deviceGroupService.deleteStructure(command, when, username, holder); } - for (StructureElementCommand structureElementCommand : structureElementCommands) { - deviceGroupService.approveStructure(structureElementCommand, when, username, holder); + for (StructureElementCommand command : commands) { + deviceGroupService.approveStructure(command, when, username, holder); } } @@ -264,18 +280,22 @@ public class DisciplineService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification cancelStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification cancelStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // cancel - update structure to status CANCELLED // find out previous // return // structure element for created structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); // find List<Discipline> disciplines = disciplineRepository.readDisciplines(Status.PENDING, null, uuid, null, null, null, null, null); @@ -285,7 +305,7 @@ public class DisciplineService { Discipline discipline = disciplines.get(0); // cancel - discipline.setAttributesStatusProcessed(Status.CANCELLED, when, username, structureElement.getComment()); + discipline.setAttributesStatusProcessed(Status.CANCELLED, when, username, structureElementCommand.getComment()); disciplineRepository.updateDiscipline(discipline); // previous @@ -301,18 +321,22 @@ public class DisciplineService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification rejectStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification rejectStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // reject - update structure to status REJECTED // find out previous // return // structure element for created structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); // find List<Discipline> disciplines = disciplineRepository.readDisciplines(Status.PENDING, null, uuid, null, null, null, null, null); @@ -322,7 +346,7 @@ public class DisciplineService { Discipline discipline = disciplines.get(0); // reject - discipline.setAttributesStatusProcessed(Status.REJECTED, when, username, structureElement.getComment()); + discipline.setAttributesStatusProcessed(Status.REJECTED, when, username, structureElementCommand.getComment()); disciplineRepository.updateDiscipline(discipline); // previous diff --git a/src/main/java/org/openepics/names/service/StructuresService.java b/src/main/java/org/openepics/names/service/StructuresService.java index 02b6d4d1ed2b2e24716314ac2bcae15839ac8037..befbaef6ceeb5c956f9f6873fd650613a954106c 100644 --- a/src/main/java/org/openepics/names/service/StructuresService.java +++ b/src/main/java/org/openepics/names/service/StructuresService.java @@ -553,8 +553,9 @@ public class StructuresService { List<Discipline> disciplines = holderRepositories.getDisciplineRepository().readDisciplines(Status.APPROVED, false, null, null, null, null, mnemonicPath, null); return !disciplines.isEmpty(); } else if (Type.DEVICEGROUP.equals(type)) { - List<DeviceGroup> deviceGroups = holderRepositories.getDeviceGroupRepository().readDeviceGroups(Status.APPROVED, false, null, null, null, null, null, mnemonicPath, null); - return !deviceGroups.isEmpty(); +// List<DeviceGroup> deviceGroups = holderRepositories.getDeviceGroupRepository().readDeviceGroups(Status.APPROVED, false, null, null, null, null, null, mnemonicPath, null); +// return !deviceGroups.isEmpty(); + return Boolean.FALSE; } else if (Type.DEVICETYPE.equals(type)) { List<DeviceType> deviceTypes = holderRepositories.getDeviceTypeRepository().readDeviceTypes(Status.APPROVED, false, null, null, null, null, null, mnemonicPath, null); return !deviceTypes.isEmpty(); diff --git a/src/main/java/org/openepics/names/service/SubsystemService.java b/src/main/java/org/openepics/names/service/SubsystemService.java index e35fe8ad193ec43289941270efe3463415bb9bf1..2a05eca70aadde27f0bd009eb334c9142bce15b1 100644 --- a/src/main/java/org/openepics/names/service/SubsystemService.java +++ b/src/main/java/org/openepics/names/service/SubsystemService.java @@ -77,28 +77,32 @@ public class SubsystemService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification createStructure(StructureElementCommand structureElement, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { + public StructureElementNotification createStructure(StructureElementCommand structureElementCommand, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // create structure to pending, not latest, not deleted, with data // return // structure element for created structure // notification + // + // attributes + // type, parent, name, mnemonic, description, comment // note // namingConvention.equivalenceClassRepresentative return null for null input // rules for mnemonic - String mnemonic = structureElement.getMnemonic(); + String mnemonic = structureElementCommand.getMnemonic(); mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic; String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic); // create - Subsystem subsystem = new Subsystem(UUID.randomUUID(), structureElement.getParent(), - structureElement.getName(), mnemonic, equivalenceClassRepresentative, - structureElement.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, - when, username, structureElement.getComment()); + Subsystem subsystem = new Subsystem(UUID.randomUUID(), structureElementCommand.getParent(), + structureElementCommand.getName(), mnemonic, equivalenceClassRepresentative, + structureElementCommand.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, + when, username, structureElementCommand.getComment()); subsystemRepository.createSubsystem(subsystem); return new StructureElementNotification( @@ -107,29 +111,33 @@ public class SubsystemService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification updateStructure(StructureElementCommand structureElement, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { + public StructureElementNotification updateStructure(StructureElementCommand structureElementCommand, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // create structure to pending, not latest, not deleted, with data // find out previous // return // structure element for updated structure // notification + // + // attributes + // uuid, type, parent, name, mnemonic, description, comment // note // namingConvention.equivalenceClassRepresentative return null for null input // rules for mnemonic - String mnemonic = structureElement.getMnemonic(); + String mnemonic = structureElementCommand.getMnemonic(); mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic; String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic); // create - Subsystem subsystem = new Subsystem(structureElement.getUuid(), structureElement.getParent(), - structureElement.getName(), mnemonic, equivalenceClassRepresentative, - structureElement.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, - when, username, structureElement.getComment()); + Subsystem subsystem = new Subsystem(structureElementCommand.getUuid(), structureElementCommand.getParent(), + structureElementCommand.getName(), mnemonic, equivalenceClassRepresentative, + structureElementCommand.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, + when, username, structureElementCommand.getComment()); subsystemRepository.createSubsystem(subsystem); // previous @@ -142,18 +150,22 @@ public class SubsystemService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification deleteStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification deleteStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // create structure to pending, not latest, deleted, with data // return // structure element for deleted structure // notification + // + // attributes + // uuid, comment // find - List<Subsystem> subsystems = subsystemRepository.readSubsystems(Status.APPROVED, Boolean.FALSE, structureElement.getUuid().toString(), null, null, null, null, null, null); + List<Subsystem> subsystems = subsystemRepository.readSubsystems(Status.APPROVED, Boolean.FALSE, structureElementCommand.getUuid().toString(), null, null, null, null, null, null); if (ValidateUtil.isNullOrNotSize(subsystems, 1)) { return null; } @@ -163,7 +175,7 @@ public class SubsystemService { Subsystem subsystem = new Subsystem(toBeDeleted.getUuid(), toBeDeleted.getParentUuid(), toBeDeleted.getName(), toBeDeleted.getMnemonic(), toBeDeleted.getMnemonicEquivalence(), toBeDeleted.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.TRUE, - when, username, structureElement.getComment()); + when, username, structureElementCommand.getComment()); subsystemRepository.createSubsystem(subsystem); return new StructureElementNotification( @@ -172,10 +184,11 @@ public class SubsystemService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification approveStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification approveStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // update not latest // find @@ -198,8 +211,11 @@ public class SubsystemService { // return // structure element for approved structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); // find List<Subsystem> subsystems = subsystemRepository.readSubsystems(Status.APPROVED, Boolean.FALSE, uuid, null, null, null, null, null, null); @@ -220,7 +236,7 @@ public class SubsystemService { subsystem = subsystems.get(0); // approve - subsystem.setAttributesStatusProcessed(Status.APPROVED, when, username, structureElement.getComment()); + subsystem.setAttributesStatusProcessed(Status.APPROVED, when, username, structureElementCommand.getComment()); subsystem.setLatest(Boolean.TRUE); subsystemRepository.updateSubsystem(subsystem); @@ -251,18 +267,22 @@ public class SubsystemService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification cancelStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification cancelStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // cancel - update structure to status CANCELLED // find out previous // return // structure element for created structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); // find List<Subsystem> subsystems = subsystemRepository.readSubsystems(Status.PENDING, null, uuid, null, null, null, null, null, null); @@ -272,7 +292,7 @@ public class SubsystemService { Subsystem subsystem = subsystems.get(0); // cancel - subsystem.setAttributesStatusProcessed(Status.CANCELLED, when, username, structureElement.getComment()); + subsystem.setAttributesStatusProcessed(Status.CANCELLED, when, username, structureElementCommand.getComment()); subsystemRepository.updateSubsystem(subsystem); // previous @@ -288,18 +308,22 @@ public class SubsystemService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification rejectStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification rejectStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // reject - update structure to status REJECTED // find out previous // return // structure element for created structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); // find List<Subsystem> subsystems = subsystemRepository.readSubsystems(Status.PENDING, null, uuid, null, null, null, null, null, null); @@ -309,7 +333,7 @@ public class SubsystemService { Subsystem subsystem = subsystems.get(0); // reject - subsystem.setAttributesStatusProcessed(Status.REJECTED, when, username, structureElement.getComment()); + subsystem.setAttributesStatusProcessed(Status.REJECTED, when, username, structureElementCommand.getComment()); subsystemRepository.updateSubsystem(subsystem); // previous diff --git a/src/main/java/org/openepics/names/service/SystemGroupService.java b/src/main/java/org/openepics/names/service/SystemGroupService.java index 60897d1f315b57610ebe46f409332afa5e8dbf31..77925e285d5706e4170769d55eb6c3cb411ea02e 100644 --- a/src/main/java/org/openepics/names/service/SystemGroupService.java +++ b/src/main/java/org/openepics/names/service/SystemGroupService.java @@ -87,28 +87,32 @@ public class SystemGroupService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification createStructure(StructureElementCommand structureElement, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { + public StructureElementNotification createStructure(StructureElementCommand structureElementCommand, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // create structure to pending, not latest, not deleted, with data // return // structure element for created structure // notification + // + // attributes + // type, parent, name, mnemonic, description, comment // note // namingConvention.equivalenceClassRepresentative return null for null input // rules for mnemonic - String mnemonic = structureElement.getMnemonic(); + String mnemonic = structureElementCommand.getMnemonic(); mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic; String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic); // create SystemGroup systemGroup = new SystemGroup(UUID.randomUUID(), - structureElement.getName(), mnemonic, equivalenceClassRepresentative, - structureElement.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, - when, username, structureElement.getComment()); + structureElementCommand.getName(), mnemonic, equivalenceClassRepresentative, + structureElementCommand.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, + when, username, structureElementCommand.getComment()); systemGroupRepository.createSystemGroup(systemGroup); return new StructureElementNotification( @@ -117,29 +121,33 @@ public class SystemGroupService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification updateStructure(StructureElementCommand structureElement, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { + public StructureElementNotification updateStructure(StructureElementCommand structureElementCommand, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // create structure to pending, not latest, not deleted, with data // find out previous // return // structure element for updated structure // notification + // + // attributes + // uuid, type, parent, name, mnemonic, description, comment // note // namingConvention.equivalenceClassRepresentative return null for null input // rules for mnemonic - String mnemonic = structureElement.getMnemonic(); + String mnemonic = structureElementCommand.getMnemonic(); mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic; String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic); // create - SystemGroup systemGroup = new SystemGroup(structureElement.getUuid(), - structureElement.getName(), mnemonic, equivalenceClassRepresentative, - structureElement.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, - when, username, structureElement.getComment()); + SystemGroup systemGroup = new SystemGroup(structureElementCommand.getUuid(), + structureElementCommand.getName(), mnemonic, equivalenceClassRepresentative, + structureElementCommand.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, + when, username, structureElementCommand.getComment()); systemGroupRepository.createSystemGroup(systemGroup); // previous @@ -152,18 +160,22 @@ public class SystemGroupService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification deleteStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification deleteStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // create structure to pending, not latest, deleted, with data // return // structure element for deleted structure // notification + // + // attributes + // uuid, comment // find - List<SystemGroup> systemGroups = systemGroupRepository.readSystemGroups(Status.APPROVED, Boolean.FALSE, structureElement.getUuid().toString(), null, null, null, null, null); + List<SystemGroup> systemGroups = systemGroupRepository.readSystemGroups(Status.APPROVED, Boolean.FALSE, structureElementCommand.getUuid().toString(), null, null, null, null, null); if (ValidateUtil.isNullOrNotSize(systemGroups, 1)) { return null; } @@ -173,7 +185,7 @@ public class SystemGroupService { SystemGroup systemGroup = new SystemGroup(toBeDeleted.getUuid(), toBeDeleted.getName(), toBeDeleted.getMnemonic(), toBeDeleted.getMnemonicEquivalence(), toBeDeleted.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.TRUE, - when, username, structureElement.getComment()); + when, username, structureElementCommand.getComment()); systemGroupRepository.createSystemGroup(systemGroup); return new StructureElementNotification( @@ -182,10 +194,11 @@ public class SystemGroupService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification approveStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification approveStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // update not latest // find @@ -208,8 +221,11 @@ public class SystemGroupService { // return // structure element for approved structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); // find List<SystemGroup> systemGroups = systemGroupRepository.readSystemGroups(Status.APPROVED, Boolean.FALSE, uuid, null, null, null, null, null); @@ -230,7 +246,7 @@ public class SystemGroupService { systemGroup = systemGroups.get(0); // approve - systemGroup.setAttributesStatusProcessed(Status.APPROVED, when, username, structureElement.getComment()); + systemGroup.setAttributesStatusProcessed(Status.APPROVED, when, username, structureElementCommand.getComment()); systemGroup.setLatest(Boolean.TRUE); systemGroupRepository.updateSystemGroup(systemGroup); @@ -252,16 +268,16 @@ public class SystemGroupService { } else if (StructureCommand.DELETE.equals(structureCommandCUD)) { // not delete names - legacy names // delete sub structures - delete, approve - List<StructureElementCommand> structureElementCommands = Lists.newArrayList(); + List<StructureElementCommand> commands = Lists.newArrayList(); List<System> systems = iSystemRepository.findLatestNotDeletedByParent(uuid); for (System system : systems) { - structureElementCommands.add(new StructureElementCommand(system.getUuid(), Type.SYSTEM, null, null, null, null, StructuresService.DELETE_AFTER_APPROVE_STRUCTURE_CHANGE)); + commands.add(new StructureElementCommand(system.getUuid(), Type.SYSTEM, null, null, null, null, StructuresService.DELETE_AFTER_APPROVE_STRUCTURE_CHANGE)); } - for (StructureElementCommand structureElementCommand : structureElementCommands) { - systemService.deleteStructure(structureElementCommand, when, username, holder); + for (StructureElementCommand command : commands) { + systemService.deleteStructure(command, when, username, holder); } - for (StructureElementCommand structureElementCommand : structureElementCommands) { - systemService.approveStructure(structureElementCommand, when, username, holder); + for (StructureElementCommand command : commands) { + systemService.approveStructure(command, when, username, holder); } } @@ -273,18 +289,22 @@ public class SystemGroupService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification cancelStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification cancelStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // cancel - update structure to status CANCELLED // find out previous // return // structure element for created structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); // find List<SystemGroup> systemGroups = systemGroupRepository.readSystemGroups(Status.PENDING, null, uuid, null, null, null, null, null); @@ -294,7 +314,7 @@ public class SystemGroupService { SystemGroup systemGroup = systemGroups.get(0); // cancel - systemGroup.setAttributesStatusProcessed(Status.CANCELLED, when, username, structureElement.getComment()); + systemGroup.setAttributesStatusProcessed(Status.CANCELLED, when, username, structureElementCommand.getComment()); systemGroupRepository.updateSystemGroup(systemGroup); // previous @@ -310,18 +330,22 @@ public class SystemGroupService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification rejectStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification rejectStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // reject - update structure to status REJECTED // find out previous // return // structure element for created structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); // find List<SystemGroup> systemGroups = systemGroupRepository.readSystemGroups(Status.PENDING, null, uuid, null, null, null, null, null); @@ -331,7 +355,7 @@ public class SystemGroupService { SystemGroup systemGroup = systemGroups.get(0); // reject - systemGroup.setAttributesStatusProcessed(Status.REJECTED, when, username, structureElement.getComment()); + systemGroup.setAttributesStatusProcessed(Status.REJECTED, when, username, structureElementCommand.getComment()); systemGroupRepository.updateSystemGroup(systemGroup); // previous diff --git a/src/main/java/org/openepics/names/service/SystemService.java b/src/main/java/org/openepics/names/service/SystemService.java index dd471d15a8b840916f71d686603a54f54551c083..2e18c69d10b4817d1121377bce30a90e89cf90a5 100644 --- a/src/main/java/org/openepics/names/service/SystemService.java +++ b/src/main/java/org/openepics/names/service/SystemService.java @@ -87,28 +87,32 @@ public class SystemService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification createStructure(StructureElementCommand structureElement, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { + public StructureElementNotification createStructure(StructureElementCommand structureElementCommand, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // create structure to pending, not latest, not deleted, with data // return // structure element for created structure // notification + // + // attributes + // type, parent, name, mnemonic, description, comment // note // namingConvention.equivalenceClassRepresentative return null for null input // rules for mnemonic - String mnemonic = structureElement.getMnemonic(); + String mnemonic = structureElementCommand.getMnemonic(); mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic; String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic); // create - System system = new System(UUID.randomUUID(), structureElement.getParent(), - structureElement.getName(), mnemonic, equivalenceClassRepresentative, - structureElement.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, - when, username, structureElement.getComment()); + System system = new System(UUID.randomUUID(), structureElementCommand.getParent(), + structureElementCommand.getName(), mnemonic, equivalenceClassRepresentative, + structureElementCommand.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, + when, username, structureElementCommand.getComment()); systemRepository.createSystem(system); return new StructureElementNotification( @@ -117,29 +121,33 @@ public class SystemService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification updateStructure(StructureElementCommand structureElement, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { + public StructureElementNotification updateStructure(StructureElementCommand structureElementCommand, Date when, String username, EssNamingConvention namingConvention, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // create structure to pending, not latest, not deleted, with data // find out previous // return // structure element for updated structure // notification + // + // attributes + // uuid, type, parent, name, mnemonic, description, comment // note // namingConvention.equivalenceClassRepresentative return null for null input // rules for mnemonic - String mnemonic = structureElement.getMnemonic(); + String mnemonic = structureElementCommand.getMnemonic(); mnemonic = StringUtils.isEmpty(mnemonic) ? null : mnemonic; String equivalenceClassRepresentative = namingConvention.equivalenceClassRepresentative(mnemonic); // create - System system = new System(structureElement.getUuid(), structureElement.getParent(), - structureElement.getName(), mnemonic, equivalenceClassRepresentative, - structureElement.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, - when, username, structureElement.getComment()); + System system = new System(structureElementCommand.getUuid(), structureElementCommand.getParent(), + structureElementCommand.getName(), mnemonic, equivalenceClassRepresentative, + structureElementCommand.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.FALSE, + when, username, structureElementCommand.getComment()); systemRepository.createSystem(system); // previous @@ -152,18 +160,22 @@ public class SystemService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification deleteStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification deleteStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // create structure to pending, not latest, deleted, with data // return // structure element for deleted structure // notification + // + // attributes + // uuid, comment // find - List<System> systems = systemRepository.readSystems(Status.APPROVED, Boolean.FALSE, structureElement.getUuid().toString(), null, null, null, null, null, null); + List<System> systems = systemRepository.readSystems(Status.APPROVED, Boolean.FALSE, structureElementCommand.getUuid().toString(), null, null, null, null, null, null); if (ValidateUtil.isNullOrNotSize(systems, 1)) { return null; } @@ -173,7 +185,7 @@ public class SystemService { System system = new System(toBeDeleted.getUuid(), toBeDeleted.getParentUuid(), toBeDeleted.getName(), toBeDeleted.getMnemonic(), toBeDeleted.getMnemonicEquivalence(), toBeDeleted.getDescription(), Status.PENDING, Boolean.FALSE, Boolean.TRUE, - when, username, structureElement.getComment()); + when, username, structureElementCommand.getComment()); systemRepository.createSystem(system); return new StructureElementNotification( @@ -182,10 +194,11 @@ public class SystemService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification approveStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification approveStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // update not latest // find @@ -208,8 +221,11 @@ public class SystemService { // return // structure element for approved structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); // find List<System> systems = systemRepository.readSystems(Status.APPROVED, Boolean.FALSE, uuid, null, null, null, null, null, null); @@ -230,7 +246,7 @@ public class SystemService { system = systems.get(0); // approve - system.setAttributesStatusProcessed(Status.APPROVED, when, username, structureElement.getComment()); + system.setAttributesStatusProcessed(Status.APPROVED, when, username, structureElementCommand.getComment()); system.setLatest(Boolean.TRUE); systemRepository.updateSystem(system); @@ -252,16 +268,16 @@ public class SystemService { } else if (StructureCommand.DELETE.equals(structureCommandCUD)) { // not delete names - legacy names // delete sub structures - delete, approve - List<StructureElementCommand> structureElementCommands = Lists.newArrayList(); + List<StructureElementCommand> commands = Lists.newArrayList(); List<Subsystem> subsystems = iSubsystemRepository.findLatestNotDeletedByParent(uuid); for (Subsystem subsystem : subsystems) { - structureElementCommands.add(new StructureElementCommand(subsystem.getUuid(), Type.SUBSYSTEM, null, null, null, null, StructuresService.DELETE_AFTER_APPROVE_STRUCTURE_CHANGE)); + commands.add(new StructureElementCommand(subsystem.getUuid(), Type.SUBSYSTEM, null, null, null, null, StructuresService.DELETE_AFTER_APPROVE_STRUCTURE_CHANGE)); } - for (StructureElementCommand structureElementCommand : structureElementCommands) { - subsystemService.deleteStructure(structureElementCommand, when, username, holder); + for (StructureElementCommand command : commands) { + subsystemService.deleteStructure(command, when, username, holder); } - for (StructureElementCommand structureElementCommand : structureElementCommands) { - subsystemService.approveStructure(structureElementCommand, when, username, holder); + for (StructureElementCommand command : commands) { + subsystemService.approveStructure(command, when, username, holder); } } @@ -273,18 +289,22 @@ public class SystemService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification cancelStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification cancelStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // cancel - update structure to status CANCELLED // find out previous // return // structure element for created structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); // find List<System> systems = systemRepository.readSystems(Status.PENDING, null, uuid, null, null, null, null, null, null); @@ -294,7 +314,7 @@ public class SystemService { System system = systems.get(0); // cancel - system.setAttributesStatusProcessed(Status.CANCELLED, when, username, structureElement.getComment()); + system.setAttributesStatusProcessed(Status.CANCELLED, when, username, structureElementCommand.getComment()); systemRepository.updateSystem(system); // previous @@ -310,18 +330,22 @@ public class SystemService { } @Transactional(propagation = Propagation.MANDATORY) - public StructureElementNotification rejectStructure(StructureElementCommand structureElement, Date when, String username, HolderSystemDeviceStructure holder) { + public StructureElementNotification rejectStructure(StructureElementCommand structureElementCommand, Date when, String username, HolderSystemDeviceStructure holder) { // validation outside method // transaction // support a current transaction, throw an exception if none exists + // attributes // find // reject - update structure to status REJECTED // find out previous // return // structure element for created structure // notification + // + // attributes + // uuid, comment - String uuid = structureElement.getUuid().toString(); + String uuid = structureElementCommand.getUuid().toString(); // find List<System> systems = systemRepository.readSystems(Status.PENDING, null, uuid, null, null, null, null, null, null); @@ -331,7 +355,7 @@ public class SystemService { System system = systems.get(0); // reject - system.setAttributesStatusProcessed(Status.REJECTED, when, username, structureElement.getComment()); + system.setAttributesStatusProcessed(Status.REJECTED, when, username, structureElementCommand.getComment()); systemRepository.updateSystem(system); // previous diff --git a/src/main/java/org/openepics/names/util/ExcelUtil.java b/src/main/java/org/openepics/names/util/ExcelUtil.java index 5dfb471ed4cb8b30bfa8be4aa6e44039d7b9d350..b7863e2fb7364fe8ff2cc0b46b04dead6b55b42c 100644 --- a/src/main/java/org/openepics/names/util/ExcelUtil.java +++ b/src/main/java/org/openepics/names/util/ExcelUtil.java @@ -264,8 +264,8 @@ public class ExcelUtil { // StructureElementCommand // create - type, parent, name, mnemonic, description, comment - // update - uuid, type, parent, name, mnemonic, description, comment - // delete - uuid, type comment + // update - uuid, type, parent, name, mnemonic, description, comment + // delete - uuid, type comment int rowIndex = 0; int columnIndex = 0; diff --git a/src/main/java/org/openepics/names/util/NameElementUtil.java b/src/main/java/org/openepics/names/util/NameElementUtil.java index de09deda5537cc6c36bb2a6931991ae7787a8aeb..b39cf4668e84b8b93fc88f93d73be6c3d6f5c2e1 100644 --- a/src/main/java/org/openepics/names/util/NameElementUtil.java +++ b/src/main/java/org/openepics/names/util/NameElementUtil.java @@ -136,97 +136,6 @@ public class NameElementUtil { when, who); } - /** - * Populate and return list of name element commands given list of name element commands for create. - * - * @param commands name element commands for create - * @return list of name element commands - */ - public static List<NameElementCommand> getNameElementCommandsForCreate(List<NameElementCommandCreate> commands) { - List<NameElementCommand> nameElementCommands = Lists.newArrayList(); - for (NameElementCommandCreate command : commands) { - nameElementCommands.add(NameElementUtil.getNameElementCommand(command)); - } - return nameElementCommands; - } - - /** - * Populate and return list of name element commands given list of name element commands for update. - * - * @param commands name element commands for create - * @return list of name element commands - */ - public static List<NameElementCommand> getNameElementCommandsForUpdate(List<NameElementCommandUpdate> commands) { - List<NameElementCommand> nameElementCommands = Lists.newArrayList(); - for (NameElementCommandUpdate command : commands) { - nameElementCommands.add(NameElementUtil.getNameElementCommand(command)); - } - return nameElementCommands; - } - - /** - * Populate and return list of name element commands given list of name element commands for confirm. - * - * @param commands name element commands for create - * @return list of name element commands - */ - public static List<NameElementCommand> getNameElementCommandsForConfirm(List<NameElementCommandConfirm> commands) { - List<NameElementCommand> nameElementCommands = Lists.newArrayList(); - for (NameElementCommandConfirm command : commands) { - nameElementCommands.add(NameElementUtil.getNameElementCommand(command)); - } - return nameElementCommands; - } - - - /** - * Return name element command given name element command for create. - * - * @param nameElementCommand name element command - * @return name element command - */ - public static NameElementCommand getNameElementCommand(NameElementCommandCreate nameElementCommand) { - return new NameElementCommand( - null, - nameElementCommand.getParentSystemStructure(), - nameElementCommand.getParentDeviceStructure(), - nameElementCommand.getIndex(), - nameElementCommand.getDescription(), - nameElementCommand.getComment()); - } - - /** - * Return name element command given name element command for update. - * - * @param nameElementCommand name element command - * @return name element command - */ - public static NameElementCommand getNameElementCommand(NameElementCommandUpdate nameElementCommand) { - return new NameElementCommand( - nameElementCommand.getUuid(), - nameElementCommand.getParentSystemStructure(), - nameElementCommand.getParentDeviceStructure(), - nameElementCommand.getIndex(), - nameElementCommand.getDescription(), - nameElementCommand.getComment()); - } - - /** - * Return name element command given name element command for confirm. - * - * @param nameElementCommand name element command - * @return name element command - */ - public static NameElementCommand getNameElementCommand(NameElementCommandConfirm nameElementCommand) { - return new NameElementCommand( - nameElementCommand.getUuid(), - null, - null, - null, - null, - nameElementCommand.getComment()); - } - /** * Check if name element and name have same content. * @@ -299,4 +208,270 @@ public class NameElementUtil { return true; } + // ---------------------------------------------------------------------------------------------------- + + /** + * Convert name element command for create to name element command. + * + * @param command name element command for create + * @return name element command + */ + public static NameElementCommand convertCommandCreate2Command(NameElementCommandCreate command) { + return new NameElementCommand( + null, + command.getParentSystemStructure(), + command.getParentDeviceStructure(), + command.getIndex(), + command.getDescription(), + command.getComment()); + } + + /** + * Convert list of name element commands for create to list of name element commands. + * + * @param commands list of name element commands for create + * @return list of name element commands + */ + public static List<NameElementCommand> convertCommandCreate2Command(List<NameElementCommandCreate> commands) { + List<NameElementCommand> nameElementCommands = Lists.newArrayList(); + for (NameElementCommandCreate command : commands) { + nameElementCommands.add(NameElementUtil.convertCommandCreate2Command(command)); + } + return nameElementCommands; + } + + /** + * Convert name element command for update to name element command. + * + * @param command name element command for update + * @return name element command + */ + public static NameElementCommand convertCommandUpdate2Command(NameElementCommandUpdate command) { + return new NameElementCommand( + command.getUuid(), + command.getParentSystemStructure(), + command.getParentDeviceStructure(), + command.getIndex(), + command.getDescription(), + command.getComment()); + } + + /** + * Convert list of name element commands for update to list of name element commands. + * + * @param commands list of name element commands for update + * @return list of name element commands + */ + public static List<NameElementCommand> convertCommandUpdate2Command(List<NameElementCommandUpdate> commands) { + List<NameElementCommand> nameElementCommands = Lists.newArrayList(); + for (NameElementCommandUpdate command : commands) { + nameElementCommands.add(NameElementUtil.convertCommandUpdate2Command(command)); + } + return nameElementCommands; + } + + /** + * Convert name element command for confirm to name element command. + * + * @param command name element command for confirm + * @return name element command + */ + public static NameElementCommand convertCommandConfirm2Command(NameElementCommandConfirm command) { + return new NameElementCommand( + command.getUuid(), + null, + null, + null, + null, + command.getComment()); + } + + /** + * Convert list of name element commands for confirm to list of name element commands. + * + * @param commands list of name element commands for confirm + * @return list of name element commands + */ + public static List<NameElementCommand> convertCommandConfirm2Command(List<NameElementCommandConfirm> commands) { + List<NameElementCommand> nameElementCommands = Lists.newArrayList(); + for (NameElementCommandConfirm command : commands) { + nameElementCommands.add(NameElementUtil.convertCommandConfirm2Command(command)); + } + return nameElementCommands; + } + + // ---------------------------------------------------------------------------------------------------- + + /** + * Convert name element command to name element command for create. + * + * @param command name element command + * @return name element command for create + */ + public static NameElementCommandCreate convertCommand2CommandCreate(NameElementCommand command) { + return new NameElementCommandCreate( + command.getParentSystemStructure(), + command.getParentDeviceStructure(), + command.getIndex(), + command.getDescription(), + command.getComment()); + } + + /** + * Convert array of name element commands to array of name element commands for create. + * + * @param commands array of name element commands + * @return array of name element commands for create + */ + public static NameElementCommandCreate[] convertCommand2CommandCreate(NameElementCommand[] commands) { + NameElementCommandCreate[] nameElementCommands = new NameElementCommandCreate[commands.length]; + for (int i=0; i<commands.length; i++) { + nameElementCommands[i] = NameElementUtil.convertCommand2CommandCreate(commands[i]); + } + return nameElementCommands; + } + + /** + * Convert name element command to name element command for update. + * + * @param command name element command + * @return name element command for update + */ + public static NameElementCommandUpdate convertCommand2CommandUpdate(NameElementCommand command) { + return new NameElementCommandUpdate( + command.getUuid(), + command.getParentSystemStructure(), + command.getParentDeviceStructure(), + command.getIndex(), + command.getDescription(), + command.getComment()); + } + + /** + * Convert array of name element commands to array of name element commands for update. + * + * @param commands array of name element commands + * @return array of name element commands for update + */ + public static NameElementCommandUpdate[] convertCommand2CommandUpdate(NameElementCommand[] commands) { + NameElementCommandUpdate[] nameElementCommands = new NameElementCommandUpdate[commands.length]; + for (int i=0; i<commands.length; i++) { + nameElementCommands[i] = NameElementUtil.convertCommand2CommandUpdate(commands[i]); + } + return nameElementCommands; + } + + /** + * Convert name element command to name element command for confirm. + * + * @param command name element command + * @return name element command for confirm + */ + public static NameElementCommandConfirm convertCommand2CommandConfirm(NameElementCommand command) { + return new NameElementCommandConfirm( + command.getUuid(), + command.getComment()); + } + + /** + * Convert array of name element commands to array of name element commands for confirm. + * + * @param commands array of name element commands + * @return array of name element commands for confirm + */ + public static NameElementCommandConfirm[] convertCommand2CommandConfirm(NameElementCommand[] commands) { + NameElementCommandConfirm[] nameElementCommands = new NameElementCommandConfirm[commands.length]; + for (int i=0; i<commands.length; i++) { + nameElementCommands[i] = NameElementUtil.convertCommand2CommandConfirm(commands[i]); + } + return nameElementCommands; + } + + // ---------------------------------------------------------------------------------------------------- + + /** + * Convert name element to name element command for create. + * + * @param element name element + * @return name element command for create + */ + public static NameElementCommandCreate convertElement2CommandCreate(NameElement element) { + return new NameElementCommandCreate( + element.getParentSystemStructure(), + element.getParentDeviceStructure(), + element.getIndex(), + element.getDescription(), + element.getComment()); + } + + /** + * Convert array of name elements to array of name element commands for create. + * + * @param elements array of name elements + * @return array of name element commands for create + */ + public static NameElementCommandCreate[] convertElement2CommandCreate(NameElement[] elements) { + NameElementCommandCreate[] nameElementCommands = new NameElementCommandCreate[elements.length]; + for (int i=0; i<elements.length; i++) { + nameElementCommands[i] = convertElement2CommandCreate(elements[i]); + } + return nameElementCommands; + } + + /** + * Convert name element to name element command for update. + * + * @param element name element + * @return name element command for update + */ + public static NameElementCommandUpdate convertElement2CommandUpdate(NameElement element) { + return new NameElementCommandUpdate( + element.getUuid(), + element.getParentSystemStructure(), + element.getParentDeviceStructure(), + element.getIndex(), + element.getDescription(), + element.getComment()); + } + + /** + * Convert array of name elements to array of name element commands for update. + * + * @param elements array of name elements + * @return array of name element commands for update + */ + public static NameElementCommandUpdate[] convertElement2CommandUpdate(NameElement[] elements) { + NameElementCommandUpdate[] nameElementCommands = new NameElementCommandUpdate[elements.length]; + for (int i=0; i<elements.length; i++) { + nameElementCommands[i] = convertElement2CommandUpdate(elements[i]); + } + return nameElementCommands; + } + + /** + * Convert name element to name element command for confirm. + * + * @param element name element + * @return name element command for confirm + */ + public static NameElementCommandConfirm convertElement2CommandConfirm(NameElement element) { + return new NameElementCommandConfirm( + element.getUuid(), + element.getComment()); + } + + /** + * Convert array of name elements to array of name element commands for confirm. + * + * @param elements array of name elements + * @return array of name element commands for confirm + */ + public static NameElementCommandConfirm[] convertElement2CommandConfirm(NameElement[] elements) { + NameElementCommandConfirm[] nameElementCommands = new NameElementCommandConfirm[elements.length]; + for (int i=0; i<elements.length; i++) { + nameElementCommands[i] = convertElement2CommandConfirm(elements[i]); + } + return nameElementCommands; + } + } diff --git a/src/main/java/org/openepics/names/util/StructureElementUtil.java b/src/main/java/org/openepics/names/util/StructureElementUtil.java index 4dfc7d8b33dc80c895599a9d339572d3d5df25b1..309ba5d3fc4c0f7151af8415fe4f593d1570a7b9 100644 --- a/src/main/java/org/openepics/names/util/StructureElementUtil.java +++ b/src/main/java/org/openepics/names/util/StructureElementUtil.java @@ -33,6 +33,10 @@ import org.openepics.names.repository.model.SystemGroup; import org.openepics.names.rest.beans.Status; import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.StructureElement; +import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandConfirm; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; +import org.openepics.names.rest.beans.element.StructureElementCommandUpdate; import com.google.common.collect.Lists; @@ -301,8 +305,8 @@ public class StructureElementUtil { String mnemonicPath = null; return getStructureElement( - Type.SYSTEMGROUP, systemGroup.getUuid(), + Type.SYSTEMGROUP, null, systemGroup.getName(), systemGroup.getMnemonic(), mnemonicPath, 1, systemGroup.getDescription(), Status.PENDING, Boolean.FALSE, systemGroup.isDeleted(), @@ -330,8 +334,8 @@ public class StructureElementUtil { : StructureUtil.getMnemonicPath(systemGroup, holderSystemDeviceStructure); return getStructureElement( - Type.SYSTEMGROUP, systemGroup.getUuid(), + Type.SYSTEMGROUP, null, systemGroup.getName(), systemGroup.getMnemonic(), mnemonicPath, 1, systemGroup.getDescription(), systemGroup.getStatus(), systemGroup.isLatest(), systemGroup.isDeleted(), @@ -355,8 +359,8 @@ public class StructureElementUtil { String mnemonicPath = null; return getStructureElement( - Type.SYSTEM, system.getUuid(), + Type.SYSTEM, system.getParentUuid(), system.getName(), system.getMnemonic(), mnemonicPath, 2, system.getDescription(), Status.PENDING, Boolean.FALSE, system.isDeleted(), @@ -384,8 +388,8 @@ public class StructureElementUtil { : StructureUtil.getMnemonicPath(system, holderSystemDeviceStructure); return getStructureElement( - Type.SYSTEM, system.getUuid(), + Type.SYSTEM, system.getParentUuid(), system.getName(), system.getMnemonic(), mnemonicPath, 2, system.getDescription(), system.getStatus(), system.isLatest(), system.isDeleted(), @@ -409,8 +413,8 @@ public class StructureElementUtil { String mnemonicPath = null; return getStructureElement( - Type.SUBSYSTEM, subsystem.getUuid(), + Type.SUBSYSTEM, subsystem.getParentUuid(), subsystem.getName(), subsystem.getMnemonic(), mnemonicPath, 3, subsystem.getDescription(), Status.PENDING, Boolean.FALSE, subsystem.isDeleted(), @@ -438,8 +442,8 @@ public class StructureElementUtil { : StructureUtil.getMnemonicPath(subsystem, holderSystemDeviceStructure); return getStructureElement( - Type.SUBSYSTEM, subsystem.getUuid(), + Type.SUBSYSTEM, subsystem.getParentUuid(), subsystem.getName(), subsystem.getMnemonic(), mnemonicPath, 3, subsystem.getDescription(), subsystem.getStatus(), subsystem.isLatest(), subsystem.isDeleted(), @@ -464,8 +468,8 @@ public class StructureElementUtil { String mnemonicPath = null; return getStructureElement( - Type.DISCIPLINE, discipline.getUuid(), + Type.DISCIPLINE, null, discipline.getName(), discipline.getMnemonic(), mnemonicPath, 1, discipline.getDescription(), Status.PENDING, Boolean.FALSE, discipline.isDeleted(), @@ -493,8 +497,8 @@ public class StructureElementUtil { : StructureUtil.getMnemonicPath(discipline, holderSystemDeviceStructure); return getStructureElement( - Type.DISCIPLINE, discipline.getUuid(), + Type.DISCIPLINE, null, discipline.getName(), discipline.getMnemonic(), mnemonicPath, 1, discipline.getDescription(), discipline.getStatus(), discipline.isLatest(), discipline.isDeleted(), @@ -518,8 +522,8 @@ public class StructureElementUtil { String mnemonicPath = null; return getStructureElement( - Type.DEVICEGROUP, deviceGroup.getUuid(), + Type.DEVICEGROUP, deviceGroup.getParentUuid(), deviceGroup.getName(), deviceGroup.getMnemonic(), mnemonicPath, 2, deviceGroup.getDescription(), Status.PENDING, Boolean.FALSE, deviceGroup.isDeleted(), @@ -547,8 +551,8 @@ public class StructureElementUtil { : StructureUtil.getMnemonicPath(deviceGroup, holderSystemDeviceStructure); return getStructureElement( - Type.DEVICEGROUP, deviceGroup.getUuid(), + Type.DEVICEGROUP, deviceGroup.getParentUuid(), deviceGroup.getName(), deviceGroup.getMnemonic(), mnemonicPath, 2, deviceGroup.getDescription(), deviceGroup.getStatus(), deviceGroup.isLatest(), deviceGroup.isDeleted(), @@ -572,8 +576,8 @@ public class StructureElementUtil { String mnemonicPath = null; return getStructureElement( - Type.DEVICETYPE, deviceType.getUuid(), + Type.DEVICETYPE, deviceType.getParentUuid(), deviceType.getName(), deviceType.getMnemonic(), mnemonicPath, 3, deviceType.getDescription(), Status.PENDING, Boolean.FALSE, deviceType.isDeleted(), @@ -601,8 +605,8 @@ public class StructureElementUtil { : StructureUtil.getMnemonicPath(deviceType, holderSystemDeviceStructure); return getStructureElement( - Type.DEVICETYPE, deviceType.getUuid(), + Type.DEVICETYPE, deviceType.getParentUuid(), deviceType.getName(), deviceType.getMnemonic(), mnemonicPath, 3, deviceType.getDescription(), deviceType.getStatus(), deviceType.isLatest(), deviceType.isDeleted(), @@ -612,8 +616,8 @@ public class StructureElementUtil { /** * Populate and return structure element. * - * @param type type * @param uuid uuid + * @param type type * @param parent parent uuid * @param name name * @param mnemonic mnemonic @@ -629,8 +633,8 @@ public class StructureElementUtil { * @return structure element */ protected static StructureElement getStructureElement( - Type type, UUID uuid, + Type type, UUID parent, String name, String mnemonic, String mnemonicPath, Integer level, String description, Status status, Boolean latest, Boolean deleted, @@ -644,7 +648,6 @@ public class StructureElementUtil { when, who); } - private static boolean hasSameContent(StructureElement structureElement, NameStructure nameStructure) { // StructureElement // x uuid @@ -833,4 +836,282 @@ public class StructureElementUtil { return true; } + // ---------------------------------------------------------------------------------------------------- + + /** + * Convert structure element command for create to structure element command. + * + * @param command structure element command for create + * @return structure element command + */ + public static StructureElementCommand convertCommandCreate2Command(StructureElementCommandCreate command) { + return new StructureElementCommand( + null, + command.getType(), + command.getParent(), + command.getName(), + command.getMnemonic(), + command.getDescription(), + command.getComment()); + } + + /** + * Convert list of structure element commands for create to list of structure element commands. + * + * @param commands list of structure element commands for create + * @return list of structure element commands + */ + public static List<StructureElementCommand> convertCommandCreate2Command(List<StructureElementCommandCreate> commands) { + List<StructureElementCommand> structureElementCommands = Lists.newArrayList(); + for (StructureElementCommandCreate command : commands) { + structureElementCommands.add(StructureElementUtil.convertCommandCreate2Command(command)); + } + return structureElementCommands; + } + + /** + * Convert structure element command for update to structure element command. + * + * @param command structure element command for update + * @return structure element command + */ + public static StructureElementCommand convertCommandUpdate2Command(StructureElementCommandUpdate command) { + return new StructureElementCommand( + command.getUuid(), + command.getType(), + command.getParent(), + command.getName(), + command.getMnemonic(), + command.getDescription(), + command.getComment()); + } + + /** + * Convert list of structure element commands for update to list of structure element commands. + * + * @param commands list of structure element commands for update + * @return list of structure element commands + */ + public static List<StructureElementCommand> convertCommandUpdate2Command(List<StructureElementCommandUpdate> commands) { + List<StructureElementCommand> structureElementCommands = Lists.newArrayList(); + for (StructureElementCommandUpdate command : commands) { + structureElementCommands.add(StructureElementUtil.convertCommandUpdate2Command(command)); + } + return structureElementCommands; + } + + /** + * Convert structure element command for confirm to structure element command. + * + * @param command structure element command for confirm + * @return structure element command + */ + public static StructureElementCommand convertCommandConfirm2Command(StructureElementCommandConfirm command) { + return new StructureElementCommand( + command.getUuid(), + command.getType(), + null, + null, + null, + null, + command.getComment()); + } + + /** + * Convert list of structure element commands for confirm to list of structure element commands. + * + * @param commands list of structure element commands for confirm + * @return list of structure element commands + */ + public static List<StructureElementCommand> convertCommandConfirm2Command(List<StructureElementCommandConfirm> commands) { + List<StructureElementCommand> structureElementCommands = Lists.newArrayList(); + for (StructureElementCommandConfirm command : commands) { + structureElementCommands.add(StructureElementUtil.convertCommandConfirm2Command(command)); + } + return structureElementCommands; + } + + // ---------------------------------------------------------------------------------------------------- + + /** + * Convert structure element command to structure element command for create. + * + * @param command structure element command + * @return structure element command for create + */ + public static StructureElementCommandCreate convertCommand2CommandCreate(StructureElementCommand command) { + return new StructureElementCommandCreate( + command.getType(), + command.getParent(), + command.getName(), + command.getMnemonic(), + command.getDescription(), + command.getComment()); + } + + /** + * Convert array of structure element commands to array of structure element commands for create. + * + * @param commands array of structure element commands + * @return array of structure element commands for create + */ + public static StructureElementCommandCreate[] convertCommand2CommandCreate(StructureElementCommand[] commands) { + StructureElementCommandCreate[] structureElementCommands = new StructureElementCommandCreate[commands.length]; + for (int i=0; i<commands.length; i++) { + structureElementCommands[i] = StructureElementUtil.convertCommand2CommandCreate(commands[i]); + + } + return structureElementCommands; + } + + /** + * Convert structure element command to structure element command for update. + * + * @param command structure element command + * @return structure element command for update + */ + public static StructureElementCommandUpdate convertCommand2CommandUpdate(StructureElementCommand command) { + return new StructureElementCommandUpdate( + command.getUuid(), + command.getType(), + command.getParent(), + command.getName(), + command.getMnemonic(), + command.getDescription(), + command.getComment()); + } + + /** + * Convert array of structure element commands to array of structure element commands for update. + * + * @param commands array of structure element commands + * @return array of structure element commands for update + */ + public static StructureElementCommandUpdate[] convertCommand2CommandUpdate(StructureElementCommand[] commands) { + StructureElementCommandUpdate[] structureElementCommands = new StructureElementCommandUpdate[commands.length]; + for (int i=0; i<commands.length; i++) { + structureElementCommands[i] = StructureElementUtil.convertCommand2CommandUpdate(commands[i]); + + } + return structureElementCommands; + } + + /** + * Convert structure element command to structure element command for confirm. + * + * @param command structure element command + * @return structure element command for confirm + */ + public static StructureElementCommandConfirm convertCommand2CommandConfirm(StructureElementCommand command) { + return new StructureElementCommandConfirm( + command.getUuid(), + command.getType(), + command.getComment()); + } + + /** + * Convert array of structure element commands to array of structure element commands for confirm. + * + * @param commands array of structure element commands + * @return array of structure element commands for confirm + */ + public static StructureElementCommandConfirm[] convertCommand2CommandConfirm(StructureElementCommand[] commands) { + StructureElementCommandConfirm[] structureElementCommands = new StructureElementCommandConfirm[commands.length]; + for (int i=0; i<commands.length; i++) { + structureElementCommands[i] = StructureElementUtil.convertCommand2CommandConfirm(commands[i]); + } + return structureElementCommands; + } + + // ---------------------------------------------------------------------------------------------------- + + /** + * Convert structure element to structure element command for create. + * + * @param element structure element + * @return structure element command for create + */ + public static StructureElementCommandCreate convertElement2CommandCreate(StructureElement element) { + return new StructureElementCommandCreate( + element.getType(), + element.getParent(), + element.getName(), + element.getMnemonic(), + element.getDescription(), + element.getComment()); + } + + /** + * Convert array of structure elements to array of structure element commands for create. + * + * @param elements array of structure elements + * @return array of structure element commands for create + */ + public static StructureElementCommandCreate[] convertElement2CommandCreate(StructureElement[] elements) { + StructureElementCommandCreate[] structureElementCommands = new StructureElementCommandCreate[elements.length]; + for (int i=0; i<elements.length; i++) { + structureElementCommands[i] = convertElement2CommandCreate(elements[i]); + } + return structureElementCommands; + } + + /** + * Convert structure element to structure element command for update. + * + * @param element structure element + * @return structure element command for update + */ + public static StructureElementCommandUpdate convertElement2CommandUpdate(StructureElement element) { + return new StructureElementCommandUpdate( + element.getUuid(), + element.getType(), + element.getParent(), + element.getName(), + element.getMnemonic(), + element.getDescription(), + element.getComment()); + } + + /** + * Convert array of structure elements to array of structure element commands for update. + * + * @param elements array of structure elements + * @return array of structure element commands for update + */ + public static StructureElementCommandUpdate[] convertElement2CommandUpdate(StructureElement[] elements) { + StructureElementCommandUpdate[] structureElementCommands = new StructureElementCommandUpdate[elements.length]; + for (int i=0; i<elements.length; i++) { + structureElementCommands[i] = convertElement2CommandUpdate(elements[i]); + } + return structureElementCommands; + } + + /** + * Convert structure element to structure element command for confirm. + * + * @param element structure element + * @return structure element command for confirm + */ + public static StructureElementCommandConfirm convertElement2CommandConfirm(StructureElement element) { + return new StructureElementCommandConfirm( + element.getUuid(), + element.getType(), + element.getComment()); + } + + /** + * Convert array of structure elements to array of structure element commands for confirm. + * + * @param elements array of structure elements + * @return array of structure element commands for confirm + */ + public static StructureElementCommandConfirm[] convertElement2CommandConfirm(StructureElement[] elements) { + StructureElementCommandConfirm[] structureElementCommands = new StructureElementCommandConfirm[elements.length]; + for (int i=0; i<elements.length; i++) { + structureElementCommands[i] = convertElement2CommandConfirm(elements[i]); + } + return structureElementCommands; + } + + } diff --git a/src/main/java/org/openepics/names/util/ValidateNameElementUtil.java b/src/main/java/org/openepics/names/util/ValidateNameElementUtil.java index ea6a219818b0c0c82b75457b35f96fd147537b3a..a6c219e35ea8edcb6b95d3e42097523b7626da0f 100644 --- a/src/main/java/org/openepics/names/util/ValidateNameElementUtil.java +++ b/src/main/java/org/openepics/names/util/ValidateNameElementUtil.java @@ -129,6 +129,11 @@ public class ValidateNameElementUtil { // delete - uuid, comment // // create, update - optional - parentDeviceStructure, index + // + // logic + // update, delete + // create, update + // create, update, delete if (ValidateUtil.isAnyNull(nameElementCommand, nameCommand)) { return; @@ -141,14 +146,11 @@ public class ValidateNameElementUtil { String description = nameElementCommand.getDescription(); String comment = nameElementCommand.getComment(); - if (NameCommand.CREATE.equals(nameCommand)) { - ExceptionUtil.validateConditionInputNotEmptyException(uuid == null, - TextUtil.VALUE_IS_NOT_EMPTY, uuid != null ? uuid.toString() : null, TextUtil.UUID); - } else { + if (ValidateUtil.isAnyEqual(nameCommand, NameCommand.UPDATE, NameCommand.DELETE)) { ValidateUtil.validateInputUuid(uuid != null ? uuid.toString() : null); } - if (!NameCommand.DELETE.equals(nameCommand)) { + if (ValidateUtil.isAnyEqual(nameCommand, NameCommand.CREATE, NameCommand.UPDATE)) { ExceptionUtil.validateConditionInputNotAvailableException(parentSystemStructure != null, TextUtil.VALUE_IS_NOT_AVAILABLE, nameElementCommand.toString(), TextUtil.PARENTSYSTEMSTRUCTURE); @@ -165,6 +167,31 @@ public class ValidateNameElementUtil { } ValidateUtil.validateInputComment(comment); + +// if (NameCommand.CREATE.equals(nameCommand)) { +// ExceptionUtil.validateConditionInputNotEmptyException(uuid == null, +// TextUtil.VALUE_IS_NOT_EMPTY, uuid != null ? uuid.toString() : null, TextUtil.UUID); +// } else { +// ValidateUtil.validateInputUuid(uuid != null ? uuid.toString() : null); +// } +// +// if (!NameCommand.DELETE.equals(nameCommand)) { +// ExceptionUtil.validateConditionInputNotAvailableException(parentSystemStructure != null, +// TextUtil.VALUE_IS_NOT_AVAILABLE, nameElementCommand.toString(), TextUtil.PARENTSYSTEMSTRUCTURE); +// +// // optional (either none or both) +// // parentDeviceStructure +// // index +// if (parentDeviceStructure != null && index == null) { +// throw ExceptionUtil.createInputNotCorrectException(null, nameElementCommand.toString(), TextUtil.INDEX); +// } else if (parentDeviceStructure == null && index != null) { +// throw ExceptionUtil.createInputNotCorrectException(null, nameElementCommand.toString(), TextUtil.PARENTDEVICESTRUCTURE); +// } +// +// ValidateUtil.validateInputDescription(description); +// } +// +// ValidateUtil.validateInputComment(comment); } // ---------------------------------------------------------------------------------------------------- diff --git a/src/main/java/org/openepics/names/util/ValidateStructureElementUtil.java b/src/main/java/org/openepics/names/util/ValidateStructureElementUtil.java index f965fa719739fb8b2c4ec5f684ac4bdba3de5398..d1db929137717cc21969bc25c23d515162d6a958 100644 --- a/src/main/java/org/openepics/names/util/ValidateStructureElementUtil.java +++ b/src/main/java/org/openepics/names/util/ValidateStructureElementUtil.java @@ -19,10 +19,15 @@ package org.openepics.names.util; import java.util.List; import java.util.UUID; +import java.util.logging.Level; +import java.util.logging.Logger; import org.apache.commons.lang3.StringUtils; import org.openepics.names.exception.DataConflictException; +import org.openepics.names.repository.model.DeviceGroup; +import org.openepics.names.repository.model.DeviceType; import org.openepics.names.repository.model.Discipline; +import org.openepics.names.repository.model.Subsystem; import org.openepics.names.repository.model.System; import org.openepics.names.repository.model.SystemGroup; import org.openepics.names.rest.beans.FieldStructure; @@ -50,9 +55,14 @@ public class ValidateStructureElementUtil { // description, status, latest, deleted, when, who, comment // // StructureElementCommand - // create - type, parent, name, mnemonic, description, comment - // update - uuid, type, parent, name, mnemonic, description, comment - // delete - uuid, type comment + // create - type, parent, name, mnemonic, description, comment + // update - uuid, type, parent, name, mnemonic, description, comment + // delete - uuid, type, comment + // approve - uuid, type, comment + // cancel - uuid, type, comment + // reject - uuid, type, comment + + private static final Logger LOGGER = Logger.getLogger(ValidateStructureElementUtil.class.getName()); /** * This class is not to be instantiated. @@ -95,101 +105,103 @@ public class ValidateStructureElementUtil { } /** - * Validate structure element parameters (input) for create. + * Validate structure element command parameters (input) for create. * - * @param structureElement structure element + * @param structureElementCommand structure element command */ - public static void validateStructureElementInputCreate(StructureElementCommand structureElement, EssNamingConvention namingConvention) { - validateStructureElementInput(structureElement, namingConvention, StructureCommand.CREATE); + public static void validateStructureElementInputCreate(StructureElementCommand structureElementCommand, EssNamingConvention namingConvention) { + validateStructureElementInput(structureElementCommand, namingConvention, StructureCommand.CREATE); } /** - * Validate structure element parameters (input) for update. + * Validate structure element command parameters (input) for update. * - * @param structureElement structure element + * @param structureElementCommand structure element command */ - public static void validateStructureElementInputUpdate(StructureElementCommand structureElement, EssNamingConvention namingConvention) { - validateStructureElementInput(structureElement, namingConvention, StructureCommand.UPDATE); + public static void validateStructureElementInputUpdate(StructureElementCommand structureElementCommand, EssNamingConvention namingConvention) { + validateStructureElementInput(structureElementCommand, namingConvention, StructureCommand.UPDATE); } /** - * Validate structure element parameters (input) for delete. + * Validate structure element command parameters (input) for delete. * - * @param structureElement structure element + * @param structureElementCommand structure element command */ - public static void validateStructureElementInputDelete(StructureElementCommand structureElement, EssNamingConvention namingConvention) { - validateStructureElementInput(structureElement, namingConvention, StructureCommand.DELETE); + public static void validateStructureElementInputDelete(StructureElementCommand structureElementCommand, EssNamingConvention namingConvention) { + validateStructureElementInput(structureElementCommand, namingConvention, StructureCommand.DELETE); } /** - * Validate structure element parameters (input) for approve. + * Validate structure element command parameters (input) for approve. * - * @param structureElement structure element + * @param structureElementCommand structure element command */ - public static void validateStructureElementInputApprove(StructureElementCommand structureElement, EssNamingConvention namingConvention) { - validateStructureElementInput(structureElement, namingConvention, StructureCommand.APPROVE); + public static void validateStructureElementInputApprove(StructureElementCommand structureElementCommand, EssNamingConvention namingConvention) { + validateStructureElementInput(structureElementCommand, namingConvention, StructureCommand.APPROVE); } /** - * Validate structure element parameters (input) for cancel. + * Validate structure element command parameters (input) for cancel. * - * @param structureElement structure element + * @param structureElementCommand structure element command */ - public static void validateStructureElementInputCancel(StructureElementCommand structureElement, EssNamingConvention namingConvention) { - validateStructureElementInput(structureElement, namingConvention, StructureCommand.CANCEL); + public static void validateStructureElementInputCancel(StructureElementCommand structureElementCommand, EssNamingConvention namingConvention) { + validateStructureElementInput(structureElementCommand, namingConvention, StructureCommand.CANCEL); } /** - * Validate structure element parameters (input) for reject. + * Validate structure element command parameters (input) for reject. * - * @param structureElement structure element + * @param structureElementCommand structure element command */ - public static void validateStructureElementInputReject(StructureElementCommand structureElement, EssNamingConvention namingConvention) { - validateStructureElementInput(structureElement, namingConvention, StructureCommand.REJECT); + public static void validateStructureElementInputReject(StructureElementCommand structureElementCommand, EssNamingConvention namingConvention) { + validateStructureElementInput(structureElementCommand, namingConvention, StructureCommand.REJECT); } /** - * Validate structure element parameters (input). + * Validate structure element command parameters (input). * - * @param structureElement structure element + * @param structureElementCommand structure element command * @param structureCommand structure command */ - private static void validateStructureElementInput(StructureElementCommand structureElement, EssNamingConvention namingConvention, StructureCommand structureCommand) { - // check structure element input - // uuid - required if not create, required empty if create - // type - required - // parent - also validate data, parent uuid available if type is system, subsystem, device group, device type - // name - required - // mnemonic - required except for device group - // description - required - // comment - required - - if (ValidateUtil.isAnyNull(structureElement, structureCommand)) { + private static void validateStructureElementInput(StructureElementCommand structureElementCommand, EssNamingConvention namingConvention, StructureCommand structureCommand) { + // command - attributes + // create - type, parent, name, mnemonic, description, comment + // update - uuid, type, parent, name, mnemonic, description, comment + // delete - uuid, type, comment + // approve - uuid, type, comment + // cancel - uuid, type, comment + // reject - uuid, type, comment + // + // create, update - optional - parent, mnemonic + // + // logic + // update, delete, approve, cancel, reject + // create, update + // create, update, delete, approve, cancel, reject + + if (ValidateUtil.isAnyNull(structureElementCommand, namingConvention, structureCommand)) { return; } - Type type = structureElement.getType(); - UUID uuid = structureElement.getUuid(); - UUID parent = structureElement.getParent(); + UUID uuid = structureElementCommand.getUuid(); + Type type = structureElementCommand.getType(); + UUID parent = structureElementCommand.getParent(); + String name = structureElementCommand.getName(); + String mnemonic = structureElementCommand.getMnemonic(); + String description = structureElementCommand.getDescription(); + String comment = structureElementCommand.getComment(); - String name = structureElement.getName(); - String mnemonic = structureElement.getMnemonic(); - String description = structureElement.getDescription(); - String comment = structureElement.getComment(); - - if (StructureCommand.CREATE.equals(structureCommand)) { - ExceptionUtil.validateConditionInputNotEmptyException(uuid == null, - TextUtil.VALUE_IS_NOT_EMPTY, uuid != null ? uuid.toString() : null, TextUtil.UUID); - } else { + if (ValidateUtil.isAnyEqual(structureCommand, StructureCommand.UPDATE, StructureCommand.DELETE, StructureCommand.APPROVE, StructureCommand.CANCEL, StructureCommand.REJECT)) { ValidateUtil.validateInputUuid(uuid != null ? uuid.toString() : null); } ValidateUtil.validateInputType(type); - if (!StructureCommand.DELETE.equals(structureCommand)) { + if (ValidateUtil.isAnyEqual(structureCommand, StructureCommand.CREATE, StructureCommand.UPDATE)) { if (ValidateUtil.isAnyEqual(type, Type.SYSTEM, Type.SUBSYSTEM, Type.DEVICEGROUP, Type.DEVICETYPE)) { ExceptionUtil.validateConditionInputNotAvailableException(parent != null, - TextUtil.PARENT_IS_NOT_AVAILABLE, structureElement.toString(), TextUtil.PARENT); + TextUtil.PARENT_IS_NOT_AVAILABLE, structureElementCommand.toString(), TextUtil.PARENT); ValidateUtil.validateInputUuid(parent.toString()); } @@ -200,104 +212,144 @@ public class ValidateStructureElementUtil { // validateMnemonic takes isMnemonicRequired into account MnemonicValidation mnemonicValidation = namingConvention.validateMnemonic(type, mnemonic); ExceptionUtil.validateConditionInputNotValidException(MnemonicValidation.VALID.equals(mnemonicValidation), - TextUtil.MNEMONIC_IS_NOT_VALID, structureElement.toString(), TextUtil.MNEMONIC); + TextUtil.MNEMONIC_IS_NOT_VALID, structureElementCommand.toString(), TextUtil.MNEMONIC); ValidateUtil.validateInputDescription(description); } ValidateUtil.validateInputComment(comment); + +// if (StructureCommand.CREATE.equals(structureCommand)) { +// ExceptionUtil.validateConditionInputNotEmptyException(uuid == null, +// TextUtil.VALUE_IS_NOT_EMPTY, uuid != null ? uuid.toString() : null, TextUtil.UUID); +// } else { +// ValidateUtil.validateInputUuid(uuid != null ? uuid.toString() : null); +// } +// +// ValidateUtil.validateInputType(type); +// +// if (!StructureCommand.DELETE.equals(structureCommand)) { +// if (ValidateUtil.isAnyEqual(type, Type.SYSTEM, Type.SUBSYSTEM, Type.DEVICEGROUP, Type.DEVICETYPE)) { +// ExceptionUtil.validateConditionInputNotAvailableException(parent != null, +// TextUtil.PARENT_IS_NOT_AVAILABLE, structureElementCommand.toString(), TextUtil.PARENT); +// ValidateUtil.validateInputUuid(parent.toString()); +// } +// +// ValidateUtil.validateInputName(name); +// +// // validate mnemonic +// // validate mnemonic input (value itself, not in relation to other values) +// // validateMnemonic takes isMnemonicRequired into account +// MnemonicValidation mnemonicValidation = namingConvention.validateMnemonic(type, mnemonic); +// ExceptionUtil.validateConditionInputNotValidException(MnemonicValidation.VALID.equals(mnemonicValidation), +// TextUtil.MNEMONIC_IS_NOT_VALID, structureElementCommand.toString(), TextUtil.MNEMONIC); +// +// ValidateUtil.validateInputDescription(description); +// } +// +// ValidateUtil.validateInputComment(comment); } // ---------------------------------------------------------------------------------------------------- /** - * Validate structure element data for create. + * Validate structure element command data for create. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @param namingConvention naming convention * @param holderRepositories holder repositories * @param holder holder */ - public static void validateStructureElementDataCreate(StructureElementCommand structureElement, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder) { - validateStructureElementDataInItself(structureElement, namingConvention, holderRepositories, holder, StructureCommand.CREATE); - validateStructureElementDataRelativeOtherData(structureElement, namingConvention, holderRepositories, holder, StructureCommand.CREATE); + public static void validateStructureElementDataCreate(StructureElementCommand structureElementCommand, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder) { + validateStructureElementDataInItself(structureElementCommand, namingConvention, holderRepositories, holder, StructureCommand.CREATE); + validateStructureElementDataRelativeOtherData(structureElementCommand, namingConvention, holderRepositories, holder, StructureCommand.CREATE); } /** - * Validate structure element data for update. + * Validate structure element command data for update. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @param namingConvention naming convention * @param holderRepositories holder repositories * @param holder holder */ - public static void validateStructureElementDataUpdate(StructureElementCommand structureElement, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder) { - validateStructureElementDataInItself(structureElement, namingConvention, holderRepositories, holder, StructureCommand.UPDATE); - validateStructureElementDataRelativeOtherData(structureElement, namingConvention, holderRepositories, holder, StructureCommand.UPDATE); + public static void validateStructureElementDataUpdate(StructureElementCommand structureElementCommand, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder) { + validateStructureElementDataInItself(structureElementCommand, namingConvention, holderRepositories, holder, StructureCommand.UPDATE); + validateStructureElementDataRelativeOtherData(structureElementCommand, namingConvention, holderRepositories, holder, StructureCommand.UPDATE); } /** - * Validate structure element data for delete. + * Validate structure element command data for delete. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @param namingConvention naming convention * @param holderRepositories holder repositories * @param holder holder */ - public static void validateStructureElementDataDelete(StructureElementCommand structureElement, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder) { - validateStructureElementDataInItself(structureElement, namingConvention, holderRepositories, holder, StructureCommand.DELETE); - validateStructureElementDataRelativeOtherData(structureElement, namingConvention, holderRepositories, holder, StructureCommand.DELETE); + public static void validateStructureElementDataDelete(StructureElementCommand structureElementCommand, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder) { + validateStructureElementDataInItself(structureElementCommand, namingConvention, holderRepositories, holder, StructureCommand.DELETE); + validateStructureElementDataRelativeOtherData(structureElementCommand, namingConvention, holderRepositories, holder, StructureCommand.DELETE); } /** - * Validate structure element data for approve. + * Validate structure element command data for approve. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @param namingConvention naming convention * @param holderRepositories holder repositories * @param holder holder */ - public static void validateStructureElementDataApprove(StructureElementCommand structureElement, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder) { - validateStructureElementDataInItself(structureElement, namingConvention, holderRepositories, holder, StructureCommand.APPROVE); - validateStructureElementDataRelativeOtherData(structureElement, namingConvention, holderRepositories, holder, StructureCommand.APPROVE); + public static void validateStructureElementDataApprove(StructureElementCommand structureElementCommand, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder) { + validateStructureElementDataInItself(structureElementCommand, namingConvention, holderRepositories, holder, StructureCommand.APPROVE); + validateStructureElementDataRelativeOtherData(structureElementCommand, namingConvention, holderRepositories, holder, StructureCommand.APPROVE); } /** - * Validate structure element data for cancel. + * Validate structure element command data for cancel. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @param namingConvention naming convention * @param holderRepositories holder repositories * @param holder holder */ - public static void validateStructureElementDataCancel(StructureElementCommand structureElement, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder) { - validateStructureElementDataInItself(structureElement, namingConvention, holderRepositories, holder, StructureCommand.CANCEL); - validateStructureElementDataRelativeOtherData(structureElement, namingConvention, holderRepositories, holder, StructureCommand.CANCEL); + public static void validateStructureElementDataCancel(StructureElementCommand structureElementCommand, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder) { + validateStructureElementDataInItself(structureElementCommand, namingConvention, holderRepositories, holder, StructureCommand.CANCEL); + validateStructureElementDataRelativeOtherData(structureElementCommand, namingConvention, holderRepositories, holder, StructureCommand.CANCEL); } /** - * Validate structure element data for reject. + * Validate structure element command data for reject. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @param namingConvention naming convention * @param holderRepositories holder repositories * @param holder holder */ - public static void validateStructureElementDataReject(StructureElementCommand structureElement, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder) { - validateStructureElementDataInItself(structureElement, namingConvention, holderRepositories, holder, StructureCommand.REJECT); - validateStructureElementDataRelativeOtherData(structureElement, namingConvention, holderRepositories, holder, StructureCommand.REJECT); + public static void validateStructureElementDataReject(StructureElementCommand structureElementCommand, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder) { + validateStructureElementDataInItself(structureElementCommand, namingConvention, holderRepositories, holder, StructureCommand.REJECT); + validateStructureElementDataRelativeOtherData(structureElementCommand, namingConvention, holderRepositories, holder, StructureCommand.REJECT); } /** - * Validate structure element data in itself. + * Validate structure element command data in itself. * - * @param structureElement - * @param namingConvention - * @param holderRepositories - * @param holder - * @param structureCommand + * @param structureElementCommand structure element command + * @param namingConvention naming convention + * @param holderRepositories holder respositories + * @param holder holder + * @param structureCommand structure command */ - public static void validateStructureElementDataInItself(StructureElementCommand structureElement, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder, StructureCommand structureCommand) { + public static void validateStructureElementDataInItself(StructureElementCommand structureElementCommand, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder, StructureCommand structureCommand) { + // command - attributes + // create - type, parent, name, mnemonic, description, comment + // update - uuid, type, parent, name, mnemonic, description, comment + // delete - uuid, type, comment + // approve - uuid, type, comment + // cancel - uuid, type, comment + // reject - uuid, type, comment + // + // create, update - optional - parent, mnemonic + // // check structure element data in itself // update, delete // definitely (not possibly) @@ -306,17 +358,17 @@ public class ValidateStructureElementUtil { // approve, reject, cancel // uuid - pending, latest, not deleted - list size 1 - if (ValidateUtil.isAnyNull(structureElement, namingConvention, holderRepositories, holder, structureCommand)) { + if (ValidateUtil.isAnyNull(structureElementCommand, namingConvention, holderRepositories, holder, structureCommand)) { return; } - String message = structureElement.getType().toString().toLowerCase() + TextUtil.SPACE + TextUtil.IS_NOT_CORRECT; - String details = structureElement.toString(); - String field = TextUtil.UUID; + UUID uuid = structureElementCommand.getUuid(); + Type type = structureElementCommand.getType(); + UUID parent = structureElementCommand.getParent(); - Type type = structureElement.getType(); - UUID uuid = structureElement.getUuid(); - UUID parent = structureElement.getParent(); + String message = type.toString().toLowerCase() + TextUtil.SPACE + TextUtil.IS_NOT_CORRECT; + String details = structureElementCommand.toString(); + String field = TextUtil.UUID; // validate data in itself // systemgroup, discipline @@ -372,15 +424,25 @@ public class ValidateStructureElementUtil { } /** - * Validate structure element data relative other data. + * Validate structure element command data relative other data. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @param namingConvention naming convention * @param holderRepositories holder repositories * @param holder holder * @param structureCommand structure command */ - public static void validateStructureElementDataRelativeOtherData(StructureElementCommand structureElement, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder, StructureCommand structureCommand) { + public static void validateStructureElementDataRelativeOtherData(StructureElementCommand structureElementCommand, EssNamingConvention namingConvention, HolderRepositories holderRepositories, HolderSystemDeviceStructure holder, StructureCommand structureCommand) { + // command - attributes + // create - type, parent, name, mnemonic, description, comment + // update - uuid, type, parent, name, mnemonic, description, comment + // delete - uuid, type, comment + // approve - uuid, type, comment + // cancel - uuid, type, comment + // reject - uuid, type, comment + // + // create, update - optional - parent, mnemonic + // // check structure element data in relation to other data // create, update // parent - (if applicable) approved, latest, not deleted @@ -396,18 +458,18 @@ public class ValidateStructureElementUtil { // additional checks if names are affected // comment not same as previous comment - if (ValidateUtil.isAnyNull(structureElement, namingConvention, holderRepositories, holder, structureCommand)) { + if (ValidateUtil.isAnyNull(structureElementCommand, namingConvention, holderRepositories, holder, structureCommand)) { return; } String message = null; - String details = structureElement.toString(); + String details = structureElementCommand.toString(); String field = TextUtil.MNEMONIC; - Type type = structureElement.getType(); - UUID uuid = structureElement.getUuid(); - UUID parent = structureElement.getParent(); - String mnemonic = structureElement.getMnemonic(); + UUID uuid = structureElementCommand.getUuid(); + Type type = structureElementCommand.getType(); + UUID parent = structureElementCommand.getParent(); + String mnemonic = structureElementCommand.getMnemonic(); // validate data relative other data // create, update @@ -504,53 +566,66 @@ public class ValidateStructureElementUtil { validateStructuresStatusSize1(uuid, type, Status.PENDING, null, holderRepositories, message, details, field); } else if (Type.SYSTEM.equals(type)) { - // status, parent - message = TextUtil.SYSTEMGROUP_IS_NOT_CORRECT; - validateStructuresStatusSize1(parent, Type.SYSTEMGROUP, Status.APPROVED, false, - holderRepositories, message, details, field); + LOGGER.log(Level.INFO, "validateStructureElementDataRelativeOtherData, SYSTEM, uuid: " + uuid); + LOGGER.log(Level.INFO, "validateStructureElementDataRelativeOtherData, SYSTEM, type: " + type); + LOGGER.log(Level.INFO, "validateStructureElementDataRelativeOtherData, SYSTEM, parent: " + parent); + LOGGER.log(Level.INFO, "validateStructureElementDataRelativeOtherData, SYSTEM, mnemonic: " + mnemonic); // status, uuid message = TextUtil.SYSTEM_IS_NOT_CORRECT; validateStructuresStatusSize1(uuid, type, Status.PENDING, null, holderRepositories, message, details, field); - } else if (Type.SUBSYSTEM.equals(type)) { + + List<System> systems = holderRepositories.getSystemRepository().readSystems(Status.PENDING, null, uuid.toString(), null, null, null, null, null, null); + // status, parent - message = TextUtil.SYSTEM_IS_NOT_CORRECT; - validateStructuresStatusSize1(parent, Type.SYSTEM, Status.APPROVED, false, + message = TextUtil.SYSTEMGROUP_IS_NOT_CORRECT; + validateStructuresStatusSize1(systems.get(0).getParentUuid(), Type.SYSTEMGROUP, Status.APPROVED, false, holderRepositories, message, details, field); - + } else if (Type.SUBSYSTEM.equals(type)) { // status, uuid message = TextUtil.SUBSYSTEM_IS_NOT_CORRECT; validateStructuresStatusSize1(uuid, type, Status.PENDING, null, holderRepositories, message, details, field); + + List<Subsystem> subsystems = holderRepositories.getSubsystemRepository().readSubsystems(Status.PENDING, null, uuid.toString(), null, null, null, null, null, null); + + // status, parent + message = TextUtil.SYSTEM_IS_NOT_CORRECT; + validateStructuresStatusSize1(subsystems.get(0).getParentUuid(), Type.SYSTEM, Status.APPROVED, false, + holderRepositories, message, details, field); } else if (Type.DISCIPLINE.equals(type)) { // status, uuid message = TextUtil.DISCIPLINE_IS_NOT_CORRECT; validateStructuresStatusSize1(uuid, type, Status.PENDING, null, holderRepositories, message, details, field); } else if (Type.DEVICEGROUP.equals(type)) { - // status, parent - message = TextUtil.DISCIPLINE_IS_NOT_CORRECT; - validateStructuresStatusSize1(parent, Type.DISCIPLINE, Status.APPROVED, false, - holderRepositories, message, details, field); - // status, uuid message = TextUtil.DEVICEGROUP_IS_NOT_CORRECT; validateStructuresStatusSize1(uuid, type, Status.PENDING, null, holderRepositories, message, details, field); - // no mnemonic for device group - ExceptionUtil.validateConditionDataConflictException(StringUtils.isEmpty(mnemonic), message, details, field); - } else if (Type.DEVICETYPE.equals(type)) { + List<DeviceGroup> deviceGroups = holderRepositories.getDeviceGroupRepository().readDeviceGroups(Status.PENDING, null, uuid.toString(), null, null, null, null, null, null); + // status, parent message = TextUtil.DISCIPLINE_IS_NOT_CORRECT; - validateStructuresStatusSize1(parent, Type.DEVICEGROUP, Status.APPROVED, false, + validateStructuresStatusSize1(deviceGroups.get(0).getParentUuid(), Type.DISCIPLINE, Status.APPROVED, false, holderRepositories, message, details, field); +// // no mnemonic for device group +// ExceptionUtil.validateConditionDataConflictException(StringUtils.isEmpty(mnemonic), message, details, field); + } else if (Type.DEVICETYPE.equals(type)) { // status, uuid message = TextUtil.DEVICETYPE_IS_NOT_CORRECT; validateStructuresStatusSize1(uuid, type, Status.PENDING, null, holderRepositories, message, details, field); + + List<DeviceType> deviceTypes = holderRepositories.getDeviceTypeRepository().readDeviceTypes(Status.PENDING, null, uuid.toString(), null, null, null, null, null, null); + + // status, parent + message = TextUtil.DISCIPLINE_IS_NOT_CORRECT; + validateStructuresStatusSize1(deviceTypes.get(0).getParentUuid(), Type.DEVICEGROUP, Status.APPROVED, false, + holderRepositories, message, details, field); } } } @@ -707,6 +782,10 @@ public class ValidateStructureElementUtil { String[] path = NamingConventionUtil.string2MnemonicPath(mnemonicPath); String mnemonicpathEquivalence = namingConvention.equivalenceClassRepresentative(mnemonicPath); + LOGGER.log(Level.INFO, "validateStructureDataCreate, type: " + type); + LOGGER.log(Level.INFO, "validateStructureDataCreate, path: " + path); + LOGGER.log(Level.INFO, "validateStructureDataCreate, mnemonicpathEquivalence: " + mnemonicpathEquivalence); + // validate path, including null check ExceptionUtil.validateConditionDataNotValidException(path != null && path.length >= 1 && path.length <= 2, TextUtil.STRUCTURE_MNEMONIC_PATH_IS_NOT_VALID, details, field); diff --git a/src/test/java/org/openepics/names/docker/ITUtilNameElement.java b/src/test/java/org/openepics/names/docker/ITUtilNameElement.java index fb9dfb647229bd3a3f003bb3bdb5148c159f4579..13823edd9e5bea65a0183bf85d80677048954a0f 100644 --- a/src/test/java/org/openepics/names/docker/ITUtilNameElement.java +++ b/src/test/java/org/openepics/names/docker/ITUtilNameElement.java @@ -66,93 +66,6 @@ public class ITUtilNameElement { // ---------------------------------------------------------------------------------------------------- - /** - * Utility method to return name element command for create given name element. - * - * @param nameElement name element - * @return name element command for create - */ - static NameElementCommandCreate convert2NameElementCommandCreate(NameElement nameElement) { - return new NameElementCommandCreate( - nameElement.getParentSystemStructure(), - nameElement.getParentDeviceStructure(), - nameElement.getIndex(), - nameElement.getDescription(), - nameElement.getComment()); - } - - /** - * Utility method to return name element command for update given name element. - * - * @param nameElement name element - * @return name element command for update - */ - static NameElementCommandUpdate convert2NameElementCommandUpdate(NameElement nameElement) { - return new NameElementCommandUpdate( - nameElement.getUuid(), - nameElement.getParentSystemStructure(), - nameElement.getParentDeviceStructure(), - nameElement.getIndex(), - nameElement.getDescription(), - nameElement.getComment()); - } - - /** - * Utility method to return name element command for confirm given name element. - * - * @param nameElement name element - * @return name element command for confirm - */ - static NameElementCommandConfirm convert2NameElementCommandConfirm(NameElement nameElement) { - return new NameElementCommandConfirm( - nameElement.getUuid(), - nameElement.getComment()); - } - - /** - * Utility method to return name element commands for create given name elements. - * - * @param nameElements name elements - * @return name element commands for create - */ - public static NameElementCommandCreate[] convert2NameElementCommandCreate(NameElement[] nameElements) { - NameElementCommandCreate[] nameElementCommandsCreate = new NameElementCommandCreate[nameElements.length]; - for (int i=0; i<nameElements.length; i++) { - nameElementCommandsCreate[i] = convert2NameElementCommandCreate(nameElements[i]); - } - return nameElementCommandsCreate; - } - - /** - * Utility method to return name element commands for update given name elements. - * - * @param nameElements name elements - * @return name element commands for update - */ - public static NameElementCommandUpdate[] convert2NameElementCommandUpdate(NameElement[] nameElements) { - NameElementCommandUpdate[] nameElementCommandsUpdate = new NameElementCommandUpdate[nameElements.length]; - for (int i=0; i<nameElements.length; i++) { - nameElementCommandsUpdate[i] = convert2NameElementCommandUpdate(nameElements[i]); - } - return nameElementCommandsUpdate; - } - - /** - * Utility method to return name element commands for confirm given name elements. - * - * @param nameElements name elements - * @return name element commands for confirm - */ - public static NameElementCommandConfirm[] convert2NameElementCommandConfirm(NameElement[] nameElements) { - NameElementCommandConfirm[] nameElementCommandsConfirm = new NameElementCommandConfirm[nameElements.length]; - for (int i=0; i<nameElements.length; i++) { - nameElementCommandsConfirm[i] = convert2NameElementCommandConfirm(nameElements[i]); - } - return nameElementCommandsConfirm; - } - - // ---------------------------------------------------------------------------------------------------- - /** * Return string for name element command array. * diff --git a/src/test/java/org/openepics/names/docker/ITUtilStructureElement.java b/src/test/java/org/openepics/names/docker/ITUtilStructureElement.java index 181fd5b196ac5f3bcb8241a03f63052ea047f845..112b1134f371e27cb83ea0acfbaca0213fbd5889 100644 --- a/src/test/java/org/openepics/names/docker/ITUtilStructureElement.java +++ b/src/test/java/org/openepics/names/docker/ITUtilStructureElement.java @@ -38,10 +38,14 @@ import org.openepics.names.rest.beans.Status; import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.StructureElement; import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandConfirm; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; +import org.openepics.names.rest.beans.element.StructureElementCommandUpdate; import org.openepics.names.rest.beans.response.ResponseBoolean; import org.openepics.names.rest.beans.response.ResponseBooleanList; import org.openepics.names.rest.beans.response.ResponsePageStructureElements; import org.openepics.names.util.StructureCommand; +import org.openepics.names.util.StructureElementUtil; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -65,12 +69,42 @@ public class ITUtilStructureElement { // ---------------------------------------------------------------------------------------------------- /** - * Return string for structure element array. + * Return string for structure element command array. * - * @param value structure element array - * @return string for structure element array + * @param value structure element command array + * @return string for structure element command array */ - static String object2Json(StructureElementCommand[] value) { + static String object2Json(StructureElementCommandCreate[] value) { + try { + return mapper.writeValueAsString(value); + } catch (JsonProcessingException e) { + fail(); + } + return null; + } + + /** + * Return string for structure element command array. + * + * @param value structure element command array + * @return string for structure element command array + */ + static String object2Json(StructureElementCommandUpdate[] value) { + try { + return mapper.writeValueAsString(value); + } catch (JsonProcessingException e) { + fail(); + } + return null; + } + + /** + * Return string for structure element command array. + * + * @param value structure element command array + * @return string for structure element command array + */ + static String object2Json(StructureElementCommandConfirm[] value) { try { return mapper.writeValueAsString(value); } catch (JsonProcessingException e) { @@ -409,40 +443,80 @@ public class ITUtilStructureElement { // -------------------- /** - * Utility method to validate structure element and assert expected response. + * Utility method to validate structure element command for create and assert expected response. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @param structureCommand structure command * @param expected expected response */ - public static void assertValidate(StructureElementCommand structureElement, StructureCommand structureCommand, Boolean expected) { - assertValidate(AuthorizationChoice.NONE, new StructureElementCommand[] {structureElement}, structureCommand, expected); + public static void assertValidate(StructureElementCommandCreate structureElementCommand, StructureCommand structureCommand, Boolean expected) { + assertValidate(AuthorizationChoice.NONE, object2Json(new StructureElementCommandCreate[] {structureElementCommand}), structureCommand, expected); } /** - * Utility method to validate structure elements and assert expected response. + * Utility method to validate structure element command for update and assert expected response. + * + * @param structureElementCommand structure element command + * @param structureCommand structure command + * @param expected expected response + */ + public static void assertValidate(StructureElementCommandUpdate structureElementCommand, StructureCommand structureCommand, Boolean expected) { + assertValidate(AuthorizationChoice.NONE, object2Json(new StructureElementCommandUpdate[] {structureElementCommand}), structureCommand, expected); + } + /** + * Utility method to validate structure element command for confirm and assert expected response. + * + * @param structureElementCommand structure element command + * @param structureCommand structure command + * @param expected expected response + */ + public static void assertValidate(StructureElementCommandConfirm structureElementCommand, StructureCommand structureCommand, Boolean expected) { + assertValidate(AuthorizationChoice.NONE, object2Json(new StructureElementCommandConfirm[] {structureElementCommand}), structureCommand, expected); + } + /** + * Utility method to validate structure element commands for create and assert expected response. + * + * @param structureElementCommands structure element commands + * @param structureCommand structure command + * @param expected expected response + */ + public static void assertValidate(StructureElementCommandCreate[] structureElementCommands, StructureCommand structureCommand, Boolean expected) { + assertValidate(AuthorizationChoice.NONE, object2Json(structureElementCommands), structureCommand, expected); + } + /** + * Utility method to validate structure element commands for update and assert expected response. + * + * @param structureElementCommands structure element commands + * @param structureCommand structure command + * @param expected expected response + */ + public static void assertValidate(StructureElementCommandUpdate[] structureElementCommands, StructureCommand structureCommand, Boolean expected) { + assertValidate(AuthorizationChoice.NONE, object2Json(structureElementCommands), structureCommand, expected); + } + /** + * Utility method to validate structure element commands for confirm and assert expected response. * - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @param structureCommand structure command * @param expected expected response */ - public static void assertValidate(StructureElementCommand[] structureElements, StructureCommand structureCommand, Boolean expected) { - assertValidate(AuthorizationChoice.NONE, structureElements, structureCommand, expected); + public static void assertValidate(StructureElementCommandConfirm[] structureElementCommands, StructureCommand structureCommand, Boolean expected) { + assertValidate(AuthorizationChoice.NONE, object2Json(structureElementCommands), structureCommand, expected); } /** * Utility method to validate structure elements and assert expected response. * * @param authorizationChoice authorization choice (none, user, admin) - * @param structureElements structure elements + * @param json json * @param structureCommand structure command * @param expected expected response */ - public static void assertValidate(AuthorizationChoice authorizationChoice, StructureElementCommand[] structureElements, StructureCommand structureCommand, Boolean expected) { + public static void assertValidate(AuthorizationChoice authorizationChoice, String json, StructureCommand structureCommand, Boolean expected) { String path = getValidatePath(structureCommand); try { String[] response = null; - response = ITUtil.runShellCommand(ITUtil.curlGetPathJson(authorizationChoice, EndpointChoice.STRUCTURES, path, object2Json(structureElements))); + response = ITUtil.runShellCommand(ITUtil.curlGetPathJson(authorizationChoice, EndpointChoice.STRUCTURES, path, json)); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); ITUtil.assertEqualsResponseBoolean(mapper.readValue(response[1], ResponseBooleanList.class), expected); } catch (IOException e) { @@ -494,12 +568,12 @@ public class ITUtilStructureElement { * Method expected to NOT succeed to create a structure element * but instead assert response code (possibly also a non-empty message). * - * @param structureElement structure element + * @param structureElementCommand structure element command * @param responseCode response code * @throws JsonProcessingException */ - public static void assertCreate(StructureElementCommand structureElement, int responseCode) throws JsonProcessingException { - assertCreate(AuthorizationChoice.NONE, object2Json(new StructureElementCommand[] {structureElement}), responseCode); + public static void assertCreate(StructureElementCommandCreate structureElementCommand, int responseCode) throws JsonProcessingException { + assertCreate(AuthorizationChoice.NONE, object2Json(new StructureElementCommandCreate[] {structureElementCommand}), responseCode); } /** * Utility method to (try to) create a structure element from given json and assert result response code. @@ -540,40 +614,40 @@ public class ITUtilStructureElement { /** * Utility method to create a structure element and assert result. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @return created structure element */ - public static StructureElement assertCreate(StructureElementCommand structureElement) { - return assertCreate(AuthorizationChoice.NONE, new StructureElementCommand[] {structureElement})[0]; + public static StructureElement assertCreate(StructureElementCommandCreate structureElementCommand) { + return assertCreate(AuthorizationChoice.NONE, new StructureElementCommandCreate[] {structureElementCommand})[0]; } /** * Utility method to create structure elements and assert result. * - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return created structure element */ - public static StructureElement[] assertCreate(StructureElementCommand[] structureElements) { - return assertCreate(AuthorizationChoice.NONE, structureElements); + public static StructureElement[] assertCreate(StructureElementCommandCreate[] structureElementCommands) { + return assertCreate(AuthorizationChoice.NONE, structureElementCommands); } /** * Utility method to create structure elements and assert result. * * @param authorizationChoice authorization choice (none, user, admin) - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return created structure element */ - public static StructureElement[] assertCreate(AuthorizationChoice authorizationChoice, StructureElementCommand[] structureElements) { + public static StructureElement[] assertCreate(AuthorizationChoice authorizationChoice, StructureElementCommandCreate[] structureElementCommands) { String path = getValidatePath(StructureCommand.CREATE); try { String[] response = null; StructureElement[] createdStructureElements = null; - response = ITUtil.runShellCommand(ITUtil.curlGetPathJson(authorizationChoice, EndpointChoice.STRUCTURES, path, object2Json(structureElements))); + response = ITUtil.runShellCommand(ITUtil.curlGetPathJson(authorizationChoice, EndpointChoice.STRUCTURES, path, object2Json(structureElementCommands))); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); ITUtil.assertEqualsResponseBoolean(mapper.readValue(response[1], ResponseBooleanList.class), Boolean.TRUE); - response = ITUtil.runShellCommand(ITUtil.curlPostPathJson(authorizationChoice, EndpointChoice.STRUCTURES, "", object2Json(structureElements))); + response = ITUtil.runShellCommand(ITUtil.curlPostPathJson(authorizationChoice, EndpointChoice.STRUCTURES, "", object2Json(structureElementCommands))); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_CREATED); createdStructureElements = mapper.readValue(response[1], StructureElement[].class); @@ -603,40 +677,40 @@ public class ITUtilStructureElement { /** * Utility method to update a structure element and assert result. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @return updated structure element */ - public static StructureElement assertUpdate(StructureElementCommand structureElement) { - return assertUpdate(AuthorizationChoice.NONE, new StructureElementCommand[] {structureElement})[0]; + public static StructureElement assertUpdate(StructureElementCommandUpdate structureElementCommand) { + return assertUpdate(AuthorizationChoice.NONE, new StructureElementCommandUpdate[] {structureElementCommand})[0]; } /** * Utility method to update structure elements and assert result. * - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return updated structure element */ - public static StructureElement[] assertUpdate(StructureElementCommand[] structureElements) { - return assertUpdate(AuthorizationChoice.NONE, structureElements); + public static StructureElement[] assertUpdate(StructureElementCommandUpdate[] structureElementCommands) { + return assertUpdate(AuthorizationChoice.NONE, structureElementCommands); } /** * Utility method to update structure elements and assert result. * * @param authorizationChoice authorization choice (none, user, admin) - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return updated structure element */ - public static StructureElement[] assertUpdate(AuthorizationChoice authorizationChoice, StructureElementCommand[] structureElements) { + public static StructureElement[] assertUpdate(AuthorizationChoice authorizationChoice, StructureElementCommandUpdate[] structureElementCommands) { String path = getValidatePath(StructureCommand.UPDATE); try { String[] response = null; StructureElement[] updatedStructureElements = null; - response = ITUtil.runShellCommand(ITUtil.curlGetPathJson(authorizationChoice, EndpointChoice.STRUCTURES, path, object2Json(structureElements))); + response = ITUtil.runShellCommand(ITUtil.curlGetPathJson(authorizationChoice, EndpointChoice.STRUCTURES, path, object2Json(structureElementCommands))); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); ITUtil.assertEqualsResponseBoolean(mapper.readValue(response[1], ResponseBooleanList.class), Boolean.TRUE); - response = ITUtil.runShellCommand(ITUtil.curlPutPathJson(authorizationChoice, EndpointChoice.STRUCTURES, "", object2Json(structureElements))); + response = ITUtil.runShellCommand(ITUtil.curlPutPathJson(authorizationChoice, EndpointChoice.STRUCTURES, "", object2Json(structureElementCommands))); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); updatedStructureElements = mapper.readValue(response[1], StructureElement[].class); @@ -663,40 +737,40 @@ public class ITUtilStructureElement { /** * Utility method to delete a structure element and assert result. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @return deleted structure element */ - public static StructureElement assertDelete(StructureElementCommand structureElement) { - return assertDelete(AuthorizationChoice.NONE, new StructureElementCommand[] {structureElement})[0]; + public static StructureElement assertDelete(StructureElementCommandConfirm structureElementCommand) { + return assertDelete(AuthorizationChoice.NONE, new StructureElementCommandConfirm[] {structureElementCommand})[0]; } /** * Utility method to delete structure elements and assert result. * - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return deleted structure element */ - public static StructureElement[] assertDelete(StructureElementCommand[] structureElements) { - return assertDelete(AuthorizationChoice.NONE, structureElements); + public static StructureElement[] assertDelete(StructureElementCommandConfirm[] structureElementCommands) { + return assertDelete(AuthorizationChoice.NONE, structureElementCommands); } /** * Utility method to delete structure elements and assert result. * * @param authorizationChoice authorization choice (none, user, admin) - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return deleted structure element */ - public static StructureElement[] assertDelete(AuthorizationChoice authorizationChoice, StructureElementCommand[] structureElements) { + public static StructureElement[] assertDelete(AuthorizationChoice authorizationChoice, StructureElementCommandConfirm[] structureElementCommands) { String path = getValidatePath(StructureCommand.DELETE); try { String[] response = null; StructureElement[] deletedStructureElements = null; - response = ITUtil.runShellCommand(ITUtil.curlGetPathJson(authorizationChoice, EndpointChoice.STRUCTURES, path, object2Json(structureElements))); + response = ITUtil.runShellCommand(ITUtil.curlGetPathJson(authorizationChoice, EndpointChoice.STRUCTURES, path, object2Json(structureElementCommands))); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); ITUtil.assertEqualsResponseBoolean(mapper.readValue(response[1], ResponseBooleanList.class), Boolean.TRUE); - response = ITUtil.runShellCommand(ITUtil.curlDeletePathJson(authorizationChoice, EndpointChoice.STRUCTURES, "", object2Json(structureElements))); + response = ITUtil.runShellCommand(ITUtil.curlDeletePathJson(authorizationChoice, EndpointChoice.STRUCTURES, "", object2Json(structureElementCommands))); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); deletedStructureElements = mapper.readValue(response[1], StructureElement[].class); @@ -723,40 +797,40 @@ public class ITUtilStructureElement { /** * Utility method to approve a structure element and assert result. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @return approved structure element */ - public static StructureElement assertApprove(StructureElementCommand structureElement) { - return assertApprove(AuthorizationChoice.NONE, new StructureElementCommand[] {structureElement})[0]; + public static StructureElement assertApprove(StructureElementCommandConfirm structureElementCommand) { + return assertApprove(AuthorizationChoice.NONE, new StructureElementCommandConfirm[] {structureElementCommand})[0]; } /** * Utility method to approve structure elements and assert result. * - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return approved structure element */ - public static StructureElement[] assertApprove(StructureElementCommand[] structureElements) { - return assertApprove(AuthorizationChoice.NONE, structureElements); + public static StructureElement[] assertApprove(StructureElementCommandConfirm[] structureElementCommands) { + return assertApprove(AuthorizationChoice.NONE, structureElementCommands); } /** * Utility method to approve structure elements and assert result. * * @param authorizationChoice authorization choice (none, user, admin) - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return approved structure element */ - public static StructureElement[] assertApprove(AuthorizationChoice authorizationChoice, StructureElementCommand[] structureElements) { + public static StructureElement[] assertApprove(AuthorizationChoice authorizationChoice, StructureElementCommandConfirm[] structureElementCommands) { String path = getValidatePath(StructureCommand.APPROVE); try { String[] response = null; StructureElement[] approvedStructureElements = null; - response = ITUtil.runShellCommand(ITUtil.curlGetPathJson(authorizationChoice, EndpointChoice.STRUCTURES, path, object2Json(structureElements))); + response = ITUtil.runShellCommand(ITUtil.curlGetPathJson(authorizationChoice, EndpointChoice.STRUCTURES, path, object2Json(structureElementCommands))); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); ITUtil.assertEqualsResponseBoolean(mapper.readValue(response[1], ResponseBooleanList.class), Boolean.TRUE); - response = ITUtil.runShellCommand(ITUtil.curlPatchPathJson(authorizationChoice, EndpointChoice.STRUCTURES, "/approve", object2Json(structureElements))); + response = ITUtil.runShellCommand(ITUtil.curlPatchPathJson(authorizationChoice, EndpointChoice.STRUCTURES, "/approve", object2Json(structureElementCommands))); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); approvedStructureElements = mapper.readValue(response[1], StructureElement[].class); @@ -783,40 +857,40 @@ public class ITUtilStructureElement { /** * Utility method to cancel a structure element and assert result. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @return cancelled structure element */ - public static StructureElement assertCancel(StructureElementCommand structureElement) { - return assertCancel(AuthorizationChoice.NONE, new StructureElementCommand[] {structureElement})[0]; + public static StructureElement assertCancel(StructureElementCommandConfirm structureElementCommand) { + return assertCancel(AuthorizationChoice.NONE, new StructureElementCommandConfirm[] {structureElementCommand})[0]; } /** * Utility method to cancel structure elements and assert result. * - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return cancelled structure element */ - public static StructureElement[] assertCancel(StructureElementCommand[] structureElements) { - return assertCancel(AuthorizationChoice.NONE, structureElements); + public static StructureElement[] assertCancel(StructureElementCommandConfirm[] structureElementCommands) { + return assertCancel(AuthorizationChoice.NONE, structureElementCommands); } /** * Utility method to cancel structure elements and assert result. * * @param authorizationChoice authorization choice (none, user, admin) - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return cancelled structure element */ - public static StructureElement[] assertCancel(AuthorizationChoice authorizationChoice, StructureElementCommand[] structureElements) { + public static StructureElement[] assertCancel(AuthorizationChoice authorizationChoice, StructureElementCommandConfirm[] structureElementCommands) { String path = getValidatePath(StructureCommand.CANCEL); try { String[] response = null; StructureElement[] cancelledStructureElements = null; - response = ITUtil.runShellCommand(ITUtil.curlGetPathJson(authorizationChoice, EndpointChoice.STRUCTURES, path, object2Json(structureElements))); + response = ITUtil.runShellCommand(ITUtil.curlGetPathJson(authorizationChoice, EndpointChoice.STRUCTURES, path, object2Json(structureElementCommands))); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); ITUtil.assertEqualsResponseBoolean(mapper.readValue(response[1], ResponseBooleanList.class), Boolean.TRUE); - response = ITUtil.runShellCommand(ITUtil.curlPatchPathJson(authorizationChoice, EndpointChoice.STRUCTURES, "/cancel", object2Json(structureElements))); + response = ITUtil.runShellCommand(ITUtil.curlPatchPathJson(authorizationChoice, EndpointChoice.STRUCTURES, "/cancel", object2Json(structureElementCommands))); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); cancelledStructureElements = mapper.readValue(response[1], StructureElement[].class); @@ -843,40 +917,40 @@ public class ITUtilStructureElement { /** * Utility method to reject a structure element and assert result. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @return rejected structure element */ - public static StructureElement assertReject(StructureElementCommand structureElement) { - return assertReject(AuthorizationChoice.NONE, new StructureElementCommand[] {structureElement})[0]; + public static StructureElement assertReject(StructureElementCommandConfirm structureElementCommand) { + return assertReject(AuthorizationChoice.NONE, new StructureElementCommandConfirm[] {structureElementCommand})[0]; } /** * Utility method to reject structure elements and assert result. * - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return rejected structure element */ - public static StructureElement[] assertReject(StructureElementCommand[] structureElements) { - return assertReject(AuthorizationChoice.NONE, structureElements); + public static StructureElement[] assertReject(StructureElementCommandConfirm[] structureElementCommands) { + return assertReject(AuthorizationChoice.NONE, structureElementCommands); } /** * Utility method to reject structure elements and assert result. * * @param authorizationChoice authorization choice (none, user, admin) - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return rejected structure element */ - public static StructureElement[] assertReject(AuthorizationChoice authorizationChoice, StructureElementCommand[] structureElements) { + public static StructureElement[] assertReject(AuthorizationChoice authorizationChoice, StructureElementCommandConfirm[] structureElementCommands) { String path = getValidatePath(StructureCommand.REJECT); try { String[] response = null; StructureElement[] rejectedStructureElements = null; - response = ITUtil.runShellCommand(ITUtil.curlGetPathJson(authorizationChoice, EndpointChoice.STRUCTURES, path, object2Json(structureElements))); + response = ITUtil.runShellCommand(ITUtil.curlGetPathJson(authorizationChoice, EndpointChoice.STRUCTURES, path, object2Json(structureElementCommands))); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); ITUtil.assertEqualsResponseBoolean(mapper.readValue(response[1], ResponseBooleanList.class), Boolean.TRUE); - response = ITUtil.runShellCommand(ITUtil.curlPatchPathJson(authorizationChoice, EndpointChoice.STRUCTURES, "/reject", object2Json(structureElements))); + response = ITUtil.runShellCommand(ITUtil.curlPatchPathJson(authorizationChoice, EndpointChoice.STRUCTURES, "/reject", object2Json(structureElementCommands))); ITUtil.assertResponseLength2Code(response, HttpURLConnection.HTTP_OK); rejectedStructureElements = mapper.readValue(response[1], StructureElement[].class); @@ -905,172 +979,172 @@ public class ITUtilStructureElement { /** * Utility method to create, approve a structure element and assert result. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @return approved structure element (after create) */ - public static StructureElement assertCreateApprove(StructureElementCommand structureElement) { - return assertApprove(assertCreate(structureElement)); + public static StructureElement assertCreateApprove(StructureElementCommandCreate structureElementCommand) { + return assertApprove(StructureElementUtil.convertElement2CommandConfirm(assertCreate(structureElementCommand))); } /** * Utility method to create, approve structure elements and assert result. * - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return approved structure elements (after create) */ - public static StructureElement[] assertCreateApprove(StructureElementCommand[] structureElements) { - return assertApprove(assertCreate(structureElements)); + public static StructureElement[] assertCreateApprove(StructureElementCommandCreate[] structureElementCommands) { + return assertApprove(StructureElementUtil.convertElement2CommandConfirm(assertCreate(structureElementCommands))); } /** * Utility method to create, cancel a structure element and assert result. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @return cancelled structure element (after create) */ - public static StructureElement assertCreateCancel(StructureElementCommand structureElement) { - return assertCancel(assertCreate(structureElement)); + public static StructureElement assertCreateCancel(StructureElementCommandCreate structureElementCommand) { + return assertCancel(StructureElementUtil.convertElement2CommandConfirm(assertCreate(structureElementCommand))); } /** * Utility method to create, cancel structure elements and assert result. * - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return cancelled structure elements (after create) */ - public static StructureElement[] assertCreateCancel(StructureElementCommand[] structureElements) { - return assertCancel(assertCreate(structureElements)); + public static StructureElement[] assertCreateCancel(StructureElementCommandCreate[] structureElementCommands) { + return assertCancel(StructureElementUtil.convertElement2CommandConfirm(assertCreate(structureElementCommands))); } /** * Utility method to create, reject a structure element and assert result. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @return rejected structure element (after create) */ - public static StructureElement assertCreateReject(StructureElementCommand structureElement) { - return assertReject(assertCreate(structureElement)); + public static StructureElement assertCreateReject(StructureElementCommandCreate structureElementCommand) { + return assertReject(StructureElementUtil.convertElement2CommandConfirm(assertCreate(structureElementCommand))); } /** * Utility method to create, reject structure elements and assert result. * - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return rejected structure elements (after create) */ - public static StructureElement[] assertCreateReject(StructureElementCommand[] structureElements) { - return assertReject(assertCreate(structureElements)); + public static StructureElement[] assertCreateReject(StructureElementCommandCreate[] structureElementCommands) { + return assertReject(StructureElementUtil.convertElement2CommandConfirm(assertCreate(structureElementCommands))); } /** * Utility method to update, approve a structure element and assert result. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @return approved structure element (after update) */ - public static StructureElement assertUpdateApprove(StructureElementCommand structureElement) { - return assertApprove(assertUpdate(structureElement)); + public static StructureElement assertUpdateApprove(StructureElementCommandUpdate structureElementCommand) { + return assertApprove(StructureElementUtil.convertElement2CommandConfirm(assertUpdate(structureElementCommand))); } /** * Utility method to update, approve structure elements and assert result. * - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return approved structure elements (after update) */ - public static StructureElement[] assertUpdateApprove(StructureElementCommand[] structureElements) { - return assertApprove(assertUpdate(structureElements)); + public static StructureElement[] assertUpdateApprove(StructureElementCommandUpdate[] structureElementCommands) { + return assertApprove(StructureElementUtil.convertElement2CommandConfirm(assertUpdate(structureElementCommands))); } /** * Utility method to update, cancel a structure element and assert result. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @return cancelled structure element (after update) */ - public static StructureElement assertUpdateCancel(StructureElementCommand structureElement) { - return assertCancel(assertUpdate(structureElement)); + public static StructureElement assertUpdateCancel(StructureElementCommandUpdate structureElementCommand) { + return assertCancel(StructureElementUtil.convertElement2CommandConfirm(assertUpdate(structureElementCommand))); } /** * Utility method to update, cancel structure elements and assert result. * - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return cancelled structure elements (after update) */ - public static StructureElement[] assertUpdateCancel(StructureElementCommand[] structureElements) { - return assertCancel(assertUpdate(structureElements)); + public static StructureElement[] assertUpdateCancel(StructureElementCommandUpdate[] structureElementCommands) { + return assertCancel(StructureElementUtil.convertElement2CommandConfirm(assertUpdate(structureElementCommands))); } /** * Utility method to update, reject a structure element and assert result. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @return rejected structure element (after update) */ - public static StructureElement assertUpdateReject(StructureElementCommand structureElement) { - return assertReject(assertUpdate(structureElement)); + public static StructureElement assertUpdateReject(StructureElementCommandUpdate structureElementCommand) { + return assertReject(StructureElementUtil.convertElement2CommandConfirm(assertUpdate(structureElementCommand))); } /** * Utility method to update, reject structure elements and assert result. * - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return rejected structure elements (after update) */ - public static StructureElement[] assertUpdateReject(StructureElementCommand[] structureElements) { - return assertReject(assertUpdate(structureElements)); + public static StructureElement[] assertUpdateReject(StructureElementCommandUpdate[] structureElementCommands) { + return assertReject(StructureElementUtil.convertElement2CommandConfirm(assertUpdate(structureElementCommands))); } /** * Utility method to delete, approve a structure element and assert result. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @return approved structure element (after delete) */ - public static StructureElement assertDeleteApprove(StructureElementCommand structureElement) { - return assertApprove(assertDelete(structureElement)); + public static StructureElement assertDeleteApprove(StructureElementCommandConfirm structureElementCommand) { + return assertApprove(StructureElementUtil.convertElement2CommandConfirm(assertDelete(structureElementCommand))); } /** * Utility method to delete, approve structure elements and assert result. * - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return approved structure elements (after delete) */ - public static StructureElement[] assertDeleteApprove(StructureElementCommand[] structureElements) { - return assertApprove(assertDelete(structureElements)); + public static StructureElement[] assertDeleteApprove(StructureElementCommandConfirm[] structureElementCommands) { + return assertApprove(StructureElementUtil.convertElement2CommandConfirm(assertDelete(structureElementCommands))); } /** * Utility method to delete, cancel a structure element and assert result. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @return cancelled structure element (after delete) */ - public static StructureElement assertDeleteCancel(StructureElementCommand structureElement) { - return assertCancel(assertDelete(structureElement)); + public static StructureElement assertDeleteCancel(StructureElementCommandConfirm structureElementCommand) { + return assertCancel(StructureElementUtil.convertElement2CommandConfirm(assertDelete(structureElementCommand))); } /** * Utility method to delete, cancel structure elements and assert result. * - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return cancelled structure elements (after delete) */ - public static StructureElement[] assertDeleteCancel(StructureElementCommand[] structureElements) { - return assertCancel(assertDelete(structureElements)); + public static StructureElement[] assertDeleteCancel(StructureElementCommandConfirm[] structureElementCommands) { + return assertCancel(StructureElementUtil.convertElement2CommandConfirm(assertDelete(structureElementCommands))); } /** * Utility method to delete, reject a structure element and assert result. * - * @param structureElement structure element + * @param structureElementCommand structure element command * @return rejected structure element (after delete) */ - public static StructureElement assertDeleteReject(StructureElementCommand structureElement) { - return assertReject(assertDelete(structureElement)); + public static StructureElement assertDeleteReject(StructureElementCommandConfirm structureElementCommand) { + return assertReject(StructureElementUtil.convertElement2CommandConfirm(assertDelete(structureElementCommand))); } /** * Utility method to delete, reject structure elements and assert result. * - * @param structureElements structure elements + * @param structureElementCommands structure element commands * @return rejected structure elements (after delete) */ - public static StructureElement[] assertDeleteReject(StructureElementCommand[] structureElements) { - return assertReject(assertDelete(structureElements)); + public static StructureElement[] assertDeleteReject(StructureElementCommandConfirm[] structureElementCommands) { + return assertReject(StructureElementUtil.convertElement2CommandConfirm(assertDelete(structureElementCommands))); } } diff --git a/src/test/java/org/openepics/names/docker/NamesIT.java b/src/test/java/org/openepics/names/docker/NamesIT.java index ee63dfbb66d3e8151c9c02da8996ec6e0bc77398..6b96311f2badcdaecdb9531a3d090b024cca6ccc 100644 --- a/src/test/java/org/openepics/names/docker/NamesIT.java +++ b/src/test/java/org/openepics/names/docker/NamesIT.java @@ -31,12 +31,15 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.NameElement; +import org.openepics.names.rest.beans.element.NameElementCommand; import org.openepics.names.rest.beans.element.NameElementCommandConfirm; import org.openepics.names.rest.beans.element.NameElementCommandCreate; import org.openepics.names.rest.beans.element.NameElementCommandUpdate; import org.openepics.names.rest.beans.element.StructureElement; -import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandConfirm; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; import org.openepics.names.util.NameCommand; +import org.openepics.names.util.NameElementUtil; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -62,6 +65,11 @@ class NamesIT { // --> // for such operations that send Command objects to backend, it is also possible to send // NameElement, StructureElement + // + // NameElementCommand + // create - parentSystemStructure, parentDeviceStructure, index, description, comment + // update - uuid, parentSystemStructure, parentDeviceStructure, index, description, comment + // delete - uuid, comment @Container public static final DockerComposeContainer<?> ENVIRONMENT = @@ -84,77 +92,77 @@ class NamesIT { public static void initAll() { // init system group, system, subsystem, discipline, device group, device type - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement approvedStructureElement = null; - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "Accelerator", "Acc", "The ESS Linear Accelerator", "approved by alfio"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); systemGroupAcc = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupAcc, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupAcc, "Radio Frequency Quadrupole", "RFQ", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); systemRFQ = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemRFQ, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemRFQ, "01 Phase Reference Line", "010PRL", "empty", "Approved by Daniel Piso"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); subsystem010PRL = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemRFQ, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemRFQ, "RFQ-010", "010", "empty", "Approved by Daniel Piso"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); subsystem010 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemRFQ, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemRFQ, "Power switch board 01", "N1U1", "Electrical power cabinets", "Approved by Daniel Piso"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); subsystemN1U1 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "Electromagnetic Resonators", "EMR", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineEMR = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineEMR, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineEMR, "Control", null, "empty", "These names are needed now, so I am approving, but please add a description to these later."); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupEMR = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupEMR, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupEMR, "Flow Switch", "FS", "empty", "Approve names added from misc device group"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceTypeFS = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupEMR, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupEMR, "RF Antenna", "RFA", "empty", "Approve names added from misc device group"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceTypeRFA = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupEMR, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupEMR, "Temperature Transmitter", "TT", "empty", "Approve names added from misc device group"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceTypeTT = approvedStructureElement.getUuid(); } @@ -200,17 +208,16 @@ class NamesIT { NameElementCommandCreate nameElementCommandCreate = null; NameElementCommandUpdate nameElementCommandUpdate = null; NameElementCommandConfirm nameElementCommandConfirm = null; + NameElementCommand nameElementCommand = null; NameElement createdNameElement = null; - StructureElementCommand structureElement = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; - nameElementCommandCreate = new NameElementCommandCreate( - subsystemN1U1, deviceTypeRFA, "071", - "description", "comment"); - nameElementCommandUpdate = new NameElementCommandUpdate( + nameElementCommand = new NameElementCommand( null, subsystemN1U1, deviceTypeRFA, "071", "description", "comment"); - nameElementCommandConfirm = new NameElementCommandConfirm( - null, "comment"); + nameElementCommandCreate = NameElementUtil.convertCommand2CommandCreate(nameElementCommand); + nameElementCommandUpdate = NameElementUtil.convertCommand2CommandUpdate(nameElementCommand); + nameElementCommandConfirm = NameElementUtil.convertCommand2CommandConfirm(nameElementCommand); Long totalCount = ITUtilNameElement.assertRead("").getTotalCount(); assertNotNull(totalCount); @@ -239,12 +246,10 @@ class NamesIT { ITUtilNameElement.assertValidate(nameElementCommandConfirm, NameCommand.DELETE, Boolean.TRUE); // delete, approve - structureElement = new StructureElementCommand( - subsystemN1U1, Type.SUBSYSTEM, systemRFQ, - "name", "N1U1", - "description", "comment"); + structureElementCommandConfirm = new StructureElementCommandConfirm( + subsystemN1U1, Type.SUBSYSTEM, "comment"); - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); ITUtilNameElement.assertExists("RFQ-N1U1:EMR-RFA-071", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("RFQ-N1U1:EMR-RFA-071", Boolean.FALSE); @@ -253,7 +258,7 @@ class NamesIT { ITUtilNameElement.assertValidate(nameElementCommandUpdate, NameCommand.UPDATE, Boolean.TRUE); ITUtilNameElement.assertValidate(nameElementCommandConfirm, NameCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); totalCount = ITUtilNameElement.assertRead("").getTotalCount(); assertNotNull(totalCount); @@ -537,7 +542,7 @@ class NamesIT { // create createdNameElement = ITUtilNameElement.assertCreate(nameElementCommandCreate); - nameElementCommandUpdate = ITUtilNameElement.convert2NameElementCommandUpdate(createdNameElement); + nameElementCommandUpdate = NameElementUtil.convertElement2CommandUpdate(createdNameElement); // validate update @@ -702,8 +707,7 @@ class NamesIT { // create createdNameElement = ITUtilNameElement.assertCreate(nameElementCommandCreate); - nameElementCommandConfirm = ITUtilNameElement.convert2NameElementCommandConfirm(createdNameElement); -// nameElement.setUuid(createdNameElement.getUuid()); + nameElementCommandConfirm = NameElementUtil.convertElement2CommandConfirm(createdNameElement); // validate delete @@ -715,49 +719,11 @@ class NamesIT { nameElementCommandConfirm.setUuid(createdNameElement.getUuid()); ITUtilNameElement.assertValidate(nameElementCommandConfirm, NameCommand.DELETE, Boolean.TRUE); - - -// nameElement.setDescription(null); -// ITUtilNameElement.assertValidate(nameElement, NameCommand.DELETE, Boolean.TRUE); -// -// nameElement.setDescription("checkDelete"); -// ITUtilNameElement.assertValidate(nameElement, NameCommand.DELETE, Boolean.TRUE); - nameElementCommandConfirm.setComment(null); ITUtilNameElement.assertValidate(nameElementCommandConfirm, NameCommand.DELETE, Boolean.FALSE); nameElementCommandConfirm.setComment("checkDelete"); ITUtilNameElement.assertValidate(nameElementCommandConfirm, NameCommand.DELETE, Boolean.TRUE); - -// // system structure not used for validation -// -// nameElement.setParentSystemStructure(systemGroupAcc); -// ITUtilNameElement.assertValidate(nameElement, NameCommand.DELETE, Boolean.TRUE); -// -// nameElement.setParentSystemStructure(null); -// ITUtilNameElement.assertValidate(nameElement, NameCommand.DELETE, Boolean.TRUE); -// -// nameElement.setParentSystemStructure(systemRFQ); -// ITUtilNameElement.assertValidate(nameElement, NameCommand.DELETE, Boolean.TRUE); -// -// nameElement.setParentSystemStructure(null); -// ITUtilNameElement.assertValidate(nameElement, NameCommand.DELETE, Boolean.TRUE); -// -// nameElement.setParentSystemStructure(subsystem010PRL); -// ITUtilNameElement.assertValidate(nameElement, NameCommand.DELETE, Boolean.TRUE); -// -// // device type not used for validation -// -// nameElement.setParentDeviceStructure(deviceTypeRFA); -// ITUtilNameElement.assertValidate(nameElement, NameCommand.DELETE, Boolean.TRUE); -// -// // index not used for validation -// -// nameElement.setIndex(null); -// ITUtilNameElement.assertValidate(nameElement, NameCommand.DELETE, Boolean.TRUE); -// -// nameElement.setIndex("055"); -// ITUtilNameElement.assertValidate(nameElement, NameCommand.DELETE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -791,8 +757,7 @@ class NamesIT { // create createdNameElement = ITUtilNameElement.assertCreate(nameElementCommandCreate); -// nameElement = createdNameElement; - nameElementCommandConfirm = ITUtilNameElement.convert2NameElementCommandConfirm(createdNameElement); + nameElementCommandConfirm = NameElementUtil.convertElement2CommandConfirm(createdNameElement); ITUtilNameElement.assertValidate(nameElementCommandConfirm, NameCommand.DELETE, Boolean.TRUE); @@ -802,8 +767,7 @@ class NamesIT { // delete deletedNameElement = ITUtilNameElement.assertDelete(nameElementCommandConfirm); -// nameElement = deletedNameElement; - nameElementCommandConfirm = ITUtilNameElement.convert2NameElementCommandConfirm(deletedNameElement); + nameElementCommandConfirm = NameElementUtil.convertElement2CommandConfirm(deletedNameElement); ITUtilNameElement.assertValidate(nameElementCommandConfirm, NameCommand.DELETE, Boolean.FALSE); } catch (Exception e) { @@ -879,25 +843,22 @@ class NamesIT { nameElement8 = responseNameElement; // update element 1 twice -// nameElement = nameElement1; - nameElementCommandUpdate = ITUtilNameElement.convert2NameElementCommandUpdate(nameElement1); + nameElementCommandUpdate = NameElementUtil.convertElement2CommandUpdate(nameElement1); nameElementCommandUpdate.setDescription("updated description"); nameElementCommandUpdate.setComment("updated comment"); responseNameElement = ITUtilNameElement.assertUpdate(nameElementCommandUpdate); -// nameElement = responseNameElement; - nameElementCommandUpdate = ITUtilNameElement.convert2NameElementCommandUpdate(responseNameElement); + nameElementCommandUpdate = NameElementUtil.convertElement2CommandUpdate(responseNameElement); nameElementCommandUpdate.setDescription("updated description again"); nameElementCommandUpdate.setComment("updated comment again"); responseNameElement = ITUtilNameElement.assertUpdate(nameElementCommandUpdate); -// nameElement = responseNameElement; // delete element 7, 8 - nameElementCommandConfirm = ITUtilNameElement.convert2NameElementCommandConfirm(nameElement7); + nameElementCommandConfirm = NameElementUtil.convertElement2CommandConfirm(nameElement7); responseNameElement = ITUtilNameElement.assertDelete(nameElementCommandConfirm); - nameElementCommandConfirm = ITUtilNameElement.convert2NameElementCommandConfirm(nameElement8); + nameElementCommandConfirm = NameElementUtil.convertElement2CommandConfirm(nameElement8); responseNameElement = ITUtilNameElement.assertDelete(nameElementCommandConfirm); try { diff --git a/src/test/java/org/openepics/names/docker/StructuresDeviceGroupIT.java b/src/test/java/org/openepics/names/docker/StructuresDeviceGroupIT.java index 00438e6efe18925cde13dc9e0e1d84ef57f8179d..4a53260585837c63d4bc452c32e92c955fef64e6 100644 --- a/src/test/java/org/openepics/names/docker/StructuresDeviceGroupIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresDeviceGroupIT.java @@ -32,7 +32,11 @@ import org.junit.jupiter.api.Test; import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.StructureElement; import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandConfirm; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; +import org.openepics.names.rest.beans.element.StructureElementCommandUpdate; import org.openepics.names.util.StructureCommand; +import org.openepics.names.util.StructureElementUtil; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -72,6 +76,14 @@ class StructuresDeviceGroupIT { // StructureElement extends StructureElementCommand // --> // for such operations that send Command objects to backend, it is also possible to send StructureElement + // + // StructureElementCommand + // create - type, parent, name, mnemonic, description, comment + // update - uuid, type, parent, name, mnemonic, description, comment + // delete - uuid, type, comment + // approve - uuid, type, comment + // cancel - uuid, type, comment + // reject - uuid, type, comment @Container public static final DockerComposeContainer<?> ENVIRONMENT = @@ -85,21 +97,21 @@ class StructuresDeviceGroupIT { public static void initAll() { // init discipline - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement approvedStructureElement = null; - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "Di", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineUuid = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "Di2", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); discipline2Uuid = approvedStructureElement.getUuid(); } @@ -134,7 +146,7 @@ class StructuresDeviceGroupIT { // comment try { - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = new StructureElementCommandCreate(); ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Cc", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "CC", Boolean.FALSE); @@ -144,34 +156,34 @@ class StructuresDeviceGroupIT { ITUtilStructureElement.assertValidate("[{asdf]", StructureCommand.CREATE, HttpURLConnection.HTTP_BAD_REQUEST); ITUtilStructureElement.assertCreate("[{asdf]", HttpURLConnection.HTTP_BAD_REQUEST); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setType(Type.DEVICEGROUP); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setType(Type.DEVICEGROUP); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setParent(disciplineUuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setParent(disciplineUuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setName("name"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setDescription("description"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setType(Type.DEVICEGROUP); - structureElement.setMnemonic("Cc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setType(Type.DEVICEGROUP); + structureElementCommandCreate.setMnemonic("Cc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); } catch (IOException e) { fail(); } catch (Exception e) { @@ -191,101 +203,101 @@ class StructuresDeviceGroupIT { // note // mnemonic try { - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = new StructureElementCommandCreate(); - structureElement.setType(Type.DEVICEGROUP); - structureElement.setParent(disciplineUuid); - structureElement.setName("name"); - structureElement.setDescription("description"); - structureElement.setComment("comment"); + structureElementCommandCreate.setType(Type.DEVICEGROUP); + structureElementCommandCreate.setParent(disciplineUuid); + structureElementCommandCreate.setName("name"); + structureElementCommandCreate.setDescription("description"); + structureElementCommandCreate.setComment("comment"); // mnemonic rules - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic(""); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic(""); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("C"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("C"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Cc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Cc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Ccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Ccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Cccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Cccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Ccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Ccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Cccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Cccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Ccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Ccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Cccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Cccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Ccccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Ccccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); // mnemonic rules (2) - structureElement.setMnemonic(" "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(" "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Grp "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Grp "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Grp"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Grp"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("000"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("000"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Grp0"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Grp0"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic(":"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(":"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Grp:"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Grp:"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Grp: "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Grp: "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("1"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("1"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("12"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("12"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("123"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("123"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("1234"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("1234"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("12345"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("12345"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("123456"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("123456"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("1234567"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("1234567"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("12345678"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("12345678"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("123456789"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("123456789"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -306,46 +318,50 @@ class StructuresDeviceGroupIT { // create in order to approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); - ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "Di", Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); - UUID uuid = structureElement.getUuid(); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); + UUID uuid = structureElementCommandConfirm.getUuid(); - ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "Di", Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); - structureElement.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); + structureElementCommandConfirm.setUuid(uuid); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); - ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "Di", Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); +// structureElement.setUuid(null); +// ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); +// ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -366,46 +382,51 @@ class StructuresDeviceGroupIT { // create in order to cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); - ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "Di", Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); - UUID uuid = structureElement.getUuid(); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); + UUID uuid = structureElementCommandConfirm.getUuid(); - ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "Di", Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); - structureElement.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); + structureElementCommandConfirm.setUuid(uuid); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); - ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "Di", Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); +// structureElement.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -426,46 +447,51 @@ class StructuresDeviceGroupIT { // create in order to reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); - ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "Di", Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); - UUID uuid = structureElement.getUuid(); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); + UUID uuid = structureElementCommandConfirm.getUuid(); - ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "Di", Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); - structureElement.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); + structureElementCommandConfirm.setUuid(uuid); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); - ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists (Type.DEVICEGROUP, "Di", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "Di", Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); +// structureElement.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -499,66 +525,68 @@ class StructuresDeviceGroupIT { try { UUID uuid = null; - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); uuid = approvedStructureElement.getUuid(); // validate update - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setUuid(uuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setType(Type.SYSTEM); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setType(Type.SYSTEM); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setType(Type.DEVICEGROUP); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setType(Type.DEVICEGROUP); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setParent(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setParent(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setParent(disciplineUuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setParent(disciplineUuid); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setName(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setName(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setName("name"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setMnemonic("Cu"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setMnemonic("Cu"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setMnemonic(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setDescription(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setDescription(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setDescription("description"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setComment(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setComment(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -581,33 +609,37 @@ class StructuresDeviceGroupIT { // create, approve in order to update, approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update approve check"); + structureElementCommandUpdate.setComment("comment update approve check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -632,33 +664,37 @@ class StructuresDeviceGroupIT { // create, approve in order to update, cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update cancel check"); + structureElementCommandUpdate.setComment("comment update cancel check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -683,33 +719,37 @@ class StructuresDeviceGroupIT { // create, approve in order to update, reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update reject check"); + structureElementCommandUpdate.setComment("comment update reject check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -739,66 +779,41 @@ class StructuresDeviceGroupIT { try { UUID uuid = null; - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); uuid = approvedStructureElement.getUuid(); // validate delete - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setUuid(uuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setType(Type.SYSTEM); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setType(Type.DEVICEGROUP); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setParent(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setParent(disciplineUuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setName(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setType(Type.DEVICEGROUP); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setMnemonic("Cd"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setComment(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setDescription(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setComment(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -821,33 +836,35 @@ class StructuresDeviceGroupIT { // create, approve in order to delete, approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment delete approve check"); + structureElementCommandConfirm.setComment("comment delete approve check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -872,33 +889,35 @@ class StructuresDeviceGroupIT { // create, approve in order to delete, cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update delete check"); + structureElementCommandConfirm.setComment("comment update delete check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -923,33 +942,35 @@ class StructuresDeviceGroupIT { // create, approve in order to delete, reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment delete reject check"); + structureElementCommandConfirm.setComment("comment delete reject check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -967,19 +988,21 @@ class StructuresDeviceGroupIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement approvedStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/DEVICEGROUP", 1, -1).getListSize(); @@ -1004,10 +1027,10 @@ class StructuresDeviceGroupIT { ITUtilStructureElement.assertRead("/history/" + createdStructureElement.getUuid().toString(), 1, -1); - ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di", Boolean.FALSE); // approve - approvedStructureElement = ITUtilStructureElement.assertApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertApprove(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/DEVICEGROUP", 1, -1).getListSize()); @@ -1032,7 +1055,7 @@ class StructuresDeviceGroupIT { ITUtilStructureElement.assertRead("/history/" + approvedStructureElement.getUuid().toString(), 1, -1); - ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di", Boolean.FALSE); } catch (Exception e) { fail(); } @@ -1050,19 +1073,21 @@ class StructuresDeviceGroupIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement cancelledStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/DEVICEGROUP", 1, -1).getListSize(); @@ -1087,10 +1112,10 @@ class StructuresDeviceGroupIT { ITUtilStructureElement.assertRead("/history/" + createdStructureElement.getUuid().toString(), 1, -1); - ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di", Boolean.FALSE); // cancel - cancelledStructureElement = ITUtilStructureElement.assertCancel(structureElement); + cancelledStructureElement = ITUtilStructureElement.assertCancel(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/DEVICEGROUP", 1, -1).getListSize()); @@ -1115,7 +1140,7 @@ class StructuresDeviceGroupIT { ITUtilStructureElement.assertRead("/history/" + cancelledStructureElement.getUuid().toString(), 1, -1); - ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di", Boolean.FALSE); } catch (Exception e) { fail(); } @@ -1133,19 +1158,21 @@ class StructuresDeviceGroupIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement rejectedStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/DEVICEGROUP", 1, -1).getListSize(); @@ -1170,10 +1197,10 @@ class StructuresDeviceGroupIT { ITUtilStructureElement.assertRead("/history/" + createdStructureElement.getUuid().toString(), 1, -1); - ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di", Boolean.FALSE); // reject - rejectedStructureElement = ITUtilStructureElement.assertReject(structureElement); + rejectedStructureElement = ITUtilStructureElement.assertReject(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/DEVICEGROUP", 1, -1).getListSize()); @@ -1198,7 +1225,7 @@ class StructuresDeviceGroupIT { ITUtilStructureElement.assertRead("/history/" + rejectedStructureElement.getUuid().toString(), 1); - ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di", Boolean.FALSE); } catch (Exception e) { fail(); } @@ -1234,40 +1261,40 @@ class StructuresDeviceGroupIT { // ( include if latest ) // include if latest not exists (considered present + future) - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement responseStructureElement = null; UUID uuid, uuid2, uuid3, uuid4 = null; // a number of entries for which the last entry has status PENDING - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); uuid = responseStructureElement.getUuid(); // a number of entries for which the last entry has status CANCELLED - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); uuid2 = responseStructureElement.getUuid(); // a number of entries for which the last entry has status REJECTED - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); uuid3 = responseStructureElement.getUuid(); // a number of entries for which the last entry has status APPROVED - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); uuid4 = responseStructureElement.getUuid(); try { @@ -1296,7 +1323,7 @@ class StructuresDeviceGroupIT { ITUtilStructureElement.assertRead("/history/" + uuid3.toString(), 1); ITUtilStructureElement.assertRead("/history/" + uuid4.toString(), 1); - ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di-P1", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di-C1", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di-R1", Boolean.FALSE); @@ -1336,109 +1363,114 @@ class StructuresDeviceGroupIT { // ( include if latest ) // include if latest not exists (considered present + future) - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; StructureElement responseStructureElement = null; UUID uuid, uuid2, uuid3, uuid4 = null; // a number of entries for which the last entry has status PENDING - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdate(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); // a number of entries for which the last entry has status CANCELLED - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid2 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); // a number of entries for which the last entry has status REJECTED - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid3 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); // a number of entries for which the last entry has status APPROVED - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid4 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); try { // from first structure element @@ -1466,7 +1498,7 @@ class StructuresDeviceGroupIT { ITUtilStructureElement.assertRead("/history/" + uuid3.toString(), 9); ITUtilStructureElement.assertRead("/history/" + uuid4.toString(), 9); - ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di", Boolean.TRUE); + ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di-P9", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di-C9", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di-R9", Boolean.FALSE); @@ -1492,280 +1524,282 @@ class StructuresDeviceGroupIT { // create (and more) to read (with content) // querying for Status.APPROVED means latest approved - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement responseStructureElement = null; UUID uuid = null; - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); uuid = responseStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); String description2 = "some other description"; String comment2 = "some other comment"; String description3 = "more description"; String comment3 = "more comment"; - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, discipline2Uuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, discipline2Uuid, "name", null, "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); // 60 device group entries @@ -1854,7 +1888,7 @@ class StructuresDeviceGroupIT { ITUtilStructureElement.assertRead("/history/" + uuid.toString(), 1); ITUtilStructureElement.assertRead("/history/" + discipline2Uuid.toString(), 1); - ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di2", Boolean.TRUE); + ITUtilStructureElement.assertExists(Type.DEVICEGROUP, "Di2", Boolean.FALSE); } catch (Exception e) { fail(); } diff --git a/src/test/java/org/openepics/names/docker/StructuresDeviceTypeIT.java b/src/test/java/org/openepics/names/docker/StructuresDeviceTypeIT.java index ee7f1c638b428892911f024df284fb8973818ab3..0212df55bb936c46d6abb21b10e6b9672520a556 100644 --- a/src/test/java/org/openepics/names/docker/StructuresDeviceTypeIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresDeviceTypeIT.java @@ -32,7 +32,11 @@ import org.junit.jupiter.api.Test; import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.StructureElement; import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandConfirm; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; +import org.openepics.names.rest.beans.element.StructureElementCommandUpdate; import org.openepics.names.util.StructureCommand; +import org.openepics.names.util.StructureElementUtil; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -72,6 +76,14 @@ class StructuresDeviceTypeIT { // StructureElement extends StructureElementCommand // --> // for such operations that send Command objects to backend, it is also possible to send StructureElement + // + // StructureElementCommand + // create - type, parent, name, mnemonic, description, comment + // update - uuid, type, parent, name, mnemonic, description, comment + // delete - uuid, type, comment + // approve - uuid, type, comment + // cancel - uuid, type, comment + // reject - uuid, type, comment @Container public static final DockerComposeContainer<?> ENVIRONMENT = @@ -85,21 +97,21 @@ class StructuresDeviceTypeIT { public static void initAll() { // init discipline, device group - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement approvedStructureElement = null; - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "Di", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineUuid = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupUuid = approvedStructureElement.getUuid(); } @@ -134,7 +146,7 @@ class StructuresDeviceTypeIT { // comment try { - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = new StructureElementCommandCreate(); ITUtilStructureElement.assertExists(Type.DEVICETYPE, "CC", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.DEVICETYPE, "Cc", Boolean.FALSE); @@ -156,34 +168,34 @@ class StructuresDeviceTypeIT { ITUtilStructureElement.assertValidate("[{asdf]", StructureCommand.CREATE, HttpURLConnection.HTTP_BAD_REQUEST); ITUtilStructureElement.assertCreate("[{asdf]", HttpURLConnection.HTTP_BAD_REQUEST); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setType(Type.DEVICETYPE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setType(Type.DEVICETYPE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setParent(deviceGroupUuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setParent(deviceGroupUuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setName("name"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setMnemonic("Cc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setMnemonic("Cc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setDescription("description"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); } catch (IOException e) { fail(); } catch (Exception e) { @@ -203,101 +215,101 @@ class StructuresDeviceTypeIT { // note // mnemonic try { - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = new StructureElementCommandCreate(); - structureElement.setType(Type.DEVICETYPE); - structureElement.setParent(deviceGroupUuid); - structureElement.setName("name"); - structureElement.setDescription("description"); - structureElement.setComment("comment"); + structureElementCommandCreate.setType(Type.DEVICETYPE); + structureElementCommandCreate.setParent(deviceGroupUuid); + structureElementCommandCreate.setName("name"); + structureElementCommandCreate.setDescription("description"); + structureElementCommandCreate.setComment("comment"); // mnemonic rules - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic(""); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(""); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("C"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("C"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Ccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Ccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Ccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Cccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Cccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Ccccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Ccccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); // mnemonic rules (2) - structureElement.setMnemonic(" "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(" "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Dev "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Dev "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Dev"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Dev"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("000"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("000"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Dev0"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Dev0"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic(":"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(":"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Dev:"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Dev:"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Dev: "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Dev: "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("1"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("1"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("12"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("12"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("123"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("123"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("1234"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("1234"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("12345"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("12345"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("123456"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("123456"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("1234567"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("1234567"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("12345678"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("12345678"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("123456789"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("123456789"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -318,38 +330,42 @@ class StructuresDeviceTypeIT { // create in order to approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.DEVICETYPE, deviceGroupUuid, "name", "Ca", "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); ITUtilStructureElement.assertExists (Type.DEVICETYPE, "Di-Ca", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-Ca", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); ITUtilStructureElement.assertExists (Type.DEVICETYPE, "Di-Ca", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-Ca", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); ITUtilStructureElement.assertExists (Type.DEVICETYPE, "Di-Ca", Boolean.TRUE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-Ca", Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -370,46 +386,51 @@ class StructuresDeviceTypeIT { // create in order to cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.DEVICETYPE, deviceGroupUuid, "name", "Cc", "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); ITUtilStructureElement.assertExists (Type.DEVICETYPE, "Di-Cc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-Cc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); - UUID uuid = structureElement.getUuid(); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); + UUID uuid = structureElementCommandConfirm.getUuid(); ITUtilStructureElement.assertExists (Type.DEVICETYPE, "Di-Cc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-Cc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); - structureElement.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); + structureElementCommandConfirm.setUuid(uuid); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); ITUtilStructureElement.assertExists (Type.DEVICETYPE, "Di-Cc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-Cc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); +// structureElement.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -430,46 +451,51 @@ class StructuresDeviceTypeIT { // create in order to reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.DEVICETYPE, deviceGroupUuid, "name", "Cr", "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); ITUtilStructureElement.assertExists (Type.DEVICETYPE, "Di-Cr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-Cr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); - UUID uuid = structureElement.getUuid(); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); + UUID uuid = structureElementCommandConfirm.getUuid(); ITUtilStructureElement.assertExists (Type.DEVICETYPE, "Di-Cr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-Cr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); - structureElement.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); + structureElementCommandConfirm.setUuid(uuid); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); ITUtilStructureElement.assertExists (Type.DEVICETYPE, "Di-Cr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-Cr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); +// structureElement.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -503,66 +529,68 @@ class StructuresDeviceTypeIT { try { UUID uuid = null; - StructureElementCommand structureElement = new StructureElement(); + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "Cu", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); uuid = approvedStructureElement.getUuid(); // validate update - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setUuid(uuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setType(Type.SUBSYSTEM); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setType(Type.SUBSYSTEM); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setType(Type.DEVICETYPE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setType(Type.DEVICETYPE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setParent(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setParent(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setParent(deviceGroupUuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setParent(deviceGroupUuid); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setName(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setName(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setName("name"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setMnemonic(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setMnemonic("Cu"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setMnemonic("Cu"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setDescription(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setDescription(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setDescription("description"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setComment(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setComment(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -585,33 +613,37 @@ class StructuresDeviceTypeIT { // create, approve in order to update, approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "Ua", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update approve check"); + structureElementCommandUpdate.setComment("comment update approve check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -636,33 +668,37 @@ class StructuresDeviceTypeIT { // create, approve in order to update, cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "Uc", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update cancel check"); + structureElementCommandUpdate.setComment("comment update cancel check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -687,33 +723,37 @@ class StructuresDeviceTypeIT { // create, approve in order to update, reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "Ur", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update reject check"); + structureElementCommandUpdate.setComment("comment update reject check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -743,66 +783,41 @@ class StructuresDeviceTypeIT { try { UUID uuid = null; - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "Cd", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); uuid = approvedStructureElement.getUuid(); // validate delete - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setUuid(uuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setType(Type.SUBSYSTEM); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setType(Type.DEVICETYPE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setParent(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setParent(deviceGroupUuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setName(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setType(Type.DEVICETYPE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setComment(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setMnemonic("Cd"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setDescription(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setComment(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -825,33 +840,35 @@ class StructuresDeviceTypeIT { // create, approve in order to delete, approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "Da", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment delete approve check"); + structureElementCommandConfirm.setComment("comment delete approve check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -876,33 +893,35 @@ class StructuresDeviceTypeIT { // create, approve in order to delete, cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "Dc", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update delete check"); + structureElementCommandConfirm.setComment("comment update delete check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -927,33 +946,35 @@ class StructuresDeviceTypeIT { // create, approve in order to delete, reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "Dr", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment delete reject check"); + structureElementCommandConfirm.setComment("comment delete reject check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -971,19 +992,21 @@ class StructuresDeviceTypeIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement approvedStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "Rsha", "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/DEVICETYPE", 1, -1).getListSize(); @@ -1012,7 +1035,7 @@ class StructuresDeviceTypeIT { ITUtilStructureElement.assertExists(Type.DEVICETYPE, "Di-Rsha", Boolean.FALSE); // approve - approvedStructureElement = ITUtilStructureElement.assertApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertApprove(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/DEVICETYPE", 1, -1).getListSize()); @@ -1056,19 +1079,21 @@ class StructuresDeviceTypeIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement cancelledStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "Rshc", "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/DEVICETYPE", 1, -1).getListSize(); @@ -1097,7 +1122,7 @@ class StructuresDeviceTypeIT { ITUtilStructureElement.assertExists(Type.DEVICETYPE, "Di-Rshc", Boolean.FALSE); // cancel - cancelledStructureElement = ITUtilStructureElement.assertCancel(structureElement); + cancelledStructureElement = ITUtilStructureElement.assertCancel(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/DEVICETYPE", 1, -1).getListSize()); @@ -1141,19 +1166,21 @@ class StructuresDeviceTypeIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement rejectedStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "Rshr", "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/DEVICETYPE", 1, -1).getListSize(); @@ -1182,7 +1209,7 @@ class StructuresDeviceTypeIT { ITUtilStructureElement.assertExists(Type.DEVICETYPE, "Di-Rshr", Boolean.FALSE); // reject - rejectedStructureElement = ITUtilStructureElement.assertReject(structureElement); + rejectedStructureElement = ITUtilStructureElement.assertReject(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/DEVICETYPE", 1, -1).getListSize()); @@ -1244,40 +1271,40 @@ class StructuresDeviceTypeIT { // ( include if latest ) // include if latest not exists (considered present + future) - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement responseStructureElement = null; UUID uuid, uuid2, uuid3, uuid4 = null; // a number of entries for which the last entry has status PENDING - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "P1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); uuid = responseStructureElement.getUuid(); // a number of entries for which the last entry has status CANCELLED - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "C1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); uuid2 = responseStructureElement.getUuid(); // a number of entries for which the last entry has status REJECTED - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "R1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); uuid3 = responseStructureElement.getUuid(); // a number of entries for which the last entry has status APPROVED - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "A1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); uuid4 = responseStructureElement.getUuid(); try { @@ -1349,109 +1376,114 @@ class StructuresDeviceTypeIT { // ( include if latest ) // include if latest not exists (considered present + future) - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; StructureElement responseStructureElement = null; UUID uuid, uuid2, uuid3, uuid4 = null; // a number of entries for which the last entry has status PENDING - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "P9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdate(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); // a number of entries for which the last entry has status CANCELLED - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "C9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid2 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); // a number of entries for which the last entry has status REJECTED - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "R9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid3 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); // a number of entries for which the last entry has status APPROVED - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "A9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid4 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); try { // from first structure element @@ -1508,280 +1540,282 @@ class StructuresDeviceTypeIT { // create (and more) to read (with content) // querying for Status.APPROVED means latest approved - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement responseStructureElement = null; UUID uuid = null; - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AA1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); uuid = responseStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AA2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AA3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AA4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AA5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AB1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AB2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AB3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AB4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AB5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AC1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AC2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AC3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AC4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AC5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AD1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AD2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AD3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AD4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AD5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); String description2 = "some other description"; String comment2 = "some other comment"; String description3 = "more description"; String comment3 = "more comment"; - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AE1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AE2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AE3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AE4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AE5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AF1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AF1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AF3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AF4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AF5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AG1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AG2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AG3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AG4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "AG5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); // 60 device type entries diff --git a/src/test/java/org/openepics/names/docker/StructuresDisciplineIT.java b/src/test/java/org/openepics/names/docker/StructuresDisciplineIT.java index 6e8e17389c4e755d85a8b2e3f0f5a5f404553fa8..9e5b63ecea30ad51ee69f68a296d3fd6bffebc29 100644 --- a/src/test/java/org/openepics/names/docker/StructuresDisciplineIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresDisciplineIT.java @@ -31,7 +31,11 @@ import org.junit.jupiter.api.Test; import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.StructureElement; import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandConfirm; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; +import org.openepics.names.rest.beans.element.StructureElementCommandUpdate; import org.openepics.names.util.StructureCommand; +import org.openepics.names.util.StructureElementUtil; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -71,6 +75,14 @@ class StructuresDisciplineIT { // StructureElement extends StructureElementCommand // --> // for such operations that send Command objects to backend, it is also possible to send StructureElement + // + // StructureElementCommand + // create - type, parent, name, mnemonic, description, comment + // update - uuid, type, parent, name, mnemonic, description, comment + // delete - uuid, type, comment + // approve - uuid, type, comment + // cancel - uuid, type, comment + // reject - uuid, type, comment @Container public static final DockerComposeContainer<?> ENVIRONMENT = @@ -107,7 +119,7 @@ class StructuresDisciplineIT { // comment try { - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = new StructureElementCommandCreate(); ITUtilStructureElement.assertExists(Type.DISCIPLINE, "Cc", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.DISCIPLINE, "CC", Boolean.FALSE); @@ -117,30 +129,30 @@ class StructuresDisciplineIT { ITUtilStructureElement.assertValidate("[{asdf]", StructureCommand.CREATE, HttpURLConnection.HTTP_BAD_REQUEST); ITUtilStructureElement.assertCreate("[{asdf]", HttpURLConnection.HTTP_BAD_REQUEST); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setType(Type.DISCIPLINE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setType(Type.DISCIPLINE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setName("name"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setMnemonic("Cc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setMnemonic("Cc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setDescription("description"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); } catch (IOException e) { fail(); } catch (Exception e) { @@ -160,100 +172,100 @@ class StructuresDisciplineIT { // note // mnemonic try { - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = new StructureElementCommandCreate(); - structureElement.setType(Type.DISCIPLINE); - structureElement.setName("name"); - structureElement.setDescription("description"); - structureElement.setComment("comment"); + structureElementCommandCreate.setType(Type.DISCIPLINE); + structureElementCommandCreate.setName("name"); + structureElementCommandCreate.setDescription("description"); + structureElementCommandCreate.setComment("comment"); // mnemonic rules - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic(""); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(""); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("C"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("C"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Ccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Ccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Ccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Cccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Cccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Ccccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Ccccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); // mnemonic rules (2) - structureElement.setMnemonic(" "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(" "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Dis "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Dis "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Dis"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Dis"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("000"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("000"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Dis0"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Dis0"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic(":"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(":"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Dis:"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Dis:"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Dis: "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Dis: "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("1"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("1"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("12"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("12"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("123"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("123"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("1234"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("1234"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("12345"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("12345"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("123456"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("123456"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("1234567"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("1234567"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("12345678"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("12345678"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("123456789"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("123456789"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -274,38 +286,42 @@ class StructuresDisciplineIT { // create in order to approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.DISCIPLINE, null, "name", "Ca", "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); ITUtilStructureElement.assertExists (Type.DISCIPLINE, "Ca", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DISCIPLINE, "Ca", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); ITUtilStructureElement.assertExists (Type.DISCIPLINE, "Ca", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DISCIPLINE, "Ca", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); ITUtilStructureElement.assertExists (Type.DISCIPLINE, "Ca", Boolean.TRUE); ITUtilStructureElement.assertIsValidToCreate(Type.DISCIPLINE, "Ca", Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -326,46 +342,51 @@ class StructuresDisciplineIT { // create in order to cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.DISCIPLINE, null, "name", "Cc", "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); ITUtilStructureElement.assertExists (Type.DISCIPLINE, "Cc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DISCIPLINE, "Cc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); - UUID uuid = structureElement.getUuid(); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); + UUID uuid = structureElementCommandConfirm.getUuid(); ITUtilStructureElement.assertExists (Type.DISCIPLINE, "Cc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DISCIPLINE, "Cc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); - structureElement.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); + structureElementCommandConfirm.setUuid(uuid); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); ITUtilStructureElement.assertExists (Type.DISCIPLINE, "Cc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DISCIPLINE, "Cc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); +// structureElement.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -386,46 +407,51 @@ class StructuresDisciplineIT { // create in order to reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.DISCIPLINE, null, "name", "Cr", "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); ITUtilStructureElement.assertExists (Type.DISCIPLINE, "Cr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DISCIPLINE, "Cr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); - UUID uuid = structureElement.getUuid(); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); + UUID uuid = structureElementCommandConfirm.getUuid(); ITUtilStructureElement.assertExists (Type.DISCIPLINE, "Cr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DISCIPLINE, "Cr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); - structureElement.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); + structureElementCommandConfirm.setUuid(uuid); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); ITUtilStructureElement.assertExists (Type.DISCIPLINE, "Cr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DISCIPLINE, "Cr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); +// structureElement.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -458,60 +484,62 @@ class StructuresDisciplineIT { try { UUID uuid = null; - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "Cu", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); uuid = approvedStructureElement.getUuid(); // validate update - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setUuid(uuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setType(Type.SYSTEMGROUP); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setType(Type.SYSTEMGROUP); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setType(Type.DISCIPLINE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setType(Type.DISCIPLINE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setName(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setName(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setName("name"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setMnemonic(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setMnemonic("Cu"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setMnemonic("Cu"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setDescription(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setDescription(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setDescription("description"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setComment(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setComment(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -534,33 +562,37 @@ class StructuresDisciplineIT { // create, approve in order to update, approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "Ua", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update approve check"); + structureElementCommandUpdate.setComment("comment update approve check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -585,33 +617,37 @@ class StructuresDisciplineIT { // create, approve in order to update, cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "Uc", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update cancel check"); + structureElementCommandUpdate.setComment("comment update cancel check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -636,33 +672,37 @@ class StructuresDisciplineIT { // create, approve in order to update, reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "Ur", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update reject check"); + structureElementCommandUpdate.setComment("comment update reject check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -692,60 +732,41 @@ class StructuresDisciplineIT { try { UUID uuid = null; - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "Cd", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); uuid = approvedStructureElement.getUuid(); // validate delete - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setUuid(uuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setType(Type.SYSTEMGROUP); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setType(Type.DISCIPLINE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setName(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setType(Type.DISCIPLINE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setMnemonic("Cd"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setComment(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setDescription(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setComment(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -768,33 +789,35 @@ class StructuresDisciplineIT { // create, approve in order to delete, approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "Da", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment delete approve check"); + structureElementCommandConfirm.setComment("comment delete approve check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -819,33 +842,35 @@ class StructuresDisciplineIT { // create, approve in order to delete, cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "Dc", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update delete check"); + structureElementCommandConfirm.setComment("comment update delete check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -870,33 +895,35 @@ class StructuresDisciplineIT { // create, approve in order to delete, reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "Dr", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment delete reject check"); + structureElementCommandConfirm.setComment("comment delete reject check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -914,19 +941,21 @@ class StructuresDisciplineIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement approvedStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "Rsha", "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/DISCIPLINE", 1, -1).getListSize(); @@ -950,7 +979,7 @@ class StructuresDisciplineIT { ITUtilStructureElement.assertExists(Type.DISCIPLINE, "Rsha", Boolean.FALSE); // approve - approvedStructureElement = ITUtilStructureElement.assertApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertApprove(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/DISCIPLINE", 1, -1).getListSize()); @@ -989,19 +1018,23 @@ class StructuresDisciplineIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement cancelledStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "Rshc", "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// StructureElementCommandCreate structureElementCommandCreate = null; +// StructureElementCommandConfirm structureElementCommandConfirm = null; +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/DISCIPLINE", 1, -1).getListSize(); @@ -1025,7 +1058,7 @@ class StructuresDisciplineIT { ITUtilStructureElement.assertExists(Type.DISCIPLINE, "Rshc", Boolean.FALSE); // cancel - cancelledStructureElement = ITUtilStructureElement.assertCancel(structureElement); + cancelledStructureElement = ITUtilStructureElement.assertCancel(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/DISCIPLINE", 1, -1).getListSize()); @@ -1064,19 +1097,21 @@ class StructuresDisciplineIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement rejectedStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "Rshr", "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/DISCIPLINE", 1, -1).getListSize(); @@ -1100,7 +1135,7 @@ class StructuresDisciplineIT { ITUtilStructureElement.assertExists(Type.DISCIPLINE, "Rshr", Boolean.FALSE); // reject - rejectedStructureElement = ITUtilStructureElement.assertReject(structureElement); + rejectedStructureElement = ITUtilStructureElement.assertReject(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/DISCIPLINE", 1, -1).getListSize()); @@ -1157,40 +1192,40 @@ class StructuresDisciplineIT { // ( include if latest ) // include if latest not exists (considered present + future) - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement responseStructureElement = null; UUID uuid, uuid2, uuid3, uuid4 = null; // a number of entries for which the last entry has status PENDING - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "P1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); uuid = responseStructureElement.getUuid(); // a number of entries for which the last entry has status CANCELLED - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "C1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); uuid2 = responseStructureElement.getUuid(); // a number of entries for which the last entry has status REJECTED - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "R1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); uuid3 = responseStructureElement.getUuid(); // a number of entries for which the last entry has status APPROVED - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "A1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); uuid4 = responseStructureElement.getUuid(); try { @@ -1258,109 +1293,114 @@ class StructuresDisciplineIT { // ( include if latest ) // include if latest not exists (considered present + future) - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; StructureElement responseStructureElement = null; UUID uuid, uuid2, uuid3, uuid4 = null; // a number of entries for which the last entry has status PENDING - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "P9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdate(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); // a number of entries for which the last entry has status CANCELLED - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "C9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid2 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); // a number of entries for which the last entry has status REJECTED - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "R9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid3 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); // a number of entries for which the last entry has status APPROVED - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "A9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid4 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); try { // from first structure element @@ -1413,280 +1453,282 @@ class StructuresDisciplineIT { // create (and more) to read (with content) // querying for Status.APPROVED means latest approved - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement responseStructureElement = null; UUID uuid = null; - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AA1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); uuid = responseStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AA2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AA3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AA4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AA5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AB1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AB2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AB3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AB4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AB5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AC1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AC2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AC3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AC4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AC5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AD1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AD2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AD3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AD4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AD5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); String description2 = "some other description"; String comment2 = "some other comment"; String description3 = "more description"; String comment3 = "more comment"; - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AE1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AE2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AE3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AE4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AE5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AF1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AF2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AF3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AF4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AF5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AG1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AG2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AG3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AG4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "AG5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); // 60 discipline entries diff --git a/src/test/java/org/openepics/names/docker/StructuresSubsystemIT.java b/src/test/java/org/openepics/names/docker/StructuresSubsystemIT.java index adaaef36c259411bcb883d25d4256dc7055b0c9e..39e07b97e9733f0ebfbbe45c80053065c9024cc2 100644 --- a/src/test/java/org/openepics/names/docker/StructuresSubsystemIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresSubsystemIT.java @@ -32,7 +32,11 @@ import org.junit.jupiter.api.Test; import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.StructureElement; import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandConfirm; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; +import org.openepics.names.rest.beans.element.StructureElementCommandUpdate; import org.openepics.names.util.StructureCommand; +import org.openepics.names.util.StructureElementUtil; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -72,6 +76,14 @@ class StructuresSubsystemIT { // StructureElement extends StructureElementCommand // --> // for such operations that send Command objects to backend, it is also possible to send StructureElement + // + // StructureElementCommand + // create - type, parent, name, mnemonic, description, comment + // update - uuid, type, parent, name, mnemonic, description, comment + // delete - uuid, type, comment + // approve - uuid, type, comment + // cancel - uuid, type, comment + // reject - uuid, type, comment @Container public static final DockerComposeContainer<?> ENVIRONMENT = @@ -85,21 +97,21 @@ class StructuresSubsystemIT { public static void initAll() { // init system group, system - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement approvedStructureElement = null; - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "Sg", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); systemGroupUuid = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "Sys", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); systemUuid = approvedStructureElement.getUuid(); } @@ -135,7 +147,7 @@ class StructuresSubsystemIT { // comment try { - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = new StructureElementCommandCreate(); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Cc", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "CC", Boolean.FALSE); @@ -158,34 +170,34 @@ class StructuresSubsystemIT { ITUtilStructureElement.assertValidate("[{asdf]", StructureCommand.CREATE, HttpURLConnection.HTTP_BAD_REQUEST); ITUtilStructureElement.assertCreate("[{asdf]", HttpURLConnection.HTTP_BAD_REQUEST); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setType(Type.SUBSYSTEM); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setType(Type.SUBSYSTEM); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setParent(systemUuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setParent(systemUuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setName("name"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setMnemonic("Cc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setMnemonic("Cc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setDescription("description"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); } catch (IOException e) { fail(); } catch (Exception e) { @@ -205,101 +217,101 @@ class StructuresSubsystemIT { // note // mnemonic try { - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = new StructureElementCommandCreate(); - structureElement.setType(Type.SUBSYSTEM); - structureElement.setParent(systemUuid); - structureElement.setName("name"); - structureElement.setDescription("description"); - structureElement.setComment("comment"); + structureElementCommandCreate.setType(Type.SUBSYSTEM); + structureElementCommandCreate.setParent(systemUuid); + structureElementCommandCreate.setName("name"); + structureElementCommandCreate.setDescription("description"); + structureElementCommandCreate.setComment("comment"); // mnemonic rules - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic(""); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(""); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("C"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("C"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Ccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Ccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Ccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Ccccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); // mnemonic rules (2) - structureElement.setMnemonic(" "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(" "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Sub "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Sub "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Sub"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Sub"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("000"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("000"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Sub0"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Sub0"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic(":"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(":"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Sub:"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Sub:"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Sub: "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Sub: "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("1"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("1"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("12"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("12"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("123"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("123"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("1234"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("1234"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("12345"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("12345"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("123456"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("123456"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("1234567"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("1234567"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("12345678"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("12345678"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("123456789"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("123456789"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -320,38 +332,42 @@ class StructuresSubsystemIT { // create in order to approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.SUBSYSTEM, systemUuid, "name", "Ca", "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); ITUtilStructureElement.assertExists (Type.SUBSYSTEM, "Sys-Ca", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SUBSYSTEM, "Sys-Ca", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); ITUtilStructureElement.assertExists (Type.SUBSYSTEM, "Sys-Ca", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SUBSYSTEM, "Sys-Ca", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); ITUtilStructureElement.assertExists (Type.SUBSYSTEM, "Sys-Ca", Boolean.TRUE); ITUtilStructureElement.assertIsValidToCreate(Type.SUBSYSTEM, "Sys-Ca", Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -372,46 +388,51 @@ class StructuresSubsystemIT { // create in order to cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.SUBSYSTEM, systemUuid, "name", "Cc", "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); ITUtilStructureElement.assertExists (Type.SUBSYSTEM, "Sys-Cc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SUBSYSTEM, "Sys-Cc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); - UUID uuid = structureElement.getUuid(); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); + UUID uuid = structureElementCommandConfirm.getUuid(); ITUtilStructureElement.assertExists (Type.SUBSYSTEM, "Sys-Cc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SUBSYSTEM, "Sys-Cc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); - structureElement.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); + structureElementCommandConfirm.setUuid(uuid); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); ITUtilStructureElement.assertExists (Type.SUBSYSTEM, "Sys-Cc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SUBSYSTEM, "Sys-Cc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); +// structureElement.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -432,46 +453,51 @@ class StructuresSubsystemIT { // create in order to reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.SUBSYSTEM, systemUuid, "name", "Cr", "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); ITUtilStructureElement.assertExists (Type.SUBSYSTEM, "Sys-Cr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SUBSYSTEM, "Sys-Cr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); - UUID uuid = structureElement.getUuid(); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); + UUID uuid = structureElementCommandConfirm.getUuid(); ITUtilStructureElement.assertExists (Type.SUBSYSTEM, "Sys-Cr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SUBSYSTEM, "Sys-Cr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); - structureElement.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); + structureElementCommandConfirm.setUuid(uuid); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); ITUtilStructureElement.assertExists (Type.SUBSYSTEM, "Sys-Cr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SUBSYSTEM, "Sys-Cr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); +// structureElement.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -505,66 +531,68 @@ class StructuresSubsystemIT { try { UUID uuid = null; - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "Cu", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); uuid = approvedStructureElement.getUuid(); // validate update - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setUuid(uuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setType(Type.DEVICETYPE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setType(Type.DEVICETYPE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setType(Type.SUBSYSTEM); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setType(Type.SUBSYSTEM); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setParent(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setParent(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setParent(systemUuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setParent(systemUuid); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setName(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setName(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setName("name"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setMnemonic(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setMnemonic("Cu"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setMnemonic("Cu"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setDescription(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setDescription(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setDescription("description"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setComment(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setComment(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -587,33 +615,37 @@ class StructuresSubsystemIT { // create, approve in order to update, approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "Ua", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update approve check"); + structureElementCommandUpdate.setComment("comment update approve check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -638,33 +670,37 @@ class StructuresSubsystemIT { // create, approve in order to update, cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "Uc", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update cancel check"); + structureElementCommandUpdate.setComment("comment update cancel check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -689,33 +725,37 @@ class StructuresSubsystemIT { // create, approve in order to update, reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "Ur", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update reject check"); + structureElementCommandUpdate.setComment("comment update reject check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -745,66 +785,41 @@ class StructuresSubsystemIT { try { UUID uuid = null; - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "Cd", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); uuid = approvedStructureElement.getUuid(); // validate delete - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setUuid(uuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setType(Type.DEVICETYPE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setType(Type.SUBSYSTEM); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setParent(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setParent(systemGroupUuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setName(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setType(Type.SUBSYSTEM); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setComment(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setMnemonic("Cd"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setDescription(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setComment(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -827,33 +842,35 @@ class StructuresSubsystemIT { // create, approve in order to delete, approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "Da", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment delete approve check"); + structureElementCommandConfirm.setComment("comment delete approve check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -878,33 +895,35 @@ class StructuresSubsystemIT { // create, approve in order to delete, cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "Dc", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update delete check"); + structureElementCommandConfirm.setComment("comment update delete check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -929,33 +948,35 @@ class StructuresSubsystemIT { // create, approve in order to delete, reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "Dr", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment delete reject check"); + structureElementCommandConfirm.setComment("comment delete reject check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -973,19 +994,21 @@ class StructuresSubsystemIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement approvedStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "Rsha", "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/SUBSYSTEM", 1, -1).getListSize(); @@ -1021,7 +1044,7 @@ class StructuresSubsystemIT { ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sg-Sys-Rsha", Boolean.FALSE); // approve - approvedStructureElement = ITUtilStructureElement.assertApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertApprove(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/SUBSYSTEM", 1, -1).getListSize()); @@ -1072,19 +1095,21 @@ class StructuresSubsystemIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement cancelledStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "Rshc", "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/SUBSYSTEM", 1, -1).getListSize(); @@ -1120,7 +1145,7 @@ class StructuresSubsystemIT { ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sg-Sys-Rshc", Boolean.FALSE); // cancel - cancelledStructureElement = ITUtilStructureElement.assertCancel(structureElement); + cancelledStructureElement = ITUtilStructureElement.assertCancel(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/SUBSYSTEM", 1, -1).getListSize()); @@ -1171,19 +1196,21 @@ class StructuresSubsystemIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement rejectedStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "Rshr", "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/SUBSYSTEM", 1, -1).getListSize(); @@ -1219,7 +1246,7 @@ class StructuresSubsystemIT { ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sg-Sys-Rshr", Boolean.FALSE); // reject - rejectedStructureElement = ITUtilStructureElement.assertReject(structureElement); + rejectedStructureElement = ITUtilStructureElement.assertReject(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/SUBSYSTEM", 1, -1).getListSize()); @@ -1288,40 +1315,40 @@ class StructuresSubsystemIT { // ( include if latest ) // include if latest not exists (considered present + future) - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement responseStructureElement = null; UUID uuid, uuid2, uuid3, uuid4 = null; // a number of entries for which the last entry has status PENDING - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "P1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); uuid = responseStructureElement.getUuid(); // a number of entries for which the last entry has status CANCELLED - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "C1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); uuid2 = responseStructureElement.getUuid(); // a number of entries for which the last entry has status REJECTED - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "R1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); uuid3 = responseStructureElement.getUuid(); // a number of entries for which the last entry has status APPROVED - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "A1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); uuid4 = responseStructureElement.getUuid(); try { @@ -1397,109 +1424,114 @@ class StructuresSubsystemIT { // ( include if latest ) // include if latest not exists (considered present + future) - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; StructureElement responseStructureElement = null; UUID uuid, uuid2, uuid3, uuid4 = null; // a number of entries for which the last entry has status PENDING - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "P9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdate(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); // a number of entries for which the last entry has status CANCELLED - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "C9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid2 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); // a number of entries for which the last entry has status REJECTED - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "R9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid3 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); // a number of entries for which the last entry has status APPROVED - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "A9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid4 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); try { // from first structure element @@ -1560,280 +1592,282 @@ class StructuresSubsystemIT { // create (and more) to read (with content) // querying for Status.APPROVED means latest approved - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement responseStructureElement = null; UUID uuid = null; - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AA1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); uuid = responseStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AA2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AA3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AA4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AA5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AB1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AB2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AB3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AB4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AB5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AC1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AC2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AC3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AC4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AC5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AD1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AD2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AD3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AD4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AD5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); String description2 = "some other description"; String comment2 = "some other comment"; String description3 = "more description"; String comment3 = "more comment"; - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AE1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AE2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AE3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AE4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AE5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AF1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AF2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AF3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AF4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AF5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AG1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AG2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AG3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AG4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "AG5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); // 60 subsystem entries diff --git a/src/test/java/org/openepics/names/docker/StructuresSystemGroupIT.java b/src/test/java/org/openepics/names/docker/StructuresSystemGroupIT.java index 25de030acd4380660cb82500329247ed724d15f1..e4e719f2a072e39b22a8c78da194f8574f7c8b83 100644 --- a/src/test/java/org/openepics/names/docker/StructuresSystemGroupIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresSystemGroupIT.java @@ -32,7 +32,11 @@ import org.junit.jupiter.api.Test; import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.StructureElement; import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandConfirm; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; +import org.openepics.names.rest.beans.element.StructureElementCommandUpdate; import org.openepics.names.util.StructureCommand; +import org.openepics.names.util.StructureElementUtil; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -72,6 +76,14 @@ class StructuresSystemGroupIT { // StructureElement extends StructureElementCommand // --> // for such operations that send Command objects to backend, it is also possible to send StructureElement + // + // StructureElementCommand + // create - type, parent, name, mnemonic, description, comment + // update - uuid, type, parent, name, mnemonic, description, comment + // delete - uuid, type, comment + // approve - uuid, type, comment + // cancel - uuid, type, comment + // reject - uuid, type, comment @Container public static final DockerComposeContainer<?> ENVIRONMENT = @@ -111,7 +123,7 @@ class StructuresSystemGroupIT { // comment try { - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = new StructureElementCommandCreate(); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "Cc", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "CC", Boolean.FALSE); @@ -123,36 +135,36 @@ class StructuresSystemGroupIT { ITUtilStructureElement.assertValidate("[{asdf]", StructureCommand.CREATE, HttpURLConnection.HTTP_BAD_REQUEST); ITUtilStructureElement.assertCreate("[{asdf]", HttpURLConnection.HTTP_BAD_REQUEST); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setType(Type.SYSTEMGROUP); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setType(Type.SYSTEMGROUP); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setName("name"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setMnemonic("Cc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setMnemonic("Cc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setDescription("description"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic(""); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic(""); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); } catch (IOException e) { fail(); } catch (Exception e) { @@ -172,106 +184,106 @@ class StructuresSystemGroupIT { // note // mnemonic try { - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = new StructureElementCommandCreate(); - structureElement.setType(Type.SYSTEMGROUP); - structureElement.setName("name"); - structureElement.setDescription("description"); - structureElement.setComment("comment"); + structureElementCommandCreate.setType(Type.SYSTEMGROUP); + structureElementCommandCreate.setName("name"); + structureElementCommandCreate.setDescription("description"); + structureElementCommandCreate.setComment("comment"); // mnemonic rules - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic(""); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic(""); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("C"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("C"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Ccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Ccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Ccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Cccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Cccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Ccccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Ccccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); // mnemonic rules (2) - structureElement.setMnemonic(" "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(" "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Sys "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Sys "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Sys"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Sys"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("000"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("000"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Sys0"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Sys0"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic(":"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(":"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Sys:"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Sys:"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Sys: "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Sys: "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("1"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("1"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("12"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("12"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("123"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("123"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("1234"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("1234"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("12345"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("12345"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("123456"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("123456"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("1234567"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("1234567"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("12345678"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("12345678"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("123456789"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("123456789"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Ac1"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Ac1"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Acc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Acc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -293,55 +305,61 @@ class StructuresSystemGroupIT { // with and without mnemonic try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; + StructureElement approvedStructureElement = null; UUID uuid, uuid2, uuid3 = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.SYSTEMGROUP, null, "name", "Ca", "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); ITUtilStructureElement.assertExists (Type.SYSTEMGROUP, "Ca", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEMGROUP, "Ca", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); uuid = createdStructureElement.getUuid(); ITUtilStructureElement.assertExists (Type.SYSTEMGROUP, "Ca", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEMGROUP, "Ca", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertApprove(structureElementCommandConfirm); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); ITUtilStructureElement.assertExists (Type.SYSTEMGROUP, "Ca", Boolean.TRUE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEMGROUP, "Ca", Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // create - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name2", null, "description2", "comment2"); - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); uuid2 = createdStructureElement.getUuid(); // create - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name3", null, "description3", "comment3"); - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); uuid3 = createdStructureElement.getUuid(); assertNotEquals(uuid, uuid2); @@ -367,46 +385,65 @@ class StructuresSystemGroupIT { // create in order to cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.SYSTEMGROUP, null, "name", "Cc", "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); ITUtilStructureElement.assertExists (Type.SYSTEMGROUP, "Cc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEMGROUP, "Cc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); - UUID uuid = structureElement.getUuid(); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElementCreate.setUuid(createdStructureElement.getUuid()); + UUID uuid = structureElementCommandConfirm.getUuid(); ITUtilStructureElement.assertExists (Type.SYSTEMGROUP, "Cc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEMGROUP, "Cc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); - structureElement.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); + structureElementCommandConfirm.setUuid(uuid); + + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); + structureElementCommandConfirm.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); + structureElementCommandConfirm.setType(Type.SYSTEMGROUP); + + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); + structureElementCommandConfirm.setComment(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); + structureElementCommandConfirm.setComment("comment"); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); ITUtilStructureElement.assertExists (Type.SYSTEMGROUP, "Cc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEMGROUP, "Cc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); +// structureElementCommandCreate.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -427,46 +464,51 @@ class StructuresSystemGroupIT { // create in order to reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.SYSTEMGROUP, null, "name", "Cr", "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); - ITUtilStructureElement.assertExists (Type.SYSTEMGROUP, "Cr", Boolean.FALSE); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "Cr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEMGROUP, "Cr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); - UUID uuid = structureElement.getUuid(); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElementCommandCreate.setUuid(createdStructureElement.getUuid()); + UUID uuid = structureElementCommandConfirm.getUuid(); - ITUtilStructureElement.assertExists (Type.SYSTEMGROUP, "Cr", Boolean.FALSE); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "Cr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEMGROUP, "Cr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); - structureElement.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); + structureElementCommandConfirm.setUuid(uuid); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); - ITUtilStructureElement.assertExists (Type.SYSTEMGROUP, "Cr", Boolean.FALSE); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "Cr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEMGROUP, "Cr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); +// structureElementCommandCreate.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -499,60 +541,62 @@ class StructuresSystemGroupIT { try { UUID uuid = null; - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "Cu", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); uuid = approvedStructureElement.getUuid(); // validate update - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setUuid(uuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setType(Type.DISCIPLINE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setType(Type.DISCIPLINE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setType(Type.SYSTEMGROUP); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setType(Type.SYSTEMGROUP); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setName(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setName(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setName("name"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setMnemonic(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setMnemonic("Cu"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setMnemonic("Cu"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setDescription(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setDescription(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setDescription("description"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setComment(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setComment(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -575,34 +619,38 @@ class StructuresSystemGroupIT { // create, approve in order to update, approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "Ua", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setDescription("description update approve check"); - structureElement.setComment("comment update approve check"); + structureElementCommandUpdate.setDescription("description update approve check"); + structureElementCommandUpdate.setComment("comment update approve check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -627,34 +675,38 @@ class StructuresSystemGroupIT { // create, approve in order to update, cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "Uc", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setDescription("description update cancel check"); - structureElement.setComment("comment update cancel check"); + structureElementCommandUpdate.setDescription("description update cancel check"); + structureElementCommandUpdate.setComment("comment update cancel check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -679,34 +731,38 @@ class StructuresSystemGroupIT { // create, approve in order to update, reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "Ur", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setDescription("description update reject check"); - structureElement.setComment("comment update reject check"); + structureElementCommandUpdate.setDescription("description update reject check"); + structureElementCommandUpdate.setComment("comment update reject check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -736,60 +792,41 @@ class StructuresSystemGroupIT { try { UUID uuid = null; - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "Cd", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); uuid = approvedStructureElement.getUuid(); // validate delete - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setUuid(uuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setType(Type.DISCIPLINE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); + structureElementCommandConfirm.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setType(Type.SYSTEMGROUP); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setName(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setType(Type.SYSTEMGROUP); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setComment(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setMnemonic("Cd"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setDescription(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setComment(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -812,33 +849,35 @@ class StructuresSystemGroupIT { // create, approve in order to delete, approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "Da", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment delete approve check"); + structureElementCommandConfirm.setComment("comment delete approve check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -863,33 +902,35 @@ class StructuresSystemGroupIT { // create, approve in order to delete, cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "Dc", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update delete check"); + structureElementCommandConfirm.setComment("comment update delete check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -914,33 +955,35 @@ class StructuresSystemGroupIT { // create, approve in order to delete, reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "Dr", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment delete reject check"); + structureElementCommandConfirm.setComment("comment delete reject check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -958,19 +1001,21 @@ class StructuresSystemGroupIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement approvedStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "Rsha", "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/SYSTEMGROUP", 1, -1).getListSize(); @@ -994,7 +1039,7 @@ class StructuresSystemGroupIT { ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "Rsha", Boolean.FALSE); // approve - approvedStructureElement = ITUtilStructureElement.assertApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertApprove(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/SYSTEMGROUP", 1, -1).getListSize()); @@ -1033,19 +1078,21 @@ class StructuresSystemGroupIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement cancelledStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "Rshc", "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/SYSTEMGROUP", 1, -1).getListSize(); @@ -1069,7 +1116,7 @@ class StructuresSystemGroupIT { ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "Rshc", Boolean.FALSE); // cancel - cancelledStructureElement = ITUtilStructureElement.assertCancel(structureElement); + cancelledStructureElement = ITUtilStructureElement.assertCancel(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/SYSTEMGROUP", 1, -1).getListSize()); @@ -1108,19 +1155,21 @@ class StructuresSystemGroupIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement rejectedStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "Rshr", "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/SYSTEMGROUP", 1, -1).getListSize(); @@ -1144,7 +1193,7 @@ class StructuresSystemGroupIT { ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "Rshr", Boolean.FALSE); // reject - rejectedStructureElement = ITUtilStructureElement.assertReject(structureElement); + rejectedStructureElement = ITUtilStructureElement.assertReject(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/SYSTEMGROUP", 1, -1).getListSize()); @@ -1201,40 +1250,40 @@ class StructuresSystemGroupIT { // ( include if latest ) // include if latest not exists (considered present + future) - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement responseStructureElement = null; UUID uuid, uuid2, uuid3, uuid4 = null; // a number of entries for which the last entry has status PENDING - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "P1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); uuid = responseStructureElement.getUuid(); // a number of entries for which the last entry has status CANCELLED - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "C1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); uuid2 = responseStructureElement.getUuid(); // a number of entries for which the last entry has status REJECTED - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "R1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); uuid3 = responseStructureElement.getUuid(); // a number of entries for which the last entry has status APPROVED - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "A1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); uuid4 = responseStructureElement.getUuid(); try { @@ -1302,109 +1351,114 @@ class StructuresSystemGroupIT { // ( include if latest ) // include if latest not exists (considered present + future) - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; StructureElement responseStructureElement = null; UUID uuid, uuid2, uuid3, uuid4 = null; // a number of entries for which the last entry has status PENDING - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "P9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdate(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); // a number of entries for which the last entry has status CANCELLED - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "C9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid2 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); // a number of entries for which the last entry has status REJECTED - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "R9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid3 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); // a number of entries for which the last entry has status APPROVED - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "A9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid4 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); try { // from first structure element @@ -1457,280 +1511,282 @@ class StructuresSystemGroupIT { // create (and more) to read (with content) // querying for Status.APPROVED means latest approved - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement responseStructureElement = null; UUID uuid = null; - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AA1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); uuid = responseStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AA2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AA3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AA4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AA5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AB1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AB2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AB3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AB4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AB5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AC1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AC2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AC3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AC4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AC5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AD1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AD2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AD3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AD4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AD5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); String description2 = "some other description"; String comment2 = "some other comment"; String description3 = "more description"; String comment3 = "more comment"; - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AE1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AE2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AE3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AE4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AE5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AF1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AF2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AF3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AF4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AF5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AG1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AG2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AG3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AG4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "AG5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); // 60 system group entries diff --git a/src/test/java/org/openepics/names/docker/StructuresSystemIT.java b/src/test/java/org/openepics/names/docker/StructuresSystemIT.java index 539eb4f44db173bfb183d0b91dbddf4785c69c59..89608208864d2f7b57a31ee61f297f2671b39f3c 100644 --- a/src/test/java/org/openepics/names/docker/StructuresSystemIT.java +++ b/src/test/java/org/openepics/names/docker/StructuresSystemIT.java @@ -32,7 +32,11 @@ import org.junit.jupiter.api.Test; import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.StructureElement; import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandConfirm; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; +import org.openepics.names.rest.beans.element.StructureElementCommandUpdate; import org.openepics.names.util.StructureCommand; +import org.openepics.names.util.StructureElementUtil; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -72,6 +76,14 @@ class StructuresSystemIT { // StructureElement extends StructureElementCommand // --> // for such operations that send Command objects to backend, it is also possible to send StructureElement + // + // StructureElementCommand + // create - type, parent, name, mnemonic, description, comment + // update - uuid, type, parent, name, mnemonic, description, comment + // delete - uuid, type, comment + // approve - uuid, type, comment + // cancel - uuid, type, comment + // reject - uuid, type, comment @Container public static final DockerComposeContainer<?> ENVIRONMENT = @@ -84,14 +96,14 @@ class StructuresSystemIT { public static void initAll() { // init system group - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement approvedStructureElement = null; - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "Sg", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); systemGroupUuid = approvedStructureElement.getUuid(); } @@ -126,7 +138,7 @@ class StructuresSystemIT { // comment try { - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = new StructureElementCommandCreate(); ITUtilStructureElement.assertExists(Type.SYSTEM, "Cc", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "CC", Boolean.FALSE); @@ -142,34 +154,34 @@ class StructuresSystemIT { ITUtilStructureElement.assertValidate("[{asdf]", StructureCommand.CREATE, HttpURLConnection.HTTP_BAD_REQUEST); ITUtilStructureElement.assertCreate("[{asdf]", HttpURLConnection.HTTP_BAD_REQUEST); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setType(Type.SYSTEM); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setType(Type.SYSTEM); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setParent(systemGroupUuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setParent(systemGroupUuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setName("name"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setMnemonic("Cc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setMnemonic("Cc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertCreate(structureElement, ITUtil.HTTP_UNPROCESSABLE_ENTITY); + structureElementCommandCreate.setDescription("description"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertCreate(structureElementCommandCreate, ITUtil.HTTP_UNPROCESSABLE_ENTITY); - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); } catch (IOException e) { fail(); } catch (Exception e) { @@ -189,100 +201,100 @@ class StructuresSystemIT { // note // mnemonic try { - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = new StructureElementCommandCreate(); - structureElement.setType(Type.SYSTEM); - structureElement.setParent(systemGroupUuid); - structureElement.setName("name"); - structureElement.setDescription("description"); - structureElement.setComment("comment"); + structureElementCommandCreate.setType(Type.SYSTEM); + structureElementCommandCreate.setParent(systemGroupUuid); + structureElementCommandCreate.setName("name"); + structureElementCommandCreate.setDescription("description"); + structureElementCommandCreate.setComment("comment"); // mnemonic rules - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("C"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("C"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Ccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Ccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Ccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Cccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Cccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Ccccccccc"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Ccccccccc"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); // mnemonic rules (2) - structureElement.setMnemonic(" "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(" "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Sys "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Sys "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Sys"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Sys"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("000"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("000"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("Sys0"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("Sys0"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic(":"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic(":"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Sys:"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Sys:"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("Sys: "); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("Sys: "); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); - structureElement.setMnemonic("1"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("1"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("12"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("12"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("123"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("123"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("1234"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("1234"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("12345"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("12345"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("123456"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("123456"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("1234567"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("1234567"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("12345678"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandCreate.setMnemonic("12345678"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); - structureElement.setMnemonic("123456789"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandCreate.setMnemonic("123456789"); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -303,38 +315,42 @@ class StructuresSystemIT { // create in order to approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.SYSTEM, systemGroupUuid, "name", "Ca", "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); ITUtilStructureElement.assertExists (Type.SYSTEM, "Ca", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEM, "Ca", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); ITUtilStructureElement.assertExists (Type.SYSTEM, "Ca", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEM, "Ca", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); ITUtilStructureElement.assertExists (Type.SYSTEM, "Ca", Boolean.TRUE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEM, "Ca", Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -355,46 +371,51 @@ class StructuresSystemIT { // create in order to cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.SYSTEM, systemGroupUuid, "name", "Cc", "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); ITUtilStructureElement.assertExists (Type.SYSTEM, "Cc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEM, "Cc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); - UUID uuid = structureElement.getUuid(); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); + UUID uuid = structureElementCommandConfirm.getUuid(); ITUtilStructureElement.assertExists (Type.SYSTEM, "Cc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEM, "Cc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); - structureElement.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); + structureElementCommandConfirm.setUuid(uuid); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); ITUtilStructureElement.assertExists (Type.SYSTEM, "Cc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEM, "Cc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); +// structureElement.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -415,46 +436,51 @@ class StructuresSystemIT { // create in order to reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElementCommand structureElementCommand = null; StructureElement createdStructureElement = null; - structureElement = new StructureElementCommand( + structureElementCommand = new StructureElementCommand( null, Type.SYSTEM, systemGroupUuid, "name", "Cr", "description", "comment"); + structureElementCommandCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommand); + structureElementCommandConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommand); ITUtilStructureElement.assertExists (Type.SYSTEM, "Cr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEM, "Cr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); - UUID uuid = structureElement.getUuid(); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); + UUID uuid = structureElementCommandConfirm.getUuid(); ITUtilStructureElement.assertExists (Type.SYSTEM, "Cr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEM, "Cr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); - structureElement.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); + structureElementCommandConfirm.setUuid(uuid); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); ITUtilStructureElement.assertExists (Type.SYSTEM, "Cr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.SYSTEM, "Cr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); +// structureElement.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -488,66 +514,68 @@ class StructuresSystemIT { try { UUID uuid = null; - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "Cu", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); uuid = approvedStructureElement.getUuid(); // validate update - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setUuid(uuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setType(Type.DEVICEGROUP); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setType(Type.DEVICEGROUP); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setType(Type.SYSTEM); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setType(Type.SYSTEM); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setParent(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setParent(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setParent(systemGroupUuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setParent(systemGroupUuid); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setName(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setName(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setName("name"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setMnemonic(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setMnemonic("Cu"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setMnemonic("Cu"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setDescription(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setDescription(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setDescription("description"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); - structureElement.setComment(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandUpdate.setComment(null); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandUpdate.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -570,33 +598,37 @@ class StructuresSystemIT { // create, approve in order to update, approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "Ua", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update approve check"); + structureElementCommandUpdate.setComment("comment update approve check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -621,33 +653,37 @@ class StructuresSystemIT { // create, approve in order to update, cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "Uc", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update cancel check"); + structureElementCommandUpdate.setComment("comment update cancel check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -672,33 +708,37 @@ class StructuresSystemIT { // create, approve in order to update, reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "Ur", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update reject check"); + structureElementCommandUpdate.setComment("comment update reject check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // update - ITUtilStructureElement.assertUpdate(structureElement); + ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -728,66 +768,41 @@ class StructuresSystemIT { try { UUID uuid = null; - StructureElementCommand structureElement = new StructureElementCommand(); + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "Cd", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); uuid = approvedStructureElement.getUuid(); // validate delete - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setUuid(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setUuid(uuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setType(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setType(Type.DEVICEGROUP); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setType(Type.SYSTEM); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setParent(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setParent(systemGroupUuid); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setName(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setName("name"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setType(Type.SYSTEM); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); - structureElement.setMnemonic(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setComment(null); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); - structureElement.setMnemonic("Cd"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setDescription(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setDescription("description"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - - structureElement.setComment(null); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - - structureElement.setComment("comment"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); + structureElementCommandConfirm.setComment("comment"); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -810,33 +825,35 @@ class StructuresSystemIT { // create, approve in order to delete, approve try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "Da", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment delete approve check"); + structureElementCommandConfirm.setComment("comment delete approve check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.TRUE); // approve - ITUtilStructureElement.assertApprove(structureElement); + ITUtilStructureElement.assertApprove(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.APPROVE, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -861,33 +878,35 @@ class StructuresSystemIT { // create, approve in order to delete, cancel try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "Dc", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment update delete check"); + structureElementCommandConfirm.setComment("comment update delete check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.TRUE); // cancel - ITUtilStructureElement.assertCancel(structureElement); + ITUtilStructureElement.assertCancel(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.CANCEL, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -912,33 +931,35 @@ class StructuresSystemIT { // create, approve in order to delete, reject try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement approvedStructureElement = null; // create, approve - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "Dr", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement.setUuid(approvedStructureElement.getUuid()); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElement); +// structureElement.setUuid(approvedStructureElement.getUuid()); - structureElement.setComment("comment delete reject check"); + structureElementCommandConfirm.setComment("comment delete reject check"); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); // delete - ITUtilStructureElement.assertDelete(structureElement); + ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.TRUE); // reject - ITUtilStructureElement.assertReject(structureElement); + ITUtilStructureElement.assertReject(structureElementCommandConfirm); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElement, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -956,19 +977,21 @@ class StructuresSystemIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement approvedStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "Rsha", "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/SYSTEM", 1, -1).getListSize(); @@ -997,7 +1020,7 @@ class StructuresSystemIT { ITUtilStructureElement.assertExists(Type.SYSTEM, "Sg-Rsha", Boolean.FALSE); // approve - approvedStructureElement = ITUtilStructureElement.assertApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertApprove(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/SYSTEM", 1, -1).getListSize()); @@ -1041,19 +1064,21 @@ class StructuresSystemIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement cancelledStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "Rshc", "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/SYSTEM", 1, -1).getListSize(); @@ -1082,7 +1107,7 @@ class StructuresSystemIT { ITUtilStructureElement.assertExists(Type.SYSTEM, "Sg-Rshc", Boolean.FALSE); // cancel - cancelledStructureElement = ITUtilStructureElement.assertCancel(structureElement); + cancelledStructureElement = ITUtilStructureElement.assertCancel(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/SYSTEM", 1, -1).getListSize()); @@ -1126,19 +1151,21 @@ class StructuresSystemIT { // create (and more) to read (with content) try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement createdStructureElement = null; StructureElement rejectedStructureElement = null; int length = 0; - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "Rshr", "description", "comment"); // create - createdStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement.setUuid(createdStructureElement.getUuid()); + createdStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElement); +// structureElement.setUuid(createdStructureElement.getUuid()); // read (1) length = ITUtilStructureElement.assertRead("/SYSTEM", 1, -1).getListSize(); @@ -1167,7 +1194,7 @@ class StructuresSystemIT { ITUtilStructureElement.assertExists(Type.SYSTEM, "Sg-Rshr", Boolean.FALSE); // reject - rejectedStructureElement = ITUtilStructureElement.assertReject(structureElement); + rejectedStructureElement = ITUtilStructureElement.assertReject(structureElementCommandConfirm); // read (2) assertEquals(length, ITUtilStructureElement.assertRead("/SYSTEM", 1, -1).getListSize()); @@ -1229,40 +1256,40 @@ class StructuresSystemIT { // ( include if latest ) // include if latest not exists (considered present + future) - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement responseStructureElement = null; UUID uuid, uuid2, uuid3, uuid4 = null; // a number of entries for which the last entry has status PENDING - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "P1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); uuid = responseStructureElement.getUuid(); // a number of entries for which the last entry has status CANCELLED - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "C1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); uuid2 = responseStructureElement.getUuid(); // a number of entries for which the last entry has status REJECTED - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "R1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); uuid3 = responseStructureElement.getUuid(); // a number of entries for which the last entry has status APPROVED - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "A1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); uuid4 = responseStructureElement.getUuid(); try { @@ -1334,109 +1361,114 @@ class StructuresSystemIT { // ( include if latest ) // include if latest not exists (considered present + future) - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; StructureElement responseStructureElement = null; UUID uuid, uuid2, uuid3, uuid4 = null; // a number of entries for which the last entry has status PENDING - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "P9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdate(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdate(structureElementCommandUpdate); // a number of entries for which the last entry has status CANCELLED - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "C9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid2 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); // a number of entries for which the last entry has status REJECTED - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "R9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid3 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); // a number of entries for which the last entry has status APPROVED - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "A9", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); uuid4 = responseStructureElement.getUuid(); - responseStructureElement.setComment("comment 2"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 3"); - responseStructureElement = ITUtilStructureElement.assertUpdateCancel(responseStructureElement); - responseStructureElement.setComment("comment 4"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 5"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 6"); - responseStructureElement = ITUtilStructureElement.assertUpdateReject(responseStructureElement); - responseStructureElement.setComment("comment 7"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 8"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); - responseStructureElement.setComment("comment 9"); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(responseStructureElement); + structureElementCommandUpdate.setComment("comment 2"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 3"); + responseStructureElement = ITUtilStructureElement.assertUpdateCancel(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 4"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 5"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 6"); + responseStructureElement = ITUtilStructureElement.assertUpdateReject(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 7"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 8"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate.setComment("comment 9"); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); try { // from first structure element @@ -1493,280 +1525,282 @@ class StructuresSystemIT { // create (and more) to read (with content) // querying for Status.APPROVED means latest approved - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElement responseStructureElement = null; UUID uuid = null; - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AA1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); uuid = responseStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AA2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AA3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AA4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AA5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AB1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AB2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AB3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AB4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AB5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateCancel(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AC1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AC2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AC3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AC4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AC5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateReject(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AD1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AD2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AD3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AD4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AD5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreate(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreate(structureElementCommandCreate); String description2 = "some other description"; String comment2 = "some other comment"; String description3 = "more description"; String comment3 = "more comment"; - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AE1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AE2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AE3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AE4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AE5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description2); - structureElement.setComment(comment2); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - structureElement.setDescription(description3); - structureElement.setComment(comment3); - responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElement); - - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description2); + structureElementCommandUpdate.setComment(comment2); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responseStructureElement); + structureElementCommandUpdate.setDescription(description3); + structureElementCommandUpdate.setComment(comment3); + responseStructureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteReject(structureElementCommandConfirm); + + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AF1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AF2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AF3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AF4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AF5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AG1", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AG2", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AG3", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AG4", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "AG5", "description", "comment"); - responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); - structureElement = responseStructureElement; - responseStructureElement = ITUtilStructureElement.assertDelete(structureElement); + responseStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responseStructureElement); + responseStructureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); // 60 system entries diff --git a/src/test/java/org/openepics/names/docker/complex/NamesInstanceIndexIT.java b/src/test/java/org/openepics/names/docker/complex/NamesInstanceIndexIT.java index 076b392737cdcdd760eeae7dc612e6d72f7fb700..c8357ffd88eaafde5d5b7242a436a350256d8b4c 100644 --- a/src/test/java/org/openepics/names/docker/complex/NamesInstanceIndexIT.java +++ b/src/test/java/org/openepics/names/docker/complex/NamesInstanceIndexIT.java @@ -32,6 +32,7 @@ import org.openepics.names.rest.beans.element.NameElementCommand; import org.openepics.names.rest.beans.element.NameElementCommandCreate; import org.openepics.names.rest.beans.element.StructureElement; import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; import org.openepics.names.util.NameCommand; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; @@ -140,399 +141,399 @@ class NamesInstanceIndexIT { public static void initAll() { // init system group, system, subsystem, discipline, device group, device type - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement approvedStructureElement = null; - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "Accelerator", "Acc", "The ESS Linear Accelerator", "approved by alfio"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); systemGroupAcc = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupAcc, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupAcc, "Radio Frequency Quadrupole", "RFQ", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); systemRFQ = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemRFQ, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemRFQ, "01 Phase Reference Line", "010PRL", "empty", "Approved by Daniel Piso"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); subsystem010PRL = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemRFQ, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemRFQ, "RFQ-010", "010", "empty", "Approved by Daniel Piso"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); subsystem010 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemRFQ, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemRFQ, "Power switch board 01", "N1U1", "Electrical power cabinets", "Approved by Daniel Piso"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); subsystemN1U1 = approvedStructureElement.getUuid(); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "Cryogenics", "Cryo", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineCryo = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "Electromagnetic Resonators", "EMR", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineEMR = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "Heating, Cooling and Air Conditioning", "HVAC", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineHVAC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "General Process Control", "Proc", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineProc = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "Software Controllers", "SC", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineSC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "Vacuum", "Vac", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineVac = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "Water Cooling", "WtrC", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineWtrC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "Beam Magnets and Deflectors", "BMD", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineBMD = approvedStructureElement.getUuid(); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineCryo, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineCryo, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupCryo = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineEMR, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineEMR, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupEMR = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineHVAC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineHVAC, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupHVAC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineProc, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineProc, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupProc = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineSC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineSC, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupSC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineVac, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineVac, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupVac = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineWtrC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineWtrC, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupWtrC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineBMD, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineBMD, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupBMD = approvedStructureElement.getUuid(); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupCryo, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupCryo, "Flow Switch", "FS", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_Cryo_FS = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupCryo, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupCryo, "Input Output Controller", "IOC", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_Cryo_IOC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupCryo, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupCryo, "RF Antenna", "RFA", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_Cryo_RFA = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupCryo, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupCryo, "Temperature Transmitter", "TT", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_Cryo_TT = approvedStructureElement.getUuid(); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupEMR, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupEMR, "Flow Switch", "FS", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_EMR_FS = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupEMR, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupEMR, "Input Output Controller", "IOC", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_EMR_IOC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupEMR, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupEMR, "RF Antenna", "RFA", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_EMR_RFA = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupEMR, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupEMR, "Temperature Transmitter", "TT", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_EMR_TT = approvedStructureElement.getUuid(); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupHVAC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupHVAC, "Flow Switch", "FS", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_HVAC_FS = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupHVAC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupHVAC, "Input Output Controller", "IOC", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_HVAC_IOC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupHVAC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupHVAC, "RF Antenna", "RFA", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_HVAC_RFA = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupHVAC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupHVAC, "Temperature Transmitter", "TT", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_HVAC_TT = approvedStructureElement.getUuid(); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupProc, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupProc, "Flow Switch", "FS", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_Proc_FS = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupProc, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupProc, "Input Output Controller", "IOC", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_Proc_IOC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupProc, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupProc, "RF Antenna", "RFA", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_Proc_RFA = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupProc, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupProc, "Temperature Transmitter", "TT", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_Proc_TT = approvedStructureElement.getUuid(); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupSC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupSC, "Flow Switch", "FS", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_SC_FS = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupSC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupSC, "Input Output Controller", "IOC", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_SC_IOC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupSC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupSC, "RF Antenna", "RFA", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_SC_RFA = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupSC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupSC, "Temperature Transmitter", "TT", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_SC_TT = approvedStructureElement.getUuid(); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupVac, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupVac, "Flow Switch", "FS", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_Vac_FS = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupVac, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupVac, "Input Output Controller", "IOC", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_Vac_IOC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupVac, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupVac, "RF Antenna", "RFA", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_Vac_RFA = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupVac, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupVac, "Temperature Transmitter", "TT", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_Vac_TT = approvedStructureElement.getUuid(); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupWtrC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupWtrC, "Flow Switch", "FS", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_WtrC_FS = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupWtrC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupWtrC, "Input Output Controller", "IOC", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_WtrC_IOC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupWtrC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupWtrC, "RF Antenna", "RFA", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_WtrC_RFA = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupWtrC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupWtrC, "Temperature Transmitter", "TT", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_WtrC_TT = approvedStructureElement.getUuid(); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupBMD, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupBMD, "Flow Switch", "FS", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_BMD_FS = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupBMD, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupBMD, "Input Output Controller", "IOC", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_BMD_IOC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupBMD, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupBMD, "RF Antenna", "RFA", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_BMD_RFA = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupBMD, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupBMD, "Temperature Transmitter", "TT", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_BMD_TT = approvedStructureElement.getUuid(); } diff --git a/src/test/java/org/openepics/names/docker/complex/NamesMultipleIT.java b/src/test/java/org/openepics/names/docker/complex/NamesMultipleIT.java index ecc895d73fc3d9c50896e29ed74ead14f2a8b5c1..d872bd1a43f42dc73ce540cc2b98d683d7b9c9c1 100644 --- a/src/test/java/org/openepics/names/docker/complex/NamesMultipleIT.java +++ b/src/test/java/org/openepics/names/docker/complex/NamesMultipleIT.java @@ -32,12 +32,14 @@ import org.openepics.names.docker.ITUtilNameElement; import org.openepics.names.docker.ITUtilStructureElement; import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.NameElement; +import org.openepics.names.rest.beans.element.NameElementCommand; import org.openepics.names.rest.beans.element.NameElementCommandConfirm; import org.openepics.names.rest.beans.element.NameElementCommandCreate; import org.openepics.names.rest.beans.element.NameElementCommandUpdate; import org.openepics.names.rest.beans.element.StructureElement; -import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; import org.openepics.names.util.NameCommand; +import org.openepics.names.util.NameElementUtil; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -82,49 +84,49 @@ class NamesMultipleIT { public static void initAll() { // init system group, system, subsystem, discipline, device group, device type - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement approvedStructureElement = null; - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "Accelerator", "Acc", "The ESS Linear Accelerator", "approved by alfio"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); systemGroupAcc = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupAcc, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupAcc, "Radio Frequency Quadrupole", "RFQ", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); systemRFQ = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemRFQ, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemRFQ, "01 Phase Reference Line", "010PRL", "empty", "Approved by Daniel Piso"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); subsystem010PRL = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "Cryogenics", "Cryo", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineCryo = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineCryo, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineCryo, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupCryo = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupCryo, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupCryo, "Flow Switch", "FS", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceType_Cryo_FS = approvedStructureElement.getUuid(); } @@ -147,42 +149,24 @@ class NamesMultipleIT { NameElementCommandCreate[] nameElementCommandsCreate = null; NameElementCommandUpdate[] nameElementCommandsUpdate = null; NameElementCommandConfirm[] nameElementCommandsConfirm = null; + NameElementCommand[] nameElementCommands = null; UUID uuid = null; String value = null; - nameElementCommandsCreate = new NameElementCommandCreate[] { - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "011", "checkCreate 1.3.011", "checkCreate 1.3.011"), - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "012", "checkCreate 1.3.012", "checkCreate 1.3.012"), - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "013", "checkCreate 1.3.013", "checkCreate 1.3.013"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "011", "checkCreate 2.3.011", "checkCreate 2.3.011"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "012", "checkCreate 2.3.012", "checkCreate 2.3.012"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "013", "checkCreate 2.3.013", "checkCreate 2.3.013"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "011", "checkCreate 3.3.011", "checkCreate 3.3.011"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "012", "checkCreate 3.3.012", "checkCreate 3.3.012"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "013", "checkCreate 3.3.013", "checkCreate 3.3.013") - }; - nameElementCommandsUpdate = new NameElementCommandUpdate[] { - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "011", "checkCreate 1.3.011", "checkCreate 1.3.011"), - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "012", "checkCreate 1.3.012", "checkCreate 1.3.012"), - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "013", "checkCreate 1.3.013", "checkCreate 1.3.013"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "011", "checkCreate 2.3.011", "checkCreate 2.3.011"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "012", "checkCreate 2.3.012", "checkCreate 2.3.012"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "013", "checkCreate 2.3.013", "checkCreate 2.3.013"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "011", "checkCreate 3.3.011", "checkCreate 3.3.011"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "012", "checkCreate 3.3.012", "checkCreate 3.3.012"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "013", "checkCreate 3.3.013", "checkCreate 3.3.013") - }; - nameElementCommandsConfirm = new NameElementCommandConfirm[] { - new NameElementCommandConfirm(null, "checkCreate 1.3.011"), - new NameElementCommandConfirm(null, "checkCreate 1.3.012"), - new NameElementCommandConfirm(null, "checkCreate 1.3.013"), - new NameElementCommandConfirm(null, "checkCreate 2.3.011"), - new NameElementCommandConfirm(null, "checkCreate 2.3.012"), - new NameElementCommandConfirm(null, "checkCreate 2.3.013"), - new NameElementCommandConfirm(null, "checkCreate 3.3.011"), - new NameElementCommandConfirm(null, "checkCreate 3.3.012"), - new NameElementCommandConfirm(null, "checkCreate 3.3.013") + nameElementCommands = new NameElementCommand[] { + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "011", "checkCreate 1.3.011", "checkCreate 1.3.011"), + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "012", "checkCreate 1.3.012", "checkCreate 1.3.012"), + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "013", "checkCreate 1.3.013", "checkCreate 1.3.013"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "011", "checkCreate 2.3.011", "checkCreate 2.3.011"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "012", "checkCreate 2.3.012", "checkCreate 2.3.012"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "013", "checkCreate 2.3.013", "checkCreate 2.3.013"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "011", "checkCreate 3.3.011", "checkCreate 3.3.011"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "012", "checkCreate 3.3.012", "checkCreate 3.3.012"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "013", "checkCreate 3.3.013", "checkCreate 3.3.013") }; + nameElementCommandsCreate = NameElementUtil.convertCommand2CommandCreate(nameElementCommands); + nameElementCommandsUpdate = NameElementUtil.convertCommand2CommandUpdate(nameElementCommands); + nameElementCommandsConfirm = NameElementUtil.convertCommand2CommandConfirm(nameElementCommands); ITUtilNameElement.assertExists("RFQ:Cryo-FS-011", Boolean.FALSE); ITUtilNameElement.assertIsLegacy("RFQ:Cryo-FS-011", Boolean.FALSE); @@ -244,45 +228,25 @@ class NamesMultipleIT { NameElementCommandCreate[] nameElementCommandsCreate = null; NameElementCommandUpdate[] nameElementCommandsUpdate = null; NameElementCommandConfirm[] nameElementCommandsConfirm = null; + NameElementCommand[] nameElementCommands = null; NameElement[] createdNameElements = null; int nbrNames = -1; - nameElementCommandsCreate = new NameElementCommandCreate[] { - new NameElementCommandCreate(systemGroupAcc, null, null, "create 1.0.0", "create 1.0.0"), - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "021", "create 1.3.021", "create 1.3.021"), - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "022", "create 1.3.022", "create 1.3.022"), - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "023", "create 1.3.023", "create 1.3.023"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "021", "create 2.3.021", "create 2.3.021"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "022", "create 2.3.022", "create 2.3.022"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "023", "create 2.3.023", "create 2.3.023"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "021", "create 3.3.021", "create 3.3.021"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "022", "create 3.3.022", "create 3.3.022"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "023", "create 3.3.023", "create 3.3.023") - }; - nameElementCommandsUpdate = new NameElementCommandUpdate[] { - new NameElementCommandUpdate(null, systemGroupAcc, null, null, "create 1.0.0", "create 1.0.0"), - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "021", "create 1.3.021", "create 1.3.021"), - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "022", "create 1.3.022", "create 1.3.022"), - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "023", "create 1.3.023", "create 1.3.023"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "021", "create 2.3.021", "create 2.3.021"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "022", "create 2.3.022", "create 2.3.022"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "023", "create 2.3.023", "create 2.3.023"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "021", "create 3.3.021", "create 3.3.021"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "022", "create 3.3.022", "create 3.3.022"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "023", "create 3.3.023", "create 3.3.023") - }; - nameElementCommandsConfirm = new NameElementCommandConfirm[] { - new NameElementCommandConfirm(null, "create 1.0.0"), - new NameElementCommandConfirm(null, "create 1.3.021"), - new NameElementCommandConfirm(null, "create 1.3.022"), - new NameElementCommandConfirm(null, "create 1.3.023"), - new NameElementCommandConfirm(null, "create 2.3.021"), - new NameElementCommandConfirm(null, "create 2.3.022"), - new NameElementCommandConfirm(null, "create 2.3.023"), - new NameElementCommandConfirm(null, "create 3.3.021"), - new NameElementCommandConfirm(null, "create 3.3.022"), - new NameElementCommandConfirm(null, "create 3.3.023") + nameElementCommands = new NameElementCommand[] { + new NameElementCommand(null, systemGroupAcc, null, null, "create 1.0.0", "create 1.0.0"), + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "021", "create 1.3.021", "create 1.3.021"), + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "022", "create 1.3.022", "create 1.3.022"), + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "023", "create 1.3.023", "create 1.3.023"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "021", "create 2.3.021", "create 2.3.021"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "022", "create 2.3.022", "create 2.3.022"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "023", "create 2.3.023", "create 2.3.023"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "021", "create 3.3.021", "create 3.3.021"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "022", "create 3.3.022", "create 3.3.022"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "023", "create 3.3.023", "create 3.3.023") }; + nameElementCommandsCreate = NameElementUtil.convertCommand2CommandCreate(nameElementCommands); + nameElementCommandsUpdate = NameElementUtil.convertCommand2CommandUpdate(nameElementCommands); + nameElementCommandsConfirm = NameElementUtil.convertCommand2CommandConfirm(nameElementCommands); ITUtilNameElement.assertValidate(nameElementCommandsCreate, NameCommand.CREATE, Boolean.FALSE); ITUtilNameElement.assertValidate(nameElementCommandsUpdate, NameCommand.UPDATE, Boolean.FALSE); @@ -315,9 +279,9 @@ class NamesMultipleIT { assertEquals(nbrNames + 9, ITUtilNameElement.assertRead("?deleted=false").getListSize()); - nameElementCommandsCreate = ITUtilNameElement.convert2NameElementCommandCreate(createdNameElements); - nameElementCommandsUpdate = ITUtilNameElement.convert2NameElementCommandUpdate(createdNameElements); - nameElementCommandsConfirm = ITUtilNameElement.convert2NameElementCommandConfirm(createdNameElements); + nameElementCommandsCreate = NameElementUtil.convertElement2CommandCreate(createdNameElements); + nameElementCommandsUpdate = NameElementUtil.convertElement2CommandUpdate(createdNameElements); + nameElementCommandsConfirm = NameElementUtil.convertElement2CommandConfirm(createdNameElements); ITUtilNameElement.assertExists("Acc:Cryo-FS-023", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("Acc:Cryo-FS-023", Boolean.FALSE); @@ -351,44 +315,26 @@ class NamesMultipleIT { NameElementCommandCreate[] nameElementCommandsCreate = null; NameElementCommandUpdate[] nameElementCommandsUpdate = null; NameElementCommandConfirm[] nameElementCommandsConfirm = null; + NameElementCommand[] nameElementCommands = null; NameElement[] createdNameElements = null; int nbrNames = -1; UUID uuid = null; String value = null; - nameElementCommandsCreate = new NameElementCommandCreate[] { - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "031", "checkUpdate 1.3.031", "checkUpdate 1.3.031"), - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "032", "checkUpdate 1.3.032", "checkUpdate 1.3.032"), - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "033", "checkUpdate 1.3.033", "checkUpdate 1.3.033"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "031", "checkUpdate 2.3.031", "checkUpdate 2.3.031"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "032", "checkUpdate 2.3.032", "checkUpdate 2.3.032"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "033", "checkUpdate 2.3.033", "checkUpdate 2.3.033"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "031", "checkUpdate 3.3.031", "checkUpdate 3.3.031"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "032", "checkUpdate 3.3.032", "checkUpdate 3.3.032"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "033", "checkUpdate 3.3.033", "checkUpdate 3.3.033") - }; - nameElementCommandsUpdate = new NameElementCommandUpdate[] { - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "031", "checkUpdate 1.3.031", "checkUpdate 1.3.031"), - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "032", "checkUpdate 1.3.032", "checkUpdate 1.3.032"), - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "033", "checkUpdate 1.3.033", "checkUpdate 1.3.033"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "031", "checkUpdate 2.3.031", "checkUpdate 2.3.031"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "032", "checkUpdate 2.3.032", "checkUpdate 2.3.032"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "033", "checkUpdate 2.3.033", "checkUpdate 2.3.033"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "031", "checkUpdate 3.3.031", "checkUpdate 3.3.031"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "032", "checkUpdate 3.3.032", "checkUpdate 3.3.032"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "033", "checkUpdate 3.3.033", "checkUpdate 3.3.033") - }; - nameElementCommandsConfirm = new NameElementCommandConfirm[] { - new NameElementCommandConfirm(null, "checkUpdate 1.3.031"), - new NameElementCommandConfirm(null, "checkUpdate 1.3.032"), - new NameElementCommandConfirm(null, "checkUpdate 1.3.033"), - new NameElementCommandConfirm(null, "checkUpdate 2.3.031"), - new NameElementCommandConfirm(null, "checkUpdate 2.3.032"), - new NameElementCommandConfirm(null, "checkUpdate 2.3.033"), - new NameElementCommandConfirm(null, "checkUpdate 3.3.031"), - new NameElementCommandConfirm(null, "checkUpdate 3.3.032"), - new NameElementCommandConfirm(null, "checkUpdate 3.3.033") + nameElementCommands = new NameElementCommand[] { + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "031", "checkUpdate 1.3.031", "checkUpdate 1.3.031"), + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "032", "checkUpdate 1.3.032", "checkUpdate 1.3.032"), + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "033", "checkUpdate 1.3.033", "checkUpdate 1.3.033"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "031", "checkUpdate 2.3.031", "checkUpdate 2.3.031"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "032", "checkUpdate 2.3.032", "checkUpdate 2.3.032"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "033", "checkUpdate 2.3.033", "checkUpdate 2.3.033"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "031", "checkUpdate 3.3.031", "checkUpdate 3.3.031"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "032", "checkUpdate 3.3.032", "checkUpdate 3.3.032"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "033", "checkUpdate 3.3.033", "checkUpdate 3.3.033") }; + nameElementCommandsCreate = NameElementUtil.convertCommand2CommandCreate(nameElementCommands); + nameElementCommandsUpdate = NameElementUtil.convertCommand2CommandUpdate(nameElementCommands); + nameElementCommandsConfirm = NameElementUtil.convertCommand2CommandConfirm(nameElementCommands); ITUtilNameElement.assertExists("RFQ:Cryo-FS-031", Boolean.FALSE); ITUtilNameElement.assertIsLegacy("RFQ:Cryo-FS-031", Boolean.FALSE); @@ -405,9 +351,9 @@ class NamesMultipleIT { assertEquals(nbrNames + 9, ITUtilNameElement.assertRead("?deleted=false").getListSize()); - nameElementCommandsCreate = ITUtilNameElement.convert2NameElementCommandCreate(createdNameElements); - nameElementCommandsUpdate = ITUtilNameElement.convert2NameElementCommandUpdate(createdNameElements); - nameElementCommandsConfirm = ITUtilNameElement.convert2NameElementCommandConfirm(createdNameElements); + nameElementCommandsCreate = NameElementUtil.convertElement2CommandCreate(createdNameElements); + nameElementCommandsUpdate = NameElementUtil.convertElement2CommandUpdate(createdNameElements); + nameElementCommandsConfirm = NameElementUtil.convertElement2CommandConfirm(createdNameElements); ITUtilNameElement.assertExists("RFQ:Cryo-FS-031", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("RFQ:Cryo-FS-031", Boolean.FALSE); @@ -473,46 +419,26 @@ class NamesMultipleIT { NameElementCommandCreate[] nameElementCommandsCreate = null; NameElementCommandUpdate[] nameElementCommandsUpdate = null; NameElementCommandConfirm[] nameElementCommandsConfirm = null; + NameElementCommand[] nameElementCommands = null; NameElement[] createdNameElements = null; NameElement[] updatedNameElements = null; int nbrNames = -1; - nameElementCommandsCreate = new NameElementCommandCreate[] { - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "041", "update 1.3.041", "update 1.3.041"), - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "042", "update 1.3.042", "update 1.3.042"), - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "043", "update 1.3.043", "update 1.3.043"), - new NameElementCommandCreate(systemRFQ, null, null, "update 2.0.0", "update 2.0.0"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "041", "update 2.3.041", "update 2.3.041"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "042", "update 2.3.042", "update 2.3.042"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "043", "update 2.3.043", "update 2.3.043"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "041", "update 3.3.041", "update 3.3.041"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "042", "update 3.3.042", "update 3.3.042"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "043", "update 3.3.043", "update 3.3.043") - }; - nameElementCommandsUpdate = new NameElementCommandUpdate[] { - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "041", "update 1.3.041", "update 1.3.041"), - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "042", "update 1.3.042", "update 1.3.042"), - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "043", "update 1.3.043", "update 1.3.043"), - new NameElementCommandUpdate(null, systemRFQ, null, null, "update 2.0.0", "update 2.0.0"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "041", "update 2.3.041", "update 2.3.041"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "042", "update 2.3.042", "update 2.3.042"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "043", "update 2.3.043", "update 2.3.043"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "041", "update 3.3.041", "update 3.3.041"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "042", "update 3.3.042", "update 3.3.042"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "043", "update 3.3.043", "update 3.3.043") - }; - nameElementCommandsConfirm = new NameElementCommandConfirm[] { - new NameElementCommandConfirm(null, "update 1.3.041"), - new NameElementCommandConfirm(null, "update 1.3.042"), - new NameElementCommandConfirm(null, "update 1.3.043"), - new NameElementCommandConfirm(null, "update 2.0.0"), - new NameElementCommandConfirm(null, "update 2.3.041"), - new NameElementCommandConfirm(null, "update 2.3.042"), - new NameElementCommandConfirm(null, "update 2.3.043"), - new NameElementCommandConfirm(null, "update 3.3.041"), - new NameElementCommandConfirm(null, "update 3.3.042"), - new NameElementCommandConfirm(null, "update 3.3.043") + nameElementCommands = new NameElementCommand[] { + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "041", "update 1.3.041", "update 1.3.041"), + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "042", "update 1.3.042", "update 1.3.042"), + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "043", "update 1.3.043", "update 1.3.043"), + new NameElementCommand(null, systemRFQ, null, null, "update 2.0.0", "update 2.0.0"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "041", "update 2.3.041", "update 2.3.041"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "042", "update 2.3.042", "update 2.3.042"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "043", "update 2.3.043", "update 2.3.043"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "041", "update 3.3.041", "update 3.3.041"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "042", "update 3.3.042", "update 3.3.042"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "043", "update 3.3.043", "update 3.3.043") }; + nameElementCommandsCreate = NameElementUtil.convertCommand2CommandCreate(nameElementCommands); + nameElementCommandsUpdate = NameElementUtil.convertCommand2CommandUpdate(nameElementCommands); + nameElementCommandsConfirm = NameElementUtil.convertCommand2CommandConfirm(nameElementCommands); ITUtilNameElement.assertValidate(nameElementCommandsCreate, NameCommand.CREATE, Boolean.FALSE); ITUtilNameElement.assertValidate(nameElementCommandsUpdate, NameCommand.UPDATE, Boolean.FALSE); @@ -567,9 +493,9 @@ class NamesMultipleIT { assertEquals(nbrNames + 9, ITUtilNameElement.assertRead("?deleted=false").getListSize()); - nameElementCommandsCreate = ITUtilNameElement.convert2NameElementCommandCreate(createdNameElements); - nameElementCommandsUpdate = ITUtilNameElement.convert2NameElementCommandUpdate(createdNameElements); - nameElementCommandsConfirm = ITUtilNameElement.convert2NameElementCommandConfirm(createdNameElements); + nameElementCommandsCreate = NameElementUtil.convertElement2CommandCreate(createdNameElements); + nameElementCommandsUpdate = NameElementUtil.convertElement2CommandUpdate(createdNameElements); + nameElementCommandsConfirm = NameElementUtil.convertElement2CommandConfirm(createdNameElements); ITUtilNameElement.assertExists("RFQ", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("RFQ", Boolean.FALSE); @@ -601,9 +527,9 @@ class NamesMultipleIT { assertEquals(nbrNames + 9, ITUtilNameElement.assertRead("?deleted=false").getListSize()); - nameElementCommandsCreate = ITUtilNameElement.convert2NameElementCommandCreate(updatedNameElements); - nameElementCommandsUpdate = ITUtilNameElement.convert2NameElementCommandUpdate(updatedNameElements); - nameElementCommandsConfirm = ITUtilNameElement.convert2NameElementCommandConfirm(updatedNameElements); + nameElementCommandsCreate = NameElementUtil.convertElement2CommandCreate(updatedNameElements); + nameElementCommandsUpdate = NameElementUtil.convertElement2CommandUpdate(updatedNameElements); + nameElementCommandsConfirm = NameElementUtil.convertElement2CommandConfirm(updatedNameElements); ITUtilNameElement.assertExists("RFQ", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("RFQ", Boolean.FALSE); @@ -636,44 +562,26 @@ class NamesMultipleIT { NameElementCommandCreate[] nameElementCommandsCreate = null; NameElementCommandUpdate[] nameElementCommandsUpdate = null; NameElementCommandConfirm[] nameElementCommandsConfirm = null; + NameElementCommand[] nameElementCommands = null; NameElement[] createdNameElements = null; int nbrNames = -1; UUID uuid = null; String value = null; - nameElementCommandsCreate = new NameElementCommandCreate[] { - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "051", "checkDelete 1.3.051", "checkDelete 1.3.051"), - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "052", "checkDelete 1.3.052", "checkDelete 1.3.052"), - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "053", "checkDelete 1.3.053", "checkDelete 1.3.053"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "051", "checkDelete 2.3.051", "checkDelete 2.3.051"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "052", "checkDelete 2.3.052", "checkDelete 2.3.052"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "053", "checkDelete 2.3.053", "checkDelete 2.3.053"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "051", "checkDelete 3.3.051", "checkDelete 3.3.051"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "052", "checkDelete 3.3.052", "checkDelete 3.3.052"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "053", "checkDelete 3.3.053", "checkDelete 3.3.053") - }; - nameElementCommandsUpdate = new NameElementCommandUpdate[] { - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "051", "checkDelete 1.3.051", "checkDelete 1.3.051"), - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "052", "checkDelete 1.3.052", "checkDelete 1.3.052"), - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "053", "checkDelete 1.3.053", "checkDelete 1.3.053"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "051", "checkDelete 2.3.051", "checkDelete 2.3.051"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "052", "checkDelete 2.3.052", "checkDelete 2.3.052"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "053", "checkDelete 2.3.053", "checkDelete 2.3.053"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "051", "checkDelete 3.3.051", "checkDelete 3.3.051"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "052", "checkDelete 3.3.052", "checkDelete 3.3.052"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "053", "checkDelete 3.3.053", "checkDelete 3.3.053") - }; - nameElementCommandsConfirm = new NameElementCommandConfirm[] { - new NameElementCommandConfirm(null, "checkDelete 1.3.051"), - new NameElementCommandConfirm(null, "checkDelete 1.3.052"), - new NameElementCommandConfirm(null, "checkDelete 1.3.053"), - new NameElementCommandConfirm(null, "checkDelete 2.3.051"), - new NameElementCommandConfirm(null, "checkDelete 2.3.052"), - new NameElementCommandConfirm(null, "checkDelete 2.3.053"), - new NameElementCommandConfirm(null, "checkDelete 3.3.051"), - new NameElementCommandConfirm(null, "checkDelete 3.3.052"), - new NameElementCommandConfirm(null, "checkDelete 3.3.053") + nameElementCommands = new NameElementCommand[] { + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "051", "checkDelete 1.3.051", "checkDelete 1.3.051"), + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "052", "checkDelete 1.3.052", "checkDelete 1.3.052"), + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "053", "checkDelete 1.3.053", "checkDelete 1.3.053"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "051", "checkDelete 2.3.051", "checkDelete 2.3.051"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "052", "checkDelete 2.3.052", "checkDelete 2.3.052"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "053", "checkDelete 2.3.053", "checkDelete 2.3.053"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "051", "checkDelete 3.3.051", "checkDelete 3.3.051"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "052", "checkDelete 3.3.052", "checkDelete 3.3.052"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "053", "checkDelete 3.3.053", "checkDelete 3.3.053") }; + nameElementCommandsCreate = NameElementUtil.convertCommand2CommandCreate(nameElementCommands); + nameElementCommandsUpdate = NameElementUtil.convertCommand2CommandUpdate(nameElementCommands); + nameElementCommandsConfirm = NameElementUtil.convertCommand2CommandConfirm(nameElementCommands); ITUtilNameElement.assertExists("RFQ:Cryo-FS-051", Boolean.FALSE); ITUtilNameElement.assertIsLegacy("RFQ:Cryo-FS-051", Boolean.FALSE); @@ -690,9 +598,9 @@ class NamesMultipleIT { assertEquals(nbrNames + 9, ITUtilNameElement.assertRead("?deleted=false").getListSize()); - nameElementCommandsCreate = ITUtilNameElement.convert2NameElementCommandCreate(createdNameElements); - nameElementCommandsUpdate = ITUtilNameElement.convert2NameElementCommandUpdate(createdNameElements); - nameElementCommandsConfirm = ITUtilNameElement.convert2NameElementCommandConfirm(createdNameElements); + nameElementCommandsCreate = NameElementUtil.convertElement2CommandCreate(createdNameElements); + nameElementCommandsUpdate = NameElementUtil.convertElement2CommandUpdate(createdNameElements); + nameElementCommandsConfirm = NameElementUtil.convertElement2CommandConfirm(createdNameElements); ITUtilNameElement.assertExists("RFQ:Cryo-FS-051", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("RFQ:Cryo-FS-051", Boolean.FALSE); @@ -742,46 +650,26 @@ class NamesMultipleIT { NameElementCommandCreate[] nameElementCommandsCreate = null; NameElementCommandUpdate[] nameElementCommandsUpdate = null; NameElementCommandConfirm[] nameElementCommandsConfirm = null; + NameElementCommand[] nameElementCommands = null; NameElement[] createdNameElements = null; NameElement[] deletedNameElements = null; int nbrNames = -1; - nameElementCommandsCreate = new NameElementCommandCreate[] { - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "061", "delete 1.3.061", "delete 1.3.061"), - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "062", "delete 1.3.062", "delete 1.3.062"), - new NameElementCommandCreate(systemGroupAcc, deviceType_Cryo_FS, "063", "delete 1.3.063", "delete 1.3.063"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "061", "delete 2.3.061", "delete 2.3.061"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "062", "delete 2.3.062", "delete 2.3.062"), - new NameElementCommandCreate(systemRFQ, deviceType_Cryo_FS, "063", "delete 2.3.063", "delete 2.3.063"), - new NameElementCommandCreate(subsystem010PRL, null, null, "delete 3.0.0", "delete 3.0.0"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "061", "delete 3.3.061", "delete 3.3.061"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "062", "delete 3.3.062", "delete 3.3.062"), - new NameElementCommandCreate(subsystem010PRL, deviceType_Cryo_FS, "063", "delete 3.3.063", "delete 3.3.063") - }; - nameElementCommandsUpdate = new NameElementCommandUpdate[] { - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "061", "delete 1.3.061", "delete 1.3.061"), - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "062", "delete 1.3.062", "delete 1.3.062"), - new NameElementCommandUpdate(null, systemGroupAcc, deviceType_Cryo_FS, "063", "delete 1.3.063", "delete 1.3.063"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "061", "delete 2.3.061", "delete 2.3.061"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "062", "delete 2.3.062", "delete 2.3.062"), - new NameElementCommandUpdate(null, systemRFQ, deviceType_Cryo_FS, "063", "delete 2.3.063", "delete 2.3.063"), - new NameElementCommandUpdate(null, subsystem010PRL, null, null, "delete 3.0.0", "delete 3.0.0"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "061", "delete 3.3.061", "delete 3.3.061"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "062", "delete 3.3.062", "delete 3.3.062"), - new NameElementCommandUpdate(null, subsystem010PRL, deviceType_Cryo_FS, "063", "delete 3.3.063", "delete 3.3.063") - }; - nameElementCommandsConfirm = new NameElementCommandConfirm[] { - new NameElementCommandConfirm(null, "delete 1.3.061"), - new NameElementCommandConfirm(null, "delete 1.3.062"), - new NameElementCommandConfirm(null, "delete 1.3.063"), - new NameElementCommandConfirm(null, "delete 2.3.061"), - new NameElementCommandConfirm(null, "delete 2.3.062"), - new NameElementCommandConfirm(null, "delete 2.3.063"), - new NameElementCommandConfirm(null, "delete 3.0.0"), - new NameElementCommandConfirm(null, "delete 3.3.061"), - new NameElementCommandConfirm(null, "delete 3.3.062"), - new NameElementCommandConfirm(null, "delete 3.3.063") + nameElementCommands = new NameElementCommand[] { + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "061", "delete 1.3.061", "delete 1.3.061"), + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "062", "delete 1.3.062", "delete 1.3.062"), + new NameElementCommand(null, systemGroupAcc, deviceType_Cryo_FS, "063", "delete 1.3.063", "delete 1.3.063"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "061", "delete 2.3.061", "delete 2.3.061"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "062", "delete 2.3.062", "delete 2.3.062"), + new NameElementCommand(null, systemRFQ, deviceType_Cryo_FS, "063", "delete 2.3.063", "delete 2.3.063"), + new NameElementCommand(null, subsystem010PRL, null, null, "delete 3.0.0", "delete 3.0.0"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "061", "delete 3.3.061", "delete 3.3.061"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "062", "delete 3.3.062", "delete 3.3.062"), + new NameElementCommand(null, subsystem010PRL, deviceType_Cryo_FS, "063", "delete 3.3.063", "delete 3.3.063") }; + nameElementCommandsCreate = NameElementUtil.convertCommand2CommandCreate(nameElementCommands); + nameElementCommandsUpdate = NameElementUtil.convertCommand2CommandUpdate(nameElementCommands); + nameElementCommandsConfirm = NameElementUtil.convertCommand2CommandConfirm(nameElementCommands); ITUtilNameElement.assertValidate(nameElementCommandsCreate, NameCommand.CREATE, Boolean.FALSE); ITUtilNameElement.assertValidate(nameElementCommandsUpdate, NameCommand.UPDATE, Boolean.FALSE); @@ -836,9 +724,9 @@ class NamesMultipleIT { assertEquals(nbrNames + 9, ITUtilNameElement.assertRead("?deleted=false").getListSize()); - nameElementCommandsCreate = ITUtilNameElement.convert2NameElementCommandCreate(createdNameElements); - nameElementCommandsUpdate = ITUtilNameElement.convert2NameElementCommandUpdate(createdNameElements); - nameElementCommandsConfirm = ITUtilNameElement.convert2NameElementCommandConfirm(createdNameElements); + nameElementCommandsCreate = NameElementUtil.convertElement2CommandCreate(createdNameElements); + nameElementCommandsUpdate = NameElementUtil.convertElement2CommandUpdate(createdNameElements); + nameElementCommandsConfirm = NameElementUtil.convertElement2CommandConfirm(createdNameElements); ITUtilNameElement.assertExists("RFQ:Cryo-FS-061", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("RFQ:Cryo-FS-061", Boolean.FALSE); @@ -853,9 +741,9 @@ class NamesMultipleIT { assertEquals(nbrNames, ITUtilNameElement.assertRead("?deleted=false").getListSize()); - nameElementCommandsCreate = ITUtilNameElement.convert2NameElementCommandCreate(deletedNameElements); - nameElementCommandsUpdate = ITUtilNameElement.convert2NameElementCommandUpdate(deletedNameElements); - nameElementCommandsConfirm = ITUtilNameElement.convert2NameElementCommandConfirm(deletedNameElements); + nameElementCommandsCreate = NameElementUtil.convertElement2CommandCreate(deletedNameElements); + nameElementCommandsUpdate = NameElementUtil.convertElement2CommandUpdate(deletedNameElements); + nameElementCommandsConfirm = NameElementUtil.convertElement2CommandConfirm(deletedNameElements); ITUtilNameElement.assertExists("RFQ:Cryo-FS-061", Boolean.FALSE); ITUtilNameElement.assertIsLegacy("RFQ:Cryo-FS-061", Boolean.FALSE); diff --git a/src/test/java/org/openepics/names/docker/complex/StructuresCUDDeleteIT.java b/src/test/java/org/openepics/names/docker/complex/StructuresCUDDeleteIT.java index 2c70083386f4bbcd20c81a22def25c3a9ff58d52..e0d9be1677b68c42c4fb23dc53ca48bfe7ca358b 100644 --- a/src/test/java/org/openepics/names/docker/complex/StructuresCUDDeleteIT.java +++ b/src/test/java/org/openepics/names/docker/complex/StructuresCUDDeleteIT.java @@ -30,7 +30,10 @@ import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.NameElementCommandCreate; import org.openepics.names.rest.beans.element.StructureElement; import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandConfirm; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; import org.openepics.names.rest.beans.response.ResponsePageStructureElements; +import org.openepics.names.util.StructureElementUtil; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -117,7 +120,7 @@ class StructuresCUDDeleteIT { // test create structure and ensure name is as expected NameElementCommandCreate nameElementCommandCreate = null; - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement approvedStructureElement = null; String name = "name"; @@ -125,8 +128,8 @@ class StructuresCUDDeleteIT { String comment = "comment"; // sg0 - structureElement = new StructureElementCommand(null, Type.SYSTEMGROUP, null, name, null, description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEMGROUP, null, name, null, description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); ITUtilStructureElement.assertRead("/SYSTEMGROUP", 1); ITUtilStructureElement.assertRead("/SYSTEM", 0); @@ -137,49 +140,49 @@ class StructuresCUDDeleteIT { // system group // sg0 - no mnemonic - structureElement = new StructureElementCommand(null, Type.SYSTEMGROUP, null, name, "Sg1", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEMGROUP, null, name, "Sg1", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sg1 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg1, name, "Sys11", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg1, name, "Sys11", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys11 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg1, name, "Sys12", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg1, name, "Sys12", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys12 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg1, name, "Sys13", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg1, name, "Sys13", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys13 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys11, name, "Sub111", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys11, name, "Sub111", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys11, name, "Sub112", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys11, name, "Sub112", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys11, name, "Sub113", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys11, name, "Sub113", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys12, name, "Sub121", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys12, name, "Sub121", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys12, name, "Sub122", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys12, name, "Sub122", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys12, name, "Sub123", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys12, name, "Sub123", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys13, name, "Sub131", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys13, name, "Sub131", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys13, name, "Sub132", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys13, name, "Sub132", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sub132 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys13, name, "Sub133", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys13, name, "Sub133", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); ITUtilStructureElement.assertRead("/SYSTEMGROUP", 2); ITUtilStructureElement.assertRead("/SYSTEM", 3); @@ -205,50 +208,50 @@ class StructuresCUDDeleteIT { // Sys12-Sub121, Sys12-Sub122, Sys12-Sub123 // Sys13-Sub131, Sys13-Sub132, Sys13-Sub133 - structureElement = new StructureElementCommand(null, Type.SYSTEMGROUP, null, name, "Sg2", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEMGROUP, null, name, "Sg2", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sg2 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg2, name, "Sys21", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg2, name, "Sys21", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys21 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg2, name, "Sys22", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg2, name, "Sys22", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys22 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg2, name, "Sys23", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg2, name, "Sys23", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys23 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys21, name, "Sub211", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys21, name, "Sub211", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys21, name, "Sub212", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys21, name, "Sub212", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys21, name, "Sub213", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys21, name, "Sub213", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys22, name, "Sub221", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys22, name, "Sub221", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys22, name, "Sub222", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys22, name, "Sub222", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys22, name, "Sub223", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys22, name, "Sub223", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys23, name, "Sub231", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys23, name, "Sub231", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sub231 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys23, name, "Sub232", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys23, name, "Sub232", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sub232 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys23, name, "Sub233", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys23, name, "Sub233", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sub233 = approvedStructureElement.getUuid(); ITUtilStructureElement.assertRead("/SYSTEMGROUP", 3); @@ -274,56 +277,56 @@ class StructuresCUDDeleteIT { // Sys22-Sub221, Sys22-Sub222, Sys22-Sub223 // Sys23-Sub231, Sys23-Sub232, Sys23-Sub233 - structureElement = new StructureElementCommand(null, Type.DISCIPLINE, null, name, "Di2", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DISCIPLINE, null, name, "Di2", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); di2 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICEGROUP, di2, name, "", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICEGROUP, di2, name, "", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dg21 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICEGROUP, di2, name, "", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICEGROUP, di2, name, "", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dg22 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICEGROUP, di2, name, "", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICEGROUP, di2, name, "", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dg23 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg21, name, "Dt211", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg21, name, "Dt211", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt211 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg21, name, "Dt212", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg21, name, "Dt212", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt212 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg21, name, "Dt213", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg21, name, "Dt213", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt213 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg22, name, "Dt221", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg22, name, "Dt221", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt221 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg22, name, "Dt222", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg22, name, "Dt222", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt222 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg22, name, "Dt223", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg22, name, "Dt223", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt223 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg23, name, "Dt231", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg23, name, "Dt231", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt231 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg23, name, "Dt232", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg23, name, "Dt232", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt232 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg23, name, "Dt233", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg23, name, "Dt233", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt233 = approvedStructureElement.getUuid(); ITUtilStructureElement.assertRead("/SYSTEMGROUP", 3); @@ -440,14 +443,17 @@ class StructuresCUDDeleteIT { // test update system structure and ensure name is as expected ResponsePageStructureElements responsePage = null; - StructureElementCommand structureElement = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElement structureElement = null; ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys13-Sub132", Boolean.TRUE); ITUtilNameElement.assertExists("Sys13-Sub132", Boolean.TRUE); responsePage = ITUtilStructureElement.assertRead("/SUBSYSTEM?uuid=" + sub132, 1); - structureElement = responsePage.getList().get(0); - structureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); +// structureElement = responsePage.getList().get(0); +// structureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responsePage.getList().get(0)); + structureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys13-Sub132", Boolean.FALSE); ITUtilNameElement.assertExists("Sys13-Sub132", Boolean.TRUE); @@ -464,8 +470,10 @@ class StructuresCUDDeleteIT { ITUtilNameElement.assertExists("Sys12-Sub123", Boolean.TRUE); responsePage = ITUtilStructureElement.assertRead("/SYSTEM?uuid=" + sys12, 1); - structureElement = responsePage.getList().get(0); - structureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); +// structureElement = responsePage.getList().get(0); +// structureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responsePage.getList().get(0)); + structureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); ITUtilStructureElement.assertExists(Type.SYSTEM, "Sys12", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys12-Sub121", Boolean.FALSE); @@ -494,8 +502,10 @@ class StructuresCUDDeleteIT { ITUtilNameElement.assertExists("Sg1", Boolean.TRUE); responsePage = ITUtilStructureElement.assertRead("/SYSTEMGROUP?uuid=" + sg1, 1); - structureElement = responsePage.getList().get(0); - structureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); +// structureElement = responsePage.getList().get(0); +// structureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responsePage.getList().get(0)); + structureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "Sg1", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "Sys11", Boolean.FALSE); @@ -519,14 +529,17 @@ class StructuresCUDDeleteIT { // test update system structure and ensure name is as expected ResponsePageStructureElements responsePage = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElementCommand structureElement = null; ITUtilStructureElement.assertExists(Type.DEVICETYPE, "Di2-Dt232", Boolean.TRUE); ITUtilNameElement.assertExists("Sys23-Sub232:Di2-Dt232-232", Boolean.TRUE); responsePage = ITUtilStructureElement.assertRead("/DEVICETYPE?uuid=" + dt232, 1); - structureElement = responsePage.getList().get(0); - structureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); +// structureElement = responsePage.getList().get(0); +// structureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responsePage.getList().get(0)); + structureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); ITUtilStructureElement.assertExists(Type.DEVICETYPE, "Di2-Dt232", Boolean.FALSE); ITUtilNameElement.assertExists("Sys23-Sub232:Di2-Dt232-232", Boolean.TRUE); @@ -541,8 +554,10 @@ class StructuresCUDDeleteIT { ITUtilNameElement.assertExists("Sys22:Di2-Dt223-223", Boolean.TRUE); responsePage = ITUtilStructureElement.assertRead("/DEVICEGROUP?uuid=" + dg22, 1); - structureElement = responsePage.getList().get(0); - structureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); +// structureElement = responsePage.getList().get(0); +// structureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responsePage.getList().get(0)); + structureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); ITUtilStructureElement.assertExists(Type.DEVICETYPE, "Di2-Dt221", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.DEVICETYPE, "Di2-Dt222", Boolean.FALSE); @@ -573,8 +588,10 @@ class StructuresCUDDeleteIT { ITUtilNameElement.assertExists("Sys23-Sub233:Di2-Dt233-233", Boolean.TRUE); responsePage = ITUtilStructureElement.assertRead("/DISCIPLINE?uuid=" + di2, 1); - structureElement = responsePage.getList().get(0); - structureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); +// structureElement = responsePage.getList().get(0); +// structureElement = ITUtilStructureElement.assertDeleteApprove(structureElement); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responsePage.getList().get(0)); + structureElement = ITUtilStructureElement.assertDeleteApprove(structureElementCommandConfirm); ITUtilStructureElement.assertExists(Type.DEVICETYPE, "Di2-Dt211", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.DEVICETYPE, "Di2-Dt212", Boolean.FALSE); diff --git a/src/test/java/org/openepics/names/docker/complex/StructuresCUDNamesLegacyIT.java b/src/test/java/org/openepics/names/docker/complex/StructuresCUDNamesLegacyIT.java index c5dd01ad47704397a10f2962c42b2d1515726106..07b58b6dcb6f0800413221f466b1910995c856b5 100644 --- a/src/test/java/org/openepics/names/docker/complex/StructuresCUDNamesLegacyIT.java +++ b/src/test/java/org/openepics/names/docker/complex/StructuresCUDNamesLegacyIT.java @@ -30,7 +30,10 @@ import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.NameElementCommandCreate; import org.openepics.names.rest.beans.element.StructureElement; import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandConfirm; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; import org.openepics.names.rest.beans.response.ResponsePageStructureElements; +import org.openepics.names.util.StructureElementUtil; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -117,7 +120,7 @@ class StructuresCUDNamesLegacyIT { // init system group, system, subsystem, discipline, device group, device type NameElementCommandCreate nameElementCommandCreate = null; - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement approvedStructureElement = null; String name = "name"; @@ -125,8 +128,8 @@ class StructuresCUDNamesLegacyIT { String comment = "comment"; // sg0 - structureElement = new StructureElementCommand(null, Type.SYSTEMGROUP, null, name, null, description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEMGROUP, null, name, null, description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); ITUtilStructureElement.assertRead("/SYSTEMGROUP", 1); ITUtilStructureElement.assertRead("/SYSTEM", 0); @@ -137,49 +140,49 @@ class StructuresCUDNamesLegacyIT { // system group // sg0 - no mnemonic - structureElement = new StructureElementCommand(null, Type.SYSTEMGROUP, null, name, "Sg1", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEMGROUP, null, name, "Sg1", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sg1 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg1, name, "Sys11", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg1, name, "Sys11", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys11 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg1, name, "Sys12", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg1, name, "Sys12", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys12 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg1, name, "Sys13", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg1, name, "Sys13", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys13 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys11, name, "Sub111", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys11, name, "Sub111", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys11, name, "Sub112", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys11, name, "Sub112", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys11, name, "Sub113", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys11, name, "Sub113", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys12, name, "Sub121", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys12, name, "Sub121", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys12, name, "Sub122", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys12, name, "Sub122", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys12, name, "Sub123", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys12, name, "Sub123", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys13, name, "Sub131", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys13, name, "Sub131", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys13, name, "Sub132", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys13, name, "Sub132", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sub132 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys13, name, "Sub133", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys13, name, "Sub133", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); ITUtilStructureElement.assertRead("/SYSTEMGROUP", 2); ITUtilStructureElement.assertRead("/SYSTEM", 3); @@ -204,50 +207,50 @@ class StructuresCUDNamesLegacyIT { // Sys12-Sub121, Sys12-Sub122, Sys12-Sub123 // Sys13-Sub131, Sys13-Sub132, Sys13-Sub133 - structureElement = new StructureElementCommand(null, Type.SYSTEMGROUP, null, name, "Sg2", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEMGROUP, null, name, "Sg2", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sg2 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg2, name, "Sys21", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg2, name, "Sys21", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys21 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg2, name, "Sys22", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg2, name, "Sys22", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys22 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg2, name, "Sys23", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg2, name, "Sys23", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys23 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys21, name, "Sub211", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys21, name, "Sub211", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys21, name, "Sub212", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys21, name, "Sub212", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys21, name, "Sub213", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys21, name, "Sub213", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys22, name, "Sub221", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys22, name, "Sub221", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys22, name, "Sub222", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys22, name, "Sub222", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys22, name, "Sub223", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys22, name, "Sub223", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys23, name, "Sub231", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys23, name, "Sub231", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sub231 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys23, name, "Sub232", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys23, name, "Sub232", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sub232 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys23, name, "Sub233", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys23, name, "Sub233", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sub233 = approvedStructureElement.getUuid(); ITUtilStructureElement.assertRead("/SYSTEMGROUP", 3); @@ -273,56 +276,56 @@ class StructuresCUDNamesLegacyIT { // Sys22-Sub221, Sys22-Sub222, Sys22-Sub223 // Sys23-Sub231, Sys23-Sub232, Sys23-Sub233 - structureElement = new StructureElementCommand(null, Type.DISCIPLINE, null, name, "Di2", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DISCIPLINE, null, name, "Di2", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); di2 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICEGROUP, di2, name, "", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICEGROUP, di2, name, "", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dg21 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICEGROUP, di2, name, "", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICEGROUP, di2, name, "", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dg22 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICEGROUP, di2, name, "", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICEGROUP, di2, name, "", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dg23 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg21, name, "Dt211", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg21, name, "Dt211", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt211 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg21, name, "Dt212", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg21, name, "Dt212", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt212 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg21, name, "Dt213", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg21, name, "Dt213", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt213 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg22, name, "Dt221", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg22, name, "Dt221", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt221 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg22, name, "Dt222", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg22, name, "Dt222", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt222 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg22, name, "Dt223", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg22, name, "Dt223", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt223 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg23, name, "Dt231", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg23, name, "Dt231", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt231 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg23, name, "Dt232", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg23, name, "Dt232", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt232 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg23, name, "Dt233", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg23, name, "Dt233", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt233 = approvedStructureElement.getUuid(); ITUtilStructureElement.assertRead("/SYSTEMGROUP", 3); @@ -414,7 +417,8 @@ class StructuresCUDNamesLegacyIT { // delete system group ResponsePageStructureElements responsePage = null; - StructureElementCommand structureElement = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; + StructureElement structureElement = null; ITUtilNameElement.assertExists("Sg1", Boolean.TRUE); ITUtilNameElement.assertExists("Sys11", Boolean.TRUE); @@ -445,10 +449,30 @@ class StructuresCUDNamesLegacyIT { ITUtilNameElement.assertIsLegacy("Sys13-Sub133", Boolean.FALSE); responsePage = ITUtilStructureElement.assertRead("/SUBSYSTEM?uuid=" + sub132, 1); - structureElement = responsePage.getList().get(0); - ITUtilStructureElement.assertApprove(ITUtilStructureElement.assertDelete(structureElement)); +// structureElement = responsePage.getList().get(0); +// +// ITUtilStructureElement.assertApprove(ITUtilStructureElement.assertDelete(structureElement)); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responsePage.getList().get(0)); + structureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); + ITUtilNameElement.assertIsLegacy("Sg1", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys11", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys12", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys13", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys11-Sub111", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys11-Sub112", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys11-Sub113", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys12-Sub121", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys12-Sub122", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys12-Sub123", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys13-Sub131", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys13-Sub132", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys13-Sub133", Boolean.FALSE); + +// approve +// islegacy + structureElement = ITUtilStructureElement.assertApprove(structureElementCommandConfirm); ITUtilNameElement.assertIsLegacy("Sg1", Boolean.FALSE); ITUtilNameElement.assertIsLegacy("Sys11", Boolean.FALSE); ITUtilNameElement.assertIsLegacy("Sys12", Boolean.FALSE); @@ -462,12 +486,33 @@ class StructuresCUDNamesLegacyIT { ITUtilNameElement.assertIsLegacy("Sys13-Sub131", Boolean.FALSE); ITUtilNameElement.assertIsLegacy("Sys13-Sub132", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("Sys13-Sub133", Boolean.FALSE); +// ----------------- responsePage = ITUtilStructureElement.assertRead("/SYSTEM?uuid=" + sys12, 1); - structureElement = responsePage.getList().get(0); - ITUtilStructureElement.assertApprove(ITUtilStructureElement.assertDelete(structureElement)); +// structureElement = responsePage.getList().get(0); +// +// ITUtilStructureElement.assertApprove(ITUtilStructureElement.assertDelete(structureElement)); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responsePage.getList().get(0)); + structureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); + ITUtilNameElement.assertIsLegacy("Sg1", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys11", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys12", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys13", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys11-Sub111", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys11-Sub112", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys11-Sub113", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys12-Sub121", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys12-Sub122", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys12-Sub123", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys13-Sub131", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys13-Sub132", Boolean.TRUE); + ITUtilNameElement.assertIsLegacy("Sys13-Sub133", Boolean.FALSE); + +// approve +// islegacy + structureElement = ITUtilStructureElement.assertApprove(structureElementCommandConfirm); ITUtilNameElement.assertIsLegacy("Sg1", Boolean.FALSE); ITUtilNameElement.assertIsLegacy("Sys11", Boolean.FALSE); ITUtilNameElement.assertIsLegacy("Sys12", Boolean.TRUE); @@ -481,12 +526,33 @@ class StructuresCUDNamesLegacyIT { ITUtilNameElement.assertIsLegacy("Sys13-Sub131", Boolean.FALSE); ITUtilNameElement.assertIsLegacy("Sys13-Sub132", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("Sys13-Sub133", Boolean.FALSE); +// --------------------------- responsePage = ITUtilStructureElement.assertRead("/SYSTEMGROUP?uuid=" + sg1, 1); - structureElement = responsePage.getList().get(0); - ITUtilStructureElement.assertApprove(ITUtilStructureElement.assertDelete(structureElement)); +// structureElement = responsePage.getList().get(0); +// +// ITUtilStructureElement.assertApprove(ITUtilStructureElement.assertDelete(structureElement)); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responsePage.getList().get(0)); + structureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); + ITUtilNameElement.assertIsLegacy("Sg1", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys11", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys12", Boolean.TRUE); + ITUtilNameElement.assertIsLegacy("Sys13", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys11-Sub111", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys11-Sub112", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys11-Sub113", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys12-Sub121", Boolean.TRUE); + ITUtilNameElement.assertIsLegacy("Sys12-Sub122", Boolean.TRUE); + ITUtilNameElement.assertIsLegacy("Sys12-Sub123", Boolean.TRUE); + ITUtilNameElement.assertIsLegacy("Sys13-Sub131", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys13-Sub132", Boolean.TRUE); + ITUtilNameElement.assertIsLegacy("Sys13-Sub133", Boolean.FALSE); + +// approve +// islegacy + structureElement = ITUtilStructureElement.assertApprove(structureElementCommandConfirm); ITUtilNameElement.assertIsLegacy("Sg1", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("Sys11", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("Sys12", Boolean.TRUE); @@ -500,6 +566,7 @@ class StructuresCUDNamesLegacyIT { ITUtilNameElement.assertIsLegacy("Sys13-Sub131", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("Sys13-Sub132", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("Sys13-Sub133", Boolean.TRUE); +// --------------- } @Test @@ -521,6 +588,7 @@ class StructuresCUDNamesLegacyIT { // delete discipline ResponsePageStructureElements responsePage = null; + StructureElementCommandConfirm structureElementCommandConfirm = null; StructureElementCommand structureElement = null; ITUtilNameElement.assertExists("Sg2:Di2-Dt211-211", Boolean.TRUE); @@ -544,10 +612,26 @@ class StructuresCUDNamesLegacyIT { ITUtilNameElement.assertIsLegacy("Sys23-Sub233:Di2-Dt233-233", Boolean.FALSE); responsePage = ITUtilStructureElement.assertRead("/DEVICETYPE?uuid=" + dt232, 1); - structureElement = responsePage.getList().get(0); - ITUtilStructureElement.assertApprove(ITUtilStructureElement.assertDelete(structureElement)); +// structureElement = responsePage.getList().get(0); +// +// ITUtilStructureElement.assertApprove(ITUtilStructureElement.assertDelete(structureElement)); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responsePage.getList().get(0)); + structureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); + + ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt211-211", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt212-212", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt213-213", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys22:Di2-Dt221-221", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys22:Di2-Dt222-222", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys22:Di2-Dt223-223", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys23-Sub231:Di2-Dt231-231", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys23-Sub232:Di2-Dt232-232", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys23-Sub233:Di2-Dt233-233", Boolean.FALSE); +// approve +// islegacy + structureElement = ITUtilStructureElement.assertApprove(structureElementCommandConfirm); ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt211-211", Boolean.FALSE); ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt212-212", Boolean.FALSE); ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt213-213", Boolean.FALSE); @@ -557,12 +641,29 @@ class StructuresCUDNamesLegacyIT { ITUtilNameElement.assertIsLegacy("Sys23-Sub231:Di2-Dt231-231", Boolean.FALSE); ITUtilNameElement.assertIsLegacy("Sys23-Sub232:Di2-Dt232-232", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("Sys23-Sub233:Di2-Dt233-233", Boolean.FALSE); +// --------------------------------- responsePage = ITUtilStructureElement.assertRead("/DEVICEGROUP?uuid=" + dg22, 1); - structureElement = responsePage.getList().get(0); - ITUtilStructureElement.assertApprove(ITUtilStructureElement.assertDelete(structureElement)); +// structureElement = responsePage.getList().get(0); +// +// ITUtilStructureElement.assertApprove(ITUtilStructureElement.assertDelete(structureElement)); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responsePage.getList().get(0)); + structureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); + + ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt211-211", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt212-212", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt213-213", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys22:Di2-Dt221-221", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys22:Di2-Dt222-222", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys22:Di2-Dt223-223", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys23-Sub231:Di2-Dt231-231", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys23-Sub232:Di2-Dt232-232", Boolean.TRUE); + ITUtilNameElement.assertIsLegacy("Sys23-Sub233:Di2-Dt233-233", Boolean.FALSE); +// approve +// islegacy + structureElement = ITUtilStructureElement.assertApprove(structureElementCommandConfirm); ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt211-211", Boolean.FALSE); ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt212-212", Boolean.FALSE); ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt213-213", Boolean.FALSE); @@ -572,12 +673,29 @@ class StructuresCUDNamesLegacyIT { ITUtilNameElement.assertIsLegacy("Sys23-Sub231:Di2-Dt231-231", Boolean.FALSE); ITUtilNameElement.assertIsLegacy("Sys23-Sub232:Di2-Dt232-232", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("Sys23-Sub233:Di2-Dt233-233", Boolean.FALSE); +// --------------------------------- responsePage = ITUtilStructureElement.assertRead("/DISCIPLINE?uuid=" + di2, 1); - structureElement = responsePage.getList().get(0); - ITUtilStructureElement.assertApprove(ITUtilStructureElement.assertDelete(structureElement)); +// structureElement = responsePage.getList().get(0); +// +// ITUtilStructureElement.assertApprove(ITUtilStructureElement.assertDelete(structureElement)); + structureElementCommandConfirm = StructureElementUtil.convertElement2CommandConfirm(responsePage.getList().get(0)); + structureElement = ITUtilStructureElement.assertDelete(structureElementCommandConfirm); + + ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt211-211", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt212-212", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt213-213", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys22:Di2-Dt221-221", Boolean.TRUE); + ITUtilNameElement.assertIsLegacy("Sys22:Di2-Dt222-222", Boolean.TRUE); + ITUtilNameElement.assertIsLegacy("Sys22:Di2-Dt223-223", Boolean.TRUE); + ITUtilNameElement.assertIsLegacy("Sys23-Sub231:Di2-Dt231-231", Boolean.FALSE); + ITUtilNameElement.assertIsLegacy("Sys23-Sub232:Di2-Dt232-232", Boolean.TRUE); + ITUtilNameElement.assertIsLegacy("Sys23-Sub233:Di2-Dt233-233", Boolean.FALSE); +// approve +// islegacy + structureElement = ITUtilStructureElement.assertApprove(structureElementCommandConfirm); ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt211-211", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt212-212", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("Sg2:Di2-Dt213-213", Boolean.TRUE); @@ -587,6 +705,7 @@ class StructuresCUDNamesLegacyIT { ITUtilNameElement.assertIsLegacy("Sys23-Sub231:Di2-Dt231-231", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("Sys23-Sub232:Di2-Dt232-232", Boolean.TRUE); ITUtilNameElement.assertIsLegacy("Sys23-Sub233:Di2-Dt233-233", Boolean.TRUE); +// --------------------------------- } } diff --git a/src/test/java/org/openepics/names/docker/complex/StructuresCUDUpdateIT.java b/src/test/java/org/openepics/names/docker/complex/StructuresCUDUpdateIT.java index f7331866a3179fda2714ebbe79523698ca606e5f..5850866d4abca6d3efa51bf039086a9d372d1203 100644 --- a/src/test/java/org/openepics/names/docker/complex/StructuresCUDUpdateIT.java +++ b/src/test/java/org/openepics/names/docker/complex/StructuresCUDUpdateIT.java @@ -29,8 +29,10 @@ import org.openepics.names.docker.ITUtilStructureElement; import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.NameElementCommandCreate; import org.openepics.names.rest.beans.element.StructureElement; -import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; +import org.openepics.names.rest.beans.element.StructureElementCommandUpdate; import org.openepics.names.rest.beans.response.ResponsePageStructureElements; +import org.openepics.names.util.StructureElementUtil; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -117,7 +119,7 @@ class StructuresCUDUpdateIT { // test create structure and ensure name is as expected NameElementCommandCreate nameElementCommandCreate = null; - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement approvedStructureElement = null; String name = "name"; @@ -125,8 +127,8 @@ class StructuresCUDUpdateIT { String comment = "comment"; // sg0 - structureElement = new StructureElementCommand(null, Type.SYSTEMGROUP, null, name, null, description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEMGROUP, null, name, null, description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); ITUtilStructureElement.assertRead("/SYSTEMGROUP", 1); ITUtilStructureElement.assertRead("/SYSTEM", 0); @@ -137,49 +139,49 @@ class StructuresCUDUpdateIT { // system group // sg0 - no mnemonic - structureElement = new StructureElementCommand(null, Type.SYSTEMGROUP, null, name, "Sg1", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEMGROUP, null, name, "Sg1", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sg1 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg1, name, "Sys11", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg1, name, "Sys11", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys11 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg1, name, "Sys12", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg1, name, "Sys12", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys12 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg1, name, "Sys13", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg1, name, "Sys13", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys13 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys11, name, "Sub111", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys11, name, "Sub111", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys11, name, "Sub112", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys11, name, "Sub112", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys11, name, "Sub113", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys11, name, "Sub113", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys12, name, "Sub121", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys12, name, "Sub121", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys12, name, "Sub122", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys12, name, "Sub122", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys12, name, "Sub123", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys12, name, "Sub123", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys13, name, "Sub131", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys13, name, "Sub131", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys13, name, "Sub132", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys13, name, "Sub132", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sub132 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys13, name, "Sub133", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys13, name, "Sub133", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); ITUtilStructureElement.assertRead("/SYSTEMGROUP", 2); ITUtilStructureElement.assertRead("/SYSTEM", 3); @@ -205,50 +207,50 @@ class StructuresCUDUpdateIT { // Sys12-Sub121, Sys12-Sub122, Sys12-Sub123 // Sys13-Sub131, Sys13-Sub132, Sys13-Sub133 - structureElement = new StructureElementCommand(null, Type.SYSTEMGROUP, null, name, "Sg2", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEMGROUP, null, name, "Sg2", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sg2 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg2, name, "Sys21", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg2, name, "Sys21", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys21 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg2, name, "Sys22", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg2, name, "Sys22", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys22 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SYSTEM, sg2, name, "Sys23", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SYSTEM, sg2, name, "Sys23", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sys23 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys21, name, "Sub211", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys21, name, "Sub211", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys21, name, "Sub212", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys21, name, "Sub212", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys21, name, "Sub213", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys21, name, "Sub213", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys22, name, "Sub221", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys22, name, "Sub221", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys22, name, "Sub222", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys22, name, "Sub222", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys22, name, "Sub223", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys22, name, "Sub223", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys23, name, "Sub231", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys23, name, "Sub231", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sub231 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys23, name, "Sub232", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys23, name, "Sub232", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sub232 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.SUBSYSTEM, sys23, name, "Sub233", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.SUBSYSTEM, sys23, name, "Sub233", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); sub233 = approvedStructureElement.getUuid(); ITUtilStructureElement.assertRead("/SYSTEMGROUP", 3); @@ -274,56 +276,56 @@ class StructuresCUDUpdateIT { // Sys22-Sub221, Sys22-Sub222, Sys22-Sub223 // Sys23-Sub231, Sys23-Sub232, Sys23-Sub233 - structureElement = new StructureElementCommand(null, Type.DISCIPLINE, null, name, "Di2", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DISCIPLINE, null, name, "Di2", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); di2 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICEGROUP, di2, name, "", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICEGROUP, di2, name, "", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dg21 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICEGROUP, di2, name, "", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICEGROUP, di2, name, "", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dg22 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICEGROUP, di2, name, "", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICEGROUP, di2, name, "", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dg23 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg21, name, "Dt211", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg21, name, "Dt211", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt211 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg21, name, "Dt212", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg21, name, "Dt212", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt212 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg21, name, "Dt213", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg21, name, "Dt213", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt213 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg22, name, "Dt221", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg22, name, "Dt221", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt221 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg22, name, "Dt222", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg22, name, "Dt222", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt222 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg22, name, "Dt223", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg22, name, "Dt223", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt223 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg23, name, "Dt231", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg23, name, "Dt231", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt231 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg23, name, "Dt232", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg23, name, "Dt232", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt232 = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand(null, Type.DEVICETYPE, dg23, name, "Dt233", description, comment); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + structureElementCommandCreate = new StructureElementCommandCreate(Type.DEVICETYPE, dg23, name, "Dt233", description, comment); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); dt233 = approvedStructureElement.getUuid(); ITUtilStructureElement.assertRead("/SYSTEMGROUP", 3); @@ -440,18 +442,26 @@ class StructuresCUDUpdateIT { // test update system structure and ensure name is as expected ResponsePageStructureElements responsePage = null; - StructureElementCommand structureElement = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElement structureElement = null; responsePage = ITUtilStructureElement.assertRead("/SUBSYSTEM?uuid=" + sub132, 1); - structureElement = responsePage.getList().get(0); - structureElement.setDescription("asdf"); - structureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); +// structureElement = responsePage.getList().get(0); +// structureElement.setDescription("asdf"); +// structureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responsePage.getList().get(0)); + structureElementCommandUpdate.setDescription("asdf"); + structureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(structureElement); ITUtilNameElement.assertExists("Sys13-Sub132", Boolean.TRUE); ITUtilNameElement.assertExists("Sys13-Su132", Boolean.FALSE); - structureElement.setMnemonic("Su132"); - ITUtilStructureElement.assertUpdateApprove(structureElement); +// structureElement.setMnemonic("Su132"); +// ITUtilStructureElement.assertUpdateApprove(structureElement); + structureElementCommandUpdate.setMnemonic("Su132"); + ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(structureElement); ITUtilNameElement.assertExists("Sys13-Sub132", Boolean.FALSE); ITUtilNameElement.assertExists("Sys13-Su132", Boolean.TRUE); @@ -459,9 +469,13 @@ class StructuresCUDUpdateIT { // ---------------------------------------- responsePage = ITUtilStructureElement.assertRead("/SYSTEM?uuid=" + sys12, 1); - structureElement = responsePage.getList().get(0); - structureElement.setDescription("asdf"); - structureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); +// structureElement = responsePage.getList().get(0); +// structureElement.setDescription("asdf"); +// structureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responsePage.getList().get(0)); + structureElementCommandUpdate.setDescription("asdf"); + structureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(structureElement); ITUtilNameElement.assertExists("Sys12", Boolean.TRUE); ITUtilNameElement.assertExists("Sys12-Sub121", Boolean.TRUE); @@ -472,8 +486,11 @@ class StructuresCUDUpdateIT { ITUtilNameElement.assertExists("Sy12-Sub122", Boolean.FALSE); ITUtilNameElement.assertExists("Sy12-Sub123", Boolean.FALSE); - structureElement.setMnemonic("Sy12"); - ITUtilStructureElement.assertUpdateApprove(structureElement); +// structureElement.setMnemonic("Sy12"); +// ITUtilStructureElement.assertUpdateApprove(structureElement); + structureElementCommandUpdate.setMnemonic("Sy12"); + ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(structureElement); ITUtilNameElement.assertExists("Sys12", Boolean.FALSE); ITUtilNameElement.assertExists("Sys12-Sub121", Boolean.FALSE); @@ -487,15 +504,22 @@ class StructuresCUDUpdateIT { // ---------------------------------------- responsePage = ITUtilStructureElement.assertRead("/SYSTEMGROUP?uuid=" + sg1, 1); - structureElement = responsePage.getList().get(0); - structureElement.setDescription("asdf"); - structureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); +// structureElement = responsePage.getList().get(0); +// structureElement.setDescription("asdf"); +// structureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responsePage.getList().get(0)); + structureElementCommandUpdate.setDescription("asdf"); + structureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(structureElement); ITUtilNameElement.assertExists("Sg1", Boolean.TRUE); ITUtilNameElement.assertExists("S1", Boolean.FALSE); - structureElement.setMnemonic("S1"); - ITUtilStructureElement.assertUpdateApprove(structureElement); +// structureElement.setMnemonic("S1"); +// ITUtilStructureElement.assertUpdateApprove(structureElement); + structureElementCommandUpdate.setMnemonic("S1"); + ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(structureElement); ITUtilNameElement.assertExists("Sg1", Boolean.FALSE); ITUtilNameElement.assertExists("S1", Boolean.TRUE); @@ -507,18 +531,26 @@ class StructuresCUDUpdateIT { // test update system structure and ensure name is as expected ResponsePageStructureElements responsePage = null; - StructureElementCommand structureElement = null; + StructureElementCommandUpdate structureElementCommandUpdate = null; + StructureElement structureElement = null; responsePage = ITUtilStructureElement.assertRead("/DEVICETYPE?uuid=" + dt232, 1); - structureElement = responsePage.getList().get(0); - structureElement.setDescription("asdf"); - structureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); +// structureElement = responsePage.getList().get(0); +// structureElement.setDescription("asdf"); +// structureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responsePage.getList().get(0)); + structureElementCommandUpdate.setDescription("asdf"); + structureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(structureElement); ITUtilNameElement.assertExists("Sys23-Sub232:Di2-Dt232-232", Boolean.TRUE); ITUtilNameElement.assertExists("Sys23-Sub232:Di2-D232-232", Boolean.FALSE); - structureElement.setMnemonic("D232"); - ITUtilStructureElement.assertUpdateApprove(structureElement); +// structureElement.setMnemonic("D232"); +// ITUtilStructureElement.assertUpdateApprove(structureElement); + structureElementCommandUpdate.setMnemonic("D232"); + ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(structureElement); ITUtilNameElement.assertExists("Sys23-Sub232:Di2-Dt232-232", Boolean.FALSE); ITUtilNameElement.assertExists("Sys23-Sub232:Di2-D232-232", Boolean.TRUE); @@ -526,9 +558,13 @@ class StructuresCUDUpdateIT { // ---------------------------------------- responsePage = ITUtilStructureElement.assertRead("/DEVICEGROUP?uuid=" + dg22, 1); - structureElement = responsePage.getList().get(0); - structureElement.setDescription("asdf"); - structureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); +// structureElement = responsePage.getList().get(0); +// structureElement.setDescription("asdf"); +// structureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responsePage.getList().get(0)); + structureElementCommandUpdate.setDescription("asdf"); + structureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(structureElement); ITUtilNameElement.assertExists("Sg2:Di2-Dt211-211", Boolean.TRUE); ITUtilNameElement.assertExists("Sg2:Di2-Dt212-212", Boolean.TRUE); @@ -553,9 +589,13 @@ class StructuresCUDUpdateIT { // ---------------------------------------- responsePage = ITUtilStructureElement.assertRead("/DISCIPLINE?uuid=" + di2, 1); - structureElement = responsePage.getList().get(0); - structureElement.setDescription("asdf"); - structureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); +// structureElement = responsePage.getList().get(0); +// structureElement.setDescription("asdf"); +// structureElement = ITUtilStructureElement.assertUpdateApprove(structureElement); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(responsePage.getList().get(0)); + structureElementCommandUpdate.setDescription("asdf"); + structureElement = ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(structureElement); ITUtilNameElement.assertExists("Sg2:Di2-Dt211-211", Boolean.TRUE); ITUtilNameElement.assertExists("Sg2:Di2-Dt212-212", Boolean.TRUE); @@ -577,8 +617,11 @@ class StructuresCUDUpdateIT { ITUtilNameElement.assertExists("Sys23-Sub232:D2-D232-232", Boolean.FALSE); ITUtilNameElement.assertExists("Sys23-Sub233:D2-Dt233-233", Boolean.FALSE); - structureElement.setMnemonic("D2"); - ITUtilStructureElement.assertUpdateApprove(structureElement); +// structureElement.setMnemonic("D2"); +// ITUtilStructureElement.assertUpdateApprove(structureElement); + structureElementCommandUpdate.setMnemonic("D2"); + ITUtilStructureElement.assertUpdateApprove(structureElementCommandUpdate); + structureElementCommandUpdate = StructureElementUtil.convertElement2CommandUpdate(structureElement); ITUtilNameElement.assertExists("Sg2:Di2-Dt211-211", Boolean.FALSE); ITUtilNameElement.assertExists("Sg2:Di2-Dt212-212", Boolean.FALSE); diff --git a/src/test/java/org/openepics/names/docker/complex/StructuresLevel3IT.java b/src/test/java/org/openepics/names/docker/complex/StructuresLevel3IT.java index 18cc94e8ee69ff570f2719483f6c35600d3072d8..1cb46a3cde8725662d274b78ee6d99f8fbe31522 100644 --- a/src/test/java/org/openepics/names/docker/complex/StructuresLevel3IT.java +++ b/src/test/java/org/openepics/names/docker/complex/StructuresLevel3IT.java @@ -30,7 +30,8 @@ import org.openepics.names.docker.ITUtil; import org.openepics.names.docker.ITUtilStructureElement; import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.StructureElement; -import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; +import org.openepics.names.util.StructureElementUtil; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -131,137 +132,137 @@ class StructuresLevel3IT { public static void initAll() { // init system group, system, discipline, device group - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement approvedStructureElement = null; - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "Accelerator", "Acc", "The ESS Linear Accelerator", "approved by alfio"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); systemGroupAcc = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupAcc, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupAcc, "Radio Frequency Quadrupole", "RFQ", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); systemRFQ = approvedStructureElement.getUuid(); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "Cryogenics", "Cryo", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineCryo = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "Electromagnetic Resonators", "EMR", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineEMR = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "Heating, Cooling and Air Conditioning", "HVAC", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineHVAC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "General Process Control", "Proc", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineProc = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "Software Controllers", "SC", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineSC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "Vacuum", "Vac", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineVac = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "Water Cooling", "WtrC", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineWtrC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "Beam Magnets and Deflectors", "BMD", "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineBMD = approvedStructureElement.getUuid(); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineCryo, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineCryo, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupCryo = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineEMR, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineEMR, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupEMR = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineHVAC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineHVAC, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupHVAC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineProc, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineProc, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupProc = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineSC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineSC, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupSC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineVac, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineVac, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupVac = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineWtrC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineWtrC, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupWtrC = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineBMD, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineBMD, "empty", null, "empty", "empty"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupBMD = approvedStructureElement.getUuid(); } @@ -282,38 +283,37 @@ class StructuresLevel3IT { // all create first, all approve separately after all create try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement createdStructureElement_010PRL = null; StructureElement createdStructureElement_010 = null; StructureElement createdStructureElement_N1U1 = null; StructureElement approvedStructureElement = null; - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemRFQ, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemRFQ, "01 Phase Reference Line", "010PRL", "empty", "Approved by Daniel Piso"); - createdStructureElement_010PRL = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_010PRL = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemRFQ, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemRFQ, "RFQ-010", "010", "empty", "Approved by Daniel Piso"); - createdStructureElement_010 = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_010 = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemRFQ, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemRFQ, "Power switch board 01", "N1U1", "Electrical power cabinets", "Approved by Daniel Piso"); - createdStructureElement_N1U1 = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_N1U1 = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_010PRL); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_010PRL)); subsystem010PRL = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_010); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_010)); subsystem010 = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_N1U1); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_N1U1)); subsystemN1U1 = approvedStructureElement.getUuid(); assertNotNull(subsystem010PRL); @@ -341,7 +341,7 @@ class StructuresLevel3IT { // all create first, all approve separately after all create try { - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement createdStructureElement_Cryo_FS = null; StructureElement createdStructureElement_Cryo_IOC = null; @@ -387,221 +387,221 @@ class StructuresLevel3IT { // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupCryo, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupCryo, "Flow Switch", "FS", "empty", "empty"); - createdStructureElement_Cryo_FS = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_Cryo_FS = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupCryo, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupCryo, "Input Output Controller", "IOC", "empty", "empty"); - createdStructureElement_Cryo_IOC = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_Cryo_IOC = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupCryo, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupCryo, "RF Antenna", "RFA", "empty", "empty"); - createdStructureElement_Cryo_RFA = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_Cryo_RFA = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupCryo, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupCryo, "Temperature Transmitter", "TT", "empty", "empty"); - createdStructureElement_Cryo_TT = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_Cryo_TT = ITUtilStructureElement.assertCreate(structureElementCommandCreate); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupEMR, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupEMR, "Flow Switch", "FS", "empty", "empty"); - createdStructureElement_EMR_FS = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_EMR_FS = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupEMR, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupEMR, "Input Output Controller", "IOC", "empty", "empty"); - createdStructureElement_EMR_IOC = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_EMR_IOC = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupEMR, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupEMR, "RF Antenna", "RFA", "empty", "empty"); - createdStructureElement_EMR_RFA = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_EMR_RFA = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupEMR, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupEMR, "Temperature Transmitter", "TT", "empty", "empty"); - createdStructureElement_EMR_TT = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_EMR_TT = ITUtilStructureElement.assertCreate(structureElementCommandCreate); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupHVAC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupHVAC, "Flow Switch", "FS", "empty", "empty"); - createdStructureElement_HVAC_FS = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_HVAC_FS = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupHVAC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupHVAC, "Input Output Controller", "IOC", "empty", "empty"); - createdStructureElement_HVAC_IOC = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_HVAC_IOC = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupHVAC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupHVAC, "RF Antenna", "RFA", "empty", "empty"); - createdStructureElement_HVAC_RFA = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_HVAC_RFA = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupHVAC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupHVAC, "Temperature Transmitter", "TT", "empty", "empty"); - createdStructureElement_HVAC_TT = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_HVAC_TT = ITUtilStructureElement.assertCreate(structureElementCommandCreate); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupProc, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupProc, "Flow Switch", "FS", "empty", "empty"); - createdStructureElement_Proc_FS = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_Proc_FS = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupProc, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupProc, "Input Output Controller", "IOC", "empty", "empty"); - createdStructureElement_Proc_IOC = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_Proc_IOC = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupProc, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupProc, "RF Antenna", "RFA", "empty", "empty"); - createdStructureElement_Proc_RFA = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_Proc_RFA = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupProc, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupProc, "Temperature Transmitter", "TT", "empty", "empty"); - createdStructureElement_Proc_TT = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_Proc_TT = ITUtilStructureElement.assertCreate(structureElementCommandCreate); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupSC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupSC, "Flow Switch", "FS", "empty", "empty"); - createdStructureElement_SC_FS = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_SC_FS = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupSC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupSC, "Input Output Controller", "IOC", "empty", "empty"); - createdStructureElement_SC_IOC = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_SC_IOC = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupSC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupSC, "RF Antenna", "RFA", "empty", "empty"); - createdStructureElement_SC_RFA = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_SC_RFA = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupSC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupSC, "Temperature Transmitter", "TT", "empty", "empty"); - createdStructureElement_SC_TT = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_SC_TT = ITUtilStructureElement.assertCreate(structureElementCommandCreate); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupVac, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupVac, "Flow Switch", "FS", "empty", "empty"); - createdStructureElement_Vac_FS = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_Vac_FS = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupVac, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupVac, "Input Output Controller", "IOC", "empty", "empty"); - createdStructureElement_Vac_IOC = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_Vac_IOC = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupVac, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupVac, "RF Antenna", "RFA", "empty", "empty"); - createdStructureElement_Vac_RFA = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_Vac_RFA = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupVac, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupVac, "Temperature Transmitter", "TT", "empty", "empty"); - createdStructureElement_Vac_TT = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_Vac_TT = ITUtilStructureElement.assertCreate(structureElementCommandCreate); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupWtrC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupWtrC, "Flow Switch", "FS", "empty", "empty"); - createdStructureElement_WtrC_FS = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_WtrC_FS = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupWtrC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupWtrC, "Input Output Controller", "IOC", "empty", "empty"); - createdStructureElement_WtrC_IOC = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_WtrC_IOC = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupWtrC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupWtrC, "RF Antenna", "RFA", "empty", "empty"); - createdStructureElement_WtrC_RFA = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_WtrC_RFA = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupWtrC, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupWtrC, "Temperature Transmitter", "TT", "empty", "empty"); - createdStructureElement_WtrC_TT = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_WtrC_TT = ITUtilStructureElement.assertCreate(structureElementCommandCreate); // ---------------------------------------------------------------------------------------------------- - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupBMD, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupBMD, "Flow Switch", "FS", "empty", "empty"); - createdStructureElement_BMD_FS = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_BMD_FS = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupBMD, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupBMD, "Input Output Controller", "IOC", "empty", "empty"); - createdStructureElement_BMD_IOC = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_BMD_IOC = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupBMD, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupBMD, "RF Antenna", "RFA", "empty", "empty"); - createdStructureElement_BMD_RFA = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_BMD_RFA = ITUtilStructureElement.assertCreate(structureElementCommandCreate); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupBMD, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupBMD, "Temperature Transmitter", "TT", "empty", "empty"); - createdStructureElement_BMD_TT = ITUtilStructureElement.assertCreate(structureElement); + createdStructureElement_BMD_TT = ITUtilStructureElement.assertCreate(structureElementCommandCreate); // ---------------------------------------------------------------------------------------------------- - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_Cryo_FS); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_Cryo_FS)); deviceType_Cryo_FS = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_Cryo_IOC); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_Cryo_IOC)); deviceType_Cryo_IOC = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_Cryo_RFA); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_Cryo_RFA)); deviceType_Cryo_RFA = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_Cryo_TT); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_Cryo_TT)); deviceType_Cryo_TT = approvedStructureElement.getUuid(); assertNotNull(deviceType_Cryo_FS); @@ -609,13 +609,13 @@ class StructuresLevel3IT { assertNotNull(deviceType_Cryo_RFA); assertNotNull(deviceType_Cryo_TT); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_EMR_FS); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_EMR_FS)); deviceType_EMR_IOC = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_EMR_IOC); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_EMR_IOC)); deviceType_EMR_FS = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_EMR_RFA); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_EMR_RFA)); deviceType_EMR_RFA = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_EMR_TT); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_EMR_TT)); deviceType_EMR_TT = approvedStructureElement.getUuid(); assertNotNull(deviceType_EMR_FS); @@ -623,13 +623,13 @@ class StructuresLevel3IT { assertNotNull(deviceType_EMR_RFA); assertNotNull(deviceType_EMR_TT); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_HVAC_FS); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_HVAC_FS)); deviceType_HVAC_FS = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_HVAC_IOC); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_HVAC_IOC)); deviceType_HVAC_IOC = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_HVAC_RFA); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_HVAC_RFA)); deviceType_HVAC_RFA = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_HVAC_TT); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_HVAC_TT)); deviceType_HVAC_TT = approvedStructureElement.getUuid(); assertNotNull(deviceType_HVAC_FS); @@ -637,13 +637,13 @@ class StructuresLevel3IT { assertNotNull(deviceType_HVAC_RFA); assertNotNull(deviceType_HVAC_TT); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_Proc_FS); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_Proc_FS)); deviceType_Proc_FS = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_Proc_IOC); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_Proc_IOC)); deviceType_Proc_IOC = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_Proc_RFA); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_Proc_RFA)); deviceType_Proc_RFA = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_Proc_TT); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_Proc_TT)); deviceType_Proc_TT = approvedStructureElement.getUuid(); assertNotNull(deviceType_Proc_FS); @@ -651,13 +651,13 @@ class StructuresLevel3IT { assertNotNull(deviceType_Proc_RFA); assertNotNull(deviceType_Proc_TT); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_SC_FS); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_SC_FS)); deviceType_SC_FS = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_SC_IOC); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_SC_IOC)); deviceType_SC_IOC = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_SC_RFA); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_SC_RFA)); deviceType_SC_RFA = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_SC_TT); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_SC_TT)); deviceType_SC_TT = approvedStructureElement.getUuid(); assertNotNull(deviceType_SC_FS); @@ -665,13 +665,13 @@ class StructuresLevel3IT { assertNotNull(deviceType_SC_RFA); assertNotNull(deviceType_SC_TT); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_Vac_FS); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_Vac_FS)); deviceType_Vac_FS = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_Vac_IOC); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_Vac_IOC)); deviceType_Vac_IOC = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_Vac_RFA); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_Vac_RFA)); deviceType_Vac_RFA = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_Vac_TT); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_Vac_TT)); deviceType_Vac_TT = approvedStructureElement.getUuid(); assertNotNull(deviceType_Vac_FS); @@ -679,13 +679,13 @@ class StructuresLevel3IT { assertNotNull(deviceType_Vac_RFA); assertNotNull(deviceType_Vac_TT); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_WtrC_FS); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_WtrC_FS)); deviceType_WtrC_FS = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_WtrC_IOC); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_WtrC_IOC)); deviceType_WtrC_IOC = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_WtrC_RFA); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_WtrC_RFA)); deviceType_WtrC_RFA = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_WtrC_TT); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_WtrC_TT)); deviceType_WtrC_TT = approvedStructureElement.getUuid(); assertNotNull(deviceType_WtrC_FS); @@ -693,13 +693,13 @@ class StructuresLevel3IT { assertNotNull(deviceType_WtrC_RFA); assertNotNull(deviceType_WtrC_TT); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_BMD_FS); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_BMD_FS)); deviceType_BMD_FS = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_BMD_IOC); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_BMD_IOC)); deviceType_BMD_IOC = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_BMD_RFA); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_BMD_RFA)); deviceType_BMD_RFA = approvedStructureElement.getUuid(); - approvedStructureElement = ITUtilStructureElement.assertApprove(createdStructureElement_BMD_TT); + approvedStructureElement = ITUtilStructureElement.assertApprove(StructureElementUtil.convertElement2CommandConfirm(createdStructureElement_BMD_TT)); deviceType_BMD_TT = approvedStructureElement.getUuid(); assertNotNull(deviceType_BMD_FS); diff --git a/src/test/java/org/openepics/names/docker/complex/StructuresMultipleIT.java b/src/test/java/org/openepics/names/docker/complex/StructuresMultipleIT.java index 110b6059bab1d702338161b55167942cd5cd9c4b..3c02785eb04eb1699ac05da715f3d45083c26253 100644 --- a/src/test/java/org/openepics/names/docker/complex/StructuresMultipleIT.java +++ b/src/test/java/org/openepics/names/docker/complex/StructuresMultipleIT.java @@ -32,7 +32,11 @@ import org.openepics.names.docker.ITUtilStructureElement; import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.StructureElement; import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandConfirm; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; +import org.openepics.names.rest.beans.element.StructureElementCommandUpdate; import org.openepics.names.util.StructureCommand; +import org.openepics.names.util.StructureElementUtil; import org.testcontainers.containers.DockerComposeContainer; import org.testcontainers.containers.wait.strategy.Wait; import org.testcontainers.junit.jupiter.Container; @@ -70,49 +74,49 @@ class StructuresMultipleIT { public static void initAll() { // init system group, system, discipline, device group - StructureElementCommand structureElement = null; + StructureElementCommandCreate structureElementCommandCreate = null; StructureElement approvedStructureElement = null; - structureElement = new StructureElementCommand( - null, Type.SYSTEMGROUP, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEMGROUP, null, "name", "Sg", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); systemGroupUuid = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SYSTEM, systemGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SYSTEM, systemGroupUuid, "name", "Sys", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); systemUuid = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.SUBSYSTEM, systemUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.SUBSYSTEM, systemUuid, "name", "Sub", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); subsystemUuid = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DISCIPLINE, null, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DISCIPLINE, null, "name", "Di", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); disciplineUuid = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICEGROUP, disciplineUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICEGROUP, disciplineUuid, "name", null, "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceGroupUuid = approvedStructureElement.getUuid(); - structureElement = new StructureElementCommand( - null, Type.DEVICETYPE, deviceGroupUuid, + structureElementCommandCreate = new StructureElementCommandCreate( + Type.DEVICETYPE, deviceGroupUuid, "name", "Dt", "description", "comment"); - approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElement); + approvedStructureElement = ITUtilStructureElement.assertCreateApprove(structureElementCommandCreate); deviceTypeUuid = approvedStructureElement.getUuid(); } @@ -137,8 +141,10 @@ class StructuresMultipleIT { // comment try { - StructureElementCommand[] structureElements = null; - UUID uuid = null; + StructureElementCommandCreate[] structureElementCommandsCreate = null; + StructureElementCommandUpdate[] structureElementCommandsUpdate = null; + StructureElementCommandConfirm[] structureElementCommandsConfirm = null; + StructureElementCommand[] structureElementCommands = null; String value = null; ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "Sg", Boolean.TRUE); @@ -171,7 +177,7 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-Dt", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtChc", Boolean.TRUE); - structureElements = new StructureElementCommand[] { + structureElementCommands = new StructureElementCommand[] { new StructureElementCommand(null, Type.SYSTEMGROUP, null, "name", "SgChc", "description", "comment"), new StructureElementCommand(null, Type.SYSTEM, systemGroupUuid, "name", "SysChc", "description", "comment"), new StructureElementCommand(null, Type.SUBSYSTEM, systemUuid, "name", "SubChc", "description", "comment"), @@ -179,54 +185,58 @@ class StructuresMultipleIT { new StructureElementCommand(null, Type.DEVICEGROUP, disciplineUuid, "name", "", "description", "comment"), new StructureElementCommand(null, Type.DEVICETYPE, deviceGroupUuid, "name", "DtChc", "description", "comment") }; - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.REJECT, Boolean.FALSE); - - uuid = subsystemUuid; - structureElements[1].setUuid(uuid); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.FALSE); - structureElements[1].setUuid(null); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - - structureElements[1].setType(null); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.FALSE); - structureElements[1].setType(Type.SYSTEMGROUP); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.FALSE); - structureElements[1].setType(Type.SUBSYSTEM); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.FALSE); - structureElements[1].setType(Type.SYSTEM); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - - structureElements[1].setParent(null); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.FALSE); - structureElements[1].setParent(systemUuid); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.FALSE); - structureElements[1].setParent(subsystemUuid); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.FALSE); - structureElements[1].setParent(systemGroupUuid); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - - value = structureElements[1].getName(); - structureElements[1].setName(null); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.FALSE); - structureElements[1].setName(value); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - - value = structureElements[1].getDescription(); - structureElements[1].setDescription(null); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.FALSE); - structureElements[1].setDescription(value); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - - value = structureElements[1].getComment(); - structureElements[1].setComment(null); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.FALSE); - structureElements[1].setComment(value); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); + structureElementCommandsCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommands); + structureElementCommandsUpdate = StructureElementUtil.convertCommand2CommandUpdate(structureElementCommands); + structureElementCommandsConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommands); + + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); + +// uuid = subsystemUuid; +// structureElementCommandsCreate[1].setUuid(uuid); +// ITUtilStructureElement.assertValidate(structureElementCommands, StructureCommand.CREATE, Boolean.FALSE); +// structureElementCommandsCreate[1].setUuid(null); +// ITUtilStructureElement.assertValidate(structureElementCommands, StructureCommand.CREATE, Boolean.TRUE); + + structureElementCommandsCreate[1].setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandsCreate[1].setType(Type.SYSTEMGROUP); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandsCreate[1].setType(Type.SUBSYSTEM); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandsCreate[1].setType(Type.SYSTEM); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + + structureElementCommandsCreate[1].setParent(null); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandsCreate[1].setParent(systemUuid); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandsCreate[1].setParent(subsystemUuid); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandsCreate[1].setParent(systemGroupUuid); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + + value = structureElementCommandsCreate[1].getName(); + structureElementCommandsCreate[1].setName(null); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandsCreate[1].setName(value); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + + value = structureElementCommandsCreate[1].getDescription(); + structureElementCommandsCreate[1].setDescription(null); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandsCreate[1].setDescription(value); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + + value = structureElementCommandsCreate[1].getComment(); + structureElementCommandsCreate[1].setComment(null); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + structureElementCommandsCreate[1].setComment(value); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -249,11 +259,14 @@ class StructuresMultipleIT { // create in order to approve try { - StructureElementCommand[] structureElements = null; + StructureElementCommandCreate[] structureElementCommandsCreate = null; + StructureElementCommandUpdate[] structureElementCommandsUpdate = null; + StructureElementCommandConfirm[] structureElementCommandsConfirm = null; + StructureElementCommand[] structureElementCommands = null; StructureElement[] createdStructureElements = null; StructureElement[] approvedStructureElements = null; - structureElements = new StructureElementCommand[] { + structureElementCommands = new StructureElementCommand[] { new StructureElementCommand(null, Type.SYSTEMGROUP, null, "name", "SgCa", "description", "comment"), new StructureElementCommand(null, Type.SYSTEM, systemGroupUuid, "name", "SysCa", "description", "comment"), new StructureElementCommand(null, Type.SUBSYSTEM, systemUuid, "name", "SubCa", "description", "comment"), @@ -261,6 +274,9 @@ class StructuresMultipleIT { new StructureElementCommand(null, Type.DEVICEGROUP, disciplineUuid, "name", "", "description", "comment"), new StructureElementCommand(null, Type.DEVICETYPE, deviceGroupUuid, "name", "DtCa", "description", "comment") }; + structureElementCommandsCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommands); + structureElementCommandsUpdate = StructureElementUtil.convertCommand2CommandUpdate(structureElementCommands); + structureElementCommandsConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommands); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgCa", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysCa", Boolean.FALSE); @@ -275,17 +291,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpCa", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtCa", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - createdStructureElements = ITUtilStructureElement.assertCreate(structureElements); + createdStructureElements = ITUtilStructureElement.assertCreate(structureElementCommandsCreate); assertNotNull(createdStructureElements); assertEquals(6, createdStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(createdStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(createdStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgCa", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysCa", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubCa", Boolean.FALSE); @@ -299,17 +319,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpCa", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtCa", Boolean.TRUE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.APPROVE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.CANCEL, Boolean.TRUE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.TRUE); - approvedStructureElements = ITUtilStructureElement.assertApprove(createdStructureElements); + approvedStructureElements = ITUtilStructureElement.assertApprove(structureElementCommandsConfirm); assertNotNull(approvedStructureElements); assertEquals(6, approvedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(approvedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgCa", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysCa", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubCa", Boolean.TRUE); @@ -323,12 +347,12 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpCa", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtCa", Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -351,11 +375,14 @@ class StructuresMultipleIT { // create in order to cancel try { - StructureElementCommand[] structureElements = null; + StructureElementCommandCreate[] structureElementCommandsCreate = null; + StructureElementCommandUpdate[] structureElementCommandsUpdate = null; + StructureElementCommandConfirm[] structureElementCommandsConfirm = null; + StructureElementCommand[] structureElementCommands = null; StructureElement[] createdStructureElements = null; StructureElement[] cancelledStructureElements = null; - structureElements = new StructureElementCommand[] { + structureElementCommands = new StructureElementCommand[] { new StructureElementCommand(null, Type.SYSTEMGROUP, null, "name", "SgCc", "description", "comment"), new StructureElementCommand(null, Type.SYSTEM, systemGroupUuid, "name", "SysCc", "description", "comment"), new StructureElementCommand(null, Type.SUBSYSTEM, systemUuid, "name", "SubCc", "description", "comment"), @@ -363,6 +390,9 @@ class StructuresMultipleIT { new StructureElementCommand(null, Type.DEVICEGROUP, disciplineUuid, "name", "", "description", "comment"), new StructureElementCommand(null, Type.DEVICETYPE, deviceGroupUuid, "name", "DtCc", "description", "comment") }; + structureElementCommandsCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommands); + structureElementCommandsUpdate = StructureElementUtil.convertCommand2CommandUpdate(structureElementCommands); + structureElementCommandsConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommands); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgCc", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysCc", Boolean.FALSE); @@ -377,17 +407,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpCc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtCc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - createdStructureElements = ITUtilStructureElement.assertCreate(structureElements); + createdStructureElements = ITUtilStructureElement.assertCreate(structureElementCommandsCreate); assertNotNull(createdStructureElements); assertEquals(6, createdStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(createdStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(createdStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgCc", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysCc", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubCc", Boolean.FALSE); @@ -401,17 +435,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpCc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtCc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.APPROVE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.CANCEL, Boolean.TRUE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.TRUE); - cancelledStructureElements = ITUtilStructureElement.assertCancel(createdStructureElements); + cancelledStructureElements = ITUtilStructureElement.assertCancel(structureElementCommandsConfirm); assertNotNull(cancelledStructureElements); assertEquals(6, cancelledStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(cancelledStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(cancelledStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(cancelledStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgCc", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysCc", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubCc", Boolean.FALSE); @@ -424,13 +462,19 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DISCIPLINE, "DiCc", Boolean.TRUE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpCc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtCc", Boolean.TRUE); - - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.REJECT, Boolean.FALSE); +///// +// ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -451,11 +495,14 @@ class StructuresMultipleIT { // create in order to reject try { - StructureElementCommand[] structureElements = null; + StructureElementCommandCreate[] structureElementCommandsCreate = null; + StructureElementCommandUpdate[] structureElementCommandsUpdate = null; + StructureElementCommandConfirm[] structureElementCommandsConfirm = null; + StructureElementCommand[] structureElementCommands = null; StructureElement[] createdStructureElements = null; StructureElement[] rejectedStructureElements = null; - structureElements = new StructureElementCommand[] { + structureElementCommands = new StructureElementCommand[] { new StructureElementCommand(null, Type.SYSTEMGROUP, null, "name", "SgCr", "description", "comment"), new StructureElementCommand(null, Type.SYSTEM, systemGroupUuid, "name", "SysCr", "description", "comment"), new StructureElementCommand(null, Type.SUBSYSTEM, systemUuid, "name", "SubCr", "description", "comment"), @@ -463,6 +510,9 @@ class StructuresMultipleIT { new StructureElementCommand(null, Type.DEVICEGROUP, disciplineUuid, "name", "", "description", "comment"), new StructureElementCommand(null, Type.DEVICETYPE, deviceGroupUuid, "name", "DtCr", "description", "comment") }; + structureElementCommandsCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommands); + structureElementCommandsUpdate = StructureElementUtil.convertCommand2CommandUpdate(structureElementCommands); + structureElementCommandsConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommands); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgCr", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysCr", Boolean.FALSE); @@ -477,17 +527,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpCr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtCr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - createdStructureElements = ITUtilStructureElement.assertCreate(structureElements); + createdStructureElements = ITUtilStructureElement.assertCreate(structureElementCommandsCreate); assertNotNull(createdStructureElements); assertEquals(6, createdStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(createdStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(createdStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(createdStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgCr", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysCr", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubCr", Boolean.FALSE); @@ -501,17 +555,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpCr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtCr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.APPROVE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.CANCEL, Boolean.TRUE); - ITUtilStructureElement.assertValidate(createdStructureElements, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.TRUE); - rejectedStructureElements = ITUtilStructureElement.assertReject(createdStructureElements); + rejectedStructureElements = ITUtilStructureElement.assertReject(structureElementCommandsConfirm); assertNotNull(rejectedStructureElements); assertEquals(6, rejectedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(rejectedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(rejectedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(rejectedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgCr", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysCr", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubCr", Boolean.FALSE); @@ -524,13 +582,19 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DISCIPLINE, "DiCr", Boolean.TRUE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpCr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtCr", Boolean.TRUE); - - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.REJECT, Boolean.FALSE); +///// +// ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -564,12 +628,15 @@ class StructuresMultipleIT { // comment try { - StructureElementCommand[] structureElements = null; + StructureElementCommandCreate[] structureElementCommandsCreate = null; + StructureElementCommandUpdate[] structureElementCommandsUpdate = null; + StructureElementCommandConfirm[] structureElementCommandsConfirm = null; + StructureElementCommand[] structureElementCommands = null; StructureElement[] approvedStructureElements = null; UUID uuid = null; String value = null; - structureElements = new StructureElementCommand[] { + structureElementCommands = new StructureElementCommand[] { new StructureElementCommand(null, Type.SYSTEMGROUP, null, "name", "SgCu", "description", "comment"), new StructureElementCommand(null, Type.SYSTEM, systemGroupUuid, "name", "SysCu", "description", "comment"), new StructureElementCommand(null, Type.SUBSYSTEM, systemUuid, "name", "SubCu", "description", "comment"), @@ -577,6 +644,9 @@ class StructuresMultipleIT { new StructureElementCommand(null, Type.DEVICEGROUP, disciplineUuid, "name", "", "description", "comment"), new StructureElementCommand(null, Type.DEVICETYPE, deviceGroupUuid, "name", "DtCu", "description", "comment") }; + structureElementCommandsCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommands); + structureElementCommandsUpdate = StructureElementUtil.convertCommand2CommandUpdate(structureElementCommands); + structureElementCommandsConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommands); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgCu", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysCu", Boolean.FALSE); @@ -591,17 +661,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpCu", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtCu", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - approvedStructureElements = ITUtilStructureElement.assertCreateApprove(structureElements); + approvedStructureElements = ITUtilStructureElement.assertCreateApprove(structureElementCommandsCreate); assertNotNull(approvedStructureElements); assertEquals(6, approvedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(approvedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgCu", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysCu", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubCu", Boolean.TRUE); @@ -615,54 +689,54 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpCu", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtCu", Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); uuid = approvedStructureElements[1].getUuid(); - approvedStructureElements[1].setUuid(null); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - approvedStructureElements[1].setUuid(uuid); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - - approvedStructureElements[1].setType(null); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - approvedStructureElements[1].setType(Type.SYSTEMGROUP); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - approvedStructureElements[1].setType(Type.SUBSYSTEM); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - approvedStructureElements[1].setType(Type.SYSTEM); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - - approvedStructureElements[1].setParent(null); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - approvedStructureElements[1].setParent(systemUuid); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - approvedStructureElements[1].setParent(subsystemUuid); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - approvedStructureElements[1].setParent(systemGroupUuid); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - - value = approvedStructureElements[1].getName(); - approvedStructureElements[1].setName(null); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - approvedStructureElements[1].setName(value); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - - value = approvedStructureElements[1].getDescription(); - approvedStructureElements[1].setDescription(null); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - approvedStructureElements[1].setDescription(value); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - - value = approvedStructureElements[1].getComment(); - approvedStructureElements[1].setComment(null); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - approvedStructureElements[1].setComment(value); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); + structureElementCommandsUpdate[1].setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandsUpdate[1].setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + + structureElementCommandsUpdate[1].setType(null); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandsUpdate[1].setType(Type.SYSTEMGROUP); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandsUpdate[1].setType(Type.SUBSYSTEM); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandsUpdate[1].setType(Type.SYSTEM); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + + structureElementCommandsUpdate[1].setParent(null); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandsUpdate[1].setParent(systemUuid); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandsUpdate[1].setParent(subsystemUuid); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandsUpdate[1].setParent(systemGroupUuid); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + + value = structureElementCommandsUpdate[1].getName(); + structureElementCommandsUpdate[1].setName(null); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandsUpdate[1].setName(value); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + + value = structureElementCommandsUpdate[1].getDescription(); + structureElementCommandsUpdate[1].setDescription(null); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandsUpdate[1].setDescription(value); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + + value = structureElementCommandsUpdate[1].getComment(); + structureElementCommandsUpdate[1].setComment(null); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + structureElementCommandsUpdate[1].setComment(value); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -687,11 +761,14 @@ class StructuresMultipleIT { // create, approve in order to update, approve try { - StructureElementCommand[] structureElements = null; + StructureElementCommandCreate[] structureElementCommandsCreate = null; + StructureElementCommandUpdate[] structureElementCommandsUpdate = null; + StructureElementCommandConfirm[] structureElementCommandsConfirm = null; + StructureElementCommand[] structureElementCommands = null; StructureElement[] approvedStructureElements = null; StructureElement[] updatedStructureElements = null; - structureElements = new StructureElementCommand[] { + structureElementCommands = new StructureElementCommand[] { new StructureElementCommand(null, Type.SYSTEMGROUP, null, "name", "SgUa", "description", "comment"), new StructureElementCommand(null, Type.SYSTEM, systemGroupUuid, "name", "SysUa", "description", "comment"), new StructureElementCommand(null, Type.SUBSYSTEM, systemUuid, "name", "SubUa", "description", "comment"), @@ -699,6 +776,9 @@ class StructuresMultipleIT { new StructureElementCommand(null, Type.DEVICEGROUP, disciplineUuid, "name", "", "description", "comment"), new StructureElementCommand(null, Type.DEVICETYPE, deviceGroupUuid, "name", "DtUa", "description", "comment") }; + structureElementCommandsCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommands); + structureElementCommandsUpdate = StructureElementUtil.convertCommand2CommandUpdate(structureElementCommands); + structureElementCommandsConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommands); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgUa", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysUa", Boolean.FALSE); @@ -713,17 +793,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpUa", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtUa", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - approvedStructureElements = ITUtilStructureElement.assertCreateApprove(structureElements); + approvedStructureElements = ITUtilStructureElement.assertCreateApprove(structureElementCommandsCreate); assertNotNull(approvedStructureElements); assertEquals(6, approvedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(approvedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgUa", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysUa", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubUa", Boolean.TRUE); @@ -737,19 +821,19 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpUa", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtUa", Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - approvedStructureElements[0].setDescription("0"); - approvedStructureElements[1].setDescription("1"); - approvedStructureElements[2].setDescription("2"); - approvedStructureElements[3].setDescription("3"); - approvedStructureElements[4].setDescription("4"); - approvedStructureElements[5].setDescription("5"); + structureElementCommandsUpdate[0].setDescription("0"); + structureElementCommandsUpdate[1].setDescription("1"); + structureElementCommandsUpdate[2].setDescription("2"); + structureElementCommandsUpdate[3].setDescription("3"); + structureElementCommandsUpdate[4].setDescription("4"); + structureElementCommandsUpdate[5].setDescription("5"); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgUa", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysUa", Boolean.TRUE); @@ -764,17 +848,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpUa", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtUa", Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - updatedStructureElements = ITUtilStructureElement.assertUpdate(approvedStructureElements); + updatedStructureElements = ITUtilStructureElement.assertUpdate(structureElementCommandsUpdate); assertNotNull(updatedStructureElements); assertEquals(6, updatedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(updatedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(updatedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(updatedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgUa", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysUa", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubUa", Boolean.TRUE); @@ -788,17 +876,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpUa", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtUa", Boolean.FALSE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.APPROVE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.CANCEL, Boolean.TRUE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.TRUE); - approvedStructureElements = ITUtilStructureElement.assertApprove(updatedStructureElements); + approvedStructureElements = ITUtilStructureElement.assertApprove(structureElementCommandsConfirm); assertNotNull(approvedStructureElements); assertEquals(6, approvedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(approvedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgUa", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysUa", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubUa", Boolean.TRUE); @@ -812,12 +904,12 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpUa", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtUa", Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -844,12 +936,15 @@ class StructuresMultipleIT { // create, approve in order to update, cancel try { - StructureElementCommand[] structureElements = null; + StructureElementCommandCreate[] structureElementCommandsCreate = null; + StructureElementCommandUpdate[] structureElementCommandsUpdate = null; + StructureElementCommandConfirm[] structureElementCommandsConfirm = null; + StructureElementCommand[] structureElementCommands = null; StructureElement[] approvedStructureElements = null; StructureElement[] updatedStructureElements = null; StructureElement[] cancelledStructureElements = null; - structureElements = new StructureElementCommand[] { + structureElementCommands = new StructureElementCommand[] { new StructureElementCommand(null, Type.SYSTEMGROUP, null, "name", "SgUc", "description", "comment"), new StructureElementCommand(null, Type.SYSTEM, systemGroupUuid, "name", "SysUc", "description", "comment"), new StructureElementCommand(null, Type.SUBSYSTEM, systemUuid, "name", "SubUc", "description", "comment"), @@ -857,6 +952,9 @@ class StructuresMultipleIT { new StructureElementCommand(null, Type.DEVICEGROUP, disciplineUuid, "name", "", "description", "comment"), new StructureElementCommand(null, Type.DEVICETYPE, deviceGroupUuid, "name", "DtUc", "description", "comment") }; + structureElementCommandsCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommands); + structureElementCommandsUpdate = StructureElementUtil.convertCommand2CommandUpdate(structureElementCommands); + structureElementCommandsConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommands); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgUc", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysUc", Boolean.FALSE); @@ -871,17 +969,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpUc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtUc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - approvedStructureElements = ITUtilStructureElement.assertCreateApprove(structureElements); + approvedStructureElements = ITUtilStructureElement.assertCreateApprove(structureElementCommandsCreate); assertNotNull(approvedStructureElements); assertEquals(6, approvedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(approvedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgUc", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysUc", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubUc", Boolean.TRUE); @@ -895,19 +997,19 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpUc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtUc", Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - approvedStructureElements[0].setDescription("0"); - approvedStructureElements[1].setDescription("1"); - approvedStructureElements[2].setDescription("2"); - approvedStructureElements[3].setDescription("3"); - approvedStructureElements[4].setDescription("4"); - approvedStructureElements[5].setDescription("5"); + structureElementCommandsUpdate[0].setDescription("0"); + structureElementCommandsUpdate[1].setDescription("1"); + structureElementCommandsUpdate[2].setDescription("2"); + structureElementCommandsUpdate[3].setDescription("3"); + structureElementCommandsUpdate[4].setDescription("4"); + structureElementCommandsUpdate[5].setDescription("5"); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgUc", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysUc", Boolean.TRUE); @@ -922,17 +1024,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpUc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtUc", Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - updatedStructureElements = ITUtilStructureElement.assertUpdate(approvedStructureElements); + updatedStructureElements = ITUtilStructureElement.assertUpdate(structureElementCommandsUpdate); assertNotNull(updatedStructureElements); assertEquals(6, updatedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(updatedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(updatedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(updatedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgUc", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysUc", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubUc", Boolean.TRUE); @@ -946,17 +1052,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpUc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtUc", Boolean.FALSE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.APPROVE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.CANCEL, Boolean.TRUE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.TRUE); - cancelledStructureElements = ITUtilStructureElement.assertCancel(updatedStructureElements); + cancelledStructureElements = ITUtilStructureElement.assertCancel(structureElementCommandsConfirm); assertNotNull(cancelledStructureElements); assertEquals(6, cancelledStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(cancelledStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(cancelledStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(cancelledStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgUc", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysUc", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubUc", Boolean.TRUE); @@ -970,12 +1080,12 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpUc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtUc", Boolean.FALSE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -1002,12 +1112,15 @@ class StructuresMultipleIT { // create, approve in order to update, reject try { - StructureElementCommand[] structureElements = null; + StructureElementCommandCreate[] structureElementCommandsCreate = null; + StructureElementCommandUpdate[] structureElementCommandsUpdate = null; + StructureElementCommandConfirm[] structureElementCommandsConfirm = null; + StructureElementCommand[] structureElementCommands = null; StructureElement[] approvedStructureElements = null; StructureElement[] updatedStructureElements = null; StructureElement[] rejectedStructureElements = null; - structureElements = new StructureElementCommand[] { + structureElementCommands = new StructureElementCommand[] { new StructureElementCommand(null, Type.SYSTEMGROUP, null, "name", "SgUr", "description", "comment"), new StructureElementCommand(null, Type.SYSTEM, systemGroupUuid, "name", "SysUr", "description", "comment"), new StructureElementCommand(null, Type.SUBSYSTEM, systemUuid, "name", "SubUr", "description", "comment"), @@ -1015,6 +1128,9 @@ class StructuresMultipleIT { new StructureElementCommand(null, Type.DEVICEGROUP, disciplineUuid, "name", "", "description", "comment"), new StructureElementCommand(null, Type.DEVICETYPE, deviceGroupUuid, "name", "DtUr", "description", "comment") }; + structureElementCommandsCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommands); + structureElementCommandsUpdate = StructureElementUtil.convertCommand2CommandUpdate(structureElementCommands); + structureElementCommandsConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommands); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgUr", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysUr", Boolean.FALSE); @@ -1029,17 +1145,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpUr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtUr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - approvedStructureElements = ITUtilStructureElement.assertCreateApprove(structureElements); + approvedStructureElements = ITUtilStructureElement.assertCreateApprove(structureElementCommandsCreate); assertNotNull(approvedStructureElements); assertEquals(6, approvedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(approvedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgUr", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysUr", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubUr", Boolean.TRUE); @@ -1053,19 +1173,19 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpUr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtUr", Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - approvedStructureElements[0].setDescription("0"); - approvedStructureElements[1].setDescription("1"); - approvedStructureElements[2].setDescription("2"); - approvedStructureElements[3].setDescription("3"); - approvedStructureElements[4].setDescription("4"); - approvedStructureElements[5].setDescription("5"); + structureElementCommandsUpdate[0].setDescription("0"); + structureElementCommandsUpdate[1].setDescription("1"); + structureElementCommandsUpdate[2].setDescription("2"); + structureElementCommandsUpdate[3].setDescription("3"); + structureElementCommandsUpdate[4].setDescription("4"); + structureElementCommandsUpdate[5].setDescription("5"); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgUr", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysUr", Boolean.TRUE); @@ -1080,17 +1200,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpUr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtUr", Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - updatedStructureElements = ITUtilStructureElement.assertUpdate(approvedStructureElements); + updatedStructureElements = ITUtilStructureElement.assertUpdate(structureElementCommandsUpdate); assertNotNull(updatedStructureElements); assertEquals(6, updatedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(updatedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(updatedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(updatedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgUr", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysUr", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubUr", Boolean.TRUE); @@ -1104,17 +1228,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpUr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtUr", Boolean.FALSE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.APPROVE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.CANCEL, Boolean.TRUE); - ITUtilStructureElement.assertValidate(updatedStructureElements, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.TRUE); - rejectedStructureElements = ITUtilStructureElement.assertReject(updatedStructureElements); + rejectedStructureElements = ITUtilStructureElement.assertReject(structureElementCommandsConfirm); assertNotNull(rejectedStructureElements); assertEquals(6, rejectedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(rejectedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(rejectedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(rejectedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgUr", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysUr", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubUr", Boolean.TRUE); @@ -1128,12 +1256,12 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpUr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtUr", Boolean.FALSE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -1161,12 +1289,15 @@ class StructuresMultipleIT { // comment try { - StructureElementCommand[] structureElements = null; + StructureElementCommandCreate[] structureElementCommandsCreate = null; + StructureElementCommandUpdate[] structureElementCommandsUpdate = null; + StructureElementCommandConfirm[] structureElementCommandsConfirm = null; + StructureElementCommand[] structureElementCommands = null; StructureElement[] approvedStructureElements = null; UUID uuid = null; String value = null; - structureElements = new StructureElementCommand[] { + structureElementCommands = new StructureElementCommand[] { new StructureElementCommand(null, Type.SYSTEMGROUP, null, "name", "SgCd", "description", "comment"), new StructureElementCommand(null, Type.SYSTEM, systemGroupUuid, "name", "SysCd", "description", "comment"), new StructureElementCommand(null, Type.SUBSYSTEM, systemUuid, "name", "SubCd", "description", "comment"), @@ -1174,6 +1305,9 @@ class StructuresMultipleIT { new StructureElementCommand(null, Type.DEVICEGROUP, disciplineUuid, "name", "", "description", "comment"), new StructureElementCommand(null, Type.DEVICETYPE, deviceGroupUuid, "name", "DtCd", "description", "comment") }; + structureElementCommandsCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommands); + structureElementCommandsUpdate = StructureElementUtil.convertCommand2CommandUpdate(structureElementCommands); + structureElementCommandsConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommands); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgCd", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysCd", Boolean.FALSE); @@ -1188,17 +1322,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpCd", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtCd", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - approvedStructureElements = ITUtilStructureElement.assertCreateApprove(structureElements); + approvedStructureElements = ITUtilStructureElement.assertCreateApprove(structureElementCommandsCreate); assertNotNull(approvedStructureElements); assertEquals(6, approvedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(approvedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgCd", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysCd", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubCd", Boolean.TRUE); @@ -1212,54 +1350,24 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpCd", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtCd", Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.REJECT, Boolean.FALSE); - - uuid = approvedStructureElements[1].getUuid(); - approvedStructureElements[1].setUuid(null); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.FALSE); - approvedStructureElements[1].setUuid(uuid); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - - approvedStructureElements[1].setType(null); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.FALSE); - approvedStructureElements[1].setType(Type.SYSTEMGROUP); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.FALSE); - approvedStructureElements[1].setType(Type.SUBSYSTEM); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.FALSE); - approvedStructureElements[1].setType(Type.SYSTEM); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - - approvedStructureElements[1].setParent(null); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - approvedStructureElements[1].setParent(systemUuid); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - approvedStructureElements[1].setParent(subsystemUuid); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - approvedStructureElements[1].setParent(systemGroupUuid); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - - value = approvedStructureElements[1].getName(); - approvedStructureElements[1].setName(null); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - approvedStructureElements[1].setName(value); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - - value = approvedStructureElements[1].getDescription(); - approvedStructureElements[1].setDescription(null); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - approvedStructureElements[1].setDescription(value); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - - value = approvedStructureElements[1].getComment(); - approvedStructureElements[1].setComment(null); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.FALSE); - approvedStructureElements[1].setComment(value); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); + + uuid = structureElementCommandsConfirm[1].getUuid(); + structureElementCommandsConfirm[1].setUuid(null); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + structureElementCommandsConfirm[1].setUuid(uuid); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + + value = structureElementCommandsConfirm[1].getComment(); + structureElementCommandsConfirm[1].setComment(null); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + structureElementCommandsConfirm[1].setComment(value); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); } catch (Exception e) { fail(); } @@ -1284,11 +1392,14 @@ class StructuresMultipleIT { // create, approve in order to delete, approve try { - StructureElementCommand[] structureElements = null; + StructureElementCommandCreate[] structureElementCommandsCreate = null; + StructureElementCommandUpdate[] structureElementCommandsUpdate = null; + StructureElementCommandConfirm[] structureElementCommandsConfirm = null; + StructureElementCommand[] structureElementCommands = null; StructureElement[] approvedStructureElements = null; StructureElement[] deletedStructureElements = null; - structureElements = new StructureElementCommand[] { + structureElementCommands = new StructureElementCommand[] { new StructureElementCommand(null, Type.SYSTEMGROUP, null, "name", "SgDa", "description", "comment"), new StructureElementCommand(null, Type.SYSTEM, systemGroupUuid, "name", "SysDa", "description", "comment"), new StructureElementCommand(null, Type.SUBSYSTEM, systemUuid, "name", "SubDa", "description", "comment"), @@ -1296,6 +1407,9 @@ class StructuresMultipleIT { new StructureElementCommand(null, Type.DEVICEGROUP, disciplineUuid, "name", "", "description", "comment"), new StructureElementCommand(null, Type.DEVICETYPE, deviceGroupUuid, "name", "DtDa", "description", "comment") }; + structureElementCommandsCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommands); + structureElementCommandsUpdate = StructureElementUtil.convertCommand2CommandUpdate(structureElementCommands); + structureElementCommandsConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommands); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgDa", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysDa", Boolean.FALSE); @@ -1310,17 +1424,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpDa", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtDa", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - approvedStructureElements = ITUtilStructureElement.assertCreateApprove(structureElements); + approvedStructureElements = ITUtilStructureElement.assertCreateApprove(structureElementCommandsCreate); assertNotNull(approvedStructureElements); assertEquals(6, approvedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(approvedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgDa", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysDa", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubDa", Boolean.TRUE); @@ -1334,17 +1452,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpDa", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtDa", Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - deletedStructureElements = ITUtilStructureElement.assertDelete(approvedStructureElements); + deletedStructureElements = ITUtilStructureElement.assertDelete(structureElementCommandsConfirm); assertNotNull(deletedStructureElements); assertEquals(6, deletedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(deletedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(deletedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(deletedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgDa", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysDa", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubDa", Boolean.TRUE); @@ -1358,17 +1480,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpDa", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtDa", Boolean.FALSE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.APPROVE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.CANCEL, Boolean.TRUE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.TRUE); - approvedStructureElements = ITUtilStructureElement.assertApprove(deletedStructureElements); + approvedStructureElements = ITUtilStructureElement.assertApprove(structureElementCommandsConfirm); assertNotNull(approvedStructureElements); assertEquals(6, approvedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(approvedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgDa", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysDa", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubDa", Boolean.FALSE); @@ -1381,13 +1507,19 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DISCIPLINE, "DiDa", Boolean.TRUE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpDa", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtDa", Boolean.TRUE); - - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.REJECT, Boolean.FALSE); +///// +// ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); +// ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -1414,12 +1546,15 @@ class StructuresMultipleIT { // create, approve in order to delete, cancel try { - StructureElementCommand[] structureElements = null; + StructureElementCommandCreate[] structureElementCommandsCreate = null; + StructureElementCommandUpdate[] structureElementCommandsUpdate = null; + StructureElementCommandConfirm[] structureElementCommandsConfirm = null; + StructureElementCommand[] structureElementCommands = null; StructureElement[] approvedStructureElements = null; StructureElement[] deletedStructureElements = null; StructureElement[] cancelledStructureElements = null; - structureElements = new StructureElementCommand[] { + structureElementCommands = new StructureElementCommand[] { new StructureElementCommand(null, Type.SYSTEMGROUP, null, "name", "SgDc", "description", "comment"), new StructureElementCommand(null, Type.SYSTEM, systemGroupUuid, "name", "SysDc", "description", "comment"), new StructureElementCommand(null, Type.SUBSYSTEM, systemUuid, "name", "SubDc", "description", "comment"), @@ -1427,6 +1562,9 @@ class StructuresMultipleIT { new StructureElementCommand(null, Type.DEVICEGROUP, disciplineUuid, "name", "", "description", "comment"), new StructureElementCommand(null, Type.DEVICETYPE, deviceGroupUuid, "name", "DtDc", "description", "comment") }; + structureElementCommandsCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommands); + structureElementCommandsUpdate = StructureElementUtil.convertCommand2CommandUpdate(structureElementCommands); + structureElementCommandsConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommands); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgDc", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysDc", Boolean.FALSE); @@ -1441,17 +1579,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpDc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtDc", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - approvedStructureElements = ITUtilStructureElement.assertCreateApprove(structureElements); + approvedStructureElements = ITUtilStructureElement.assertCreateApprove(structureElementCommandsCreate); assertNotNull(approvedStructureElements); assertEquals(6, approvedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(approvedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgDc", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysDc", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubDc", Boolean.TRUE); @@ -1465,17 +1607,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpDc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtDc", Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - deletedStructureElements = ITUtilStructureElement.assertDelete(approvedStructureElements); + deletedStructureElements = ITUtilStructureElement.assertDelete(structureElementCommandsConfirm); assertNotNull(deletedStructureElements); assertEquals(6, deletedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(deletedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(deletedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(deletedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgDc", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysDc", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubDc", Boolean.TRUE); @@ -1489,17 +1635,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpDc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtDc", Boolean.FALSE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.APPROVE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.CANCEL, Boolean.TRUE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.TRUE); - cancelledStructureElements = ITUtilStructureElement.assertCancel(deletedStructureElements); + cancelledStructureElements = ITUtilStructureElement.assertCancel(structureElementCommandsConfirm); assertNotNull(cancelledStructureElements); assertEquals(6, cancelledStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(cancelledStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(cancelledStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(cancelledStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgDc", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysDc", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubDc", Boolean.TRUE); @@ -1513,12 +1663,12 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpDc", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtDc", Boolean.FALSE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(cancelledStructureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } @@ -1545,12 +1695,15 @@ class StructuresMultipleIT { // create, approve in order to delete, reject try { - StructureElementCommand[] structureElements = null; + StructureElementCommandCreate[] structureElementCommandsCreate = null; + StructureElementCommandUpdate[] structureElementCommandsUpdate = null; + StructureElementCommandConfirm[] structureElementCommandsConfirm = null; + StructureElementCommand[] structureElementCommands = null; StructureElement[] approvedStructureElements = null; StructureElement[] deletedStructureElements = null; StructureElement[] rejectedStructureElements = null; - structureElements = new StructureElementCommand[] { + structureElementCommands = new StructureElementCommand[] { new StructureElementCommand(null, Type.SYSTEMGROUP, null, "name", "SgDr", "description", "comment"), new StructureElementCommand(null, Type.SYSTEM, systemGroupUuid, "name", "SysDr", "description", "comment"), new StructureElementCommand(null, Type.SUBSYSTEM, systemUuid, "name", "SubDr", "description", "comment"), @@ -1558,6 +1711,9 @@ class StructuresMultipleIT { new StructureElementCommand(null, Type.DEVICEGROUP, disciplineUuid, "name", "", "description", "comment"), new StructureElementCommand(null, Type.DEVICETYPE, deviceGroupUuid, "name", "DtDr", "description", "comment") }; + structureElementCommandsCreate = StructureElementUtil.convertCommand2CommandCreate(structureElementCommands); + structureElementCommandsUpdate = StructureElementUtil.convertCommand2CommandUpdate(structureElementCommands); + structureElementCommandsConfirm = StructureElementUtil.convertCommand2CommandConfirm(structureElementCommands); ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgDr", Boolean.FALSE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysDr", Boolean.FALSE); @@ -1572,17 +1728,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpDr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtDr", Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CREATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(structureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - approvedStructureElements = ITUtilStructureElement.assertCreateApprove(structureElements); + approvedStructureElements = ITUtilStructureElement.assertCreateApprove(structureElementCommandsCreate); assertNotNull(approvedStructureElements); assertEquals(6, approvedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(approvedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(approvedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(approvedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgDr", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysDr", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubDr", Boolean.TRUE); @@ -1596,17 +1756,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpDr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtDr", Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(approvedStructureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); - deletedStructureElements = ITUtilStructureElement.assertDelete(approvedStructureElements); + deletedStructureElements = ITUtilStructureElement.assertDelete(structureElementCommandsConfirm); assertNotNull(deletedStructureElements); assertEquals(6, deletedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(deletedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(deletedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(deletedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgDr", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysDr", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubDr", Boolean.TRUE); @@ -1620,17 +1784,21 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpDr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtDr", Boolean.FALSE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.UPDATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.DELETE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.APPROVE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.CANCEL, Boolean.TRUE); - ITUtilStructureElement.assertValidate(deletedStructureElements, StructureCommand.REJECT, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.TRUE); - rejectedStructureElements = ITUtilStructureElement.assertReject(deletedStructureElements); + rejectedStructureElements = ITUtilStructureElement.assertReject(structureElementCommandsConfirm); assertNotNull(rejectedStructureElements); assertEquals(6, rejectedStructureElements.length); + structureElementCommandsCreate = StructureElementUtil.convertElement2CommandCreate(rejectedStructureElements); + structureElementCommandsUpdate = StructureElementUtil.convertElement2CommandUpdate(rejectedStructureElements); + structureElementCommandsConfirm = StructureElementUtil.convertElement2CommandConfirm(rejectedStructureElements); + ITUtilStructureElement.assertExists(Type.SYSTEMGROUP, "SgDr", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SYSTEM, "SysDr", Boolean.TRUE); ITUtilStructureElement.assertExists(Type.SUBSYSTEM, "Sys-SubDr", Boolean.TRUE); @@ -1644,12 +1812,12 @@ class StructuresMultipleIT { ITUtilStructureElement.assertIsValidToCreate(Type.DEVICEGROUP, "GrpDr", Boolean.FALSE); ITUtilStructureElement.assertIsValidToCreate(Type.DEVICETYPE, "Di-DtDr", Boolean.FALSE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.CREATE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.UPDATE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.DELETE, Boolean.TRUE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.APPROVE, Boolean.FALSE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.CANCEL, Boolean.FALSE); - ITUtilStructureElement.assertValidate(rejectedStructureElements, StructureCommand.REJECT, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsCreate, StructureCommand.CREATE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsUpdate, StructureCommand.UPDATE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.DELETE, Boolean.TRUE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.APPROVE, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.CANCEL, Boolean.FALSE); + ITUtilStructureElement.assertValidate(structureElementCommandsConfirm, StructureCommand.REJECT, Boolean.FALSE); } catch (Exception e) { fail(); } diff --git a/src/test/java/org/openepics/names/util/NameElementUtilTest.java b/src/test/java/org/openepics/names/util/NameElementUtilTest.java index 6cf73248d416de89e3e83ace73af9aadcf044e9b..7ad67bcb3d0208249485de26af8721b5075b2e68 100644 --- a/src/test/java/org/openepics/names/util/NameElementUtilTest.java +++ b/src/test/java/org/openepics/names/util/NameElementUtilTest.java @@ -22,6 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; +import java.util.Date; import java.util.UUID; import org.junit.jupiter.api.Test; @@ -75,58 +76,145 @@ class NameElementUtilTest { */ @Test void getNameElementContent() { + UUID uuid = UUID.randomUUID(); + UUID parentSystemStructure = UUID.randomUUID(); + UUID parentDeviceStructure = UUID.randomUUID(); + String systemStructure = "qw"; + String deviceStructure = "er"; + String index = "ty"; + String name = "ui"; + String description = "op"; + Status status = Status.APPROVED; + Boolean latest = Boolean.TRUE; + Boolean deleted = Boolean.FALSE; + Date when = new Date(); + String who = "as"; + String comment = "df"; + NameElement nameElement = NameElementUtil.getNameElement( - null, - null, null, - null, null, - null, null, - null, null, null, null, - null, null, null); + uuid, + parentSystemStructure, parentDeviceStructure, + systemStructure, deviceStructure, + index, name, + description, status, latest, deleted, + when, who, comment); assertNotNull(nameElement); - assertEquals(null, nameElement.getUuid()); - assertEquals(null, nameElement.getParentSystemStructure()); - assertEquals(null, nameElement.getParentDeviceStructure()); - assertEquals(null, nameElement.getSystemStructure()); - assertEquals(null, nameElement.getDeviceStructure()); - assertEquals(null, nameElement.getIndex()); - assertEquals(null, nameElement.getName()); - assertEquals(null, nameElement.getDescription()); - assertEquals(null, nameElement.getStatus()); - assertEquals(null, nameElement.isLatest()); - assertEquals(null, nameElement.isDeleted()); - assertEquals(null, nameElement.getWhen()); - assertEquals(null, nameElement.getWho()); - assertEquals(null, nameElement.getComment()); + assertEquals(uuid, nameElement.getUuid()); + assertEquals(parentSystemStructure, nameElement.getParentSystemStructure()); + assertEquals(parentDeviceStructure, nameElement.getParentDeviceStructure()); + assertEquals(systemStructure, nameElement.getSystemStructure()); + assertEquals(deviceStructure, nameElement.getDeviceStructure()); + assertEquals(index, nameElement.getIndex()); + assertEquals(name, nameElement.getName()); + assertEquals(description, nameElement.getDescription()); + assertEquals(status, nameElement.getStatus()); + assertEquals(latest, nameElement.isLatest()); + assertEquals(deleted, nameElement.isDeleted()); + assertEquals(when, nameElement.getWhen()); + assertEquals(who, nameElement.getWho()); + assertEquals(comment, nameElement.getComment()); + } + + // ---------------------------------------------------------------------------------------------------- + + /** + * Test of convert name element command for create to name element command. + */ + @Test + void convertCommandCreate2Command() { + UUID uuid2 = UUID.randomUUID(); + UUID uuid3 = UUID.randomUUID(); + String str1 = "qwer"; + String str2 = "asdf"; + String str3 = "zxcv"; + + NameElementCommandCreate commandCreate = new NameElementCommandCreate(uuid2, uuid3, str1, str2, str3); + NameElementCommand command = NameElementUtil.convertCommandCreate2Command(commandCreate); + + assertNotNull(command); + assertNull(command.getUuid()); + assertEquals(uuid2, command.getParentSystemStructure()); + assertEquals(uuid3, command.getParentDeviceStructure()); + assertEquals(str1, command.getIndex()); + assertEquals(str2, command.getDescription()); + assertEquals(str3, command.getComment()); + } + + /** + * Test of convert name element command for update to name element command. + */ + @Test + void convertCommandUpdate2Command() { + UUID uuid1 = UUID.randomUUID(); + UUID uuid2 = UUID.randomUUID(); + UUID uuid3 = UUID.randomUUID(); + String str1 = "qwer"; + String str2 = "asdf"; + String str3 = "zxcv"; + + NameElementCommandUpdate commandUpdate = new NameElementCommandUpdate(uuid1, uuid2, uuid3, str1, str2, str3); + NameElementCommand command = NameElementUtil.convertCommandUpdate2Command(commandUpdate); + + assertNotNull(command); + assertEquals(uuid1, command.getUuid()); + assertEquals(uuid2, command.getParentSystemStructure()); + assertEquals(uuid3, command.getParentDeviceStructure()); + assertEquals(str1, command.getIndex()); + assertEquals(str2, command.getDescription()); + assertEquals(str3, command.getComment()); } /** - * Test of get name element command given name element command for create. + * Test of convert name element command for confirm to name element command. */ @Test - void getNameElementCommandCreate() { + void convertCommandConfirm2Command() { + UUID uuid1 = UUID.randomUUID(); + String str3 = "zxcv"; + + NameElementCommandConfirm commandConfirm = new NameElementCommandConfirm(uuid1, str3); + NameElementCommand command = NameElementUtil.convertCommandConfirm2Command(commandConfirm); + + assertNotNull(command); + assertEquals(uuid1, command.getUuid()); + assertNull(command.getParentSystemStructure()); + assertNull(command.getParentDeviceStructure()); + assertNull(command.getIndex()); + assertNull(command.getDescription()); + assertEquals(str3, command.getComment()); + } + + // ---------------------------------------------------------------------------------------------------- + + /** + * Test of convert name element command to name element command for create. + */ + @Test + void convertCommand2CommandCreate() { + UUID uuid1 = UUID.randomUUID(); UUID uuid2 = UUID.randomUUID(); UUID uuid3 = UUID.randomUUID(); String str1 = "qwer"; String str2 = "asdf"; String str3 = "zxcv"; - NameElementCommandCreate nameElementCommandCreate = new NameElementCommandCreate(uuid2, uuid3, str1, str2, str3); - NameElementCommand nameElementCommand = NameElementUtil.getNameElementCommand(nameElementCommandCreate); + NameElementCommand command = new NameElementCommand(uuid1, uuid2, uuid3, str1, str2, str3); + NameElementCommandCreate commandCreate = NameElementUtil.convertCommand2CommandCreate(command); - assertNull(nameElementCommand.getUuid()); - assertEquals(uuid2, nameElementCommand.getParentSystemStructure()); - assertEquals(uuid3, nameElementCommand.getParentDeviceStructure()); - assertEquals(str1, nameElementCommand.getIndex()); - assertEquals(str2, nameElementCommand.getDescription()); - assertEquals(str3, nameElementCommand.getComment()); + assertNotNull(commandCreate); + assertEquals(uuid2, commandCreate.getParentSystemStructure()); + assertEquals(uuid3, commandCreate.getParentDeviceStructure()); + assertEquals(str1, commandCreate.getIndex()); + assertEquals(str2, commandCreate.getDescription()); + assertEquals(str3, commandCreate.getComment()); } /** - * Test of get name element command given name element command for update. + * Test of convert name element command to name element command for update. */ @Test - void getNameElementCommandUpdate() { + void convertCommand2CommandUpdate() { UUID uuid1 = UUID.randomUUID(); UUID uuid2 = UUID.randomUUID(); UUID uuid3 = UUID.randomUUID(); @@ -134,34 +222,150 @@ class NameElementUtilTest { String str2 = "asdf"; String str3 = "zxcv"; - NameElementCommandUpdate nameElementCommandUpdate = new NameElementCommandUpdate(uuid1, uuid2, uuid3, str1, str2, str3); - NameElementCommand nameElementCommand = NameElementUtil.getNameElementCommand(nameElementCommandUpdate); + NameElementCommand command = new NameElementCommand(uuid1, uuid2, uuid3, str1, str2, str3); + NameElementCommandUpdate commandUpdate = NameElementUtil.convertCommand2CommandUpdate(command); - assertEquals(uuid1, nameElementCommand.getUuid()); - assertEquals(uuid2, nameElementCommand.getParentSystemStructure()); - assertEquals(uuid3, nameElementCommand.getParentDeviceStructure()); - assertEquals(str1, nameElementCommand.getIndex()); - assertEquals(str2, nameElementCommand.getDescription()); - assertEquals(str3, nameElementCommand.getComment()); + assertNotNull(commandUpdate); + assertEquals(uuid1, commandUpdate.getUuid()); + assertEquals(uuid2, commandUpdate.getParentSystemStructure()); + assertEquals(uuid3, commandUpdate.getParentDeviceStructure()); + assertEquals(str1, commandUpdate.getIndex()); + assertEquals(str2, commandUpdate.getDescription()); + assertEquals(str3, commandUpdate.getComment()); } /** - * Test of get name element command given name element command for confirm. + * Test of convert name element command to name element command for confirm. */ @Test - void getNameElementCommandConfirm() { + void convertCommand2CommandConfirm() { UUID uuid1 = UUID.randomUUID(); + UUID uuid2 = UUID.randomUUID(); + UUID uuid3 = UUID.randomUUID(); + String str1 = "qwer"; + String str2 = "asdf"; String str3 = "zxcv"; - NameElementCommandConfirm nameElementCommandConfirm = new NameElementCommandConfirm(uuid1, str3); - NameElementCommand nameElementCommand = NameElementUtil.getNameElementCommand(nameElementCommandConfirm); + NameElementCommand command = new NameElementCommand(uuid1, uuid2, uuid3, str1, str2, str3); + NameElementCommandConfirm commandConfirm = NameElementUtil.convertCommand2CommandConfirm(command); + + assertNotNull(commandConfirm); + assertEquals(uuid1, commandConfirm.getUuid()); + assertEquals(str3, commandConfirm.getComment()); + } + + // ---------------------------------------------------------------------------------------------------- + + /** + * Test of convert name element to name element command for create. + */ + @Test + void convertElement2CommandCreate() { + UUID uuid = UUID.randomUUID(); + UUID parentSystemStructure = UUID.randomUUID(); + UUID parentDeviceStructure = UUID.randomUUID(); + String systemStructure = "qw"; + String deviceStructure = "er"; + String index = "ty"; + String name = "ui"; + String description = "op"; + Status status = Status.APPROVED; + Boolean latest = Boolean.TRUE; + Boolean deleted = Boolean.FALSE; + Date when = new Date(); + String who = "as"; + String comment = "df"; + + NameElement element = NameElementUtil.getNameElement( + uuid, + parentSystemStructure, parentDeviceStructure, + systemStructure, deviceStructure, + index, name, + description, status, latest, deleted, + when, who, comment); + + NameElementCommandCreate commandCreate = NameElementUtil.convertElement2CommandCreate(element); + + assertNotNull(commandCreate); + assertEquals(parentSystemStructure, commandCreate.getParentSystemStructure()); + assertEquals(parentDeviceStructure, commandCreate.getParentDeviceStructure()); + assertEquals(index, commandCreate.getIndex()); + assertEquals(description, commandCreate.getDescription()); + assertEquals(comment, commandCreate.getComment()); + } + + /** + * Test of convert name element to name element command for update. + */ + @Test + void convertElement2CommandUpdate() { + UUID uuid = UUID.randomUUID(); + UUID parentSystemStructure = UUID.randomUUID(); + UUID parentDeviceStructure = UUID.randomUUID(); + String systemStructure = "qw"; + String deviceStructure = "er"; + String index = "ty"; + String name = "ui"; + String description = "op"; + Status status = Status.APPROVED; + Boolean latest = Boolean.TRUE; + Boolean deleted = Boolean.FALSE; + Date when = new Date(); + String who = "as"; + String comment = "df"; + + NameElement element = NameElementUtil.getNameElement( + uuid, + parentSystemStructure, parentDeviceStructure, + systemStructure, deviceStructure, + index, name, + description, status, latest, deleted, + when, who, comment); + + NameElementCommandUpdate commandUpdate = NameElementUtil.convertElement2CommandUpdate(element); + + assertNotNull(commandUpdate); + assertEquals(uuid, commandUpdate.getUuid()); + assertEquals(parentSystemStructure, commandUpdate.getParentSystemStructure()); + assertEquals(parentDeviceStructure, commandUpdate.getParentDeviceStructure()); + assertEquals(index, commandUpdate.getIndex()); + assertEquals(description, commandUpdate.getDescription()); + assertEquals(comment, commandUpdate.getComment()); + } + + /** + * Test of convert name element to name element command for confirm. + */ + @Test + void convertElement2CommandConfirm() { + UUID uuid = UUID.randomUUID(); + UUID parentSystemStructure = UUID.randomUUID(); + UUID parentDeviceStructure = UUID.randomUUID(); + String systemStructure = "qw"; + String deviceStructure = "er"; + String index = "ty"; + String name = "ui"; + String description = "op"; + Status status = Status.APPROVED; + Boolean latest = Boolean.TRUE; + Boolean deleted = Boolean.FALSE; + Date when = new Date(); + String who = "as"; + String comment = "df"; + + NameElement element = NameElementUtil.getNameElement( + uuid, + parentSystemStructure, parentDeviceStructure, + systemStructure, deviceStructure, + index, name, + description, status, latest, deleted, + when, who, comment); + + NameElementCommandConfirm commandConfirm = NameElementUtil.convertElement2CommandConfirm(element); - assertEquals(uuid1, nameElementCommand.getUuid()); - assertNull(nameElementCommand.getParentSystemStructure()); - assertNull(nameElementCommand.getParentDeviceStructure()); - assertNull(nameElementCommand.getIndex()); - assertNull(nameElementCommand.getDescription()); - assertEquals(str3, nameElementCommand.getComment()); + assertNotNull(commandConfirm); + assertEquals(uuid, commandConfirm.getUuid()); + assertEquals(comment, commandConfirm.getComment()); } } diff --git a/src/test/java/org/openepics/names/util/StructureElementUtilTest.java b/src/test/java/org/openepics/names/util/StructureElementUtilTest.java index 60114c5dce29732420f9cffbbb878956a87ee05c..d12030b5043266ab09921c601473e6193c7a156d 100644 --- a/src/test/java/org/openepics/names/util/StructureElementUtilTest.java +++ b/src/test/java/org/openepics/names/util/StructureElementUtilTest.java @@ -20,10 +20,20 @@ package org.openepics.names.util; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; +import java.util.Date; +import java.util.UUID; + import org.junit.jupiter.api.Test; +import org.openepics.names.rest.beans.Status; +import org.openepics.names.rest.beans.Type; import org.openepics.names.rest.beans.element.StructureElement; +import org.openepics.names.rest.beans.element.StructureElementCommand; +import org.openepics.names.rest.beans.element.StructureElementCommandConfirm; +import org.openepics.names.rest.beans.element.StructureElementCommandCreate; +import org.openepics.names.rest.beans.element.StructureElementCommandUpdate; /** * Unit tests for StructureElementUtil class. @@ -39,31 +49,48 @@ class StructureElementUtilTest { */ @Test void getStructureElementContent() { + UUID uuid = UUID.randomUUID(); + Type type = Type.DEVICETYPE; + UUID parent = UUID.randomUUID(); + String name = "gh"; + String mnemonic = "jk"; + String mnemonicPath = "zx"; + Integer level = 3; + String description = "cv"; + Status status = Status.PENDING; + Boolean latest = Boolean.FALSE; + Boolean deleted = Boolean.FALSE; + Date when = new Date(); + String who = "bn"; + String comment = "ml"; + StructureElement structureElement = StructureElementUtil.getStructureElement( - null, - null, - null, - null, null, null, null, - null, null, null, null, - null, null, null); + uuid, + type, + parent, + name, mnemonic, mnemonicPath, level, + description, status, latest, deleted, + when, who, comment); assertNotNull(structureElement); - assertEquals(null, structureElement.getType()); - assertEquals(null, structureElement.getUuid()); - assertEquals(null, structureElement.getParent()); - assertEquals(null, structureElement.getName()); - assertEquals(null, structureElement.getMnemonic()); - assertEquals(null, structureElement.getMnemonicPath()); - assertEquals(null, structureElement.getLevel()); - assertEquals(null, structureElement.getDescription()); - assertEquals(null, structureElement.getStatus()); - assertEquals(null, structureElement.isLatest()); - assertEquals(null, structureElement.isDeleted()); - assertEquals(null, structureElement.getWhen()); - assertEquals(null, structureElement.getWho()); - assertEquals(null, structureElement.getComment()); + assertEquals(uuid, structureElement.getUuid()); + assertEquals(type, structureElement.getType()); + assertEquals(parent, structureElement.getParent()); + assertEquals(name, structureElement.getName()); + assertEquals(mnemonic, structureElement.getMnemonic()); + assertEquals(mnemonicPath, structureElement.getMnemonicPath()); + assertEquals(level, structureElement.getLevel()); + assertEquals(description, structureElement.getDescription()); + assertEquals(status, structureElement.getStatus()); + assertEquals(latest, structureElement.isLatest()); + assertEquals(deleted, structureElement.isDeleted()); + assertEquals(when, structureElement.getWhen()); + assertEquals(who, structureElement.getWho()); + assertEquals(comment, structureElement.getComment()); } + // ---------------------------------------------------------------------------------------------------- + @Test void equals() { StructureElement se1 = new StructureElement(); @@ -94,4 +121,268 @@ class StructureElementUtilTest { assertTrue(se1.equals(se2)); } + // ---------------------------------------------------------------------------------------------------- + + /** + * Test of convert structure element command for create to structure element command. + */ + @Test + void convertCommandCreate2Command() { + Type type = Type.SUBSYSTEM; + UUID uuid2 = UUID.randomUUID(); + String str1 = "qwer"; + String str2 = "asdf"; + String str3 = "zxcv"; + String str4 = "tyui"; + + StructureElementCommandCreate commandCreate = new StructureElementCommandCreate(type, uuid2, str1, str2, str3, str4); + StructureElementCommand command = StructureElementUtil.convertCommandCreate2Command(commandCreate); + + assertNull(command.getUuid()); + assertEquals(type, command.getType()); + assertEquals(uuid2, command.getParent()); + assertEquals(str1, command.getName()); + assertEquals(str2, command.getMnemonic()); + assertEquals(str3, command.getDescription()); + assertEquals(str4, command.getComment()); + } + + /** + * Test of convert structure element command for update to structure element command. + */ + @Test + void convertCommandUpdate2Command() { + UUID uuid1 = UUID.randomUUID(); + Type type = Type.SUBSYSTEM; + UUID uuid2 = UUID.randomUUID(); + String str1 = "qwer"; + String str2 = "asdf"; + String str3 = "zxcv"; + String str4 = "tyui"; + + StructureElementCommandUpdate commandUpdate = new StructureElementCommandUpdate(uuid1, type, uuid2, str1, str2, str3, str4); + StructureElementCommand command = StructureElementUtil.convertCommandUpdate2Command(commandUpdate); + + assertEquals(uuid1, command.getUuid()); + assertEquals(type, command.getType()); + assertEquals(uuid2, command.getParent()); + assertEquals(str1, command.getName()); + assertEquals(str2, command.getMnemonic()); + assertEquals(str3, command.getDescription()); + assertEquals(str4, command.getComment()); + } + + /** + * Test of convert structure element command for confirm to structure element command. + */ + @Test + void convertCommandConfirm2Command() { + UUID uuid1 = UUID.randomUUID(); + Type type = Type.SUBSYSTEM; + String str4 = "tyui"; + + StructureElementCommandConfirm commandConfirm = new StructureElementCommandConfirm(uuid1, type, str4); + StructureElementCommand command = StructureElementUtil.convertCommandConfirm2Command(commandConfirm); + + assertEquals(uuid1, command.getUuid()); + assertEquals(type, command.getType()); + assertNull(command.getParent()); + assertNull(command.getName()); + assertNull(command.getMnemonic()); + assertNull(command.getDescription()); + assertEquals(str4, command.getComment()); + } + + // ---------------------------------------------------------------------------------------------------- + + /** + * Test of convert structure element command to structure element command for create. + */ + @Test + void convertCommand2CommandCreate() { + UUID uuid1 = UUID.randomUUID(); + Type type = Type.SUBSYSTEM; + UUID uuid2 = UUID.randomUUID(); + String str1 = "qwer"; + String str2 = "asdf"; + String str3 = "zxcv"; + String str4 = "tyui"; + + StructureElementCommand command = new StructureElementCommand(uuid1, type, uuid2, str1, str2, str3, str4); + StructureElementCommandCreate commandCreate = StructureElementUtil.convertCommand2CommandCreate(command); + + assertNotNull(commandCreate); + assertEquals(type, commandCreate.getType()); + assertEquals(uuid2, commandCreate.getParent()); + assertEquals(str1, commandCreate.getName()); + assertEquals(str2, commandCreate.getMnemonic()); + assertEquals(str3, commandCreate.getDescription()); + assertEquals(str4, commandCreate.getComment()); + } + + /** + * Test of convert structure element command to structure element command for update. + */ + @Test + void convertCommand2CommandUpdate() { + UUID uuid1 = UUID.randomUUID(); + Type type = Type.SUBSYSTEM; + UUID uuid2 = UUID.randomUUID(); + String str1 = "qwer"; + String str2 = "asdf"; + String str3 = "zxcv"; + String str4 = "tyui"; + + StructureElementCommand command = new StructureElementCommand(uuid1, type, uuid2, str1, str2, str3, str4); + StructureElementCommandUpdate commandUpdate = StructureElementUtil.convertCommand2CommandUpdate(command); + + assertNotNull(commandUpdate); + assertEquals(uuid1, commandUpdate.getUuid()); + assertEquals(type, commandUpdate.getType()); + assertEquals(uuid2, commandUpdate.getParent()); + assertEquals(str1, commandUpdate.getName()); + assertEquals(str2, commandUpdate.getMnemonic()); + assertEquals(str3, commandUpdate.getDescription()); + assertEquals(str4, commandUpdate.getComment()); + } + + /** + * Test of convert structure element command to structure element command for confirm. + */ + @Test + void convertCommand2CommandConfirm() { + UUID uuid1 = UUID.randomUUID(); + Type type = Type.SUBSYSTEM; + UUID uuid2 = UUID.randomUUID(); + String str1 = "qwer"; + String str2 = "asdf"; + String str3 = "zxcv"; + String str4 = "tyui"; + + StructureElementCommand command = new StructureElementCommand(uuid1, type, uuid2, str1, str2, str3, str4); + StructureElementCommandConfirm commandConfirm = StructureElementUtil.convertCommand2CommandConfirm(command); + + assertNotNull(commandConfirm); + assertEquals(uuid1, commandConfirm.getUuid()); + assertEquals(type, commandConfirm.getType()); + assertEquals(str4, commandConfirm.getComment()); + } + + // ---------------------------------------------------------------------------------------------------- + + /** + * Test of convert structure element to structure element command for create. + */ + @Test + void convertElement2CommandCreate() { + UUID uuid = UUID.randomUUID(); + Type type = Type.DEVICETYPE; + UUID parent = UUID.randomUUID(); + String name = "gh"; + String mnemonic = "jk"; + String mnemonicPath = "zx"; + Integer level = 3; + String description = "cv"; + Status status = Status.PENDING; + Boolean latest = Boolean.FALSE; + Boolean deleted = Boolean.FALSE; + Date when = new Date(); + String who = "bn"; + String comment = "ml"; + + StructureElement element = StructureElementUtil.getStructureElement( + uuid, + type, + parent, + name, mnemonic, mnemonicPath, level, + description, status, latest, deleted, + when, who, comment); + + StructureElementCommandCreate commandCreate = StructureElementUtil.convertElement2CommandCreate(element); + + assertNotNull(commandCreate); + assertEquals(type, commandCreate.getType()); + assertEquals(parent, commandCreate.getParent()); + assertEquals(name, commandCreate.getName()); + assertEquals(mnemonic, commandCreate.getMnemonic()); + assertEquals(description, commandCreate.getDescription()); + assertEquals(comment, commandCreate.getComment()); + } + + /** + * Test of convert structure element to structure element command for update. + */ + @Test + void convertElement2CommandUpdate() { + UUID uuid = UUID.randomUUID(); + Type type = Type.DEVICETYPE; + UUID parent = UUID.randomUUID(); + String name = "gh"; + String mnemonic = "jk"; + String mnemonicPath = "zx"; + Integer level = 3; + String description = "cv"; + Status status = Status.PENDING; + Boolean latest = Boolean.FALSE; + Boolean deleted = Boolean.FALSE; + Date when = new Date(); + String who = "bn"; + String comment = "ml"; + + StructureElement element = StructureElementUtil.getStructureElement( + uuid, + type, + parent, + name, mnemonic, mnemonicPath, level, + description, status, latest, deleted, + when, who, comment); + + StructureElementCommandUpdate commandUpdate = StructureElementUtil.convertElement2CommandUpdate(element); + + assertNotNull(commandUpdate); + assertEquals(uuid, commandUpdate.getUuid()); + assertEquals(type, commandUpdate.getType()); + assertEquals(parent, commandUpdate.getParent()); + assertEquals(name, commandUpdate.getName()); + assertEquals(mnemonic, commandUpdate.getMnemonic()); + assertEquals(description, commandUpdate.getDescription()); + assertEquals(comment, commandUpdate.getComment()); + } + + /** + * Test of convert structure element to structure element command for confirm. + */ + @Test + void convertElement2CommandConfirm() { + UUID uuid = UUID.randomUUID(); + Type type = Type.DEVICETYPE; + UUID parent = UUID.randomUUID(); + String name = "gh"; + String mnemonic = "jk"; + String mnemonicPath = "zx"; + Integer level = 3; + String description = "cv"; + Status status = Status.PENDING; + Boolean latest = Boolean.FALSE; + Boolean deleted = Boolean.FALSE; + Date when = new Date(); + String who = "bn"; + String comment = "ml"; + + StructureElement element = StructureElementUtil.getStructureElement( + uuid, + type, + parent, + name, mnemonic, mnemonicPath, level, + description, status, latest, deleted, + when, who, comment); + + StructureElementCommandConfirm commandConfirm = StructureElementUtil.convertElement2CommandConfirm(element); + + assertNotNull(commandConfirm); + assertEquals(uuid, commandConfirm.getUuid()); + assertEquals(type, commandConfirm.getType()); + assertEquals(comment, commandConfirm.getComment()); + } + }