diff options
author | AviZi <avi.ziv@amdocs.com> | 2017-06-09 02:39:56 +0300 |
---|---|---|
committer | AviZi <avi.ziv@amdocs.com> | 2017-06-09 02:39:56 +0300 |
commit | 280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch) | |
tree | 9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-ui/test-utils/factories/softwareProduct | |
parent | fd3821dad11780d33c5373d74c957c442489945e (diff) |
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370
Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-ui/test-utils/factories/softwareProduct')
16 files changed, 1032 insertions, 0 deletions
diff --git a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductAttachmentsFactories.js b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductAttachmentsFactories.js new file mode 100644 index 0000000000..eb010da790 --- /dev/null +++ b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductAttachmentsFactories.js @@ -0,0 +1,106 @@ +/*! + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {Factory} from 'rosie'; +import randomstring from 'randomstring'; + +export const VSPAttachmentsErrorFactory = new Factory() + .attrs({ + level: 'WARNING' + }) + .sequence('message', index => `error no. ${index}`); + +export const VSPHeatFactory = new Factory() + .attrs({ + fileName: () => `${randomstring.generate()}.yaml`, + env: { + fileName: () => `${randomstring.generate()}.env` + }, + errors: Factory.buildList(VSPAttachmentsErrorFactory) + }); + +export const VSPAttachmentTreeNodeFactory = new Factory() + .attrs({ + name: 'HEAT', + type: 'heat' + }); + +export const VSPAttachmentTreeNodeWithChildrenFactory = new Factory() + .extend(VSPAttachmentTreeNodeFactory) + .attrs({ + expanded: true, + children: [] + }); + +export const VSPAttachmentDetailedError = new Factory() + .attrs({ + level: 'WARNING', + errorMessage: 'Resource is not defined as output and thus cannot be Shared. resource id - network_4', + name: () => `${randomstring.generate()}.yaml`, + hasParent: false, + parentName: 'HEAT', + type: 'heat' + }); + +export const HeatSetupModuleBase = new Factory() + .option('name', 0) + .attr('name', ['name'], (name) => { + return name ? randomstring.generate(5) : ''; + }) + .attrs({ + isBase: false, + yaml: () => {return 'yaml_' + randomstring.generate(5) + '.yaml';}, + env: () => {return 'env_' + randomstring.generate(5) + '.env';}, + vol: () => {return 'vol_' + randomstring.generate(5) + '.vol';}, + volEnv: () => {return 'volEnv_' + randomstring.generate(5) + '.env';} + }); + +export const heatSetupManifest = new Factory() + .attrs({ + modules: [ + { + name: 'BASE_sdjflsjldfsd', + isBase: true, + yaml: 'yaml_filename9.yaml', + env: 'env_filename8.env', + vol: 'vol_filename5.vol', + volEnv: 'vol_env_filename1.8.vol', + + }, + { + name: 'MODULE_asdkjfhkajsf', + isBase: false, + yaml: 'yaml_filename.yaml', + env: 'env_filename.env', + vol: 'vol_filename.vol', + volEnv: 'vol_env_filename.vol', + + } + ], + unassigned: [ + 'hot-nimbus-oam-volumes_v1.0.env', + 'hot-nimbus-oam_v1.0.env', + 'hot-nimbus-oam-volumes_v1.1.env', + 'hot-nimbus-oam-volumes_v2.0.env', + 'vol_filename2.vol', + 'hot-nimbus-oam-volumes_v4.0.env', + 'hot-nimbus-oam-volumes_v5.0.env', + 'hot-nimbus-oam_v6.0.env', + 'hot-nimbus-oam-volumes_v7.0.env', + 'vol_filename1.vol' + ], + artifacts: ['hot-nimbus-oam_v3.0.env'], + nested: ['nested-ppd_v1.1.yaml', 'nested-ppd_v1.0.yaml', 'nested-ppd_v8.0.yaml'] + }); diff --git a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsComputeFactory.js b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsComputeFactory.js new file mode 100644 index 0000000000..58e5db7a7d --- /dev/null +++ b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsComputeFactory.js @@ -0,0 +1,35 @@ +/*! + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {Factory} from 'rosie'; + +export default new Factory() + .attrs({ + 'vmSizing':{ + 'numOfCPUs': 3, + 'fileSystemSizeGB': 888 + }, + 'numOfVMs':{ + 'minimum':2 + } + }); + + +export const VSPComponentsComputeDataMapFactory = new Factory() + .attrs({ + 'vmSizing/numOfCPUs' : 3, + 'vmSizing/fileSystemSizeGB': 888, + 'numOfVMs/minimum':2 + }); diff --git a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsFactories.js b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsFactories.js new file mode 100644 index 0000000000..a98249bf14 --- /dev/null +++ b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsFactories.js @@ -0,0 +1,34 @@ +/*! + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {Factory} from 'rosie'; +import randomstring from 'randomstring'; + +export const VSPComponentsFactory = new Factory() + .option('componentName', 'comp') + .option('componentType', 'server') + .attr('displayName', ['componentName', 'componentType'], (componentName, componentType) => `${componentName}_${componentType}`) + .attr('name', ['displayName'], displayName => `com.ecomp.d2.resource.vfc.nodes.heat.${displayName}`) + .attr('id', () => randomstring.generate()) + .attr('description', 'description'); + +export const VSPComponentsGeneralFactory = new Factory() + .attrs({ + hypervisor: { + containerFeatureDescription: 'aaaUpdated', + drivers: 'bbbUpdated', + hypervisor: 'cccUpdated' + } + }); diff --git a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsMonitoringFactories.js b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsMonitoringFactories.js new file mode 100644 index 0000000000..6bfa091fd3 --- /dev/null +++ b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsMonitoringFactories.js @@ -0,0 +1,32 @@ +/*! + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {Factory} from 'rosie'; +import randomstring from 'randomstring'; + +export const VSPComponentsMonitoringRestFactory = new Factory() + .option('snmpTrapFlag', false) + .option('snmpPollFlag', false) + .attr('snmpTrap', ['snmpTrapFlag'], snmpTrapFlag => snmpTrapFlag ? randomstring.generate() : undefined) + .attr('snmpPoll', ['snmpPollFlag'], snmpPollFlag => snmpPollFlag ? randomstring.generate() : undefined); + +export const VSPComponentsMonitoringViewFactory = new Factory() + .extend(VSPComponentsMonitoringRestFactory) + .after(monitoring => { + monitoring['trapFilename'] = monitoring['snmpTrap']; + monitoring['pollFilename'] = monitoring['snmpPoll']; + delete monitoring['snmpTrap']; + delete monitoring['snmpPoll']; + }); diff --git a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsNetworkFactories.js b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsNetworkFactories.js new file mode 100644 index 0000000000..f08d282131 --- /dev/null +++ b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsNetworkFactories.js @@ -0,0 +1,260 @@ +/*! + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {Factory} from 'rosie'; +import randomstring from 'randomstring'; +import IdMixin from 'test-utils/factories/mixins/IdMixin.js'; + +export const VSPComponentsNicFactory = new Factory() + .attrs({ + name: () => randomstring.generate(), + description: () => randomstring.generate(), + networkId: 'network', + }) + .attr('networkName', ['name'], name => `n${name}`); + +export const VSPComponentsNicWithIdFactory = new Factory() + .extend(VSPComponentsNicFactory) + .extend(IdMixin); + +export const VSPComponentsNetworkFactory = new Factory() + .attrs({ + nicEditor: {}, + nicList: [] + }); + +export const VSPComponentsNetworkQDataFactory = new Factory() + .attrs({ + protocols: { + protocolWithHighestTrafficProfile: 'UDP', + protocols: ['UDP'] + }, + ipConfiguration: { + ipv4Required: true + } + }); + +export const VSPComponentsNetworkDataMapFactory = new Factory() + .attrs({ + 'protocols/protocolWithHighestTrafficProfile' : 'UDP', + 'protocols/protocols' : ['UDP'], + 'ipConfiguration/ipv4Required' : true + }); + +export const VSPComponentsNicFactoryGenericFieldInfo = new Factory() + .attrs({ + 'description' : { + isValid: true, + errorText: '', + validations: [] + }, + 'name' : { + isValid: true, + errorText: '', + validations: [] + } + }); + +export const VSPComponentsNicFactoryQGenericFieldInfo = new Factory() + .attrs({ + 'protocols/protocols': { + isValid: true, + errorText: '', + 'enum': [ + { + 'enum': 'TCP', + title: 'TCP' + }, + { + 'enum': 'UDP', + title: 'UDP' + }, + { + 'enum': 'SCTP', + title: 'SCTP' + }, + { + 'enum': 'IPsec', + title: 'IPsec' + } + ], + items: { + type: 'string', + 'enum': [ + '', + 'TCP', + 'UDP', + 'SCTP', + 'IPsec' + ], + 'default': '' + }, + minItems: 1, + validations: [] + }, + 'protocols/protocolWithHighestTrafficProfile': { + isValid: true, + errorText: '', + validations: [] + }, + 'ipConfiguration/ipv4Required': { + isValid: true, + errorText: '', + type: 'boolean', + 'default': true, + validations: [] + }, + 'ipConfiguration/ipv6Required': { + isValid: true, + errorText: '', + type: 'boolean', + 'default': false, + validations: [] + }, + 'network/networkDescription': { + isValid: true, + errorText: '', + type: 'string', + validations: [ + { + type: 'pattern', + data: '[A-Za-z]+' + }, + { + type: 'maxLength', + data: 300 + } + ] + }, + 'sizing/describeQualityOfService': { + isValid: true, + errorText: '', + type: 'string', + validations: [] + }, + 'sizing/inflowTrafficPerSecond/packets/peak': { + isValid: true, + errorText: '', + type: 'number', + validations: [] + }, + 'sizing/inflowTrafficPerSecond/packets/avg': { + isValid: true, + errorText: '', + type: 'number', + validations: [] + }, + 'sizing/inflowTrafficPerSecond/bytes/peak': { + isValid: true, + errorText: '', + type: 'number', + validations: [] + }, + 'sizing/inflowTrafficPerSecond/bytes/avg': { + isValid: true, + errorText: '', + type: 'number', + validations: [] + }, + 'sizing/outflowTrafficPerSecond/packets/peak': { + isValid: true, + errorText: '', + type: 'number', + validations: [] + }, + 'sizing/outflowTrafficPerSecond/packets/avg': { + isValid: true, + errorText: '', + type: 'number', + validations: [] + }, + 'sizing/outflowTrafficPerSecond/bytes/peak': { + isValid: true, + errorText: '', + type: 'number', + validations: [] + }, + 'sizing/outflowTrafficPerSecond/bytes/avg': { + isValid: true, + errorText: '', + type: 'number', + validations: [] + }, + 'sizing/flowLength/packets/peak': { + isValid: true, + errorText: '', + type: 'number', + validations: [] + }, + 'sizing/flowLength/packets/avg': { + isValid: true, + errorText: '', + type: 'number', + validations: [] + }, + 'sizing/flowLength/bytes/peak': { + isValid: true, + errorText: '', + type: 'number', + validations: [] + }, + 'sizing/flowLength/bytes/avg': { + isValid: true, + errorText: '', + type: 'number', + validations: [] + }, + 'sizing/acceptableJitter/mean': { + isValid: true, + errorText: '', + type: 'number', + validations: [] + }, + 'sizing/acceptableJitter/max': { + isValid: true, + errorText: '', + type: 'number', + validations: [] + }, + 'sizing/acceptableJitter/variable': { + isValid: true, + errorText: '', + type: 'number', + validations: [] + }, + 'sizing/acceptablePacketLoss': { + isValid: true, + errorText: '', + type: 'number', + validations: [ + { + type: 'minimum', + data: 0 + }, + { + type: 'maximum', + data: 100 + } + ] + } + }); + +export const VSPComponentsVersionControllerFactory = new Factory() + .attrs({ + version: { id: '1.1', label: '1.1'}, + viewableVersions: [{id: '1.0', label: '1.0'}, {id: '1.1', label: '1.1'}, {id: '1.2', label: '1.2'}], + status: 'locked', + isCheckedOut: true + }); diff --git a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsStorageFactory.js b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsStorageFactory.js new file mode 100644 index 0000000000..2691da2288 --- /dev/null +++ b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsStorageFactory.js @@ -0,0 +1,34 @@ +/*! + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {Factory} from 'rosie'; + +export default new Factory() + .attrs({ + 'backup':{ + 'backupType':'OnSite', + 'backupSolution':76333 + }, + 'snapshotBackup':{ + 'snapshotFrequency':2 + } + }); + +export const VSPComponentsStorageDataMapFactory = new Factory() + .attrs({ + 'backup/backupType' : 'OnSite', + 'backup/backupSolution' : 76333, + 'snapshotBackup/snapshotFrequency' : 2 + }); diff --git a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductCreationFactories.js b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductCreationFactories.js new file mode 100644 index 0000000000..d8ae58d105 --- /dev/null +++ b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductCreationFactories.js @@ -0,0 +1,33 @@ +/*! + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {Factory} from 'rosie'; +import {CategoryWithSubFactory} from './VSPCategoriesFactory'; +import {FinalizedLicenseModelFactory} from '../licenseModel/LicenseModelFactories'; +import randomstring from 'randomstring'; + +export const SoftwareProductCreationFactory = new Factory() + .attrs({ + name: () => randomstring.generate(), + description: () => randomstring.generate(), + vendorId: () => FinalizedLicenseModelFactory.build().id, + subCategory: () => CategoryWithSubFactory.build({}, {quantity: 3}).subcategories[0], + }); + +export const SoftwareProductCreationFactoryWithSelectedVendor = new Factory() + .extend(SoftwareProductCreationFactory) + .attrs({ + selectedVendorId: FinalizedLicenseModelFactory.build().id, + }); diff --git a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductDependenciesFactories.js b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductDependenciesFactories.js new file mode 100644 index 0000000000..6521c58a35 --- /dev/null +++ b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductDependenciesFactories.js @@ -0,0 +1,34 @@ +/*! + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +import { Factory } from 'rosie'; +import IdMixin from 'test-utils/factories/mixins/IdMixin.js'; +import randomstring from 'randomstring'; +import {relationTypes} from 'sdc-app/onboarding/softwareProduct/dependencies/SoftwareProductDependenciesConstants.js'; + +const SoftwareProductDependenciesBaseFactory = new Factory() + .attrs({ sourceId: () => randomstring.generate(), + targetId: () => randomstring.generate(), + relationType: relationTypes.DEPENDS_ON + }); + +export const SoftwareProductDependenciesResponseFactory = new Factory() + .extend(SoftwareProductDependenciesBaseFactory); + +export const SoftwareProductDependenciesStoreFactory = new Factory() +.extend(SoftwareProductDependenciesBaseFactory) +.extend(IdMixin) +.attrs({ hasCycle: false }); diff --git a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js new file mode 100644 index 0000000000..5c5936155e --- /dev/null +++ b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js @@ -0,0 +1,63 @@ +/*! + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {Factory} from 'rosie'; +import IdMixin from 'test-utils/factories/mixins/IdMixin.js'; +import randomstring from 'randomstring'; +import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js'; + +Factory.define('VSPBaseFactory') + .attrs( + { + name: 'VSP2', + description: 'sdsd', + category: 'resourceNewCategory.application l4+', + subCategory: 'resourceNewCategory.application l4+.media servers', + vendorName: 'V1 ', + vendorId: () => randomstring.generate(33), + licensingVersion: {id: '1', label: '1'}, + licensingData: {}, + icon: 'icon', + version: {id: '1', label: '1'} + } +); + +Factory.define('LicensingDataMixin') + .attrs({ + licensingData: { + licenseAgreement: () => randomstring.generate(33), + featureGroups: [ + () => randomstring.generate(33) + ] + } + }); + +export const VSPEditorFactory = new Factory() + .extend('VSPBaseFactory') + .extend(VersionControllerUtilsFactory) + .extend(IdMixin); + +export const VSPEditorPostFactory = new Factory() + .extend('VSPBaseFactory'); + +export const VSPEditorFactoryWithLicensingData = new Factory() + .extend('VSPBaseFactory') + .extend(VersionControllerUtilsFactory) + .extend('LicensingDataMixin') + .extend(IdMixin); + +export const VSPEditorPostFactoryWithLicensingData = new Factory() + .extend('VSPBaseFactory') + .extend('LicensingDataMixin'); diff --git a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductFactory.js b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductFactory.js new file mode 100644 index 0000000000..86a8276beb --- /dev/null +++ b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductFactory.js @@ -0,0 +1,47 @@ +/*! + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {Factory} from 'rosie'; + +export const SoftwareProductFactory = new Factory() + .attrs({ + softwareProductAttachments: {}, + softwareProductCreation: {}, + softwareProductEditor: {}, + softwareProductProcesses: { + processesList: [], + processesEditor: {}, + processToDelete: false + }, + softwareProductNetworks: { + networksList: [] + }, + softwareProductComponents: { + componentsList: [], + componentEditor: {}, + componentProcesses: { + processesList: [], + processesEditor: {}, + processToDelete: false + }, + network: { + nicList: [], + nicEditor: {} + } + }, + monitoring: {}, + softwareProductCategories: [], + softwareProductQuestionnaire: {} + }); diff --git a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductNetworkFactory.js b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductNetworkFactory.js new file mode 100644 index 0000000000..08b4daa973 --- /dev/null +++ b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductNetworkFactory.js @@ -0,0 +1,25 @@ +/*! + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {Factory} from 'rosie'; +import IdMixin from 'test-utils/factories/mixins/IdMixin'; +import RandomNameMixin from 'test-utils/factories/mixins/RandomNameMixin'; + +export default new Factory() + .extend(RandomNameMixin) + .extend(IdMixin) + .attrs({ + dhcp: true + }); diff --git a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductProcessFactories.js b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductProcessFactories.js new file mode 100644 index 0000000000..26ac49dbe5 --- /dev/null +++ b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductProcessFactories.js @@ -0,0 +1,73 @@ +/*! + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {Factory} from 'rosie'; +import IdMixin from 'test-utils/factories/mixins/IdMixin.js'; + +Factory.define('VSPProcessBaseFactory') + .attrs({ + name: 'Pr1', + description: 'string', + type: '' + }); + +Factory.define('VSPProcessBaseFactoryWithType') + .attrs({ + name: 'Pr1', + description: 'string', + type: 'Other' + }); + + +Factory.define('VSPProcessBaseFactoryWithNullType') + .attrs({ + name: 'Pr1', + description: 'string', + type: null + }); + +Factory.define('FormDataMixin') + .option('artifactName', 'artifact') + .attr('formData', ['artifactName'], artifactName => ({name: artifactName})); + + +export const VSPProcessPostFactory = new Factory() + .extend('VSPProcessBaseFactory'); + +export const VSPProcessStoreFactory = new Factory() + .extend('VSPProcessBaseFactoryWithNullType') + .extend(IdMixin); + + +export const VSPProcessPostFactoryWithType = new Factory() + .extend('VSPProcessBaseFactoryWithType'); + +export const VSPProcessStoreFactoryWithType = new Factory() + .extend('VSPProcessBaseFactoryWithType') + .extend(IdMixin); + + +export const VSPProcessPostWithFormDataFactory = new Factory() + .extend(VSPProcessPostFactoryWithType) + .extend('FormDataMixin'); + +export const VSPProcessStoreWithFormDataFactory = new Factory() + .extend(VSPProcessStoreFactoryWithType) + .extend('FormDataMixin'); + + +export const VSPProcessStoreWithArtifactNameFactory = new Factory() + .extend(VSPProcessStoreFactoryWithType) + .attr('artifactName', 'artifact'); diff --git a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductQSchemaFactory.js b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductQSchemaFactory.js new file mode 100644 index 0000000000..bb640cfd89 --- /dev/null +++ b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductQSchemaFactory.js @@ -0,0 +1,131 @@ +/*! + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {Factory} from 'rosie'; + +const parsePropertiesForSchema = (obj) => { + let schemaProperties = {}; + + Object.keys(obj).forEach(prop => { + let type = typeof obj[prop]; + if (type === undefined){throw new Error('Schema property cannot be undefined');} + if (type === 'object'){ + if (Array.isArray(obj[prop])) { + schemaProperties[prop] = {type: 'array'}; + } else if (Object.is(obj[prop], null)){ + throw new Error('Schema property cannot be null'); + } else { + schemaProperties[prop] = {properties: parsePropertiesForSchema(obj[prop]), type: 'object'}; + } + } else { + schemaProperties[prop] = {type}; + } + }); + + return schemaProperties; +}; + +export default new Factory() + .after(schema => { + const propertiesForSchema = parsePropertiesForSchema(schema); + for (let attribute in schema) { + delete schema[attribute]; + } + schema.$schema = 'http://json-schema.org/draft-04/schema#'; + schema.type = 'object'; + schema.properties = propertiesForSchema; + }); + + +export const SchemaGenericFieldInfoFactory = new Factory() + .attrs({ + 'general/affinityData': { + 'hasErrors': false, + 'errorText': '', + 'type': 'string', + 'enum': [{'enum': 'Affinity', 'title': 'Affinity'}, { + 'enum': 'Anti Affinity', + 'title': 'Anti Affinity' + }, {'enum': 'None', 'title': 'None'}], + 'default': '', + 'validations': [] + }, + 'general/availability/useAvailabilityZonesForHighAvailability': { + 'hasErrors': false, + 'errorText': '', + 'type': 'boolean', + 'default': false, + 'validations': [] + }, + 'general/regionsData/multiRegion': { + 'hasErrors': false, + 'errorText': '', + 'type': 'boolean', + 'default': false, + 'validations': [] + }, + 'general/regionsData/regions': { + 'hasErrors': false, + 'errorText': '', + 'enum': [{'enum': 'Alphareta', 'title': 'Alphareta'}, { + 'enum': 'Birmingham', + 'title': 'Birmingham' + }, {'enum': 'Dallas', 'title': 'Dallas'}, { + 'enum': 'Fairfield CA', + 'title': 'Fairfield CA' + }, {'enum': 'Hayward CA', 'title': 'Hayward CA'}, {'enum': 'Lisle', 'title': 'Lisle'}, { + 'enum': 'Mission', + 'title': 'Mission' + }, {'enum': 'San Diego', 'title': 'San Diego'}, {'enum': 'Secaucus', 'title': 'Secaucus'}], + 'items': { + 'type': 'string', + 'enum': ['', 'Alphareta', 'Birmingham', 'Dallas', 'Fairfield CA', 'Hayward CA', 'Lisle', 'Mission', 'San Diego', 'Secaucus'], + 'default': '' + }, + 'validations': [] + }, + 'general/storageDataReplication/storageReplicationAcrossRegion': { + 'hasErrors': false, + 'errorText': '', + 'type': 'boolean', + 'default': false, + 'validations': [] + }, + 'general/storageDataReplication/storageReplicationSize': { + 'hasErrors': false, + 'errorText': '', + 'type': 'number', + 'exclusiveMaximum': true, + 'validations': [{'type': 'maximumExclusive', 'data': 100}] + }, + 'general/storageDataReplication/storageReplicationFrequency': { + 'hasErrors': false, + 'errorText': '', + 'type': 'number', + 'validations': [{'type': 'minimum', 'data': 5}] + }, + 'general/storageDataReplication/storageReplicationSource': { + 'hasErrors': false, + 'errorText': '', + 'type': 'string', + 'validations': [{'type': 'maxLength', 'data': 300}] + }, + 'general/storageDataReplication/storageReplicationDestination': { + 'hasErrors': false, + 'errorText': '', + 'type': 'string', + 'validations': [{'type': 'maxLength', 'data': 300}] + } + }); diff --git a/openecomp-ui/test-utils/factories/softwareProduct/VSPCategoriesFactory.js b/openecomp-ui/test-utils/factories/softwareProduct/VSPCategoriesFactory.js new file mode 100644 index 0000000000..eabd02df7b --- /dev/null +++ b/openecomp-ui/test-utils/factories/softwareProduct/VSPCategoriesFactory.js @@ -0,0 +1,40 @@ +/*! + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {Factory} from 'rosie'; +import randomstring from 'randomstring'; + +Factory.define('baseCategory') + .attrs({ + name: () => randomstring.generate(), + normalizedName: () => randomstring.generate(), + uniqueId: () => randomstring.generate() + }); + +export const CategoryFactory = new Factory() + .extend('baseCategory'); + +export const CategoryWithSubFactory = new Factory() + .extend('baseCategory') + .option('quantity', 0) + .attr('subcategories', ['quantity'], (quantity) => { + var subs = []; + for (let i = 1; i <= quantity; i++) { + subs.push({ + uniqueId: randomstring.generate() + }); + } + return subs; + }); diff --git a/openecomp-ui/test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js b/openecomp-ui/test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js new file mode 100644 index 0000000000..8c9640714d --- /dev/null +++ b/openecomp-ui/test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js @@ -0,0 +1,30 @@ +/*! + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {Factory} from 'rosie'; +import {statusEnum} from 'nfvo-components/panel/versionController/VersionControllerConstants.js'; + +export default new Factory() + .attrs({ + version: { id: '1.2', label: '1.2'}, + viewableVersions: [{id: '1.0', label: '1.0'}, {id: '1.1', label: '1.1'}, {id: '1.2', label: '1.2'}], + status: statusEnum.CHECK_OUT_STATUS, + lockingUser: 'current' + }).after(function(inst) { + if (inst.status !== statusEnum.CHECK_OUT_STATUS) { + delete inst.lockingUser; + } + }); + diff --git a/openecomp-ui/test-utils/factories/softwareProduct/VspQdataFactory.js b/openecomp-ui/test-utils/factories/softwareProduct/VspQdataFactory.js new file mode 100644 index 0000000000..66c08dac49 --- /dev/null +++ b/openecomp-ui/test-utils/factories/softwareProduct/VspQdataFactory.js @@ -0,0 +1,55 @@ +/*! + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +import {Factory} from 'rosie'; + +export default new Factory() + .attrs({ + 'general': { + 'regionsData': { + 'regions': '', + 'multiRegion': '' + }, + 'storageDataReplication': { + 'storageReplicationAcrossRegion': '', + 'storageReplicationSize': '', + 'storageReplicationFrequency': '', + 'storageReplicationSource': '', + 'storageReplicationDestination': '' + }, + 'availability': { + 'useAvailabilityZonesForHighAvailability': '' + }, + 'affinityData': { + 'affinityGrouping': '', + 'antiAffinityGrouping': '' + } + } + }); + +export const VspDataMapFactory = new Factory() + .attrs({ + 'general/regionsData/regions': '', + 'general/regionsData/multiRegion': '', + 'general/storageDataReplication/storageReplicationAcrossRegion' : '', + 'general/storageDataReplication/storageReplicationSize' : '', + 'general/storageDataReplication/storageReplicationFrequency' : '', + 'general/storageDataReplication/storageReplicationSource' : '', + 'general/storageDataReplication/storageReplicationDestination' : '', + 'general/availability/useAvailabilityZonesForHighAvailability' : '', + 'general/affinityData/affinityGrouping' : '', + 'general/affinityData/antiAffinityGrouping' : '' + }); + |