From 714493fb9588598b969711bf761f301ba8ebe286 Mon Sep 17 00:00:00 2001 From: vasraz Date: Thu, 25 Mar 2021 20:51:48 +0000 Subject: Improve test coverage Signed-off-by: Vasyl Razinkov Change-Id: I88e5bf627510b72322d061df5d34bc3600c47eb5 Issue-ID: SDC-3428 --- .../types/EnrichedServiceArtifactEntityTest.java | 60 +++++++++---------- .../types/EnrichedServiceTemplateEntityTest.java | 60 +++++++++---------- .../model/types/ServiceArtifactEntityTest.java | 60 +++++++++---------- .../model/types/ServiceTemplateEntityTest.java | 60 +++++++++---------- .../model/types/EnrichedServiceArtifactEntity.java | 59 +++---------------- .../model/types/EnrichedServiceTemplateEntity.java | 67 +++------------------- .../core/model/types/ServiceArtifactEntity.java | 59 +++---------------- .../core/model/types/ServiceTemplateEntity.java | 67 +++------------------- 8 files changed, 136 insertions(+), 356 deletions(-) (limited to 'openecomp-be') diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntityTest.java index b201e9d24d..dfd0b887f5 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntityTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntityTest.java @@ -20,45 +20,45 @@ package org.openecomp.core.model.types; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; + +import java.io.IOException; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openecomp.sdc.common.errors.SdcRuntimeException; import org.openecomp.sdc.versioning.dao.types.Version; -import java.io.IOException; - -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; - public class EnrichedServiceArtifactEntityTest { - private static final byte[] BYTE_ARRAY = new byte[] {0xA, 0xB, 0xC, 0xD}; + private static final byte[] BYTE_ARRAY = new byte[]{0xA, 0xB, 0xC, 0xD}; - @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(EnrichedServiceArtifactEntity.class, - hasValidGettersAndSettersExcluding("entityType", "firstClassCitizenId", "serviceArtifact")); + private static ServiceArtifact createServiceArtifact() { + ServiceArtifact serviceArtifact = new ServiceArtifact(); + serviceArtifact.setVspId("someIdd"); + serviceArtifact.setVersion(new Version("best")); + serviceArtifact.setName("name"); + serviceArtifact.setContentData(BYTE_ARRAY); + return serviceArtifact; } @Test public void shouldReturnNonEmptyEntityType() { EnrichedServiceArtifactEntity entity = - new EnrichedServiceArtifactEntity(); + new EnrichedServiceArtifactEntity(); assertTrue(StringUtils.isNoneEmpty(entity.getEntityType())); } @Test public void shouldHaveFirstClassCitizenIdEqualToVspId() { EnrichedServiceArtifactEntity entity = - new EnrichedServiceArtifactEntity(createServiceArtifact()); + new EnrichedServiceArtifactEntity(createServiceArtifact()); assertEquals(entity.getId(), entity.getFirstClassCitizenId()); } @@ -66,7 +66,7 @@ public class EnrichedServiceArtifactEntityTest { public void serviceArtifactGetterShouldReturnCorrectData() throws IOException { ServiceArtifact serviceArtifact = createServiceArtifact(); EnrichedServiceArtifactEntity entity = - new EnrichedServiceArtifactEntity(serviceArtifact); + new EnrichedServiceArtifactEntity(serviceArtifact); ServiceArtifact actual = entity.getServiceArtifact(); @@ -76,20 +76,14 @@ public class EnrichedServiceArtifactEntityTest { assertArrayEquals(IOUtils.toByteArray(serviceArtifact.getContent()), IOUtils.toByteArray(actual.getContent())); } - @Test(expected = SdcRuntimeException.class) + @Test public void shouldFailOnNullContentBytesSupplied() { ServiceArtifact serviceArtifactMock = mock(ServiceArtifact.class); - given(serviceArtifactMock.getContent()).willAnswer(invocation -> { throw new IOException("Test exception"); } ); - EnrichedServiceArtifactEntity entity = - new EnrichedServiceArtifactEntity(serviceArtifactMock); - } - - private static ServiceArtifact createServiceArtifact() { - ServiceArtifact serviceArtifact = new ServiceArtifact(); - serviceArtifact.setVspId("someIdd"); - serviceArtifact.setVersion(new Version("best")); - serviceArtifact.setName("name"); - serviceArtifact.setContentData(BYTE_ARRAY); - return serviceArtifact; + given(serviceArtifactMock.getContent()).willAnswer(invocation -> { + throw new IOException("Test exception"); + }); + assertThrows(SdcRuntimeException.class, () -> { + new EnrichedServiceArtifactEntity(serviceArtifactMock); + }); } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntityTest.java index 671a0a2d88..6654436e72 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntityTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntityTest.java @@ -20,45 +20,45 @@ package org.openecomp.core.model.types; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; + +import java.io.IOException; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openecomp.sdc.common.errors.SdcRuntimeException; import org.openecomp.sdc.versioning.dao.types.Version; -import java.io.IOException; - -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; - public class EnrichedServiceTemplateEntityTest { - private static final byte[] BYTE_ARRAY = new byte[] {0xA, 0xB, 0xC, 0xD}; + private static final byte[] BYTE_ARRAY = new byte[]{0xA, 0xB, 0xC, 0xD}; - @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(EnrichedServiceTemplateEntity.class, - hasValidGettersAndSettersExcluding("entityType", "firstClassCitizenId", "serviceTemplate")); + private static ServiceTemplate createServiceTemplate() { + ServiceTemplate serviceTemplate = new ServiceTemplate(); + serviceTemplate.setVspId("someIdd"); + serviceTemplate.setVersion(new Version("best")); + serviceTemplate.setName("name"); + serviceTemplate.setContentData(BYTE_ARRAY); + return serviceTemplate; } @Test public void shouldReturnNonEmptyEntityType() { EnrichedServiceTemplateEntity entity = - new EnrichedServiceTemplateEntity(); + new EnrichedServiceTemplateEntity(); assertTrue(StringUtils.isNoneEmpty(entity.getEntityType())); } @Test public void shouldHaveFirstClassCitizenIdEqualToVspId() { EnrichedServiceTemplateEntity entity = - new EnrichedServiceTemplateEntity(createServiceTemplate()); + new EnrichedServiceTemplateEntity(createServiceTemplate()); assertEquals(entity.getId(), entity.getFirstClassCitizenId()); } @@ -66,7 +66,7 @@ public class EnrichedServiceTemplateEntityTest { public void serviceTemplateGetterShouldReturnCorrectData() throws IOException { ServiceTemplate serviceTemplate = createServiceTemplate(); EnrichedServiceTemplateEntity entity = - new EnrichedServiceTemplateEntity(serviceTemplate); + new EnrichedServiceTemplateEntity(serviceTemplate); ServiceTemplate actual = entity.getServiceTemplate(); @@ -76,20 +76,14 @@ public class EnrichedServiceTemplateEntityTest { assertArrayEquals(IOUtils.toByteArray(serviceTemplate.getContent()), IOUtils.toByteArray(actual.getContent())); } - @Test(expected = SdcRuntimeException.class) + @Test public void shouldFailOnNullContentBytesSupplied() { ServiceTemplate serviceTemplateMock = mock(ServiceTemplate.class); - given(serviceTemplateMock.getContent()).willAnswer(invocation -> { throw new IOException("Test exception"); } ); - EnrichedServiceTemplateEntity entity = - new EnrichedServiceTemplateEntity(serviceTemplateMock); - } - - private static ServiceTemplate createServiceTemplate() { - ServiceTemplate serviceTemplate = new ServiceTemplate(); - serviceTemplate.setVspId("someIdd"); - serviceTemplate.setVersion(new Version("best")); - serviceTemplate.setName("name"); - serviceTemplate.setContentData(BYTE_ARRAY); - return serviceTemplate; + given(serviceTemplateMock.getContent()).willAnswer(invocation -> { + throw new IOException("Test exception"); + }); + assertThrows(SdcRuntimeException.class, () -> { + new EnrichedServiceTemplateEntity(serviceTemplateMock); + }); } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/ServiceArtifactEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/ServiceArtifactEntityTest.java index 291abee7f9..109f8d0bee 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/ServiceArtifactEntityTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/ServiceArtifactEntityTest.java @@ -20,45 +20,45 @@ package org.openecomp.core.model.types; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; + +import java.io.IOException; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openecomp.sdc.common.errors.SdcRuntimeException; import org.openecomp.sdc.versioning.dao.types.Version; -import java.io.IOException; - -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; - public class ServiceArtifactEntityTest { - private static final byte[] BYTE_ARRAY = new byte[] {0xA, 0xB, 0xC, 0xD}; + private static final byte[] BYTE_ARRAY = new byte[]{0xA, 0xB, 0xC, 0xD}; - @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(ServiceArtifactEntity.class, - hasValidGettersAndSettersExcluding("entityType", "firstClassCitizenId", "serviceArtifact")); + private static ServiceArtifact createServiceArtifact() { + ServiceArtifact serviceArtifact = new ServiceArtifact(); + serviceArtifact.setVspId("someIdd"); + serviceArtifact.setVersion(new Version("best")); + serviceArtifact.setName("name"); + serviceArtifact.setContentData(BYTE_ARRAY); + return serviceArtifact; } @Test public void shouldReturnNonEmptyEntityType() { ServiceArtifactEntity entity = - new ServiceArtifactEntity(); + new ServiceArtifactEntity(); assertTrue(StringUtils.isNoneEmpty(entity.getEntityType())); } @Test public void shouldHaveFirstClassCitizenIdEqualToVspId() { ServiceArtifactEntity entity = - new ServiceArtifactEntity(createServiceArtifact()); + new ServiceArtifactEntity(createServiceArtifact()); assertEquals(entity.getId(), entity.getFirstClassCitizenId()); } @@ -66,7 +66,7 @@ public class ServiceArtifactEntityTest { public void serviceArtifactGetterShouldReturnCorrectData() throws IOException { ServiceArtifact serviceArtifact = createServiceArtifact(); ServiceArtifactEntity entity = - new ServiceArtifactEntity(serviceArtifact); + new ServiceArtifactEntity(serviceArtifact); ServiceArtifact actual = entity.getServiceArtifact(); @@ -76,20 +76,14 @@ public class ServiceArtifactEntityTest { assertArrayEquals(IOUtils.toByteArray(serviceArtifact.getContent()), IOUtils.toByteArray(actual.getContent())); } - @Test(expected = SdcRuntimeException.class) + @Test public void shouldFailOnNullContentBytesSupplied() { ServiceArtifact serviceArtifactMock = mock(ServiceArtifact.class); - given(serviceArtifactMock.getContent()).willAnswer(invocation -> { throw new IOException("Test exception"); } ); - ServiceArtifactEntity entity = - new ServiceArtifactEntity(serviceArtifactMock); - } - - private static ServiceArtifact createServiceArtifact() { - ServiceArtifact serviceArtifact = new ServiceArtifact(); - serviceArtifact.setVspId("someIdd"); - serviceArtifact.setVersion(new Version("best")); - serviceArtifact.setName("name"); - serviceArtifact.setContentData(BYTE_ARRAY); - return serviceArtifact; + given(serviceArtifactMock.getContent()).willAnswer(invocation -> { + throw new IOException("Test exception"); + }); + assertThrows(SdcRuntimeException.class, () -> { + new ServiceArtifactEntity(serviceArtifactMock); + }); } } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/ServiceTemplateEntityTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/ServiceTemplateEntityTest.java index f64c04874e..ad4d6b1fe4 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/ServiceTemplateEntityTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/ServiceTemplateEntityTest.java @@ -20,45 +20,45 @@ package org.openecomp.core.model.types; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.mock; + +import java.io.IOException; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.openecomp.sdc.common.errors.SdcRuntimeException; import org.openecomp.sdc.versioning.dao.types.Version; -import java.io.IOException; - -import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.mock; - public class ServiceTemplateEntityTest { - private static final byte[] BYTE_ARRAY = new byte[] {0xA, 0xB, 0xC, 0xD}; + private static final byte[] BYTE_ARRAY = new byte[]{0xA, 0xB, 0xC, 0xD}; - @Test - public void shouldHaveValidGettersAndSetters() { - assertThat(ServiceTemplateEntity.class, - hasValidGettersAndSettersExcluding("entityType", "firstClassCitizenId", "serviceTemplate")); + private static ServiceTemplate createServiceTemplate() { + ServiceTemplate serviceTemplate = new ServiceTemplate(); + serviceTemplate.setVspId("someIdd"); + serviceTemplate.setVersion(new Version("best")); + serviceTemplate.setName("name"); + serviceTemplate.setContentData(BYTE_ARRAY); + return serviceTemplate; } @Test public void shouldReturnNonEmptyEntityType() { ServiceTemplateEntity entity = - new ServiceTemplateEntity(); + new ServiceTemplateEntity(); assertTrue(StringUtils.isNoneEmpty(entity.getEntityType())); } @Test public void shouldHaveFirstClassCitizenIdEqualToVspId() { ServiceTemplateEntity entity = - new ServiceTemplateEntity(createServiceTemplate()); + new ServiceTemplateEntity(createServiceTemplate()); assertEquals(entity.getId(), entity.getFirstClassCitizenId()); } @@ -66,7 +66,7 @@ public class ServiceTemplateEntityTest { public void serviceTemplateGetterShouldReturnCorrectData() throws IOException { ServiceTemplate serviceTemplate = createServiceTemplate(); ServiceTemplateEntity entity = - new ServiceTemplateEntity(serviceTemplate); + new ServiceTemplateEntity(serviceTemplate); ServiceTemplate actual = entity.getServiceTemplate(); @@ -76,20 +76,14 @@ public class ServiceTemplateEntityTest { assertArrayEquals(IOUtils.toByteArray(serviceTemplate.getContent()), IOUtils.toByteArray(actual.getContent())); } - @Test(expected = SdcRuntimeException.class) + @Test public void shouldFailOnNullContentBytesSupplied() { ServiceTemplate serviceTemplateMock = mock(ServiceTemplate.class); - given(serviceTemplateMock.getContent()).willAnswer(invocation -> { throw new IOException("Test exception"); } ); - ServiceTemplateEntity entity = - new ServiceTemplateEntity(serviceTemplateMock); - } - - private static ServiceTemplate createServiceTemplate() { - ServiceTemplate serviceTemplate = new ServiceTemplate(); - serviceTemplate.setVspId("someIdd"); - serviceTemplate.setVersion(new Version("best")); - serviceTemplate.setName("name"); - serviceTemplate.setContentData(BYTE_ARRAY); - return serviceTemplate; + given(serviceTemplateMock.getContent()).willAnswer(invocation -> { + throw new IOException("Test exception"); + }); + assertThrows(SdcRuntimeException.class, () -> { + new ServiceTemplateEntity(serviceTemplateMock); + }); } } diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java index d47ec10f2c..e66d0525aa 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java @@ -23,17 +23,19 @@ import com.datastax.driver.mapping.annotations.Table; import com.google.common.io.ByteStreams; import java.io.IOException; import java.nio.ByteBuffer; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.openecomp.sdc.common.errors.SdcRuntimeException; import org.openecomp.sdc.versioning.dao.types.Version; +@Getter +@Setter +@NoArgsConstructor @Table(keyspace = "dox", name = "vsp_enriched_service_artifact") public class EnrichedServiceArtifactEntity implements ServiceElementEntity { - private static final String ENTITY_TYPE; - - static { - ENTITY_TYPE = "Vendor Software Product Service artifact"; - } + private static final String ENTITY_TYPE = "Vendor Software Product Service artifact"; @PartitionKey @Column(name = "vsp_id") @@ -47,15 +49,6 @@ public class EnrichedServiceArtifactEntity implements ServiceElementEntity { @Column(name = "content_data") public ByteBuffer contentData; - /** - * Every entity class must have a default constructor according to - * - * Definition of mapped classes. - */ - public EnrichedServiceArtifactEntity() { - // Don't delete! Default constructor is required by DataStax driver - } - /** * Instantiates a new Enriched service artifact entity. * @@ -82,44 +75,6 @@ public class EnrichedServiceArtifactEntity implements ServiceElementEntity { return getId(); } - @Override - public String getId() { - return id; - } - - @Override - public void setId(String id) { - this.id = id; - } - - @Override - public Version getVersion() { - return version; - } - - @Override - public void setVersion(Version version) { - this.version = version; - } - - @Override - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public ByteBuffer getContentData() { - return contentData; - } - - public void setContentData(ByteBuffer contentData) { - this.contentData = contentData; - } - public ServiceArtifact getServiceArtifact() { ServiceArtifact serviceArtifact = new ServiceArtifact(); serviceArtifact.setName(this.getName()); diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java index 8301df73c7..508e5f6a4e 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java @@ -23,17 +23,19 @@ import com.datastax.driver.mapping.annotations.Table; import com.google.common.io.ByteStreams; import java.io.IOException; import java.nio.ByteBuffer; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.openecomp.sdc.common.errors.SdcRuntimeException; import org.openecomp.sdc.versioning.dao.types.Version; +@Getter +@Setter +@NoArgsConstructor @Table(keyspace = "dox", name = "vsp_enriched_service_template") public class EnrichedServiceTemplateEntity implements ServiceElementEntity { - private static final String ENTITY_TYPE; - - static { - ENTITY_TYPE = "Vendor Software Product Service model"; - } + private static final String ENTITY_TYPE = "Vendor Software Product Service model"; @PartitionKey @Column(name = "vsp_id") @@ -49,15 +51,6 @@ public class EnrichedServiceTemplateEntity implements ServiceElementEntity { @Column(name = "base_name") private String baseName; - /** - * Every entity class must have a default constructor according to - * - * Definition of mapped classes. - */ - public EnrichedServiceTemplateEntity() { - // Don't delete! Default constructor is required by DataStax driver - } - /** * Instantiates a new Enriched service template entity. * @@ -75,14 +68,6 @@ public class EnrichedServiceTemplateEntity implements ServiceElementEntity { } } - public String getBaseName() { - return baseName; - } - - public void setBaseName(String baseName) { - this.baseName = baseName; - } - @Override public String getEntityType() { return ENTITY_TYPE; @@ -93,44 +78,6 @@ public class EnrichedServiceTemplateEntity implements ServiceElementEntity { return getId(); } - @Override - public String getId() { - return id; - } - - @Override - public void setId(String id) { - this.id = id; - } - - @Override - public Version getVersion() { - return version; - } - - @Override - public void setVersion(Version version) { - this.version = version; - } - - @Override - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public ByteBuffer getContentData() { - return contentData; - } - - public void setContentData(ByteBuffer contentData) { - this.contentData = contentData; - } - public ServiceTemplate getServiceTemplate() { ServiceTemplate serviceTemplate = new ServiceTemplate(); serviceTemplate.setName(getName()); diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java index bfab42f8ee..8cba3b82cc 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java @@ -23,17 +23,19 @@ import com.datastax.driver.mapping.annotations.Table; import com.google.common.io.ByteStreams; import java.io.IOException; import java.nio.ByteBuffer; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.openecomp.sdc.common.errors.SdcRuntimeException; import org.openecomp.sdc.versioning.dao.types.Version; +@Getter +@Setter +@NoArgsConstructor @Table(keyspace = "dox", name = "vsp_service_artifact") public class ServiceArtifactEntity implements ServiceElementEntity { - private static final String ENTITY_TYPE; - - static { - ENTITY_TYPE = "Vendor Software Product Service artifact"; - } + private static final String ENTITY_TYPE = "Vendor Software Product Service artifact"; @PartitionKey @Column(name = "vsp_id") @@ -47,15 +49,6 @@ public class ServiceArtifactEntity implements ServiceElementEntity { @Column(name = "content_data") public ByteBuffer contentData; - /** - * Every entity class must have a default constructor according to - * - * Definition of mapped classes. - */ - public ServiceArtifactEntity() { - // Don't delete! Default constructor is required by DataStax driver - } - /** * Instantiates a new Service artifact entity. * @@ -82,44 +75,6 @@ public class ServiceArtifactEntity implements ServiceElementEntity { return getId(); } - @Override - public String getId() { - return id; - } - - @Override - public void setId(String id) { - this.id = id; - } - - @Override - public Version getVersion() { - return version; - } - - @Override - public void setVersion(Version version) { - this.version = version; - } - - @Override - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public ByteBuffer getContentData() { - return contentData; - } - - public void setContentData(ByteBuffer contentData) { - this.contentData = contentData; - } - public ServiceArtifact getServiceArtifact() { ServiceArtifact serviceArtifact = new ServiceArtifact(); serviceArtifact.setName(this.getName()); diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java index 48b539ec5f..57fa235675 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java @@ -23,17 +23,19 @@ import com.datastax.driver.mapping.annotations.Table; import com.google.common.io.ByteStreams; import java.io.IOException; import java.nio.ByteBuffer; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.openecomp.sdc.common.errors.SdcRuntimeException; import org.openecomp.sdc.versioning.dao.types.Version; +@Getter +@Setter +@NoArgsConstructor @Table(keyspace = "dox", name = "vsp_service_template") public class ServiceTemplateEntity implements ServiceElementEntity { - private static final String ENTITY_TYPE; - - static { - ENTITY_TYPE = "Vendor Software Product Service model"; - } + private static final String ENTITY_TYPE = "Vendor Software Product Service model"; @PartitionKey @Column(name = "vsp_id") @@ -49,15 +51,6 @@ public class ServiceTemplateEntity implements ServiceElementEntity { @Column(name = "base_name") private String baseName; - /** - * Every entity class must have a default constructor according to - * - * Definition of mapped classes. - */ - public ServiceTemplateEntity() { - // Don't delete! Default constructor is required by DataStax driver - } - /** * Instantiates a new Service template entity. * @@ -75,14 +68,6 @@ public class ServiceTemplateEntity implements ServiceElementEntity { } } - public String getBaseName() { - return baseName; - } - - public void setBaseName(String baseName) { - this.baseName = baseName; - } - @Override public String getEntityType() { return ENTITY_TYPE; @@ -93,44 +78,6 @@ public class ServiceTemplateEntity implements ServiceElementEntity { return getId(); } - @Override - public String getId() { - return id; - } - - @Override - public void setId(String id) { - this.id = id; - } - - @Override - public Version getVersion() { - return version; - } - - @Override - public void setVersion(Version version) { - this.version = version; - } - - @Override - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public ByteBuffer getContentData() { - return contentData; - } - - public void setContentData(ByteBuffer contentData) { - this.contentData = contentData; - } - public ServiceTemplate getServiceTemplate() { ServiceTemplate serviceTemplate = new ServiceTemplate(); serviceTemplate.setName(getName()); -- cgit 1.2.3-korg