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 | |
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')
37 files changed, 1859 insertions, 40 deletions
diff --git a/openecomp-ui/test-utils/MockRest.js b/openecomp-ui/test-utils/MockRest.js index 927da6030a..c49d53d984 100644 --- a/openecomp-ui/test-utils/MockRest.js +++ b/openecomp-ui/test-utils/MockRest.js @@ -1,34 +1,29 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ +/*! * 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 - * + * + * 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. - * ============LICENSE_END========================================================= + * 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. */ - const queue = { fetch: [], - save: [], - create: [], + put: [], + post: [], destroy: [] }; const initQueue = () => { queue['fetch'] = []; - queue['save'] = []; - queue['create'] = []; + queue['put'] = []; + queue['post'] = []; queue['destroy'] = []; }; @@ -51,20 +46,20 @@ export default { return handleOperation(fetch.shift(), {options, baseUrl}); }, - save(baseUrl, data, options) { - const {save} = queue; - if(!save.length) { - throw new Error(`Save operation was called without proper handler. baseUrl: '${baseUrl}' options: '${options}'`); + put(baseUrl, data, options) { + const {put} = queue; + if(!put.length) { + throw new Error(`put operation was called without proper handler. baseUrl: '${baseUrl}' options: '${options}'`); } - return handleOperation(save.shift(), {data, options, baseUrl}); + return handleOperation(put.shift(), {data, options, baseUrl}); }, - create(baseUrl, data, options) { - const {create} = queue; - if(!create.length) { - throw new Error(`Create operation was called without proper handler. baseUrl: '${baseUrl}' options: '${options}'`); + post(baseUrl, data, options) { + const {post} = queue; + if(!post.length) { + throw new Error(`post operation was called without proper handler. baseUrl: '${baseUrl}' options: '${options}'`); } - return handleOperation(create.shift(), {data, options, baseUrl}); + return handleOperation(post.shift(), {data, options, baseUrl}); }, destroy(baseUrl, options) { diff --git a/openecomp-ui/test-utils/Util.js b/openecomp-ui/test-utils/Util.js index 7146267afe..415736fa60 100644 --- a/openecomp-ui/test-utils/Util.js +++ b/openecomp-ui/test-utils/Util.js @@ -1,26 +1,38 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ +/*! * 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 - * + * + * 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. - * ============LICENSE_END========================================================= + * 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 deepFreeze from 'deep-freeze'; +import times from 'lodash/times'; +import pick from 'lodash/pick'; +import intersection from 'lodash/intersection'; import ReactTestUtils from 'react-addons-test-utils'; +export const buildListFromFactory = (factory, quantity = 3, overrides) => { + let list = []; + times(quantity, () =>{ + list.push(factory.build(overrides)); + }); + return list; +}; + +export const buildFromExistingObject = (factory, obj, overrides = {}, options = {}) => { + const mock = factory.build(); + const sharedProperties = intersection(Object.keys(mock), Object.keys(obj)); + return factory.build({...pick(obj, sharedProperties), ...overrides}, options); +}; + //returned object should be treated as immutable. export const cloneAndSet = (obj, path, value) => { let retVal = {...obj}; @@ -53,3 +65,17 @@ export const findAllRenderedComponentsWithTestId = (tree, testId) => { return ReactTestUtils.findAllInRenderedTree(tree, component => component.props.testId === testId); }; +/** + * Finds all instance of components in the rendered tree that are DOM + * components with the data-test-id + * @return {array} an array of all the matches. + */ +export const scryRenderedDOMComponentsWithTestId = (root, testId) => { + return ReactTestUtils.findAllInRenderedTree(root, function (inst) { + if (ReactTestUtils.isDOMComponent(inst)) { + var compTestId = inst.getAttribute('data-test-id'); + return compTestId === testId; + } + return false; + }); +}; diff --git a/openecomp-ui/test-utils/factories/SubnitErrorMessageFactorie.js b/openecomp-ui/test-utils/factories/SubnitErrorMessageFactorie.js new file mode 100644 index 0000000000..a553d9a9a0 --- /dev/null +++ b/openecomp-ui/test-utils/factories/SubnitErrorMessageFactorie.js @@ -0,0 +1,56 @@ +/*! + * 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 SubmitErrorMessageFactory = new Factory() + .attrs({ + vspErrors: [ + {message: randomstring.generate(5)}, + {message: randomstring.generate(5)}, + ], + licensingDataErrors: [ + {message: randomstring.generate(5)}, + {message: randomstring.generate(5)}, + ], + questionnaireValidationResult: { + validationData: [ + { + entityName: randomstring.generate(5), + errors: ['1212', '232323'] + } + ] + }, + uploadDataErrors: { + eca_oam: [ + { + level: 'ERROR', + message: randomstring.generate(25) + }, + { + level: 'ERROR', + message: randomstring.generate(25) + } + ], + cmaui_env: [ + { + level: 'ERROR', + message: randomstring.generate(25) + } + ] + } + }); diff --git a/openecomp-ui/test-utils/factories/activity-log/ActivityLogFactories.js b/openecomp-ui/test-utils/factories/activity-log/ActivityLogFactories.js new file mode 100644 index 0000000000..8f1ff5d40c --- /dev/null +++ b/openecomp-ui/test-utils/factories/activity-log/ActivityLogFactories.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 IdMixin from 'test-utils/factories/mixins/IdMixin.js'; + +const ActivityLogBaseFactory = new Factory() + .attrs({ timestamp: new Date().getTime(), + type: 'CREATE_NEW', + comment: '', + user: 'cs0008', + status: { success: true, message: ''} + }); + +export const ActivityLogStoreFactory = new Factory() + .extend(ActivityLogBaseFactory) + .extend(IdMixin); diff --git a/openecomp-ui/test-utils/factories/flows/FlowsFactories.js b/openecomp-ui/test-utils/factories/flows/FlowsFactories.js new file mode 100644 index 0000000000..f487ee7404 --- /dev/null +++ b/openecomp-ui/test-utils/factories/flows/FlowsFactories.js @@ -0,0 +1,118 @@ +/*! + * 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 SequenceDiagramFactory from './SequenceDiagramFactory.js'; +import ParticipantFactory from './ParticipantFactory.js'; +import UUID from 'uuid-js'; + +const serviceIDByArtifactType = { + NETWORK_CALL_FLOW: '338d75f0-aec8-4eb4-89c9-8733fcd9bf3b', + WORKFLOW: '338d75f0-aec8-4eb4-89c9-8733fcd9bf3b', + PUPPET: '0280b577-2c7b-426e-b7a2-f0dc16508c37' +}; + +const defaultServiceId = '338d75f0-aec8-4eb4-89c9-8733fcd9bf3b'; + +Factory.define('FlowBaseFactory') + .attrs({ + artifactName: 'zizizi', + artifactType: 'WORKFLOW', + description: 'aslkjdfl asfdasdf', + }); + +Factory.define('FlowBaseWithServiceIdFactory') + .extend('FlowBaseFactory') + .attr( + 'serviceID', ['artifactType'], artifactType => serviceIDByArtifactType[artifactType] || defaultServiceId + ); + +Factory.define('FlowBaseWithUniqueIdFactory') + .extend('FlowBaseFactory') + .attr('uniqueId', ['artifactType', 'artifactName'], (artifactType, artifactName) => `${serviceIDByArtifactType[artifactType] || defaultServiceId}.${artifactName}`); + +Factory.define('FlowBaseFetchAndDeleteFactory') + .extend('FlowBaseWithServiceIdFactory') + .extend('FlowBaseWithUniqueIdFactory') + .attrs({ + participants: [] + }); + +Factory.define('FlowBaseWithEsIdFactory') + .extend('FlowBaseWithUniqueIdFactory') + .attr('esId', ['uniqueId'], uniqueId => uniqueId); + +export const FlowBasicFactory = new Factory() + .extend('FlowBaseFactory').attrs({uniqueId: () => UUID.create(4)}); + +export const FlowCreateFactory = new Factory() + .extend('FlowBaseWithServiceIdFactory'); + +export const FlowPostRequestFactory = new Factory() + .extend('FlowBaseFactory') + .attrs({ + artifactGroupType: 'INFORMATIONAL', + payloadData: 'eyJWRVJTSU9OIjp7Im1ham9yIjoxLCJtaW5vciI6MH0sImRlc2NyaXB0aW9uIjoiYXNsa2pkZmwgYXNmZGFzZGYifQ==' + }) + .attr('artifactLabel', ['artifactName'], name => name); + +Factory.define('FlowPostResponeAndUpdateBaseFactory') + .extend('FlowBaseFactory') + .extend('FlowBaseWithUniqueIdFactory') + .extend('FlowBaseWithEsIdFactory') + .attrs({ + artifactGroupType: 'INFORMATIONAL', + artifactUUID: () => UUID.create(4), + artifactVersion: '1', + creationDate: 1470144601623, + lastUpdateDate: 1470144601623, + mandatory: false, + timeout: 0, + artifactChecksum: 'NjBmYjc4NGM5MWIwNmNkMDhmMThhMDAwYmQxYjBiZTU=' + }) + .attr('artifactLabel', ['artifactName'], name => name) + .attr('artifactDisplayName', ['artifactName'], name => name); + +export const FlowPostResponseFactory = new Factory() + .extend('FlowPostResponeAndUpdateBaseFactory') + .attrs({ + attUidLastUpdater: 'cs0008', + payloadUpdateDate: 1470144602131, + serviceApi: false, + updaterFullName: 'Carlos Santana', + artifactCreator: 'cs0008' + }); + +export const FlowUpdateRequestFactory = new Factory() + .extend('FlowPostResponeAndUpdateBaseFactory') + .extend('FlowBaseFetchAndDeleteFactory') + .extend('FlowBaseWithEsIdFactory') + .attrs({ + heatParameters: [], + participants: ParticipantFactory.buildList(10) + }) + .attr('sequenceDiagramModel', ['participants'], participants => SequenceDiagramFactory.build({}, {participants})); + +export const FlowFetchRequestFactory = new Factory() + .extend('FlowBaseFetchAndDeleteFactory'); + +export const FlowDeleteRequestFactory = new Factory() + .extend('FlowBaseFetchAndDeleteFactory'); + +export const FlowFetchResponseFactory = new Factory() + .extend('FlowBaseFactory') + .attrs({ + base64Contents: 'eyJWRVJTSU9OIjp7Im1ham9yIjoxLCJtaW5vciI6MH0sImRlc2NyaXB0aW9uIjoiYXNsa2pkZmwgYXNmZGFzZGYifQ==' + }); diff --git a/openecomp-ui/test-utils/factories/flows/ParticipantFactory.js b/openecomp-ui/test-utils/factories/flows/ParticipantFactory.js new file mode 100644 index 0000000000..2e74649cb8 --- /dev/null +++ b/openecomp-ui/test-utils/factories/flows/ParticipantFactory.js @@ -0,0 +1,20 @@ +/*! + * 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() + .attr('name', 'participantName') + .sequence('id', index => index.toString()); diff --git a/openecomp-ui/test-utils/factories/flows/SequenceDiagramFactory.js b/openecomp-ui/test-utils/factories/flows/SequenceDiagramFactory.js new file mode 100644 index 0000000000..7662f5b2f2 --- /dev/null +++ b/openecomp-ui/test-utils/factories/flows/SequenceDiagramFactory.js @@ -0,0 +1,50 @@ +/*! + * 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 UUID from 'uuid-js'; + +Factory.define('LifeLineFactory') + .attr('name', 'participantName') + .sequence('id', index => index.toString()) + .sequence('index') + .sequence('x', index => 175 + (index - 1) * 400); + +Factory.define('StepMessageFactory') + .attrs({ + name: '[Unnamed Message]', + type: 'request', + from: '1', + to: '2', + }) + .attr('id', () => UUID.create(4)) + .sequence('index'); + +Factory.define('StepFactory') + .attr('message', () => Factory.build('StepMessageFactory')); + +export default new Factory() + .option('participants', []) + .option('stepsCount', 2) + .attr('diagram', ['participants', 'stepsCount'], (participants, stepsCount) => ({ + metadata: { + 'id': '338d75f0-aec8-4eb4-89c9-8733fcd9bf3b.zizizi', + 'name': 'zizizi', + 'ref': 'BLANK' + }, + lifelines: participants.map(participant => Factory.build('LifeLineFactory', participant)), + steps: Factory.buildList('StepFactory', stepsCount) + }) +); diff --git a/openecomp-ui/test-utils/factories/licenseModel/EntitlementPoolFactories.js b/openecomp-ui/test-utils/factories/licenseModel/EntitlementPoolFactories.js new file mode 100644 index 0000000000..14df58e4c2 --- /dev/null +++ b/openecomp-ui/test-utils/factories/licenseModel/EntitlementPoolFactories.js @@ -0,0 +1,61 @@ +/*! + * 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 {overviewEditorHeaders} from 'sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewConstants.js'; + +Factory.define('EntitlementPoolBaseFactory') + .attrs({ + name: 'EntitlementPoolName', + description: 'description', + entitlementMetric: {'choice': 'User', 'other': ''}, + manufacturerReferenceNumber: '123' + }); + +Factory.define('EntitlementPoolExtendedBaseFactory') + .extend('EntitlementPoolBaseFactory') + .attrs({ + thresholdValue: 75, + thresholdUnits: '%', + increments: 'string', + aggregationFunction: {'choice': 'Average', 'other': ''}, + operationalScope: {'choices': ['Other'], 'other': 'blabla'}, + time: {'choice': 'Hour', 'other': ''} + }); + +export const EntitlementPoolListItemFactory = new Factory() + .extend('EntitlementPoolBaseFactory') + .attrs({ + id: () => Math.floor(Math.random() * (1000 - 1) + 1), + itemType: overviewEditorHeaders.ENTITLEMENT_POOL + }); + +export const EntitlementPoolStoreFactory = new Factory() + .extend('EntitlementPoolExtendedBaseFactory') + .attrs({ + id: () => Math.floor(Math.random() * (1000 - 1) + 1), + referencingFeatureGroups: [] + }); + +export const EntitlementPoolDataListFactory = new Factory() + .extend('EntitlementPoolExtendedBaseFactory') + .attrs({ + id: () => Math.floor(Math.random() * (1000 - 1) + 1), + referencingFeatureGroups: [], + itemType: overviewEditorHeaders.ENTITLEMENT_POOL + }); + +export const EntitlementPoolPostFactory = new Factory() + .extend('EntitlementPoolExtendedBaseFactory'); diff --git a/openecomp-ui/test-utils/factories/licenseModel/FeatureGroupFactories.js b/openecomp-ui/test-utils/factories/licenseModel/FeatureGroupFactories.js new file mode 100644 index 0000000000..42209792b9 --- /dev/null +++ b/openecomp-ui/test-utils/factories/licenseModel/FeatureGroupFactories.js @@ -0,0 +1,82 @@ +/*! + * 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 {overviewEditorHeaders} from 'sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewConstants.js'; +import IdMixin from 'test-utils/factories/mixins/IdMixin.js'; + +Factory.define('FeatureGroupBaseFactory') + .attrs({ + 'name': 'featureGroup', + 'description': 'description' + }); + +Factory.define('FeatureGroupExtendedBaseFactory') + .extend('FeatureGroupBaseFactory') + .attrs({ + 'partNumber': '1212' + }); + +export const FeatureGroupListItemFactory = new Factory() + .extend('FeatureGroupBaseFactory') + .extend(IdMixin) + .attrs({ + children: [], + isCollapsed: true, + itemType: overviewEditorHeaders.FEATURE_GROUP + }); + +export const FeatureGroupDispatchFactory = new Factory() + .extend('FeatureGroupExtendedBaseFactory') + .attrs({ + 'licenseKeyGroupsIds': [], + 'entitlementPoolsIds': [] + }); + +export const FeatureGroupStoreFactory = new Factory() + .extend('FeatureGroupExtendedBaseFactory') + .extend(IdMixin) + .attrs({ + licenseKeyGroupsIds: [], + entitlementPoolsIds: [], + referencingLicenseAgreements: [] + }); + +export const FeatureGroupDataListFactory = new Factory() + .extend('FeatureGroupExtendedBaseFactory') + .extend(IdMixin) + .attrs({ + licenseKeyGroupsIds: [], + entitlementPoolsIds: [], + referencingLicenseAgreements: [], + children: [], + itemType: overviewEditorHeaders.FEATURE_GROUP + }); + +export const FeatureGroupPostFactory = new Factory() + .extend('FeatureGroupExtendedBaseFactory') + .attrs({ + addedLicenseKeyGroupsIds: [], + addedEntitlementPoolsIds: [] + }); + +export const FeatureGroupPutFactory = new Factory() + .extend('FeatureGroupExtendedBaseFactory') + .attrs({ + addedLicenseKeyGroupsIds: [], + addedEntitlementPoolsIds: [], + removedLicenseKeyGroupsIds: [], + removedEntitlementPoolsIds: [] + }); diff --git a/openecomp-ui/test-utils/factories/licenseModel/LicenseAgreementFactories.js b/openecomp-ui/test-utils/factories/licenseModel/LicenseAgreementFactories.js new file mode 100644 index 0000000000..0c91456123 --- /dev/null +++ b/openecomp-ui/test-utils/factories/licenseModel/LicenseAgreementFactories.js @@ -0,0 +1,77 @@ +/*! + * 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 {overviewEditorHeaders} from 'sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewConstants.js'; +import IdMixin from 'test-utils/factories/mixins/IdMixin.js'; + +Factory.define('LicenseAgreementBaseFactory') + .attrs({ + name: 'License Agreement', + description: 'sdsd', + licenseTerm: { + choice: 'Fixed_Term' + } + }); + +Factory.define('LicenseAgreementExtendedBaseFactory') + .extend('LicenseAgreementBaseFactory') + .attrs({ + requirementsAndConstrains: 'req_and_constraints_ADDED_LA' + }); + +export const LicenseAgreementListItemFactory = new Factory() + .extend('LicenseAgreementExtendedBaseFactory') + .extend(IdMixin) + .attrs({ + children: [], + isCollapsed: true, + itemType: overviewEditorHeaders.LICENSE_AGREEMENT + }); + +export const LicenseAgreementDispatchFactory = new Factory() + .extend('LicenseAgreementExtendedBaseFactory') + .attrs({ + featureGroupsIds: [] + }); + +export const LicenseAgreementStoreFactory = new Factory() + .extend('LicenseAgreementExtendedBaseFactory') + .extend(IdMixin) + .attrs({ + featureGroupsIds: [] + }); + +export const LicenseAgreementDataListFactory = new Factory() + .extend('LicenseAgreementExtendedBaseFactory') + .extend(IdMixin) + .attrs({ + featureGroupsIds: [], + children:[], + itemType: overviewEditorHeaders.LICENSE_AGREEMENT + }); + +export const LicenseAgreementPostFactory = new Factory() + .extend('LicenseAgreementExtendedBaseFactory') + .attrs({ + addedFeatureGroupsIds: [] + }); + +export const LicenseAgreementPutFactory = new Factory() + .extend('LicenseAgreementExtendedBaseFactory') + .attrs({ + addedFeatureGroupsIds: [], + removedFeatureGroupsIds: [] + }); diff --git a/openecomp-ui/test-utils/factories/licenseModel/LicenseKeyGroupFactories.js b/openecomp-ui/test-utils/factories/licenseModel/LicenseKeyGroupFactories.js new file mode 100644 index 0000000000..50890dd7ec --- /dev/null +++ b/openecomp-ui/test-utils/factories/licenseModel/LicenseKeyGroupFactories.js @@ -0,0 +1,52 @@ +/*! + * 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 {overviewEditorHeaders} from 'sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewConstants.js'; + +Factory.define('LicenseKeyGroupBaseFactory') + .attrs({ + name: 'License Key Group', + description: 'wewe', + type: 'Unique', + operationalScope: { + choices: ['Data_Center'] + } + }); + +export const LicenseKeyGroupListItemFactory = new Factory() + .extend('LicenseKeyGroupBaseFactory') + .attrs({ + id: () => Math.floor(Math.random() * (1000 - 1) + 1), + itemType: overviewEditorHeaders.LICENSE_KEY_GROUP + }); + +export const LicenseKeyGroupStoreFactory = new Factory() + .extend('LicenseKeyGroupBaseFactory') + .attrs({ + id: () => Math.floor(Math.random() * (1000 - 1) + 1), + referencingFeatureGroups: [] + }); + +export const LicenseKeyGroupDataListFactory = new Factory() + .extend('LicenseKeyGroupBaseFactory') + .attrs({ + id: () => Math.floor(Math.random() * (1000 - 1) + 1), + referencingFeatureGroups: [], + itemType: overviewEditorHeaders.LICENSE_KEY_GROUP + }); + +export const LicenseKeyGroupPostFactory = new Factory() + .extend('LicenseKeyGroupBaseFactory'); diff --git a/openecomp-ui/test-utils/factories/licenseModel/LicenseModelFactories.js b/openecomp-ui/test-utils/factories/licenseModel/LicenseModelFactories.js new file mode 100644 index 0000000000..716eb15559 --- /dev/null +++ b/openecomp-ui/test-utils/factories/licenseModel/LicenseModelFactories.js @@ -0,0 +1,77 @@ +/*! + * 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 { selectedButton } from 'sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewConstants.js'; +import IdMixin from 'test-utils/factories/mixins/IdMixin.js'; +import randomstring from 'randomstring'; +import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js'; + +Factory.define('LicenseModelBaseFactory') + .attrs({ + vendorName: 'vlm1', + description: 'string', + iconRef: 'icon' + }); + +export const LicenseModelCreationFactory = new Factory() + .attrs({ + data: { + vendorName: () => randomstring.generate(), + description: () => randomstring.generate() + } + }); + +export const LicenseModelPostFactory = new Factory() + .extend('LicenseModelBaseFactory'); + +export const LicenseModelDispatchFactory = new Factory() + .extend('LicenseModelBaseFactory'); + +export const LicenseModelStoreFactory = new Factory() + .extend('LicenseModelBaseFactory') + .extend(IdMixin); + + +export const FinalizedLicenseModelFactory = new Factory() + .extend(IdMixin) + .attrs({ + vendorName: randomstring.generate(), + description: randomstring.generate(), + iconRef: 'iconRef_lBpEgzhuiY1', + version: {id: '1.0', label: '1.0'}, + status: 'Final', + viewableVersion: [{id: '1.0', label: '1.0'}], + finalVersions: [{id: '1.0', label: '1.0'}] + }); + +export const LicenseModelOverviewFactory = new Factory() +.attrs({ + licenseModelEditor: { + data: { + ...Factory.attributes('LicenseModelBaseFactory'), + id: () => Math.floor(Math.random() * (1000 - 1) + 1), + ...VersionControllerUtilsFactory.build() + } + }, + entitlementPool: {}, + licenseAgreement: {}, + featureGroup: {}, + licenseKeyGroup: {}, + licenseModelOverview: { + descriptionEditor : { data : { description : undefined}}, + selectedTab: selectedButton.VLM_LIST_VIEW + } +}); diff --git a/openecomp-ui/test-utils/factories/mixins/IdMixin.js b/openecomp-ui/test-utils/factories/mixins/IdMixin.js new file mode 100644 index 0000000000..9fd98a23be --- /dev/null +++ b/openecomp-ui/test-utils/factories/mixins/IdMixin.js @@ -0,0 +1,20 @@ +/*! + * 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 default new Factory() + .attr('id', () => randomstring.generate(33)); diff --git a/openecomp-ui/test-utils/factories/mixins/RandomNameMixin.js b/openecomp-ui/test-utils/factories/mixins/RandomNameMixin.js new file mode 100644 index 0000000000..3d5588c0d2 --- /dev/null +++ b/openecomp-ui/test-utils/factories/mixins/RandomNameMixin.js @@ -0,0 +1,20 @@ +/*! + * 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 default new Factory() + .attr('name', () => randomstring.generate()); diff --git a/openecomp-ui/test-utils/factories/onboard/OnboardFactories.js b/openecomp-ui/test-utils/factories/onboard/OnboardFactories.js new file mode 100644 index 0000000000..3228694ccd --- /dev/null +++ b/openecomp-ui/test-utils/factories/onboard/OnboardFactories.js @@ -0,0 +1,23 @@ +/*! + * 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 {storeCreator} from 'sdc-app/AppStore.js'; + +const store = storeCreator(); +const defaultStore = store.getState(); + +export const OnboardStoreFactory = new Factory() + .attrs(defaultStore.onboard); diff --git a/openecomp-ui/test-utils/factories/onboard/OnboardingCatalogFactories.js b/openecomp-ui/test-utils/factories/onboard/OnboardingCatalogFactories.js new file mode 100644 index 0000000000..ff926acdf5 --- /dev/null +++ b/openecomp-ui/test-utils/factories/onboard/OnboardingCatalogFactories.js @@ -0,0 +1,26 @@ +/*! + * 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 {storeCreator} from 'sdc-app/AppStore.js'; + +const store = storeCreator(); +const defaultStore = store.getState(); + +export const OnboardingCatalogStoreFactory = new Factory() + .attrs(defaultStore.onboard.onboardingCatalog); + +export const defaultStoreFactory = new Factory() + .attrs(defaultStore); 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' : '' + }); + diff --git a/openecomp-ui/test-utils/failedTestReport.js b/openecomp-ui/test-utils/failedTestReport.js new file mode 100644 index 0000000000..9520cc9c99 --- /dev/null +++ b/openecomp-ui/test-utils/failedTestReport.js @@ -0,0 +1,34 @@ +var stdin = process.stdin; +var inputJSON = ''; +var startJSON = false; +stdin.resume(); +stdin.setEncoding('utf8'); + +stdin.on('data', function (chunk) { + if (chunk.startsWith('{')) { + startJSON = true; + } + if (startJSON) { + inputJSON += chunk; + } +}); + +stdin.on('end', function () { + let report = JSON.parse(inputJSON); + if (!report.numFailedTestSuites) { + return; + } else { + console.log('--------------------------------'); + console.log('Failure Summary: \n'); + } + report.testResults.forEach((suite) => { + if(suite.status == 'failed') { + console.log('Suite: ' + suite.name); + suite.assertionResults.forEach((test) => { + if (test.status === 'failed') { + console.log('\tTest: ' + test.title); + } + }); + } + }); +}); diff --git a/openecomp-ui/test-utils/fileMock.js b/openecomp-ui/test-utils/fileMock.js new file mode 100644 index 0000000000..84c1da6fdc --- /dev/null +++ b/openecomp-ui/test-utils/fileMock.js @@ -0,0 +1 @@ +module.exports = 'test-file-stub';
\ No newline at end of file diff --git a/openecomp-ui/test-utils/styleMock.js b/openecomp-ui/test-utils/styleMock.js new file mode 100644 index 0000000000..a099545376 --- /dev/null +++ b/openecomp-ui/test-utils/styleMock.js @@ -0,0 +1 @@ +module.exports = {};
\ No newline at end of file diff --git a/openecomp-ui/test-utils/test-env-setup.js b/openecomp-ui/test-utils/test-env-setup.js new file mode 100644 index 0000000000..a2ed491319 --- /dev/null +++ b/openecomp-ui/test-utils/test-env-setup.js @@ -0,0 +1,16 @@ +var localStorageMock = (function() { + var store = {}; + return { + getItem: function(key) { + return store[key]; + }, + setItem: function(key, value) { + store[key] = value.toString(); + }, + clear: function() { + store = {}; + } + }; +})(); + +Object.defineProperty(window, 'localStorage', { value: localStorageMock });
\ No newline at end of file diff --git a/openecomp-ui/test-utils/test-setup.js b/openecomp-ui/test-utils/test-setup.js new file mode 100644 index 0000000000..ec3ca72fc5 --- /dev/null +++ b/openecomp-ui/test-utils/test-setup.js @@ -0,0 +1,2 @@ +import mockRest from 'test-utils/MockRest.js'; +mockRest.resetQueue(); |