diff --git a/catalog-dao/pom.xml b/catalog-dao/pom.xml
index 81c9d0c..8f5cb57 100644
--- a/catalog-dao/pom.xml
+++ b/catalog-dao/pom.xml
@@ -114,6 +114,13 @@
 		</dependency>
 
 		<dependency>
+    		<groupId>org.jmockit</groupId>
+			<artifactId>jmockit</artifactId>
+			<version>${jmockit.version}</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
 			<groupId>org.yaml</groupId>
 			<artifactId>snakeyaml</artifactId>
 			<version>${snakeyaml.version}</version>
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDao.java
index 211cb67..82630e0 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDao.java
@@ -101,9 +101,7 @@
 			}
 			events.all().forEach(event -> {
 				components.add(event);
-				if (logger.isTraceEnabled()) {
-					logger.trace("Fetch component uid = {} isDirty = {}", event.getId(), event.getIsDirty());
-				}
+				logger.trace("Fetch component uid = {} isDirty = {}", event.getId(), event.getIsDirty());
 			});
 
 			logger.debug("Number of components to fetch was {}. Actually, {} components fetched", ids.size(),
@@ -128,9 +126,7 @@
 			}
 			events.all().forEach(event -> {
 				components.add(event);
-				if (logger.isTraceEnabled()) {
 					logger.trace("Fetch component uid = {} isDirty = {}", event.getId(), event.getIsDirty());
-				}
 			});
 
 			logger.debug("Number of components fetched was {}.", components.size());
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/AccountTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/AccountTest.java
index 414748a..7d99916 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/AccountTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/AccountTest.java
@@ -9,6 +9,11 @@
 	}
 
 	@Test
+	public void testCtor() throws Exception {
+		new Account("mock", "mock");
+	}
+	
+	@Test
 	public void testGetName() throws Exception {
 		Account testSubject;
 		String result;
@@ -57,6 +62,8 @@
 		// default test
 		testSubject = createTestSubject();
 		result = testSubject.equals(other);
+		result = testSubject.equals(testSubject);
+		result = testSubject.equals(createTestSubject());
 	}
 
 	@Test
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/ArtifactCassandraDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/ArtifactCassandraDaoTest.java
new file mode 100644
index 0000000..250459f
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/ArtifactCassandraDaoTest.java
@@ -0,0 +1,133 @@
+package org.openecomp.sdc.be.dao.cassandra;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.InetAddress;
+import java.nio.ByteBuffer;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.openecomp.sdc.be.resources.data.ESArtifactData;
+
+import com.datastax.driver.core.ColumnDefinitions;
+import com.datastax.driver.core.LocalDate;
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.core.Row;
+import com.datastax.driver.core.Session;
+import com.datastax.driver.core.Token;
+import com.datastax.driver.core.TupleValue;
+import com.datastax.driver.core.TypeCodec;
+import com.datastax.driver.core.UDTValue;
+import com.datastax.driver.mapping.MappingManager;
+import com.google.common.reflect.TypeToken;
+
+import fj.data.Either;
+
+public class ArtifactCassandraDaoTest {
+
+	@InjectMocks
+	ArtifactCassandraDao testSubject;
+	
+	@Mock
+	CassandraClient client;
+	
+	@Mock
+	ArtifactAccessor artifactAccessor;
+	
+	@Before
+	public void setUp() throws Exception {
+		MockitoAnnotations.initMocks(this);
+	}
+
+	@Test(expected = RuntimeException.class)
+	public void testInit() throws Exception {
+		Mockito.when(client.isConnected()).thenReturn(true);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.right(CassandraOperationStatus.CLUSTER_NOT_CONNECTED);
+		Mockito.when(client.connect(Mockito.anyString())).thenReturn(value);
+		testSubject.init();
+	}
+	
+	@Test
+	public void testInitError() throws Exception {
+		testSubject.init();
+	}
+
+	@Test
+	public void testSaveArtifact() throws Exception {
+		ESArtifactData artifact = null;
+		CassandraOperationStatus result;
+
+		// default test
+		result = testSubject.saveArtifact(artifact);
+	}
+
+	@Test
+	public void testGetArtifact() throws Exception {
+		String artifactId = "";
+		Either<ESArtifactData, CassandraOperationStatus> result;
+
+		// default test
+		result = testSubject.getArtifact(artifactId);
+	}
+
+	@Test
+	public void testDeleteArtifact() throws Exception {
+		String artifactId = "";
+		CassandraOperationStatus result;
+
+		// default test
+		result = testSubject.deleteArtifact(artifactId);
+	}
+
+	@Test
+	public void testDeleteAllArtifacts() throws Exception {
+		CassandraOperationStatus result;
+
+		// default test
+		result = testSubject.deleteAllArtifacts();
+	}
+
+	@Test
+	public void testIsTableEmpty() throws Exception {
+		String tableName = "";
+		Either<Boolean, CassandraOperationStatus> result;
+
+		// default test
+		result = testSubject.isTableEmpty(tableName);
+	}
+
+	@Test
+	public void testGetCountOfArtifactById() throws Exception {
+		String uniqeId = "mock";
+		Either<Long, CassandraOperationStatus> result;
+		ResultSet value = Mockito.mock(ResultSet.class);
+		Row value2 = Mockito.mock(Row.class);
+		Mockito.when(value2.getLong(0)).thenReturn(0L);
+		Mockito.when(value.one()).thenReturn(value2);
+		Mockito.when(artifactAccessor.getNumOfArtifactsById(uniqeId)).thenReturn(value);
+		
+		// default test
+		result = testSubject.getCountOfArtifactById(uniqeId);
+	}
+	
+	@Test
+	public void testGetCountOfArtifactById1() throws Exception {
+		String uniqeId = "mock";
+		Either<Long, CassandraOperationStatus> result;
+		ResultSet value = Mockito.mock(ResultSet.class);
+		Mockito.when(artifactAccessor.getNumOfArtifactsById(uniqeId)).thenReturn(null);
+		
+		// default test
+		result = testSubject.getCountOfArtifactById(uniqeId);
+	}
+}
\ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/AuditCassandraDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/AuditCassandraDaoTest.java
index c7cdca0..511f8bd 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/AuditCassandraDaoTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/AuditCassandraDaoTest.java
@@ -1,8 +1,15 @@
 package org.openecomp.sdc.be.dao.cassandra;
 
+import java.util.LinkedList;
 import java.util.List;
 
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.junit.Before;
 import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent;
 import org.openecomp.sdc.be.resources.data.auditing.DistributionDeployEvent;
@@ -10,142 +17,455 @@
 import org.openecomp.sdc.be.resources.data.auditing.DistributionStatusEvent;
 import org.openecomp.sdc.be.resources.data.auditing.ResourceAdminEvent;
 
-import fj.data.Either;
+import com.datastax.driver.core.Session;
+import com.datastax.driver.mapping.MappingManager;
+import com.datastax.driver.mapping.Result;
 
+import fj.data.Either;
 
 public class AuditCassandraDaoTest {
 
-	private AuditCassandraDao createTestSubject() {
-		return new AuditCassandraDao();
+	@InjectMocks
+	AuditCassandraDao testSubject;
+
+	@Mock
+	AuditAccessor auditAccessor;
+
+	@Mock
+	CassandraClient client;
+
+	@Before
+	public void setUp() throws Exception {
+		MockitoAnnotations.initMocks(this);
 	}
 
-	
+	@Test(expected = RuntimeException.class)
+	public void testInit() throws Exception {
+		Mockito.when(client.isConnected()).thenReturn(true);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either
+				.right(CassandraOperationStatus.CLUSTER_NOT_CONNECTED);
+		Mockito.when(client.connect(Mockito.anyString())).thenReturn(value);
+		testSubject.init();
+	}
 
-	
+	@Test
+	public void testInitFail2() throws Exception {
+		Mockito.when(client.isConnected()).thenReturn(false);
+		testSubject.init();
+	}
 
-
-	
 	@Test
 	public void testGetListOfDistributionStatuses() throws Exception {
-		AuditCassandraDao testSubject;
+		String did = "";
+		Either<List<DistributionStatusEvent>, ActionStatus> result;
+
+		Result<DistributionStatusEvent> value = Mockito.mock(Result.class);
+		LinkedList<DistributionStatusEvent> value2 = new LinkedList<>();
+		value2.add(new DistributionStatusEvent());
+		Mockito.when(value.all()).thenReturn(value2);
+		Mockito.when(auditAccessor.getListOfDistributionStatuses(Mockito.anyString())).thenReturn(value);
+
+		// default test
+		result = testSubject.getListOfDistributionStatuses(did);
+	}
+
+	@Test
+	public void testGetListOfDistributionStatusesException() throws Exception {
+		String did = "";
+		Either<List<DistributionStatusEvent>, ActionStatus> result;
+
+		Mockito.when(auditAccessor.getListOfDistributionStatuses(Mockito.anyString()))
+				.thenThrow(RuntimeException.class);
+
+		// default test
+		result = testSubject.getListOfDistributionStatuses(did);
+	}
+
+	@Test
+	public void testGetListOfDistributionStatusesEmptyList() throws Exception {
 		String did = "";
 		Either<List<DistributionStatusEvent>, ActionStatus> result;
 
 		// default test
-		testSubject = createTestSubject();
 		result = testSubject.getListOfDistributionStatuses(did);
 	}
 
-	
 	@Test
 	public void testGetDistributionDeployByStatus() throws Exception {
-		AuditCassandraDao testSubject;
 		String did = "";
 		String action = "";
 		String status = "";
 		Either<List<DistributionDeployEvent>, ActionStatus> result;
 
+		Result<DistributionDeployEvent> value = Mockito.mock(Result.class);
+		LinkedList<DistributionDeployEvent> value2 = new LinkedList<>();
+		value2.add(new DistributionDeployEvent());
+		Mockito.when(value.all()).thenReturn(value2);
+		Mockito.when(auditAccessor.getDistributionDeployByStatus(Mockito.anyString(), Mockito.anyString(),
+				Mockito.anyString())).thenReturn(value);
+
 		// default test
-		testSubject = createTestSubject();
 		result = testSubject.getDistributionDeployByStatus(did, action, status);
 	}
 
-	
+	@Test
+	public void testGetDistributionDeployByStatusEmptyList() throws Exception {
+		String did = "";
+		String action = "";
+		String status = "";
+		Either<List<DistributionDeployEvent>, ActionStatus> result;
+
+		Result<DistributionDeployEvent> value = Mockito.mock(Result.class);
+		LinkedList<DistributionDeployEvent> value2 = new LinkedList<>();
+		value2.add(new DistributionDeployEvent());
+		Mockito.when(value.all()).thenReturn(value2);
+		Mockito.when(auditAccessor.getDistributionDeployByStatus(Mockito.anyString(), Mockito.anyString(),
+				Mockito.anyString())).thenReturn(null);
+
+		// default test
+		result = testSubject.getDistributionDeployByStatus(did, action, status);
+	}
+
+	@Test
+	public void testGetDistributionDeployByStatusException() throws Exception {
+		String did = "";
+		String action = "";
+		String status = "";
+		Either<List<DistributionDeployEvent>, ActionStatus> result;
+
+		Mockito.when(auditAccessor.getDistributionDeployByStatus(Mockito.anyString(), Mockito.anyString(),
+				Mockito.anyString())).thenThrow(RuntimeException.class);
+
+		// default test
+		result = testSubject.getDistributionDeployByStatus(did, action, status);
+	}
+
 	@Test
 	public void testGetDistributionRequest() throws Exception {
-		AuditCassandraDao testSubject;
 		String did = "";
 		String action = "";
 		Either<List<ResourceAdminEvent>, ActionStatus> result;
 
 		// default test
-		testSubject = createTestSubject();
 		result = testSubject.getDistributionRequest(did, action);
 	}
 
-	
+	@Test
+	public void testGetDistributionRequestList() throws Exception {
+		String did = "";
+		String action = "";
+		Either<List<ResourceAdminEvent>, ActionStatus> result;
+
+		Result<ResourceAdminEvent> value = Mockito.mock(Result.class);
+		List<ResourceAdminEvent> value2 = new LinkedList<>();
+		value2.add(new ResourceAdminEvent());
+		Mockito.when(value.all()).thenReturn(value2);
+		Mockito.when(auditAccessor.getDistributionRequest(Mockito.anyString(), Mockito.anyString())).thenReturn(value);
+
+		// default test
+		result = testSubject.getDistributionRequest(did, action);
+	}
+
+	@Test
+	public void testGetDistributionRequestException() throws Exception {
+		String did = "";
+		String action = "";
+		Either<List<ResourceAdminEvent>, ActionStatus> result;
+
+		Mockito.when(auditAccessor.getDistributionRequest(Mockito.anyString(), Mockito.anyString()))
+				.thenThrow(RuntimeException.class);
+
+		// default test
+		result = testSubject.getDistributionRequest(did, action);
+	}
+
 	@Test
 	public void testGetDistributionNotify() throws Exception {
-		AuditCassandraDao testSubject;
+		String did = "";
+		String action = "";
+		Either<List<DistributionNotificationEvent>, ActionStatus> result;
+
+		Result<DistributionNotificationEvent> value = Mockito.mock(Result.class);
+		List<DistributionNotificationEvent> value2 = new LinkedList<>();
+		value2.add(new DistributionNotificationEvent());
+		Mockito.when(value.all()).thenReturn(value2);
+
+		Mockito.when(auditAccessor.getDistributionNotify(Mockito.anyString(), Mockito.anyString())).thenReturn(value);
+
+		// default test
+		result = testSubject.getDistributionNotify(did, action);
+	}
+
+	@Test
+	public void testGetDistributionNotifyException() throws Exception {
+		String did = "";
+		String action = "";
+		Either<List<DistributionNotificationEvent>, ActionStatus> result;
+
+		Mockito.when(auditAccessor.getDistributionNotify(Mockito.anyString(), Mockito.anyString()))
+				.thenThrow(RuntimeException.class);
+
+		// default test
+		result = testSubject.getDistributionNotify(did, action);
+	}
+
+	@Test
+	public void testGetDistributionNotifyNull() throws Exception {
 		String did = "";
 		String action = "";
 		Either<List<DistributionNotificationEvent>, ActionStatus> result;
 
 		// default test
-		testSubject = createTestSubject();
 		result = testSubject.getDistributionNotify(did, action);
 	}
 
-	
 	@Test
 	public void testGetByServiceInstanceId() throws Exception {
-		AuditCassandraDao testSubject;
+		String serviceInstanceId = "";
+		Either<List<ResourceAdminEvent>, ActionStatus> result;
+
+		Result<ResourceAdminEvent> value = Mockito.mock(Result.class);
+		List<ResourceAdminEvent> value2 = new LinkedList<>();
+		value2.add(new ResourceAdminEvent());
+		Mockito.when(value.all()).thenReturn(value2);
+		Mockito.when(auditAccessor.getByServiceInstanceId(Mockito.anyString())).thenReturn(value);
+		// default test
+		result = testSubject.getByServiceInstanceId(serviceInstanceId);
+	}
+
+	@Test
+	public void testGetByServiceInstanceIdException() throws Exception {
+		String serviceInstanceId = "";
+		Either<List<ResourceAdminEvent>, ActionStatus> result;
+
+		Mockito.when(auditAccessor.getByServiceInstanceId(Mockito.anyString())).thenThrow(RuntimeException.class);
+		// default test
+		result = testSubject.getByServiceInstanceId(serviceInstanceId);
+	}
+
+	@Test
+	public void testGetByServiceInstanceIdNull() throws Exception {
 		String serviceInstanceId = "";
 		Either<List<ResourceAdminEvent>, ActionStatus> result;
 
 		// default test
-		testSubject = createTestSubject();
 		result = testSubject.getByServiceInstanceId(serviceInstanceId);
 	}
 
-	
 	@Test
 	public void testGetServiceDistributionStatusesList() throws Exception {
-		AuditCassandraDao testSubject;
+		String serviceInstanceId = "";
+		Either<List<? extends AuditingGenericEvent>, ActionStatus> result;
+
+		Result<ResourceAdminEvent> value = Mockito.mock(Result.class);
+		List<ResourceAdminEvent> value2 = new LinkedList<>();
+		value2.add(new ResourceAdminEvent());
+		Mockito.when(value.all()).thenReturn(value2);
+		Mockito.when(auditAccessor.getServiceDistributionStatus(Mockito.anyString())).thenReturn(value);
+
+		// default test
+		result = testSubject.getServiceDistributionStatusesList(serviceInstanceId);
+	}
+
+	@Test
+	public void testGetServiceDistributionStatusesList2() throws Exception {
+		String serviceInstanceId = "";
+		Either<List<? extends AuditingGenericEvent>, ActionStatus> result;
+
+		Result<ResourceAdminEvent> value = Mockito.mock(Result.class);
+		List<ResourceAdminEvent> value2 = new LinkedList<>();
+		value2.add(new ResourceAdminEvent());
+		Mockito.when(value.all()).thenReturn(value2);
+		Mockito.when(auditAccessor.getServiceDistributionStatus(Mockito.anyString())).thenReturn(value);
+
+		Result<DistributionDeployEvent> value3 = Mockito.mock(Result.class);
+		List<DistributionDeployEvent> value4 = new LinkedList<>();
+		value4.add(new DistributionDeployEvent());
+		Mockito.when(value3.all()).thenReturn(value4);
+		Mockito.when(auditAccessor.getServiceDistributionDeploy(Mockito.anyString())).thenReturn(value3);
+
+		// default test
+		result = testSubject.getServiceDistributionStatusesList(serviceInstanceId);
+	}
+
+	@Test
+	public void testGetServiceDistributionStatusesList3() throws Exception {
+		String serviceInstanceId = "";
+		Either<List<? extends AuditingGenericEvent>, ActionStatus> result;
+
+		Result<ResourceAdminEvent> value = Mockito.mock(Result.class);
+		List<ResourceAdminEvent> value2 = new LinkedList<>();
+		value2.add(new ResourceAdminEvent());
+		Mockito.when(value.all()).thenReturn(value2);
+		Mockito.when(auditAccessor.getServiceDistributionStatus(Mockito.anyString())).thenReturn(value);
+
+		Result<DistributionDeployEvent> value3 = Mockito.mock(Result.class);
+		List<DistributionDeployEvent> value4 = new LinkedList<>();
+		value4.add(new DistributionDeployEvent());
+		Mockito.when(value3.all()).thenReturn(value4);
+		Mockito.when(auditAccessor.getServiceDistributionDeploy(Mockito.anyString())).thenReturn(value3);
+
+		
+		Result<DistributionNotificationEvent> value5 = Mockito.mock(Result.class);
+		List<DistributionNotificationEvent> value6 = new LinkedList<>();
+		value6.add(new DistributionNotificationEvent());
+		Mockito.when(value5.all()).thenReturn(value6);
+		Mockito.when(auditAccessor.getServiceDistributionNotify(Mockito.anyString())).thenReturn(value5);
+
+		// default test
+		result = testSubject.getServiceDistributionStatusesList(serviceInstanceId);
+	}
+	
+	@Test
+	public void testGetServiceDistributionStatusesListException3() throws Exception {
+		String serviceInstanceId = "";
+		Either<List<? extends AuditingGenericEvent>, ActionStatus> result;
+
+		Result<ResourceAdminEvent> value = Mockito.mock(Result.class);
+		List<ResourceAdminEvent> value2 = new LinkedList<>();
+		value2.add(new ResourceAdminEvent());
+		Mockito.when(value.all()).thenReturn(value2);
+		Mockito.when(auditAccessor.getServiceDistributionStatus(Mockito.anyString())).thenReturn(value);
+
+		Result<DistributionDeployEvent> value3 = Mockito.mock(Result.class);
+		List<DistributionDeployEvent> value4 = new LinkedList<>();
+		value4.add(new DistributionDeployEvent());
+		Mockito.when(value3.all()).thenReturn(value4);
+		Mockito.when(auditAccessor.getServiceDistributionDeploy(Mockito.anyString())).thenReturn(value3);
+
+		Mockito.when(auditAccessor.getServiceDistributionNotify(Mockito.anyString())).thenThrow(RuntimeException.class);
+
+		// default test
+		result = testSubject.getServiceDistributionStatusesList(serviceInstanceId);
+	}
+	
+	@Test
+	public void testGetServiceDistributionStatusesListException2() throws Exception {
+		String serviceInstanceId = "";
+		Either<List<? extends AuditingGenericEvent>, ActionStatus> result;
+
+		Result<ResourceAdminEvent> value = Mockito.mock(Result.class);
+		List<ResourceAdminEvent> value2 = new LinkedList<>();
+		value2.add(new ResourceAdminEvent());
+		Mockito.when(value.all()).thenReturn(value2);
+		Mockito.when(auditAccessor.getServiceDistributionStatus(Mockito.anyString())).thenReturn(value);
+
+		Mockito.when(auditAccessor.getServiceDistributionDeploy(Mockito.anyString())).thenThrow(RuntimeException.class);
+
+		// default test
+		result = testSubject.getServiceDistributionStatusesList(serviceInstanceId);
+	}
+
+	@Test
+	public void testGetServiceDistributionStatusesListException() throws Exception {
+		String serviceInstanceId = "";
+		Either<List<? extends AuditingGenericEvent>, ActionStatus> result;
+
+		Mockito.when(auditAccessor.getServiceDistributionStatus(Mockito.anyString())).thenThrow(RuntimeException.class);
+
+		// default test
+		result = testSubject.getServiceDistributionStatusesList(serviceInstanceId);
+	}
+
+	@Test
+	public void testGetServiceDistributionStatusesListNull() throws Exception {
 		String serviceInstanceId = "";
 		Either<List<? extends AuditingGenericEvent>, ActionStatus> result;
 
 		// default test
-		testSubject = createTestSubject();
 		result = testSubject.getServiceDistributionStatusesList(serviceInstanceId);
 	}
 
-	
 	@Test
-	public void testGetAuditByServiceIdAndPrevVersion() throws Exception {
-		AuditCassandraDao testSubject;
+	public void testGetAuditByServiceIdAndPrevVersionNull() throws Exception {
 		String serviceInstanceId = "";
 		String prevVersion = "";
 		Either<List<ResourceAdminEvent>, ActionStatus> result;
 
 		// default test
-		testSubject = createTestSubject();
 		result = testSubject.getAuditByServiceIdAndPrevVersion(serviceInstanceId, prevVersion);
 	}
-
 	
 	@Test
-	public void testGetAuditByServiceIdAndCurrVersion() throws Exception {
-		AuditCassandraDao testSubject;
+	public void testGetAuditByServiceIdAndPrevVersion() throws Exception {
+		String serviceInstanceId = "";
+		String prevVersion = "";
+		Either<List<ResourceAdminEvent>, ActionStatus> result;
+		
+		Result<ResourceAdminEvent> value = Mockito.mock(Result.class);
+		List<ResourceAdminEvent> value2 = new LinkedList<>();
+		value2.add(new ResourceAdminEvent());
+		Mockito.when(value.all()).thenReturn(value2);
+		Mockito.when(auditAccessor.getAuditByServiceIdAndPrevVersion(Mockito.anyString(), Mockito.anyString())).thenReturn(value);
+		
+		// default test
+		result = testSubject.getAuditByServiceIdAndPrevVersion(serviceInstanceId, prevVersion);
+	}
+	
+	@Test
+	public void testGetAuditByServiceIdAndPrevVersionException() throws Exception {
+		String serviceInstanceId = "";
+		String prevVersion = "";
+		Either<List<ResourceAdminEvent>, ActionStatus> result;
+		
+		Mockito.when(auditAccessor.getAuditByServiceIdAndPrevVersion(Mockito.anyString(), Mockito.anyString())).thenThrow(RuntimeException.class);
+		
+		// default test
+		result = testSubject.getAuditByServiceIdAndPrevVersion(serviceInstanceId, prevVersion);
+	}
+	
+	@Test
+	public void testGetAuditByServiceIdAndCurrVersionNull() throws Exception {
 		String serviceInstanceId = "";
 		String currVersion = "";
 		Either<List<ResourceAdminEvent>, ActionStatus> result;
 
 		// default test
-		testSubject = createTestSubject();
 		result = testSubject.getAuditByServiceIdAndCurrVersion(serviceInstanceId, currVersion);
 	}
 
+	@Test
+	public void testGetAuditByServiceIdAndCurrVersion() throws Exception {
+		String serviceInstanceId = "";
+		String currVersion = "";
+		Either<List<ResourceAdminEvent>, ActionStatus> result;
+
+		Result<ResourceAdminEvent> value = Mockito.mock(Result.class);
+		List<ResourceAdminEvent> value2 = new LinkedList<>();
+		value2.add(new ResourceAdminEvent());
+		Mockito.when(value.all()).thenReturn(value2);
+		Mockito.when(auditAccessor.getAuditByServiceIdAndCurrVersion(Mockito.anyString(), Mockito.anyString())).thenReturn(value);
+		
+		// default test
+		result = testSubject.getAuditByServiceIdAndCurrVersion(serviceInstanceId, currVersion);
+	}
+	
+	@Test
+	public void testGetAuditByServiceIdAndCurrVersionException() throws Exception {
+		String serviceInstanceId = "";
+		String currVersion = "";
+		Either<List<ResourceAdminEvent>, ActionStatus> result;
+
+		Mockito.when(auditAccessor.getAuditByServiceIdAndCurrVersion(Mockito.anyString(), Mockito.anyString())).thenThrow(RuntimeException.class);
+		
+		// default test
+		result = testSubject.getAuditByServiceIdAndCurrVersion(serviceInstanceId, currVersion);
+	}
 	
 	@Test
 	public void testIsTableEmpty() throws Exception {
-		AuditCassandraDao testSubject;
 		String tableName = "";
 		Either<Boolean, CassandraOperationStatus> result;
 
 		// default test
-		testSubject = createTestSubject();
 		result = testSubject.isTableEmpty(tableName);
 	}
 
-	
 	@Test
 	public void testDeleteAllAudit() throws Exception {
-		AuditCassandraDao testSubject;
 		CassandraOperationStatus result;
 
 		// default test
-		testSubject = createTestSubject();
 		result = testSubject.deleteAllAudit();
 	}
 }
\ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/CassandraClientTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/CassandraClientTest.java
new file mode 100644
index 0000000..2f637f7
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/CassandraClientTest.java
@@ -0,0 +1,150 @@
+package org.openecomp.sdc.be.dao.cassandra;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.openecomp.sdc.be.utils.DAOConfDependentTest;
+
+import com.datastax.driver.core.Cluster;
+import com.datastax.driver.core.Cluster.Builder;
+import com.datastax.driver.core.Session;
+import com.datastax.driver.mapping.MappingManager;
+
+import fj.data.Either;
+import mockit.Deencapsulation;
+
+public class CassandraClientTest extends DAOConfDependentTest {
+
+	private CassandraClient createTestSubject() {
+		return new CassandraClient();
+	}
+
+	@Test
+	public void testSetLocalDc() throws Exception {
+		CassandraClient testSubject;
+		Cluster.Builder clusterBuilder = null;
+
+		Builder mock = Mockito.mock(Cluster.Builder.class);
+		Mockito.when(mock.withLoadBalancingPolicy(Mockito.any())).thenReturn(new Builder());
+		// default test
+		testSubject = createTestSubject();
+		Deencapsulation.invoke(testSubject, "setLocalDc", new Object[] { Cluster.Builder.class });
+
+		ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig()
+				.setLocalDataCenter("mock");
+
+		testSubject = createTestSubject();
+		Deencapsulation.invoke(testSubject, "setLocalDc", mock);
+	}
+
+	@Test
+	public void testEnableSsl() throws Exception {
+		CassandraClient testSubject;
+		Cluster.Builder clusterBuilder = null;
+
+		Builder mock = Mockito.mock(Cluster.Builder.class);
+		Mockito.when(mock.withSSL()).thenReturn(new Builder());
+
+		ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setSsl(false);
+		// default test
+		testSubject = createTestSubject();
+		Deencapsulation.invoke(testSubject, "enableSsl", mock);
+
+		ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setSsl(true);
+		// default test
+		testSubject = createTestSubject();
+		Deencapsulation.invoke(testSubject, "enableSsl", mock);
+		ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setTruststorePath(null);
+		ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig()
+				.setTruststorePassword(null);
+		Deencapsulation.invoke(testSubject, "enableSsl", mock);
+	}
+
+	@Test
+	public void testEnableAuthentication() throws Exception {
+		CassandraClient testSubject;
+		Builder mock = Mockito.mock(Cluster.Builder.class);
+		Mockito.when(mock.withCredentials(Mockito.any(), Mockito.any())).thenReturn(new Builder());
+
+		// default test
+		testSubject = createTestSubject();
+		Deencapsulation.invoke(testSubject, "enableAuthentication", Cluster.Builder.class);
+
+		ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setAuthenticate(true);
+		Deencapsulation.invoke(testSubject, "enableAuthentication", mock);
+		ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setUsername(null);
+		ConfigurationManager.getConfigurationManager().getConfiguration().getCassandraConfig().setPassword(null);
+		Deencapsulation.invoke(testSubject, "enableAuthentication", mock);
+	}
+
+	@Test
+	public void testConnect() throws Exception {
+		CassandraClient testSubject;
+		String keyspace = "";
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> result;
+
+		// default test
+		testSubject = createTestSubject();
+		result = testSubject.connect(keyspace);
+	}
+
+	@Test
+	public void testSave() throws Exception {
+		CassandraClient testSubject;
+		T entity = null;
+		Class<T> clazz = null;
+		MappingManager manager = null;
+		CassandraOperationStatus result;
+
+		// default test
+		testSubject = createTestSubject();
+		result = testSubject.save(entity, clazz, manager);
+	}
+
+	@Test
+	public void testGetById() throws Exception {
+		CassandraClient testSubject;
+		String id = "";
+		Class<T> clazz = null;
+		MappingManager manager = null;
+		Either<T, CassandraOperationStatus> result;
+
+		// default test
+		testSubject = createTestSubject();
+		result = testSubject.getById(id, clazz, manager);
+	}
+
+	@Test
+	public void testDelete() throws Exception {
+		CassandraClient testSubject;
+		String id = "";
+		Class<T> clazz = null;
+		MappingManager manager = null;
+		CassandraOperationStatus result;
+
+		// default test
+		testSubject = createTestSubject();
+		result = testSubject.delete(id, clazz, manager);
+	}
+
+	@Test
+	public void testIsConnected() throws Exception {
+		CassandraClient testSubject;
+		boolean result;
+
+		// default test
+		testSubject = createTestSubject();
+		result = testSubject.isConnected();
+	}
+
+	@Test
+	public void testCloseClient() throws Exception {
+		CassandraClient testSubject;
+
+		// default test
+		testSubject = createTestSubject();
+		testSubject.closeClient();
+	}
+}
\ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDaoTest.java
index ed8e2a7..8869c81 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDaoTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/ComponentCassandraDaoTest.java
@@ -1,49 +1,396 @@
 package org.openecomp.sdc.be.dao.cassandra;
 
-import java.util.List;
+import static org.junit.Assert.assertTrue;
 
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.junit.Before;
 import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
 import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.resources.data.ComponentCacheData;
 
-import fj.data.Either;
+import com.datastax.driver.core.Session;
+import com.datastax.driver.mapping.MappingManager;
+import com.datastax.driver.mapping.Result;
 
+import fj.data.Either;
 
 public class ComponentCassandraDaoTest {
 
-	private ComponentCassandraDao createTestSubject() {
-		return new ComponentCassandraDao();
+	@InjectMocks
+	ComponentCassandraDao testSubject;
+
+	@Mock
+	CassandraClient clientMock;
+
+	@Before
+	public void setUp() throws Exception {
+		MockitoAnnotations.initMocks(this);
+	}
+
+	@Test
+	public void testInit() throws Exception {
+
+		// default test
+		testSubject.init();
+
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		testSubject.init();
+	}
+
+	@Test
+	public void testInitException() throws Exception {
+
+		// default test
+		testSubject.init();
+
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either
+				.right(CassandraOperationStatus.CLUSTER_NOT_CONNECTED);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		try {
+			testSubject.init();
+		} catch (Exception e) {
+			assertTrue(e.getClass() == RuntimeException.class);
+		}
+	}
+
+	@Test
+	public void testGetComponents() throws Exception {
+		List<String> ids;
+		Either<List<ComponentCacheData>, ActionStatus> result;
+
+		// test 1
+		ids = null;
+		result = testSubject.getComponents(ids);
+
+		
+		// test 2
+		ids = new LinkedList<>();
+		result = testSubject.getComponents(ids);
+		
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ComponentCacheAccessor componentCacheAccessorMock = Mockito.mock(ComponentCacheAccessor.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		Mockito.when(mappMock.createAccessor(ComponentCacheAccessor.class)).thenReturn(componentCacheAccessorMock);
+		
+		Result<ComponentCacheData> value2 = Mockito.mock(Result.class);
+		Mockito.when(componentCacheAccessorMock.getComponents(Mockito.any())).thenReturn(value2);
+		List<ComponentCacheData> value3 = new LinkedList<>();
+		value3.add(new ComponentCacheData("mock"));
+		Mockito.when(value2.all()).thenReturn(value3);
+		testSubject.init();
+		
+		ids.add("mock");
+		testSubject.getComponents(ids);
+	}
+	
+	@Test
+	public void testGetComponentsNull() throws Exception {
+		List<String> ids = new LinkedList<>();
+		Either<List<ComponentCacheData>, ActionStatus> result;
+		
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ComponentCacheAccessor componentCacheAccessorMock = Mockito.mock(ComponentCacheAccessor.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		Mockito.when(mappMock.createAccessor(ComponentCacheAccessor.class)).thenReturn(componentCacheAccessorMock);
+		
+		Mockito.when(componentCacheAccessorMock.getComponents(Mockito.any())).thenReturn(null);
+		testSubject.init();
+		
+		ids.add("mock");
+		testSubject.getComponents(ids);
+	}
+	
+	@Test
+	public void testGetComponentsException() throws Exception {
+		List<String> ids = new LinkedList<>();
+		Either<List<ComponentCacheData>, ActionStatus> result;
+		
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ComponentCacheAccessor componentCacheAccessorMock = Mockito.mock(ComponentCacheAccessor.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		Mockito.when(mappMock.createAccessor(ComponentCacheAccessor.class)).thenReturn(componentCacheAccessorMock);
+		
+		Mockito.when(componentCacheAccessorMock.getComponents(Mockito.any())).thenThrow(RuntimeException.class);
+		testSubject.init();
+		
+		ids.add("mock");
+		testSubject.getComponents(ids);
 	}
 	
 	@Test
 	public void testGetAllComponentIdTimeAndType() throws Exception {
-		ComponentCassandraDao testSubject;
 		Either<List<ComponentCacheData>, ActionStatus> result;
 
 		// default test
-		testSubject = createTestSubject();
 		result = testSubject.getAllComponentIdTimeAndType();
+		
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ComponentCacheAccessor componentCacheAccessorMock = Mockito.mock(ComponentCacheAccessor.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		Mockito.when(mappMock.createAccessor(ComponentCacheAccessor.class)).thenReturn(componentCacheAccessorMock);
+		
+		Result<ComponentCacheData> value2 = Mockito.mock(Result.class);
+		Mockito.when(componentCacheAccessorMock.getAllComponentIdTimeAndType()).thenReturn(value2);
+		List<ComponentCacheData> value3 = new LinkedList<>();
+		value3.add(new ComponentCacheData("mock"));
+		Mockito.when(value2.all()).thenReturn(value3);
+		testSubject.init();
+		
+		testSubject.getAllComponentIdTimeAndType();
 	}
 
-	
+	@Test
+	public void testGetAllComponentIdTimeAndTypeNull() throws Exception {
+		Either<List<ComponentCacheData>, ActionStatus> result;
 
-
-	
-
+		// default test
+		result = testSubject.getAllComponentIdTimeAndType();
+		
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ComponentCacheAccessor componentCacheAccessorMock = Mockito.mock(ComponentCacheAccessor.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		Mockito.when(mappMock.createAccessor(ComponentCacheAccessor.class)).thenReturn(componentCacheAccessorMock);
+		
+		Mockito.when(componentCacheAccessorMock.getAllComponentIdTimeAndType()).thenReturn(null);
+		testSubject.init();
+		
+		result = testSubject.getAllComponentIdTimeAndType();
+	}
 	
 	@Test
+	public void testGetComponent() throws Exception {
+		String id = "";
+		Either<ComponentCacheData, ActionStatus> result;
+
+		// test 1
+		id = null;
+		result = testSubject.getComponent(id);
+		//Assert.assertEquals(null, result);
+
+		// test 2
+		id = "";
+		result = testSubject.getComponent(id);
+		//Assert.assertEquals(null, result);
+		
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ComponentCacheAccessor componentCacheAccessorMock = Mockito.mock(ComponentCacheAccessor.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		Mockito.when(mappMock.createAccessor(ComponentCacheAccessor.class)).thenReturn(componentCacheAccessorMock);
+		
+		Result<ComponentCacheData> value2 = Mockito.mock(Result.class);
+		Mockito.when(componentCacheAccessorMock.getComponent(Mockito.any())).thenReturn(value2);
+		ComponentCacheData value3 = new ComponentCacheData();
+		Mockito.when(value2.one()).thenReturn(value3);
+		testSubject.init();
+		
+		result = testSubject.getComponent(id);
+	}
+	
+	@Test
+	public void testGetComponentNull1() throws Exception {
+		String id = "";
+		Either<ComponentCacheData, ActionStatus> result;
+		
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ComponentCacheAccessor componentCacheAccessorMock = Mockito.mock(ComponentCacheAccessor.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		Mockito.when(mappMock.createAccessor(ComponentCacheAccessor.class)).thenReturn(componentCacheAccessorMock);
+		
+		Mockito.when(componentCacheAccessorMock.getComponent(Mockito.any())).thenReturn(null);
+		testSubject.init();
+		
+		result = testSubject.getComponent(id);
+	}
+	
+	@Test
+	public void testGetComponentNull2() throws Exception {
+		String id = "";
+		Either<ComponentCacheData, ActionStatus> result;
+
+		// test 1
+		id = null;
+		result = testSubject.getComponent(id);
+		//Assert.assertEquals(null, result);
+
+		// test 2
+		id = "";
+		result = testSubject.getComponent(id);
+		//Assert.assertEquals(null, result);
+		
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ComponentCacheAccessor componentCacheAccessorMock = Mockito.mock(ComponentCacheAccessor.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		Mockito.when(mappMock.createAccessor(ComponentCacheAccessor.class)).thenReturn(componentCacheAccessorMock);
+		
+		Result<ComponentCacheData> value2 = Mockito.mock(Result.class);
+		Mockito.when(componentCacheAccessorMock.getComponent(Mockito.any())).thenReturn(value2);
+		Mockito.when(value2.one()).thenReturn(null);
+		testSubject.init();
+		
+		result = testSubject.getComponent(id);
+	}
+	
+	@Test
+	public void testSaveComponent() throws Exception {
+		ComponentCacheData componentCacheData = null;
+		CassandraOperationStatus result;
+
+		// default test
+		result = testSubject.saveComponent(componentCacheData);
+	}
+
+	@Test
 	public void testIsTableEmpty() throws Exception {
-		ComponentCassandraDao testSubject;
 		String tableName = "";
 		Either<Boolean, CassandraOperationStatus> result;
 
 		// default test
-		testSubject = createTestSubject();
 		result = testSubject.isTableEmpty(tableName);
 	}
 
-	
+	@Test
+	public void testGetComponents_1() throws Exception {
+		Map<String, Long> idToTimestampMap = null;
+		Either<ImmutablePair<List<ComponentCacheData>, Set<String>>, ActionStatus> result;
 
-	
+		// test 1
+		idToTimestampMap = null;
+		result = testSubject.getComponents(idToTimestampMap);
+		//Assert.assertEquals(null, result);
+		
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ComponentCacheAccessor componentCacheAccessorMock = Mockito.mock(ComponentCacheAccessor.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		Mockito.when(mappMock.createAccessor(ComponentCacheAccessor.class)).thenReturn(componentCacheAccessorMock);
+		
+		Result<ComponentCacheData> value2 = Mockito.mock(Result.class);
+		Mockito.when(componentCacheAccessorMock.getComponents(Mockito.any(List.class))).thenReturn(value2);
+		List<ComponentCacheData> value3 = new LinkedList<>();
+		ComponentCacheData e = new ComponentCacheData("mock");
+		Mockito.when(value2.all()).thenReturn(value3);
+		testSubject.init();
+		
+		idToTimestampMap = new HashMap<>();
+		idToTimestampMap.put("mock", 0L);
+		e.setModificationTime(new Date());
+		value3.add(e);
+		result = testSubject.getComponents(idToTimestampMap);
+	}
 
+	@Test
+	public void testGetComponents_1Null() throws Exception {
+		Map<String, Long> idToTimestampMap = null;
+		Either<ImmutablePair<List<ComponentCacheData>, Set<String>>, ActionStatus> result;
+		
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ComponentCacheAccessor componentCacheAccessorMock = Mockito.mock(ComponentCacheAccessor.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		Mockito.when(mappMock.createAccessor(ComponentCacheAccessor.class)).thenReturn(componentCacheAccessorMock);
+		
+		Mockito.when(componentCacheAccessorMock.getComponents(Mockito.any(List.class))).thenReturn(null);
+		testSubject.init();
+		
+		idToTimestampMap = new HashMap<>();
+		idToTimestampMap.put("mock", 0L);
+		result = testSubject.getComponents(idToTimestampMap);
+	}
+	
+	@Test
+	public void testGetComponents_1Exception() throws Exception {
+		Map<String, Long> idToTimestampMap = null;
+		Either<ImmutablePair<List<ComponentCacheData>, Set<String>>, ActionStatus> result;
+		
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ComponentCacheAccessor componentCacheAccessorMock = Mockito.mock(ComponentCacheAccessor.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		Mockito.when(mappMock.createAccessor(ComponentCacheAccessor.class)).thenReturn(componentCacheAccessorMock);
+		
+		Mockito.when(componentCacheAccessorMock.getComponents(Mockito.any(List.class))).thenThrow(RuntimeException.class);
+		testSubject.init();
+		
+		idToTimestampMap = new HashMap<>();
+		idToTimestampMap.put("mock", 0L);
+		result = testSubject.getComponents(idToTimestampMap);
+	}
+	
+	@Test
+	public void testDeleteComponent() throws Exception {
+		String id = "";
+		CassandraOperationStatus result;
+
+		// default test
+		result = testSubject.deleteComponent(id);
+	}
 }
\ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/OperationalEnvironmentDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/OperationalEnvironmentDaoTest.java
new file mode 100644
index 0000000..12418a4
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/OperationalEnvironmentDaoTest.java
@@ -0,0 +1,161 @@
+package org.openecomp.sdc.be.dao.cassandra;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.openecomp.sdc.be.datatypes.enums.EnvironmentStatusEnum;
+import org.openecomp.sdc.be.resources.data.OperationalEnvironmentEntry;
+
+import com.datastax.driver.core.Session;
+import com.datastax.driver.mapping.MappingManager;
+import com.datastax.driver.mapping.Result;
+
+import fj.data.Either;
+
+public class OperationalEnvironmentDaoTest {
+
+	@InjectMocks
+	OperationalEnvironmentDao testSubject;
+
+	@Mock
+	CassandraClient clientMock;
+
+	@Before
+	public void setUp() throws Exception {
+		MockitoAnnotations.initMocks(this);
+	}
+
+	@Test
+	public void testInit() throws Exception {
+
+		// default test
+		testSubject.init();
+		
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		testSubject.init();
+	}
+	
+	@Test
+	public void testInitException() throws Exception {
+
+		// default test
+		testSubject.init();
+
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either
+				.right(CassandraOperationStatus.CLUSTER_NOT_CONNECTED);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		try {
+			testSubject.init();
+		} catch (Exception e) {
+			assertTrue(e.getClass() == RuntimeException.class);
+		}
+	}
+	
+	@Test
+	public void testSave() throws Exception {
+		OperationalEnvironmentEntry operationalEnvironmentEntry = null;
+		CassandraOperationStatus result;
+
+		// default test
+		result = testSubject.save(operationalEnvironmentEntry);
+	}
+
+	@Test
+	public void testGet() throws Exception {
+		String envId = "";
+		Either<OperationalEnvironmentEntry, CassandraOperationStatus> result;
+
+		// default test
+		result = testSubject.get(envId);
+	}
+
+	@Test
+	public void testDelete() throws Exception {
+		String envId = "";
+		CassandraOperationStatus result;
+
+		// default test
+		result = testSubject.delete(envId);
+	}
+
+	@Test
+	public void testDeleteAll() throws Exception {
+		CassandraOperationStatus result;
+
+		// default test
+		result = testSubject.deleteAll();
+		
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		testSubject.init();
+		
+		result = testSubject.deleteAll();
+	}
+
+	@Test
+	public void testIsTableEmpty() throws Exception {
+		String tableName = "";
+		Either<Boolean, CassandraOperationStatus> result;
+
+		// default test
+		result = testSubject.isTableEmpty(tableName);
+	}
+
+	@Test
+	public void testGetByEnvironmentsStatus() throws Exception {
+		Either<List<OperationalEnvironmentEntry>, CassandraOperationStatus> result;
+		
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		OperationalEnvironmentsAccessor value2 = Mockito.mock(OperationalEnvironmentsAccessor.class);
+		Mockito.when(mappMock.createAccessor(OperationalEnvironmentsAccessor.class)).thenReturn(value2);
+		Result<OperationalEnvironmentEntry> value3 = Mockito.mock(Result.class);
+		Mockito.when(value2.getByEnvironmentsStatus(Mockito.any(String.class))).thenReturn(value3);
+		testSubject.init();
+		
+		// default test
+		result = testSubject.getByEnvironmentsStatus(EnvironmentStatusEnum.COMPLETED);
+	}
+	
+	@Test
+	public void testGetByEnvironmentsStatusNull() throws Exception {
+		Either<List<OperationalEnvironmentEntry>, CassandraOperationStatus> result;
+		
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		OperationalEnvironmentsAccessor value2 = Mockito.mock(OperationalEnvironmentsAccessor.class);
+		Mockito.when(mappMock.createAccessor(OperationalEnvironmentsAccessor.class)).thenReturn(value2);
+		Result<OperationalEnvironmentEntry> value3 = null;
+		Mockito.when(value2.getByEnvironmentsStatus(Mockito.any(String.class))).thenReturn(value3);
+		testSubject.init();
+		
+		// default test
+		result = testSubject.getByEnvironmentsStatus(EnvironmentStatusEnum.COMPLETED);
+	}
+}
\ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDaoTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDaoTest.java
index 96e8a7e..402cfc5 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDaoTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/cassandra/SdcSchemaFilesCassandraDaoTest.java
@@ -1,53 +1,130 @@
 package org.openecomp.sdc.be.dao.cassandra;
 
+import static org.junit.Assert.assertTrue;
+
 import java.util.List;
 
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.junit.Before;
 import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
 import org.openecomp.sdc.be.resources.data.SdcSchemaFilesData;
 
+import com.datastax.driver.core.Session;
+import com.datastax.driver.mapping.MappingManager;
+
 import fj.data.Either;
 
 
 public class SdcSchemaFilesCassandraDaoTest {
 
-	private SdcSchemaFilesCassandraDao createTestSubject() {
-		return new SdcSchemaFilesCassandraDao();
+	@InjectMocks
+	SdcSchemaFilesCassandraDao testSubject;
+
+	@Mock
+	CassandraClient clientMock;
+
+	@Before
+	public void setUp() throws Exception {
+		MockitoAnnotations.initMocks(this);
 	}
 
+	@Test
+	public void testInit() throws Exception {
 
+		// default test
+		testSubject.init();
+
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		testSubject.init();
+	}
+
+	@Test
+	public void testInitException() throws Exception {
+
+		// default test
+		testSubject.init();
+
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either
+				.right(CassandraOperationStatus.CLUSTER_NOT_CONNECTED);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		try {
+			testSubject.init();
+		} catch (Exception e) {
+			assertTrue(e.getClass() == RuntimeException.class);
+		}
+	}
+
+	@Test
+	public void testSaveSchemaFile() throws Exception {
+		SdcSchemaFilesData schemaFileData = null;
+		CassandraOperationStatus result;
+
+		// default test
+		result = testSubject.saveSchemaFile(schemaFileData);
+	}
+	
+	@Test
+	public void testGetSchemaFile() throws Exception {
+		String schemaFileId = null;
+		Either<SdcSchemaFilesData, CassandraOperationStatus> result;
+
+		// default test
+		result = testSubject.getSchemaFile(schemaFileId);
+	}
+	
+	@Test
+	public void testDeleteSchemaFile() throws Exception {
+		String schemaFileId = null;
+		CassandraOperationStatus result;
+
+		// default test
+		result = testSubject.deleteSchemaFile(schemaFileId);
+	}
 	
 	@Test
 	public void testGetSpecificSchemaFiles() throws Exception {
-		SdcSchemaFilesCassandraDao testSubject;
 		String sdcreleasenum = "";
 		String conformancelevel = "";
 		Either<List<SdcSchemaFilesData>, CassandraOperationStatus> result;
 
 		// default test
-		testSubject = createTestSubject();
 		result = testSubject.getSpecificSchemaFiles(sdcreleasenum, conformancelevel);
 	}
 
-	
 	@Test
-	public void testDeleteAllArtifacts() throws Exception {
-		SdcSchemaFilesCassandraDao testSubject;
+	public void testDeleteAll() throws Exception {
 		CassandraOperationStatus result;
 
 		// default test
-		testSubject = createTestSubject();
+		result = testSubject.deleteAllArtifacts();
+		
+		Mockito.when(clientMock.isConnected()).thenReturn(true);
+		Session sessMock = Mockito.mock(Session.class);
+		MappingManager mappMock = Mockito.mock(MappingManager.class);
+		ImmutablePair<Session, MappingManager> ipMock = ImmutablePair.of(sessMock, mappMock);
+		Either<ImmutablePair<Session, MappingManager>, CassandraOperationStatus> value = Either.left(ipMock);
+		Mockito.when(clientMock.connect(Mockito.any())).thenReturn(value);
+		testSubject.init();
+		
 		result = testSubject.deleteAllArtifacts();
 	}
-
 	
 	@Test
 	public void testIsTableEmpty() throws Exception {
-		SdcSchemaFilesCassandraDao testSubject;
 		String tableName = "";
 		Either<Boolean, CassandraOperationStatus> result;
 
 		// default test
-		testSubject = createTestSubject();
 		result = testSubject.isTableEmpty(tableName);
 	}
 }
\ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/utils/DAOConfDependentTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/utils/DAOConfDependentTest.java
new file mode 100644
index 0000000..4759d5b
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/utils/DAOConfDependentTest.java
@@ -0,0 +1,13 @@
+package org.openecomp.sdc.be.utils;
+
+import org.junit.BeforeClass;
+import org.openecomp.sdc.common.test.BaseConfDependent;
+
+public class DAOConfDependentTest extends BaseConfDependent {
+	@BeforeClass
+    public static void setupBeforeClass() {
+        componentName = "catalog-dao";
+        confPath = "src/test/resources/config";
+        setUp();
+    }
+}
