diff options
5 files changed, 32 insertions, 27 deletions
diff --git a/vid-automation/src/test/java/org/onap/vid/api/ProbeApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/ProbeApiTest.java index 05075896a..d3c72dab6 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/ProbeApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/ProbeApiTest.java @@ -6,9 +6,9 @@ import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.startsWith; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.testng.Assert.assertEquals; import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET; -import static vid.automation.test.services.SimulatorApi.getSimulatedResponsesPort; -import static vid.automation.test.services.SimulatorApi.getSimulatorHost; import com.google.common.collect.ImmutableList; import java.lang.reflect.Method; @@ -17,7 +17,6 @@ import java.util.List; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; -import org.junit.Assert; import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGetInvalidResponse; @@ -43,8 +42,7 @@ public class ProbeApiTest extends BaseApiTest { private static final String MSO_QUERY_PARAMS = "filter=requestExecutionDate:EQUALS:01-01-2100"; private static final String AAI_QUERY_PARMAS = "business/customers?subscriber-type=INFRA&depth=0"; private static final String SDC_PATH_PARAMS = "46401eec-35bd-4e96-ad0d-0356ff6b8c8d/toscaModel"; - private static final String SCHEDULER_PATH = - String.format("http://%s:%d/scheduler/v1/ChangeManagement/schedules/scheduleDetails/", getSimulatorHost(), getSimulatedResponsesPort()); + private static final String SCHEDULER_PATH = "/scheduler/v1/ChangeManagement/schedules/scheduleDetails/"; @BeforeClass @@ -210,7 +208,7 @@ public class ProbeApiTest extends BaseApiTest { new ParameterizedTypeReference<List<ExternalComponentStatus>>() { }); List<ExternalComponentStatus> probeResults = response.getBody(); - Assert.assertEquals(5, probeResults.size()); + assertEquals(5, probeResults.size()); assertResultAsExpected(ExternalComponentStatus.Component.AAI, probeResults, expectedStatuses); assertResultAsExpected(ExternalComponentStatus.Component.SDC, probeResults, expectedStatuses); assertResultAsExpected(ExternalComponentStatus.Component.MSO, probeResults, expectedStatuses); @@ -223,16 +221,16 @@ public class ProbeApiTest extends BaseApiTest { ExternalComponentStatus componentStatus = probeResults.stream().filter(x -> x.getComponent() == component) .findFirst().orElseThrow(() -> new AssertionError(component.name()+" result not found in response")); - Assert.assertThat("wrong metadata for " + component, requestMetadataReflected(componentStatus.getMetadata()), + assertThat("wrong metadata for " + component, requestMetadataReflected(componentStatus.getMetadata()), is(requestMetadataReflected(expectedStatus.getMetadata()))); - Assert.assertThat("wrong url for " + component, componentStatus.getMetadata().getUrl(), + assertThat("wrong url for " + component, componentStatus.getMetadata().getUrl(), both(endsWith(expectedStatus.getMetadata().getUrl())).and(startsWith("http"))); - Assert.assertThat("wrong description for " + component, componentStatus.getMetadata().getDescription(), + assertThat("wrong description for " + component, componentStatus.getMetadata().getDescription(), anyOf(equalTo(expectedStatus.getMetadata().getDescription()), startsWith(expectedStatus.getMetadata().getDescription()))); - Assert.assertThat("wrong status for " + component, componentStatus.isAvailable(), is(expectedStatus.isAvailable())); + assertThat("wrong status for " + component, componentStatus.isAvailable(), is(expectedStatus.isAvailable())); } //serialize fields except of fields we cannot know ahead of time diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.spec.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.spec.ts index e97ed9ca3..64d553bfc 100644 --- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.spec.ts +++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.spec.ts @@ -46,6 +46,13 @@ describe('Basic Control Generator', () => { expect(legacyRegionControl.isVisible).toBeFalsy(); }); + test('sdn-preload checkbox is visible', () => { + const instance = {}; + const sdncPreload: FileFormControl = service.getSDNCControl(instance); + expect (sdncPreload.displayName).toEqual('SDN-C pre-load'); + expect (sdncPreload.value).toBeFalsy(); + }); + test('given instance, get supp file from getSupplementaryFile ', () => { const instance = {}; const suppFileForInstance: FileFormControl = service.getSupplementaryFile(instance); diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.ts index f7075e7d8..3e94b4b2c 100644 --- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.ts +++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/basic.control.generator.ts @@ -22,8 +22,10 @@ import {Observable, of} from "rxjs"; import {NodeModel} from "../../../models/nodeModel"; import {Constants} from "../../../utils/constants"; import {FileUnit} from "../../formControls/component/file/fileUnit.enum"; +import {CheckboxFormControl} from "../../../models/formControlModels/checkboxFormControl.model"; const SUPPLEMENTARY_FILE = 'supplementaryFile'; +export const SDN_C_PRE_LOAD = 'sdncPreLoad'; @Injectable() export class BasicControlGenerator { @@ -244,6 +246,16 @@ export class BasicControlGenerator { return originalArray.concat([suppFileInput], suppFileInput.hiddenFile); } + getSDNCControl = (instance: any): FormControlModel => { + return new CheckboxFormControl({ + controlName: SDN_C_PRE_LOAD, + displayName: 'SDN-C pre-load', + dataTestId: 'sdncPreLoad', + value: instance ? instance.sdncPreLoad : false, + validations: [new ValidatorModel(ValidatorOptions.required, 'is required')] + }) + }; + getSupplementaryFile(instance: any): FileFormControl { return new FileFormControl({ controlName: SUPPLEMENTARY_FILE, diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts index 62c5ce3f4..28c92f565 100644 --- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts +++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts @@ -1,7 +1,7 @@ import {getTestBed, TestBed} from '@angular/core/testing'; import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing'; import {NgRedux} from '@angular-redux/store'; -import {BasicControlGenerator} from "../basic.control.generator"; +import {BasicControlGenerator, SDN_C_PRE_LOAD} from "../basic.control.generator"; import {AaiService} from "../../../../services/aaiService/aai.service"; import {GenericFormService} from "../../generic-form.service"; import {FormBuilder} from "@angular/forms"; @@ -1062,7 +1062,7 @@ describe('VFModule Control Generator', () => { FormControlNames.LEGACY_REGION, FormControlNames.TENANT_ID, FormControlNames.ROLLBACK_ON_FAILURE, - FormControlNames.SDN_C_PRE_LOAD + SDN_C_PRE_LOAD, ]; expect(controls.length).toEqual(7); @@ -1097,7 +1097,7 @@ describe('VFModule Control Generator', () => { FormControlNames.TENANT_ID, // TENANT_ID must be after LEGACY_REGION FormControlNames.LEGACY_REGION, FormControlNames.ROLLBACK_ON_FAILURE, - FormControlNames.SDN_C_PRE_LOAD + SDN_C_PRE_LOAD, ]; for(let i = 0 ; i < orderedControls.length ; i++) { @@ -1154,7 +1154,7 @@ describe('VFModule Control Generator', () => { FormControlNames.LEGACY_REGION, FormControlNames.TENANT_ID, FormControlNames.ROLLBACK_ON_FAILURE, - FormControlNames.SDN_C_PRE_LOAD + SDN_C_PRE_LOAD, ]; for(let i = 0 ; i < orderedControls.length ; i++) { diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts index 762cb41dd..8919c0419 100644 --- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts +++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts @@ -37,7 +37,6 @@ export enum FormControlNames { LEGACY_REGION = 'legacyRegion', TENANT_ID = 'tenantId', ROLLBACK_ON_FAILURE = 'rollbackOnFailure', - SDN_C_PRE_LOAD = 'sdncPreLoad', } @@ -138,7 +137,7 @@ export class VfModuleControlGenerator { result.push(this._basicControlGenerator.getLegacyRegion(vfModuleInstance)); result.push(this.getTenantControl(serviceId, vfModuleInstance, result)); result.push(this.getRollbackOnFailureControl(vfModuleInstance, result)); - result.push(this.getSDNCControl(vfModuleInstance, result)); + result.push(this._basicControlGenerator.getSDNCControl(vfModuleInstance)); if(this.store.getState().global.flags['FLAG_SUPPLEMENTARY_FILE']) { result = this._basicControlGenerator.concatSupplementaryFile(result, vfModuleInstance); } @@ -271,17 +270,6 @@ export class VfModuleControlGenerator { }) }; - getSDNCControl = (instance: any, controls: FormControlModel[]): CheckboxFormControl => { - return new CheckboxFormControl({ - type: FormControlType.CHECKBOX, - controlName: 'sdncPreLoad', - displayName: 'SDN-C pre-load', - dataTestId: 'sdncPreLoad', - value: instance ? instance.sdncPreLoad : false, - validations: [new ValidatorModel(ValidatorOptions.required, 'is required')] - }) - }; - getRollbackOnFailureControl = (instance: any, controls: FormControlModel[]): DropdownFormControl => { return new DropdownFormControl({ type: FormControlType.DROPDOWN, |