3 * Copyright (c) 2018 AT&T Intellectual Property.
7 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
19 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
23 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 * See the License for the specific language governing permissions and
27 * limitations under the License.
30 package org.openecomp.sdc.be.model.operations.impl;
32 import com.thinkaurelius.titan.core.TitanVertex;
33 import fj.data.Either;
34 import org.junit.Test;
35 import org.junit.runner.RunWith;
36 import org.mockito.InjectMocks;
37 import org.mockito.Mock;
38 import org.mockito.Mockito;
39 import org.mockito.junit.MockitoJUnitRunner;
40 import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
41 import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
42 import org.openecomp.sdc.be.model.ComponentInstanceInput;
43 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
45 import static org.junit.Assert.assertNull;
46 import static org.junit.Assert.assertEquals;
47 import static org.mockito.Mockito.when;
49 @RunWith(MockitoJUnitRunner.class)
50 public class ComponentInstanceOperationTest {
53 private ComponentInstanceOperation componentInstanceOperation;
56 protected TitanGenericDao titanGenericDao;
60 public void testSetTitanGenericDao() {
61 componentInstanceOperation.setTitanGenericDao(titanGenericDao);
65 public void testUpdateInputValueInResourceInstance() {
66 ComponentInstanceInput input = null;
67 String resourceInstanceId = "";
69 Either<ComponentInstanceInput, StorageOperationStatus> result;
71 result = componentInstanceOperation.updateInputValueInResourceInstance(input, resourceInstanceId, b);
76 public void testUpdateCustomizationUUID() {
77 StorageOperationStatus result;
78 String componentInstanceId = "instanceId";
79 TitanVertex titanVertex = Mockito.mock(TitanVertex.class);
80 when(titanGenericDao.getVertexByProperty(GraphPropertiesDictionary.UNIQUE_ID.getProperty(),componentInstanceId)).thenReturn(Either.left(titanVertex));
81 result = componentInstanceOperation.updateCustomizationUUID(componentInstanceId);
82 assertEquals(StorageOperationStatus.OK, result);