-package org.openecomp.sdc.be.model.jsontitan.operations;
+package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
import fj.data.Either;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
-import org.openecomp.sdc.be.dao.jsongraph.TitanDao;
+import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.MapComponentInstanceExternalRefs;
import org.openecomp.sdc.be.model.ModelTestBase;
-import org.openecomp.sdc.be.model.jsontitan.utils.GraphTestUtils;
-import org.openecomp.sdc.be.model.jsontitan.utils.IdMapper;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.GraphTestUtils;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.IdMapper;
import org.openecomp.sdc.be.model.operations.StorageException;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
private ExternalReferencesOperation externalReferenceOperation;
@Resource
- private TitanDao titanDao;
+ private JanusGraphDao janusGraphDao;
private boolean isInitialized;
this.externalReferenceOperation.setIdMapper(idMapper);
when(idMapper.mapComponentNameToUniqueId(Mockito.anyString(), Mockito.any(GraphVertex.class))).thenReturn(COMPONENT_ID);
if (!isInitialized) {
- GraphTestUtils.clearGraph(titanDao);
+ GraphTestUtils.clearGraph(janusGraphDao);
initGraphForTest();
isInitialized = true;
}
Either<String, ActionStatus> addResult = externalReferenceOperation.addExternalReference(this.serviceVertexUuid, COMPONENT_ID, MONITORING_OBJECT_TYPE, REF_4);
assertThat(addResult.isLeft()).isEqualTo(true);
- //commit changes to titan
- final TitanOperationStatus commit = this.titanDao.commit();
- assertThat(commit).isEqualTo(TitanOperationStatus.OK);
+ //commit changes to janusgraph
+ final JanusGraphOperationStatus commit = this.janusGraphDao.commit();
+ assertThat(commit).isEqualTo(JanusGraphOperationStatus.OK);
assertThat(getServiceExternalRefs()).contains(REF_1, REF_2, REF_3, REF_4);
}
Either<String, ActionStatus> deleteStatus = externalReferenceOperation.deleteExternalReference(this.serviceVertexUuid, COMPONENT_ID, MONITORING_OBJECT_TYPE, REF_5);
assertThat(deleteStatus.isLeft()).isEqualTo(true);
- //commit changes to titan
- final TitanOperationStatus commit = this.titanDao.commit();
- assertThat(commit).isEqualTo(TitanOperationStatus.OK);
+ //commit changes to janusgraph
+ final JanusGraphOperationStatus commit = this.janusGraphDao.commit();
+ assertThat(commit).isEqualTo(JanusGraphOperationStatus.OK);
//Check that ref does not exist anymore
assertThat(getServiceExternalRefs()).doesNotContain(REF_5).contains(REF_1, REF_2, REF_3);
assertThat(updateResult.isLeft()).isEqualTo(true);
- //commit changes to titan
- final TitanOperationStatus commit = this.titanDao.commit();
- assertThat(commit).isEqualTo(TitanOperationStatus.OK);
+ //commit changes to janusgraph
+ final JanusGraphOperationStatus commit = this.janusGraphDao.commit();
+ assertThat(commit).isEqualTo(JanusGraphOperationStatus.OK);
//Check that ref does not exist anymore
assertThat(getServiceExternalRefs()).doesNotContain(REF_5).contains(REF_1, REF_2, REF_3, REF_4);
private List<String> getServiceExternalRefs(){
//Get service vertex
- final Either<GraphVertex, TitanOperationStatus> externalRefsVertexResult = this.titanDao.getChildVertex(this.serviceVertex, EdgeLabelEnum.EXTERNAL_REFS, JsonParseFlagEnum.ParseJson);
+ final Either<GraphVertex, JanusGraphOperationStatus> externalRefsVertexResult = this.janusGraphDao
+ .getChildVertex(this.serviceVertex, EdgeLabelEnum.EXTERNAL_REFS, JsonParseFlagEnum.ParseJson);
assertThat(externalRefsVertexResult.isLeft()).isEqualTo(true);
GraphVertex externalRefVertex = externalRefsVertexResult.left().value();
private void initGraphForTest() {
//create a service
- this.serviceVertex = GraphTestUtils.createServiceVertex(titanDao, new HashMap<>());
+ this.serviceVertex = GraphTestUtils.createServiceVertex(janusGraphDao, new HashMap<>());
this.serviceVertexUuid = this.serviceVertex.getUniqueId();
//monitoring references
externalReferenceOperation.addExternalReference(serviceVertexUuid, COMPONENT_ID, WORKFLOW_OBJECT_TYPE, REF_6);
//create a service without refs
- serviceVertex2 = GraphTestUtils.createServiceVertex(titanDao, new HashMap<>());
+ serviceVertex2 = GraphTestUtils.createServiceVertex(janusGraphDao, new HashMap<>());
serviceVertex2Uuid = serviceVertex2.getUniqueId();
//create a service for adding all references
- serviceVertex3 = GraphTestUtils.createServiceVertex(titanDao, new HashMap<>());
+ serviceVertex3 = GraphTestUtils.createServiceVertex(janusGraphDao, new HashMap<>());
serviceVertex3Uuid = serviceVertex3.getUniqueId();
- final TitanOperationStatus commit = this.titanDao.commit();
- assertThat(commit).isEqualTo(TitanOperationStatus.OK);
+ final JanusGraphOperationStatus commit = this.janusGraphDao.commit();
+ assertThat(commit).isEqualTo(JanusGraphOperationStatus.OK);
}
}
\ No newline at end of file