aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/test-utils
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2017-12-20 14:30:43 +0200
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-21 11:12:33 +0000
commit8e9c0653dd6c6862123c9609ae34e1206d86456e (patch)
tree5eeef00ec0677133baa439ca8d7ffd7aca4804b6 /openecomp-ui/test-utils
parent785ebcc95de3e064e843bec04ba7a209d854fc7c (diff)
Add collaboration feature
Issue-ID: SDC-767 Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795 Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-ui/test-utils')
-rw-r--r--openecomp-ui/test-utils/MockRest.js14
-rw-r--r--openecomp-ui/test-utils/ShowMore.js10
-rw-r--r--openecomp-ui/test-utils/factories/common/CurrentScreenFactory.js100
-rw-r--r--openecomp-ui/test-utils/factories/common/VersionFactory.js31
-rw-r--r--openecomp-ui/test-utils/factories/licenseModel/LicenseModelFactories.js18
-rw-r--r--openecomp-ui/test-utils/factories/revisions/RevisionsFactories.js30
-rw-r--r--openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsMonitoringFactories.js9
-rw-r--r--openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductDependenciesFactories.js4
-rw-r--r--openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js5
-rw-r--r--openecomp-ui/test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js10
-rw-r--r--openecomp-ui/test-utils/factories/users/UsersFactories.js35
-rw-r--r--openecomp-ui/test-utils/factories/versionsPage/VersionsPageCreationFactories.js38
-rw-r--r--openecomp-ui/test-utils/factories/versionsPage/VersionsPageFactories.js27
-rw-r--r--openecomp-ui/test-utils/failedTestReport.js2
14 files changed, 300 insertions, 33 deletions
diff --git a/openecomp-ui/test-utils/MockRest.js b/openecomp-ui/test-utils/MockRest.js
index c49d53d984..6cc676a2bb 100644
--- a/openecomp-ui/test-utils/MockRest.js
+++ b/openecomp-ui/test-utils/MockRest.js
@@ -76,5 +76,19 @@ export default {
resetQueue() {
initQueue();
+ },
+
+ checkEmptyQueue() {
+ let isEmpty = true;
+ let message = 'Check following calls: ';
+ for (let operationType in queue) {
+ if (queue[operationType].length > 0) {
+ isEmpty = false;
+ message += operationType;
+ }
+ }
+ if (!isEmpty) {
+ throw new Error('Queue is not empty, ' + message);
+ }
}
};
diff --git a/openecomp-ui/test-utils/ShowMore.js b/openecomp-ui/test-utils/ShowMore.js
new file mode 100644
index 0000000000..a01ae6a5c9
--- /dev/null
+++ b/openecomp-ui/test-utils/ShowMore.js
@@ -0,0 +1,10 @@
+import React from 'react';
+
+const ShowMore = ({children}) => {
+ if (children.length > 50) {
+ return (<div>Show Message With More Mock</div>);
+ } else {
+ return (<div>Show Message Mock</div>);
+ }
+};
+export default ShowMore; \ No newline at end of file
diff --git a/openecomp-ui/test-utils/factories/common/CurrentScreenFactory.js b/openecomp-ui/test-utils/factories/common/CurrentScreenFactory.js
new file mode 100644
index 0000000000..8301a277cf
--- /dev/null
+++ b/openecomp-ui/test-utils/factories/common/CurrentScreenFactory.js
@@ -0,0 +1,100 @@
+/*!
+ * 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 VersionFactory from './VersionFactory.js';
+
+export const InitializedItemPermissionFactory = new Factory()
+ .attrs({
+ 'isCertified': false,
+ 'inMerge': false,
+ 'isCollaborator': true
+ });
+
+export const ItemPermissionFactory = new Factory()
+ .extend(InitializedItemPermissionFactory)
+ .attrs({
+ 'isDirty': false,
+ 'isOutOfSync': false,
+ 'isUpToDate': true
+ });
+
+
+export const CurrentScreenPropsFactory = new Factory()
+ .option('versionId', () => randomstring.generate())
+ .option('versionBaseId', () => randomstring.generate())
+ .attrs({
+ softwareProductId: () => randomstring.generate(),
+ licenseModelId: () => randomstring.generate(),
+ isReadOnlyMode: false
+ })
+ .attr('version', [
+ 'versionId', 'versionBaseId'
+ ], (id, baseId) =>
+ VersionFactory.build({id, baseId})
+ );
+
+
+Factory.define('InitializedCurrentScreenFactory')
+ .option('isCertified', false)
+ .option('inMerge', false)
+ .option('isCollaborator', true)
+ .option('isReadOnlyMode', ['isCertified', 'inMerge', 'isCollaborator'], (isCertified, inMerge, isCollaborator) =>
+ isCertified || inMerge || !isCollaborator
+ )
+ .attr('itemPermission', ['isCertified', 'inMerge', 'isCollaborator'], (isCertified, inMerge, isCollaborator) =>
+ InitializedItemPermissionFactory.build({isCollaborator, isCertified, inMerge})
+ )
+ .attr('props', ['isReadOnlyMode'], (isReadOnlyMode) => {
+ return {isReadOnlyMode};
+ });
+export const InitializedCurrentScreenFactory = new Factory().extend('InitializedCurrentScreenFactory');
+
+
+Factory.define('CurrentScreenFactory')
+ .extend('InitializedCurrentScreenFactory')
+ .option('isDirty', false)
+ .option('isOutOfSync', false)
+ .option('isUpToDate', true)
+ .option('version', ['isCertified'], (isCertified) => VersionFactory.build({isCertified}))
+ .attr('itemPermission', [
+ 'isCertified', 'inMerge', 'isCollaborator', 'isDirty', 'isOutOfSync', 'isUpToDate'
+ ], (isCertified, inMerge, isCollaborator, isDirty, isOutOfSync, isUpToDate) =>
+ ItemPermissionFactory.build({isCollaborator, isCertified, inMerge, isDirty, isOutOfSync, isUpToDate})
+ )
+ .attr('props', ['isReadOnlyMode', 'version'], (isReadOnlyMode, version) => {
+ return {isReadOnlyMode, version};
+ });
+export default new Factory().extend('CurrentScreenFactory');
+
+
+export const CurrentScreenFactoryWithProps = new Factory()
+ .extend('CurrentScreenFactory')
+ .option('versionId')
+ .option('versionBaseId')
+ .option('version')
+ .attr('props', [
+ 'isReadOnlyMode', 'versionId', 'versionBaseId', 'version'
+ ], (isReadOnlyMode, id, baseId, version) => {
+ let attrs = {isReadOnlyMode};
+ let options = {};
+
+ if (version !== undefined) { attrs['version'] = version; }
+ if (id !== undefined) { options['versionId'] = id; }
+ if (baseId !== undefined) { options['versionBaseId'] = baseId; }
+
+ return CurrentScreenPropsFactory.build(attrs, options);
+ });
diff --git a/openecomp-ui/test-utils/factories/common/VersionFactory.js b/openecomp-ui/test-utils/factories/common/VersionFactory.js
new file mode 100644
index 0000000000..66db6d6075
--- /dev/null
+++ b/openecomp-ui/test-utils/factories/common/VersionFactory.js
@@ -0,0 +1,31 @@
+/*!
+ * 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 '../mixins/IdMixin.js';
+
+export default new Factory()
+ .extend(IdMixin)
+ .option('isCertified', false)
+ .attrs({
+ baseId: () => randomstring.generate(),
+ description: () => randomstring.generate(),
+ name: () => randomstring.generate(),
+ creationTime: () => new Date().getTime(),
+ modificationTime: () => new Date().getTime(),
+ additionalInfo: () => { return {OptionalCreationMethods: ['major', 'minor']}; }
+ })
+ .attr('status', ['isCertified'], (isCertified) => {return isCertified ? 'Certified' : 'Draft'; });
diff --git a/openecomp-ui/test-utils/factories/licenseModel/LicenseModelFactories.js b/openecomp-ui/test-utils/factories/licenseModel/LicenseModelFactories.js
index 716eb15559..7cda105ff7 100644
--- a/openecomp-ui/test-utils/factories/licenseModel/LicenseModelFactories.js
+++ b/openecomp-ui/test-utils/factories/licenseModel/LicenseModelFactories.js
@@ -17,7 +17,6 @@ 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({
@@ -29,7 +28,7 @@ Factory.define('LicenseModelBaseFactory')
export const LicenseModelCreationFactory = new Factory()
.attrs({
data: {
- vendorName: () => randomstring.generate(),
+ name: () => randomstring.generate(),
description: () => randomstring.generate()
}
});
@@ -48,13 +47,8 @@ export const LicenseModelStoreFactory = new Factory()
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'}]
+ name: randomstring.generate(),
+ description: randomstring.generate()
});
export const LicenseModelOverviewFactory = new Factory()
@@ -62,8 +56,10 @@ export const LicenseModelOverviewFactory = new Factory()
licenseModelEditor: {
data: {
...Factory.attributes('LicenseModelBaseFactory'),
- id: () => Math.floor(Math.random() * (1000 - 1) + 1),
- ...VersionControllerUtilsFactory.build()
+ id: () => Math.floor(Math.random() * 1000 + 1),
+ version: {
+ id: Math.floor(Math.random() * 1000 + 1)
+ }
}
},
entitlementPool: {},
diff --git a/openecomp-ui/test-utils/factories/revisions/RevisionsFactories.js b/openecomp-ui/test-utils/factories/revisions/RevisionsFactories.js
new file mode 100644
index 0000000000..57c5e70e68
--- /dev/null
+++ b/openecomp-ui/test-utils/factories/revisions/RevisionsFactories.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 randomstring from 'randomstring';
+import IdMixin from 'test-utils/factories/mixins/IdMixin.js';
+
+
+export const RevisionsPagePropsFactory = new Factory()
+ .sequence('user')
+ .attr('message', 'message')
+ .attr('date', new Date().getTime())
+ .extend(IdMixin).after(function(revisions) {
+ let longMessage = revisions.user % 2;
+ revisions.user = 'Carlos Santana';
+ revisions.message = (longMessage) ? randomstring.generate(60) : randomstring.generate(10);
+ });
diff --git a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsMonitoringFactories.js b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsMonitoringFactories.js
index 550e1a6d6c..8cb2221bea 100644
--- a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsMonitoringFactories.js
+++ b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductComponentsMonitoringFactories.js
@@ -26,13 +26,10 @@ export const VSPComponentsMonitoringRestFactory = new Factory()
.option('createPoll', false)
.option('createVes', false)
- .attr(trap, ['createTrap'], (createTrap) => {return (createTrap) ? randomstring.generate() : undefined})
- .attr(poll, ['createPoll'], (createPoll) => {return (createPoll) ? randomstring.generate() : undefined})
- .attr(ves, ['createVes'], (createVes) => {return (createVes) ? randomstring.generate() : undefined});
+ .attr(trap, ['createTrap'], (createTrap) => createTrap ? randomstring.generate() : undefined)
+ .attr(poll, ['createPoll'], (createPoll) => createPoll ? randomstring.generate() : undefined)
+ .attr(ves, ['createVes'], (createVes) => createVes ? randomstring.generate() : undefined);
export const VSPComponentsMonitoringViewFactory = new Factory()
.extend(VSPComponentsMonitoringRestFactory);
-// .after(monitoring => {
-
-// });
diff --git a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductDependenciesFactories.js b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductDependenciesFactories.js
index 6521c58a35..fab3f5f79e 100644
--- a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductDependenciesFactories.js
+++ b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductDependenciesFactories.js
@@ -23,10 +23,10 @@ const SoftwareProductDependenciesBaseFactory = new Factory()
.attrs({ sourceId: () => randomstring.generate(),
targetId: () => randomstring.generate(),
relationType: relationTypes.DEPENDS_ON
- });
+ }).extend(IdMixin);
export const SoftwareProductDependenciesResponseFactory = new Factory()
- .extend(SoftwareProductDependenciesBaseFactory);
+ .extend(SoftwareProductDependenciesBaseFactory).extend(IdMixin);
export const SoftwareProductDependenciesStoreFactory = new Factory()
.extend(SoftwareProductDependenciesBaseFactory)
diff --git a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js
index 5c5936155e..a820b70600 100644
--- a/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js
+++ b/openecomp-ui/test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js
@@ -16,7 +16,6 @@
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(
@@ -30,7 +29,7 @@ Factory.define('VSPBaseFactory')
licensingVersion: {id: '1', label: '1'},
licensingData: {},
icon: 'icon',
- version: {id: '1', label: '1'}
+ version: {id: '123'}
}
);
@@ -46,7 +45,6 @@ Factory.define('LicensingDataMixin')
export const VSPEditorFactory = new Factory()
.extend('VSPBaseFactory')
- .extend(VersionControllerUtilsFactory)
.extend(IdMixin);
export const VSPEditorPostFactory = new Factory()
@@ -54,7 +52,6 @@ export const VSPEditorPostFactory = new Factory()
export const VSPEditorFactoryWithLicensingData = new Factory()
.extend('VSPBaseFactory')
- .extend(VersionControllerUtilsFactory)
.extend('LicensingDataMixin')
.extend(IdMixin);
diff --git a/openecomp-ui/test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js b/openecomp-ui/test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js
index 8c9640714d..ba3946be48 100644
--- a/openecomp-ui/test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js
+++ b/openecomp-ui/test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js
@@ -14,17 +14,9 @@
* 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;
- }
+ viewableVersions: [{id: '1.0', label: '1.0'}, {id: '1.1', label: '1.1'}, {id: '1.2', label: '1.2'}]
});
-
diff --git a/openecomp-ui/test-utils/factories/users/UsersFactories.js b/openecomp-ui/test-utils/factories/users/UsersFactories.js
new file mode 100644
index 0000000000..cbafbe0747
--- /dev/null
+++ b/openecomp-ui/test-utils/factories/users/UsersFactories.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';
+import randomstring from 'randomstring';
+
+Factory.define('UserFactory')
+ .attrs(
+ {
+ firstName: () => randomstring.generate(5),
+ lastName: () => randomstring.generate(6),
+ userId: () => randomstring.generate(11),
+ email: randomstring.generate(5) + '@' + randomstring.generate(6) + '.com',
+ role: 'OPS',
+ lastLoginTime: 0,
+ status: 'ACTIVE',
+ fullName: () => randomstring.generate(5) + ' ' + randomstring.generate(6),
+ }
+);
+
+
+export const UserFactory = new Factory()
+ .extend('UserFactory'); \ No newline at end of file
diff --git a/openecomp-ui/test-utils/factories/versionsPage/VersionsPageCreationFactories.js b/openecomp-ui/test-utils/factories/versionsPage/VersionsPageCreationFactories.js
new file mode 100644
index 0000000000..c57ac87431
--- /dev/null
+++ b/openecomp-ui/test-utils/factories/versionsPage/VersionsPageCreationFactories.js
@@ -0,0 +1,38 @@
+/*!
+ * 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 VersionsPageCreationFactory = new Factory()
+ .attrs({
+ name: () => randomstring.generate(),
+ description: () => randomstring.generate(),
+ creationMethod: () => ['major', 'minor'][Math.round(Math.random())]
+ });
+
+export const VersionsPageCreationFieldInfoFactory = new Factory()
+ .attrs({
+ description: () => ({
+ isValid: true,
+ errorText: '',
+ validations: [{type: 'required', data: true}, {type: 'maxLength', data: 1000}]
+ }),
+ creationMethod: () => ({
+ isValid: true,
+ errorText: '',
+ validations: [{type: 'required', data: true}]
+ })
+ });
diff --git a/openecomp-ui/test-utils/factories/versionsPage/VersionsPageFactories.js b/openecomp-ui/test-utils/factories/versionsPage/VersionsPageFactories.js
new file mode 100644
index 0000000000..49ceddc2bf
--- /dev/null
+++ b/openecomp-ui/test-utils/factories/versionsPage/VersionsPageFactories.js
@@ -0,0 +1,27 @@
+/*!
+ * 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 VersionFactory from 'test-utils/factories/common/VersionFactory.js';
+
+export const VersionsPageAdditionalPropsFactory = new Factory()
+ .attrs({
+ itemId: () => randomstring.generate(),
+ itemType: () => 'vendor-license-models',
+ additionalProps: () => {},
+ baseVersion: () => VersionFactory.build()
+ });
diff --git a/openecomp-ui/test-utils/failedTestReport.js b/openecomp-ui/test-utils/failedTestReport.js
index 9520cc9c99..ed88ccde4f 100644
--- a/openecomp-ui/test-utils/failedTestReport.js
+++ b/openecomp-ui/test-utils/failedTestReport.js
@@ -22,7 +22,7 @@ stdin.on('end', function () {
console.log('Failure Summary: \n');
}
report.testResults.forEach((suite) => {
- if(suite.status == 'failed') {
+ if(suite.status === 'failed') {
console.log('Suite: ' + suite.name);
suite.assertionResults.forEach((test) => {
if (test.status === 'failed') {