171d4b29f5cf7212620beb6876f7abd6f2b37c2d
[so.git] / mso-catalog-db / src / test / java / org / onap / so / db / catalog / data / repository / WorkflowRepositoryTest.java
1 /*
2  * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix
3  * Foundation. ================================================================================ Licensed under the
4  * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
5  * obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
8  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
9  * either express or implied. See the License for the specific language governing permissions and limitations under the
10  * License.
11  *
12  * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END=========================================================
13  */
14
15 package org.onap.so.db.catalog.data.repository;
16
17 import static org.junit.Assert.assertEquals;
18 import java.util.List;
19 import org.junit.Assert;
20 import org.junit.Test;
21 import org.onap.so.db.catalog.BaseTest;
22 import org.onap.so.db.catalog.beans.Workflow;
23 import org.springframework.beans.factory.annotation.Autowired;
24
25 public class WorkflowRepositoryTest extends BaseTest {
26
27     @Autowired
28     private WorkflowRepository workflowRepository;
29
30     @Test
31     public void findByArtifactUuid_ValidUuid_ExpectedOutput() throws Exception {
32         Workflow workflow = workflowRepository.findByArtifactUUID("5b0c4322-643d-4c9f-b184-4516049e99b1");
33
34         assertEquals("artifactName", "testingWorkflow", workflow.getArtifactName());
35     }
36
37     @Test
38     public void findByVnfResourceModelUUIDTest() throws Exception {
39         List<Workflow> workflows = workflowRepository.findWorkflowByModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
40
41         Assert.assertTrue(workflows != null);
42         Assert.assertTrue(workflows.size() != 0);
43
44         Assert.assertTrue("testingWorkflow".equals(workflows.get(0).getArtifactName()));
45     }
46
47     @Test
48     public void findBySourceTest() throws Exception {
49         List<Workflow> workflows = workflowRepository.findBySource("sdc");
50
51         Assert.assertTrue(workflows != null);
52         Assert.assertTrue(workflows.size() != 0);
53
54         Assert.assertTrue("testingWorkflow".equals(workflows.get(0).getArtifactName()));
55     }
56
57 }