* ============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.
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;
import org.onap.policy.so.SoRequest;
import org.onap.policy.so.SoResponse;
+@RunWith(MockitoJUnitRunner.class)
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);
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();
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);
}