2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.asdctool.impl.validator.executers;
23 import org.junit.Test;
24 import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao;
25 import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
26 import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
27 import org.openecomp.sdc.be.model.Component;
28 import org.openecomp.sdc.be.model.Resource;
29 import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
30 import org.testng.Assert;
32 import java.util.HashMap;
33 import java.util.LinkedList;
34 import java.util.List;
37 import static org.mockito.Mockito.mock;
39 public class ArtifactValidatorExecuterTest {
41 private ArtifactValidatorExecuter createTestSubject() {
42 JanusGraphDao janusGraphDaoMock = mock(JanusGraphDao.class);
43 ToscaOperationFacade toscaOperationFacade = mock(ToscaOperationFacade.class);
45 return new ArtifactValidatorExecuter(janusGraphDaoMock, toscaOperationFacade);
49 public void testGetName() throws Exception {
50 ArtifactValidatorExecuter testSubject;
54 testSubject = createTestSubject();
55 result = testSubject.getName();
58 @Test(expected=NullPointerException.class)
59 public void testGetVerticesToValidate() throws Exception {
60 ArtifactValidatorExecuter testSubject;
61 VertexTypeEnum type = null;
62 Map<GraphPropertyEnum, Object> hasProps = null;
65 testSubject = createTestSubject();
66 testSubject.getVerticesToValidate(type, hasProps);
70 public void testSetName() throws Exception {
71 ArtifactValidatorExecuter testSubject;
75 testSubject = createTestSubject();
76 testSubject.setName(name);
80 public void testValidate() {
81 ArtifactValidatorExecuter testSubject;
82 Map<String, List<Component>> vertices = new HashMap<>();
83 LinkedList<Component> linkedList = new LinkedList<Component>();
84 linkedList.add(new Resource());
85 vertices.put("stam", linkedList);
89 testSubject = createTestSubject();
90 result = testSubject.validate(vertices);
91 Assert.assertFalse(result);