summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWojciech Sliwka <wojciech.sliwka@nokia.com>2019-06-28 09:20:55 +0200
committerOfir Sonsino <ofir.sonsino@intl.att.com>2019-07-07 08:22:38 +0000
commit958a87de8f3c19ce51d969047f750692da2ba833 (patch)
tree63d9b5f2934c2e6e44022aa2a6fc7fb3875da799
parentbf2ffad5b686eb0ffddbeeeca5824b8caea0c8ff (diff)
Remove field injection in catalog-dao
Change-Id: I96ac13d3b50737518924a3aaa9b320adbba241eb Issue-ID: SDC-2398 Signed-off-by: Wojciech Sliwka <wojciech.sliwka@nokia.com>
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java2
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java2
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/JanusGraphSpringConfig.java4
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/HealingJanusGraphGenericDao.java5
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/HealingJanusGraphDao.java6
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java7
6 files changed, 14 insertions, 12 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java
index e011aabdd9..96eeaaf464 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/externalapi/servlet/ExternalRefServletTest.java
@@ -232,7 +232,7 @@ public class ExternalRefServletTest extends JerseyTest {
@Bean
HealingJanusGraphDao janusGraphDao() {
- this.janusGraphDao = new HealingJanusGraphDao(janusGraphClient());
+ this.janusGraphDao = new HealingJanusGraphDao(healingPipelineDao(),janusGraphClient());
return janusGraphDao;
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java
index 2ad52251f6..fc7ee951b8 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ArchiveEndpointTest.java
@@ -212,7 +212,7 @@ public class ArchiveEndpointTest extends JerseyTest {
@Bean
HealingJanusGraphDao janusGraphDao() {
- janusGraphDao = new HealingJanusGraphDao(janusGraphClient());
+ janusGraphDao = new HealingJanusGraphDao(healingPipelineDao(), janusGraphClient());
return janusGraphDao;
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/JanusGraphSpringConfig.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/JanusGraphSpringConfig.java
index d30caf1845..eff0ec7be0 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/JanusGraphSpringConfig.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/config/JanusGraphSpringConfig.java
@@ -23,8 +23,8 @@ public class JanusGraphSpringConfig {
@Bean(name = "janusgraph-generic-dao")
@Primary
- public HealingJanusGraphGenericDao janusGraphGenericDao(@Qualifier("janusgraph-client") JanusGraphClient janusGraphClient) {
- return new HealingJanusGraphGenericDao(janusGraphClient);
+ public HealingJanusGraphGenericDao janusGraphGenericDao(@Qualifier("janusgraph-client") JanusGraphClient janusGraphClient, @Qualifier("healingPipelineDao") HealingPipelineDao healingPipelineDao) {
+ return new HealingJanusGraphGenericDao(healingPipelineDao, janusGraphClient);
}
@Bean(name = "janusgraph-client", initMethod = "createGraph")
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/HealingJanusGraphGenericDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/HealingJanusGraphGenericDao.java
index f8ab531f04..1b643ffa75 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/HealingJanusGraphGenericDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/janusgraph/HealingJanusGraphGenericDao.java
@@ -36,11 +36,12 @@ import org.springframework.stereotype.Component;
@Component("janusgraph-generic-dao")
public class HealingJanusGraphGenericDao extends JanusGraphGenericDao {
- @Autowired
private HealingPipelineDao healingPipelineDao;
- public HealingJanusGraphGenericDao(JanusGraphClient janusGraphClient) {
+ @Autowired
+ public HealingJanusGraphGenericDao(HealingPipelineDao healingPipelineDao, JanusGraphClient janusGraphClient) {
super(janusGraphClient);
+ this.healingPipelineDao = healingPipelineDao;
}
@Override
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/HealingJanusGraphDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/HealingJanusGraphDao.java
index c2ef659c65..90c0d9157a 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/HealingJanusGraphDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/HealingJanusGraphDao.java
@@ -31,13 +31,13 @@ import org.springframework.stereotype.Component;
@Component("janusgraph-dao")
public class HealingJanusGraphDao extends JanusGraphDao {
-
- @Autowired
private HealingPipelineDao healingPipelineDao;
- public HealingJanusGraphDao(JanusGraphClient janusGraphClient) {
+ @Autowired
+ public HealingJanusGraphDao(HealingPipelineDao healingPipelineDao, JanusGraphClient janusGraphClient) {
super(janusGraphClient);
+ this.healingPipelineDao = healingPipelineDao;
}
@Override
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java
index 8535c3a9f3..7550b209a9 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperationTest.java
@@ -26,7 +26,7 @@ import org.apache.commons.lang3.tuple.ImmutablePair;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.Mockito;
+import org.openecomp.sdc.be.dao.impl.HealingPipelineDao;
import org.openecomp.sdc.be.dao.janusgraph.HealingJanusGraphGenericDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphClient;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
@@ -48,10 +48,11 @@ import org.openecomp.sdc.be.resources.data.PropertyValueData;
import java.util.*;
import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
public class PropertyOperationTest extends ModelTestBase {
- HealingJanusGraphGenericDao janusGraphGenericDao = Mockito.mock(HealingJanusGraphGenericDao.class);
+ HealingJanusGraphGenericDao janusGraphGenericDao = mock(HealingJanusGraphGenericDao.class);
PropertyOperation propertyOperation = new PropertyOperation(janusGraphGenericDao, null);
@@ -512,7 +513,7 @@ public class PropertyOperationTest extends ModelTestBase {
}
private PropertyOperation createTestSubject() {
- return new PropertyOperation(new HealingJanusGraphGenericDao(new JanusGraphClient()), null);
+ return new PropertyOperation(new HealingJanusGraphGenericDao(mock(HealingPipelineDao.class), new JanusGraphClient()), null);
}