diff options
Diffstat (limited to 'mso-catalog-db/src/test')
2 files changed, 25 insertions, 1 deletions
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java index 66fc0f5dc5..79e3cbcc08 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2020 Nordix + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -179,7 +181,7 @@ public class CatalogDbClientTest { } @Test - public final void testFindWorkflowByPnfModelUUID() throws Exception { + public final void testFindWorkflowByPnfModelUUID() { String pnfResourceModelUUID = "f2d1f2b2-88bb-49da-b716-36ae420ccbff"; doReturn(new ArrayList()).when(catalogDbClient).getMultipleResources(any(), any()); @@ -190,4 +192,16 @@ public class CatalogDbClientTest { } + @Test + public final void testFindWorkflowByResourceTarget() { + // when + final String pnf_resource = "pnf"; + doReturn(new ArrayList()).when(catalogDbClient).getMultipleResources(any(), any()); + catalogDbClient.findWorkflowByResourceTarget(pnf_resource); + + // verify + verify(catalogDbClient).getMultipleResources(any(Client.class), eq(UriBuilder.fromUri("/findByResourceTarget") + .queryParam(CatalogDbClient.RESOURCE_TARGET, pnf_resource).build())); + } + } diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java index b07e82b8a8..e47c61d8b4 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java @@ -55,4 +55,14 @@ public class WorkflowRepositoryTest extends BaseTest { Assert.assertTrue("testingWorkflow.bpmn".equals(workflows.get(0).getArtifactName())); } + @Test + public void findByResourceTargetTest() { + List<Workflow> workflows = workflowRepository.findByResourceTarget("pnf"); + + Assert.assertTrue(workflows != null); + Assert.assertTrue(workflows.size() == 1); + + Assert.assertTrue("DummyPnfWorkflow".equals(workflows.get(0).getArtifactName())); + } + } |