summaryrefslogtreecommitdiffstats
path: root/openecomp-ui/test/softwareProduct/details
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/softwareProduct/details
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/softwareProduct/details')
-rw-r--r--openecomp-ui/test/softwareProduct/details/detailsView.test.js52
-rw-r--r--openecomp-ui/test/softwareProduct/details/test.js70
2 files changed, 87 insertions, 35 deletions
diff --git a/openecomp-ui/test/softwareProduct/details/detailsView.test.js b/openecomp-ui/test/softwareProduct/details/detailsView.test.js
index 37c5df5079..d83fedaf7d 100644
--- a/openecomp-ui/test/softwareProduct/details/detailsView.test.js
+++ b/openecomp-ui/test/softwareProduct/details/detailsView.test.js
@@ -24,10 +24,12 @@ import {FeatureGroupStoreFactory} from 'test-utils/factories/licenseModel/Featu
import {SchemaGenericFieldInfoFactory} from 'test-utils/factories/softwareProduct/SoftwareProductQSchemaFactory.js';
import {default as VspQdataFactory, VspDataMapFactory} from 'test-utils/factories/softwareProduct/VspQdataFactory.js';
import {FinalizedLicenseModelFactory} from 'test-utils/factories/licenseModel/LicenseModelFactories.js';
+import VersionFactory from 'test-utils/factories/common/VersionFactory.js';
+import CurrentScreenFactory from 'test-utils/factories/common/CurrentScreenFactory.js';
describe('Software Product Details: ', function () {
- let currentSoftwareProduct = {}, currentSoftwareProductWithLicensingData = {}, softwareProductCategories = [],
+ let currentSoftwareProduct = {}, currentSoftwareProductWithLicensingData = {}, softwareProductCategories = [], licensingVersionsList = [], currentScreen = {},
finalizedLicenseModelList, licenseAgreementList, featureGroupsList, qdata = {}, dataMap = {}, genericFieldInfo = {}, qGenericFieldInfo = {};
let dummyFunc = () => {};
@@ -35,11 +37,18 @@ describe('Software Product Details: ', function () {
finalizedLicenseModelList = FinalizedLicenseModelFactory.buildList(2);
currentSoftwareProduct = VSPEditorFactory.build({
id: 'RTRTG454545',
+ licensingVersion: undefined,
vendorId: finalizedLicenseModelList[0].id,
- vendorName: finalizedLicenseModelList[0].vendorName
+ vendorName: finalizedLicenseModelList[0].name
});
softwareProductCategories = CategoryWithSubFactory.buildList(2, {}, {quantity: 1});
licenseAgreementList = LicenseAgreementStoreFactory.buildList(2);
+ licensingVersionsList = [
+ {
+ "id":"0127b419e9574a11aab8e031a78fc534",
+ "name":"1.0","description":"Initial version",
+ "baseId":"","status":"Certified","creationTime":1506409288390,"modificationTime":1506409288390,"additionalInfo":{"OptionalCreationMethods":["minor"]}},{"id":"ea159ffedd9a4f9a8a56d53ba66b7314","name":"2.0","description":"ggggg","baseId":"0127b419e9574a11aab8e031a78fc534","status":"Draft","creationTime":1508839019802,"modificationTime":1508839019802,"additionalInfo":{"OptionalCreationMethods":[]}}
+ ];
featureGroupsList = FeatureGroupStoreFactory.buildList(2, {referencingLicenseAgreements: [licenseAgreementList[0].id]});
qdata = VspQdataFactory.build();
dataMap = VspDataMapFactory.build();
@@ -48,7 +57,8 @@ describe('Software Product Details: ', function () {
licensingData: {
licenseAgreement: licenseAgreementList[0].id,
featureGroups: [featureGroupsList[0].id]
- }
+ },
+ licensingVersion : licensingVersionsList[0].id
};
genericFieldInfo = {
'name': {
@@ -66,6 +76,7 @@ describe('Software Product Details: ', function () {
}
};
qGenericFieldInfo = SchemaGenericFieldInfoFactory.build();
+ currentScreen = CurrentScreenFactory.build();
});
it('should mapper exist', () => {
@@ -75,10 +86,12 @@ describe('Software Product Details: ', function () {
it('should mapper return vsp basic data', () => {
var obj = {
+ currentScreen,
softwareProduct: {
softwareProductEditor: {
data: currentSoftwareProduct,
- genericFieldInfo
+ genericFieldInfo,
+ licensingVersionsList
},
softwareProductCategories,
softwareProductQuestionnaire: {
@@ -104,7 +117,7 @@ describe('Software Product Details: ', function () {
expect(result.finalizedLicenseModelList.length).toBeGreaterThan(0);
expect(finalizedLicenseModelList[0]).toMatchObject({
id: result.currentSoftwareProduct.vendorId,
- vendorName: result.currentSoftwareProduct.vendorName
+ name: result.currentSoftwareProduct.vendorName
});
expect(result.softwareProductCategories).toEqual(softwareProductCategories);
expect(result.licenseAgreementList).toEqual([]);
@@ -112,16 +125,17 @@ describe('Software Product Details: ', function () {
expect(result.qdata).toEqual(qdata);
expect(result.dataMap).toEqual(dataMap);
expect(result.isFormValid).toEqual(true);
- expect(result.isReadOnlyMode).toEqual(true);
});
it('should mapper return vsp data with selected licenseAgreement and featureGroup', () => {
var obj = {
+ currentScreen,
softwareProduct: {
softwareProductEditor: {
data: currentSoftwareProductWithLicensingData,
- genericFieldInfo
+ genericFieldInfo,
+ licensingVersionsList
},
softwareProductCategories,
softwareProductQuestionnaire: {
@@ -147,7 +161,7 @@ describe('Software Product Details: ', function () {
expect(result.finalizedLicenseModelList.length).toBeGreaterThan(0);
expect(result.finalizedLicenseModelList[0]).toMatchObject({
id: result.currentSoftwareProduct.vendorId,
- vendorName: result.currentSoftwareProduct.vendorName
+ name: result.currentSoftwareProduct.vendorName
});
expect(result.softwareProductCategories).toEqual(softwareProductCategories);
expect(result.licenseAgreementList).toEqual(licenseAgreementList);
@@ -156,12 +170,12 @@ describe('Software Product Details: ', function () {
expect(featureGroupsList[0]).toMatchObject({...featureGroupsList[0], id: fg});
});
expect(result.qdata).toEqual(qdata);
- expect(result.isReadOnlyMode).toEqual(true);
});
it('VSP Details view test', () => {
let params = {
+ ...currentScreen.props,
currentSoftwareProduct,
softwareProductCategories,
qdata,
@@ -170,6 +184,7 @@ describe('Software Product Details: ', function () {
finalizedLicenseModelList,
licenseAgreementList,
featureGroupsList,
+ licensingVersionsList,
genericFieldInfo,
qGenericFieldInfo,
};
@@ -185,6 +200,8 @@ describe('Software Product Details: ', function () {
);
let renderedOutput = renderer.getRenderOutput();
expect(renderedOutput).toBeTruthy();
+ expect(renderedOutput.props.children.props.isReadOnlyMode).toBe(false);
+
});
it('in view: should change vendorId and update vsp licensing-version', done => {
@@ -199,11 +216,12 @@ describe('Software Product Details: ', function () {
qGenericFieldInfo,
finalizedLicenseModelList,
licenseAgreementList,
+ licensingVersionsList,
featureGroupsList
};
const onVendorChangedListener = (deltaData) => {
expect(deltaData.vendorId).toEqual(finalizedLicenseModelList[1].id);
- expect(deltaData.vendorName).toEqual(finalizedLicenseModelList[1].vendorName);
+ expect(deltaData.vendorName).toEqual(finalizedLicenseModelList[1].name);
expect(deltaData.licensingVersion).toEqual('');
expect(deltaData.licensingData).toEqual({});
done();
@@ -215,6 +233,7 @@ describe('Software Product Details: ', function () {
qdata = {params.qdata}
qGenericFieldInfo = {params.qGenericFieldInfo}
genericFieldInfo = {params.genericFieldInfo}
+ licensingVersionsList={params.licensingVersionsList}
isFormValid={params.isFormValid}
dataMap={params.dataMap}
finalizedLicenseModelList = {params.finalizedLicenseModelList}
@@ -235,6 +254,7 @@ describe('Software Product Details: ', function () {
softwareProductCategories,
qdata,
dataMap,
+ licensingVersionsList,
isFormValid: true,
genericFieldInfo,
qGenericFieldInfo,
@@ -244,8 +264,8 @@ describe('Software Product Details: ', function () {
};
const onVendorChangedListener = (deltaData) => {
expect(deltaData.vendorId).toEqual(finalizedLicenseModelList[1].id);
- expect(deltaData.vendorName).toEqual(finalizedLicenseModelList[1].vendorName);
- expect(deltaData.licensingVersion).toEqual(finalizedLicenseModelList[1].viewableVersion[0]);
+ expect(deltaData.vendorName).toEqual(finalizedLicenseModelList[1].name);
+ expect(deltaData.licensingVersion).toEqual(licensingVersionsList[1]);
expect(deltaData.licensingData).toEqual({});
done();
};
@@ -258,7 +278,7 @@ describe('Software Product Details: ', function () {
onQDataChanged = {dummyFunc}
onVendorParamChanged = {(deltaData) => onVendorChangedListener(deltaData)}/>);
expect(vspDetailsView).toBeTruthy();
- vspDetailsView.onVendorParamChanged({vendorId: finalizedLicenseModelList[1].id, licensingVersion: finalizedLicenseModelList[1].viewableVersion[0]});
+ vspDetailsView.onVendorParamChanged({vendorId: finalizedLicenseModelList[1].id, licensingVersion: licensingVersionsList[1]});
});
it('in view: should change subcategory', done => {
@@ -270,6 +290,7 @@ describe('Software Product Details: ', function () {
isFormValid: true,
genericFieldInfo,
qGenericFieldInfo,
+ licensingVersionsList,
finalizedLicenseModelList,
licenseAgreementList,
featureGroupsList
@@ -301,6 +322,7 @@ describe('Software Product Details: ', function () {
isFormValid: true,
genericFieldInfo,
qGenericFieldInfo,
+ licensingVersionsList,
finalizedLicenseModelList,
licenseAgreementList,
featureGroupsList
@@ -328,8 +350,8 @@ describe('Software Product Details: ', function () {
]});
});
- it('in view: should change license agreement', done => {
+ it('in view: should change license agreement', done => {
let params = {
currentSoftwareProduct: currentSoftwareProductWithLicensingData,
softwareProductCategories,
@@ -338,6 +360,7 @@ describe('Software Product Details: ', function () {
isFormValid: true,
genericFieldInfo,
qGenericFieldInfo,
+ licensingVersionsList,
finalizedLicenseModelList,
licenseAgreementList,
featureGroupsList
@@ -358,4 +381,5 @@ describe('Software Product Details: ', function () {
expect(vspDetailsView).toBeTruthy();
vspDetailsView.onLicensingDataChanged({licenseAgreement: licenseAgreementList[1].id, featureGroups: []});
});
+
});
diff --git a/openecomp-ui/test/softwareProduct/details/test.js b/openecomp-ui/test/softwareProduct/details/test.js
index df84d184ce..27cbaa40ef 100644
--- a/openecomp-ui/test/softwareProduct/details/test.js
+++ b/openecomp-ui/test/softwareProduct/details/test.js
@@ -30,10 +30,11 @@ import {heatSetupManifest} from 'test-utils/factories/softwareProduct/SoftwarePr
import { FeatureGroupStoreFactory as FeatureGroup} from 'test-utils/factories/licenseModel/FeatureGroupFactories.js';
import {LicenseAgreementStoreFactory as LicenseAgreement} from 'test-utils/factories/licenseModel/LicenseAgreementFactories.js';
-import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js';
+import VersionFactory from 'test-utils/factories/common/VersionFactory.js';
+import {InitializedCurrentScreenFactory} from 'test-utils/factories/common/CurrentScreenFactory.js';
-describe('Software Product Module Tests', function () {
+describe('Software Product Details Module Tests', function () {
it('Get Software Products List', () => {
const store = storeCreator();
deepFreeze(store.getState());
@@ -43,14 +44,14 @@ describe('Software Product Module Tests', function () {
const expectedStore = cloneAndSet(store.getState(), 'softwareProductList', softwareProductList);
mockRest.addHandler('fetch', ({options, data, baseUrl}) => {
- expect(baseUrl).toEqual('/onboarding-api/v1.0/vendor-software-products/');
+ expect(baseUrl).toEqual('/onboarding-api/v1.0/vendor-software-products/?versionFilter=Draft');
expect(data).toEqual(undefined);
expect(options).toEqual(undefined);
return {results: softwareProductList};
});
mockRest.addHandler('fetch', ({options, data, baseUrl}) => {
- expect(baseUrl).toEqual('/onboarding-api/v1.0/vendor-software-products/?versionFilter=Final');
+ expect(baseUrl).toEqual('/onboarding-api/v1.0/vendor-software-products/?versionFilter=Certified');
expect(data).toEqual(undefined);
expect(options).toEqual(undefined);
return {results: []};
@@ -130,6 +131,10 @@ describe('Software Product Module Tests', function () {
let manifest = heatSetupManifest.build();
expectedStore = cloneAndSet(expectedStore, 'softwareProduct.softwareProductAttachments.heatSetup', manifest);
+ const expectedCurrentScreen = InitializedCurrentScreenFactory.build();
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.itemPermission', expectedCurrentScreen.itemPermission);
+ expectedStore = cloneAndSet(expectedStore, 'currentScreen.props', expectedCurrentScreen.props);
+
mockRest.addHandler('post', ({options, data, baseUrl}) => {
expect(baseUrl).toEqual('/onboarding-api/v1.0/vendor-software-products/');
expect(data).toEqual(softwareProductPostRequest);
@@ -184,7 +189,7 @@ describe('Software Product Module Tests', function () {
deepFreeze(softwareProductPostRequest);
const licenseModelId = softwareProductPostRequest.vendorId;
- const LMVersion = VersionControllerUtilsFactory.build().version;
+ const LMVersion = VersionFactory.build();
const secondLicenseModelId = 'secondLicenseModelId';
let FG1 = FeatureGroup.build();
@@ -205,13 +210,20 @@ describe('Software Product Module Tests', function () {
});
mockRest.addHandler('fetch', ({options, data, baseUrl}) => {
- expect(baseUrl).toEqual('/onboarding-api/v1.0/vendor-license-models/?versionFilter=Final');
+ expect(baseUrl).toEqual('/onboarding-api/v1.0/vendor-license-models/?versionFilter=Certified');
expect(data).toEqual(undefined);
expect(options).toEqual(undefined);
return {results: []};
});
mockRest.addHandler('fetch', ({options, data, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${licenseModelId}/versions/${LMVersion.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {results: {}};
+ });
+
+ mockRest.addHandler('fetch', ({options, data, baseUrl}) => {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${licenseModelId}/versions/${LMVersion.id}/license-agreements`);
expect(data).toEqual(undefined);
expect(options).toEqual(undefined);
@@ -226,6 +238,13 @@ describe('Software Product Module Tests', function () {
});
mockRest.addHandler('fetch', ({options, data, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${secondLicenseModelId}/versions/${LMVersion.id}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {results: {}};
+ });
+
+ mockRest.addHandler('fetch', ({options, data, baseUrl}) => {
expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-license-models/${secondLicenseModelId}/versions/${LMVersion.id}/license-agreements`);
expect(data).toEqual(undefined);
expect(options).toEqual(undefined);
@@ -239,17 +258,18 @@ describe('Software Product Module Tests', function () {
return {results: [FG2]};
});
- return SoftwareProductActionHelper.loadSoftwareProductDetailsData(store.dispatch, {licenseModelId, licensingVersion: LMVersion}).then(() => {
+ return SoftwareProductActionHelper.loadSoftwareProductDetailsData(store.dispatch, {licenseModelId, licensingVersion: LMVersion.id}).then(() => {
let state = store.getState();
expect(state.licenseModel.licenseAgreement.licenseAgreementList).toEqual([LA1]);
expect(state.licenseModel.featureGroup.featureGroupsList).toEqual([FG1]);
return SoftwareProductActionHelper.softwareProductEditorVendorChanged(store.dispatch,
- {deltaData: {vendorId: secondLicenseModelId, licensingVersion: LMVersion},
- formName: forms.VENDOR_SOFTWARE_PRODUCT_DETAILS});
- }).then(() => {
- let state = store.getState();
- expect(state.licenseModel.licenseAgreement.licenseAgreementList).toEqual([LA2]);
- expect(state.licenseModel.featureGroup.featureGroupsList).toEqual([FG2]);
+ {deltaData: {vendorId: secondLicenseModelId, licensingVersion: LMVersion.id},
+ formName: forms.VENDOR_SOFTWARE_PRODUCT_DETAILS}
+ ).then(() => {
+ let state = store.getState();
+ expect(state.licenseModel.licenseAgreement.licenseAgreementList).toEqual([LA2]);
+ expect(state.licenseModel.featureGroup.featureGroupsList).toEqual([FG2]);
+ });
});
});
@@ -258,6 +278,8 @@ describe('Software Product Module Tests', function () {
const softwareProduct = VSPEditorFactoryWithLicensingData.build();
deepFreeze(softwareProduct);
+ const version = VersionFactory.build();
+
const store = storeCreator({
softwareProduct: {
softwareProductEditor: {data: softwareProduct},
@@ -291,13 +313,13 @@ describe('Software Product Module Tests', function () {
deepFreeze(questionnaireData);
mockRest.addHandler('put', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-software-products/${toBeUpdatedSoftwareProductId}/versions/${softwareProduct.version.id}`);
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-software-products/${toBeUpdatedSoftwareProductId}/versions/${version.id}`);
expect(data).toEqual(softwareProductUpdateData);
expect(options).toEqual(undefined);
return {returnCode: 'OK'};
});
mockRest.addHandler('put', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-software-products/${toBeUpdatedSoftwareProductId}/versions/${softwareProduct.version.id}/questionnaire`);
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-software-products/${toBeUpdatedSoftwareProductId}/versions/${version.id}/questionnaire`);
expect(data).toEqual(questionnaireData);
expect(options).toEqual(undefined);
return {returnCode: 'OK'};
@@ -305,7 +327,8 @@ describe('Software Product Module Tests', function () {
return SoftwareProductActionHelper.updateSoftwareProduct(store.dispatch, {
softwareProduct: softwareProductPutRequest,
- qdata: questionnaireData
+ qdata: questionnaireData,
+ version
}).then(() => {
expect(store.getState()).toEqual(expectedStore);
});
@@ -316,6 +339,8 @@ describe('Software Product Module Tests', function () {
const softwareProduct = VSPEditorFactoryWithLicensingData.build();
deepFreeze(softwareProduct);
+ const version = VersionFactory.build();
+
const store = storeCreator({
softwareProduct: {
softwareProductEditor: {data: softwareProduct},
@@ -334,19 +359,20 @@ describe('Software Product Module Tests', function () {
let softwareProductUpdateData = VSPEditorPostFactoryWithLicensingData.build(dataForUpdate);
delete softwareProductUpdateData.version;
- const softwareProductPutRequest = buildFromExistingObject(VSPEditorFactoryWithLicensingData, softwareProductUpdateData, {id: toBeUpdatedSoftwareProductId, version: softwareProduct.version});
+ const softwareProductPutRequest = buildFromExistingObject(VSPEditorFactoryWithLicensingData, softwareProductUpdateData, {id: toBeUpdatedSoftwareProductId});
deepFreeze(softwareProductUpdateData);
mockRest.addHandler('put', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-software-products/${toBeUpdatedSoftwareProductId}/versions/${softwareProduct.version.id}`);
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-software-products/${toBeUpdatedSoftwareProductId}/versions/${version.id}`);
expect(data).toEqual(softwareProductUpdateData);
expect(options).toEqual(undefined);
return {returnCode: 'OK'};
});
return SoftwareProductActionHelper.updateSoftwareProductData(store.dispatch, {
- softwareProduct: softwareProductPutRequest
+ softwareProduct: softwareProductPutRequest,
+ version
}).then(() => {
expect(store.getState()).toEqual(expectedStore);
});
@@ -356,6 +382,8 @@ describe('Software Product Module Tests', function () {
const softwareProduct = VSPEditorFactoryWithLicensingData.build();
deepFreeze(softwareProduct);
+ const version = VersionFactory.build();
+
const store = storeCreator({
softwareProduct: {
softwareProductEditor: {data: softwareProduct},
@@ -377,7 +405,7 @@ describe('Software Product Module Tests', function () {
deepFreeze(questionnaireData);
mockRest.addHandler('put', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-software-products/${toBeUpdatedSoftwareProductId}/versions/${softwareProduct.version.id}/questionnaire`);
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-software-products/${toBeUpdatedSoftwareProductId}/versions/${version.id}/questionnaire`);
expect(data).toEqual(questionnaireData);
expect(options).toEqual(undefined);
return {returnCode: 'OK'};
@@ -385,7 +413,7 @@ describe('Software Product Module Tests', function () {
return SoftwareProductActionHelper.updateSoftwareProductQuestionnaire(store.dispatch, {
softwareProductId: softwareProduct.id,
- version: softwareProduct.version,
+ version,
qdata: questionnaireData
}).then(() => {
expect(store.getState()).toEqual(expectedStore);