Improve test coverage 71/119871/1
authorvasraz <vasyl.razinkov@est.tech>
Thu, 25 Mar 2021 20:51:48 +0000 (20:51 +0000)
committerVasyl Razinkov <vasyl.razinkov@est.tech>
Thu, 25 Mar 2021 20:52:52 +0000 (20:52 +0000)
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Change-Id: I88e5bf627510b72322d061df5d34bc3600c47eb5
Issue-ID: SDC-3428

openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntityTest.java
openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntityTest.java
openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/ServiceArtifactEntityTest.java
openecomp-be/api/openecomp-sdc-rest-webapp/conflict-rest/conflict-rest-services/src/test/java/org/openecomp/core/model/types/ServiceTemplateEntityTest.java
openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java
openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java
openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java
openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java

index b201e9d..dfd0b88 100644 (file)
 
 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);
+        });
     }
 }
index 671a0a2..6654436 100644 (file)
 
 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);
+        });
     }
 }
index 291abee..109f8d0 100644 (file)
 
 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);
+        });
     }
 }
index f64c048..ad4d6b1 100644 (file)
 
 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);
+        });
     }
 }
index d47ec10..e66d052 100644 (file)
@@ -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
-     * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
-     * Definition of mapped classes</a>.
-     */
-    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());
index 8301df7..508e5f6 100644 (file)
@@ -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
-     * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
-     * Definition of mapped classes</a>.
-     */
-    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());
index bfab42f..8cba3b8 100644 (file)
@@ -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
-     * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
-     * Definition of mapped classes</a>.
-     */
-    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());
index 48b539e..57fa235 100644 (file)
@@ -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
-     * <a href="http://docs.datastax.com/en/developer/java-driver/2.1/manual/object_mapper/creating/">
-     * Definition of mapped classes</a>.
-     */
-    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());