X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=models-interactions%2Fmodel-actors%2Factor.so%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fcontrolloop%2Factor%2Fso%2FVfModuleCreateTest.java;h=ad242c0dc469e531cbc807cc7bd6fa9e89cc15a6;hb=e3938e43b8a1f02f74368ecb75c38530285feac0;hp=8dca7c844b56a927474614705c0070433cfeebff;hpb=19ef8b24a98c09a349e6ae7309f535a0135463f6;p=policy%2Fmodels.git diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java index 8dca7c844..ad242c0dc 100644 --- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java +++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleCreateTest.java @@ -2,8 +2,9 @@ * ============LICENSE_START======================================================= * ONAP * ================================================================================ - * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020 Wipro Limited. + * Modifications Copyright (C) 2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +39,8 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.aai.domain.yang.CloudRegion; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.ModelVer; @@ -53,6 +56,7 @@ import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingPa import org.onap.policy.so.SoRequest; import org.onap.policy.so.SoResponse; +@RunWith(MockitoJUnitRunner.class) public class VfModuleCreateTest extends BasicSoOperation { @@ -98,7 +102,7 @@ public class VfModuleCreateTest extends BasicSoOperation { .maxPolls(2).build(); config = new HttpPollingConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); - params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).preprocessed(true).build(); + params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build(); oper = new VfModuleCreate(params, config); @@ -212,6 +216,20 @@ public class VfModuleCreateTest extends BasicSoOperation { verifyRequest("vfModuleCreate.json", pair.getRight()); } + /** + * Tests makeRequest() when a property is missing. + */ + @Test + public void testMakeRequestMissingProperty() throws Exception { + loadProperties(); + + ServiceInstance instance = new ServiceInstance(); + oper.setProperty(OperationProperties.AAI_SERVICE, instance); + + assertThatIllegalArgumentException().isThrownBy(() -> oper.makeRequest()) + .withMessageContaining("missing service instance ID"); + } + private void loadProperties() { // set the properties ServiceInstance instance = new ServiceInstance(); @@ -229,8 +247,13 @@ public class VfModuleCreateTest extends BasicSoOperation { vnf.setVnfId(VNF_ID); oper.setProperty(OperationProperties.AAI_VNF, vnf); - oper.setProperty(OperationProperties.AAI_DEFAULT_CLOUD_REGION, new CloudRegion()); - oper.setProperty(OperationProperties.AAI_DEFAULT_TENANT, new Tenant()); + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setCloudRegionId("my-cloud-id"); + oper.setProperty(OperationProperties.AAI_DEFAULT_CLOUD_REGION, cloudRegion); + + Tenant tenant = new Tenant(); + tenant.setTenantId("my-tenant-id"); + oper.setProperty(OperationProperties.AAI_DEFAULT_TENANT, tenant); oper.setProperty(OperationProperties.DATA_VF_COUNT, VF_COUNT); }