From f54b124ccfcf596e19d19ba2d24fd2702cd73c8d Mon Sep 17 00:00:00 2001 From: xuegao Date: Thu, 11 Mar 2021 17:22:46 +0100 Subject: Adding unit tests Adding unit tests to improve test coverage. Issue-ID: SDC-3428 Signed-off-by: xuegao Change-Id: I57da2ff92839cb78985e5f3d3c13dc575c1b6c17 --- .../sdc/be/resources/data/SdcSchemaFilesData.java | 75 ++++++---------------- 1 file changed, 18 insertions(+), 57 deletions(-) (limited to 'catalog-dao') diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesData.java index 1ed044082e..401d9099e6 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesData.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/SdcSchemaFilesData.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,19 +25,27 @@ import com.datastax.driver.mapping.annotations.Column; import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; import com.datastax.driver.mapping.annotations.Transient; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + import java.nio.ByteBuffer; import java.util.Date; +@Getter +@Setter +@NoArgsConstructor @Table(keyspace = "sdcartifact", name = "sdcschemafiles") public class SdcSchemaFilesData { @PartitionKey(0) @Column(name = "sdcreleasenum") private String sdcReleaseNum; - + @ClusteringColumn @Column(name = "timestamp") private Date timestamp; - + @PartitionKey(1) @Column(name = "conformanceLevel") private String conformanceLevel; @@ -46,15 +54,11 @@ public class SdcSchemaFilesData { private String fileName; @Column(name = "payload") - private ByteBuffer payload; - + @Setter(AccessLevel.NONE)private ByteBuffer payload; + @Column(name = "checksum") private String checksum; - - public SdcSchemaFilesData() { - - } - + public SdcSchemaFilesData(String sdcReleaseNum, Date timestamp, String conformanceLevel, String fileName, byte[] payload, String checksum){ this.sdcReleaseNum = sdcReleaseNum; this.timestamp = timestamp; @@ -65,43 +69,16 @@ public class SdcSchemaFilesData { } this.checksum = checksum; } - - public String getSdcReleaseNum() { - return sdcReleaseNum; - } - - public void setSdcReleaseNum(String sdcReleaseNum) { - this.sdcReleaseNum = sdcReleaseNum; - } - - public String getConformanceLevel() { - return conformanceLevel; - } - - public void setConformanceLevel(String conformanceLevel) { - this.conformanceLevel = conformanceLevel; - } - - public String getFileName() { - return fileName; - } - public void setFileName(String fileName) { - this.fileName = fileName; - } - - public ByteBuffer getPayload() { - return payload; - } public void setPayload(ByteBuffer payload) { - if(payload != null){ + if(payload != null) { this.payload = payload.duplicate(); } } - + public void setPayloadAsArray(byte[] payload) { - if(payload != null){ + if(payload != null) { this.payload = ByteBuffer.wrap(payload.clone()); } } @@ -111,22 +88,6 @@ public class SdcSchemaFilesData { return payload != null ? payload.array() : null; } - public Date getTimestamp() { - return timestamp; - } - - public void setTimestamp(Date timestamp) { - this.timestamp = timestamp; - } - - public String getChecksum() { - return checksum; - } - - public void setChecksum(String checksum) { - this.checksum = checksum; - } - @Override public String toString() { return "SdcSchemaFilesData [sdcReleaseNum=" + sdcReleaseNum + ", timestamp=" + timestamp + ", conformanceLevel=" -- cgit 1.2.3-korg