diff --git a/CSC Ground Segment Interface Delivery Point Test Suite v1.9.1_HF.json b/CSC Ground Segment Interface Delivery Point Test Suite v2.0.json similarity index 75% rename from CSC Ground Segment Interface Delivery Point Test Suite v1.9.1_HF.json rename to CSC Ground Segment Interface Delivery Point Test Suite v2.0.json index 4528ad5..9716106 100644 --- a/CSC Ground Segment Interface Delivery Point Test Suite v1.9.1_HF.json +++ b/CSC Ground Segment Interface Delivery Point Test Suite v2.0.json @@ -1,7 +1,7 @@ { "info": { "_postman_id": "", - "name": "CSC Ground Segment Interface Delivery Point Test Suite v1.9.1_HF", + "name": "CSC Ground Segment Interface Delivery Point Test Suite v2.0", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ @@ -6846,7 +6846,7 @@ "test_map.instrumentShortName=function (element) {pm.expect(element.Name).eq('instrumentShortName');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SAR\"]);};", "test_map.operationalMode=function (element) {pm.expect(element.Name).eq('operationalMode');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SM\",\"IW\",\"EW\",\"WV\"]);};", "test_map.swathIdentifier=function (element) {pm.expect(element.Name).eq('swathIdentifier');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]);};", - "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\"]);};", + "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\",\"HH,HV\",\"VV,HV\",\"HV,HH\",\"HV,VV\"]);};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9])/);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|1[0-6][0-9]|17[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|1[0-6][0-9]|17[0-5])/);};", @@ -6863,7 +6863,7 @@ "test_map.productConsolidation=function (element) {pm.expect(element.Name).eq('productConsolidation');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SLICE\",\"SLICE PARTIAL\",\"FULL\"]);};", "test_map.instrumentConfigurationID=function (element) {pm.expect(element.Name).eq('instrumentConfigurationID');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|1[0-5][0-9]{6}|16[0-6][0-9]{5}|167[0-6][0-9]{4}|1677[0-6][0-9]{3}|16777[01][0-9]{2}|1677720[0-9]|1677721[0-5])/);};", "test_map.datatakeID=function (element) {pm.expect(element.Name).eq('datatakeID');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-7][0-9]{6}|8[0-2][0-9]{5}|83[0-7][0-9]{4}|838[0-7][0-9]{3}|8388[0-5][0-9]{2}|838860[0-7])/);};", - "test_map.sliceProductFlag=function (element) {pm.expect(element.Name).eq('sliceProductFlag');pm.expect(element.ValueType).eq('Boolean');pm.expect(element.Value).to.be.oneOf([\"TRUE\",\"FALSE\",\"true\",\"false\"]);};", + "test_map.sliceProductFlag=function (element) {pm.expect(element.Name).eq('sliceProductFlag');pm.expect(element.ValueType).eq('Boolean');pm.expect(element.Value).to.be.oneOf([TRUE,FALSE,true,false]);};", "test_map.sliceNumber=function (element) {pm.expect(element.Name).eq('sliceNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.totalSlices=function (element) {pm.expect(element.Name).eq('totalSlices');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "", @@ -7682,7 +7682,7 @@ "test_map.instrumentShortName=function (element) {pm.expect(element.Name).eq('instrumentShortName');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SAR\"]);};", "test_map.operationalMode=function (element) {pm.expect(element.Name).eq('operationalMode');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SM\",\"IW\",\"EW\",\"WV\",\"RF\",\"EN\",\"AN\"]);};", "test_map.swathIdentifier=function (element) {pm.expect(element.Name).eq('swathIdentifier');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]);};", - "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\"]);};", + "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\",\"HH,HV\",\"VV,HV\",\"HV,HH\",\"HV,VV\"]);};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9])/);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|1[0-6][0-9]|17[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|1[0-6][0-9]|17[0-5])/);};", @@ -7699,7 +7699,7 @@ "test_map.productConsolidation=function (element) {pm.expect(element.Name).eq('productConsolidation');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SLICE\",\"SLICE PARTIAL\",\"FULL\"]);};", "test_map.instrumentConfigurationID=function (element) {pm.expect(element.Name).eq('instrumentConfigurationID');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|1[0-5][0-9]{6}|16[0-6][0-9]{5}|167[0-6][0-9]{4}|1677[0-6][0-9]{3}|16777[01][0-9]{2}|1677720[0-9]|1677721[0-5])/);};", "test_map.datatakeID=function (element) {pm.expect(element.Name).eq('datatakeID');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-7][0-9]{6}|8[0-2][0-9]{5}|83[0-7][0-9]{4}|838[0-7][0-9]{3}|8388[0-5][0-9]{2}|838860[0-7])/);};", - "test_map.sliceProductFlag=function (element) {pm.expect(element.Name).eq('sliceProductFlag');pm.expect(element.ValueType).eq('Boolean');pm.expect(element.Value).to.be.oneOf([\"TRUE\",\"FALSE\",\"true\",\"false\"]);};", + "test_map.sliceProductFlag=function (element) {pm.expect(element.Name).eq('sliceProductFlag');pm.expect(element.ValueType).eq('Boolean');pm.expect(element.Value).to.be.oneOf([TRUE,FALSE,true,false]);};", "test_map.sliceNumber=function (element) {pm.expect(element.Name).eq('sliceNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.totalSlices=function (element) {pm.expect(element.Name).eq('totalSlices');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "", @@ -8014,7 +8014,7 @@ "test_map.instrumentShortName=function (element) {pm.expect(element.Name).eq('instrumentShortName');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SAR\"]);};", "test_map.operationalMode=function (element) {pm.expect(element.Name).eq('operationalMode');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SM\",\"IW\",\"EW\",\"WV\"]);};", "test_map.swathIdentifier=function (element) {pm.expect(element.Name).eq('swathIdentifier');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]);};", - "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\"]);};", + "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\",\"HH,HV\",\"VV,HV\",\"HV,HH\",\"HV,VV\"]);};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9])/);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|1[0-6][0-9]|17[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|1[0-6][0-9]|17[0-5])/);};", @@ -8031,7 +8031,7 @@ "test_map.productConsolidation=function (element) {pm.expect(element.Name).eq('productConsolidation');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SLICE\",\"SLICE PARTIAL\",\"FULL\"]);};", "test_map.instrumentConfigurationID=function (element) {pm.expect(element.Name).eq('instrumentConfigurationID');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|1[0-5][0-9]{6}|16[0-6][0-9]{5}|167[0-6][0-9]{4}|1677[0-6][0-9]{3}|16777[01][0-9]{2}|1677720[0-9]|1677721[0-5])/);};", "test_map.datatakeID=function (element) {pm.expect(element.Name).eq('datatakeID');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-7][0-9]{6}|8[0-2][0-9]{5}|83[0-7][0-9]{4}|838[0-7][0-9]{3}|8388[0-5][0-9]{2}|838860[0-7])/);};", - "test_map.sliceProductFlag=function (element) {pm.expect(element.Name).eq('sliceProductFlag');pm.expect(element.ValueType).eq('Boolean');pm.expect(element.Value).to.be.oneOf([\"TRUE\",\"FALSE\",\"true\",\"false\"]);};", + "test_map.sliceProductFlag=function (element) {pm.expect(element.Name).eq('sliceProductFlag');pm.expect(element.ValueType).eq('Boolean');pm.expect(element.Value).to.be.oneOf([TRUE,FALSE,true,false]);};", "test_map.sliceNumber=function (element) {pm.expect(element.Name).eq('sliceNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.totalSlices=function (element) {pm.expect(element.Name).eq('totalSlices');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "", @@ -8850,7 +8850,7 @@ "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|1[0-6][0-9]|17[0-5])/);};", "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"UNKNOWN\"]);};", "test_map.coordinates=function (element) {pm.expect(element.Name).eq('coordinates');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.match(/(-?\\d+(\\.\\d+)?),\\s*(-?\\d+(\\.\\d+)?)/);};", - "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\"]);};", + "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\",\"HH,HV\",\"VV,HV\",\"HV,HH\",\"HV,VV\"]);};", "test_map.productType=function (element) {pm.expect(element.Name).eq('productType');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"S1_SLC__1S\",\"S2_SLC__1S\",\"S3_SLC__1S\",\"S4_SLC__1S\",\"S5_SLC__1S\",\"S6_SLC__1S\",\"S1_SLC__1A\",\"S2_SLC__1A\",\"S3_SLC__1A\",\"S4_SLC__1A\",\"S5_SLC__1A\",\"S6_SLC__1A\",\"S1_GRDF_1S\",\"S2_GRDF_1S\",\"S3_GRDF_1S\",\"S4_GRDF_1S\",\"S5_GRDF_1S\",\"S6_GRDF_1S\",\"S1_GRDF_1A\",\"S2_GRDF_1A\",\"S3_GRDF_1A\",\"S4_GRDF_1A\",\"S5_GRDF_1A\",\"S6_GRDF_1A\",\"S1_GRDH_1S\",\"S2_GRDH_1S\",\"S3_GRDH_1S\",\"S4_GRDH_1S\",\"S5_GRDH_1S\",\"S6_GRDH_1S\",\"S1_GRDH_1A\",\"S2_GRDH_1A\",\"S3_GRDH_1A\",\"S4_GRDH_1A\",\"S5_GRDH_1A\",\"S6_GRDH_1A\",\"S1_GRDM_1S\",\"S2_GRDM_1S\",\"S3_GRDM_1S\",\"S4_GRDM_1S\",\"S5_GRDM_1S\",\"S6_GRDM_1S\",\"S1_GRDM_1A\",\"S2_GRDM_1A\",\"S3_GRDM_1A\",\"S4_GRDM_1A\",\"S5_GRDM_1A\",\"S6_GRDM_1A\",\"S1_RTC__1S\",\"S2_RTC__1S\",\"S3_RTC__1S\",\"S4_RTC__1S\",\"S5_RTC__1S\",\"S6_RTC__1S\",\"S1_OCN__2S\",\"S2_OCN__2S\",\"S3_OCN__2S\",\"S4_OCN__2S\",\"S5_OCN__2S\",\"S6_OCN__2S\",\"S1_OCN__2A\",\"S2_OCN__2A\",\"S3_OCN__2A\",\"S4_OCN__2A\",\"S5_OCN__2A\",\"S6_OCN__2A\",\"IW_SLC__1S\",\"IW_SLC__1A\",\"IW_GRDH_1S\",\"IW_GRDH_1A\",\"IW_GRDM_1S\",\"IW_GRDM_1A\",\"IW_RTC__1S\",\"IW_OCN__2S\",\"IW_OCN__2A\",\"EW_SLC__1S\",\"EW_SLC__1A\",\"EW_GRDH_1S\",\"EW_GRDH_1A\",\"EW_GRDM_1S\",\"EW_GRDM_1A\",\"EW_RTC__1S\",\"EW_OCN__2S\",\"EW_OCN__2A\",\"WV_SLC__1S\",\"WV_SLC__1A\",\"WV_GRDM_1S\",\"WV_GRDM_1A\",\"WV_OCN__2S\",\"WV_OCN__2A\"]);", "", "};", @@ -9473,7 +9473,7 @@ "test_map.instrumentShortName=function (element) {pm.expect(element.Name).eq('instrumentShortName');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SAR\"]);};", "test_map.operationalMode=function (element) {pm.expect(element.Name).eq('operationalMode');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SM\",\"IW\",\"EW\",\"WV\",\"RF\",\"EN\",\"AN\"]);};", "test_map.swathIdentifier=function (element) {pm.expect(element.Name).eq('swathIdentifier');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]);};", - "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\"]);};", + "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\",\"HH,HV\",\"VV,HV\",\"HV,HH\",\"HV,VV\"]);};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9])/);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|1[0-6][0-9]|17[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|1[0-6][0-9]|17[0-5])/);};", @@ -9965,7 +9965,7 @@ "test_map.instrumentShortName=function (element) {pm.expect(element.Name).eq('instrumentShortName');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SAR\"]);};", "test_map.operationalMode=function (element) {pm.expect(element.Name).eq('operationalMode');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SM\",\"IW\",\"EW\",\"WV\"]);};", "test_map.swathIdentifier=function (element) {pm.expect(element.Name).eq('swathIdentifier');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]);};", - "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\"]);};", + "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\",\"HH,HV\",\"VV,HV\",\"HV,HH\",\"HV,VV\"]);};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9])/);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|1[0-6][0-9]|17[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|1[0-6][0-9]|17[0-5])/);};", @@ -9982,7 +9982,7 @@ "test_map.productConsolidation=function (element) {pm.expect(element.Name).eq('productConsolidation');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SLICE\",\"SLICE PARTIAL\",\"FULL\"]);};", "test_map.instrumentConfigurationID=function (element) {pm.expect(element.Name).eq('instrumentConfigurationID');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|1[0-5][0-9]{6}|16[0-6][0-9]{5}|167[0-6][0-9]{4}|1677[0-6][0-9]{3}|16777[01][0-9]{2}|1677720[0-9]|1677721[0-5])/);};", "test_map.datatakeID=function (element) {pm.expect(element.Name).eq('datatakeID');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-7][0-9]{6}|8[0-2][0-9]{5}|83[0-7][0-9]{4}|838[0-7][0-9]{3}|8388[0-5][0-9]{2}|838860[0-7])/);};", - "test_map.sliceProductFlag=function (element) {pm.expect(element.Name).eq('sliceProductFlag');pm.expect(element.ValueType).eq('Boolean');pm.expect(element.Value).to.be.oneOf([\"TRUE\",\"FALSE\",\"true\",\"false\"]);};", + "test_map.sliceProductFlag=function (element) {pm.expect(element.Name).eq('sliceProductFlag');pm.expect(element.ValueType).eq('Boolean');pm.expect(element.Value).to.be.oneOf([TRUE,FALSE,true,false]);};", "test_map.sliceNumber=function (element) {pm.expect(element.Name).eq('sliceNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.totalSlices=function (element) {pm.expect(element.Name).eq('totalSlices');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "", @@ -10969,7 +10969,7 @@ "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|1[0-6][0-9]|17[0-5])/);};", "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"UNKNOWN\"]);};", "test_map.coordinates=function (element) {pm.expect(element.Name).eq('coordinates');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.match(/(-?\\d+(\\.\\d+)?),\\s*(-?\\d+(\\.\\d+)?)/);};", - "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\"]);};", + "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\",\"HH,HV\",\"VV,HV\",\"HV,HH\",\"HV,VV\"]);};", "test_map.productType=function (element) {pm.expect(element.Name).eq('productType');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"S1_SLC__1S\",\"S2_SLC__1S\",\"S3_SLC__1S\",\"S4_SLC__1S\",\"S5_SLC__1S\",\"S6_SLC__1S\",\"S1_SLC__1A\",\"S2_SLC__1A\",\"S3_SLC__1A\",\"S4_SLC__1A\",\"S5_SLC__1A\",\"S6_SLC__1A\",\"S1_GRDF_1S\",\"S2_GRDF_1S\",\"S3_GRDF_1S\",\"S4_GRDF_1S\",\"S5_GRDF_1S\",\"S6_GRDF_1S\",\"S1_GRDF_1A\",\"S2_GRDF_1A\",\"S3_GRDF_1A\",\"S4_GRDF_1A\",\"S5_GRDF_1A\",\"S6_GRDF_1A\",\"S1_GRDH_1S\",\"S2_GRDH_1S\",\"S3_GRDH_1S\",\"S4_GRDH_1S\",\"S5_GRDH_1S\",\"S6_GRDH_1S\",\"S1_GRDH_1A\",\"S2_GRDH_1A\",\"S3_GRDH_1A\",\"S4_GRDH_1A\",\"S5_GRDH_1A\",\"S6_GRDH_1A\",\"S1_GRDM_1S\",\"S2_GRDM_1S\",\"S3_GRDM_1S\",\"S4_GRDM_1S\",\"S5_GRDM_1S\",\"S6_GRDM_1S\",\"S1_GRDM_1A\",\"S2_GRDM_1A\",\"S3_GRDM_1A\",\"S4_GRDM_1A\",\"S5_GRDM_1A\",\"S6_GRDM_1A\",\"S1_RTC__1S\",\"S2_RTC__1S\",\"S3_RTC__1S\",\"S4_RTC__1S\",\"S5_RTC__1S\",\"S6_RTC__1S\",\"S1_OCN__2S\",\"S2_OCN__2S\",\"S3_OCN__2S\",\"S4_OCN__2S\",\"S5_OCN__2S\",\"S6_OCN__2S\",\"S1_OCN__2A\",\"S2_OCN__2A\",\"S3_OCN__2A\",\"S4_OCN__2A\",\"S5_OCN__2A\",\"S6_OCN__2A\",\"IW_SLC__1S\",\"IW_SLC__1A\",\"IW_GRDH_1S\",\"IW_GRDH_1A\",\"IW_GRDM_1S\",\"IW_GRDM_1A\",\"IW_RTC__1S\",\"IW_OCN__2S\",\"IW_OCN__2A\",\"EW_SLC__1S\",\"EW_SLC__1A\",\"EW_GRDH_1S\",\"EW_GRDH_1A\",\"EW_GRDM_1S\",\"EW_GRDM_1A\",\"EW_RTC__1S\",\"EW_OCN__2S\",\"EW_OCN__2A\",\"WV_SLC__1S\",\"WV_SLC__1A\",\"WV_GRDM_1S\",\"WV_GRDM_1A\",\"WV_OCN__2S\",\"WV_OCN__2A\"]);", "", "};", @@ -10978,7 +10978,7 @@ "test_map.datatakeID=function (element) {pm.expect(element.Name).eq('datatakeID');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.productClass=function (element) {pm.expect(element.Name).eq('productClass');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');};", "test_map.productComposition=function (element) {pm.expect(element.Name).eq('productComposition');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');};", - "test_map.sliceProductFlag=function (element) {pm.expect(element.Name).eq('sliceProductFlag');pm.expect(element.ValueType).eq('Boolean');pm.expect(element.Value).to.be.oneOf([\"TRUE\",\"FALSE\",\"true\",\"false\"]);};", + "test_map.sliceProductFlag=function (element) {pm.expect(element.Name).eq('sliceProductFlag');pm.expect(element.ValueType).eq('Boolean');pm.expect(element.Value).to.be.oneOf([TRUE,FALSE,true,false]);};", "test_map.segmentStartTime=function (element) {pm.expect(element.Name).eq('segmentStartTime');pm.expect(element.ValueType).eq('DateTimeOffset');pm.expect(element.Value).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};", "test_map.sliceNumber=function (element) {pm.expect(element.Name).eq('sliceNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.totalSlices=function (element) {pm.expect(element.Name).eq('totalSlices');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", @@ -11614,7 +11614,7 @@ "test_map.instrumentShortName=function (element) {pm.expect(element.Name).eq('instrumentShortName');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SAR\"]);};", "test_map.operationalMode=function (element) {pm.expect(element.Name).eq('operationalMode');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SM\",\"IW\",\"EW\",\"WV\",\"RF\",\"EN\",\"AN\"]);};", "test_map.swathIdentifier=function (element) {pm.expect(element.Name).eq('swathIdentifier');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]);};", - "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\"]);};", + "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\",\"HH,HV\",\"VV,HV\",\"HV,HH\",\"HV,VV\"]);};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9])/);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|1[0-6][0-9]|17[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|1[0-6][0-9]|17[0-5])/);};", @@ -11631,7 +11631,7 @@ "test_map.productConsolidation=function (element) {pm.expect(element.Name).eq('productConsolidation');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SLICE\",\"SLICE PARTIAL\",\"FULL\"]);};", "test_map.instrumentConfigurationID=function (element) {pm.expect(element.Name).eq('instrumentConfigurationID');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|1[0-5][0-9]{6}|16[0-6][0-9]{5}|167[0-6][0-9]{4}|1677[0-6][0-9]{3}|16777[01][0-9]{2}|1677720[0-9]|1677721[0-5])/);};", "test_map.datatakeID=function (element) {pm.expect(element.Name).eq('datatakeID');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-7][0-9]{6}|8[0-2][0-9]{5}|83[0-7][0-9]{4}|838[0-7][0-9]{3}|8388[0-5][0-9]{2}|838860[0-7])/);};", - "test_map.sliceProductFlag=function (element) {pm.expect(element.Name).eq('sliceProductFlag');pm.expect(element.ValueType).eq('Boolean');pm.expect(element.Value).to.be.oneOf([\"TRUE\",\"FALSE\",\"true\",\"false\"]);};", + "test_map.sliceProductFlag=function (element) {pm.expect(element.Name).eq('sliceProductFlag');pm.expect(element.ValueType).eq('Boolean');pm.expect(element.Value).to.be.oneOf([TRUE,FALSE,true,false]);};", "test_map.sliceNumber=function (element) {pm.expect(element.Name).eq('sliceNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.totalSlices=function (element) {pm.expect(element.Name).eq('totalSlices');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "", @@ -11944,7 +11944,7 @@ "test_map.instrumentShortName=function (element) {pm.expect(element.Name).eq('instrumentShortName');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SAR\"]);};", "test_map.operationalMode=function (element) {pm.expect(element.Name).eq('operationalMode');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SM\",\"IW\",\"EW\",\"WV\"]);};", "test_map.swathIdentifier=function (element) {pm.expect(element.Name).eq('swathIdentifier');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\",\"2\",\"3\",\"4\",\"5\",\"6\"]);};", - "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\"]);};", + "test_map.polarisationChannels=function (element) {pm.expect(element.Name).eq('polarisationChannels');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"HH\",\"VV\",\"HH,VH\",\"VV,VH\",\"VH,VV\",\"VH,HH\",\"HH,HV\",\"VV,HV\",\"HV,HH\",\"HV,VV\"]);};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9])/);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|1[0-6][0-9]|17[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|1[0-6][0-9]|17[0-5])/);};", @@ -11961,7 +11961,7 @@ "test_map.productConsolidation=function (element) {pm.expect(element.Name).eq('productConsolidation');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"SLICE\",\"SLICE PARTIAL\",\"FULL\"]);};", "test_map.instrumentConfigurationID=function (element) {pm.expect(element.Name).eq('instrumentConfigurationID');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-8][0-9]{6}|9[0-8][0-9]{5}|99[0-8][0-9]{4}|999[0-8][0-9]{3}|9999[0-8][0-9]{2}|99999[0-8][0-9]|999999[0-9]|1[0-5][0-9]{6}|16[0-6][0-9]{5}|167[0-6][0-9]{4}|1677[0-6][0-9]{3}|16777[01][0-9]{2}|1677720[0-9]|1677721[0-5])/);};", "test_map.datatakeID=function (element) {pm.expect(element.Name).eq('datatakeID');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|[1-8][0-9]{3}|9[0-8][0-9]{2}|99[0-8][0-9]|999[0-9]|[1-8][0-9]{4}|9[0-8][0-9]{3}|99[0-8][0-9]{2}|999[0-8][0-9]|9999[0-9]|[1-8][0-9]{5}|9[0-8][0-9]{4}|99[0-8][0-9]{3}|999[0-8][0-9]{2}|9999[0-8][0-9]|99999[0-9]|[1-7][0-9]{6}|8[0-2][0-9]{5}|83[0-7][0-9]{4}|838[0-7][0-9]{3}|8388[0-5][0-9]{2}|838860[0-7])/);};", - "test_map.sliceProductFlag=function (element) {pm.expect(element.Name).eq('sliceProductFlag');pm.expect(element.ValueType).eq('Boolean');pm.expect(element.Value).to.be.oneOf([\"TRUE\",\"FALSE\",\"true\",\"false\"]);};", + "test_map.sliceProductFlag=function (element) {pm.expect(element.Name).eq('sliceProductFlag');pm.expect(element.ValueType).eq('Boolean');pm.expect(element.Value).to.be.oneOf([TRUE,FALSE,true,false]);};", "test_map.sliceNumber=function (element) {pm.expect(element.Name).eq('sliceNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.totalSlices=function (element) {pm.expect(element.Name).eq('totalSlices');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "", @@ -12205,8 +12205,8 @@ "test_map.timeliness=function (element) {pm.expect(element.Name).eq('timeliness');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"NR\",\"NT\",\"ST\",\"AL\"]);};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.lastOrbitNumber=function (element) {pm.expect(element.Name).eq('lastOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", - "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", - "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", + "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", + "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.processingLevel=function (element) {pm.expect(element.Name).eq('processingLevel');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\",\"2\"]);};", @@ -12227,8 +12227,8 @@ "test_schema.operationalMode=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.productType=function (num) {pm.expect(num).to.be.eq(1)};", "test_schema.timeliness=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", - "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", + "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.orbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastOrbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.relativeOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", @@ -12402,8 +12402,8 @@ "test_map.timeliness=function (element) {pm.expect(element.Name).eq('timeliness');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"NR\",\"NT\",\"ST\",\"AL\"]);};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.lastOrbitNumber=function (element) {pm.expect(element.Name).eq('lastOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", - "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", - "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", + "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", + "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.processingLevel=function (element) {pm.expect(element.Name).eq('processingLevel');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\",\"2\"]);};", @@ -12424,8 +12424,8 @@ "test_schema.operationalMode=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.productType=function (num) {pm.expect(num).to.be.eq(1)};", "test_schema.timeliness=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", - "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", + "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.orbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastOrbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.relativeOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", @@ -12604,8 +12604,8 @@ "test_map.timeliness=function (element) {pm.expect(element.Name).eq('timeliness');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"NR\",\"NT\",\"ST\",\"AL\"]);};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.lastOrbitNumber=function (element) {pm.expect(element.Name).eq('lastOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", - "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", - "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", + "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", + "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.processingLevel=function (element) {pm.expect(element.Name).eq('processingLevel');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\"]);};", @@ -12626,8 +12626,8 @@ "test_schema.operationalMode=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.productType=function (num) {pm.expect(num).to.be.eq(1)};", "test_schema.timeliness=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", - "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", + "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.orbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastOrbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.relativeOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", @@ -14449,8 +14449,8 @@ "test_map.timeliness=function (element) {pm.expect(element.Name).eq('timeliness');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"NR\",\"NT\",\"ST\",\"AL\"]);};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.lastOrbitNumber=function (element) {pm.expect(element.Name).eq('lastOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", - "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", - "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", + "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", + "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.processingLevel=function (element) {pm.expect(element.Name).eq('processingLevel');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"0\"]);};", @@ -14471,8 +14471,8 @@ "test_schema.operationalMode=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.productType=function (num) {pm.expect(num).to.be.eq(1)};", "test_schema.timeliness=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", - "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", + "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.orbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastOrbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.relativeOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", @@ -14713,8 +14713,8 @@ "test_map.timeliness=function (element) {pm.expect(element.Name).eq('timeliness');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"NR\",\"NT\",\"ST\",\"AL\"]);};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.lastOrbitNumber=function (element) {pm.expect(element.Name).eq('lastOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", - "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", - "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", + "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", + "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.processingLevel=function (element) {pm.expect(element.Name).eq('processingLevel');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\",\"2\"]);};", @@ -14739,8 +14739,8 @@ "test_schema.operationalMode=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.productType=function (num) {pm.expect(num).to.be.eq(1)};", "test_schema.timeliness=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", - "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", + "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.orbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastOrbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.relativeOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", @@ -14929,8 +14929,8 @@ "test_map.cloudCover=function (element) {pm.expect(element.Name).eq('cloudCover');pm.expect(element.ValueType).eq('Double');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.lastOrbitNumber=function (element) {pm.expect(element.Name).eq('lastOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", - "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", - "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", + "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", + "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.processingLevel=function (element) {pm.expect(element.Name).eq('processingLevel');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');};", @@ -14957,8 +14957,8 @@ "test_schema.productType=function (num) {pm.expect(num).to.be.eq(1)};", "test_schema.timeliness=function (num) {pm.expect(num).to.be.eq(1)};", "test_schema.cloudCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", - "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", + "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.orbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastOrbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.relativeOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", @@ -15138,8 +15138,8 @@ "test_map.cloudCover=function (element) {pm.expect(element.Name).eq('cloudCover');pm.expect(element.ValueType).eq('Double');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.lastOrbitNumber=function (element) {pm.expect(element.Name).eq('lastOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", - "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", - "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", + "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", + "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.processingLevel=function (element) {pm.expect(element.Name).eq('processingLevel');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\",\"2\"]);};", @@ -15166,9 +15166,9 @@ "test_schema.operationalMode=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.productType=function (num) {pm.expect(num).to.be.eq(1)};", "test_schema.timeliness=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.cloudCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", - "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", + "test_schema.cloudCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.orbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastOrbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.relativeOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", @@ -15180,12 +15180,12 @@ "test_schema.processorVersion=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.coordinates=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.baselineCollection=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.snowOrIceCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.salineWaterCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.coastalCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.freshInlandWaterCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.tidalRegionCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.landCover=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.snowOrIceCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.salineWaterCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.coastalCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.freshInlandWaterCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.tidalRegionCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.landCover=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastRelativeOrbitNumber=function (num) {pm.expect(num).to.be.within(0,2)};", "", " ", @@ -15369,8 +15369,8 @@ "test_map.cloudCover=function (element) {pm.expect(element.Name).eq('cloudCover');pm.expect(element.ValueType).eq('Double');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.lastOrbitNumber=function (element) {pm.expect(element.Name).eq('lastOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", - "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", - "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", + "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", + "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.processingLevel=function (element) {pm.expect(element.Name).eq('processingLevel');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\",\"2\"]);};", @@ -15397,9 +15397,9 @@ "test_schema.operationalMode=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.productType=function (num) {pm.expect(num).to.be.eq(1)};", "test_schema.timeliness=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.cloudCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", - "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", + "test_schema.cloudCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.orbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastOrbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.relativeOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", @@ -15411,12 +15411,12 @@ "test_schema.processorVersion=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.coordinates=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.baselineCollection=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.brightCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.salineWaterCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.coastalCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.freshInlandWaterCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.tidalRegionCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.landCover=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.brightCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.salineWaterCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.coastalCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.freshInlandWaterCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.tidalRegionCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.landCover=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastRelativeOrbitNumber=function (num) {pm.expect(num).to.be.within(0,2)};", "", " ", @@ -17239,8 +17239,8 @@ "test_map.timeliness=function (element) {pm.expect(element.Name).eq('timeliness');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"NR\",\"NT\",\"ST\",\"AL\"]);};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.lastOrbitNumber=function (element) {pm.expect(element.Name).eq('lastOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", - "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", - "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", + "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", + "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.processingLevel=function (element) {pm.expect(element.Name).eq('processingLevel');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\",\"2\"]);};", @@ -17265,8 +17265,8 @@ "test_schema.operationalMode=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.productType=function (num) {pm.expect(num).to.be.eq(1)};", "test_schema.timeliness=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", - "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", + "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.orbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastOrbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.relativeOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", @@ -17463,8 +17463,8 @@ "test_map.cloudCover=function (element) {pm.expect(element.Name).eq('cloudCover');pm.expect(element.ValueType).eq('Double');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.lastOrbitNumber=function (element) {pm.expect(element.Name).eq('lastOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", - "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", - "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", + "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", + "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.processingLevel=function (element) {pm.expect(element.Name).eq('processingLevel');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');};", @@ -17491,8 +17491,8 @@ "test_schema.productType=function (num) {pm.expect(num).to.be.eq(1)};", "test_schema.timeliness=function (num) {pm.expect(num).to.be.eq(1)};", "test_schema.cloudCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", - "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", + "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.orbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastOrbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.relativeOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", @@ -17680,8 +17680,8 @@ "test_map.cloudCover=function (element) {pm.expect(element.Name).eq('cloudCover');pm.expect(element.ValueType).eq('Double');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.lastOrbitNumber=function (element) {pm.expect(element.Name).eq('lastOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", - "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", - "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", + "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", + "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.processingLevel=function (element) {pm.expect(element.Name).eq('processingLevel');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\",\"2\"]);};", @@ -17708,9 +17708,9 @@ "test_schema.operationalMode=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.productType=function (num) {pm.expect(num).to.be.eq(1)};", "test_schema.timeliness=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.cloudCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", - "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", + "test_schema.cloudCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.orbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastOrbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.relativeOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", @@ -17722,12 +17722,12 @@ "test_schema.processorVersion=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.coordinates=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.baselineCollection=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.snowOrIceCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.salineWaterCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.coastalCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.freshInlandWaterCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.tidalRegionCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.landCover=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.snowOrIceCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.salineWaterCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.coastalCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.freshInlandWaterCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.tidalRegionCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.landCover=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastRelativeOrbitNumber=function (num) {pm.expect(num).to.be.within(0,2)};", "", " ", @@ -17919,8 +17919,8 @@ "test_map.cloudCover=function (element) {pm.expect(element.Name).eq('cloudCover');pm.expect(element.ValueType).eq('Double');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.lastOrbitNumber=function (element) {pm.expect(element.Name).eq('lastOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", - "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", - "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", + "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", + "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.processingLevel=function (element) {pm.expect(element.Name).eq('processingLevel');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\",\"2\"]);};", @@ -17947,9 +17947,9 @@ "test_schema.operationalMode=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.productType=function (num) {pm.expect(num).to.be.eq(1)};", "test_schema.timeliness=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.cloudCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", - "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", + "test_schema.cloudCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.orbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastOrbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.relativeOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", @@ -17961,12 +17961,12 @@ "test_schema.processorVersion=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.coordinates=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.baselineCollection=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.brightCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.salineWaterCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.coastalCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.freshInlandWaterCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.tidalRegionCover=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.landCover=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.brightCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.salineWaterCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.coastalCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.freshInlandWaterCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.tidalRegionCover=function (num) {pm.expect(num).to.be.within(0,1)};", + "test_schema.landCover=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastRelativeOrbitNumber=function (num) {pm.expect(num).to.be.within(0,2)};", "", " ", @@ -18152,8 +18152,8 @@ "test_map.timeliness=function (element) {pm.expect(element.Name).eq('timeliness');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"NR\",\"NT\",\"ST\",\"AL\"]);};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.lastOrbitNumber=function (element) {pm.expect(element.Name).eq('lastOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", - "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", - "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", + "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", + "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.processingLevel=function (element) {pm.expect(element.Name).eq('processingLevel');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"1\"]);};", @@ -18174,8 +18174,8 @@ "test_schema.operationalMode=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.productType=function (num) {pm.expect(num).to.be.eq(1)};", "test_schema.timeliness=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", - "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", + "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.orbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastOrbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.relativeOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", @@ -19998,8 +19998,8 @@ "test_map.timeliness=function (element) {pm.expect(element.Name).eq('timeliness');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"NR\",\"NT\",\"ST\",\"AL\"]);};", "test_map.orbitNumber=function (element) {pm.expect(element.Name).eq('orbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", "test_map.lastOrbitNumber=function (element) {pm.expect(element.Name).eq('lastOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");};", - "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", - "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\"]);};", + "test_map.orbitDirection=function (element) {pm.expect(element.Name).eq('orbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", + "test_map.lastOrbitDirection=function (element) {pm.expect(element.Name).eq('lastOrbitDirection');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"ASCENDING\",\"DESCENDING\",\"ascending\",\"descending\"]);};", "test_map.relativeOrbitNumber=function (element) {pm.expect(element.Name).eq('relativeOrbitNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.cycleNumber=function (element) {pm.expect(element.Name).eq('cycleNumber');pm.expect(element.ValueType).eq('Integer');pm.expect(element.Value).to.be.a(\"number\");pm.expect(element.Value).to.match(/([1-9]|[1-8][0-9]|9[0-9]|[12][0-9]{2}|3[0-7][0-9]|38[0-5])/);};", "test_map.processingLevel=function (element) {pm.expect(element.Name).eq('processingLevel');pm.expect(element.ValueType).eq('String');pm.expect(element.Value).to.be.a('string');pm.expect(element.Value).to.be.oneOf([\"0\"]);};", @@ -20020,8 +20020,8 @@ "test_schema.operationalMode=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.productType=function (num) {pm.expect(num).to.be.eq(1)};", "test_schema.timeliness=function (num) {pm.expect(num).to.be.eq(1)};", - "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", - "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", + "test_schema.orbitNumber=function (num) {pm.expect(num).to.be.eq(1)};", + "test_schema.lastOrbitNumber=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.orbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.lastOrbitDirection=function (num) {pm.expect(num).to.be.within(0,1)};", "test_schema.relativeOrbitNumber=function (num) {pm.expect(num).to.be.within(1,2)};", @@ -20223,7648 +20223,7977 @@ "protocolProfileBehavior": {} }, { - "name": "Filters", + "name": "LTA", "item": [ { - "name": "Dynamic_filters", - "event": [ - { - "listen": "test", - "script": { - "id": "", - "exec": [ - "const supportedOperators = [\"eq\", \"ne\", \"gt\", \"ge\", \"lt\", \"le\", \"and\", \"or\", \"not\"];", - "const supportedFunctions = [\"startswith\", \"contains\", \"endswith\"];", - "", - "function compare(a, b){", - " if(isNaN(a)){", - " return String(a).localeCompare(String(b));", - " } else {", - " return a > b;", - " } ", - "}", - "", - "function getOperator(inputString, possibleOperators) {", - " var op = null;", - " possibleOperators.forEach(function (el) { if (inputString.indexOf(el) >= 0) { op = el; } });", - " return op;", - "}", - "", - "function opToJsFormat(op) {", - " res = null;", - " switch (op) {", - " case \"and\":", - " return \"&&\";", - " case \"or\":", - " return \"||\";", - " case \"not\":", - " return \"!\";", - " case \"eq\":", - " return \"==\";", - " case \"ne\":", - " return \"!=\";", - " case \"gt\":", - " return \">\";", - " case \"ge\":", - " return \">=\";", - " case \"lt\":", - " return \"<\";", - " case \"le\":", - " return \"<=\";", - " }", - "}", - "", - "function get_query_filters(input_query) {", - "", - " console.log(\"Parsing Filter...\");", - "", - " var matcher = /(contains\\((.+?)\\)|startswith\\((.+?)\\)|endswith\\((.+?)\\)|any\\(.*?\\)|ContentDate\\/Start.*Z|ContentDate\\/End.*Z|[\\w.]+?\\s(?:eq|ne|gt|ge|lt|le)\\s(?:\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)|[+-]?([0-9]*[.])?[0-9]+|\\w+|'.+?'))/g", - "", - " var filters = input_query.match(matcher);", - " var i = 0;", - " var simpleString = input_query.replace(matcher, function () {", - " return i++;", - " });", - "", - " console.log(simpleString);", - " console.log(filters);", - "", - " var filterString = simpleString;", - "", - " var groupString;", - " var groupFilter = null;", - " var testNextLevel = true;", - "", - " while (testNextLevel) {", - " var closeParenthesisIndex = filterString.indexOf(')');", - " if (closeParenthesisIndex !== -1) {", - " var openParenthesisIndex = filterString.lastIndexOf('(', closeParenthesisIndex);", - "", - " // Extract the string between the first deepest set of parenthesis", - " groupString = filterString.substring(openParenthesisIndex + 1, closeParenthesisIndex);", - "", - " // Modify the filter string replacing the contents of the group string in addition to the parenthesis with the length of the filters array (which will be the index of the filter object that we push)", - " filterString = filterString.substring(0, openParenthesisIndex) + filters.length + filterString.substring(closeParenthesisIndex + 1);", - " } else {", - "", - " // There are no more parenthesis groups", - " groupString = filterString;", - " testNextLevel = false;", - " }", - "", - " // If the group uses both 'and' and 'or' then return null as an invalid filter string.", - " if (groupString.indexOf('and') >= 0 && groupString.indexOf('or') >= 0) {", - " console.log(\"Invalid Filter!\");", - " return null;", - " }", - "", - " // Get the group indexes out of the group string", - " var groupFilterIndexes = groupString.match(/[0-9]+/g);", - " var groupFilters = [];", - "", - " // Create an array with each of the filters who's index matches the group indexes", - " for (i = 0; i < groupFilterIndexes.length; i++) {", - " groupFilters.push(filters[Number(groupFilterIndexes[i])]);", - " }", - "", - " //cycling over the supported operators", - " var op = getOperator(groupString, supportedOperators);", - "", - " //redundant brakets management", - " if (op == null) {", - " groupFilters.push(\"true\");", - " op = \"and\";", - " }", - "", - " // Create the filter object and push it onto the filters array", - " groupFilter = { op: op, filters: groupFilters };", - " filters.push(groupFilter);", - " }", - "", - " return groupFilter;", - "", - "}", - "", - "function checkResponse(inputString, product) {", - " console.log(\"Input String: \" + inputString);", - " //console.log(\"Product:\");", - " //console.log(product);", - " var responseProperties = Object.keys(product);", - " var responseAttributes = {};", - "", - " //Attribute", - " if (inputString.includes(\"any(\") && inputString.includes(\"/Name\") && inputString.includes(\"/Value\")) {", - " //Attribute Logic Assertion", - " if (responseProperties.indexOf(\"Attributes\") >= 0) {", - " product['Attributes'].forEach(function (el) {", - " responseAttributes[el.Name] = el.Value;", - " });", - "", - " //functions in Attribute Value", - " var cleanedInputString = inputString.split(\"any(\").pop();", - " console.log(\"CLEANED ATTRIBUTE INPUTSTRING: \" + cleanedInputString);", - " if (cleanedInputString.includes(\"(\") && cleanedInputString.includes(\")\")) {", - " //get the function name", - " var functionName = cleanedInputString.split(\"(\")[0].split(\" \").pop();", - " if (supportedFunctions.indexOf(functionName) >= 0) {", - " console.log(\"Found Attribute Function: \" + functionName);", - " //get the attribute", - " var attrToCheck = cleanedInputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();", - " console.log(\"Attribute KEY Found: \" + attrToCheck);", - " //get the cleaned value", - " var attrValueToCheck = cleanedInputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");", - " console.log(\"Attribute VALUE Found: \" + attrValueToCheck);", - "", - " switch (functionName) {", - " case \"contains\":", - " attributesUnderTest.push(attrToCheck + \" contains \" + attrValueToCheck);", - " return (responseAttributes[attrToCheck].includes(attrValueToCheck)) ? true : false;", - " case \"startswith\":", - " attributesUnderTest.push(attrToCheck + \" startswith \" + attrValueToCheck);", - " return responseAttributes[attrToCheck].startsWith(attrValueToCheck) ? true : false;", - " case \"endswith\":", - " attributesUnderTest.push(attrToCheck + \" endswith \" + attrValueToCheck);", - " return responseAttributes[attrToCheck].endsWith(attrValueToCheck) ? true : false;", - " }", - " }", - " } else {", - " //simple any(Attributes Name and Value)", - " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();", - " console.log(\"Extracted Attribute KEY: \" + attrToCheck);", - " var attrValueToCheck = inputString.split('Value eq ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\\\/g, \"\");", - " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck);", - "", - " attributesUnderTest.push(\"attr:\" + attrToCheck + \" eq \" + attrValueToCheck);", - "", - " return responseAttributes[attrToCheck] == attrValueToCheck;", - " }", - " }", - " } else {", - " //inputString contains a function on a Property -> complex property not supported!", - " if (inputString.includes(\"(\") && inputString.includes(\")\")) {", - " //get the function name", - " var functionName = inputString.split(\"(\")[0];", - " if (supportedFunctions.indexOf(functionName) >= 0) {", - " console.log(\"Found Function: \" + functionName);", - " //get the property", - " var propertyToCheck = inputString.split(\"(\")[1].split(\",\")[0].trim();", - " console.log(\"Property Found: \" + propertyToCheck);", - "", - " //get the cleaned value", - " var propValueToCheck = inputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");", - " console.log(\"PropertyValue Found: \" + propValueToCheck);", - "", - " switch (functionName) {", - " case \"contains\":", - " propertiesUnderTest.push(propertyToCheck + \" contains \" + propValueToCheck);", - " return (product[propertyToCheck].includes(propValueToCheck)) ? true : false;", - " case \"startswith\":", - " propertiesUnderTest.push(propertyToCheck + \" startswith \" + propValueToCheck);", - " return product[propertyToCheck].startsWith(propValueToCheck) ? true : false;", - " case \"endswith\":", - " propertiesUnderTest.push(propertyToCheck + \" endswith \" + propValueToCheck);", - " return product[propertyToCheck].endsWith(propValueToCheck) ? true : false;", - " }", - " } else {", - " console.log(\"Unsupported Function: \" + functionName);", - " return false;", - " }", - " } else {", - " // single logic assertion in \"AND\" with \"true\"", - " if (inputString === \"true\") {", - " console.log(\"True Value!\");", - " return true;", - " } else {", - " //direct Property", - " var propertyToCheck = inputString.split(\" \")[0].trim();", - " var operatorToApply = inputString.split(\" \")[1];", - " var propValueToCheck = inputString.split(\" \")[2].trim().replace(/'/g, \"\");", - "", - " console.log(\"Property Found: \" + propertyToCheck);", - " console.log(\"PropertyValue Found: \" + propValueToCheck);", - "", - " if (supportedOperators.indexOf(operatorToApply) >= 0) {", - " console.log(\"Operator To Apply: \" + operatorToApply);", - " operator = opToJsFormat(operatorToApply);", - " propertiesUnderTest.push(propertyToCheck + \" \" + operatorToApply + \" \" + propValueToCheck);", - "", - " var toEvalString = \"\";", - " var subProperty = \"\";", - "", - " //Complex properties (ContentDate)", - " if(propertyToCheck.includes(\"/\")){", - " var rootPropertyToCheck = propertyToCheck.split(\"/\")[0];", - " subProperty = propertyToCheck.split(\"/\")[1];", - "", - " console.log(\"Complex Property: \" + rootPropertyToCheck);", - " console.log(\"Sub Property: \" + subProperty);", - "", - " toEvalString = \"product[rootPropertyToCheck][subProperty] \" + operator + \" propValueToCheck\";", - "", - " } else {", - " toEvalString = \"product[propertyToCheck] \" + operator + \" propValueToCheck\";", - " }", - "", - " return eval(toEvalString);", - " } else {", - " console.log(\"Operator not supported\");", - " return false;", - " }", - " }", - " }", - " }", - " console.log(\"Logic Assertion not computed: \" + inputString);", - " return Math.random() >= 0.5;", - "}", - "", - "function treeIterator(tree, product) {", - " if (tree['filters'].length >= 0) {", - " var conditions = [];", - "", - " var logicOperator = getOperator(tree['op'], supportedOperators);", - " var logicOperator = opToJsFormat(logicOperator);", - "", - " //general tree: iterates over all filters (child nodes)", - " for (elem in tree['filters']) {", - " var currentCondition = typeof ((tree['filters'][elem])) == \"object\" ? treeIterator(tree['filters'][elem], product) : checkResponse(tree['filters'][elem], product);", - " conditions.push(currentCondition);", - " //optimize AND and OR", - " if(logicOperator == \"||\" && currentCondition){", - " break;", - " }", - " if(logicOperator == \"&&\" && !currentCondition){", - " break;", - " }", - " }", - " console.log(\"CURRENT CONDITIONS\");", - " console.log(conditions);", - "", - " //building return string", - " var resString = \"(\";", - " for (elem in conditions) {", - " resString += conditions[elem] + \" \" + logicOperator.toString() + \" \";", - " }", - " resString = resString.substring(0, resString.length - 4);", - " resString += \")\";", - "", - " console.log(\"RES String: \" + resString);", - "", - " return resString;", - " }", - "}", - "", - "try {", - " var jsonDataElements = pm.response.json().value;", - "", - " console.log(\"Response: \");", - " console.log(jsonDataElements);", - "", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));", - " });", - "", - " //MIN number of Records Test", - " var minimumExpRecords = parseInt(pm.collectionVariables.get('resp_min_records'));", - " pm.test(\"Expected minimum number of products Test: \" + minimumExpRecords, function(){", - " pm.expect(jsonDataElements.length).to.be.gte(minimumExpRecords);", - " });", - "", - " //TOP and ORDERBY", - " var topFilterString = pm.request.url.getQueryString();", - " var topFilterValue = 0;", - "", - " if(topFilterString.includes(\"$top=\")){", - " topFilterValue = parseInt(topFilterString.split(\"$top=\").pop());", - " console.log(jsonDataElements.length);", - "", - " pm.test(\"TOP Filter - Response list lenght \" + jsonDataElements.length + \" is less or equal to TOP param Value: \" + topFilterValue, function(){", - " pm.expect(jsonDataElements.length).to.be.lte(topFilterValue);", - " });", - " }", - " ", - " var orderString = pm.request.url.getQueryString();", - " var orderParameters;", - "", - " if(orderString.includes(\"$orderby=\")){", - " orderParameters = decodeURIComponent(orderString.split(\"$orderby=\").pop().split(\"&\")[0]);", - "", - " var orderProperty = orderParameters;", - " var orderCriteria = \"asc\";", - "", - " if(orderParameters.includes(\" \")){", - " orderProperty = orderParameters.split(\" \")[0];", - " orderCriteria = orderParameters.split(\" \")[1];", - " }", - "", - " console.log(\"order Property: \" + orderProperty);", - " console.log(\"order Criteria: \" + orderCriteria);", - "", - " //if with complex Property management", - " if(orderProperty.includes(\"/\")){", - " var complexProperty = orderProperty.split(\"/\")[0];", - " var subProperty = orderProperty.split(\"/\").pop();", - "", - " console.log(complexProperty);", - " console.log(subProperty);", - "", - " var simplerSortingList = jsonDataElements.map(ex=>ex[complexProperty][subProperty]);", - " var serverSorting = jsonDataElements.map(ex=>ex[complexProperty][subProperty]);", - " } else {", - " var simplerSortingList = jsonDataElements.map(ex=>ex[orderProperty]);", - " var serverSorting = jsonDataElements.map(ex=>ex[orderProperty]);", - " }", - "", - " console.log(\"Unsorted list: \");", - " console.log(simplerSortingList);", - " ", - " simplerSortingList.sort(function(a, b){return compare(a, b)});", - "", - "", - " if(orderCriteria == \"desc\"){", - " simplerSortingList.reverse(); ", - " }", - "", - " console.log(\"Sorted list: \");", - " console.log(simplerSortingList);", - " ", - " pm.test(\"ORDERBY Filter Test - Sort check\", function(){", - " pm.expect(simplerSortingList).to.deep.equal(serverSorting);", - " });", - " }", - "", - " //FILTERS", - "", - " var parsed_filters;", - "", - " //POST or GET query", - " if (pm.request.method == \"POST\" && pm.request.body.raw) {", - " var productsFilters = JSON.parse(pm.request.body.raw);", - "", - " var jsonBodyToLogicAssertions = \"\";", - "", - " for (elem in productsFilters['products']) {", - " console.log(productsFilters['products'][elem]);", - " var currentAssertion = \"\";", - "", - " var keys = [];", - " for (var k in productsFilters['products'][elem]) keys.push(k);", - " //console.log(keys);", - " var currentKey = keys[0];", - " console.log(\"Current Key: \" + currentKey);", - "", - " var currentValue = productsFilters['products'][elem][currentKey].toString();", - " console.log(\"Current Value: \" + currentValue);", - "", - " currentAssertion = \"\" + currentKey + \" eq '\" + currentValue + \"'\";", - " jsonBodyToLogicAssertions += currentAssertion + \" or \";", - " }", - "", - " //cutting last \" or \"", - " jsonBodyToLogicAssertions = jsonBodyToLogicAssertions.substring(0, jsonBodyToLogicAssertions.length - 4);", - " console.log(\"PARSED POST: \" + jsonBodyToLogicAssertions);", - "", - " parsed_filters = get_query_filters(jsonBodyToLogicAssertions);", - "", - " } else if (pm.request.method == \"GET\" && pm.request.url.getQueryString().includes(\"$filter=\")) {", - " var filter_query = pm.request.url.getQueryString().split(\"$filter=\")[1];", - " filter_query = decodeURIComponent(filter_query.split(\"&\")[0]);", - " console.log(filter_query);", - " parsed_filters = get_query_filters(filter_query);", - "", - " }", - "", - " console.log(parsed_filters);", - "", - " var attributesUnderTest = [];", - " var propertiesUnderTest = [];", - "", - " if (typeof (parsed_filters) == \"object\") {", - " for (var counter = 0; counter < jsonDataElements.length; counter++) {", - "", - " attributesUnderTest = [];", - " propertiesUnderTest = [];", - "", - " var product = jsonDataElements[counter];", - " var treeExp = treeIterator(parsed_filters, product);", - " var booleanTreeExp = eval(treeExp);", - "", - " console.log(treeExp); console.log(booleanTreeExp);", - "", - " testMessage = product.Name;", - "", - " /*", - " if(attributesUnderTest.length > 0){", - " testMessage += \" \";", - " for(elem in attributesUnderTest){", - " testMessage += attributesUnderTest[elem] + \"; \";", - " }", - " }", - " if(propertiesUnderTest.length > 0){", - " testMessage += \" \";", - " for(elem in propertiesUnderTest){", - " testMessage += propertiesUnderTest[elem] + \"; \";", - " }", - " }", - " */", - "", - " pm.test(testMessage, function () {", - " pm.expect(booleanTreeExp).to.be.true;", - " });", - " }", - " }", - "}", - "", - "catch (err) {", - " pm.test(\"Filters Test\", function () {", - " pm.expect.fail(err.toString());", - " });", - "}" - ], - "type": "text/javascript" - } - }, + "name": "Filters", + "item": [ { - "listen": "prerequest", - "script": { - "id": "", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Dynamic_filters", + "event": [ { - "key": "password", - "value": "{{password}}", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "const supportedOperators = [\"eq\", \"ne\", \"gt\", \"ge\", \"lt\", \"le\", \"and\", \"or\", \"not\"];", + "const supportedFunctions = [\"startswith\", \"contains\", \"endswith\"];", + "", + "function compare(a, b){", + " if(isNaN(a)){", + " return String(a).localeCompare(String(b));", + " } else {", + " return a > b;", + " } ", + "}", + "", + "function getOperator(inputString, possibleOperators) {", + " var op = null;", + " possibleOperators.forEach(function (el) { if (inputString.indexOf(el) >= 0) { op = el; } });", + " return op;", + "}", + "", + "function opToJsFormat(op) {", + " res = null;", + " switch (op) {", + " case \"and\":", + " return \"&&\";", + " case \"or\":", + " return \"||\";", + " case \"not\":", + " return \"!\";", + " case \"eq\":", + " return \"==\";", + " case \"ne\":", + " return \"!=\";", + " case \"gt\":", + " return \">\";", + " case \"ge\":", + " return \">=\";", + " case \"lt\":", + " return \"<\";", + " case \"le\":", + " return \"<=\";", + " }", + "}", + "", + "function get_query_filters(input_query) {", + "", + " console.log(\"Parsing Filter...\");", + "", + " var matcher = /(contains\\((.+?)\\)|startswith\\((.+?)\\)|endswith\\((.+?)\\)|any\\(.*?\\)|ContentDate\\/Start.*Z|ContentDate\\/End.*Z|[\\w.]+?\\s(?:eq|ne|gt|ge|lt|le)\\s(?:\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)|[+-]?([0-9]*[.])?[0-9]+|\\w+|'.+?'))/g", + "", + " var filters = input_query.match(matcher);", + " var i = 0;", + " var simpleString = input_query.replace(matcher, function () {", + " return i++;", + " });", + "", + " console.log(simpleString);", + " console.log(filters);", + "", + " var filterString = simpleString;", + "", + " var groupString;", + " var groupFilter = null;", + " var testNextLevel = true;", + "", + " while (testNextLevel) {", + " var closeParenthesisIndex = filterString.indexOf(')');", + " if (closeParenthesisIndex !== -1) {", + " var openParenthesisIndex = filterString.lastIndexOf('(', closeParenthesisIndex);", + "", + " // Extract the string between the first deepest set of parenthesis", + " groupString = filterString.substring(openParenthesisIndex + 1, closeParenthesisIndex);", + "", + " // Modify the filter string replacing the contents of the group string in addition to the parenthesis with the length of the filters array (which will be the index of the filter object that we push)", + " filterString = filterString.substring(0, openParenthesisIndex) + filters.length + filterString.substring(closeParenthesisIndex + 1);", + " } else {", + "", + " // There are no more parenthesis groups", + " groupString = filterString;", + " testNextLevel = false;", + " }", + "", + " // If the group uses both 'and' and 'or' then return null as an invalid filter string.", + " if (groupString.indexOf('and') >= 0 && groupString.indexOf('or') >= 0) {", + " console.log(\"Invalid Filter!\");", + " return null;", + " }", + "", + " // Get the group indexes out of the group string", + " var groupFilterIndexes = groupString.match(/[0-9]+/g);", + " var groupFilters = [];", + "", + " // Create an array with each of the filters who's index matches the group indexes", + " for (i = 0; i < groupFilterIndexes.length; i++) {", + " groupFilters.push(filters[Number(groupFilterIndexes[i])]);", + " }", + "", + " //cycling over the supported operators", + " var op = getOperator(groupString, supportedOperators);", + "", + " //redundant brakets management", + " if (op == null) {", + " groupFilters.push(\"true\");", + " op = \"and\";", + " }", + "", + " // Create the filter object and push it onto the filters array", + " groupFilter = { op: op, filters: groupFilters };", + " filters.push(groupFilter);", + " }", + "", + " return groupFilter;", + "", + "}", + "", + "function checkResponse(inputString, product) {", + " console.log(\"Input String: \" + inputString);", + " //console.log(\"Product:\");", + " //console.log(product);", + " var responseProperties = Object.keys(product);", + " var responseAttributes = {};", + "", + " //Attribute", + " if (inputString.includes(\"any(\") && inputString.includes(\"/Name\") && inputString.includes(\"/Value\")) {", + " //Attribute Logic Assertion", + " if (responseProperties.indexOf(\"Attributes\") >= 0) {", + " product['Attributes'].forEach(function (el) {", + " responseAttributes[el.Name] = el.Value;", + " });", + "", + " //functions in Attribute Value", + " var cleanedInputString = inputString.split(\"any(\").pop();", + " console.log(\"CLEANED ATTRIBUTE INPUTSTRING: \" + cleanedInputString);", + " if (cleanedInputString.includes(\"(\") && cleanedInputString.includes(\")\")) {", + " //get the function name", + " var functionName = cleanedInputString.split(\"(\")[0].split(\" \").pop();", + " if (supportedFunctions.indexOf(functionName) >= 0) {", + " console.log(\"Found Attribute Function: \" + functionName);", + " //get the attribute", + " var attrToCheck = cleanedInputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();", + " console.log(\"Attribute KEY Found: \" + attrToCheck);", + " //get the cleaned value", + " var attrValueToCheck = cleanedInputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");", + " console.log(\"Attribute VALUE Found: \" + attrValueToCheck);", + "", + " switch (functionName) {", + " case \"contains\":", + " attributesUnderTest.push(attrToCheck + \" contains \" + attrValueToCheck);", + " return (responseAttributes[attrToCheck].includes(attrValueToCheck)) ? true : false;", + " case \"startswith\":", + " attributesUnderTest.push(attrToCheck + \" startswith \" + attrValueToCheck);", + " return responseAttributes[attrToCheck].startsWith(attrValueToCheck) ? true : false;", + " case \"endswith\":", + " attributesUnderTest.push(attrToCheck + \" endswith \" + attrValueToCheck);", + " return responseAttributes[attrToCheck].endsWith(attrValueToCheck) ? true : false;", + " }", + " }", + " } else {", + " //simple any(Attributes Name and Value)", + " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();", + " console.log(\"Extracted Attribute KEY: \" + attrToCheck);", + " var attrValueToCheck = inputString.split('Value eq ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\\\/g, \"\");", + " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck);", + "", + " attributesUnderTest.push(\"attr:\" + attrToCheck + \" eq \" + attrValueToCheck);", + "", + " return responseAttributes[attrToCheck] == attrValueToCheck;", + " }", + " }", + " } else {", + " //inputString contains a function on a Property -> complex property not supported!", + " if (inputString.includes(\"(\") && inputString.includes(\")\")) {", + " //get the function name", + " var functionName = inputString.split(\"(\")[0];", + " if (supportedFunctions.indexOf(functionName) >= 0) {", + " console.log(\"Found Function: \" + functionName);", + " //get the property", + " var propertyToCheck = inputString.split(\"(\")[1].split(\",\")[0].trim();", + " console.log(\"Property Found: \" + propertyToCheck);", + "", + " //get the cleaned value", + " var propValueToCheck = inputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");", + " console.log(\"PropertyValue Found: \" + propValueToCheck);", + "", + " switch (functionName) {", + " case \"contains\":", + " propertiesUnderTest.push(propertyToCheck + \" contains \" + propValueToCheck);", + " return (product[propertyToCheck].includes(propValueToCheck)) ? true : false;", + " case \"startswith\":", + " propertiesUnderTest.push(propertyToCheck + \" startswith \" + propValueToCheck);", + " return product[propertyToCheck].startsWith(propValueToCheck) ? true : false;", + " case \"endswith\":", + " propertiesUnderTest.push(propertyToCheck + \" endswith \" + propValueToCheck);", + " return product[propertyToCheck].endsWith(propValueToCheck) ? true : false;", + " }", + " } else {", + " console.log(\"Unsupported Function: \" + functionName);", + " return false;", + " }", + " } else {", + " // single logic assertion in \"AND\" with \"true\"", + " if (inputString === \"true\") {", + " console.log(\"True Value!\");", + " return true;", + " } else {", + " //direct Property", + " var propertyToCheck = inputString.split(\" \")[0].trim();", + " var operatorToApply = inputString.split(\" \")[1];", + " var propValueToCheck = inputString.split(\" \")[2].trim().replace(/'/g, \"\");", + "", + " console.log(\"Property Found: \" + propertyToCheck);", + " console.log(\"PropertyValue Found: \" + propValueToCheck);", + "", + " if (supportedOperators.indexOf(operatorToApply) >= 0) {", + " console.log(\"Operator To Apply: \" + operatorToApply);", + " operator = opToJsFormat(operatorToApply);", + " propertiesUnderTest.push(propertyToCheck + \" \" + operatorToApply + \" \" + propValueToCheck);", + "", + " var toEvalString = \"\";", + " var subProperty = \"\";", + "", + " //Complex properties (ContentDate)", + " if(propertyToCheck.includes(\"/\")){", + " var rootPropertyToCheck = propertyToCheck.split(\"/\")[0];", + " subProperty = propertyToCheck.split(\"/\")[1];", + "", + " console.log(\"Complex Property: \" + rootPropertyToCheck);", + " console.log(\"Sub Property: \" + subProperty);", + "", + " toEvalString = \"product[rootPropertyToCheck][subProperty] \" + operator + \" propValueToCheck\";", + "", + " } else {", + " toEvalString = \"product[propertyToCheck] \" + operator + \" propValueToCheck\";", + " }", + "", + " return eval(toEvalString);", + " } else {", + " console.log(\"Operator not supported\");", + " return false;", + " }", + " }", + " }", + " }", + " console.log(\"Logic Assertion not computed: \" + inputString);", + " return Math.random() >= 0.5;", + "}", + "", + "function treeIterator(tree, product) {", + " if (tree['filters'].length >= 0) {", + " var conditions = [];", + "", + " var logicOperator = getOperator(tree['op'], supportedOperators);", + " var logicOperator = opToJsFormat(logicOperator);", + "", + " //general tree: iterates over all filters (child nodes)", + " for (elem in tree['filters']) {", + " var currentCondition = typeof ((tree['filters'][elem])) == \"object\" ? treeIterator(tree['filters'][elem], product) : checkResponse(tree['filters'][elem], product);", + " conditions.push(currentCondition);", + " //optimize AND and OR", + " if(logicOperator == \"||\" && currentCondition){", + " break;", + " }", + " if(logicOperator == \"&&\" && !currentCondition){", + " break;", + " }", + " }", + " console.log(\"CURRENT CONDITIONS\");", + " console.log(conditions);", + "", + " //building return string", + " var resString = \"(\";", + " for (elem in conditions) {", + " resString += conditions[elem] + \" \" + logicOperator.toString() + \" \";", + " }", + " resString = resString.substring(0, resString.length - 4);", + " resString += \")\";", + "", + " console.log(\"RES String: \" + resString);", + "", + " return resString;", + " }", + "}", + "", + "try {", + " var jsonDataElements = pm.response.json().value;", + "", + " console.log(\"Response: \");", + " console.log(jsonDataElements);", + "", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));", + " });", + "", + " //MIN number of Records Test", + " var minimumExpRecords = parseInt(pm.collectionVariables.get('resp_min_records'));", + " pm.test(\"Expected minimum number of products Test: \" + minimumExpRecords, function(){", + " pm.expect(jsonDataElements.length).to.be.gte(minimumExpRecords);", + " });", + "", + " //TOP and ORDERBY", + " var topFilterString = pm.request.url.getQueryString();", + " var topFilterValue = 0;", + "", + " if(topFilterString.includes(\"$top=\")){", + " topFilterValue = parseInt(topFilterString.split(\"$top=\").pop());", + " console.log(jsonDataElements.length);", + "", + " pm.test(\"TOP Filter - Response list lenght \" + jsonDataElements.length + \" is less or equal to TOP param Value: \" + topFilterValue, function(){", + " pm.expect(jsonDataElements.length).to.be.lte(topFilterValue);", + " });", + " }", + " ", + " var orderString = pm.request.url.getQueryString();", + " var orderParameters;", + "", + " if(orderString.includes(\"$orderby=\")){", + " orderParameters = decodeURIComponent(orderString.split(\"$orderby=\").pop().split(\"&\")[0]);", + "", + " var orderProperty = orderParameters;", + " var orderCriteria = \"asc\";", + "", + " if(orderParameters.includes(\" \")){", + " orderProperty = orderParameters.split(\" \")[0];", + " orderCriteria = orderParameters.split(\" \")[1];", + " }", + "", + " console.log(\"order Property: \" + orderProperty);", + " console.log(\"order Criteria: \" + orderCriteria);", + "", + " //if with complex Property management", + " if(orderProperty.includes(\"/\")){", + " var complexProperty = orderProperty.split(\"/\")[0];", + " var subProperty = orderProperty.split(\"/\").pop();", + "", + " console.log(complexProperty);", + " console.log(subProperty);", + "", + " var simplerSortingList = jsonDataElements.map(ex=>ex[complexProperty][subProperty]);", + " var serverSorting = jsonDataElements.map(ex=>ex[complexProperty][subProperty]);", + " } else {", + " var simplerSortingList = jsonDataElements.map(ex=>ex[orderProperty]);", + " var serverSorting = jsonDataElements.map(ex=>ex[orderProperty]);", + " }", + "", + " console.log(\"Unsorted list: \");", + " console.log(simplerSortingList);", + " ", + " simplerSortingList.sort(function(a, b){return compare(a, b)});", + "", + "", + " if(orderCriteria == \"desc\"){", + " simplerSortingList.reverse(); ", + " }", + "", + " console.log(\"Sorted list: \");", + " console.log(simplerSortingList);", + " ", + " pm.test(\"ORDERBY Filter Test - Sort check\", function(){", + " pm.expect(simplerSortingList).to.deep.equal(serverSorting);", + " });", + " }", + "", + " //FILTERS", + "", + " var parsed_filters;", + "", + " //POST or GET query", + " if (pm.request.method == \"POST\" && pm.request.body.raw) {", + " var productsFilters = JSON.parse(pm.request.body.raw);", + "", + " var jsonBodyToLogicAssertions = \"\";", + "", + " for (elem in productsFilters['products']) {", + " console.log(productsFilters['products'][elem]);", + " var currentAssertion = \"\";", + "", + " var keys = [];", + " for (var k in productsFilters['products'][elem]) keys.push(k);", + " //console.log(keys);", + " var currentKey = keys[0];", + " console.log(\"Current Key: \" + currentKey);", + "", + " var currentValue = productsFilters['products'][elem][currentKey].toString();", + " console.log(\"Current Value: \" + currentValue);", + "", + " currentAssertion = \"\" + currentKey + \" eq '\" + currentValue + \"'\";", + " jsonBodyToLogicAssertions += currentAssertion + \" or \";", + " }", + "", + " //cutting last \" or \"", + " jsonBodyToLogicAssertions = jsonBodyToLogicAssertions.substring(0, jsonBodyToLogicAssertions.length - 4);", + " console.log(\"PARSED POST: \" + jsonBodyToLogicAssertions);", + "", + " parsed_filters = get_query_filters(jsonBodyToLogicAssertions);", + "", + " } else if (pm.request.method == \"GET\" && pm.request.url.getQueryString().includes(\"$filter=\")) {", + " var filter_query = pm.request.url.getQueryString().split(\"$filter=\")[1];", + " filter_query = decodeURIComponent(filter_query.split(\"&\")[0]);", + " console.log(filter_query);", + " parsed_filters = get_query_filters(filter_query);", + "", + " }", + "", + " console.log(parsed_filters);", + "", + " var attributesUnderTest = [];", + " var propertiesUnderTest = [];", + "", + " if (typeof (parsed_filters) == \"object\") {", + " for (var counter = 0; counter < jsonDataElements.length; counter++) {", + "", + " attributesUnderTest = [];", + " propertiesUnderTest = [];", + "", + " var product = jsonDataElements[counter];", + " var treeExp = treeIterator(parsed_filters, product);", + " var booleanTreeExp = eval(treeExp);", + "", + " console.log(treeExp); console.log(booleanTreeExp);", + "", + " testMessage = product.Name;", + "", + " /*", + " if(attributesUnderTest.length > 0){", + " testMessage += \" \";", + " for(elem in attributesUnderTest){", + " testMessage += attributesUnderTest[elem] + \"; \";", + " }", + " }", + " if(propertiesUnderTest.length > 0){", + " testMessage += \" \";", + " for(elem in propertiesUnderTest){", + " testMessage += propertiesUnderTest[elem] + \"; \";", + " }", + " }", + " */", + "", + " pm.test(testMessage, function () {", + " pm.expect(booleanTreeExp).to.be.true;", + " });", + " }", + " }", + "}", + "", + "catch (err) {", + " pm.test(\"Filters Test\", function () {", + " pm.expect.fail(err.toString());", + " });", + "}" + ], + "type": "text/javascript" + } }, { - "key": "username", - "value": "{{username}}", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Products?$top=10&$expand=Attributes", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Products" ], - "query": [ - { - "key": "$top", - "value": "10" - }, - { - "key": "$expand", - "value": "Attributes" - }, - { - "key": "$filter", - "value": "Name eq 'S1A_S5_GRDH_1SDV_20190826T063656_20190826T063715_028736_0340F7_6518.SAFE.zip'", - "description": "Simple Property Name", - "disabled": true - }, - { - "key": "$filter", - "value": "PublicationDate eq 2020-06-08T16:14:02.036Z", - "description": "Simple Property PublicationDate", - "disabled": true - }, - { - "key": "$filter", - "value": "ContentDate/Start eq 2019-08-26T06:36:56.989Z", - "description": "Complex Property ContentDate", - "disabled": true - }, - { - "key": "$filter", - "value": "ContentLength eq 5979870 and OriginDate eq 2020-06-22T15:33:15.998Z", - "description": "Properties Combination ContentLength OriginDate", - "disabled": true - }, - { - "key": "$orderby", - "value": "ContentDate/Start desc", - "description": "TOP and ORDERBY", - "disabled": true - }, - { - "key": "$filter", - "value": "Attributes/OData.CSC.DateTimeOffsetAttribute/any(att:att/Name eq 'processingDate' and att/OData.CSC.DateTimeOffsetAttribute/Value eq '2020-09-17T13:43:25.252809Z')", - "description": "Query by Attributes", - "disabled": true + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{password}}", + "type": "string" + }, + { + "key": "username", + "value": "{{username}}", + "type": "string" + } + ] }, - { - "key": "$filter", - "value": "contains(Name,'HK_RAW__') and Attributes/OData.CSC.StringAttribute/any(att:att/Name eq 'productType' and startswith(att/OData.CSC.StringAttribute/Value,'HK_RAW'))", - "description": "Function on Property combined with Attributes Query", - "disabled": true + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Products?$top=10&$expand=Attributes", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Products" + ], + "query": [ + { + "key": "$top", + "value": "10" + }, + { + "key": "$expand", + "value": "Attributes" + }, + { + "key": "$filter", + "value": "Name eq 'S1A_S5_GRDH_1SDV_20190826T063656_20190826T063715_028736_0340F7_6518.SAFE.zip'", + "description": "Simple Property Name", + "disabled": true + }, + { + "key": "$filter", + "value": "PublicationDate eq 2020-06-08T16:14:02.036Z", + "description": "Simple Property PublicationDate", + "disabled": true + }, + { + "key": "$filter", + "value": "ContentDate/Start eq 2019-08-26T06:36:56.989Z", + "description": "Complex Property ContentDate", + "disabled": true + }, + { + "key": "$filter", + "value": "ContentLength eq 5979870 and OriginDate eq 2020-06-22T15:33:15.998Z", + "description": "Properties Combination ContentLength OriginDate", + "disabled": true + }, + { + "key": "$orderby", + "value": "ContentDate/Start desc", + "description": "TOP and ORDERBY", + "disabled": true + }, + { + "key": "$filter", + "value": "Attributes/OData.CSC.DateTimeOffsetAttribute/any(att:att/Name eq 'processingDate' and att/OData.CSC.DateTimeOffsetAttribute/Value eq '2020-09-17T13:43:25.252809Z')", + "description": "Query by Attributes", + "disabled": true + }, + { + "key": "$filter", + "value": "contains(Name,'HK_RAW__') and Attributes/OData.CSC.StringAttribute/any(att:att/Name eq 'productType' and startswith(att/OData.CSC.StringAttribute/Value,'HK_RAW'))", + "description": "Function on Property combined with Attributes Query", + "disabled": true + } + ] } - ] - } - }, - "response": [] - }, - { - "name": "POST FilterList", - "event": [ - { - "listen": "test", - "script": { - "id": "", - "exec": [ - "const supportedOperators = [\"eq\", \"ne\", \"gt\", \"ge\", \"lt\", \"le\", \"and\", \"or\", \"not\"];", - "const supportedFunctions = [\"startswith\", \"contains\", \"endswith\"];", - "", - "function compare(a, b){", - " if(isNaN(a)){", - " return String(a).localeCompare(String(b));", - " } else {", - " return a > b;", - " } ", - "}", - "", - "function getOperator(inputString, possibleOperators) {", - " var op = null;", - " possibleOperators.forEach(function (el) { if (inputString.indexOf(el) >= 0) { op = el; } });", - " return op;", - "}", - "", - "function opToJsFormat(op) {", - " res = null;", - " switch (op) {", - " case \"and\":", - " return \"&&\";", - " case \"or\":", - " return \"||\";", - " case \"not\":", - " return \"!\";", - " case \"eq\":", - " return \"==\";", - " case \"ne\":", - " return \"!=\";", - " case \"gt\":", - " return \">\";", - " case \"ge\":", - " return \">=\";", - " case \"lt\":", - " return \"<\";", - " case \"le\":", - " return \"<=\";", - " }", - "}", - "", - "function get_query_filters(input_query) {", - "", - " console.log(\"Parsing Filter...\");", - "", - " var matcher = /(contains\\((.+?)\\)|startswith\\((.+?)\\)|endswith\\((.+?)\\)|any\\(.*?\\)|ContentDate\\/Start.*Z|ContentDate\\/End.*Z|[\\w.]+?\\s(?:eq|ne|gt|ge|lt|le)\\s(?:\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)|[+-]?([0-9]*[.])?[0-9]+|\\w+|'.+?'))/g", - "", - " var filters = input_query.match(matcher);", - " var i = 0;", - " var simpleString = input_query.replace(matcher, function () {", - " return i++;", - " });", - "", - " console.log(simpleString);", - " console.log(filters);", - "", - " var filterString = simpleString;", - "", - " var groupString;", - " var groupFilter = null;", - " var testNextLevel = true;", - "", - " while (testNextLevel) {", - " var closeParenthesisIndex = filterString.indexOf(')');", - " if (closeParenthesisIndex !== -1) {", - " var openParenthesisIndex = filterString.lastIndexOf('(', closeParenthesisIndex);", - "", - " // Extract the string between the first deepest set of parenthesis", - " groupString = filterString.substring(openParenthesisIndex + 1, closeParenthesisIndex);", - "", - " // Modify the filter string replacing the contents of the group string in addition to the parenthesis with the length of the filters array (which will be the index of the filter object that we push)", - " filterString = filterString.substring(0, openParenthesisIndex) + filters.length + filterString.substring(closeParenthesisIndex + 1);", - " } else {", - "", - " // There are no more parenthesis groups", - " groupString = filterString;", - " testNextLevel = false;", - " }", - "", - " // If the group uses both 'and' and 'or' then return null as an invalid filter string.", - " if (groupString.indexOf('and') >= 0 && groupString.indexOf('or') >= 0) {", - " console.log(\"Invalid Filter!\");", - " return null;", - " }", - "", - " // Get the group indexes out of the group string", - " var groupFilterIndexes = groupString.match(/[0-9]+/g);", - " var groupFilters = [];", - "", - " // Create an array with each of the filters who's index matches the group indexes", - " for (i = 0; i < groupFilterIndexes.length; i++) {", - " groupFilters.push(filters[Number(groupFilterIndexes[i])]);", - " }", - "", - " //cycling over the supported operators", - " var op = getOperator(groupString, supportedOperators);", - "", - " //redundant brakets management", - " if (op == null) {", - " groupFilters.push(\"true\");", - " op = \"and\";", - " }", - "", - " // Create the filter object and push it onto the filters array", - " groupFilter = { op: op, filters: groupFilters };", - " filters.push(groupFilter);", - " }", - "", - " return groupFilter;", - "", - "}", - "", - "function checkResponse(inputString, product) {", - " console.log(\"Input String: \" + inputString);", - " //console.log(\"Product:\");", - " //console.log(product);", - " var responseProperties = Object.keys(product);", - " var responseAttributes = {};", - "", - " //Attribute", - " if (inputString.includes(\"any(\") && inputString.includes(\"/Name\") && inputString.includes(\"/Value\")) {", - " //Attribute Logic Assertion", - " if (responseProperties.indexOf(\"Attributes\") >= 0) {", - " product['Attributes'].forEach(function (el) {", - " responseAttributes[el.Name] = el.Value;", - " });", - "", - " //functions in Attribute Value", - " var cleanedInputString = inputString.split(\"any(\").pop();", - " console.log(\"CLEANED ATTRIBUTE INPUTSTRING: \" + cleanedInputString);", - " if (cleanedInputString.includes(\"(\") && cleanedInputString.includes(\")\")) {", - " //get the function name", - " var functionName = cleanedInputString.split(\"(\")[0].split(\" \").pop();", - " if (supportedFunctions.indexOf(functionName) >= 0) {", - " console.log(\"Found Attribute Function: \" + functionName);", - " //get the attribute", - " var attrToCheck = cleanedInputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();", - " console.log(\"Attribute KEY Found: \" + attrToCheck);", - " //get the cleaned value", - " var attrValueToCheck = cleanedInputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");", - " console.log(\"Attribute VALUE Found: \" + attrValueToCheck);", - "", - " switch (functionName) {", - " case \"contains\":", - " attributesUnderTest.push(attrToCheck + \" contains \" + attrValueToCheck);", - " return (responseAttributes[attrToCheck].includes(attrValueToCheck)) ? true : false;", - " case \"startswith\":", - " attributesUnderTest.push(attrToCheck + \" startswith \" + attrValueToCheck);", - " return responseAttributes[attrToCheck].startsWith(attrValueToCheck) ? true : false;", - " case \"endswith\":", - " attributesUnderTest.push(attrToCheck + \" endswith \" + attrValueToCheck);", - " return responseAttributes[attrToCheck].endsWith(attrValueToCheck) ? true : false;", - " }", - " }", - " } else {", - " //simple any(Attributes Name and Value)", - " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();", - " console.log(\"Extracted Attribute KEY: \" + attrToCheck);", - " var attrValueToCheck = inputString.split('Value eq ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\\\/g, \"\");", - " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck);", - "", - " attributesUnderTest.push(\"attr:\" + attrToCheck + \" eq \" + attrValueToCheck);", - "", - " return responseAttributes[attrToCheck] == attrValueToCheck;", - " }", - " }", - " } else {", - " //inputString contains a function on a Property -> complex property not supported!", - " if (inputString.includes(\"(\") && inputString.includes(\")\")) {", - " //get the function name", - " var functionName = inputString.split(\"(\")[0];", - " if (supportedFunctions.indexOf(functionName) >= 0) {", - " console.log(\"Found Function: \" + functionName);", - " //get the property", - " var propertyToCheck = inputString.split(\"(\")[1].split(\",\")[0].trim();", - " console.log(\"Property Found: \" + propertyToCheck);", - "", - " //get the cleaned value", - " var propValueToCheck = inputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");", - " console.log(\"PropertyValue Found: \" + propValueToCheck);", - "", - " switch (functionName) {", - " case \"contains\":", - " propertiesUnderTest.push(propertyToCheck + \" contains \" + propValueToCheck);", - " return (product[propertyToCheck].includes(propValueToCheck)) ? true : false;", - " case \"startswith\":", - " propertiesUnderTest.push(propertyToCheck + \" startswith \" + propValueToCheck);", - " return product[propertyToCheck].startsWith(propValueToCheck) ? true : false;", - " case \"endswith\":", - " propertiesUnderTest.push(propertyToCheck + \" endswith \" + propValueToCheck);", - " return product[propertyToCheck].endsWith(propValueToCheck) ? true : false;", - " }", - " } else {", - " console.log(\"Unsupported Function: \" + functionName);", - " return false;", - " }", - " } else {", - " // single logic assertion in \"AND\" with \"true\"", - " if (inputString === \"true\") {", - " console.log(\"True Value!\");", - " return true;", - " } else {", - " //direct Property", - " var propertyToCheck = inputString.split(\" \")[0].trim();", - " var operatorToApply = inputString.split(\" \")[1];", - " var propValueToCheck = inputString.split(\" \")[2].trim().replace(/'/g, \"\");", - "", - " console.log(\"Property Found: \" + propertyToCheck);", - " console.log(\"PropertyValue Found: \" + propValueToCheck);", - "", - " if (supportedOperators.indexOf(operatorToApply) >= 0) {", - " console.log(\"Operator To Apply: \" + operatorToApply);", - " operator = opToJsFormat(operatorToApply);", - " propertiesUnderTest.push(propertyToCheck + \" \" + operatorToApply + \" \" + propValueToCheck);", - "", - " var toEvalString = \"\";", - " var subProperty = \"\";", - "", - " //Complex properties (ContentDate)", - " if(propertyToCheck.includes(\"/\")){", - " var rootPropertyToCheck = propertyToCheck.split(\"/\")[0];", - " subProperty = propertyToCheck.split(\"/\")[1];", - "", - " console.log(\"Complex Property: \" + rootPropertyToCheck);", - " console.log(\"Sub Property: \" + subProperty);", - "", - " toEvalString = \"product[rootPropertyToCheck][subProperty] \" + operator + \" propValueToCheck\";", - "", - " } else {", - " toEvalString = \"product[propertyToCheck] \" + operator + \" propValueToCheck\";", - " }", - "", - " return eval(toEvalString);", - " } else {", - " console.log(\"Operator not supported\");", - " return false;", - " }", - " }", - " }", - " }", - " console.log(\"Logic Assertion not computed: \" + inputString);", - " return Math.random() >= 0.5;", - "}", - "", - "function treeIterator(tree, product) {", - " if (tree['filters'].length >= 0) {", - " var conditions = [];", - "", - " var logicOperator = getOperator(tree['op'], supportedOperators);", - " var logicOperator = opToJsFormat(logicOperator);", - "", - " //general tree: iterates over all filters (child nodes)", - " for (elem in tree['filters']) {", - " var currentCondition = typeof ((tree['filters'][elem])) == \"object\" ? treeIterator(tree['filters'][elem], product) : checkResponse(tree['filters'][elem], product);", - " conditions.push(currentCondition);", - " //optimize AND and OR", - " if(logicOperator == \"||\" && currentCondition){", - " break;", - " }", - " if(logicOperator == \"&&\" && !currentCondition){", - " break;", - " }", - " }", - " console.log(\"CURRENT CONDITIONS\");", - " console.log(conditions);", - "", - " //building return string", - " var resString = \"(\";", - " for (elem in conditions) {", - " resString += conditions[elem] + \" \" + logicOperator.toString() + \" \";", - " }", - " resString = resString.substring(0, resString.length - 4);", - " resString += \")\";", - "", - " console.log(\"RES String: \" + resString);", - "", - " return resString;", - " }", - "}", - "", - "try {", - " var jsonDataElements = pm.response.json().value;", - "", - " console.log(\"Response: \");", - " console.log(jsonDataElements);", - "", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));", - " });", - "", - " //MIN number of Records Test", - " var minimumExpRecords = parseInt(pm.collectionVariables.get('resp_min_records'));", - " pm.test(\"Expected minimum number of products Test: \" + minimumExpRecords, function(){", - " pm.expect(jsonDataElements.length).to.be.gte(minimumExpRecords);", - " });", - "", - " //TOP and ORDERBY", - " var topFilterString = pm.request.url.getQueryString();", - " var topFilterValue = 0;", - "", - " if(topFilterString.includes(\"$top=\")){", - " topFilterValue = parseInt(topFilterString.split(\"$top=\").pop());", - " console.log(jsonDataElements.length);", - "", - " pm.test(\"TOP Filter - Response list lenght \" + jsonDataElements.length + \" is less or equal to TOP param Value: \" + topFilterValue, function(){", - " pm.expect(jsonDataElements.length).to.be.lte(topFilterValue);", - " });", - " }", - " ", - " var orderString = pm.request.url.getQueryString();", - " var orderParameters;", - "", - " if(orderString.includes(\"$orderby=\")){", - " orderParameters = decodeURIComponent(orderString.split(\"$orderby=\").pop().split(\"&\")[0]);", - "", - " var orderProperty = orderParameters;", - " var orderCriteria = \"asc\";", - "", - " if(orderParameters.includes(\" \")){", - " orderProperty = orderParameters.split(\" \")[0];", - " orderCriteria = orderParameters.split(\" \")[1];", - " }", - "", - " console.log(\"order Property: \" + orderProperty);", - " console.log(\"order Criteria: \" + orderCriteria);", - "", - " //if with complex Property management", - " if(orderProperty.includes(\"/\")){", - " var complexProperty = orderProperty.split(\"/\")[0];", - " var subProperty = orderProperty.split(\"/\").pop();", - "", - " console.log(complexProperty);", - " console.log(subProperty);", - "", - " var simplerSortingList = jsonDataElements.map(ex=>ex[complexProperty][subProperty]);", - " var serverSorting = jsonDataElements.map(ex=>ex[complexProperty][subProperty]);", - " } else {", - " var simplerSortingList = jsonDataElements.map(ex=>ex[orderProperty]);", - " var serverSorting = jsonDataElements.map(ex=>ex[orderProperty]);", - " }", - "", - " console.log(\"Unsorted list: \");", - " console.log(simplerSortingList);", - " ", - " simplerSortingList.sort(function(a, b){return compare(a, b)});", - "", - "", - " if(orderCriteria == \"desc\"){", - " simplerSortingList.reverse(); ", - " }", - "", - " console.log(\"Sorted list: \");", - " console.log(simplerSortingList);", - " ", - " pm.test(\"ORDERBY Filter Test - Sort check\", function(){", - " pm.expect(simplerSortingList).to.deep.equal(serverSorting);", - " });", - " }", - "", - " //FILTERS", - "", - " var parsed_filters;", - "", - " //POST or GET query", - " if (pm.request.method == \"POST\" && pm.request.body.raw) {", - " var productsFilters = JSON.parse(pm.request.body.raw);", - "", - " var jsonBodyToLogicAssertions = \"\";", - "", - " for (elem in productsFilters['FilterProducts']) {", - " console.log(productsFilters['FilterProducts'][elem]);", - " var currentAssertion = \"\";", - "", - " var keys = [];", - " for (var k in productsFilters['FilterProducts'][elem]) keys.push(k);", - " //console.log(keys);", - " var currentKey = keys[0];", - " console.log(\"Current Key: \" + currentKey);", - "", - " var currentValue = productsFilters['FilterProducts'][elem][currentKey].toString();", - " console.log(\"Current Value: \" + currentValue);", - "", - " currentAssertion = \"\" + currentKey + \" eq '\" + currentValue + \"'\";", - " jsonBodyToLogicAssertions += currentAssertion + \" or \";", - " }", - "", - " //cutting last \" or \"", - " jsonBodyToLogicAssertions = jsonBodyToLogicAssertions.substring(0, jsonBodyToLogicAssertions.length - 4);", - " console.log(\"PARSED POST: \" + jsonBodyToLogicAssertions);", - "", - " parsed_filters = get_query_filters(jsonBodyToLogicAssertions);", - "", - " } else if (pm.request.method == \"GET\" && pm.request.url.getQueryString().includes(\"$filter=\")) {", - " var filter_query = pm.request.url.getQueryString().split(\"$filter=\")[1];", - " filter_query = decodeURIComponent(filter_query.split(\"&\")[0]);", - " console.log(filter_query);", - " parsed_filters = get_query_filters(filter_query);", - "", - " }", - "", - " console.log(parsed_filters);", - "", - " var attributesUnderTest = [];", - " var propertiesUnderTest = [];", - "", - " if (typeof (parsed_filters) == \"object\") {", - " for (var counter = 0; counter < jsonDataElements.length; counter++) {", - "", - " attributesUnderTest = [];", - " propertiesUnderTest = [];", - "", - " var product = jsonDataElements[counter];", - " var treeExp = treeIterator(parsed_filters, product);", - " var booleanTreeExp = eval(treeExp);", - "", - " console.log(treeExp); console.log(booleanTreeExp);", - "", - " testMessage = product.Name;", - "", - " /*", - " if(attributesUnderTest.length > 0){", - " testMessage += \" \";", - " for(elem in attributesUnderTest){", - " testMessage += attributesUnderTest[elem] + \"; \";", - " }", - " }", - " if(propertiesUnderTest.length > 0){", - " testMessage += \" \";", - " for(elem in propertiesUnderTest){", - " testMessage += propertiesUnderTest[elem] + \"; \";", - " }", - " }", - " */", - "", - " pm.test(testMessage, function () {", - " pm.expect(booleanTreeExp).to.be.true;", - " });", - " }", - " }", - "}", - "", - "catch (err) {", - " pm.test(\"Filters Test\", function () {", - " pm.expect.fail(err.toString());", - " });", - "}" - ], - "type": "text/javascript" - } + }, + "response": [] }, { - "listen": "prerequest", - "script": { - "id": "", - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "{{password}}", - "type": "string" - }, + "name": "POST FilterList", + "event": [ { - "key": "username", - "value": "{{username}}", - "type": "string" - } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\"FilterProducts\":[\r\n\t{\"Name\": \"S1A_IW_GRDH_1SDV_20200121T201716_20200121T201741_030903_038C0F_DAEC.SAFE.zip\"},\r\n\t{\"Name\": \"S1A_EW_GRDM_1ADH_20200121T014322_20200121T014427_030892_038BA2_CD80.SAFE.zip\"},\r\n\t{\"Name\": \"S1A_S4_GRDH_1SDV_20190827T045540_20190827T045605_028750_03416A_B108.SAFE.zip\"}\r\n]}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/Products/OData.CSC.FilterList", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Products", - "OData.CSC.FilterList" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Orders", - "item": [ - { - "name": "Get_Offline_Products", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "try {\r", - " var jsonDataElements = pm.response.json().value;\r", - "\r", - " console.log(\"Response: \");\r", - " console.log(jsonDataElements);\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " //MIN number of Records Test\r", - " var minimumExpRecords = parseInt(pm.collectionVariables.get('resp_min_records'));\r", - " pm.test(\"Expected minimum number of products Test: \" + minimumExpRecords, function(){\r", - " pm.expect(jsonDataElements.length).to.be.gte(minimumExpRecords);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " query_string = pm.request.url.getQueryString();\r", - " if(query_string.includes(\"$expand=Attributes\")){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Products(Attributes())\");\r", - " } else{\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Products\");\r", - " }\r", - " });\r", - "\r", - " for (var counter = 0; counter < jsonDataElements.length; counter++){\r", - " var product = jsonDataElements[counter];\r", - " console.log(\"Processing Product: \"+product.Name+\" - \"+product.Id);\r", - "\r", - " pm.test(\"Test Properties for product: \" + product.Id, function(){\r", - " pm.expect(product).to.have.property(\"Id\");\r", - " pm.expect(product.Id).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"Name\");\r", - " pm.expect(product.Name).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"ContentType\");\r", - " pm.expect(product.ContentType).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"ContentLength\");\r", - " pm.expect(product.ContentLength).to.be.a(\"number\");\r", - " pm.expect(product).to.have.property(\"OriginDate\");\r", - " pm.expect(product.OriginDate).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"PublicationDate\");\r", - " pm.expect(product.PublicationDate).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"ModificationDate\");\r", - " pm.expect(product.ModificationDate).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"Online\");\r", - " pm.expect(product.Online).to.be.a(\"boolean\");\r", - " pm.expect(product).to.have.property(\"Checksum\");\r", - " pm.expect(product.Checksum).to.be.an(\"array\");\r", - " pm.expect(product).to.have.property(\"ContentDate\");\r", - " pm.expect(product.ContentDate).to.be.an(\"object\");\r", - " }); \r", - " \r", - " if(\"Attributes\" in jsonDataElements[counter]){\r", - " schema_seen = {};\r", - "\r", - " pm.test(\"Test Attributes list for product: \" + jsonDataElements[counter].Id, function(){\r", - " pm.expect(jsonDataElements[counter].Attributes.length).to.be.above(0);\r", - " jsonDataElements[counter].Attributes.forEach(function(elem){\r", - " pm.expect(elem).to.have.all.keys(\"Name\", \"Value\", \"ValueType\");\r", - " });\r", - " }); \r", - " }\r", - " }\r", - "\r", - " pm.collectionVariables.set('offline_products', jsonDataElements);\r", - " \r", - "}\r", - "\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "{{password}}", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "const supportedOperators = [\"eq\", \"ne\", \"gt\", \"ge\", \"lt\", \"le\", \"and\", \"or\", \"not\"];", + "const supportedFunctions = [\"startswith\", \"contains\", \"endswith\"];", + "", + "function compare(a, b){", + " if(isNaN(a)){", + " return String(a).localeCompare(String(b));", + " } else {", + " return a > b;", + " } ", + "}", + "", + "function getOperator(inputString, possibleOperators) {", + " var op = null;", + " possibleOperators.forEach(function (el) { if (inputString.indexOf(el) >= 0) { op = el; } });", + " return op;", + "}", + "", + "function opToJsFormat(op) {", + " res = null;", + " switch (op) {", + " case \"and\":", + " return \"&&\";", + " case \"or\":", + " return \"||\";", + " case \"not\":", + " return \"!\";", + " case \"eq\":", + " return \"==\";", + " case \"ne\":", + " return \"!=\";", + " case \"gt\":", + " return \">\";", + " case \"ge\":", + " return \">=\";", + " case \"lt\":", + " return \"<\";", + " case \"le\":", + " return \"<=\";", + " }", + "}", + "", + "function get_query_filters(input_query) {", + "", + " console.log(\"Parsing Filter...\");", + "", + " var matcher = /(contains\\((.+?)\\)|startswith\\((.+?)\\)|endswith\\((.+?)\\)|any\\(.*?\\)|ContentDate\\/Start.*Z|ContentDate\\/End.*Z|[\\w.]+?\\s(?:eq|ne|gt|ge|lt|le)\\s(?:\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)|[+-]?([0-9]*[.])?[0-9]+|\\w+|'.+?'))/g", + "", + " var filters = input_query.match(matcher);", + " var i = 0;", + " var simpleString = input_query.replace(matcher, function () {", + " return i++;", + " });", + "", + " console.log(simpleString);", + " console.log(filters);", + "", + " var filterString = simpleString;", + "", + " var groupString;", + " var groupFilter = null;", + " var testNextLevel = true;", + "", + " while (testNextLevel) {", + " var closeParenthesisIndex = filterString.indexOf(')');", + " if (closeParenthesisIndex !== -1) {", + " var openParenthesisIndex = filterString.lastIndexOf('(', closeParenthesisIndex);", + "", + " // Extract the string between the first deepest set of parenthesis", + " groupString = filterString.substring(openParenthesisIndex + 1, closeParenthesisIndex);", + "", + " // Modify the filter string replacing the contents of the group string in addition to the parenthesis with the length of the filters array (which will be the index of the filter object that we push)", + " filterString = filterString.substring(0, openParenthesisIndex) + filters.length + filterString.substring(closeParenthesisIndex + 1);", + " } else {", + "", + " // There are no more parenthesis groups", + " groupString = filterString;", + " testNextLevel = false;", + " }", + "", + " // If the group uses both 'and' and 'or' then return null as an invalid filter string.", + " if (groupString.indexOf('and') >= 0 && groupString.indexOf('or') >= 0) {", + " console.log(\"Invalid Filter!\");", + " return null;", + " }", + "", + " // Get the group indexes out of the group string", + " var groupFilterIndexes = groupString.match(/[0-9]+/g);", + " var groupFilters = [];", + "", + " // Create an array with each of the filters who's index matches the group indexes", + " for (i = 0; i < groupFilterIndexes.length; i++) {", + " groupFilters.push(filters[Number(groupFilterIndexes[i])]);", + " }", + "", + " //cycling over the supported operators", + " var op = getOperator(groupString, supportedOperators);", + "", + " //redundant brakets management", + " if (op == null) {", + " groupFilters.push(\"true\");", + " op = \"and\";", + " }", + "", + " // Create the filter object and push it onto the filters array", + " groupFilter = { op: op, filters: groupFilters };", + " filters.push(groupFilter);", + " }", + "", + " return groupFilter;", + "", + "}", + "", + "function checkResponse(inputString, product) {", + " console.log(\"Input String: \" + inputString);", + " //console.log(\"Product:\");", + " //console.log(product);", + " var responseProperties = Object.keys(product);", + " var responseAttributes = {};", + "", + " //Attribute", + " if (inputString.includes(\"any(\") && inputString.includes(\"/Name\") && inputString.includes(\"/Value\")) {", + " //Attribute Logic Assertion", + " if (responseProperties.indexOf(\"Attributes\") >= 0) {", + " product['Attributes'].forEach(function (el) {", + " responseAttributes[el.Name] = el.Value;", + " });", + "", + " //functions in Attribute Value", + " var cleanedInputString = inputString.split(\"any(\").pop();", + " console.log(\"CLEANED ATTRIBUTE INPUTSTRING: \" + cleanedInputString);", + " if (cleanedInputString.includes(\"(\") && cleanedInputString.includes(\")\")) {", + " //get the function name", + " var functionName = cleanedInputString.split(\"(\")[0].split(\" \").pop();", + " if (supportedFunctions.indexOf(functionName) >= 0) {", + " console.log(\"Found Attribute Function: \" + functionName);", + " //get the attribute", + " var attrToCheck = cleanedInputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();", + " console.log(\"Attribute KEY Found: \" + attrToCheck);", + " //get the cleaned value", + " var attrValueToCheck = cleanedInputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");", + " console.log(\"Attribute VALUE Found: \" + attrValueToCheck);", + "", + " switch (functionName) {", + " case \"contains\":", + " attributesUnderTest.push(attrToCheck + \" contains \" + attrValueToCheck);", + " return (responseAttributes[attrToCheck].includes(attrValueToCheck)) ? true : false;", + " case \"startswith\":", + " attributesUnderTest.push(attrToCheck + \" startswith \" + attrValueToCheck);", + " return responseAttributes[attrToCheck].startsWith(attrValueToCheck) ? true : false;", + " case \"endswith\":", + " attributesUnderTest.push(attrToCheck + \" endswith \" + attrValueToCheck);", + " return responseAttributes[attrToCheck].endsWith(attrValueToCheck) ? true : false;", + " }", + " }", + " } else {", + " //simple any(Attributes Name and Value)", + " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();", + " console.log(\"Extracted Attribute KEY: \" + attrToCheck);", + " var attrValueToCheck = inputString.split('Value eq ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\\\/g, \"\");", + " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck);", + "", + " attributesUnderTest.push(\"attr:\" + attrToCheck + \" eq \" + attrValueToCheck);", + "", + " return responseAttributes[attrToCheck] == attrValueToCheck;", + " }", + " }", + " } else {", + " //inputString contains a function on a Property -> complex property not supported!", + " if (inputString.includes(\"(\") && inputString.includes(\")\")) {", + " //get the function name", + " var functionName = inputString.split(\"(\")[0];", + " if (supportedFunctions.indexOf(functionName) >= 0) {", + " console.log(\"Found Function: \" + functionName);", + " //get the property", + " var propertyToCheck = inputString.split(\"(\")[1].split(\",\")[0].trim();", + " console.log(\"Property Found: \" + propertyToCheck);", + "", + " //get the cleaned value", + " var propValueToCheck = inputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");", + " console.log(\"PropertyValue Found: \" + propValueToCheck);", + "", + " switch (functionName) {", + " case \"contains\":", + " propertiesUnderTest.push(propertyToCheck + \" contains \" + propValueToCheck);", + " return (product[propertyToCheck].includes(propValueToCheck)) ? true : false;", + " case \"startswith\":", + " propertiesUnderTest.push(propertyToCheck + \" startswith \" + propValueToCheck);", + " return product[propertyToCheck].startsWith(propValueToCheck) ? true : false;", + " case \"endswith\":", + " propertiesUnderTest.push(propertyToCheck + \" endswith \" + propValueToCheck);", + " return product[propertyToCheck].endsWith(propValueToCheck) ? true : false;", + " }", + " } else {", + " console.log(\"Unsupported Function: \" + functionName);", + " return false;", + " }", + " } else {", + " // single logic assertion in \"AND\" with \"true\"", + " if (inputString === \"true\") {", + " console.log(\"True Value!\");", + " return true;", + " } else {", + " //direct Property", + " var propertyToCheck = inputString.split(\" \")[0].trim();", + " var operatorToApply = inputString.split(\" \")[1];", + " var propValueToCheck = inputString.split(\" \")[2].trim().replace(/'/g, \"\");", + "", + " console.log(\"Property Found: \" + propertyToCheck);", + " console.log(\"PropertyValue Found: \" + propValueToCheck);", + "", + " if (supportedOperators.indexOf(operatorToApply) >= 0) {", + " console.log(\"Operator To Apply: \" + operatorToApply);", + " operator = opToJsFormat(operatorToApply);", + " propertiesUnderTest.push(propertyToCheck + \" \" + operatorToApply + \" \" + propValueToCheck);", + "", + " var toEvalString = \"\";", + " var subProperty = \"\";", + "", + " //Complex properties (ContentDate)", + " if(propertyToCheck.includes(\"/\")){", + " var rootPropertyToCheck = propertyToCheck.split(\"/\")[0];", + " subProperty = propertyToCheck.split(\"/\")[1];", + "", + " console.log(\"Complex Property: \" + rootPropertyToCheck);", + " console.log(\"Sub Property: \" + subProperty);", + "", + " toEvalString = \"product[rootPropertyToCheck][subProperty] \" + operator + \" propValueToCheck\";", + "", + " } else {", + " toEvalString = \"product[propertyToCheck] \" + operator + \" propValueToCheck\";", + " }", + "", + " return eval(toEvalString);", + " } else {", + " console.log(\"Operator not supported\");", + " return false;", + " }", + " }", + " }", + " }", + " console.log(\"Logic Assertion not computed: \" + inputString);", + " return Math.random() >= 0.5;", + "}", + "", + "function treeIterator(tree, product) {", + " if (tree['filters'].length >= 0) {", + " var conditions = [];", + "", + " var logicOperator = getOperator(tree['op'], supportedOperators);", + " var logicOperator = opToJsFormat(logicOperator);", + "", + " //general tree: iterates over all filters (child nodes)", + " for (elem in tree['filters']) {", + " var currentCondition = typeof ((tree['filters'][elem])) == \"object\" ? treeIterator(tree['filters'][elem], product) : checkResponse(tree['filters'][elem], product);", + " conditions.push(currentCondition);", + " //optimize AND and OR", + " if(logicOperator == \"||\" && currentCondition){", + " break;", + " }", + " if(logicOperator == \"&&\" && !currentCondition){", + " break;", + " }", + " }", + " console.log(\"CURRENT CONDITIONS\");", + " console.log(conditions);", + "", + " //building return string", + " var resString = \"(\";", + " for (elem in conditions) {", + " resString += conditions[elem] + \" \" + logicOperator.toString() + \" \";", + " }", + " resString = resString.substring(0, resString.length - 4);", + " resString += \")\";", + "", + " console.log(\"RES String: \" + resString);", + "", + " return resString;", + " }", + "}", + "", + "try {", + " var jsonDataElements = pm.response.json().value;", + "", + " console.log(\"Response: \");", + " console.log(jsonDataElements);", + "", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));", + " });", + "", + " //MIN number of Records Test", + " var minimumExpRecords = parseInt(pm.collectionVariables.get('resp_min_records'));", + " pm.test(\"Expected minimum number of products Test: \" + minimumExpRecords, function(){", + " pm.expect(jsonDataElements.length).to.be.gte(minimumExpRecords);", + " });", + "", + " //TOP and ORDERBY", + " var topFilterString = pm.request.url.getQueryString();", + " var topFilterValue = 0;", + "", + " if(topFilterString.includes(\"$top=\")){", + " topFilterValue = parseInt(topFilterString.split(\"$top=\").pop());", + " console.log(jsonDataElements.length);", + "", + " pm.test(\"TOP Filter - Response list lenght \" + jsonDataElements.length + \" is less or equal to TOP param Value: \" + topFilterValue, function(){", + " pm.expect(jsonDataElements.length).to.be.lte(topFilterValue);", + " });", + " }", + " ", + " var orderString = pm.request.url.getQueryString();", + " var orderParameters;", + "", + " if(orderString.includes(\"$orderby=\")){", + " orderParameters = decodeURIComponent(orderString.split(\"$orderby=\").pop().split(\"&\")[0]);", + "", + " var orderProperty = orderParameters;", + " var orderCriteria = \"asc\";", + "", + " if(orderParameters.includes(\" \")){", + " orderProperty = orderParameters.split(\" \")[0];", + " orderCriteria = orderParameters.split(\" \")[1];", + " }", + "", + " console.log(\"order Property: \" + orderProperty);", + " console.log(\"order Criteria: \" + orderCriteria);", + "", + " //if with complex Property management", + " if(orderProperty.includes(\"/\")){", + " var complexProperty = orderProperty.split(\"/\")[0];", + " var subProperty = orderProperty.split(\"/\").pop();", + "", + " console.log(complexProperty);", + " console.log(subProperty);", + "", + " var simplerSortingList = jsonDataElements.map(ex=>ex[complexProperty][subProperty]);", + " var serverSorting = jsonDataElements.map(ex=>ex[complexProperty][subProperty]);", + " } else {", + " var simplerSortingList = jsonDataElements.map(ex=>ex[orderProperty]);", + " var serverSorting = jsonDataElements.map(ex=>ex[orderProperty]);", + " }", + "", + " console.log(\"Unsorted list: \");", + " console.log(simplerSortingList);", + " ", + " simplerSortingList.sort(function(a, b){return compare(a, b)});", + "", + "", + " if(orderCriteria == \"desc\"){", + " simplerSortingList.reverse(); ", + " }", + "", + " console.log(\"Sorted list: \");", + " console.log(simplerSortingList);", + " ", + " pm.test(\"ORDERBY Filter Test - Sort check\", function(){", + " pm.expect(simplerSortingList).to.deep.equal(serverSorting);", + " });", + " }", + "", + " //FILTERS", + "", + " var parsed_filters;", + "", + " //POST or GET query", + " if (pm.request.method == \"POST\" && pm.request.body.raw) {", + " var productsFilters = JSON.parse(pm.request.body.raw);", + "", + " var jsonBodyToLogicAssertions = \"\";", + "", + " for (elem in productsFilters['FilterProducts']) {", + " console.log(productsFilters['FilterProducts'][elem]);", + " var currentAssertion = \"\";", + "", + " var keys = [];", + " for (var k in productsFilters['FilterProducts'][elem]) keys.push(k);", + " //console.log(keys);", + " var currentKey = keys[0];", + " console.log(\"Current Key: \" + currentKey);", + "", + " var currentValue = productsFilters['FilterProducts'][elem][currentKey].toString();", + " console.log(\"Current Value: \" + currentValue);", + "", + " currentAssertion = \"\" + currentKey + \" eq '\" + currentValue + \"'\";", + " jsonBodyToLogicAssertions += currentAssertion + \" or \";", + " }", + "", + " //cutting last \" or \"", + " jsonBodyToLogicAssertions = jsonBodyToLogicAssertions.substring(0, jsonBodyToLogicAssertions.length - 4);", + " console.log(\"PARSED POST: \" + jsonBodyToLogicAssertions);", + "", + " parsed_filters = get_query_filters(jsonBodyToLogicAssertions);", + "", + " } else if (pm.request.method == \"GET\" && pm.request.url.getQueryString().includes(\"$filter=\")) {", + " var filter_query = pm.request.url.getQueryString().split(\"$filter=\")[1];", + " filter_query = decodeURIComponent(filter_query.split(\"&\")[0]);", + " console.log(filter_query);", + " parsed_filters = get_query_filters(filter_query);", + "", + " }", + "", + " console.log(parsed_filters);", + "", + " var attributesUnderTest = [];", + " var propertiesUnderTest = [];", + "", + " if (typeof (parsed_filters) == \"object\") {", + " for (var counter = 0; counter < jsonDataElements.length; counter++) {", + "", + " attributesUnderTest = [];", + " propertiesUnderTest = [];", + "", + " var product = jsonDataElements[counter];", + " var treeExp = treeIterator(parsed_filters, product);", + " var booleanTreeExp = eval(treeExp);", + "", + " console.log(treeExp); console.log(booleanTreeExp);", + "", + " testMessage = product.Name;", + "", + " /*", + " if(attributesUnderTest.length > 0){", + " testMessage += \" \";", + " for(elem in attributesUnderTest){", + " testMessage += attributesUnderTest[elem] + \"; \";", + " }", + " }", + " if(propertiesUnderTest.length > 0){", + " testMessage += \" \";", + " for(elem in propertiesUnderTest){", + " testMessage += propertiesUnderTest[elem] + \"; \";", + " }", + " }", + " */", + "", + " pm.test(testMessage, function () {", + " pm.expect(booleanTreeExp).to.be.true;", + " });", + " }", + " }", + "}", + "", + "catch (err) {", + " pm.test(\"Filters Test\", function () {", + " pm.expect.fail(err.toString());", + " });", + "}" + ], + "type": "text/javascript" + } }, { - "key": "username", - "value": "{{username}}", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Products?$filter=Online eq false", - "host": [ - "{{service-root-uri}}" ], - "path": [ - "odata", - "v1", - "Products" - ], - "query": [ - { - "key": "$filter", - "value": "Online eq false" + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{password}}", + "type": "string" + }, + { + "key": "username", + "value": "{{username}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\"FilterProducts\":[\r\n\t{\"Name\": \"S1A_IW_GRDH_1SDV_20200121T201716_20200121T201741_030903_038C0F_DAEC.SAFE.zip\"},\r\n\t{\"Name\": \"S1A_EW_GRDM_1ADH_20200121T014322_20200121T014427_030892_038BA2_CD80.SAFE.zip\"},\r\n\t{\"Name\": \"S1A_S4_GRDH_1SDV_20190827T045540_20190827T045605_028750_03416A_B108.SAFE.zip\"}\r\n]}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/Products/OData.CSC.FilterList", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Products", + "OData.CSC.FilterList" + ] } - ] + }, + "response": [] } - }, - "response": [] + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true }, { - "name": "Order_Offline_Product", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "try {\r", - "\r", - " var current_offline_product_id = decodeURIComponent(pm.request.url.getPathWithQuery()).split(\"Products(\")[1].split(\")/OData.CSC.Order\")[0];\r", - "\r", - " pm.variables.unset(\"current_offline_product_id\");\r", - " if(current_offline_product_id == \"{{current_offline_product_id}}\"){\r", - " var current_offline_products = pm.collectionVariables.get('offline_products');\r", - " //get random product from collected offline products\r", - " var random_product = current_offline_products[Math.floor(Math.random()*current_offline_products.length)];\r", - " pm.variables.set(\"current_offline_product_id\", random_product[\"Id\"]);\r", - " } else {\r", - " pm.variables.set(\"current_offline_product_id\", current_offline_product_id);\r", - " }\r", - "\r", - " console.log(pm.variables.get(\"current_offline_product_id\"));\r", - " \r", - "} catch (err) {\r", - " pm.test(\"Filters Test\", function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - }, + "name": "Orders", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"in_progress\",\"queued\",\"failed\",\"completed\", \"cancelled\"]);\r", - "};\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\r", - " \"request is under processing\",\r", - " \"request is queued\",\r", - " \"request product is available\",\r", - " \"product currently unavailable\",\r", - " \"request cancelled by user\"]);\r", - "};\r", - "properties_map.Priority=function (element) {pm.expect(element.Priority).to.be.a(\"number\");}; \r", - "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "properties_map.EstimatedDate=function (element) {pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d\\d\\d(\\d*)Z/);};\r", - "\r", - "// properties_map.OrderSize=function (element) {pm.expect(element.OrderSize).to.be.a(\"number\");};\r", - "// properties_map.CompletedDate=function (element) {pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "// properties_map.EvictionDate=function (element) {if(element.EvictionDate){ pm.expect(element.EvictionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/); }};\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Order: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Order: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json();\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Order\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var order_response = {};\r", - "\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, jsonDataElements);\r", - " //filling the collection variable order array\r", - " order_response[key] = jsonDataElements[key];\r", - " pm.collectionVariables.set(\"current_order_\" + key, jsonDataElements[key]);\r", - " }\r", - "\r", - " pm.collectionVariables.set(\"expected_current_order_values\", order_response);\r", - " pm.collectionVariables.set(\"order_filter_counter\", 0);\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "{{password}}", - "type": "string" - }, + "name": "Get_Offline_Products", + "event": [ { - "key": "username", - "value": "{{username}}", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "try {\r", + " var jsonDataElements = pm.response.json().value;\r", + "\r", + " console.log(\"Response: \");\r", + " console.log(jsonDataElements);\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " //MIN number of Records Test\r", + " var minimumExpRecords = parseInt(pm.collectionVariables.get('resp_min_records'));\r", + " pm.test(\"Expected minimum number of products Test: \" + minimumExpRecords, function(){\r", + " pm.expect(jsonDataElements.length).to.be.gte(minimumExpRecords);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " query_string = pm.request.url.getQueryString();\r", + " if(query_string.includes(\"$expand=Attributes\")){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Products(Attributes())\");\r", + " } else{\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Products\");\r", + " }\r", + " });\r", + "\r", + " for (var counter = 0; counter < jsonDataElements.length; counter++){\r", + " var product = jsonDataElements[counter];\r", + " console.log(\"Processing Product: \"+product.Name+\" - \"+product.Id);\r", + "\r", + " pm.test(\"Test Properties for product: \" + product.Id, function(){\r", + " pm.expect(product).to.have.property(\"Id\");\r", + " pm.expect(product.Id).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"Name\");\r", + " pm.expect(product.Name).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"ContentType\");\r", + " pm.expect(product.ContentType).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"ContentLength\");\r", + " pm.expect(product.ContentLength).to.be.a(\"number\");\r", + " pm.expect(product).to.have.property(\"OriginDate\");\r", + " pm.expect(product.OriginDate).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"PublicationDate\");\r", + " pm.expect(product.PublicationDate).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"ModificationDate\");\r", + " pm.expect(product.ModificationDate).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"Online\");\r", + " pm.expect(product.Online).to.be.a(\"boolean\");\r", + " pm.expect(product).to.have.property(\"Checksum\");\r", + " pm.expect(product.Checksum).to.be.an(\"array\");\r", + " pm.expect(product).to.have.property(\"ContentDate\");\r", + " pm.expect(product.ContentDate).to.be.an(\"object\");\r", + " }); \r", + " \r", + " if(\"Attributes\" in jsonDataElements[counter]){\r", + " schema_seen = {};\r", + "\r", + " pm.test(\"Test Attributes list for product: \" + jsonDataElements[counter].Id, function(){\r", + " pm.expect(jsonDataElements[counter].Attributes.length).to.be.above(0);\r", + " jsonDataElements[counter].Attributes.forEach(function(elem){\r", + " pm.expect(elem).to.have.all.keys(\"Name\", \"Value\", \"ValueType\");\r", + " });\r", + " }); \r", + " }\r", + " }\r", + "\r", + " pm.collectionVariables.set('offline_products', jsonDataElements);\r", + " \r", + "}\r", + "\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\"Priority\":43}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/Products({{current_offline_product_id}})/OData.CSC.Order", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Products({{current_offline_product_id}})", - "OData.CSC.Order" - ] - } - }, - "response": [] - }, - { - "name": "Order_Filter_By_Id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"Id\";\r", - "\r", - "try {\r", - " current_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", - "\r", - " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=Id eq {{current_order_Id}}", - "host": [ - "{{service-root-uri}}" ], - "path": [ - "odata", - "v1", - "Orders" - ], - "query": [ - { - "key": "$filter", - "value": "Id eq {{current_order_Id}}" + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{password}}", + "type": "string" + }, + { + "key": "username", + "value": "{{username}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Products?$filter=Online eq false", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Products" + ], + "query": [ + { + "key": "$filter", + "value": "Online eq false" + } + ] } - ] - } - }, - "response": [] - }, - { - "name": "Order_Filter_By_EstimatedDate", - "event": [ + }, + "response": [] + }, { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"EstimatedDate\";\r", - "\r", - "try {\r", - " current_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", - "\r", - " console.log(expected_order_key_value);\r", - "\r", - " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=EstimatedDate eq {{current_order_EstimatedDate}}", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Orders" - ], - "query": [ + "name": "Order_Offline_Product", + "event": [ { - "key": "$filter", - "value": "EstimatedDate eq {{current_order_EstimatedDate}}" - } - ] - } - }, - "response": [] - }, - { - "name": "Order_Filter_By_SubmissionDate", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"SubmissionDate\";\r", - "\r", - "try {\r", - " current_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", - "\r", - " console.log(expected_order_key_value);\r", - "\r", - " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=SubmissionDate eq {{current_order_SubmissionDate}}", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Orders" - ], - "query": [ - { - "key": "$filter", - "value": "SubmissionDate eq {{current_order_SubmissionDate}}" - } - ] - } - }, - "response": [] - }, - { - "name": "Order_Filter_By_Priority", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"Priority\";\r", - "\r", - "try {\r", - " current_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = parseInt(decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\"));\r", - "\r", - " console.log(expected_order_key_value);\r", - "\r", - " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=Priority eq {{current_order_Priority}}", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Orders" - ], - "query": [ - { - "key": "$filter", - "value": "Priority eq {{current_order_Priority}}" - } - ] - } - }, - "response": [] - }, - { - "name": "Order_Filter_By_Status", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"Status\";\r", - "\r", - "try {\r", - " current_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().split(\"OData.CSC.JobStatus\").pop().replace(/'/g, \"\");\r", - " \r", - " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=Status eq OData.CSC.JobStatus'{{current_order_Status}}'", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Orders" - ], - "query": [ - { - "key": "$filter", - "value": "Status eq OData.CSC.JobStatus'{{current_order_Status}}'" - } - ] - } - }, - "response": [] - }, - { - "name": "Order_Filter_By_StatusMessage", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"StatusMessage\";\r", - "\r", - "try {\r", - " current_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = pm.collectionVariables.get(\"current_order_\" + current_tested_filter_key);\r", - "\r", - " console.log(expected_order_key_value);\r", - "\r", - " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=StatusMessage eq {{current_order_StatusMessage}}", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Orders" - ], - "query": [ - { - "key": "$filter", - "value": "StatusMessage eq {{current_order_StatusMessage}}" - } - ] - } - }, - "response": [] - }, - { - "name": "Get_Completed_Orders", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "try {\r", - " var jsonDataElements = pm.response.json().value;\r", - "\r", - " console.log(\"Response: \");\r", - " console.log(jsonDataElements);\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " //MIN number of Records Test\r", - " var minimumExpRecords = parseInt(pm.collectionVariables.get('resp_min_records'));\r", - " pm.test(\"Expected minimum number of records Test: \" + minimumExpRecords, function(){\r", - " pm.expect(jsonDataElements.length).to.be.gte(minimumExpRecords);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " query_string = pm.request.url.getQueryString();\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", - " });\r", - "\r", - " for (var counter = 0; counter < jsonDataElements.length; counter++){\r", - " var current_order = jsonDataElements[counter];\r", - " console.log(\"Processing Order: \"+current_order.Id);\r", - "\r", - " pm.test(\"Test Properties for Order: \" + current_order.Id, function(){\r", - " pm.expect(current_order).to.have.property(\"Id\");\r", - " pm.expect(current_order.Id).to.be.a(\"string\");\r", - " pm.expect(current_order).to.have.property(\"Status\");\r", - " pm.expect(current_order.Status).to.be.a(\"string\");\r", - " pm.expect(current_order).to.have.property(\"StatusMessage\");\r", - " pm.expect(current_order.StatusMessage).to.be.a(\"string\");\r", - " pm.expect(current_order).to.have.property(\"SubmissionDate\");\r", - " pm.expect(current_order.SubmissionDate).to.be.a(\"string\");\r", - " pm.expect(current_order).to.have.property(\"EstimatedDate\");\r", - " pm.expect(current_order.EstimatedDate).to.be.a(\"string\");\r", - " pm.expect(current_order).to.have.property(\"Priority\");\r", - " pm.expect(current_order.Priority).to.be.a(\"number\");\r", - " });\r", - " }\r", - "\r", - " pm.collectionVariables.set('completed_orders', jsonDataElements);\r", - " \r", - "}\r", - "\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "{{password}}", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "try {\r", + "\r", + " var current_offline_product_id = decodeURIComponent(pm.request.url.getPathWithQuery()).split(\"Products(\")[1].split(\")/OData.CSC.Order\")[0];\r", + "\r", + " pm.variables.unset(\"current_offline_product_id\");\r", + " if(current_offline_product_id == \"{{current_offline_product_id}}\"){\r", + " var current_offline_products = pm.collectionVariables.get('offline_products');\r", + " //get random product from collected offline products\r", + " var random_product = current_offline_products[Math.floor(Math.random()*current_offline_products.length)];\r", + " pm.variables.set(\"current_offline_product_id\", random_product[\"Id\"]);\r", + " } else {\r", + " pm.variables.set(\"current_offline_product_id\", current_offline_product_id);\r", + " }\r", + "\r", + " console.log(pm.variables.get(\"current_offline_product_id\"));\r", + " \r", + "} catch (err) {\r", + " pm.test(\"Filters Test\", function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } }, { - "key": "username", - "value": "{{username}}", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"in_progress\",\"queued\",\"failed\",\"completed\", \"cancelled\"]);\r", + "};\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\r", + " \"request is under processing\",\r", + " \"request is queued\",\r", + " \"request product is available\",\r", + " \"product currently unavailable\",\r", + " \"request cancelled by user\"]);\r", + "};\r", + "properties_map.Priority=function (element) {pm.expect(element.Priority).to.be.a(\"number\");}; \r", + "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "properties_map.EstimatedDate=function (element) {pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d\\d\\d(\\d*)Z/);};\r", + "\r", + "// properties_map.OrderSize=function (element) {pm.expect(element.OrderSize).to.be.a(\"number\");};\r", + "// properties_map.CompletedDate=function (element) {pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "// properties_map.EvictionDate=function (element) {if(element.EvictionDate){ pm.expect(element.EvictionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/); }};\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Order: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Order: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json();\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Order\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var order_response = {};\r", + "\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, jsonDataElements);\r", + " //filling the collection variable order array\r", + " order_response[key] = jsonDataElements[key];\r", + " pm.collectionVariables.set(\"current_order_\" + key, jsonDataElements[key]);\r", + " }\r", + "\r", + " pm.collectionVariables.set(\"expected_current_order_values\", order_response);\r", + " pm.collectionVariables.set(\"order_filter_counter\", 0);\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=Status eq OData.CSC.JobStatus'completed'", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Orders" ], - "query": [ - { - "key": "$filter", - "value": "Status eq OData.CSC.JobStatus'completed'" + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{password}}", + "type": "string" + }, + { + "key": "username", + "value": "{{username}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\"Priority\":43}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/Products({{current_offline_product_id}})/OData.CSC.Order", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Products({{current_offline_product_id}})", + "OData.CSC.Order" + ] } - ] - } - }, - "response": [] - }, - { - "name": "Completed_Order_Properties", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "try {\r", - " var current_completed_order = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \")[1];\r", - " console.log(current_completed_order);\r", - " pm.variables.unset(\"current_completed_order_id\"); \r", - " if(current_completed_order == \"{{current_completed_order_id}}\"){\r", - " current_completed_order = pm.collectionVariables.get('completed_orders');\r", - " //get random product from collected completed orders\r", - " var random_completed_order = current_completed_order[Math.floor(Math.random()*current_completed_order.length)];\r", - " pm.variables.set(\"current_completed_order_id\", random_completed_order[\"Id\"]);\r", - " } else {\r", - " pm.variables.set(\"current_completed_order_id\", current_completed_order);\r", - " }\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } + }, + "response": [] }, { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"in_progress\",\"queued\",\"failed\",\"completed\", \"cancelled\"]);\r", - "};\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\r", - " \"request is under processing\",\r", - " \"request is queued\",\r", - " \"request product is available\",\r", - " \"product currently unavailable\",\r", - " \"request cancelled by user\"]);\r", - "};\r", - "properties_map.Priority=function (element) {pm.expect(element.Priority).to.be.a(\"number\");}; \r", - "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "properties_map.EstimatedDate=function (element) {pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d\\d\\d(\\d*)Z/);};\r", - "\r", - "properties_map.OrderSize=function (element) {pm.expect(element.OrderSize).to.be.a(\"number\");};\r", - "properties_map.CompletedDate=function (element) {pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "properties_map.EvictionDate=function (element) {if(element.EvictionDate){ pm.expect(element.EvictionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/); }};\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Order: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Order: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().value[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var order_response = {};\r", - "\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, jsonDataElements);\r", - " //filling the collection variable order array\r", - " order_response[key] = jsonDataElements[key];\r", - " pm.collectionVariables.set(\"current_order_\" + key, jsonDataElements[key]);\r", - " }\r", - "\r", - " pm.collectionVariables.set(\"expected_current_order_values\", order_response);\r", - " pm.collectionVariables.set(\"order_filter_counter\", 0);\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "{{password}}", - "type": "string" - }, + "name": "Order_Filter_By_Id", + "event": [ { - "key": "username", - "value": "{{username}}", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"Id\";\r", + "\r", + "try {\r", + " current_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", + "\r", + " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=Id eq {{current_completed_order_id}}", - "host": [ - "{{service-root-uri}}" ], - "path": [ - "odata", - "v1", - "Orders" - ], - "query": [ - { - "key": "$filter", - "value": "Id eq {{current_completed_order_id}}" + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=Id eq {{current_order_Id}}", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Orders" + ], + "query": [ + { + "key": "$filter", + "value": "Id eq {{current_order_Id}}" + } + ] } - ] - } - }, - "response": [] - }, - { - "name": "Order_Filter_By_OrderSize", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"OrderSize\";\r", - "\r", - "try {\r", - " current_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = parseInt(decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\"));\r", - "\r", - " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } + }, + "response": [] }, { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=OrderSize eq {{current_order_OrderSize}}", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Orders" - ], - "query": [ + "name": "Order_Filter_By_EstimatedDate", + "event": [ { - "key": "$filter", - "value": "OrderSize eq {{current_order_OrderSize}}" + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"EstimatedDate\";\r", + "\r", + "try {\r", + " current_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", + "\r", + " console.log(expected_order_key_value);\r", + "\r", + " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } } - ] - } - }, - "response": [] - }, - { - "name": "Order_Filter_By_CompletedDate", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"CompletedDate\";\r", - "\r", - "try {\r", - " current_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", - "\r", - " console.log(expected_order_key_value);\r", - "\r", - " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=CompletedDate eq {{current_order_CompletedDate}}", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Orders" ], - "query": [ - { - "key": "$filter", - "value": "CompletedDate eq {{current_order_CompletedDate}}" + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=EstimatedDate eq {{current_order_EstimatedDate}}", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Orders" + ], + "query": [ + { + "key": "$filter", + "value": "EstimatedDate eq {{current_order_EstimatedDate}}" + } + ] } - ] - } - }, - "response": [] - }, - { - "name": "Order_Filter_By_EvictionDate", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"EvictionDate\";\r", - "\r", - "try {\r", - " current_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", - "\r", - " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } + }, + "response": [] }, { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=EvictionDate eq {{current_order_EvictionDate}}", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Orders" - ], - "query": [ + "name": "Order_Filter_By_SubmissionDate", + "event": [ { - "key": "$filter", - "value": "EvictionDate eq {{current_order_EvictionDate}}" + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"SubmissionDate\";\r", + "\r", + "try {\r", + " current_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", + "\r", + " console.log(expected_order_key_value);\r", + "\r", + " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } } - ] - } - }, - "response": [] - }, - { - "name": "Get_Online_Product_By_Order_Navigation", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "try {\r", - " var current_completed_order = decodeURIComponent(pm.request.url.getPathWithQuery()).split(\"/odata/v1/Orders(\")[1].split(\")/Product\")[0];\r", - " pm.variables.unset(\"current_completed_order_id\");\r", - " if(current_completed_order == \"{{current_completed_order_id}}\"){\r", - " current_completed_order = pm.collectionVariables.get('completed_orders');\r", - " //get random product from collected completed orders\r", - " var random_completed_order = current_completed_order[Math.floor(Math.random()*current_completed_order.length)];\r", - " pm.variables.set(\"current_completed_order_id\", random_completed_order[\"Id\"]);\r", - " } else {\r", - " pm.variables.set(\"current_completed_order_id\", current_completed_order);\r", - " }\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=SubmissionDate eq {{current_order_SubmissionDate}}", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Orders" + ], + "query": [ + { + "key": "$filter", + "value": "SubmissionDate eq {{current_order_SubmissionDate}}" + } + ] + } + }, + "response": [] }, { - "listen": "test", - "script": { - "exec": [ - "try {\r", - " var jsonDataElements = pm.response.json();\r", - "\r", - " console.log(jsonDataElements[\"Online\"]);\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Product\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " pm.test(\"Product Property Online\", function(){\r", - " pm.expect(jsonDataElements[\"Online\"]).be.equal(true);\r", - " });\r", - "\r", - " pm.collectionVariables.set('current_online_product_id', jsonDataElements[\"Id\"]);\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "{{password}}", - "type": "string" - }, + "name": "Order_Filter_By_Priority", + "event": [ { - "key": "username", - "value": "{{username}}", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"Priority\";\r", + "\r", + "try {\r", + " current_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = parseInt(decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\"));\r", + "\r", + " console.log(expected_order_key_value);\r", + "\r", + " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Orders({{current_completed_order_id}})/Product", - "host": [ - "{{service-root-uri}}" ], - "path": [ - "odata", - "v1", - "Orders({{current_completed_order_id}})", - "Product" - ] - } - }, - "response": [] - }, - { - "name": "Product_Download_By_Order_Navigation", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "try {\r", - "\r", - " var current_completed_order = decodeURIComponent(pm.request.url.getPathWithQuery()).split(\"/odata/v1/Orders(\")[1].split(\")/Product/$value\")[0];\r", - " \r", - " pm.variables.unset(\"current_completed_order_id\");\r", - " if(current_completed_order == \"{{current_completed_order_id}}\"){\r", - " current_completed_order = pm.collectionVariables.get('completed_orders');\r", - " //get random product from collected completed orders\r", - " var random_completed_order = current_completed_order[Math.floor(Math.random()*current_completed_order.length)];\r", - " pm.variables.set(\"current_completed_order_id\", random_completed_order[\"Id\"]);\r", - " } else {\r", - " pm.variables.set(\"current_completed_order_id\", current_completed_order);\r", - " }\r", - " pm.request.headers.add({key: 'Range', value: 'bytes=0-1023' })\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=Priority eq {{current_order_Priority}}", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Orders" + ], + "query": [ + { + "key": "$filter", + "value": "Priority eq {{current_order_Priority}}" + } + ] + } + }, + "response": [] }, { - "listen": "test", - "script": { - "exec": [ - "try {\r", - "\r", - " console.log(pm.response);\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200,206,202]);\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " pm.test(\"Downloaded Size\", function(){\r", - " pm.expect(pm.response.responseSize).be.equal(1024);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "{{password}}", - "type": "string" - }, + "name": "Order_Filter_By_Status", + "event": [ { - "key": "username", - "value": "{{username}}", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"Status\";\r", + "\r", + "try {\r", + " current_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().split(\"OData.CSC.JobStatus\").pop().replace(/'/g, \"\");\r", + " \r", + " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Orders({{current_completed_order_id}})/Product/$value", - "host": [ - "{{service-root-uri}}" ], - "path": [ - "odata", - "v1", - "Orders({{current_completed_order_id}})", - "Product", - "$value" - ] - } - }, - "response": [] - }, - { - "name": "Product_Download_By_Product_Navigation", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "try {\r", - " pm.request.headers.add({key: 'Range', value: 'bytes=0-1023' })\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=Status eq OData.CSC.JobStatus'{{current_order_Status}}'", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Orders" + ], + "query": [ + { + "key": "$filter", + "value": "Status eq OData.CSC.JobStatus'{{current_order_Status}}'" + } + ] + } + }, + "response": [] }, { - "listen": "test", - "script": { - "exec": [ - "try {\r", - "\r", - " console.log(pm.response);\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200,206,202]);\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " pm.test(\"Downloaded Size\", function(){\r", - " pm.expect(pm.response.responseSize).be.equal(1024);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "{{password}}", - "type": "string" - }, + "name": "Order_Filter_By_StatusMessage", + "event": [ { - "key": "username", - "value": "{{username}}", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"StatusMessage\";\r", + "\r", + "try {\r", + " current_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = pm.collectionVariables.get(\"current_order_\" + current_tested_filter_key);\r", + "\r", + " console.log(expected_order_key_value);\r", + "\r", + " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Products({{current_online_product_id}})/$value", - "host": [ - "{{service-root-uri}}" ], - "path": [ - "odata", - "v1", - "Products({{current_online_product_id}})", - "$value" - ] - } - }, - "response": [] - }, - { - "name": "Order_Cancel", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=StatusMessage eq {{current_order_StatusMessage}}", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Orders" + ], + "query": [ + { + "key": "$filter", + "value": "StatusMessage eq {{current_order_StatusMessage}}" + } + ] + } + }, + "response": [] }, { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"cancelled\"]);\r", - "};\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"request cancelled by user\"]);\r", - "};\r", - "properties_map.Priority=function (element) {pm.expect(element.Priority).to.be.a(\"number\");}; \r", - "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "properties_map.EstimatedDate=function (element) {pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d\\d\\d(\\d*)Z/);};\r", - "\r", - "// comment out OrderSize check", - "// properties_map.OrderSize=function (element) {pm.expect(element.OrderSize).to.be.equal(0);};\r", - "properties_map.CompletedDate=function (element) {pm.expect(element.CompletedDate).to.be.equal(null);};\r", - "properties_map.EvictionDate=function (element) {if(element.EvictionDate){ pm.expect(element.EvictionDate).to.be.equal(null); }};\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Order: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Order: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json();\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Order\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, jsonDataElements);\r", - " }\r", - "\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "{{password}}", - "type": "string" - }, + "name": "Get_Completed_Orders", + "event": [ { - "key": "username", - "value": "{{username}}", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "try {\r", + " var jsonDataElements = pm.response.json().value;\r", + "\r", + " console.log(\"Response: \");\r", + " console.log(jsonDataElements);\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " //MIN number of Records Test\r", + " var minimumExpRecords = parseInt(pm.collectionVariables.get('resp_min_records'));\r", + " pm.test(\"Expected minimum number of records Test: \" + minimumExpRecords, function(){\r", + " pm.expect(jsonDataElements.length).to.be.gte(minimumExpRecords);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " query_string = pm.request.url.getQueryString();\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", + " });\r", + "\r", + " for (var counter = 0; counter < jsonDataElements.length; counter++){\r", + " var current_order = jsonDataElements[counter];\r", + " console.log(\"Processing Order: \"+current_order.Id);\r", + "\r", + " pm.test(\"Test Properties for Order: \" + current_order.Id, function(){\r", + " pm.expect(current_order).to.have.property(\"Id\");\r", + " pm.expect(current_order.Id).to.be.a(\"string\");\r", + " pm.expect(current_order).to.have.property(\"Status\");\r", + " pm.expect(current_order.Status).to.be.a(\"string\");\r", + " pm.expect(current_order).to.have.property(\"StatusMessage\");\r", + " pm.expect(current_order.StatusMessage).to.be.a(\"string\");\r", + " pm.expect(current_order).to.have.property(\"SubmissionDate\");\r", + " pm.expect(current_order.SubmissionDate).to.be.a(\"string\");\r", + " pm.expect(current_order).to.have.property(\"EstimatedDate\");\r", + " pm.expect(current_order.EstimatedDate).to.be.a(\"string\");\r", + " pm.expect(current_order).to.have.property(\"Priority\");\r", + " pm.expect(current_order.Priority).to.be.a(\"number\");\r", + " });\r", + " }\r", + "\r", + " pm.collectionVariables.set('completed_orders', jsonDataElements);\r", + " \r", + "}\r", + "\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/Orders({{current_order_Id}})/OData.CSC.Cancel", - "host": [ - "{{service-root-uri}}" ], - "path": [ - "odata", - "v1", - "Orders({{current_order_Id}})", - "OData.CSC.Cancel" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Bulks_BatchOrders", - "item": [ - { - "name": "BulkCreateMinParams", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"created\"]);\r", - "};\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk has been created but no BatchOrders have been triggered\"]);\r", - "};\r", - "properties_map.FilterParam=function (element) {\r", - " pm.expect(element.FilterParam).to.be.a(\"string\");\r", - "};\r", - "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "\r", - "properties_map.BatchsizeProducts=function (element) {\r", - " pm.expect(element.BatchsizeProducts).to.be.a(\"number\");\r", - "};\r", - "properties_map.BatchsizeVolume=function (element) {\r", - " pm.expect(element.BatchsizeVolume).to.be.a(\"number\");\r", - "};\r", - "properties_map.NotificationEndpoint=function (element) {\r", - " if(element.NotificationEndpoint){\r", - " pm.expect(element.NotificationEndpoint).to.be.equal(null);\r", - " }\r", - "};\r", - "properties_map.OrderbyParam=function (element) {\r", - " if(element.OrderbyParam){\r", - " pm.expect(element.OrderbyParam).to.be.equal(null);\r", - " }\r", - "};\r", - "\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Bulk: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Bulk: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().value[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Bulk\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var order_response = {};\r", - "\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, jsonDataElements);\r", - " //filling the collection variable order array\r", - " order_response[key] = jsonDataElements[key];\r", - " pm.collectionVariables.set(\"current_order_\" + key, jsonDataElements[key]);\r", - " }\r", - "\r", - " pm.collectionVariables.set('bulk_id', jsonDataElements['Id']);\r", - " pm.collectionVariables.set('bulk_batchsize_products', jsonDataElements['BatchsizeProducts']);\r", - " pm.collectionVariables.set('current_batch_filter_param', JSON.parse(request.data)[\"FilterParam\"]);\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n\"@odata.context\": \"$metadata#Bulk/$entity\",\r\n\"FilterParam\": \"contains(Name,'S')\"\r\n} ", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/Bulks", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Bulks" - ] - } - }, - "response": [] - }, - { - "name": "BulkCreateMaxParams", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"created\"]);\r", - "};\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk has been created but no BatchOrders have been triggered\"]);\r", - "};\r", - "properties_map.FilterParam=function (element) {\r", - " pm.expect(element.FilterParam).to.be.a(\"string\");\r", - " pm.expect(element.FilterParam).to.be.not.equal(null);\r", - "};\r", - "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "\r", - "properties_map.BatchsizeProducts=function (element) {\r", - " pm.expect(element.BatchsizeProducts).to.be.a(\"number\");\r", - "};\r", - "properties_map.BatchsizeVolume=function (element) {\r", - " pm.expect(element.BatchsizeVolume).to.be.a(\"number\");\r", - "};\r", - "properties_map.NotificationEndpoint=function (element) {\r", - " if(element.NotificationEndpoint){\r", - " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", - " }\r", - "};\r", - "properties_map.OrderbyParam=function (element) {\r", - " if(element.OrderbyParam){\r", - " pm.expect(element.OrderbyParam).to.be.a(\"string\"); \r", - " }\r", - "};\r", - "\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Bulk: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Bulk: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().value[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Bulk\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var order_response = {};\r", - "\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, jsonDataElements);\r", - " //filling the collection variable order array\r", - " order_response[key] = jsonDataElements[key];\r", - " pm.collectionVariables.set(\"current_order_\" + key, jsonDataElements[key]);\r", - " }\r", - "\r", - " pm.collectionVariables.set('bulk_id', jsonDataElements['Id']);\r", - " pm.collectionVariables.set('bulk_batchsize_products', jsonDataElements['BatchsizeProducts']);\r", - "\r", - " pm.collectionVariables.set('current_batch_filter_param', JSON.parse(request.data)[\"FilterParam\"]);\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n\"@odata.context\": \"$metadata#Bulk/$entity\",\r\n\"FilterParam\": \"contains(Name,'S2A')\",\r\n\"BatchsizeProducts\": 50,\r\n\"BatchsizeVolume\": 50,\r\n\"OrderbyParam\": \"Name asc\"\r\n} ", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/Bulks", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Bulks" - ] - } - }, - "response": [] - }, - { - "name": "BulkDetails", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"created\", \"in_progress\", \"completed\", \"failed\", \"cancelled\"]);\r", - "};\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " switch(element.Status){\r", - " case \"created\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk has been created but no BatchOrders have been triggered\"]);\r", - " break;\r", - " case \"in_progress\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"One or more BatchOrders are under processing\"]);\r", - " break;\r", - " case \"completed\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"requested products of all BatchOrders comprising the Bulk are in status 'completed'\"]);\r", - " break;\r", - " case \"cancelled\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk cancelled by user\"]);\r", - " break;\r", - " case \"failed\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"at least one product retrieval has failed\", \"at least one product currently unavailable\", \"at least one product not found on LTA\"]);\r", - " break;\r", - " }\r", - "};\r", - "properties_map.FilterParam=function (element) {\r", - " pm.expect(element.FilterParam).to.be.a(\"string\");\r", - "};\r", - "properties_map.SubmissionDate=function (element) {\r", - " pm.expect(element.SubmissionDate).to.be.a(\"string\");\r", - " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - "};\r", - "properties_map.BatchsizeProducts=function (element) {\r", - " pm.expect(element.BatchsizeProducts).to.be.a(\"number\");\r", - "};\r", - "properties_map.BatchsizeVolume=function (element) {\r", - " pm.expect(element.BatchsizeVolume).to.be.a(\"number\");\r", - "};\r", - "properties_map.NotificationEndpoint=function (element) {\r", - " if(element.NotificationEndpoint){\r", - " if(typeof(element.NotificationEndpoint)==\"string\"){\r", - " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", - " } else pm.expect(element.NotificationEndpoint).to.be.equal(null);\r", - " }\r", - "};\r", - "properties_map.OrderbyParam=function (element) {\r", - " if(element.OrderbyParam){\r", - " if(typeof(element.OrderbyParam)==\"string\"){\r", - " pm.expect(element.OrderbyParam).to.be.a(\"string\");\r", - " } else pm.expect(element.OrderbyParam).to.be.equal(null);\r", - " }\r", - "\r", - "};\r", - "properties_map.CompletedDate=function (element) {\r", - " if(element.CompletedDate){\r", - " switch(element.Status){\r", - " case \"completed\":\r", - " pm.expect(element.CompletedDate).to.be.a(\"string\");\r", - " pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - " break;\r", - " default:\r", - " if(element.CompletedDate){\r", - " pm.expect(element.CompletedDate).to.be.equal(null)\r", - " } \r", - " }\r", - " }\r", - "};\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Bulk: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Bulk: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().value;\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"metadata#Bulks\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " for(bulk of jsonDataElements){\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, bulk);\r", - " }\r", - " }\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/Bulks({{bulk_id}})", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Bulks({{bulk_id}})" - ] - } - }, - "response": [] - }, - { - "name": "BulkFilter_by_Status", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"created\", \"in_progress\", \"completed\", \"failed\", \"cancelled\"]);\r", - "};\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " switch(element.Status){\r", - " case \"created\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk has been created but no BatchOrders have been triggered\"]);\r", - " break;\r", - " case \"in_progress\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"One or more BatchOrders are under processing\"]);\r", - " break;\r", - " case \"completed\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"requested products of all BatchOrders comprising the Bulk are in status 'completed'\"]);\r", - " break;\r", - " case \"cancelled\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk cancelled by user\"]);\r", - " break;\r", - " case \"failed\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"at least one product retrieval has failed\", \"at least one product currently unavailable\", \"at least one product not found on LTA\"]);\r", - " break;\r", - " }\r", - "};\r", - "properties_map.FilterParam=function (element) {\r", - " pm.expect(element.FilterParam).to.be.a(\"string\");\r", - "};\r", - "properties_map.SubmissionDate=function (element) {\r", - " pm.expect(element.SubmissionDate).to.be.a(\"string\");\r", - " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - "};\r", - "properties_map.BatchsizeProducts=function (element) {\r", - " pm.expect(element.BatchsizeProducts).to.be.a(\"number\");\r", - "};\r", - "properties_map.BatchsizeVolume=function (element) {\r", - " pm.expect(element.BatchsizeVolume).to.be.a(\"number\");\r", - "};\r", - "properties_map.NotificationEndpoint=function (element) {\r", - " if(element.NotificationEndpoint){\r", - " if(typeof(element.NotificationEndpoint)==\"string\"){\r", - " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", - " } else pm.expect(element.NotificationEndpoint).to.be.equal(null);\r", - " }\r", - "};\r", - "properties_map.OrderbyParam=function (element) {\r", - " if(element.OrderbyParam){\r", - " if(typeof(element.OrderbyParam)==\"string\"){\r", - " pm.expect(element.OrderbyParam).to.be.a(\"string\");\r", - " } else pm.expect(element.OrderbyParam).to.be.equal(null);\r", - " }\r", - "\r", - "};\r", - "properties_map.CompletedDate=function (element) {\r", - " if(element.CompletedDate){\r", - " switch(element.Status){\r", - " case \"completed\":\r", - " pm.expect(element.CompletedDate).to.be.a(\"string\");\r", - " pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - " break;\r", - " default:\r", - " if(element.CompletedDate){\r", - " pm.expect(element.CompletedDate).to.be.equal(null)\r", - " } \r", - " }\r", - " }\r", - "};\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Bulk: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Bulk: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().value;\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"metadata#Bulks\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " for(bulk of jsonDataElements){\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, bulk);\r", - " }\r", - " }\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/Bulks?$filter=Status eq OData.CSC.JobStatus'created'", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Bulks" - ], - "query": [ - { - "key": "$filter", - "value": "Status eq OData.CSC.JobStatus'created'" + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{password}}", + "type": "string" + }, + { + "key": "username", + "value": "{{username}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=Status eq OData.CSC.JobStatus'completed'", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Orders" + ], + "query": [ + { + "key": "$filter", + "value": "Status eq OData.CSC.JobStatus'completed'" + } + ] } - ] - } - }, - "response": [] - }, - { - "name": "BatchOrdersViaBulk", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"queued\", \"in_progress\", \"completed\", \"failed\", \"cancelled\"]);\r", - "};\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " switch(element.Status){\r", - " case \"queued\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder request is queued\"]);\r", - " break;\r", - " case \"in_progress\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder is under processing\"]);\r", - " break;\r", - " case \"completed\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"requested products of BatchOrder are available\"]);\r", - " break;\r", - " case \"cancelled\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder cancelled by user\"]);\r", - " break;\r", - " case \"failed\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"at least one product retrieval has failed\", \"at least one product currently unavailable\", \"at least one product not found on LTA\"]);\r", - " break;\r", - " }\r", - "};\r", - "properties_map.CompletedDate=function (element) {\r", - " switch(element.Status){\r", - " case \"completed\":\r", - " pm.expect(element.CompletedDate).to.be.a(\"string\");\r", - " pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - " break;\r", - " default:\r", - " if(element.CompletedDate){\r", - " pm.expect(element.CompletedDate).to.be.equal(null)\r", - " }\r", - " }\r", - "};\r", - "properties_map.SubmissionDate=function (element) {\r", - " switch(element.Status){\r", - " case \"queued\":\r", - " if(element.SubmissionDate){\r", - " pm.expect(element.SubmissionDate).to.be.oneOf([null]);\r", - " }\r", - " break;\r", - " case \"in_progress\", \"completed\":\r", - " pm.expect(element.SubmissionDate).to.be.a(\"string\");\r", - " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - " break;\r", - " case \"cancelled\", \"failed\":\r", - " if(typeof(element.SubmissionDate)==\"string\"){\r", - " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - " } else pm.expect(element.SubmissionDate).to.be.oneOf([null]);\r", - " break;\r", - " }\r", - "};\r", - "properties_map.EstimatedDate=function (element) {\r", - " switch(element.Status){\r", - " case \"queued\":\r", - " if(element.EstimatedDate){\r", - " pm.expect(element.EstimatedDate).to.be.oneOf([null]);\r", - " }\r", - " break;\r", - " case \"in_progress\", \"completed\":\r", - " pm.expect(element.EstimatedDate).to.be.a(\"string\");\r", - " pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - " break;\r", - " case \"cancelled\", \"failed\":\r", - " if(typeof(element.EstimatedDate)==\"string\"){\r", - " pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - " } else pm.expect(element.EstimatedDate).to.be.oneOf([null]);\r", - " break;\r", - " }\r", - "};\r", - "properties_map.OrderSize=function (element) {\r", - " switch(element.Status){\r", - " case \"queued\", \"in_progress\", \"cancelled\", \"failed\":\r", - " if(element.OrderSize){\r", - " pm.expect(element.OrderSize).to.be.oneOf([null]);\r", - " } \r", - " break;\r", - " case \"completed\":\r", - " pm.expect(element.OrderSize).to.be.a(\"number\");\r", - " break;\r", - " }\r", - "};\r", - "properties_map.Priority=function (element) {\r", - " if(element.Status != 'created'){", - " pm.expect(element.Priority).to.be.a(\"number\");\r", - " }", - "};\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for BatchOrder: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for BatchOrder: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().value;\r", - " pm.collectionVariables.set('batch_orders', jsonDataElements);\r", - " var random_batch_order = jsonDataElements[Math.floor(Math.random()*jsonDataElements.length)];\r", - " pm.collectionVariables.set(\"current_batch_order_id\", random_batch_order[\"Id\"]);\r", - "\r", - " console.log(random_batch_order);\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " for (var counter = 0; counter < jsonDataElements.length; counter++){\r", - " var batch = jsonDataElements[counter];\r", - " console.log(\"Processing Batch: \"+batch.Id);\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, batch);\r", - " }\r", - " }\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/Bulks({{bulk_id}})/BatchOrders", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Bulks({{bulk_id}})", - "BatchOrders" - ] - } - }, - "response": [] - }, - { - "name": "BatchOrderDetailsBeforeTrigger", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"queued\"]);\r", - "};\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder request is queued\"]);\r", - "};\r", - "properties_map.CompletedDate=function (element) {\r", - " pm.expect(element.CompletedDate).to.be.equal(null);\r", - "};\r", - "properties_map.SubmissionDate=function (element) {\r", - " pm.expect(element.SubmissionDate).to.be.equal(null);\r", - "};\r", - "properties_map.EstimatedDate=function (element) {\r", - " pm.expect(element.EstimatedDate).to.be.equal(null);\r", - "};\r", - "properties_map.OrderSize=function (element) {\r", - " pm.expect(element.OrderSize).to.be.equal(null);\r", - "};\r", - "properties_map.Priority=function (element) {\r", - " pm.expect(element.Priority).to.be.a(\"number\");\r", - "};\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for BatchOrder: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for BatchOrder: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().value[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrder/$entity\");\r", - " });\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var batch = jsonDataElements;\r", - " console.log(\"Processing Batch: \"+batch.Id);\r", - "\r", - " var batchorder_response = {};\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, batch);\r", - " batchorder_response[key] = batch[key];\r", - " pm.collectionVariables.set(\"current_batchorder_\" + key, batch[key]);\r", - " }\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/BatchOrders({{current_batch_order_id}})", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "BatchOrders({{current_batch_order_id}})" - ] - } - }, - "response": [] - }, - { - "name": "BatchOrderProducts", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const supportedOperators = [\"eq\", \"ne\", \"gt\", \"ge\", \"lt\", \"le\", \"and\", \"or\", \"not\"];\r", - "const supportedFunctions = [\"startswith\", \"contains\", \"endswith\"];\r", - "\r", - "function compare(a, b){\r", - " if(isNaN(a)){\r", - " return String(a).localeCompare(String(b));\r", - " } else {\r", - " return a > b;\r", - " } \r", - "}\r", - "\r", - "function getOperator(inputString, possibleOperators) {\r", - " var op = null;\r", - " possibleOperators.forEach(function (el) { if (inputString.indexOf(el) >= 0) { op = el; } });\r", - " return op;\r", - "}\r", - "\r", - "function opToJsFormat(op) {\r", - " res = null;\r", - " switch (op) {\r", - " case \"and\":\r", - " return \"&&\";\r", - " case \"or\":\r", - " return \"||\";\r", - " case \"not\":\r", - " return \"!\";\r", - " case \"eq\":\r", - " return \"==\";\r", - " case \"ne\":\r", - " return \"!=\";\r", - " case \"gt\":\r", - " return \">\";\r", - " case \"ge\":\r", - " return \">=\";\r", - " case \"lt\":\r", - " return \"<\";\r", - " case \"le\":\r", - " return \"<=\";\r", - " }\r", - "}\r", - "\r", - "function get_query_filters(input_query) {\r", - "\r", - " console.log(\"Parsing Filter...\");\r", - "\r", - " var matcher = /(contains\\((.+?)\\)|startswith\\((.+?)\\)|endswith\\((.+?)\\)|any\\(.*?\\)|ContentDate\\/Start.*Z|ContentDate\\/End.*Z|[\\w.]+?\\s(?:eq|ne|gt|ge|lt|le)\\s(?:\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)|[+-]?([0-9]*[.])?[0-9]+|\\w+|'.+?'))/g\r", - "\r", - " var filters = input_query.match(matcher);\r", - " var i = 0;\r", - " var simpleString = input_query.replace(matcher, function () {\r", - " return i++;\r", - " });\r", - "\r", - " console.log(simpleString);\r", - " console.log(filters);\r", - "\r", - " var filterString = simpleString;\r", - "\r", - " var groupString;\r", - " var groupFilter = null;\r", - " var testNextLevel = true;\r", - "\r", - " while (testNextLevel) {\r", - " var closeParenthesisIndex = filterString.indexOf(')');\r", - " if (closeParenthesisIndex !== -1) {\r", - " var openParenthesisIndex = filterString.lastIndexOf('(', closeParenthesisIndex);\r", - "\r", - " // Extract the string between the first deepest set of parenthesis\r", - " groupString = filterString.substring(openParenthesisIndex + 1, closeParenthesisIndex);\r", - "\r", - " // Modify the filter string replacing the contents of the group string in addition to the parenthesis with the length of the filters array (which will be the index of the filter object that we push)\r", - " filterString = filterString.substring(0, openParenthesisIndex) + filters.length + filterString.substring(closeParenthesisIndex + 1);\r", - " } else {\r", - "\r", - " // There are no more parenthesis groups\r", - " groupString = filterString;\r", - " testNextLevel = false;\r", - " }\r", - "\r", - " // If the group uses both 'and' and 'or' then return null as an invalid filter string.\r", - " if (groupString.indexOf('and') >= 0 && groupString.indexOf('or') >= 0) {\r", - " console.log(\"Invalid Filter!\");\r", - " return null;\r", - " }\r", - "\r", - " // Get the group indexes out of the group string\r", - " var groupFilterIndexes = groupString.match(/[0-9]+/g);\r", - " var groupFilters = [];\r", - "\r", - " // Create an array with each of the filters who's index matches the group indexes\r", - " for (i = 0; i < groupFilterIndexes.length; i++) {\r", - " groupFilters.push(filters[Number(groupFilterIndexes[i])]);\r", - " }\r", - "\r", - " //cycling over the supported operators\r", - " var op = getOperator(groupString, supportedOperators);\r", - "\r", - " //redundant brakets management\r", - " if (op == null) {\r", - " groupFilters.push(\"true\");\r", - " op = \"and\";\r", - " }\r", - "\r", - " // Create the filter object and push it onto the filters array\r", - " groupFilter = { op: op, filters: groupFilters };\r", - " filters.push(groupFilter);\r", - " }\r", - "\r", - " return groupFilter;\r", - "\r", - "}\r", - "\r", - "function checkResponse(inputString, product) {\r", - " console.log(\"Input String: \" + inputString);\r", - " //console.log(\"Product:\");\r", - " //console.log(product);\r", - " var responseProperties = Object.keys(product);\r", - " var responseAttributes = {};\r", - "\r", - " //Attribute\r", - " if (inputString.includes(\"any(\") && inputString.includes(\"/Name\") && inputString.includes(\"/Value\")) {\r", - " //Attribute Logic Assertion\r", - " if (responseProperties.indexOf(\"Attributes\") >= 0) {\r", - " product['Attributes'].forEach(function (el) {\r", - " responseAttributes[el.Name] = el.Value;\r", - " });\r", - "\r", - " //functions in Attribute Value\r", - " var cleanedInputString = inputString.split(\"any(\").pop();\r", - " console.log(\"CLEANED ATTRIBUTE INPUTSTRING: \" + cleanedInputString);\r", - " if (cleanedInputString.includes(\"(\") && cleanedInputString.includes(\")\")) {\r", - " //get the function name\r", - " var functionName = cleanedInputString.split(\"(\")[0].split(\" \").pop();\r", - " if (supportedFunctions.indexOf(functionName) >= 0) {\r", - " console.log(\"Found Attribute Function: \" + functionName);\r", - " //get the attribute\r", - " var attrToCheck = cleanedInputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", - " console.log(\"Attribute KEY Found: \" + attrToCheck);\r", - " //get the cleaned value\r", - " var attrValueToCheck = cleanedInputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", - " console.log(\"Attribute VALUE Found: \" + attrValueToCheck);\r", - "\r", - " switch (functionName) {\r", - " case \"contains\":\r", - " attributesUnderTest.push(attrToCheck + \" contains \" + attrValueToCheck);\r", - " return (responseAttributes[attrToCheck].includes(attrValueToCheck)) ? true : false;\r", - " case \"startswith\":\r", - " attributesUnderTest.push(attrToCheck + \" startswith \" + attrValueToCheck);\r", - " return responseAttributes[attrToCheck].startsWith(attrValueToCheck) ? true : false;\r", - " case \"endswith\":\r", - " attributesUnderTest.push(attrToCheck + \" endswith \" + attrValueToCheck);\r", - " return responseAttributes[attrToCheck].endsWith(attrValueToCheck) ? true : false;\r", - " }\r", - " }\r", - " } else {\r", - " //simple any(Attributes Name and Value)\r", - " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", - " console.log(\"Extracted Attribute KEY: \" + attrToCheck);\r", - " var attrValueToCheck = inputString.split('Value eq ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\\\/g, \"\");\r", - " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck);\r", - "\r", - " attributesUnderTest.push(\"attr:\" + attrToCheck + \" eq \" + attrValueToCheck);\r", - "\r", - " return responseAttributes[attrToCheck] == attrValueToCheck;\r", - " }\r", - " }\r", - " } else {\r", - " //inputString contains a function on a Property -> complex property not supported!\r", - " if (inputString.includes(\"(\") && inputString.includes(\")\")) {\r", - " //get the function name\r", - " var functionName = inputString.split(\"(\")[0];\r", - " if (supportedFunctions.indexOf(functionName) >= 0) {\r", - " console.log(\"Found Function: \" + functionName);\r", - " //get the property\r", - " var propertyToCheck = inputString.split(\"(\")[1].split(\",\")[0].trim();\r", - " console.log(\"Property Found: \" + propertyToCheck);\r", - "\r", - " //get the cleaned value\r", - " var propValueToCheck = inputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", - " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", - "\r", - " switch (functionName) {\r", - " case \"contains\":\r", - " propertiesUnderTest.push(propertyToCheck + \" contains \" + propValueToCheck);\r", - " return (product[propertyToCheck].includes(propValueToCheck)) ? true : false;\r", - " case \"startswith\":\r", - " propertiesUnderTest.push(propertyToCheck + \" startswith \" + propValueToCheck);\r", - " return product[propertyToCheck].startsWith(propValueToCheck) ? true : false;\r", - " case \"endswith\":\r", - " propertiesUnderTest.push(propertyToCheck + \" endswith \" + propValueToCheck);\r", - " return product[propertyToCheck].endsWith(propValueToCheck) ? true : false;\r", - " }\r", - " } else {\r", - " console.log(\"Unsupported Function: \" + functionName);\r", - " return false;\r", - " }\r", - " } else {\r", - " // single logic assertion in \"AND\" with \"true\"\r", - " if (inputString === \"true\") {\r", - " console.log(\"True Value!\");\r", - " return true;\r", - " } else {\r", - " //direct Property\r", - " var propertyToCheck = inputString.split(\" \")[0].trim();\r", - " var operatorToApply = inputString.split(\" \")[1];\r", - " var propValueToCheck = inputString.split(\" \")[2].trim().replace(/'/g, \"\");\r", - "\r", - " console.log(\"Property Found: \" + propertyToCheck);\r", - " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", - "\r", - " if (supportedOperators.indexOf(operatorToApply) >= 0) {\r", - " console.log(\"Operator To Apply: \" + operatorToApply);\r", - " operator = opToJsFormat(operatorToApply);\r", - " propertiesUnderTest.push(propertyToCheck + \" \" + operatorToApply + \" \" + propValueToCheck);\r", - "\r", - " var toEvalString = \"\";\r", - " var subProperty = \"\";\r", - "\r", - " //Complex properties (ContentDate)\r", - " if(propertyToCheck.includes(\"/\")){\r", - " var rootPropertyToCheck = propertyToCheck.split(\"/\")[0];\r", - " subProperty = propertyToCheck.split(\"/\")[1];\r", - "\r", - " console.log(\"Complex Property: \" + rootPropertyToCheck);\r", - " console.log(\"Sub Property: \" + subProperty);\r", - "\r", - " toEvalString = \"product[rootPropertyToCheck][subProperty] \" + operator + \" propValueToCheck\";\r", - "\r", - " } else {\r", - " toEvalString = \"product[propertyToCheck] \" + operator + \" propValueToCheck\";\r", - " }\r", - "\r", - " return eval(toEvalString);\r", - " } else {\r", - " console.log(\"Operator not supported\");\r", - " return false;\r", - " }\r", - " }\r", - " }\r", - " }\r", - " console.log(\"Logic Assertion not computed: \" + inputString);\r", - " return Math.random() >= 0.5;\r", - "}\r", - "\r", - "function treeIterator(tree, product) {\r", - " if (tree['filters'].length >= 0) {\r", - " var conditions = [];\r", - "\r", - " var logicOperator = getOperator(tree['op'], supportedOperators);\r", - " var logicOperator = opToJsFormat(logicOperator);\r", - "\r", - " //general tree: iterates over all filters (child nodes)\r", - " for (elem in tree['filters']) {\r", - " var currentCondition = typeof ((tree['filters'][elem])) == \"object\" ? treeIterator(tree['filters'][elem], product) : checkResponse(tree['filters'][elem], product);\r", - " conditions.push(currentCondition);\r", - " //optimize AND and OR\r", - " if(logicOperator == \"||\" && currentCondition){\r", - " break;\r", - " }\r", - " if(logicOperator == \"&&\" && !currentCondition){\r", - " break;\r", - " }\r", - " }\r", - " console.log(\"CURRENT CONDITIONS\");\r", - " console.log(conditions);\r", - "\r", - " //building return string\r", - " var resString = \"(\";\r", - " for (elem in conditions) {\r", - " resString += conditions[elem] + \" \" + logicOperator.toString() + \" \";\r", - " }\r", - " resString = resString.substring(0, resString.length - 4);\r", - " resString += \")\";\r", - "\r", - " console.log(\"RES String: \" + resString);\r", - "\r", - " return resString;\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().value;\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " //MIN number of BatchOrder Products Test\r", - " var bulk_batchsize_products = pm.collectionVariables.get('bulk_batchsize_products');\r", - " pm.test(\"Expected BatchOrder number of products Test: \" + bulk_batchsize_products, function(){\r", - " pm.expect(jsonDataElements.length).to.be.lte(bulk_batchsize_products);\r", - " pm.expect(jsonDataElements.length).to.be.gte(1);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " query_string = pm.request.url.getQueryString();\r", - " if(query_string.includes(\"$expand=Attributes\")){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Products(Attributes())\");\r", - " } else{\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Products\");\r", - " }\r", - " });\r", - "\r", - " for (var counter = 0; counter < jsonDataElements.length; counter++){\r", - " var product = jsonDataElements[counter];\r", - " console.log(\"Processing Product: \"+product.Name+\" - \"+product.Id);\r", - "\r", - " pm.test(\"Test Properties for product: \" + product.Id, function(){\r", - " pm.expect(product).to.have.property(\"Id\");\r", - " pm.expect(product.Id).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"Name\");\r", - " pm.expect(product.Name).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"ContentType\");\r", - " pm.expect(product.ContentType).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"ContentLength\");\r", - " pm.expect(product.ContentLength).to.be.a(\"number\");\r", - " pm.expect(product).to.have.property(\"OriginDate\");\r", - " pm.expect(product.OriginDate).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"PublicationDate\");\r", - " pm.expect(product.PublicationDate).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"ModificationDate\");\r", - " pm.expect(product.ModificationDate).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"Online\");\r", - " pm.expect(product.Online).to.be.a(\"boolean\");\r", - " pm.expect(product).to.have.property(\"Checksum\");\r", - " pm.expect(product.Checksum).to.be.an(\"array\");\r", - " pm.expect(product).to.have.property(\"ContentDate\");\r", - " pm.expect(product.ContentDate).to.be.an(\"object\");\r", - " }); \r", - " \r", - " if(\"Attributes\" in jsonDataElements[counter]){\r", - " schema_seen = {};\r", - "\r", - " pm.test(\"Test Attributes list for product: \" + jsonDataElements[counter].Id, function(){\r", - " pm.expect(jsonDataElements[counter].Attributes.length).to.be.above(0);\r", - " jsonDataElements[counter].Attributes.forEach(function(elem){\r", - " pm.expect(elem).to.have.all.keys(\"Name\", \"Value\", \"ValueType\");\r", - " });\r", - " }); \r", - " }\r", - " }\r", - "\r", - " //Filter Param Test\r", - " var filterParam = pm.collectionVariables.get(\"current_batch_filter_param\");\r", - " parsed_filters = get_query_filters(filterParam);\r", - " console.log(parsed_filters);\r", - " if (typeof (parsed_filters) == \"object\") {\r", - " for (var counter = 0; counter < jsonDataElements.length; counter++) {\r", - "\r", - " attributesUnderTest = [];\r", - " propertiesUnderTest = [];\r", - "\r", - " var product = jsonDataElements[counter];\r", - " var treeExp = treeIterator(parsed_filters, product);\r", - " var booleanTreeExp = eval(treeExp);\r", - "\r", - " console.log(treeExp); console.log(booleanTreeExp);\r", - "\r", - " testMessage = \"FilterParam \" + filterParam + \" Check: \" + product.Name;\r", - "\r", - " pm.test(testMessage, function () {\r", - " pm.expect(booleanTreeExp, \"FilterParam Check\").to.be.true;\r", - " });\r", - " }\r", - " }\r", - "}\r", - "\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/BatchOrders({{current_batch_order_id}})/Products", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "BatchOrders({{current_batch_order_id}})", - "Products" - ] - } - }, - "response": [] - }, - { - "name": "BatchOrderTriggering", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "try {\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([204]);\r", - " });\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"Priority\": 33\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/BatchOrders({{current_batch_order_id}})/OData.CSC.BatchOrder", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "BatchOrders({{current_batch_order_id}})", - "OData.CSC.BatchOrder" - ] - } - }, - "response": [] - }, - { - "name": "BatchOrderDetailsAfterTrigger", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"in_progress\"]);\r", - "};\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder is under processing\"]);\r", - "};\r", - "properties_map.CompletedDate=function (element) {\r", - " pm.expect(element.CompletedDate).to.be.equal(null);\r", - "};\r", - "properties_map.SubmissionDate=function (element) {\r", - " pm.expect(element.SubmissionDate).to.be.a(\"string\");\r", - " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - "};\r", - "properties_map.EstimatedDate=function (element) {\r", - " pm.expect(element.EstimatedDate).to.be.a(\"string\");\r", - " pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - "};\r", - "properties_map.OrderSize=function (element) {\r", - " pm.expect(element.OrderSize).to.be.equal(null);\r", - "};\r", - "properties_map.Priority=function (element) {\r", - " pm.expect(element.Priority).to.be.a(\"number\");\r", - "};\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for BatchOrder: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for BatchOrder: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().value[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", - " });\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var batch = jsonDataElements;\r", - "\r", - " var batchorder_response = {};\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, batch);\r", - " batchorder_response[key] = batch[key];\r", - " pm.collectionVariables.set(\"current_batchorder_\" + key, batch[key]);\r", - " }\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } + }, + "response": [] }, { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=Status eq OData.CSC.JobStatus'in_progress'", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "BatchOrders" - ], - "query": [ + "name": "Completed_Order_Properties", + "event": [ { - "key": "$filter", - "value": "Status eq OData.CSC.JobStatus'in_progress'" - } - ] - } - }, - "response": [] - }, - { - "name": "GetCompletedBatchOrder", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"completed\"]);\r", - "};\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"requested products of BatchOrder are available\"]);\r", - "};\r", - "properties_map.CompletedDate=function (element) {\r", - " pm.expect(element.CompletedDate).to.be.a(\"string\");\r", - " pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - "};\r", - "properties_map.SubmissionDate=function (element) {\r", - " pm.expect(element.SubmissionDate).to.be.a(\"string\");\r", - " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - "};\r", - "properties_map.EstimatedDate=function (element) {\r", - " pm.expect(element.EstimatedDate).to.be.a(\"string\");\r", - " pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - "};\r", - "properties_map.OrderSize=function (element) {\r", - " pm.expect(element.OrderSize).to.be.a(\"number\");\r", - "};\r", - "properties_map.Priority=function (element) {\r", - " pm.expect(element.Priority).to.be.a(\"number\");\r", - "};\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for BatchOrder: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for BatchOrder: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().value[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", - " });\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var batch = jsonDataElements;\r", - "\r", - " var batchorder_response = {};\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, batch);\r", - " batchorder_response[key] = batch[key];\r", - " pm.collectionVariables.set(\"current_batchorder_\" + key, batch[key]);\r", - " }\r", - "\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=Status eq OData.CSC.JobStatus'completed'", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "BatchOrders" - ], - "query": [ + "listen": "prerequest", + "script": { + "exec": [ + "try {\r", + " var current_completed_order = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \")[1];\r", + " console.log(current_completed_order);\r", + " pm.variables.unset(\"current_completed_order_id\"); \r", + " if(current_completed_order == \"{{current_completed_order_id}}\"){\r", + " current_completed_order = pm.collectionVariables.get('completed_orders');\r", + " //get random product from collected completed orders\r", + " var random_completed_order = current_completed_order[Math.floor(Math.random()*current_completed_order.length)];\r", + " pm.variables.set(\"current_completed_order_id\", random_completed_order[\"Id\"]);\r", + " } else {\r", + " pm.variables.set(\"current_completed_order_id\", current_completed_order);\r", + " }\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, { - "key": "$filter", - "value": "Status eq OData.CSC.JobStatus'completed'" + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"in_progress\",\"queued\",\"failed\",\"completed\", \"cancelled\"]);\r", + "};\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\r", + " \"request is under processing\",\r", + " \"request is queued\",\r", + " \"request product is available\",\r", + " \"product currently unavailable\",\r", + " \"request cancelled by user\"]);\r", + "};\r", + "properties_map.Priority=function (element) {pm.expect(element.Priority).to.be.a(\"number\");}; \r", + "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "properties_map.EstimatedDate=function (element) {pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d\\d\\d(\\d*)Z/);};\r", + "\r", + "properties_map.OrderSize=function (element) {pm.expect(element.OrderSize).to.be.a(\"number\");};\r", + "properties_map.CompletedDate=function (element) {pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "properties_map.EvictionDate=function (element) {if(element.EvictionDate){ pm.expect(element.EvictionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/); }};\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Order: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Order: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().value[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var order_response = {};\r", + "\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, jsonDataElements);\r", + " //filling the collection variable order array\r", + " order_response[key] = jsonDataElements[key];\r", + " pm.collectionVariables.set(\"current_order_\" + key, jsonDataElements[key]);\r", + " }\r", + "\r", + " pm.collectionVariables.set(\"expected_current_order_values\", order_response);\r", + " pm.collectionVariables.set(\"order_filter_counter\", 0);\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } } - ] - } - }, - "response": [] - }, - { - "name": "BatchOrderFilter_by_Id", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"Id\";\r", - "\r", - "try {\r", - " current_batch_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", - "\r", - " pm.test(\"Expected BatchOrder \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_batch_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=Id eq {{current_batchorder_Id}}", - "host": [ - "{{service-root-uri}}" ], - "path": [ - "odata", - "v1", - "BatchOrders" - ], - "query": [ - { - "key": "$filter", - "value": "Id eq {{current_batchorder_Id}}" + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{password}}", + "type": "string" + }, + { + "key": "username", + "value": "{{username}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=Id eq {{current_completed_order_id}}", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Orders" + ], + "query": [ + { + "key": "$filter", + "value": "Id eq {{current_completed_order_id}}" + } + ] } - ] - } - }, - "response": [] - }, - { - "name": "BatchOrderFilter_by_Status", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"Status\";\r", - "\r", - "try {\r", - " current_batch_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().split(\"OData.CSC.JobStatus\").pop().replace(/'/g, \"\");\r", - "\r", - " pm.test(\"Expected BatchOrder \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_batch_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } + }, + "response": [] }, { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=Status eq OData.CSC.JobStatus'{{current_batchorder_Status}}'", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "BatchOrders" - ], - "query": [ + "name": "Order_Filter_By_OrderSize", + "event": [ { - "key": "$filter", - "value": "Status eq OData.CSC.JobStatus'{{current_batchorder_Status}}'" - } - ] - } - }, - "response": [] - }, - { - "name": "BatchOrderFilter_by_StatusMessage", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"StatusMessage\";\r", - "\r", - "try {\r", - " current_batch_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", - "\r", - " pm.test(\"Expected BatchOrder \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_batch_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=StatusMessage eq {{current_batchorder_StatusMessage}}", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "BatchOrders" - ], - "query": [ + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"OrderSize\";\r", + "\r", + "try {\r", + " current_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = parseInt(decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\"));\r", + "\r", + " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, { - "key": "$filter", - "value": "StatusMessage eq {{current_batchorder_StatusMessage}}" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } } - ] - } - }, - "response": [] - }, - { - "name": "BatchOrderFilter_by_Priority", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"Priority\";\r", - "\r", - "try {\r", - " current_batch_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = parseInt(decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\"));\r", - "\r", - " pm.test(\"Expected BatchOrder \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_batch_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=Priority eq {{current_batchorder_Priority}}", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "BatchOrders" ], - "query": [ - { - "key": "$filter", - "value": "Priority eq {{current_batchorder_Priority}}" + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=OrderSize eq {{current_order_OrderSize}}", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Orders" + ], + "query": [ + { + "key": "$filter", + "value": "OrderSize eq {{current_order_OrderSize}}" + } + ] } - ] - } - }, - "response": [] - }, - { - "name": "BatchOrderFilter_by_OrderSize", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"OrderSize\";\r", - "\r", - "try {\r", - " current_batch_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = parseInt(decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\"));\r", - "\r", - " pm.test(\"Expected BatchOrder \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_batch_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } + }, + "response": [] }, { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=OrderSize eq {{current_batchorder_OrderSize}}", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "BatchOrders" - ], - "query": [ + "name": "Order_Filter_By_CompletedDate", + "event": [ { - "key": "$filter", - "value": "OrderSize eq {{current_batchorder_OrderSize}}" - } - ] - } - }, - "response": [] - }, - { - "name": "BatchOrderFilter_by_SubmissionDate", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"SubmissionDate\";\r", - "\r", - "try {\r", - " current_batch_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", - "\r", - " pm.test(\"Expected BatchOrder \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_batch_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=SubmissionDate eq {{current_batchorder_SubmissionDate}}", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "BatchOrders" - ], - "query": [ + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"CompletedDate\";\r", + "\r", + "try {\r", + " current_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", + "\r", + " console.log(expected_order_key_value);\r", + "\r", + " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, { - "key": "$filter", - "value": "SubmissionDate eq {{current_batchorder_SubmissionDate}}" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } } - ] - } - }, - "response": [] - }, - { - "name": "BatchOrderFilter_by_EstimatedDate", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"EstimatedDate\";\r", - "\r", - "try {\r", - " current_batch_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", - "\r", - " pm.test(\"Expected BatchOrder \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_batch_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=EstimatedDate eq {{current_batchorder_EstimatedDate}}", - "host": [ - "{{service-root-uri}}" ], - "path": [ - "odata", - "v1", - "BatchOrders" - ], - "query": [ - { - "key": "$filter", - "value": "EstimatedDate eq {{current_batchorder_EstimatedDate}}" + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=CompletedDate eq {{current_order_CompletedDate}}", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Orders" + ], + "query": [ + { + "key": "$filter", + "value": "CompletedDate eq {{current_order_CompletedDate}}" + } + ] } - ] - } - }, - "response": [] - }, - { - "name": "BatchOrderFilter_by_CompletedDate", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var jsonDataElements = pm.response.json().value;\r", - "current_tested_filter_key = \"CompletedDate\";\r", - "\r", - "try {\r", - " current_batch_order = jsonDataElements[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", - "\r", - " pm.test(\"Expected BatchOrder \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", - " pm.expect(current_batch_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", - " });\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } + }, + "response": [] }, { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=CompletedDate eq {{current_batchorder_CompletedDate}}", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "BatchOrders" - ], - "query": [ + "name": "Order_Filter_By_EvictionDate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"EvictionDate\";\r", + "\r", + "try {\r", + " current_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", + "\r", + " pm.test(\"Expected Order \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(\"Order Filter \" + current_tested_filter_key + \" Test\", function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, { - "key": "$filter", - "value": "CompletedDate eq {{current_batchorder_CompletedDate}}" + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } } - ] - } - }, - "response": [] - }, - { - "name": "BatchOrderCancel", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"cancelled\"]);\r", - "};\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder cancelled by user\"]);\r", - "};\r", - "properties_map.CompletedDate=function (element) {\r", - " pm.expect(element.CompletedDate).to.be.equal(null);\r", - "};\r", - "properties_map.SubmissionDate=function (element) {\r", - " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - "};\r", - "properties_map.EstimatedDate=function (element) {\r", - " pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - "};\r", - "properties_map.OrderSize=function (element) {\r", - " pm.expect(element.OrderSize).to.be.equal(0);\r", - "};\r", - "properties_map.Priority=function (element) {\r", - " pm.expect(element.Priority).to.be.a(\"number\");\r", - "};\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for BatchOrder: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for BatchOrder: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json();\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"metadata#OData.CSC.BatchOrder\");\r", - " });\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var batch = jsonDataElements;\r", - " console.log(\"Processing Batch: \"+batch.Id);\r", - "\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, batch);\r", - " }\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/BatchOrders({{current_batch_order_id}})/OData.CSC.Cancel", - "host": [ - "{{service-root-uri}}" ], - "path": [ - "odata", - "v1", - "BatchOrders({{current_batch_order_id}})", - "OData.CSC.Cancel" - ] - } - }, - "response": [] - }, - { - "name": "BulkCancel", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"created\", \"in_progress\", \"completed\", \"failed\", \"cancelled\"]);\r", - "};\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " switch(element.Status){\r", - " case \"created\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk has been created but no BatchOrders have been triggered\"]);\r", - " break;\r", - " case \"in_progress\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"One or more BatchOrders are under processing\"]);\r", - " break;\r", - " case \"completed\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"requested products of all BatchOrders comprising the Bulk are in status 'completed'\"]);\r", - " break;\r", - " case \"cancelled\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk cancelled by user\"]);\r", - " break;\r", - " case \"failed\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"at least one product retrieval has failed\", \"at least one product currently unavailable\", \"at least one product not found on LTA\"]);\r", - " break;\r", - " }\r", - "};\r", - "properties_map.FilterParam=function (element) {\r", - " pm.expect(element.FilterParam).to.be.a(\"string\");\r", - "};\r", - "properties_map.SubmissionDate=function (element) {\r", - " pm.expect(element.SubmissionDate).to.be.a(\"string\");\r", - " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - "};\r", - "properties_map.BatchsizeProducts=function (element) {\r", - " pm.expect(element.BatchsizeProducts).to.be.a(\"number\");\r", - "};\r", - "properties_map.BatchsizeVolume=function (element) {\r", - " pm.expect(element.BatchsizeVolume).to.be.a(\"number\");\r", - "};\r", - "properties_map.NotificationEndpoint=function (element) {\r", - " if(element.NotificationEndpoint){\r", - " if(typeof(element.NotificationEndpoint)==\"string\"){\r", - " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", - " } else pm.expect(element.NotificationEndpoint).to.be.equal(null);\r", - " }\r", - "};\r", - "properties_map.OrderbyParam=function (element) {\r", - " if(element.OrderbyParam){\r", - " if(typeof(element.OrderbyParam)==\"string\"){\r", - " pm.expect(element.OrderbyParam).to.be.a(\"string\");\r", - " } else pm.expect(element.OrderbyParam).to.be.equal(null);\r", - " }\r", - "\r", - "};\r", - "properties_map.CompletedDate=function (element) {\r", - " if(element.CompletedDate){\r", - " switch(element.Status){\r", - " case \"completed\":\r", - " pm.expect(element.CompletedDate).to.be.a(\"string\");\r", - " pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - " break;\r", - " default:\r", - " if(element.CompletedDate){\r", - " pm.expect(element.CompletedDate).to.be.equal(null)\r", - " } \r", - " }\r", - " }\r", - "};\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Bulk: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Bulk: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json();\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Bulk\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, jsonDataElements);\r", - " }\r", - "\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - }, - { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Orders?$filter=EvictionDate eq {{current_order_EvictionDate}}", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Orders" + ], + "query": [ + { + "key": "$filter", + "value": "EvictionDate eq {{current_order_EvictionDate}}" + } + ] + } + }, + "response": [] }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/Bulks({{bulk_id}})/OData.CSC.Cancel", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Bulks({{bulk_id}})", - "OData.CSC.Cancel" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Subscriptions", - "item": [ - { - "name": "CreateSubscription_noStaging", - "event": [ { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.FilterParam=function (element) {\r", - " pm.expect(element.FilterParam).to.be.a(\"string\");\r", - " pm.expect(element.FilterParam).to.be.not.equal(null);\r", - "};\r", - "\r", - "properties_map.LastNotificationDate=function (element) {pm.expect(element.LastNotificationDate).to.be.equal(null);};\r", - "\r", - "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "\r", - "properties_map.Priority=function (element) {\r", - " pm.expect(element.Priority).to.be.equal(null);\r", - "};\r", - "\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"running\"]);\r", - "};\r", - "\r", - "properties_map.StageOrder=function (element) {\r", - " pm.expect(element.StageOrder).to.be.equal(false);\r", - "};\r", - "\r", - "properties_map.SubscriptionEvent=function (element) {\r", - " pm.expect(element.SubscriptionEvent).to.be.a(\"string\");\r", - " pm.expect(element.SubscriptionEvent).to.be.oneOf([\"created\"]);\r", - "};\r", - "\r", - "properties_map.NotificationEndpoint=function (element) {\r", - " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", - "};\r", - "\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Subscription: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Subscription: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json();\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Subscription\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, jsonDataElements);\r", - " }\r", - "\r", - " pm.collectionVariables.set('no_staging_subscription', jsonDataElements);\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"@odata.context\": \"$metadata#Subscription/entity\",\r\n \"FilterParam\": \"startswith(Name,'S1')\",\r\n \"SubscriptionEvent\": \"created\",\r\n \"StageOrder\": false,\r\n \"Priority\": 25,\r\n \"NotificationEndpoint\": \"http://{{notification_server_url}}/{{lta_path}}\",\r\n \"NotificationEpUsername\": \"{{notification_username}}\",\r\n \"NotificationEpPassword\": \"{{notification_password}}\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/Subscriptions", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Subscriptions" - ] - } - }, - "response": [] - }, - { - "name": "GetProductAvailabilityNotifications", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const supportedOperators = [\"eq\", \"ne\", \"gt\", \"ge\", \"lt\", \"le\", \"and\", \"or\", \"not\"];\r", - "const supportedFunctions = [\"startswith\", \"contains\", \"endswith\"];\r", - "\r", - "function compare(a, b){\r", - " if(isNaN(a)){\r", - " return String(a).localeCompare(String(b));\r", - " } else {\r", - " return a > b;\r", - " } \r", - "}\r", - "\r", - "function getOperator(inputString, possibleOperators) {\r", - " var op = null;\r", - " possibleOperators.forEach(function (el) { if (inputString.indexOf(el) >= 0) { op = el; } });\r", - " return op;\r", - "}\r", - "\r", - "function opToJsFormat(op) {\r", - " res = null;\r", - " switch (op) {\r", - " case \"and\":\r", - " return \"&&\";\r", - " case \"or\":\r", - " return \"||\";\r", - " case \"not\":\r", - " return \"!\";\r", - " case \"eq\":\r", - " return \"==\";\r", - " case \"ne\":\r", - " return \"!=\";\r", - " case \"gt\":\r", - " return \">\";\r", - " case \"ge\":\r", - " return \">=\";\r", - " case \"lt\":\r", - " return \"<\";\r", - " case \"le\":\r", - " return \"<=\";\r", - " }\r", - "}\r", - "\r", - "function get_query_filters(input_query) {\r", - "\r", - " console.log(\"Parsing Filter...\");\r", - "\r", - " var matcher = /(contains\\((.+?)\\)|startswith\\((.+?)\\)|endswith\\((.+?)\\)|any\\(.*?\\)|ContentDate\\/Start.*Z|ContentDate\\/End.*Z|[\\w.]+?\\s(?:eq|ne|gt|ge|lt|le)\\s(?:\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)|[+-]?([0-9]*[.])?[0-9]+|\\w+|'.+?'))/g\r", - "\r", - " var filters = input_query.match(matcher);\r", - " var i = 0;\r", - " var simpleString = input_query.replace(matcher, function () {\r", - " return i++;\r", - " });\r", - "\r", - " console.log(simpleString);\r", - " console.log(filters);\r", - "\r", - " var filterString = simpleString;\r", - "\r", - " var groupString;\r", - " var groupFilter = null;\r", - " var testNextLevel = true;\r", - "\r", - " while (testNextLevel) {\r", - " var closeParenthesisIndex = filterString.indexOf(')');\r", - " if (closeParenthesisIndex !== -1) {\r", - " var openParenthesisIndex = filterString.lastIndexOf('(', closeParenthesisIndex);\r", - "\r", - " // Extract the string between the first deepest set of parenthesis\r", - " groupString = filterString.substring(openParenthesisIndex + 1, closeParenthesisIndex);\r", - "\r", - " // Modify the filter string replacing the contents of the group string in addition to the parenthesis with the length of the filters array (which will be the index of the filter object that we push)\r", - " filterString = filterString.substring(0, openParenthesisIndex) + filters.length + filterString.substring(closeParenthesisIndex + 1);\r", - " } else {\r", - "\r", - " // There are no more parenthesis groups\r", - " groupString = filterString;\r", - " testNextLevel = false;\r", - " }\r", - "\r", - " // If the group uses both 'and' and 'or' then return null as an invalid filter string.\r", - " if (groupString.indexOf('and') >= 0 && groupString.indexOf('or') >= 0) {\r", - " console.log(\"Invalid Filter!\");\r", - " return null;\r", - " }\r", - "\r", - " // Get the group indexes out of the group string\r", - " var groupFilterIndexes = groupString.match(/[0-9]+/g);\r", - " var groupFilters = [];\r", - "\r", - " // Create an array with each of the filters who's index matches the group indexes\r", - " for (i = 0; i < groupFilterIndexes.length; i++) {\r", - " groupFilters.push(filters[Number(groupFilterIndexes[i])]);\r", - " }\r", - "\r", - " //cycling over the supported operators\r", - " var op = getOperator(groupString, supportedOperators);\r", - "\r", - " //redundant brakets management\r", - " if (op == null) {\r", - " groupFilters.push(\"true\");\r", - " op = \"and\";\r", - " }\r", - "\r", - " // Create the filter object and push it onto the filters array\r", - " groupFilter = { op: op, filters: groupFilters };\r", - " filters.push(groupFilter);\r", - " }\r", - "\r", - " return groupFilter;\r", - "\r", - "}\r", - "\r", - "function checkResponse(inputString, product) {\r", - " console.log(\"Input String: \" + inputString);\r", - " //console.log(\"Product:\");\r", - " //console.log(product);\r", - " var responseProperties = Object.keys(product);\r", - " var responseAttributes = {};\r", - "\r", - " //Attribute\r", - " if (inputString.includes(\"any(\") && inputString.includes(\"/Name\") && inputString.includes(\"/Value\")) {\r", - " //Attribute Logic Assertion\r", - " if (responseProperties.indexOf(\"Attributes\") >= 0) {\r", - " product['Attributes'].forEach(function (el) {\r", - " responseAttributes[el.Name] = el.Value;\r", - " });\r", - "\r", - " //functions in Attribute Value\r", - " var cleanedInputString = inputString.split(\"any(\").pop();\r", - " console.log(\"CLEANED ATTRIBUTE INPUTSTRING: \" + cleanedInputString);\r", - " if (cleanedInputString.includes(\"(\") && cleanedInputString.includes(\")\")) {\r", - " //get the function name\r", - " var functionName = cleanedInputString.split(\"(\")[0].split(\" \").pop();\r", - " if (supportedFunctions.indexOf(functionName) >= 0) {\r", - " console.log(\"Found Attribute Function: \" + functionName);\r", - " //get the attribute\r", - " var attrToCheck = cleanedInputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", - " console.log(\"Attribute KEY Found: \" + attrToCheck);\r", - " //get the cleaned value\r", - " var attrValueToCheck = cleanedInputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", - " console.log(\"Attribute VALUE Found: \" + attrValueToCheck);\r", - "\r", - " switch (functionName) {\r", - " case \"contains\":\r", - " attributesUnderTest.push(attrToCheck + \" contains \" + attrValueToCheck);\r", - " return (responseAttributes[attrToCheck].includes(attrValueToCheck)) ? true : false;\r", - " case \"startswith\":\r", - " attributesUnderTest.push(attrToCheck + \" startswith \" + attrValueToCheck);\r", - " return responseAttributes[attrToCheck].startsWith(attrValueToCheck) ? true : false;\r", - " case \"endswith\":\r", - " attributesUnderTest.push(attrToCheck + \" endswith \" + attrValueToCheck);\r", - " return responseAttributes[attrToCheck].endsWith(attrValueToCheck) ? true : false;\r", - " }\r", - " }\r", - " } else {\r", - " //simple any(Attributes Name and Value)\r", - " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", - " console.log(\"Extracted Attribute KEY: \" + attrToCheck);\r", - " var attrValueToCheck = inputString.split('Value eq ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\\\/g, \"\");\r", - " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck);\r", - "\r", - " attributesUnderTest.push(\"attr:\" + attrToCheck + \" eq \" + attrValueToCheck);\r", - "\r", - " return responseAttributes[attrToCheck] == attrValueToCheck;\r", - " }\r", - " }\r", - " } else {\r", - " //inputString contains a function on a Property -> complex property not supported!\r", - " if (inputString.includes(\"(\") && inputString.includes(\")\")) {\r", - " //get the function name\r", - " var functionName = inputString.split(\"(\")[0];\r", - " if (supportedFunctions.indexOf(functionName) >= 0) {\r", - " console.log(\"Found Function: \" + functionName);\r", - " //get the property\r", - " var propertyToCheck = inputString.split(\"(\")[1].split(\",\")[0].trim();\r", - " console.log(\"Property Found: \" + propertyToCheck);\r", - "\r", - " //get the cleaned value\r", - " var propValueToCheck = inputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", - " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", - "\r", - " switch (functionName) {\r", - " case \"contains\":\r", - " propertiesUnderTest.push(propertyToCheck + \" contains \" + propValueToCheck);\r", - " return (product[propertyToCheck].includes(propValueToCheck)) ? true : false;\r", - " case \"startswith\":\r", - " propertiesUnderTest.push(propertyToCheck + \" startswith \" + propValueToCheck);\r", - " return product[propertyToCheck].startsWith(propValueToCheck) ? true : false;\r", - " case \"endswith\":\r", - " propertiesUnderTest.push(propertyToCheck + \" endswith \" + propValueToCheck);\r", - " return product[propertyToCheck].endsWith(propValueToCheck) ? true : false;\r", - " }\r", - " } else {\r", - " console.log(\"Unsupported Function: \" + functionName);\r", - " return false;\r", - " }\r", - " } else {\r", - " // single logic assertion in \"AND\" with \"true\"\r", - " if (inputString === \"true\") {\r", - " console.log(\"True Value!\");\r", - " return true;\r", - " } else {\r", - " //direct Property\r", - " var propertyToCheck = inputString.split(\" \")[0].trim();\r", - " var operatorToApply = inputString.split(\" \")[1];\r", - " var propValueToCheck = inputString.split(\" \")[2].trim().replace(/'/g, \"\");\r", - "\r", - " console.log(\"Property Found: \" + propertyToCheck);\r", - " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", - "\r", - " if (supportedOperators.indexOf(operatorToApply) >= 0) {\r", - " console.log(\"Operator To Apply: \" + operatorToApply);\r", - " operator = opToJsFormat(operatorToApply);\r", - " propertiesUnderTest.push(propertyToCheck + \" \" + operatorToApply + \" \" + propValueToCheck);\r", - "\r", - " var toEvalString = \"\";\r", - " var subProperty = \"\";\r", - "\r", - " //Complex properties (ContentDate)\r", - " if(propertyToCheck.includes(\"/\")){\r", - " var rootPropertyToCheck = propertyToCheck.split(\"/\")[0];\r", - " subProperty = propertyToCheck.split(\"/\")[1];\r", - "\r", - " console.log(\"Complex Property: \" + rootPropertyToCheck);\r", - " console.log(\"Sub Property: \" + subProperty);\r", - "\r", - " toEvalString = \"product[rootPropertyToCheck][subProperty] \" + operator + \" propValueToCheck\";\r", - "\r", - " } else {\r", - " toEvalString = \"product[propertyToCheck] \" + operator + \" propValueToCheck\";\r", - " }\r", - "\r", - " return eval(toEvalString);\r", - " } else {\r", - " console.log(\"Operator not supported\");\r", - " return false;\r", - " }\r", - " }\r", - " }\r", - " }\r", - " console.log(\"Logic Assertion not computed: \" + inputString);\r", - " return Math.random() >= 0.5;\r", - "}\r", - "\r", - "function treeIterator(tree, product) {\r", - " if (tree['filters'].length >= 0) {\r", - " var conditions = [];\r", - "\r", - " var logicOperator = getOperator(tree['op'], supportedOperators);\r", - " var logicOperator = opToJsFormat(logicOperator);\r", - "\r", - " //general tree: iterates over all filters (child nodes)\r", - " for (elem in tree['filters']) {\r", - " var currentCondition = typeof ((tree['filters'][elem])) == \"object\" ? treeIterator(tree['filters'][elem], product) : checkResponse(tree['filters'][elem], product);\r", - " conditions.push(currentCondition);\r", - " //optimize AND and OR\r", - " if(logicOperator == \"||\" && currentCondition){\r", - " break;\r", - " }\r", - " if(logicOperator == \"&&\" && !currentCondition){\r", - " break;\r", - " }\r", - " }\r", - " console.log(\"CURRENT CONDITIONS\");\r", - " console.log(conditions);\r", - "\r", - " //building return string\r", - " var resString = \"(\";\r", - " for (elem in conditions) {\r", - " resString += conditions[elem] + \" \" + logicOperator.toString() + \" \";\r", - " }\r", - " resString = resString.substring(0, resString.length - 3);\r", - " resString += \")\";\r", - "\r", - " console.log(\"RES String: \" + resString);\r", - "\r", - " return resString;\r", - " }\r", - "}\r", - "\r", - "properties_map = {};\r", - "\r", - "properties_map[\"@odata.context\"]=function(element){\r", - " pm.expect(element[\"@odata.context\"]).to.include(\"$metadata#Notifications\");\r", - "};\r", - "\r", - "properties_map.SubscriptionId=function (element) {pm.expect(element.SubscriptionId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.ProductId=function (element) {pm.expect(element.ProductId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.NotificationDate=function (element) {pm.expect(element.NotificationDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "\r", - "properties_map.Name=function (element) {\r", - " pm.expect(element.Name).to.be.a(\"string\");\r", - "};\r", - "\r", - "properties_map.SubscriptionEvent=function (element) {\r", - " pm.expect(element.SubscriptionEvent).to.be.a(\"string\");\r", - " pm.expect(element.SubscriptionEvent).to.be.oneOf([\"created\"]);\r", - "};\r", - "\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Subscription: \" + order.SubscriptionId, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Subscription: \" + order.SubscriptionId);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().requests;\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var subscription = pm.collectionVariables.get('no_staging_subscription');\r", - " for(notification of jsonDataElements){\r", - " var current_notification = JSON.parse(notification[\"body\"]);\r", - " if(current_notification[\"SubscriptionId\"] == subscription[\"Id\"]){\r", - " console.log(current_notification);\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, current_notification);\r", - " }\r", - "\r", - " //FilterParam Check\r", - " var filterParam = subscription[\"FilterParam\"];\r", - " parsed_filters = get_query_filters(subscription[\"FilterParam\"]);\r", - " console.log(parsed_filters);\r", - " if (typeof (parsed_filters) == \"object\") {\r", - " \r", - " attributesUnderTest = [];\r", - " propertiesUnderTest = [];\r", - "\r", - " var product = current_notification;\r", - " var treeExp = treeIterator(parsed_filters, product);\r", - " var booleanTreeExp = eval(treeExp);\r", - "\r", - " console.log(treeExp); console.log(booleanTreeExp);\r", - "\r", - " testMessage = \"FilterParam \" + filterParam + \" Check: \" + product.Name;\r", - "\r", - " pm.test(testMessage, function () {\r", - " pm.expect(booleanTreeExp, \"FilterParam Check\").to.be.true;\r", - " });\r", - " }\r", - " }\r", - " }\r", - "\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "{{subscription_auth_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"urlPattern\":\"/{{lta_path}}\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{mocklab_api_endpoint}}/{{notification_server_url}}/__admin/requests/find", - "host": [ - "{{mocklab_api_endpoint}}" - ], - "path": [ - "{{notification_server_url}}", - "__admin", - "requests", - "find" - ] - } - }, - "response": [] - }, - { - "name": "CreateSubscription_withStaging", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.FilterParam=function (element) {\r", - " pm.expect(element.FilterParam).to.be.a(\"string\");\r", - " pm.expect(element.FilterParam).to.be.not.equal(null);\r", - "};\r", - "\r", - "properties_map.LastNotificationDate=function (element) {pm.expect(element.LastNotificationDate).to.be.equal(null);};\r", - "\r", - "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "\r", - "properties_map.Priority=function (element) {\r", - " pm.expect(element.Priority).to.be.a(\"number\");\r", - " pm.expect(element.Priority).to.be.gte(0);\r", - " pm.expect(element.Priority).to.be.lte(100);\r", - "};\r", - "\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"running\"]);\r", - "};\r", - "\r", - "properties_map.StageOrder=function (element) {\r", - " pm.expect(element.StageOrder).to.be.equal(true);\r", - "};\r", - "\r", - "properties_map.SubscriptionEvent=function (element) {\r", - " pm.expect(element.SubscriptionEvent).to.be.a(\"string\");\r", - " pm.expect(element.SubscriptionEvent).to.be.oneOf([\"created\"]);\r", - "};\r", - "\r", - "properties_map.NotificationEndpoint=function (element) {\r", - " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", - "};\r", - "\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Subscription: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Subscription: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json();\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Subscription\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, jsonDataElements);\r", - " }\r", - "\r", - " pm.collectionVariables.set('staging_subscription', jsonDataElements);\r", - " pm.collectionVariables.set('subscription_id', jsonDataElements[\"Id\"]);\r", - "\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"@odata.context\": \"$metadata#Subscription/entity\",\r\n \"FilterParam\": \"startswith(Name,'S1')\",\r\n \"SubscriptionEvent\": \"created\",\r\n \"StageOrder\": true,\r\n \"Priority\": 25,\r\n \"NotificationEndpoint\": \"http://{{notification_server_url}}/{{lta_path}}\",\r\n \"NotificationEpUsername\": \"{{notification_username}}\",\r\n \"NotificationEpPassword\": \"{{notification_password}}\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/Subscriptions", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Subscriptions" - ] - } - }, - "response": [] - }, - { - "name": "GetProductDownloadReadinessNotifications", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const supportedOperators = [\"eq\", \"ne\", \"gt\", \"ge\", \"lt\", \"le\", \"and\", \"or\", \"not\"];\r", - "const supportedFunctions = [\"startswith\", \"contains\", \"endswith\"];\r", - "\r", - "function compare(a, b){\r", - " if(isNaN(a)){\r", - " return String(a).localeCompare(String(b));\r", - " } else {\r", - " return a > b;\r", - " } \r", - "}\r", - "\r", - "function getOperator(inputString, possibleOperators) {\r", - " var op = null;\r", - " possibleOperators.forEach(function (el) { if (inputString.indexOf(el) >= 0) { op = el; } });\r", - " return op;\r", - "}\r", - "\r", - "function opToJsFormat(op) {\r", - " res = null;\r", - " switch (op) {\r", - " case \"and\":\r", - " return \"&&\";\r", - " case \"or\":\r", - " return \"||\";\r", - " case \"not\":\r", - " return \"!\";\r", - " case \"eq\":\r", - " return \"==\";\r", - " case \"ne\":\r", - " return \"!=\";\r", - " case \"gt\":\r", - " return \">\";\r", - " case \"ge\":\r", - " return \">=\";\r", - " case \"lt\":\r", - " return \"<\";\r", - " case \"le\":\r", - " return \"<=\";\r", - " }\r", - "}\r", - "\r", - "function get_query_filters(input_query) {\r", - "\r", - " console.log(\"Parsing Filter...\");\r", - "\r", - " var matcher = /(contains\\((.+?)\\)|startswith\\((.+?)\\)|endswith\\((.+?)\\)|any\\(.*?\\)|ContentDate\\/Start.*Z|ContentDate\\/End.*Z|[\\w.]+?\\s(?:eq|ne|gt|ge|lt|le)\\s(?:\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)|[+-]?([0-9]*[.])?[0-9]+|\\w+|'.+?'))/g\r", - "\r", - " var filters = input_query.match(matcher);\r", - " var i = 0;\r", - " var simpleString = input_query.replace(matcher, function () {\r", - " return i++;\r", - " });\r", - "\r", - " console.log(simpleString);\r", - " console.log(filters);\r", - "\r", - " var filterString = simpleString;\r", - "\r", - " var groupString;\r", - " var groupFilter = null;\r", - " var testNextLevel = true;\r", - "\r", - " while (testNextLevel) {\r", - " var closeParenthesisIndex = filterString.indexOf(')');\r", - " if (closeParenthesisIndex !== -1) {\r", - " var openParenthesisIndex = filterString.lastIndexOf('(', closeParenthesisIndex);\r", - "\r", - " // Extract the string between the first deepest set of parenthesis\r", - " groupString = filterString.substring(openParenthesisIndex + 1, closeParenthesisIndex);\r", - "\r", - " // Modify the filter string replacing the contents of the group string in addition to the parenthesis with the length of the filters array (which will be the index of the filter object that we push)\r", - " filterString = filterString.substring(0, openParenthesisIndex) + filters.length + filterString.substring(closeParenthesisIndex + 1);\r", - " } else {\r", - "\r", - " // There are no more parenthesis groups\r", - " groupString = filterString;\r", - " testNextLevel = false;\r", - " }\r", - "\r", - " // If the group uses both 'and' and 'or' then return null as an invalid filter string.\r", - " if (groupString.indexOf('and') >= 0 && groupString.indexOf('or') >= 0) {\r", - " console.log(\"Invalid Filter!\");\r", - " return null;\r", - " }\r", - "\r", - " // Get the group indexes out of the group string\r", - " var groupFilterIndexes = groupString.match(/[0-9]+/g);\r", - " var groupFilters = [];\r", - "\r", - " // Create an array with each of the filters who's index matches the group indexes\r", - " for (i = 0; i < groupFilterIndexes.length; i++) {\r", - " groupFilters.push(filters[Number(groupFilterIndexes[i])]);\r", - " }\r", - "\r", - " //cycling over the supported operators\r", - " var op = getOperator(groupString, supportedOperators);\r", - "\r", - " //redundant brakets management\r", - " if (op == null) {\r", - " groupFilters.push(\"true\");\r", - " op = \"and\";\r", - " }\r", - "\r", - " // Create the filter object and push it onto the filters array\r", - " groupFilter = { op: op, filters: groupFilters };\r", - " filters.push(groupFilter);\r", - " }\r", - "\r", - " return groupFilter;\r", - "\r", - "}\r", - "\r", - "function checkResponse(inputString, product) {\r", - " console.log(\"Input String: \" + inputString);\r", - " //console.log(\"Product:\");\r", - " //console.log(product);\r", - " var responseProperties = Object.keys(product);\r", - " var responseAttributes = {};\r", - "\r", - " //Attribute\r", - " if (inputString.includes(\"any(\") && inputString.includes(\"/Name\") && inputString.includes(\"/Value\")) {\r", - " //Attribute Logic Assertion\r", - " if (responseProperties.indexOf(\"Attributes\") >= 0) {\r", - " product['Attributes'].forEach(function (el) {\r", - " responseAttributes[el.Name] = el.Value;\r", - " });\r", - "\r", - " //functions in Attribute Value\r", - " var cleanedInputString = inputString.split(\"any(\").pop();\r", - " console.log(\"CLEANED ATTRIBUTE INPUTSTRING: \" + cleanedInputString);\r", - " if (cleanedInputString.includes(\"(\") && cleanedInputString.includes(\")\")) {\r", - " //get the function name\r", - " var functionName = cleanedInputString.split(\"(\")[0].split(\" \").pop();\r", - " if (supportedFunctions.indexOf(functionName) >= 0) {\r", - " console.log(\"Found Attribute Function: \" + functionName);\r", - " //get the attribute\r", - " var attrToCheck = cleanedInputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", - " console.log(\"Attribute KEY Found: \" + attrToCheck);\r", - " //get the cleaned value\r", - " var attrValueToCheck = cleanedInputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", - " console.log(\"Attribute VALUE Found: \" + attrValueToCheck);\r", - "\r", - " switch (functionName) {\r", - " case \"contains\":\r", - " attributesUnderTest.push(attrToCheck + \" contains \" + attrValueToCheck);\r", - " return (responseAttributes[attrToCheck].includes(attrValueToCheck)) ? true : false;\r", - " case \"startswith\":\r", - " attributesUnderTest.push(attrToCheck + \" startswith \" + attrValueToCheck);\r", - " return responseAttributes[attrToCheck].startsWith(attrValueToCheck) ? true : false;\r", - " case \"endswith\":\r", - " attributesUnderTest.push(attrToCheck + \" endswith \" + attrValueToCheck);\r", - " return responseAttributes[attrToCheck].endsWith(attrValueToCheck) ? true : false;\r", - " }\r", - " }\r", - " } else {\r", - " //simple any(Attributes Name and Value)\r", - " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", - " console.log(\"Extracted Attribute KEY: \" + attrToCheck);\r", - " var attrValueToCheck = inputString.split('Value eq ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\\\/g, \"\");\r", - " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck);\r", - "\r", - " attributesUnderTest.push(\"attr:\" + attrToCheck + \" eq \" + attrValueToCheck);\r", - "\r", - " return responseAttributes[attrToCheck] == attrValueToCheck;\r", - " }\r", - " }\r", - " } else {\r", - " //inputString contains a function on a Property -> complex property not supported!\r", - " if (inputString.includes(\"(\") && inputString.includes(\")\")) {\r", - " //get the function name\r", - " var functionName = inputString.split(\"(\")[0];\r", - " if (supportedFunctions.indexOf(functionName) >= 0) {\r", - " console.log(\"Found Function: \" + functionName);\r", - " //get the property\r", - " var propertyToCheck = inputString.split(\"(\")[1].split(\",\")[0].trim();\r", - " console.log(\"Property Found: \" + propertyToCheck);\r", - "\r", - " //get the cleaned value\r", - " var propValueToCheck = inputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", - " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", - "\r", - " switch (functionName) {\r", - " case \"contains\":\r", - " propertiesUnderTest.push(propertyToCheck + \" contains \" + propValueToCheck);\r", - " return (product[propertyToCheck].includes(propValueToCheck)) ? true : false;\r", - " case \"startswith\":\r", - " propertiesUnderTest.push(propertyToCheck + \" startswith \" + propValueToCheck);\r", - " return product[propertyToCheck].startsWith(propValueToCheck) ? true : false;\r", - " case \"endswith\":\r", - " propertiesUnderTest.push(propertyToCheck + \" endswith \" + propValueToCheck);\r", - " return product[propertyToCheck].endsWith(propValueToCheck) ? true : false;\r", - " }\r", - " } else {\r", - " console.log(\"Unsupported Function: \" + functionName);\r", - " return false;\r", - " }\r", - " } else {\r", - " // single logic assertion in \"AND\" with \"true\"\r", - " if (inputString === \"true\") {\r", - " console.log(\"True Value!\");\r", - " return true;\r", - " } else {\r", - " //direct Property\r", - " var propertyToCheck = inputString.split(\" \")[0].trim();\r", - " var operatorToApply = inputString.split(\" \")[1];\r", - " var propValueToCheck = inputString.split(\" \")[2].trim().replace(/'/g, \"\");\r", - "\r", - " console.log(\"Property Found: \" + propertyToCheck);\r", - " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", - "\r", - " if (supportedOperators.indexOf(operatorToApply) >= 0) {\r", - " console.log(\"Operator To Apply: \" + operatorToApply);\r", - " operator = opToJsFormat(operatorToApply);\r", - " propertiesUnderTest.push(propertyToCheck + \" \" + operatorToApply + \" \" + propValueToCheck);\r", - "\r", - " var toEvalString = \"\";\r", - " var subProperty = \"\";\r", - "\r", - " //Complex properties (ContentDate)\r", - " if(propertyToCheck.includes(\"/\")){\r", - " var rootPropertyToCheck = propertyToCheck.split(\"/\")[0];\r", - " subProperty = propertyToCheck.split(\"/\")[1];\r", - "\r", - " console.log(\"Complex Property: \" + rootPropertyToCheck);\r", - " console.log(\"Sub Property: \" + subProperty);\r", - "\r", - " toEvalString = \"product[rootPropertyToCheck][subProperty] \" + operator + \" propValueToCheck\";\r", - "\r", - " } else {\r", - " toEvalString = \"product[propertyToCheck] \" + operator + \" propValueToCheck\";\r", - " }\r", - "\r", - " return eval(toEvalString);\r", - " } else {\r", - " console.log(\"Operator not supported\");\r", - " return false;\r", - " }\r", - " }\r", - " }\r", - " }\r", - " console.log(\"Logic Assertion not computed: \" + inputString);\r", - " return Math.random() >= 0.5;\r", - "}\r", - "\r", - "function treeIterator(tree, product) {\r", - " if (tree['filters'].length >= 0) {\r", - " var conditions = [];\r", - "\r", - " var logicOperator = getOperator(tree['op'], supportedOperators);\r", - " var logicOperator = opToJsFormat(logicOperator);\r", - "\r", - " //general tree: iterates over all filters (child nodes)\r", - " for (elem in tree['filters']) {\r", - " var currentCondition = typeof ((tree['filters'][elem])) == \"object\" ? treeIterator(tree['filters'][elem], product) : checkResponse(tree['filters'][elem], product);\r", - " conditions.push(currentCondition);\r", - " //optimize AND and OR\r", - " if(logicOperator == \"||\" && currentCondition){\r", - " break;\r", - " }\r", - " if(logicOperator == \"&&\" && !currentCondition){\r", - " break;\r", - " }\r", - " }\r", - " console.log(\"CURRENT CONDITIONS\");\r", - " console.log(conditions);\r", - "\r", - " //building return string\r", - " var resString = \"(\";\r", - " for (elem in conditions) {\r", - " resString += conditions[elem] + \" \" + logicOperator.toString() + \" \";\r", - " }\r", - " resString = resString.substring(0, resString.length - 3);\r", - " resString += \")\";\r", - "\r", - " console.log(\"RES String: \" + resString);\r", - "\r", - " return resString;\r", - " }\r", - "}\r", - "\r", - "properties_map = {};\r", - "\r", - "properties_map[\"@odata.context\"]=function(element){\r", - " pm.expect(element[\"@odata.context\"]).to.include(\"$metadata#Notifications\");\r", - "};\r", - "\r", - "properties_map.SubscriptionId=function (element) {pm.expect(element.SubscriptionId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.ProductId=function (element) {pm.expect(element.ProductId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.NotificationDate=function (element) {pm.expect(element.NotificationDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "\r", - "properties_map.Name=function (element) {\r", - " pm.expect(element.Name).to.be.a(\"string\");\r", - "};\r", - "\r", - "properties_map.SubscriptionEvent=function (element) {\r", - " pm.expect(element.SubscriptionEvent).to.be.a(\"string\");\r", - " pm.expect(element.SubscriptionEvent).to.be.oneOf([\"created\"]);\r", - "};\r", - "\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Subscription: \" + order.SubscriptionId, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Subscription: \" + order.SubscriptionId);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().requests;\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var subscription = pm.collectionVariables.get('staging_subscription');\r", - " for(notification of jsonDataElements){\r", - " var current_notification = JSON.parse(notification[\"body\"]);\r", - " console.log(current_notification);\r", - " console.log(subscription[\"Id\"]);\r", - " if(current_notification[\"SubscriptionId\"] == subscription[\"Id\"]){\r", - " console.log(current_notification);\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, current_notification);\r", - " }\r", - "\r", - " //FilterParam Check\r", - " var filterParam = subscription[\"FilterParam\"];\r", - " parsed_filters = get_query_filters(subscription[\"FilterParam\"]);\r", - " console.log(parsed_filters);\r", - " if (typeof (parsed_filters) == \"object\") {\r", - " \r", - " attributesUnderTest = [];\r", - " propertiesUnderTest = [];\r", - "\r", - " var product = current_notification;\r", - " var treeExp = treeIterator(parsed_filters, product);\r", - " var booleanTreeExp = eval(treeExp);\r", - "\r", - " console.log(treeExp); console.log(booleanTreeExp);\r", - "\r", - " testMessage = \"FilterParam \" + filterParam + \" Check: \" + product.Name;\r", - "\r", - " pm.test(testMessage, function () {\r", - " pm.expect(booleanTreeExp, \"FilterParam Check\").to.be.true;\r", - " });\r", - " }\r", - " }\r", - " }\r", - "\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "{{subscription_auth_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"urlPattern\":\"/{{lta_path}}\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{mocklab_api_endpoint}}/{{notification_server_url}}/__admin/requests/find", - "host": [ - "{{mocklab_api_endpoint}}" - ], - "path": [ - "{{notification_server_url}}", - "__admin", - "requests", - "find" - ] - } - }, - "response": [] - }, - { - "name": "GetStagedOrders", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"in_progress\",\"queued\",\"failed\",\"completed\", \"cancelled\"]);\r", - "};\r", - "\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " switch(element.Status){\r", - " case \"in_progress\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"request is under processing\"]);\r", - " break;\r", - " case \"queued\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"request is queued\"]);\r", - " break;\r", - " case \"failed\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\r", - " \"product currently unavailable\",\r", - " \"product retrieval has failed\",\r", - " \"product not found on LTA\"]);\r", - " break;\r", - " case \"completed\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"request product is available\"]);\r", - " break;\r", - " case \"cancelled\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"request cancelled by user\"]);\r", - " break;\r", - " }\r", - "};\r", - "properties_map.Priority=function (element) {pm.expect(element.Priority).to.be.a(\"number\");}; \r", - "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "properties_map.EstimatedDate=function (element) {pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d\\d\\d(\\d*)Z/);};\r", - "\r", - "properties_map.OrderSize=function (element) {pm.expect(element.OrderSize).to.be.a(\"number\");};\r", - "properties_map.CompletedDate=function (element) {\r", - " if(element.CompletedDate){\r", - " switch(element.Status){\r", - " case \"completed\":\r", - " pm.expect(element.CompletedDate).to.be.a(\"string\");\r", - " pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - " break;\r", - " default:\r", - " pm.expect(element.CompletedDate).to.be.equal(null)\r", - " }\r", - " }\r", - "}\r", - " \r", - "properties_map.EvictionDate=function (element) {\r", - " if(element.EvictionDate){\r", - " switch(element.Status){\r", - " case \"completed\":\r", - " pm.expect(element.EvictionDate).to.be.a(\"string\");\r", - " pm.expect(element.EvictionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - " break;\r", - " default:\r", - " pm.expect(element.EvictionDate).to.be.equal(null) \r", - " }\r", - " }\r", - "}\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Order: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Order: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().value[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var order_response = {};\r", - "\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, jsonDataElements);\r", - " }\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Subscriptions({{subscription_id}})/Orders", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Subscriptions({{subscription_id}})", - "Orders" - ] - } - }, - "response": [] - }, - { - "name": "CreateSubscription_deletion", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.FilterParam=function (element) {\r", - " pm.expect(element.FilterParam).to.be.a(\"string\");\r", - " pm.expect(element.FilterParam).to.be.not.equal(null);\r", - "};\r", - "\r", - "properties_map.LastNotificationDate=function (element) {pm.expect(element.LastNotificationDate).to.be.equal(null);};\r", - "\r", - "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "\r", - "properties_map.Priority=function (element) {\r", - " pm.expect(element.Priority).to.be.equal(null);\r", - "};\r", - "\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"running\"]);\r", - "};\r", - "\r", - "properties_map.StageOrder=function (element) {\r", - " pm.expect(element.StageOrder).to.be.equal(false);\r", - "};\r", - "\r", - "properties_map.SubscriptionEvent=function (element) {\r", - " pm.expect(element.SubscriptionEvent).to.be.a(\"string\");\r", - " pm.expect(element.SubscriptionEvent).to.be.oneOf([\"deleted\"]);\r", - "};\r", - "\r", - "properties_map.NotificationEndpoint=function (element) {\r", - " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", - "};\r", - "\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Subscription: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Subscription: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json();\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Subscription\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, jsonDataElements);\r", - " }\r", - "\r", - " pm.collectionVariables.set('product_deleted_subscription', jsonDataElements);\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"@odata.context\": \"$metadata#Subscription/entity\",\r\n \"FilterParam\": \"startswith(Name,'S1')\",\r\n \"SubscriptionEvent\": \"deleted\",\r\n \"StageOrder\": false,\r\n \"Priority\": 25,\r\n \"NotificationEndpoint\": \"http://{{notification_server_url}}/{{lta_path}}\",\r\n \"NotificationEpUsername\": \"{{notification_username}}\",\r\n \"NotificationEpPassword\": \"{{notification_password}}\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/Subscriptions", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Subscriptions" - ] - } - }, - "response": [] - }, - { - "name": "GetProductDeletedNotifications", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const supportedOperators = [\"eq\", \"ne\", \"gt\", \"ge\", \"lt\", \"le\", \"and\", \"or\", \"not\"];\r", - "const supportedFunctions = [\"startswith\", \"contains\", \"endswith\"];\r", - "\r", - "function compare(a, b){\r", - " if(isNaN(a)){\r", - " return String(a).localeCompare(String(b));\r", - " } else {\r", - " return a > b;\r", - " } \r", - "}\r", - "\r", - "function getOperator(inputString, possibleOperators) {\r", - " var op = null;\r", - " possibleOperators.forEach(function (el) { if (inputString.indexOf(el) >= 0) { op = el; } });\r", - " return op;\r", - "}\r", - "\r", - "function opToJsFormat(op) {\r", - " res = null;\r", - " switch (op) {\r", - " case \"and\":\r", - " return \"&&\";\r", - " case \"or\":\r", - " return \"||\";\r", - " case \"not\":\r", - " return \"!\";\r", - " case \"eq\":\r", - " return \"==\";\r", - " case \"ne\":\r", - " return \"!=\";\r", - " case \"gt\":\r", - " return \">\";\r", - " case \"ge\":\r", - " return \">=\";\r", - " case \"lt\":\r", - " return \"<\";\r", - " case \"le\":\r", - " return \"<=\";\r", - " }\r", - "}\r", - "\r", - "function get_query_filters(input_query) {\r", - "\r", - " console.log(\"Parsing Filter...\");\r", - "\r", - " var matcher = /(contains\\((.+?)\\)|startswith\\((.+?)\\)|endswith\\((.+?)\\)|any\\(.*?\\)|ContentDate\\/Start.*Z|ContentDate\\/End.*Z|[\\w.]+?\\s(?:eq|ne|gt|ge|lt|le)\\s(?:\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)|[+-]?([0-9]*[.])?[0-9]+|\\w+|'.+?'))/g\r", - "\r", - " var filters = input_query.match(matcher);\r", - " var i = 0;\r", - " var simpleString = input_query.replace(matcher, function () {\r", - " return i++;\r", - " });\r", - "\r", - " console.log(simpleString);\r", - " console.log(filters);\r", - "\r", - " var filterString = simpleString;\r", - "\r", - " var groupString;\r", - " var groupFilter = null;\r", - " var testNextLevel = true;\r", - "\r", - " while (testNextLevel) {\r", - " var closeParenthesisIndex = filterString.indexOf(')');\r", - " if (closeParenthesisIndex !== -1) {\r", - " var openParenthesisIndex = filterString.lastIndexOf('(', closeParenthesisIndex);\r", - "\r", - " // Extract the string between the first deepest set of parenthesis\r", - " groupString = filterString.substring(openParenthesisIndex + 1, closeParenthesisIndex);\r", - "\r", - " // Modify the filter string replacing the contents of the group string in addition to the parenthesis with the length of the filters array (which will be the index of the filter object that we push)\r", - " filterString = filterString.substring(0, openParenthesisIndex) + filters.length + filterString.substring(closeParenthesisIndex + 1);\r", - " } else {\r", - "\r", - " // There are no more parenthesis groups\r", - " groupString = filterString;\r", - " testNextLevel = false;\r", - " }\r", - "\r", - " // If the group uses both 'and' and 'or' then return null as an invalid filter string.\r", - " if (groupString.indexOf('and') >= 0 && groupString.indexOf('or') >= 0) {\r", - " console.log(\"Invalid Filter!\");\r", - " return null;\r", - " }\r", - "\r", - " // Get the group indexes out of the group string\r", - " var groupFilterIndexes = groupString.match(/[0-9]+/g);\r", - " var groupFilters = [];\r", - "\r", - " // Create an array with each of the filters who's index matches the group indexes\r", - " for (i = 0; i < groupFilterIndexes.length; i++) {\r", - " groupFilters.push(filters[Number(groupFilterIndexes[i])]);\r", - " }\r", - "\r", - " //cycling over the supported operators\r", - " var op = getOperator(groupString, supportedOperators);\r", - "\r", - " //redundant brakets management\r", - " if (op == null) {\r", - " groupFilters.push(\"true\");\r", - " op = \"and\";\r", - " }\r", - "\r", - " // Create the filter object and push it onto the filters array\r", - " groupFilter = { op: op, filters: groupFilters };\r", - " filters.push(groupFilter);\r", - " }\r", - "\r", - " return groupFilter;\r", - "\r", - "}\r", - "\r", - "function checkResponse(inputString, product) {\r", - " console.log(\"Input String: \" + inputString);\r", - " //console.log(\"Product:\");\r", - " //console.log(product);\r", - " var responseProperties = Object.keys(product);\r", - " var responseAttributes = {};\r", - "\r", - " //Attribute\r", - " if (inputString.includes(\"any(\") && inputString.includes(\"/Name\") && inputString.includes(\"/Value\")) {\r", - " //Attribute Logic Assertion\r", - " if (responseProperties.indexOf(\"Attributes\") >= 0) {\r", - " product['Attributes'].forEach(function (el) {\r", - " responseAttributes[el.Name] = el.Value;\r", - " });\r", - "\r", - " //functions in Attribute Value\r", - " var cleanedInputString = inputString.split(\"any(\").pop();\r", - " console.log(\"CLEANED ATTRIBUTE INPUTSTRING: \" + cleanedInputString);\r", - " if (cleanedInputString.includes(\"(\") && cleanedInputString.includes(\")\")) {\r", - " //get the function name\r", - " var functionName = cleanedInputString.split(\"(\")[0].split(\" \").pop();\r", - " if (supportedFunctions.indexOf(functionName) >= 0) {\r", - " console.log(\"Found Attribute Function: \" + functionName);\r", - " //get the attribute\r", - " var attrToCheck = cleanedInputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", - " console.log(\"Attribute KEY Found: \" + attrToCheck);\r", - " //get the cleaned value\r", - " var attrValueToCheck = cleanedInputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", - " console.log(\"Attribute VALUE Found: \" + attrValueToCheck);\r", - "\r", - " switch (functionName) {\r", - " case \"contains\":\r", - " attributesUnderTest.push(attrToCheck + \" contains \" + attrValueToCheck);\r", - " return (responseAttributes[attrToCheck].includes(attrValueToCheck)) ? true : false;\r", - " case \"startswith\":\r", - " attributesUnderTest.push(attrToCheck + \" startswith \" + attrValueToCheck);\r", - " return responseAttributes[attrToCheck].startsWith(attrValueToCheck) ? true : false;\r", - " case \"endswith\":\r", - " attributesUnderTest.push(attrToCheck + \" endswith \" + attrValueToCheck);\r", - " return responseAttributes[attrToCheck].endsWith(attrValueToCheck) ? true : false;\r", - " }\r", - " }\r", - " } else {\r", - " //simple any(Attributes Name and Value)\r", - " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", - " console.log(\"Extracted Attribute KEY: \" + attrToCheck);\r", - " var attrValueToCheck = inputString.split('Value eq ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\\\/g, \"\");\r", - " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck);\r", - "\r", - " attributesUnderTest.push(\"attr:\" + attrToCheck + \" eq \" + attrValueToCheck);\r", - "\r", - " return responseAttributes[attrToCheck] == attrValueToCheck;\r", - " }\r", - " }\r", - " } else {\r", - " //inputString contains a function on a Property -> complex property not supported!\r", - " if (inputString.includes(\"(\") && inputString.includes(\")\")) {\r", - " //get the function name\r", - " var functionName = inputString.split(\"(\")[0];\r", - " if (supportedFunctions.indexOf(functionName) >= 0) {\r", - " console.log(\"Found Function: \" + functionName);\r", - " //get the property\r", - " var propertyToCheck = inputString.split(\"(\")[1].split(\",\")[0].trim();\r", - " console.log(\"Property Found: \" + propertyToCheck);\r", - "\r", - " //get the cleaned value\r", - " var propValueToCheck = inputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", - " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", - "\r", - " switch (functionName) {\r", - " case \"contains\":\r", - " propertiesUnderTest.push(propertyToCheck + \" contains \" + propValueToCheck);\r", - " return (product[propertyToCheck].includes(propValueToCheck)) ? true : false;\r", - " case \"startswith\":\r", - " propertiesUnderTest.push(propertyToCheck + \" startswith \" + propValueToCheck);\r", - " return product[propertyToCheck].startsWith(propValueToCheck) ? true : false;\r", - " case \"endswith\":\r", - " propertiesUnderTest.push(propertyToCheck + \" endswith \" + propValueToCheck);\r", - " return product[propertyToCheck].endsWith(propValueToCheck) ? true : false;\r", - " }\r", - " } else {\r", - " console.log(\"Unsupported Function: \" + functionName);\r", - " return false;\r", - " }\r", - " } else {\r", - " // single logic assertion in \"AND\" with \"true\"\r", - " if (inputString === \"true\") {\r", - " console.log(\"True Value!\");\r", - " return true;\r", - " } else {\r", - " //direct Property\r", - " var propertyToCheck = inputString.split(\" \")[0].trim();\r", - " var operatorToApply = inputString.split(\" \")[1];\r", - " var propValueToCheck = inputString.split(\" \")[2].trim().replace(/'/g, \"\");\r", - "\r", - " console.log(\"Property Found: \" + propertyToCheck);\r", - " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", - "\r", - " if (supportedOperators.indexOf(operatorToApply) >= 0) {\r", - " console.log(\"Operator To Apply: \" + operatorToApply);\r", - " operator = opToJsFormat(operatorToApply);\r", - " propertiesUnderTest.push(propertyToCheck + \" \" + operatorToApply + \" \" + propValueToCheck);\r", - "\r", - " var toEvalString = \"\";\r", - " var subProperty = \"\";\r", - "\r", - " //Complex properties (ContentDate)\r", - " if(propertyToCheck.includes(\"/\")){\r", - " var rootPropertyToCheck = propertyToCheck.split(\"/\")[0];\r", - " subProperty = propertyToCheck.split(\"/\")[1];\r", - "\r", - " console.log(\"Complex Property: \" + rootPropertyToCheck);\r", - " console.log(\"Sub Property: \" + subProperty);\r", - "\r", - " toEvalString = \"product[rootPropertyToCheck][subProperty] \" + operator + \" propValueToCheck\";\r", - "\r", - " } else {\r", - " toEvalString = \"product[propertyToCheck] \" + operator + \" propValueToCheck\";\r", - " }\r", - "\r", - " return eval(toEvalString);\r", - " } else {\r", - " console.log(\"Operator not supported\");\r", - " return false;\r", - " }\r", - " }\r", - " }\r", - " }\r", - " console.log(\"Logic Assertion not computed: \" + inputString);\r", - " return Math.random() >= 0.5;\r", - "}\r", - "\r", - "function treeIterator(tree, product) {\r", - " if (tree['filters'].length >= 0) {\r", - " var conditions = [];\r", - "\r", - " var logicOperator = getOperator(tree['op'], supportedOperators);\r", - " var logicOperator = opToJsFormat(logicOperator);\r", - "\r", - " //general tree: iterates over all filters (child nodes)\r", - " for (elem in tree['filters']) {\r", - " var currentCondition = typeof ((tree['filters'][elem])) == \"object\" ? treeIterator(tree['filters'][elem], product) : checkResponse(tree['filters'][elem], product);\r", - " conditions.push(currentCondition);\r", - " //optimize AND and OR\r", - " if(logicOperator == \"||\" && currentCondition){\r", - " break;\r", - " }\r", - " if(logicOperator == \"&&\" && !currentCondition){\r", - " break;\r", - " }\r", - " }\r", - " console.log(\"CURRENT CONDITIONS\");\r", - " console.log(conditions);\r", - "\r", - " //building return string\r", - " var resString = \"(\";\r", - " for (elem in conditions) {\r", - " resString += conditions[elem] + \" \" + logicOperator.toString() + \" \";\r", - " }\r", - " resString = resString.substring(0, resString.length - 3);\r", - " resString += \")\";\r", - "\r", - " console.log(\"RES String: \" + resString);\r", - "\r", - " return resString;\r", - " }\r", - "}\r", - "\r", - "properties_map = {};\r", - "\r", - "properties_map[\"@odata.context\"]=function(element){\r", - " pm.expect(element[\"@odata.context\"]).to.include(\"$metadata#Notifications\");\r", - "};\r", - "\r", - "properties_map.SubscriptionId=function (element) {pm.expect(element.SubscriptionId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.ProductId=function (element) {pm.expect(element.ProductId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.NotificationDate=function (element) {pm.expect(element.NotificationDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "\r", - "properties_map.Name=function (element) {\r", - " pm.expect(element.Name).to.be.a(\"string\");\r", - "};\r", - "\r", - "properties_map.SubscriptionEvent=function (element) {\r", - " pm.expect(element.SubscriptionEvent).to.be.a(\"string\");\r", - " pm.expect(element.SubscriptionEvent).to.be.oneOf([\"deleted\"]);\r", - "};\r", - "\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Subscription: \" + order.SubscriptionId, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Subscription: \" + order.SubscriptionId);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().requests;\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var subscription = pm.collectionVariables.get('product_deleted_subscription');\r", - " for(notification of jsonDataElements){\r", - " var current_notification = JSON.parse(notification[\"body\"]);\r", - " console.log(current_notification);\r", - " console.log(subscription[\"Id\"]);\r", - " if(current_notification[\"SubscriptionId\"] == subscription[\"Id\"]){\r", - " console.log(current_notification);\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, current_notification);\r", - " }\r", - "\r", - " //FilterParam Check\r", - " var filterParam = subscription[\"FilterParam\"];\r", - " parsed_filters = get_query_filters(subscription[\"FilterParam\"]);\r", - " console.log(parsed_filters);\r", - " if (typeof (parsed_filters) == \"object\") {\r", - " \r", - " attributesUnderTest = [];\r", - " propertiesUnderTest = [];\r", - "\r", - " var product = current_notification;\r", - " var treeExp = treeIterator(parsed_filters, product);\r", - " var booleanTreeExp = eval(treeExp);\r", - "\r", - " console.log(treeExp); console.log(booleanTreeExp);\r", - "\r", - " testMessage = \"FilterParam \" + filterParam + \" Check: \" + product.Name;\r", - "\r", - " pm.test(testMessage, function () {\r", - " pm.expect(booleanTreeExp, \"FilterParam Check\").to.be.true;\r", - " });\r", - " }\r", - " }\r", - " }\r", - "\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "{{subscription_auth_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"urlPattern\":\"/{{lta_path}}\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{mocklab_api_endpoint}}/{{notification_server_url}}/__admin/requests/find", - "host": [ - "{{mocklab_api_endpoint}}" - ], - "path": [ - "{{notification_server_url}}", - "__admin", - "requests", - "find" - ] - } - }, - "response": [] - }, - { - "name": "Get_Offline_Products", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "try {\r", - " var jsonDataElements = pm.response.json().value;\r", - "\r", - " console.log(\"Response: \");\r", - " console.log(jsonDataElements);\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " //MIN number of Records Test\r", - " var minimumExpRecords = parseInt(pm.collectionVariables.get('resp_min_records'));\r", - " pm.test(\"Expected minimum number of products Test: \" + minimumExpRecords, function(){\r", - " pm.expect(jsonDataElements.length).to.be.gte(minimumExpRecords);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " query_string = pm.request.url.getQueryString();\r", - " if(query_string.includes(\"$expand=Attributes\")){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Products(Attributes())\");\r", - " } else{\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Products\");\r", - " }\r", - " });\r", - "\r", - " for (var counter = 0; counter < jsonDataElements.length; counter++){\r", - " var product = jsonDataElements[counter];\r", - " console.log(\"Processing Product: \"+product.Name+\" - \"+product.Id);\r", - "\r", - " pm.test(\"Test Properties for product: \" + product.Id, function(){\r", - " pm.expect(product).to.have.property(\"Id\");\r", - " pm.expect(product.Id).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"Name\");\r", - " pm.expect(product.Name).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"ContentType\");\r", - " pm.expect(product.ContentType).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"ContentLength\");\r", - " pm.expect(product.ContentLength).to.be.a(\"number\");\r", - " pm.expect(product).to.have.property(\"OriginDate\");\r", - " pm.expect(product.OriginDate).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"PublicationDate\");\r", - " pm.expect(product.PublicationDate).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"ModificationDate\");\r", - " pm.expect(product.ModificationDate).to.be.a(\"string\");\r", - " pm.expect(product).to.have.property(\"Online\");\r", - " pm.expect(product.Online).to.be.a(\"boolean\");\r", - " pm.expect(product).to.have.property(\"Checksum\");\r", - " pm.expect(product.Checksum).to.be.an(\"array\");\r", - " pm.expect(product).to.have.property(\"ContentDate\");\r", - " pm.expect(product.ContentDate).to.be.an(\"object\");\r", - " }); \r", - " \r", - " if(\"Attributes\" in jsonDataElements[counter]){\r", - " schema_seen = {};\r", - "\r", - " pm.test(\"Test Attributes list for product: \" + jsonDataElements[counter].Id, function(){\r", - " pm.expect(jsonDataElements[counter].Attributes.length).to.be.above(0);\r", - " jsonDataElements[counter].Attributes.forEach(function(elem){\r", - " pm.expect(elem).to.have.all.keys(\"Name\", \"Value\", \"ValueType\");\r", - " });\r", - " }); \r", - " }\r", - " }\r", - "\r", - " pm.collectionVariables.set('offline_products', jsonDataElements);\r", - " \r", - "}\r", - "\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Get_Online_Product_By_Order_Navigation", + "event": [ { - "key": "password", - "value": "{{password}}", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "try {\r", + " var current_completed_order = decodeURIComponent(pm.request.url.getPathWithQuery()).split(\"/odata/v1/Orders(\")[1].split(\")/Product\")[0];\r", + " pm.variables.unset(\"current_completed_order_id\");\r", + " if(current_completed_order == \"{{current_completed_order_id}}\"){\r", + " current_completed_order = pm.collectionVariables.get('completed_orders');\r", + " //get random product from collected completed orders\r", + " var random_completed_order = current_completed_order[Math.floor(Math.random()*current_completed_order.length)];\r", + " pm.variables.set(\"current_completed_order_id\", random_completed_order[\"Id\"]);\r", + " } else {\r", + " pm.variables.set(\"current_completed_order_id\", current_completed_order);\r", + " }\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } }, { - "key": "username", - "value": "{{username}}", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "try {\r", + " var jsonDataElements = pm.response.json();\r", + "\r", + " console.log(jsonDataElements[\"Online\"]);\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Product\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " pm.test(\"Product Property Online\", function(){\r", + " pm.expect(jsonDataElements[\"Online\"]).be.equal(true);\r", + " });\r", + "\r", + " pm.collectionVariables.set('current_online_product_id', jsonDataElements[\"Id\"]);\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{service-root-uri}}/odata/v1/Products?$filter=Online eq false", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Products" ], - "query": [ - { - "key": "$filter", - "value": "Online eq false" + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{password}}", + "type": "string" + }, + { + "key": "username", + "value": "{{username}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Orders({{current_completed_order_id}})/Product", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Orders({{current_completed_order_id}})", + "Product" + ] } - ] - } - }, - "response": [] - }, - { - "name": "Order_Offline_Product", - "event": [ - { - "listen": "prerequest", - "script": { - "exec": [ - "try {\r", - "\r", - " var current_offline_product_id = decodeURIComponent(pm.request.url.getPathWithQuery()).split(\"Products(\")[1].split(\")/OData.CSC.Order\")[0];\r", - "\r", - " pm.variables.unset(\"current_offline_product_id\");\r", - " if(current_offline_product_id == \"{{current_offline_product_id}}\"){\r", - " var current_offline_products = pm.collectionVariables.get('offline_products');\r", - " //get random product from collected offline products\r", - " var random_product = current_offline_products[Math.floor(Math.random()*current_offline_products.length)];\r", - " pm.variables.set(\"current_offline_product_id\", random_product[\"Id\"]);\r", - " } else {\r", - " pm.variables.set(\"current_offline_product_id\", current_offline_product_id);\r", - " }\r", - "\r", - " console.log(pm.variables.get(\"current_offline_product_id\"));\r", - " \r", - "} catch (err) {\r", - " pm.test(\"Filters Test\", function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } + }, + "response": [] }, { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"in_progress\",\"queued\",\"failed\",\"completed\", \"cancelled\"]);\r", - "};\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\r", - " \"request is under processing\",\r", - " \"request is queued\",\r", - " \"request product is available\",\r", - " \"product currently unavailable\",\r", - " \"request cancelled by user\"]);\r", - "};\r", - "properties_map.Priority=function (element) {pm.expect(element.Priority).to.be.a(\"number\");}; \r", - "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "properties_map.EstimatedDate=function (element) {pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d\\d\\d(\\d*)Z/);};\r", - "\r", - "// properties_map.OrderSize=function (element) {pm.expect(element.OrderSize).to.be.a(\"number\");};\r", - "// properties_map.CompletedDate=function (element) {pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "// properties_map.EvictionDate=function (element) {if(element.EvictionDate){ pm.expect(element.EvictionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/); }};\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Order: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Order: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json();\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Order\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, jsonDataElements);\r", - " //filling the collection variable order array\r", - " }\r", - "\r", - " pm.collectionVariables.set(\"current_order_id\", jsonDataElements.Id);\r", - "\r", - "} catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "basic", - "basic": [ + "name": "Product_Download_By_Order_Navigation", + "event": [ { - "key": "password", - "value": "{{password}}", - "type": "string" + "listen": "prerequest", + "script": { + "exec": [ + "try {\r", + "\r", + " var current_completed_order = decodeURIComponent(pm.request.url.getPathWithQuery()).split(\"/odata/v1/Orders(\")[1].split(\")/Product/$value\")[0];\r", + " \r", + " pm.variables.unset(\"current_completed_order_id\");\r", + " if(current_completed_order == \"{{current_completed_order_id}}\"){\r", + " current_completed_order = pm.collectionVariables.get('completed_orders');\r", + " //get random product from collected completed orders\r", + " var random_completed_order = current_completed_order[Math.floor(Math.random()*current_completed_order.length)];\r", + " pm.variables.set(\"current_completed_order_id\", random_completed_order[\"Id\"]);\r", + " } else {\r", + " pm.variables.set(\"current_completed_order_id\", current_completed_order);\r", + " }\r", + " pm.request.headers.add({key: 'Range', value: 'bytes=0-1023' })\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } }, { - "key": "username", - "value": "{{username}}", - "type": "string" + "listen": "test", + "script": { + "exec": [ + "try {\r", + "\r", + " console.log(pm.response);\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200,206,202]);\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " pm.test(\"Downloaded Size\", function(){\r", + " pm.expect(pm.response.responseSize).be.equal(1024);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } } - ] - }, - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"Priority\":43,\r\n \"NotificationEndpoint\": \"http://{{notification_server_url}}/{{lta_path}}\",\r\n \"NotificationEpUsername\": \"{{notification_username}}\",\r\n \"NotificationEpPassword\": \"{{notification_password}}\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/Products({{current_offline_product_id}})/OData.CSC.Order", - "host": [ - "{{service-root-uri}}" - ], - "path": [ - "odata", - "v1", - "Products({{current_offline_product_id}})", - "OData.CSC.Order" - ] - } - }, - "response": [] - }, - { - "name": "GetOrderNotification", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "\r", - "properties_map[\"@odata.context\"]=function(element){\r", - " pm.expect(element[\"@odata.context\"]).to.include(\"$metadata#Notifications\");\r", - "};\r", - "\r", - "properties_map.OrderId=function (element) {pm.expect(element.OrderId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.ProductId=function (element) {pm.expect(element.ProductId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.NotificationDate=function (element) {pm.expect(element.NotificationDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "\r", - "properties_map.Name=function (element) {\r", - " pm.expect(element.Name).to.be.a(\"string\");\r", - "};\r", - "\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Notification: \" + order.Name + \" Order: \" + order.OrderId, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Notification: \" + order.Name + \" Order: \" + order.OrderId);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().requests;\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var order_id = pm.collectionVariables.get('current_order_id');\r", - " for(notification of jsonDataElements){\r", - " var current_notification = JSON.parse(notification[\"body\"]);\r", - " console.log(current_notification);\r", - " console.log(order_id);\r", - " if(current_notification[\"OrderId\"] == order_id){\r", - " console.log(current_notification);\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, current_notification);\r", - " }\r", - " }\r", - " }\r", - "\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" - }, - "method": "POST", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "{{subscription_auth_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"urlPattern\":\"/{{lta_path}}\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{mocklab_api_endpoint}}/{{notification_server_url}}/__admin/requests/find", - "host": [ - "{{mocklab_api_endpoint}}" ], - "path": [ - "{{notification_server_url}}", - "__admin", - "requests", - "find" - ] - } - }, - "response": [] - }, - { - "name": "BulkCreateMaxParams_with_Notification", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"created\"]);\r", - "};\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk has been created but no BatchOrders have been triggered\"]);\r", - "};\r", - "properties_map.FilterParam=function (element) {\r", - " pm.expect(element.FilterParam).to.be.a(\"string\");\r", - " pm.expect(element.FilterParam).to.be.not.equal(null);\r", - "};\r", - "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "\r", - "properties_map.BatchsizeProducts=function (element) {\r", - " pm.expect(element.BatchsizeProducts).to.be.a(\"number\");\r", - "};\r", - "properties_map.BatchsizeVolume=function (element) {\r", - " pm.expect(element.BatchsizeVolume).to.be.a(\"number\");\r", - "};\r", - "properties_map.NotificationEndpoint=function (element) {\r", - " if(element.NotificationEndpoint){\r", - " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", - " }\r", - "};\r", - "properties_map.OrderbyParam=function (element) {\r", - " if(element.OrderbyParam){\r", - " pm.expect(element.OrderbyParam).to.be.a(\"string\"); \r", - " }\r", - "};\r", - "\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Bulk: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Bulk: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().value[0];\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Bulk\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var order_response = {};\r", - "\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, jsonDataElements);\r", - " //filling the collection variable order array\r", - " order_response[key] = jsonDataElements[key];\r", - " pm.collectionVariables.set(\"current_order_\" + key, jsonDataElements[key]);\r", - " }\r", - "\r", - " pm.collectionVariables.set('bulk_id', jsonDataElements['Id']);\r", - " pm.collectionVariables.set('bulk_batchsize_products', jsonDataElements['BatchsizeProducts']);\r", - "\r", - " pm.collectionVariables.set('current_batch_filter_param', JSON.parse(request.data)[\"FilterParam\"]);\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{password}}", + "type": "string" + }, + { + "key": "username", + "value": "{{username}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Orders({{current_completed_order_id}})/Product/$value", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Orders({{current_completed_order_id}})", + "Product", + "$value" + ] + } + }, + "response": [] }, { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n\"@odata.context\": \"$metadata#Bulk/$entity\",\r\n\"FilterParam\": \"contains(Name,'S2A')\",\r\n\"BatchsizeProducts\": 10,\r\n\"BatchsizeVolume\": 50,\r\n\"OrderbyParam\": \"Name asc\",\r\n\"NotificationEndpoint\": \"http://{{notification_server_url}}/{{lta_path}}\",\r\n\"NotificationEpUsername\": \"{{notification_username}}\",\r\n\"NotificationEpPassword\": \"{{notification_password}}\"\r\n} ", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/Bulks", - "host": [ - "{{service-root-uri}}" + "name": "Product_Download_By_Product_Navigation", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "try {\r", + " pm.request.headers.add({key: 'Range', value: 'bytes=0-1023' })\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "try {\r", + "\r", + " console.log(pm.response);\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200,206,202]);\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " pm.test(\"Downloaded Size\", function(){\r", + " pm.expect(pm.response.responseSize).be.equal(1024);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } ], - "path": [ - "odata", - "v1", - "Bulks" - ] - } - }, - "response": [] - }, - { - "name": "BatchOrdersViaBulk", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "properties_map.Status=function (element) {\r", - " pm.expect(element.Status).to.be.a(\"string\");\r", - " pm.expect(element.Status).to.be.oneOf([\"queued\", \"in_progress\", \"completed\", \"failed\", \"cancelled\"]);\r", - "};\r", - "properties_map.StatusMessage=function (element) {\r", - " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", - " switch(element.Status){\r", - " case \"queued\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder request is queued\"]);\r", - " break;\r", - " case \"in_progress\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder is under processing\"]);\r", - " break;\r", - " case \"completed\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"requested products of BatchOrder are available\"]);\r", - " break;\r", - " case \"cancelled\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder cancelled by user\"]);\r", - " break;\r", - " case \"failed\":\r", - " pm.expect(element.StatusMessage).to.be.oneOf([\"at least one product retrieval has failed\", \"at least one product currently unavailable\", \"at least one product not found on LTA\"]);\r", - " break;\r", - " }\r", - "};\r", - "properties_map.CompletedDate=function (element) {\r", - " switch(element.Status){\r", - " case \"completed\":\r", - " pm.expect(element.CompletedDate).to.be.a(\"string\");\r", - " pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - " break;\r", - " default:\r", - " if(element.CompletedDate){\r", - " pm.expect(element.CompletedDate).to.be.equal(null)\r", - " }\r", - " }\r", - "};\r", - "properties_map.SubmissionDate=function (element) {\r", - " switch(element.Status){\r", - " case \"queued\":\r", - " if(element.SubmissionDate){\r", - " pm.expect(element.SubmissionDate).to.be.oneOf([null]);\r", - " }\r", - " break;\r", - " case \"in_progress\", \"completed\":\r", - " pm.expect(element.SubmissionDate).to.be.a(\"string\");\r", - " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - " break;\r", - " case \"cancelled\", \"failed\":\r", - " if(typeof(element.SubmissionDate)==\"string\"){\r", - " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - " } else pm.expect(element.SubmissionDate).to.be.oneOf([null]);\r", - " break;\r", - " }\r", - "};\r", - "properties_map.EstimatedDate=function (element) {\r", - " switch(element.Status){\r", - " case \"queued\":\r", - " if(element.EstimatedDate){\r", - " pm.expect(element.EstimatedDate).to.be.oneOf([null]);\r", - " }\r", - " break;\r", - " case \"in_progress\", \"completed\":\r", - " pm.expect(element.EstimatedDate).to.be.a(\"string\");\r", - " pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - " break;\r", - " case \"cancelled\", \"failed\":\r", - " if(typeof(element.EstimatedDate)==\"string\"){\r", - " pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", - " } else pm.expect(element.EstimatedDate).to.be.oneOf([null]);\r", - " break;\r", - " }\r", - "};\r", - "properties_map.OrderSize=function (element) {\r", - " switch(element.Status){\r", - " case \"queued\", \"in_progress\", \"cancelled\", \"failed\":\r", - " if(element.OrderSize){\r", - " pm.expect(element.OrderSize).to.be.oneOf([null]);\r", - " } \r", - " break;\r", - " case \"completed\":\r", - " pm.expect(element.OrderSize).to.be.a(\"number\");\r", - " break;\r", - " }\r", - "};\r", - "properties_map.Priority=function (element) {\r", - " pm.expect(element.Priority).to.be.a(\"number\");\r", - "};\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for BatchOrder: \" + order.Id, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for BatchOrder: \" + order.Id);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().value;\r", - " pm.collectionVariables.set('batch_orders', jsonDataElements);\r", - " var random_batch_order = jsonDataElements[Math.floor(Math.random()*jsonDataElements.length)];\r", - " pm.collectionVariables.set(\"current_batch_order_id\", random_batch_order[\"Id\"]);\r", - "\r", - " console.log(random_batch_order);\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " for (var counter = 0; counter < jsonDataElements.length; counter++){\r", - " var batch = jsonDataElements[counter];\r", - " console.log(\"Processing Batch: \"+batch.Id);\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, batch);\r", - " }\r", - " }\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{password}}", + "type": "string" + }, + { + "key": "username", + "value": "{{username}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Products({{current_online_product_id}})/$value", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Products({{current_online_product_id}})", + "$value" + ] + } + }, + "response": [] }, { - "listen": "prerequest", - "script": { - "exec": [ - "" - ], - "type": "text/javascript" - } - } - ], - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [], - "body": { - "mode": "raw", - "raw": "", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/Bulks({{bulk_id}})/BatchOrders", - "host": [ - "{{service-root-uri}}" + "name": "Order_Cancel", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"cancelled\"]);\r", + "};\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"request cancelled by user\"]);\r", + "};\r", + "properties_map.Priority=function (element) {pm.expect(element.Priority).to.be.a(\"number\");}; \r", + "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "properties_map.EstimatedDate=function (element) {pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d\\d\\d(\\d*)Z/);};\r", + "\r", + "// comment out OrderSize check", + "// properties_map.OrderSize=function (element) {pm.expect(element.OrderSize).to.be.equal(0);};\r", + "properties_map.CompletedDate=function (element) {pm.expect(element.CompletedDate).to.be.equal(null);};\r", + "properties_map.EvictionDate=function (element) {if(element.EvictionDate){ pm.expect(element.EvictionDate).to.be.equal(null); }};\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Order: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Order: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json();\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Order\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, jsonDataElements);\r", + " }\r", + "\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } ], - "path": [ - "odata", - "v1", - "Bulks({{bulk_id}})", - "BatchOrders" - ] + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{password}}", + "type": "string" + }, + { + "key": "username", + "value": "{{username}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/Orders({{current_order_Id}})/OData.CSC.Cancel", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Orders({{current_order_Id}})", + "OData.CSC.Cancel" + ] + } + }, + "response": [] } - }, - "response": [] + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true }, { - "name": "BatchOrderTriggering", - "event": [ + "name": "Bulks_BatchOrders", + "item": [ { - "listen": "test", - "script": { - "exec": [ - "try {\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([204]);\r", - " });\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\r\n \"Priority\": 33\r\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "{{service-root-uri}}/odata/v1/BatchOrders({{current_batch_order_id}})/OData.CSC.BatchOrder", - "host": [ - "{{service-root-uri}}" + "name": "BulkCreateMinParams", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"created\"]);\r", + "};\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk has been created but no BatchOrders have been triggered\"]);\r", + "};\r", + "properties_map.FilterParam=function (element) {\r", + " pm.expect(element.FilterParam).to.be.a(\"string\");\r", + "};\r", + "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "\r", + "properties_map.BatchsizeProducts=function (element) {\r", + " pm.expect(element.BatchsizeProducts).to.be.a(\"number\");\r", + "};\r", + "properties_map.BatchsizeVolume=function (element) {\r", + " pm.expect(element.BatchsizeVolume).to.be.a(\"number\");\r", + "};\r", + "properties_map.NotificationEndpoint=function (element) {\r", + " if(element.NotificationEndpoint){\r", + " pm.expect(element.NotificationEndpoint).to.be.equal(null);\r", + " }\r", + "};\r", + "properties_map.OrderbyParam=function (element) {\r", + " if(element.OrderbyParam){\r", + " pm.expect(element.OrderbyParam).to.be.equal(null);\r", + " }\r", + "};\r", + "\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Bulk: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Bulk: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().value[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Bulk\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var order_response = {};\r", + "\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, jsonDataElements);\r", + " //filling the collection variable order array\r", + " order_response[key] = jsonDataElements[key];\r", + " pm.collectionVariables.set(\"current_order_\" + key, jsonDataElements[key]);\r", + " }\r", + "\r", + " pm.collectionVariables.set('bulk_id', jsonDataElements['Id']);\r", + " pm.collectionVariables.set('bulk_batchsize_products', jsonDataElements['BatchsizeProducts']);\r", + " pm.collectionVariables.set('current_batch_filter_param', JSON.parse(request.data)[\"FilterParam\"]);\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } ], - "path": [ - "odata", - "v1", - "BatchOrders({{current_batch_order_id}})", - "OData.CSC.BatchOrder" - ] - } - }, - "response": [] - }, - { - "name": "GetBulkStagedOrdersNotifications", - "event": [ + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n\"@odata.context\": \"$metadata#Bulk/$entity\",\r\n\"FilterParam\": \"contains(Name,'S')\"\r\n} ", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/Bulks", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Bulks" + ] + } + }, + "response": [] + }, { - "listen": "test", - "script": { - "exec": [ - "properties_map = {};\r", - "\r", - "properties_map[\"@odata.context\"]=function(element){\r", - " pm.expect(element[\"@odata.context\"]).to.include(\"$metadata#Notifications\");\r", - "};\r", - "\r", - "properties_map.BatchOrderId=function (element) {pm.expect(element.BatchOrderId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.ProductId=function (element) {pm.expect(element.ProductId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", - "\r", - "properties_map.NotificationDate=function (element) {pm.expect(element.NotificationDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", - "\r", - "properties_map.Name=function (element) {\r", - " pm.expect(element.Name).to.be.a(\"string\");\r", - "};\r", - "\r", - "\r", - "function propertySpecific(key, order){\r", - " if (properties_map[key]) {\r", - " pm.test(\"Test Property \"+key+\" for Notification: \" + order.Name + \" BatchOrder: \" + order.BatchOrderId, function(){properties_map[key](order)});\r", - " }\r", - " else {\r", - " pm.test.skip(\"Test Property \"+key+\" for Notification: \" + order.Name + \" BatchOrder: \" + order.BatchOrderId);\r", - " }\r", - "}\r", - "\r", - "try {\r", - " var jsonDataElements = pm.response.json().requests;\r", - "\r", - " pm.test(\"Test Response Status Code\", function(){\r", - " pm.expect(pm.response.code).to.be.oneOf([200]);\r", - " });\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " var batchorder_id = pm.collectionVariables.get('current_batch_order_id');\r", - " for(notification of jsonDataElements){\r", - " var current_notification = JSON.parse(notification[\"body\"]);\r", - " console.log(current_notification);\r", - " console.log(batchorder_id);\r", - " if(current_notification[\"BatchOrderId\"] == batchorder_id){\r", - " console.log(current_notification);\r", - " for (const[key, value] of Object.entries(properties_map)){\r", - " propertySpecific(key, current_notification);\r", - " }\r", - " }\r", - " }\r", - "\r", - "}\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "noauth" + "name": "BulkCreateMaxParams", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"created\"]);\r", + "};\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk has been created but no BatchOrders have been triggered\"]);\r", + "};\r", + "properties_map.FilterParam=function (element) {\r", + " pm.expect(element.FilterParam).to.be.a(\"string\");\r", + " pm.expect(element.FilterParam).to.be.not.equal(null);\r", + "};\r", + "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "\r", + "properties_map.BatchsizeProducts=function (element) {\r", + " pm.expect(element.BatchsizeProducts).to.be.a(\"number\");\r", + "};\r", + "properties_map.BatchsizeVolume=function (element) {\r", + " pm.expect(element.BatchsizeVolume).to.be.a(\"number\");\r", + "};\r", + "properties_map.NotificationEndpoint=function (element) {\r", + " if(element.NotificationEndpoint){\r", + " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", + " }\r", + "};\r", + "properties_map.OrderbyParam=function (element) {\r", + " if(element.OrderbyParam){\r", + " pm.expect(element.OrderbyParam).to.be.a(\"string\"); \r", + " }\r", + "};\r", + "\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Bulk: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Bulk: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().value[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Bulk\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var order_response = {};\r", + "\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, jsonDataElements);\r", + " //filling the collection variable order array\r", + " order_response[key] = jsonDataElements[key];\r", + " pm.collectionVariables.set(\"current_order_\" + key, jsonDataElements[key]);\r", + " }\r", + "\r", + " pm.collectionVariables.set('bulk_id', jsonDataElements['Id']);\r", + " pm.collectionVariables.set('bulk_batchsize_products', jsonDataElements['BatchsizeProducts']);\r", + "\r", + " pm.collectionVariables.set('current_batch_filter_param', JSON.parse(request.data)[\"FilterParam\"]);\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n\"@odata.context\": \"$metadata#Bulk/$entity\",\r\n\"FilterParam\": \"contains(Name,'S2A')\",\r\n\"BatchsizeProducts\": 50,\r\n\"BatchsizeVolume\": 50,\r\n\"OrderbyParam\": \"Name asc\"\r\n} ", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/Bulks", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Bulks" + ] + } + }, + "response": [] }, - "method": "POST", - "header": [ - { - "key": "Authorization", - "type": "text", - "value": "{{subscription_auth_token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\r\n \"urlPattern\":\"/{{lta_path}}\"\r\n}", - "options": { - "raw": { - "language": "json" - } - } + { + "name": "BulkDetails", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"created\", \"in_progress\", \"completed\", \"failed\", \"cancelled\"]);\r", + "};\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " switch(element.Status){\r", + " case \"created\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk has been created but no BatchOrders have been triggered\"]);\r", + " break;\r", + " case \"in_progress\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"One or more BatchOrders are under processing\"]);\r", + " break;\r", + " case \"completed\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"requested products of all BatchOrders comprising the Bulk are in status 'completed'\"]);\r", + " break;\r", + " case \"cancelled\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk cancelled by user\"]);\r", + " break;\r", + " case \"failed\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"at least one product retrieval has failed\", \"at least one product currently unavailable\", \"at least one product not found on LTA\"]);\r", + " break;\r", + " }\r", + "};\r", + "properties_map.FilterParam=function (element) {\r", + " pm.expect(element.FilterParam).to.be.a(\"string\");\r", + "};\r", + "properties_map.SubmissionDate=function (element) {\r", + " pm.expect(element.SubmissionDate).to.be.a(\"string\");\r", + " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + "};\r", + "properties_map.BatchsizeProducts=function (element) {\r", + " pm.expect(element.BatchsizeProducts).to.be.a(\"number\");\r", + "};\r", + "properties_map.BatchsizeVolume=function (element) {\r", + " pm.expect(element.BatchsizeVolume).to.be.a(\"number\");\r", + "};\r", + "properties_map.NotificationEndpoint=function (element) {\r", + " if(element.NotificationEndpoint){\r", + " if(typeof(element.NotificationEndpoint)==\"string\"){\r", + " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", + " } else pm.expect(element.NotificationEndpoint).to.be.equal(null);\r", + " }\r", + "};\r", + "properties_map.OrderbyParam=function (element) {\r", + " if(element.OrderbyParam){\r", + " if(typeof(element.OrderbyParam)==\"string\"){\r", + " pm.expect(element.OrderbyParam).to.be.a(\"string\");\r", + " } else pm.expect(element.OrderbyParam).to.be.equal(null);\r", + " }\r", + "\r", + "};\r", + "properties_map.CompletedDate=function (element) {\r", + " if(element.CompletedDate){\r", + " switch(element.Status){\r", + " case \"completed\":\r", + " pm.expect(element.CompletedDate).to.be.a(\"string\");\r", + " pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + " break;\r", + " default:\r", + " if(element.CompletedDate){\r", + " pm.expect(element.CompletedDate).to.be.equal(null)\r", + " } \r", + " }\r", + " }\r", + "};\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Bulk: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Bulk: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().value;\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"metadata#Bulks\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " for(bulk of jsonDataElements){\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, bulk);\r", + " }\r", + " }\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/Bulks({{bulk_id}})", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Bulks({{bulk_id}})" + ] + } + }, + "response": [] + }, + { + "name": "BulkFilter_by_Status", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"created\", \"in_progress\", \"completed\", \"failed\", \"cancelled\"]);\r", + "};\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " switch(element.Status){\r", + " case \"created\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk has been created but no BatchOrders have been triggered\"]);\r", + " break;\r", + " case \"in_progress\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"One or more BatchOrders are under processing\"]);\r", + " break;\r", + " case \"completed\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"requested products of all BatchOrders comprising the Bulk are in status 'completed'\"]);\r", + " break;\r", + " case \"cancelled\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk cancelled by user\"]);\r", + " break;\r", + " case \"failed\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"at least one product retrieval has failed\", \"at least one product currently unavailable\", \"at least one product not found on LTA\"]);\r", + " break;\r", + " }\r", + "};\r", + "properties_map.FilterParam=function (element) {\r", + " pm.expect(element.FilterParam).to.be.a(\"string\");\r", + "};\r", + "properties_map.SubmissionDate=function (element) {\r", + " pm.expect(element.SubmissionDate).to.be.a(\"string\");\r", + " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + "};\r", + "properties_map.BatchsizeProducts=function (element) {\r", + " pm.expect(element.BatchsizeProducts).to.be.a(\"number\");\r", + "};\r", + "properties_map.BatchsizeVolume=function (element) {\r", + " pm.expect(element.BatchsizeVolume).to.be.a(\"number\");\r", + "};\r", + "properties_map.NotificationEndpoint=function (element) {\r", + " if(element.NotificationEndpoint){\r", + " if(typeof(element.NotificationEndpoint)==\"string\"){\r", + " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", + " } else pm.expect(element.NotificationEndpoint).to.be.equal(null);\r", + " }\r", + "};\r", + "properties_map.OrderbyParam=function (element) {\r", + " if(element.OrderbyParam){\r", + " if(typeof(element.OrderbyParam)==\"string\"){\r", + " pm.expect(element.OrderbyParam).to.be.a(\"string\");\r", + " } else pm.expect(element.OrderbyParam).to.be.equal(null);\r", + " }\r", + "\r", + "};\r", + "properties_map.CompletedDate=function (element) {\r", + " if(element.CompletedDate){\r", + " switch(element.Status){\r", + " case \"completed\":\r", + " pm.expect(element.CompletedDate).to.be.a(\"string\");\r", + " pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + " break;\r", + " default:\r", + " if(element.CompletedDate){\r", + " pm.expect(element.CompletedDate).to.be.equal(null)\r", + " } \r", + " }\r", + " }\r", + "};\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Bulk: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Bulk: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().value;\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"metadata#Bulks\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " for(bulk of jsonDataElements){\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, bulk);\r", + " }\r", + " }\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/Bulks?$filter=Status eq OData.CSC.JobStatus'created'", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Bulks" + ], + "query": [ + { + "key": "$filter", + "value": "Status eq OData.CSC.JobStatus'created'" + } + ] + } + }, + "response": [] + }, + { + "name": "BatchOrdersViaBulk", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"queued\", \"in_progress\", \"completed\", \"failed\", \"cancelled\"]);\r", + "};\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " switch(element.Status){\r", + " case \"queued\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder request is queued\"]);\r", + " break;\r", + " case \"in_progress\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder is under processing\"]);\r", + " break;\r", + " case \"completed\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"requested products of BatchOrder are available\"]);\r", + " break;\r", + " case \"cancelled\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder cancelled by user\"]);\r", + " break;\r", + " case \"failed\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"at least one product retrieval has failed\", \"at least one product currently unavailable\", \"at least one product not found on LTA\"]);\r", + " break;\r", + " }\r", + "};\r", + "properties_map.CompletedDate=function (element) {\r", + " switch(element.Status){\r", + " case \"completed\":\r", + " pm.expect(element.CompletedDate).to.be.a(\"string\");\r", + " pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + " break;\r", + " default:\r", + " if(element.CompletedDate){\r", + " pm.expect(element.CompletedDate).to.be.equal(null)\r", + " }\r", + " }\r", + "};\r", + "properties_map.SubmissionDate=function (element) {\r", + " switch(element.Status){\r", + " case \"queued\":\r", + " if(element.SubmissionDate){\r", + " pm.expect(element.SubmissionDate).to.be.oneOf([null]);\r", + " }\r", + " break;\r", + " case \"in_progress\", \"completed\":\r", + " pm.expect(element.SubmissionDate).to.be.a(\"string\");\r", + " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + " break;\r", + " case \"cancelled\", \"failed\":\r", + " if(typeof(element.SubmissionDate)==\"string\"){\r", + " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + " } else pm.expect(element.SubmissionDate).to.be.oneOf([null]);\r", + " break;\r", + " }\r", + "};\r", + "properties_map.EstimatedDate=function (element) {\r", + " switch(element.Status){\r", + " case \"queued\":\r", + " if(element.EstimatedDate){\r", + " pm.expect(element.EstimatedDate).to.be.oneOf([null]);\r", + " }\r", + " break;\r", + " case \"in_progress\", \"completed\":\r", + " pm.expect(element.EstimatedDate).to.be.a(\"string\");\r", + " pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + " break;\r", + " case \"cancelled\", \"failed\":\r", + " if(typeof(element.EstimatedDate)==\"string\"){\r", + " pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + " } else pm.expect(element.EstimatedDate).to.be.oneOf([null]);\r", + " break;\r", + " }\r", + "};\r", + "properties_map.OrderSize=function (element) {\r", + " switch(element.Status){\r", + " case \"queued\", \"in_progress\", \"cancelled\", \"failed\":\r", + " if(element.OrderSize){\r", + " pm.expect(element.OrderSize).to.be.oneOf([null]);\r", + " } \r", + " break;\r", + " case \"completed\":\r", + " pm.expect(element.OrderSize).to.be.a(\"number\");\r", + " break;\r", + " }\r", + "};\r", + "properties_map.Priority=function (element) {\r", + " if(element.Status != 'created'){", + " pm.expect(element.Priority).to.be.a(\"number\");\r", + " }", + "};\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for BatchOrder: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for BatchOrder: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().value;\r", + " pm.collectionVariables.set('batch_orders', jsonDataElements);\r", + " var random_batch_order = jsonDataElements[Math.floor(Math.random()*jsonDataElements.length)];\r", + " pm.collectionVariables.set(\"current_batch_order_id\", random_batch_order[\"Id\"]);\r", + "\r", + " console.log(random_batch_order);\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " for (var counter = 0; counter < jsonDataElements.length; counter++){\r", + " var batch = jsonDataElements[counter];\r", + " console.log(\"Processing Batch: \"+batch.Id);\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, batch);\r", + " }\r", + " }\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/Bulks({{bulk_id}})/BatchOrders", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Bulks({{bulk_id}})", + "BatchOrders" + ] + } + }, + "response": [] + }, + { + "name": "BatchOrderDetailsBeforeTrigger", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"queued\"]);\r", + "};\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder request is queued\"]);\r", + "};\r", + "properties_map.CompletedDate=function (element) {\r", + " pm.expect(element.CompletedDate).to.be.equal(null);\r", + "};\r", + "properties_map.SubmissionDate=function (element) {\r", + " pm.expect(element.SubmissionDate).to.be.equal(null);\r", + "};\r", + "properties_map.EstimatedDate=function (element) {\r", + " pm.expect(element.EstimatedDate).to.be.equal(null);\r", + "};\r", + "properties_map.OrderSize=function (element) {\r", + " pm.expect(element.OrderSize).to.be.equal(null);\r", + "};\r", + "properties_map.Priority=function (element) {\r", + " pm.expect(element.Priority).to.be.a(\"number\");\r", + "};\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for BatchOrder: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for BatchOrder: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().value[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrder/$entity\");\r", + " });\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var batch = jsonDataElements;\r", + " console.log(\"Processing Batch: \"+batch.Id);\r", + "\r", + " var batchorder_response = {};\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, batch);\r", + " batchorder_response[key] = batch[key];\r", + " pm.collectionVariables.set(\"current_batchorder_\" + key, batch[key]);\r", + " }\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/BatchOrders({{current_batch_order_id}})", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "BatchOrders({{current_batch_order_id}})" + ] + } + }, + "response": [] + }, + { + "name": "BatchOrderProducts", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const supportedOperators = [\"eq\", \"ne\", \"gt\", \"ge\", \"lt\", \"le\", \"and\", \"or\", \"not\"];\r", + "const supportedFunctions = [\"startswith\", \"contains\", \"endswith\"];\r", + "\r", + "function compare(a, b){\r", + " if(isNaN(a)){\r", + " return String(a).localeCompare(String(b));\r", + " } else {\r", + " return a > b;\r", + " } \r", + "}\r", + "\r", + "function getOperator(inputString, possibleOperators) {\r", + " var op = null;\r", + " possibleOperators.forEach(function (el) { if (inputString.indexOf(el) >= 0) { op = el; } });\r", + " return op;\r", + "}\r", + "\r", + "function opToJsFormat(op) {\r", + " res = null;\r", + " switch (op) {\r", + " case \"and\":\r", + " return \"&&\";\r", + " case \"or\":\r", + " return \"||\";\r", + " case \"not\":\r", + " return \"!\";\r", + " case \"eq\":\r", + " return \"==\";\r", + " case \"ne\":\r", + " return \"!=\";\r", + " case \"gt\":\r", + " return \">\";\r", + " case \"ge\":\r", + " return \">=\";\r", + " case \"lt\":\r", + " return \"<\";\r", + " case \"le\":\r", + " return \"<=\";\r", + " }\r", + "}\r", + "\r", + "function get_query_filters(input_query) {\r", + "\r", + " console.log(\"Parsing Filter...\");\r", + "\r", + " var matcher = /(contains\\((.+?)\\)|startswith\\((.+?)\\)|endswith\\((.+?)\\)|any\\(.*?\\)|ContentDate\\/Start.*Z|ContentDate\\/End.*Z|[\\w.]+?\\s(?:eq|ne|gt|ge|lt|le)\\s(?:\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)|[+-]?([0-9]*[.])?[0-9]+|\\w+|'.+?'))/g\r", + "\r", + " var filters = input_query.match(matcher);\r", + " var i = 0;\r", + " var simpleString = input_query.replace(matcher, function () {\r", + " return i++;\r", + " });\r", + "\r", + " console.log(simpleString);\r", + " console.log(filters);\r", + "\r", + " var filterString = simpleString;\r", + "\r", + " var groupString;\r", + " var groupFilter = null;\r", + " var testNextLevel = true;\r", + "\r", + " while (testNextLevel) {\r", + " var closeParenthesisIndex = filterString.indexOf(')');\r", + " if (closeParenthesisIndex !== -1) {\r", + " var openParenthesisIndex = filterString.lastIndexOf('(', closeParenthesisIndex);\r", + "\r", + " // Extract the string between the first deepest set of parenthesis\r", + " groupString = filterString.substring(openParenthesisIndex + 1, closeParenthesisIndex);\r", + "\r", + " // Modify the filter string replacing the contents of the group string in addition to the parenthesis with the length of the filters array (which will be the index of the filter object that we push)\r", + " filterString = filterString.substring(0, openParenthesisIndex) + filters.length + filterString.substring(closeParenthesisIndex + 1);\r", + " } else {\r", + "\r", + " // There are no more parenthesis groups\r", + " groupString = filterString;\r", + " testNextLevel = false;\r", + " }\r", + "\r", + " // If the group uses both 'and' and 'or' then return null as an invalid filter string.\r", + " if (groupString.indexOf('and') >= 0 && groupString.indexOf('or') >= 0) {\r", + " console.log(\"Invalid Filter!\");\r", + " return null;\r", + " }\r", + "\r", + " // Get the group indexes out of the group string\r", + " var groupFilterIndexes = groupString.match(/[0-9]+/g);\r", + " var groupFilters = [];\r", + "\r", + " // Create an array with each of the filters who's index matches the group indexes\r", + " for (i = 0; i < groupFilterIndexes.length; i++) {\r", + " groupFilters.push(filters[Number(groupFilterIndexes[i])]);\r", + " }\r", + "\r", + " //cycling over the supported operators\r", + " var op = getOperator(groupString, supportedOperators);\r", + "\r", + " //redundant brakets management\r", + " if (op == null) {\r", + " groupFilters.push(\"true\");\r", + " op = \"and\";\r", + " }\r", + "\r", + " // Create the filter object and push it onto the filters array\r", + " groupFilter = { op: op, filters: groupFilters };\r", + " filters.push(groupFilter);\r", + " }\r", + "\r", + " return groupFilter;\r", + "\r", + "}\r", + "\r", + "function checkResponse(inputString, product) {\r", + " console.log(\"Input String: \" + inputString);\r", + " //console.log(\"Product:\");\r", + " //console.log(product);\r", + " var responseProperties = Object.keys(product);\r", + " var responseAttributes = {};\r", + "\r", + " //Attribute\r", + " if (inputString.includes(\"any(\") && inputString.includes(\"/Name\") && inputString.includes(\"/Value\")) {\r", + " //Attribute Logic Assertion\r", + " if (responseProperties.indexOf(\"Attributes\") >= 0) {\r", + " product['Attributes'].forEach(function (el) {\r", + " responseAttributes[el.Name] = el.Value;\r", + " });\r", + "\r", + " //functions in Attribute Value\r", + " var cleanedInputString = inputString.split(\"any(\").pop();\r", + " console.log(\"CLEANED ATTRIBUTE INPUTSTRING: \" + cleanedInputString);\r", + " if (cleanedInputString.includes(\"(\") && cleanedInputString.includes(\")\")) {\r", + " //get the function name\r", + " var functionName = cleanedInputString.split(\"(\")[0].split(\" \").pop();\r", + " if (supportedFunctions.indexOf(functionName) >= 0) {\r", + " console.log(\"Found Attribute Function: \" + functionName);\r", + " //get the attribute\r", + " var attrToCheck = cleanedInputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", + " console.log(\"Attribute KEY Found: \" + attrToCheck);\r", + " //get the cleaned value\r", + " var attrValueToCheck = cleanedInputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", + " console.log(\"Attribute VALUE Found: \" + attrValueToCheck);\r", + "\r", + " switch (functionName) {\r", + " case \"contains\":\r", + " attributesUnderTest.push(attrToCheck + \" contains \" + attrValueToCheck);\r", + " return (responseAttributes[attrToCheck].includes(attrValueToCheck)) ? true : false;\r", + " case \"startswith\":\r", + " attributesUnderTest.push(attrToCheck + \" startswith \" + attrValueToCheck);\r", + " return responseAttributes[attrToCheck].startsWith(attrValueToCheck) ? true : false;\r", + " case \"endswith\":\r", + " attributesUnderTest.push(attrToCheck + \" endswith \" + attrValueToCheck);\r", + " return responseAttributes[attrToCheck].endsWith(attrValueToCheck) ? true : false;\r", + " }\r", + " }\r", + " } else {\r", + " //simple any(Attributes Name and Value)\r", + " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", + " console.log(\"Extracted Attribute KEY: \" + attrToCheck);\r", + " var attrValueToCheck = inputString.split('Value eq ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\\\/g, \"\");\r", + " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck);\r", + "\r", + " attributesUnderTest.push(\"attr:\" + attrToCheck + \" eq \" + attrValueToCheck);\r", + "\r", + " return responseAttributes[attrToCheck] == attrValueToCheck;\r", + " }\r", + " }\r", + " } else {\r", + " //inputString contains a function on a Property -> complex property not supported!\r", + " if (inputString.includes(\"(\") && inputString.includes(\")\")) {\r", + " //get the function name\r", + " var functionName = inputString.split(\"(\")[0];\r", + " if (supportedFunctions.indexOf(functionName) >= 0) {\r", + " console.log(\"Found Function: \" + functionName);\r", + " //get the property\r", + " var propertyToCheck = inputString.split(\"(\")[1].split(\",\")[0].trim();\r", + " console.log(\"Property Found: \" + propertyToCheck);\r", + "\r", + " //get the cleaned value\r", + " var propValueToCheck = inputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", + " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", + "\r", + " switch (functionName) {\r", + " case \"contains\":\r", + " propertiesUnderTest.push(propertyToCheck + \" contains \" + propValueToCheck);\r", + " return (product[propertyToCheck].includes(propValueToCheck)) ? true : false;\r", + " case \"startswith\":\r", + " propertiesUnderTest.push(propertyToCheck + \" startswith \" + propValueToCheck);\r", + " return product[propertyToCheck].startsWith(propValueToCheck) ? true : false;\r", + " case \"endswith\":\r", + " propertiesUnderTest.push(propertyToCheck + \" endswith \" + propValueToCheck);\r", + " return product[propertyToCheck].endsWith(propValueToCheck) ? true : false;\r", + " }\r", + " } else {\r", + " console.log(\"Unsupported Function: \" + functionName);\r", + " return false;\r", + " }\r", + " } else {\r", + " // single logic assertion in \"AND\" with \"true\"\r", + " if (inputString === \"true\") {\r", + " console.log(\"True Value!\");\r", + " return true;\r", + " } else {\r", + " //direct Property\r", + " var propertyToCheck = inputString.split(\" \")[0].trim();\r", + " var operatorToApply = inputString.split(\" \")[1];\r", + " var propValueToCheck = inputString.split(\" \")[2].trim().replace(/'/g, \"\");\r", + "\r", + " console.log(\"Property Found: \" + propertyToCheck);\r", + " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", + "\r", + " if (supportedOperators.indexOf(operatorToApply) >= 0) {\r", + " console.log(\"Operator To Apply: \" + operatorToApply);\r", + " operator = opToJsFormat(operatorToApply);\r", + " propertiesUnderTest.push(propertyToCheck + \" \" + operatorToApply + \" \" + propValueToCheck);\r", + "\r", + " var toEvalString = \"\";\r", + " var subProperty = \"\";\r", + "\r", + " //Complex properties (ContentDate)\r", + " if(propertyToCheck.includes(\"/\")){\r", + " var rootPropertyToCheck = propertyToCheck.split(\"/\")[0];\r", + " subProperty = propertyToCheck.split(\"/\")[1];\r", + "\r", + " console.log(\"Complex Property: \" + rootPropertyToCheck);\r", + " console.log(\"Sub Property: \" + subProperty);\r", + "\r", + " toEvalString = \"product[rootPropertyToCheck][subProperty] \" + operator + \" propValueToCheck\";\r", + "\r", + " } else {\r", + " toEvalString = \"product[propertyToCheck] \" + operator + \" propValueToCheck\";\r", + " }\r", + "\r", + " return eval(toEvalString);\r", + " } else {\r", + " console.log(\"Operator not supported\");\r", + " return false;\r", + " }\r", + " }\r", + " }\r", + " }\r", + " console.log(\"Logic Assertion not computed: \" + inputString);\r", + " return Math.random() >= 0.5;\r", + "}\r", + "\r", + "function treeIterator(tree, product) {\r", + " if (tree['filters'].length >= 0) {\r", + " var conditions = [];\r", + "\r", + " var logicOperator = getOperator(tree['op'], supportedOperators);\r", + " var logicOperator = opToJsFormat(logicOperator);\r", + "\r", + " //general tree: iterates over all filters (child nodes)\r", + " for (elem in tree['filters']) {\r", + " var currentCondition = typeof ((tree['filters'][elem])) == \"object\" ? treeIterator(tree['filters'][elem], product) : checkResponse(tree['filters'][elem], product);\r", + " conditions.push(currentCondition);\r", + " //optimize AND and OR\r", + " if(logicOperator == \"||\" && currentCondition){\r", + " break;\r", + " }\r", + " if(logicOperator == \"&&\" && !currentCondition){\r", + " break;\r", + " }\r", + " }\r", + " console.log(\"CURRENT CONDITIONS\");\r", + " console.log(conditions);\r", + "\r", + " //building return string\r", + " var resString = \"(\";\r", + " for (elem in conditions) {\r", + " resString += conditions[elem] + \" \" + logicOperator.toString() + \" \";\r", + " }\r", + " resString = resString.substring(0, resString.length - 4);\r", + " resString += \")\";\r", + "\r", + " console.log(\"RES String: \" + resString);\r", + "\r", + " return resString;\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().value;\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " //MIN number of BatchOrder Products Test\r", + " var bulk_batchsize_products = pm.collectionVariables.get('bulk_batchsize_products');\r", + " pm.test(\"Expected BatchOrder number of products Test: \" + bulk_batchsize_products, function(){\r", + " pm.expect(jsonDataElements.length).to.be.lte(bulk_batchsize_products);\r", + " pm.expect(jsonDataElements.length).to.be.gte(1);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " query_string = pm.request.url.getQueryString();\r", + " if(query_string.includes(\"$expand=Attributes\")){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Products(Attributes())\");\r", + " } else{\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Products\");\r", + " }\r", + " });\r", + "\r", + " for (var counter = 0; counter < jsonDataElements.length; counter++){\r", + " var product = jsonDataElements[counter];\r", + " console.log(\"Processing Product: \"+product.Name+\" - \"+product.Id);\r", + "\r", + " pm.test(\"Test Properties for product: \" + product.Id, function(){\r", + " pm.expect(product).to.have.property(\"Id\");\r", + " pm.expect(product.Id).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"Name\");\r", + " pm.expect(product.Name).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"ContentType\");\r", + " pm.expect(product.ContentType).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"ContentLength\");\r", + " pm.expect(product.ContentLength).to.be.a(\"number\");\r", + " pm.expect(product).to.have.property(\"OriginDate\");\r", + " pm.expect(product.OriginDate).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"PublicationDate\");\r", + " pm.expect(product.PublicationDate).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"ModificationDate\");\r", + " pm.expect(product.ModificationDate).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"Online\");\r", + " pm.expect(product.Online).to.be.a(\"boolean\");\r", + " pm.expect(product).to.have.property(\"Checksum\");\r", + " pm.expect(product.Checksum).to.be.an(\"array\");\r", + " pm.expect(product).to.have.property(\"ContentDate\");\r", + " pm.expect(product.ContentDate).to.be.an(\"object\");\r", + " }); \r", + " \r", + " if(\"Attributes\" in jsonDataElements[counter]){\r", + " schema_seen = {};\r", + "\r", + " pm.test(\"Test Attributes list for product: \" + jsonDataElements[counter].Id, function(){\r", + " pm.expect(jsonDataElements[counter].Attributes.length).to.be.above(0);\r", + " jsonDataElements[counter].Attributes.forEach(function(elem){\r", + " pm.expect(elem).to.have.all.keys(\"Name\", \"Value\", \"ValueType\");\r", + " });\r", + " }); \r", + " }\r", + " }\r", + "\r", + " //Filter Param Test\r", + " var filterParam = pm.collectionVariables.get(\"current_batch_filter_param\");\r", + " parsed_filters = get_query_filters(filterParam);\r", + " console.log(parsed_filters);\r", + " if (typeof (parsed_filters) == \"object\") {\r", + " for (var counter = 0; counter < jsonDataElements.length; counter++) {\r", + "\r", + " attributesUnderTest = [];\r", + " propertiesUnderTest = [];\r", + "\r", + " var product = jsonDataElements[counter];\r", + " var treeExp = treeIterator(parsed_filters, product);\r", + " var booleanTreeExp = eval(treeExp);\r", + "\r", + " console.log(treeExp); console.log(booleanTreeExp);\r", + "\r", + " testMessage = \"FilterParam \" + filterParam + \" Check: \" + product.Name;\r", + "\r", + " pm.test(testMessage, function () {\r", + " pm.expect(booleanTreeExp, \"FilterParam Check\").to.be.true;\r", + " });\r", + " }\r", + " }\r", + "}\r", + "\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/BatchOrders({{current_batch_order_id}})/Products", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "BatchOrders({{current_batch_order_id}})", + "Products" + ] + } + }, + "response": [] + }, + { + "name": "BatchOrderTriggering", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "try {\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([204]);\r", + " });\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"Priority\": 33\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/BatchOrders({{current_batch_order_id}})/OData.CSC.BatchOrder", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "BatchOrders({{current_batch_order_id}})", + "OData.CSC.BatchOrder" + ] + } + }, + "response": [] + }, + { + "name": "BatchOrderDetailsAfterTrigger", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"in_progress\"]);\r", + "};\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder is under processing\"]);\r", + "};\r", + "properties_map.CompletedDate=function (element) {\r", + " pm.expect(element.CompletedDate).to.be.equal(null);\r", + "};\r", + "properties_map.SubmissionDate=function (element) {\r", + " pm.expect(element.SubmissionDate).to.be.a(\"string\");\r", + " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + "};\r", + "properties_map.EstimatedDate=function (element) {\r", + " pm.expect(element.EstimatedDate).to.be.a(\"string\");\r", + " pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + "};\r", + "properties_map.OrderSize=function (element) {\r", + " pm.expect(element.OrderSize).to.be.equal(null);\r", + "};\r", + "properties_map.Priority=function (element) {\r", + " pm.expect(element.Priority).to.be.a(\"number\");\r", + "};\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for BatchOrder: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for BatchOrder: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().value[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", + " });\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var batch = jsonDataElements;\r", + "\r", + " var batchorder_response = {};\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, batch);\r", + " batchorder_response[key] = batch[key];\r", + " pm.collectionVariables.set(\"current_batchorder_\" + key, batch[key]);\r", + " }\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=Status eq OData.CSC.JobStatus'in_progress'", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "BatchOrders" + ], + "query": [ + { + "key": "$filter", + "value": "Status eq OData.CSC.JobStatus'in_progress'" + } + ] + } + }, + "response": [] + }, + { + "name": "GetCompletedBatchOrder", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"completed\"]);\r", + "};\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"requested products of BatchOrder are available\"]);\r", + "};\r", + "properties_map.CompletedDate=function (element) {\r", + " pm.expect(element.CompletedDate).to.be.a(\"string\");\r", + " pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + "};\r", + "properties_map.SubmissionDate=function (element) {\r", + " pm.expect(element.SubmissionDate).to.be.a(\"string\");\r", + " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + "};\r", + "properties_map.EstimatedDate=function (element) {\r", + " pm.expect(element.EstimatedDate).to.be.a(\"string\");\r", + " pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + "};\r", + "properties_map.OrderSize=function (element) {\r", + " pm.expect(element.OrderSize).to.be.a(\"number\");\r", + "};\r", + "properties_map.Priority=function (element) {\r", + " pm.expect(element.Priority).to.be.a(\"number\");\r", + "};\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for BatchOrder: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for BatchOrder: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().value[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", + " });\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var batch = jsonDataElements;\r", + "\r", + " var batchorder_response = {};\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, batch);\r", + " batchorder_response[key] = batch[key];\r", + " pm.collectionVariables.set(\"current_batchorder_\" + key, batch[key]);\r", + " }\r", + "\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=Status eq OData.CSC.JobStatus'completed'", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "BatchOrders" + ], + "query": [ + { + "key": "$filter", + "value": "Status eq OData.CSC.JobStatus'completed'" + } + ] + } + }, + "response": [] + }, + { + "name": "BatchOrderFilter_by_Id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"Id\";\r", + "\r", + "try {\r", + " current_batch_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", + "\r", + " pm.test(\"Expected BatchOrder \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_batch_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=Id eq {{current_batchorder_Id}}", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "BatchOrders" + ], + "query": [ + { + "key": "$filter", + "value": "Id eq {{current_batchorder_Id}}" + } + ] + } + }, + "response": [] + }, + { + "name": "BatchOrderFilter_by_Status", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"Status\";\r", + "\r", + "try {\r", + " current_batch_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().split(\"OData.CSC.JobStatus\").pop().replace(/'/g, \"\");\r", + "\r", + " pm.test(\"Expected BatchOrder \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_batch_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=Status eq OData.CSC.JobStatus'{{current_batchorder_Status}}'", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "BatchOrders" + ], + "query": [ + { + "key": "$filter", + "value": "Status eq OData.CSC.JobStatus'{{current_batchorder_Status}}'" + } + ] + } + }, + "response": [] + }, + { + "name": "BatchOrderFilter_by_StatusMessage", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"StatusMessage\";\r", + "\r", + "try {\r", + " current_batch_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", + "\r", + " pm.test(\"Expected BatchOrder \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_batch_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=StatusMessage eq {{current_batchorder_StatusMessage}}", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "BatchOrders" + ], + "query": [ + { + "key": "$filter", + "value": "StatusMessage eq {{current_batchorder_StatusMessage}}" + } + ] + } + }, + "response": [] + }, + { + "name": "BatchOrderFilter_by_Priority", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"Priority\";\r", + "\r", + "try {\r", + " current_batch_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = parseInt(decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\"));\r", + "\r", + " pm.test(\"Expected BatchOrder \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_batch_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=Priority eq {{current_batchorder_Priority}}", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "BatchOrders" + ], + "query": [ + { + "key": "$filter", + "value": "Priority eq {{current_batchorder_Priority}}" + } + ] + } + }, + "response": [] + }, + { + "name": "BatchOrderFilter_by_OrderSize", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"OrderSize\";\r", + "\r", + "try {\r", + " current_batch_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = parseInt(decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\"));\r", + "\r", + " pm.test(\"Expected BatchOrder \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_batch_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=OrderSize eq {{current_batchorder_OrderSize}}", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "BatchOrders" + ], + "query": [ + { + "key": "$filter", + "value": "OrderSize eq {{current_batchorder_OrderSize}}" + } + ] + } + }, + "response": [] + }, + { + "name": "BatchOrderFilter_by_SubmissionDate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"SubmissionDate\";\r", + "\r", + "try {\r", + " current_batch_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", + "\r", + " pm.test(\"Expected BatchOrder \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_batch_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=SubmissionDate eq {{current_batchorder_SubmissionDate}}", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "BatchOrders" + ], + "query": [ + { + "key": "$filter", + "value": "SubmissionDate eq {{current_batchorder_SubmissionDate}}" + } + ] + } + }, + "response": [] + }, + { + "name": "BatchOrderFilter_by_EstimatedDate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"EstimatedDate\";\r", + "\r", + "try {\r", + " current_batch_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", + "\r", + " pm.test(\"Expected BatchOrder \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_batch_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=EstimatedDate eq {{current_batchorder_EstimatedDate}}", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "BatchOrders" + ], + "query": [ + { + "key": "$filter", + "value": "EstimatedDate eq {{current_batchorder_EstimatedDate}}" + } + ] + } + }, + "response": [] + }, + { + "name": "BatchOrderFilter_by_CompletedDate", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonDataElements = pm.response.json().value;\r", + "current_tested_filter_key = \"CompletedDate\";\r", + "\r", + "try {\r", + " current_batch_order = jsonDataElements[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var expected_order_key_value = decodeURIComponent(pm.request.url.getQueryString()).split(\" eq \").pop().replace(/'/g, \"\");\r", + "\r", + " pm.test(\"Expected BatchOrder \" + current_tested_filter_key + \" is: \" + expected_order_key_value, function(){\r", + " pm.expect(current_batch_order[current_tested_filter_key]).to.equal(expected_order_key_value);\r", + " });\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/BatchOrders?$filter=CompletedDate eq {{current_batchorder_CompletedDate}}", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "BatchOrders" + ], + "query": [ + { + "key": "$filter", + "value": "CompletedDate eq {{current_batchorder_CompletedDate}}" + } + ] + } + }, + "response": [] + }, + { + "name": "BatchOrderCancel", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"cancelled\"]);\r", + "};\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder cancelled by user\"]);\r", + "};\r", + "properties_map.CompletedDate=function (element) {\r", + " pm.expect(element.CompletedDate).to.be.equal(null);\r", + "};\r", + "properties_map.SubmissionDate=function (element) {\r", + " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + "};\r", + "properties_map.EstimatedDate=function (element) {\r", + " pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + "};\r", + "properties_map.OrderSize=function (element) {\r", + " pm.expect(element.OrderSize).to.be.equal(0);\r", + "};\r", + "properties_map.Priority=function (element) {\r", + " pm.expect(element.Priority).to.be.a(\"number\");\r", + "};\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for BatchOrder: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for BatchOrder: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json();\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"metadata#OData.CSC.BatchOrder\");\r", + " });\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var batch = jsonDataElements;\r", + " console.log(\"Processing Batch: \"+batch.Id);\r", + "\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, batch);\r", + " }\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/BatchOrders({{current_batch_order_id}})/OData.CSC.Cancel", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "BatchOrders({{current_batch_order_id}})", + "OData.CSC.Cancel" + ] + } + }, + "response": [] + }, + { + "name": "BulkCancel", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"created\", \"in_progress\", \"completed\", \"failed\", \"cancelled\"]);\r", + "};\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " switch(element.Status){\r", + " case \"created\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk has been created but no BatchOrders have been triggered\"]);\r", + " break;\r", + " case \"in_progress\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"One or more BatchOrders are under processing\"]);\r", + " break;\r", + " case \"completed\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"requested products of all BatchOrders comprising the Bulk are in status 'completed'\"]);\r", + " break;\r", + " case \"cancelled\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk cancelled by user\"]);\r", + " break;\r", + " case \"failed\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"at least one product retrieval has failed\", \"at least one product currently unavailable\", \"at least one product not found on LTA\"]);\r", + " break;\r", + " }\r", + "};\r", + "properties_map.FilterParam=function (element) {\r", + " pm.expect(element.FilterParam).to.be.a(\"string\");\r", + "};\r", + "properties_map.SubmissionDate=function (element) {\r", + " pm.expect(element.SubmissionDate).to.be.a(\"string\");\r", + " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + "};\r", + "properties_map.BatchsizeProducts=function (element) {\r", + " pm.expect(element.BatchsizeProducts).to.be.a(\"number\");\r", + "};\r", + "properties_map.BatchsizeVolume=function (element) {\r", + " pm.expect(element.BatchsizeVolume).to.be.a(\"number\");\r", + "};\r", + "properties_map.NotificationEndpoint=function (element) {\r", + " if(element.NotificationEndpoint){\r", + " if(typeof(element.NotificationEndpoint)==\"string\"){\r", + " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", + " } else pm.expect(element.NotificationEndpoint).to.be.equal(null);\r", + " }\r", + "};\r", + "properties_map.OrderbyParam=function (element) {\r", + " if(element.OrderbyParam){\r", + " if(typeof(element.OrderbyParam)==\"string\"){\r", + " pm.expect(element.OrderbyParam).to.be.a(\"string\");\r", + " } else pm.expect(element.OrderbyParam).to.be.equal(null);\r", + " }\r", + "\r", + "};\r", + "properties_map.CompletedDate=function (element) {\r", + " if(element.CompletedDate){\r", + " switch(element.Status){\r", + " case \"completed\":\r", + " pm.expect(element.CompletedDate).to.be.a(\"string\");\r", + " pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + " break;\r", + " default:\r", + " if(element.CompletedDate){\r", + " pm.expect(element.CompletedDate).to.be.equal(null)\r", + " } \r", + " }\r", + " }\r", + "};\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Bulk: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Bulk: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json();\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Bulk\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, jsonDataElements);\r", + " }\r", + "\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/Bulks({{bulk_id}})/OData.CSC.Cancel", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Bulks({{bulk_id}})", + "OData.CSC.Cancel" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Subscriptions", + "item": [ + { + "name": "CreateSubscription_noStaging", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.FilterParam=function (element) {\r", + " pm.expect(element.FilterParam).to.be.a(\"string\");\r", + " pm.expect(element.FilterParam).to.be.not.equal(null);\r", + "};\r", + "\r", + "properties_map.LastNotificationDate=function (element) {pm.expect(element.LastNotificationDate).to.be.equal(null);};\r", + "\r", + "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "\r", + "properties_map.Priority=function (element) {\r", + " pm.expect(element.Priority).to.be.equal(null);\r", + "};\r", + "\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"running\"]);\r", + "};\r", + "\r", + "properties_map.StageOrder=function (element) {\r", + " pm.expect(element.StageOrder).to.be.equal(false);\r", + "};\r", + "\r", + "properties_map.SubscriptionEvent=function (element) {\r", + " pm.expect(element.SubscriptionEvent).to.be.a(\"string\");\r", + " pm.expect(element.SubscriptionEvent).to.be.oneOf([\"created\"]);\r", + "};\r", + "\r", + "properties_map.NotificationEndpoint=function (element) {\r", + " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", + "};\r", + "\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Subscription: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Subscription: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json();\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Subscription\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, jsonDataElements);\r", + " }\r", + "\r", + " pm.collectionVariables.set('no_staging_subscription', jsonDataElements);\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"@odata.context\": \"$metadata#Subscription/entity\",\r\n \"FilterParam\": \"startswith(Name,'S1')\",\r\n \"SubscriptionEvent\": \"created\",\r\n \"StageOrder\": false,\r\n \"Priority\": 25,\r\n \"NotificationEndpoint\": \"http://{{notification_server_url}}/{{lta_path}}\",\r\n \"NotificationEpUsername\": \"{{notification_username}}\",\r\n \"NotificationEpPassword\": \"{{notification_password}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/Subscriptions", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Subscriptions" + ] + } + }, + "response": [] + }, + { + "name": "GetProductAvailabilityNotifications", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const supportedOperators = [\"eq\", \"ne\", \"gt\", \"ge\", \"lt\", \"le\", \"and\", \"or\", \"not\"];\r", + "const supportedFunctions = [\"startswith\", \"contains\", \"endswith\"];\r", + "\r", + "function compare(a, b){\r", + " if(isNaN(a)){\r", + " return String(a).localeCompare(String(b));\r", + " } else {\r", + " return a > b;\r", + " } \r", + "}\r", + "\r", + "function getOperator(inputString, possibleOperators) {\r", + " var op = null;\r", + " possibleOperators.forEach(function (el) { if (inputString.indexOf(el) >= 0) { op = el; } });\r", + " return op;\r", + "}\r", + "\r", + "function opToJsFormat(op) {\r", + " res = null;\r", + " switch (op) {\r", + " case \"and\":\r", + " return \"&&\";\r", + " case \"or\":\r", + " return \"||\";\r", + " case \"not\":\r", + " return \"!\";\r", + " case \"eq\":\r", + " return \"==\";\r", + " case \"ne\":\r", + " return \"!=\";\r", + " case \"gt\":\r", + " return \">\";\r", + " case \"ge\":\r", + " return \">=\";\r", + " case \"lt\":\r", + " return \"<\";\r", + " case \"le\":\r", + " return \"<=\";\r", + " }\r", + "}\r", + "\r", + "function get_query_filters(input_query) {\r", + "\r", + " console.log(\"Parsing Filter...\");\r", + "\r", + " var matcher = /(contains\\((.+?)\\)|startswith\\((.+?)\\)|endswith\\((.+?)\\)|any\\(.*?\\)|ContentDate\\/Start.*Z|ContentDate\\/End.*Z|[\\w.]+?\\s(?:eq|ne|gt|ge|lt|le)\\s(?:\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)|[+-]?([0-9]*[.])?[0-9]+|\\w+|'.+?'))/g\r", + "\r", + " var filters = input_query.match(matcher);\r", + " var i = 0;\r", + " var simpleString = input_query.replace(matcher, function () {\r", + " return i++;\r", + " });\r", + "\r", + " console.log(simpleString);\r", + " console.log(filters);\r", + "\r", + " var filterString = simpleString;\r", + "\r", + " var groupString;\r", + " var groupFilter = null;\r", + " var testNextLevel = true;\r", + "\r", + " while (testNextLevel) {\r", + " var closeParenthesisIndex = filterString.indexOf(')');\r", + " if (closeParenthesisIndex !== -1) {\r", + " var openParenthesisIndex = filterString.lastIndexOf('(', closeParenthesisIndex);\r", + "\r", + " // Extract the string between the first deepest set of parenthesis\r", + " groupString = filterString.substring(openParenthesisIndex + 1, closeParenthesisIndex);\r", + "\r", + " // Modify the filter string replacing the contents of the group string in addition to the parenthesis with the length of the filters array (which will be the index of the filter object that we push)\r", + " filterString = filterString.substring(0, openParenthesisIndex) + filters.length + filterString.substring(closeParenthesisIndex + 1);\r", + " } else {\r", + "\r", + " // There are no more parenthesis groups\r", + " groupString = filterString;\r", + " testNextLevel = false;\r", + " }\r", + "\r", + " // If the group uses both 'and' and 'or' then return null as an invalid filter string.\r", + " if (groupString.indexOf('and') >= 0 && groupString.indexOf('or') >= 0) {\r", + " console.log(\"Invalid Filter!\");\r", + " return null;\r", + " }\r", + "\r", + " // Get the group indexes out of the group string\r", + " var groupFilterIndexes = groupString.match(/[0-9]+/g);\r", + " var groupFilters = [];\r", + "\r", + " // Create an array with each of the filters who's index matches the group indexes\r", + " for (i = 0; i < groupFilterIndexes.length; i++) {\r", + " groupFilters.push(filters[Number(groupFilterIndexes[i])]);\r", + " }\r", + "\r", + " //cycling over the supported operators\r", + " var op = getOperator(groupString, supportedOperators);\r", + "\r", + " //redundant brakets management\r", + " if (op == null) {\r", + " groupFilters.push(\"true\");\r", + " op = \"and\";\r", + " }\r", + "\r", + " // Create the filter object and push it onto the filters array\r", + " groupFilter = { op: op, filters: groupFilters };\r", + " filters.push(groupFilter);\r", + " }\r", + "\r", + " return groupFilter;\r", + "\r", + "}\r", + "\r", + "function checkResponse(inputString, product) {\r", + " console.log(\"Input String: \" + inputString);\r", + " //console.log(\"Product:\");\r", + " //console.log(product);\r", + " var responseProperties = Object.keys(product);\r", + " var responseAttributes = {};\r", + "\r", + " //Attribute\r", + " if (inputString.includes(\"any(\") && inputString.includes(\"/Name\") && inputString.includes(\"/Value\")) {\r", + " //Attribute Logic Assertion\r", + " if (responseProperties.indexOf(\"Attributes\") >= 0) {\r", + " product['Attributes'].forEach(function (el) {\r", + " responseAttributes[el.Name] = el.Value;\r", + " });\r", + "\r", + " //functions in Attribute Value\r", + " var cleanedInputString = inputString.split(\"any(\").pop();\r", + " console.log(\"CLEANED ATTRIBUTE INPUTSTRING: \" + cleanedInputString);\r", + " if (cleanedInputString.includes(\"(\") && cleanedInputString.includes(\")\")) {\r", + " //get the function name\r", + " var functionName = cleanedInputString.split(\"(\")[0].split(\" \").pop();\r", + " if (supportedFunctions.indexOf(functionName) >= 0) {\r", + " console.log(\"Found Attribute Function: \" + functionName);\r", + " //get the attribute\r", + " var attrToCheck = cleanedInputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", + " console.log(\"Attribute KEY Found: \" + attrToCheck);\r", + " //get the cleaned value\r", + " var attrValueToCheck = cleanedInputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", + " console.log(\"Attribute VALUE Found: \" + attrValueToCheck);\r", + "\r", + " switch (functionName) {\r", + " case \"contains\":\r", + " attributesUnderTest.push(attrToCheck + \" contains \" + attrValueToCheck);\r", + " return (responseAttributes[attrToCheck].includes(attrValueToCheck)) ? true : false;\r", + " case \"startswith\":\r", + " attributesUnderTest.push(attrToCheck + \" startswith \" + attrValueToCheck);\r", + " return responseAttributes[attrToCheck].startsWith(attrValueToCheck) ? true : false;\r", + " case \"endswith\":\r", + " attributesUnderTest.push(attrToCheck + \" endswith \" + attrValueToCheck);\r", + " return responseAttributes[attrToCheck].endsWith(attrValueToCheck) ? true : false;\r", + " }\r", + " }\r", + " } else {\r", + " //simple any(Attributes Name and Value)\r", + " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", + " console.log(\"Extracted Attribute KEY: \" + attrToCheck);\r", + " var attrValueToCheck = inputString.split('Value eq ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\\\/g, \"\");\r", + " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck);\r", + "\r", + " attributesUnderTest.push(\"attr:\" + attrToCheck + \" eq \" + attrValueToCheck);\r", + "\r", + " return responseAttributes[attrToCheck] == attrValueToCheck;\r", + " }\r", + " }\r", + " } else {\r", + " //inputString contains a function on a Property -> complex property not supported!\r", + " if (inputString.includes(\"(\") && inputString.includes(\")\")) {\r", + " //get the function name\r", + " var functionName = inputString.split(\"(\")[0];\r", + " if (supportedFunctions.indexOf(functionName) >= 0) {\r", + " console.log(\"Found Function: \" + functionName);\r", + " //get the property\r", + " var propertyToCheck = inputString.split(\"(\")[1].split(\",\")[0].trim();\r", + " console.log(\"Property Found: \" + propertyToCheck);\r", + "\r", + " //get the cleaned value\r", + " var propValueToCheck = inputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", + " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", + "\r", + " switch (functionName) {\r", + " case \"contains\":\r", + " propertiesUnderTest.push(propertyToCheck + \" contains \" + propValueToCheck);\r", + " return (product[propertyToCheck].includes(propValueToCheck)) ? true : false;\r", + " case \"startswith\":\r", + " propertiesUnderTest.push(propertyToCheck + \" startswith \" + propValueToCheck);\r", + " return product[propertyToCheck].startsWith(propValueToCheck) ? true : false;\r", + " case \"endswith\":\r", + " propertiesUnderTest.push(propertyToCheck + \" endswith \" + propValueToCheck);\r", + " return product[propertyToCheck].endsWith(propValueToCheck) ? true : false;\r", + " }\r", + " } else {\r", + " console.log(\"Unsupported Function: \" + functionName);\r", + " return false;\r", + " }\r", + " } else {\r", + " // single logic assertion in \"AND\" with \"true\"\r", + " if (inputString === \"true\") {\r", + " console.log(\"True Value!\");\r", + " return true;\r", + " } else {\r", + " //direct Property\r", + " var propertyToCheck = inputString.split(\" \")[0].trim();\r", + " var operatorToApply = inputString.split(\" \")[1];\r", + " var propValueToCheck = inputString.split(\" \")[2].trim().replace(/'/g, \"\");\r", + "\r", + " console.log(\"Property Found: \" + propertyToCheck);\r", + " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", + "\r", + " if (supportedOperators.indexOf(operatorToApply) >= 0) {\r", + " console.log(\"Operator To Apply: \" + operatorToApply);\r", + " operator = opToJsFormat(operatorToApply);\r", + " propertiesUnderTest.push(propertyToCheck + \" \" + operatorToApply + \" \" + propValueToCheck);\r", + "\r", + " var toEvalString = \"\";\r", + " var subProperty = \"\";\r", + "\r", + " //Complex properties (ContentDate)\r", + " if(propertyToCheck.includes(\"/\")){\r", + " var rootPropertyToCheck = propertyToCheck.split(\"/\")[0];\r", + " subProperty = propertyToCheck.split(\"/\")[1];\r", + "\r", + " console.log(\"Complex Property: \" + rootPropertyToCheck);\r", + " console.log(\"Sub Property: \" + subProperty);\r", + "\r", + " toEvalString = \"product[rootPropertyToCheck][subProperty] \" + operator + \" propValueToCheck\";\r", + "\r", + " } else {\r", + " toEvalString = \"product[propertyToCheck] \" + operator + \" propValueToCheck\";\r", + " }\r", + "\r", + " return eval(toEvalString);\r", + " } else {\r", + " console.log(\"Operator not supported\");\r", + " return false;\r", + " }\r", + " }\r", + " }\r", + " }\r", + " console.log(\"Logic Assertion not computed: \" + inputString);\r", + " return Math.random() >= 0.5;\r", + "}\r", + "\r", + "function treeIterator(tree, product) {\r", + " if (tree['filters'].length >= 0) {\r", + " var conditions = [];\r", + "\r", + " var logicOperator = getOperator(tree['op'], supportedOperators);\r", + " var logicOperator = opToJsFormat(logicOperator);\r", + "\r", + " //general tree: iterates over all filters (child nodes)\r", + " for (elem in tree['filters']) {\r", + " var currentCondition = typeof ((tree['filters'][elem])) == \"object\" ? treeIterator(tree['filters'][elem], product) : checkResponse(tree['filters'][elem], product);\r", + " conditions.push(currentCondition);\r", + " //optimize AND and OR\r", + " if(logicOperator == \"||\" && currentCondition){\r", + " break;\r", + " }\r", + " if(logicOperator == \"&&\" && !currentCondition){\r", + " break;\r", + " }\r", + " }\r", + " console.log(\"CURRENT CONDITIONS\");\r", + " console.log(conditions);\r", + "\r", + " //building return string\r", + " var resString = \"(\";\r", + " for (elem in conditions) {\r", + " resString += conditions[elem] + \" \" + logicOperator.toString() + \" \";\r", + " }\r", + " resString = resString.substring(0, resString.length - 3);\r", + " resString += \")\";\r", + "\r", + " console.log(\"RES String: \" + resString);\r", + "\r", + " return resString;\r", + " }\r", + "}\r", + "\r", + "properties_map = {};\r", + "\r", + "properties_map[\"@odata.context\"]=function(element){\r", + " pm.expect(element[\"@odata.context\"]).to.include(\"$metadata#Notifications\");\r", + "};\r", + "\r", + "properties_map.SubscriptionId=function (element) {pm.expect(element.SubscriptionId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.ProductId=function (element) {pm.expect(element.ProductId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.NotificationDate=function (element) {pm.expect(element.NotificationDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "\r", + "properties_map.Name=function (element) {\r", + " pm.expect(element.Name).to.be.a(\"string\");\r", + "};\r", + "\r", + "properties_map.SubscriptionEvent=function (element) {\r", + " pm.expect(element.SubscriptionEvent).to.be.a(\"string\");\r", + " pm.expect(element.SubscriptionEvent).to.be.oneOf([\"created\"]);\r", + "};\r", + "\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Subscription: \" + order.SubscriptionId, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Subscription: \" + order.SubscriptionId);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().requests;\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var subscription = pm.collectionVariables.get('no_staging_subscription');\r", + " for(notification of jsonDataElements){\r", + " var current_notification = JSON.parse(notification[\"body\"]);\r", + " if(current_notification[\"SubscriptionId\"] == subscription[\"Id\"]){\r", + " console.log(current_notification);\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, current_notification);\r", + " }\r", + "\r", + " //FilterParam Check\r", + " var filterParam = subscription[\"FilterParam\"];\r", + " parsed_filters = get_query_filters(subscription[\"FilterParam\"]);\r", + " console.log(parsed_filters);\r", + " if (typeof (parsed_filters) == \"object\") {\r", + " \r", + " attributesUnderTest = [];\r", + " propertiesUnderTest = [];\r", + "\r", + " var product = current_notification;\r", + " var treeExp = treeIterator(parsed_filters, product);\r", + " var booleanTreeExp = eval(treeExp);\r", + "\r", + " console.log(treeExp); console.log(booleanTreeExp);\r", + "\r", + " testMessage = \"FilterParam \" + filterParam + \" Check: \" + product.Name;\r", + "\r", + " pm.test(testMessage, function () {\r", + " pm.expect(booleanTreeExp, \"FilterParam Check\").to.be.true;\r", + " });\r", + " }\r", + " }\r", + " }\r", + "\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "{{subscription_auth_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"urlPattern\":\"/{{lta_path}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{mocklab_api_endpoint}}/{{notification_server_url}}/__admin/requests/find", + "host": [ + "{{mocklab_api_endpoint}}" + ], + "path": [ + "{{notification_server_url}}", + "__admin", + "requests", + "find" + ] + } + }, + "response": [] + }, + { + "name": "CreateSubscription_withStaging", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.FilterParam=function (element) {\r", + " pm.expect(element.FilterParam).to.be.a(\"string\");\r", + " pm.expect(element.FilterParam).to.be.not.equal(null);\r", + "};\r", + "\r", + "properties_map.LastNotificationDate=function (element) {pm.expect(element.LastNotificationDate).to.be.equal(null);};\r", + "\r", + "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "\r", + "properties_map.Priority=function (element) {\r", + " pm.expect(element.Priority).to.be.a(\"number\");\r", + " pm.expect(element.Priority).to.be.gte(0);\r", + " pm.expect(element.Priority).to.be.lte(100);\r", + "};\r", + "\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"running\"]);\r", + "};\r", + "\r", + "properties_map.StageOrder=function (element) {\r", + " pm.expect(element.StageOrder).to.be.equal(true);\r", + "};\r", + "\r", + "properties_map.SubscriptionEvent=function (element) {\r", + " pm.expect(element.SubscriptionEvent).to.be.a(\"string\");\r", + " pm.expect(element.SubscriptionEvent).to.be.oneOf([\"created\"]);\r", + "};\r", + "\r", + "properties_map.NotificationEndpoint=function (element) {\r", + " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", + "};\r", + "\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Subscription: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Subscription: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json();\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Subscription\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, jsonDataElements);\r", + " }\r", + "\r", + " pm.collectionVariables.set('staging_subscription', jsonDataElements);\r", + " pm.collectionVariables.set('subscription_id', jsonDataElements[\"Id\"]);\r", + "\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"@odata.context\": \"$metadata#Subscription/entity\",\r\n \"FilterParam\": \"startswith(Name,'S1')\",\r\n \"SubscriptionEvent\": \"created\",\r\n \"StageOrder\": true,\r\n \"Priority\": 25,\r\n \"NotificationEndpoint\": \"http://{{notification_server_url}}/{{lta_path}}\",\r\n \"NotificationEpUsername\": \"{{notification_username}}\",\r\n \"NotificationEpPassword\": \"{{notification_password}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/Subscriptions", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Subscriptions" + ] + } + }, + "response": [] + }, + { + "name": "GetProductDownloadReadinessNotifications", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const supportedOperators = [\"eq\", \"ne\", \"gt\", \"ge\", \"lt\", \"le\", \"and\", \"or\", \"not\"];\r", + "const supportedFunctions = [\"startswith\", \"contains\", \"endswith\"];\r", + "\r", + "function compare(a, b){\r", + " if(isNaN(a)){\r", + " return String(a).localeCompare(String(b));\r", + " } else {\r", + " return a > b;\r", + " } \r", + "}\r", + "\r", + "function getOperator(inputString, possibleOperators) {\r", + " var op = null;\r", + " possibleOperators.forEach(function (el) { if (inputString.indexOf(el) >= 0) { op = el; } });\r", + " return op;\r", + "}\r", + "\r", + "function opToJsFormat(op) {\r", + " res = null;\r", + " switch (op) {\r", + " case \"and\":\r", + " return \"&&\";\r", + " case \"or\":\r", + " return \"||\";\r", + " case \"not\":\r", + " return \"!\";\r", + " case \"eq\":\r", + " return \"==\";\r", + " case \"ne\":\r", + " return \"!=\";\r", + " case \"gt\":\r", + " return \">\";\r", + " case \"ge\":\r", + " return \">=\";\r", + " case \"lt\":\r", + " return \"<\";\r", + " case \"le\":\r", + " return \"<=\";\r", + " }\r", + "}\r", + "\r", + "function get_query_filters(input_query) {\r", + "\r", + " console.log(\"Parsing Filter...\");\r", + "\r", + " var matcher = /(contains\\((.+?)\\)|startswith\\((.+?)\\)|endswith\\((.+?)\\)|any\\(.*?\\)|ContentDate\\/Start.*Z|ContentDate\\/End.*Z|[\\w.]+?\\s(?:eq|ne|gt|ge|lt|le)\\s(?:\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)|[+-]?([0-9]*[.])?[0-9]+|\\w+|'.+?'))/g\r", + "\r", + " var filters = input_query.match(matcher);\r", + " var i = 0;\r", + " var simpleString = input_query.replace(matcher, function () {\r", + " return i++;\r", + " });\r", + "\r", + " console.log(simpleString);\r", + " console.log(filters);\r", + "\r", + " var filterString = simpleString;\r", + "\r", + " var groupString;\r", + " var groupFilter = null;\r", + " var testNextLevel = true;\r", + "\r", + " while (testNextLevel) {\r", + " var closeParenthesisIndex = filterString.indexOf(')');\r", + " if (closeParenthesisIndex !== -1) {\r", + " var openParenthesisIndex = filterString.lastIndexOf('(', closeParenthesisIndex);\r", + "\r", + " // Extract the string between the first deepest set of parenthesis\r", + " groupString = filterString.substring(openParenthesisIndex + 1, closeParenthesisIndex);\r", + "\r", + " // Modify the filter string replacing the contents of the group string in addition to the parenthesis with the length of the filters array (which will be the index of the filter object that we push)\r", + " filterString = filterString.substring(0, openParenthesisIndex) + filters.length + filterString.substring(closeParenthesisIndex + 1);\r", + " } else {\r", + "\r", + " // There are no more parenthesis groups\r", + " groupString = filterString;\r", + " testNextLevel = false;\r", + " }\r", + "\r", + " // If the group uses both 'and' and 'or' then return null as an invalid filter string.\r", + " if (groupString.indexOf('and') >= 0 && groupString.indexOf('or') >= 0) {\r", + " console.log(\"Invalid Filter!\");\r", + " return null;\r", + " }\r", + "\r", + " // Get the group indexes out of the group string\r", + " var groupFilterIndexes = groupString.match(/[0-9]+/g);\r", + " var groupFilters = [];\r", + "\r", + " // Create an array with each of the filters who's index matches the group indexes\r", + " for (i = 0; i < groupFilterIndexes.length; i++) {\r", + " groupFilters.push(filters[Number(groupFilterIndexes[i])]);\r", + " }\r", + "\r", + " //cycling over the supported operators\r", + " var op = getOperator(groupString, supportedOperators);\r", + "\r", + " //redundant brakets management\r", + " if (op == null) {\r", + " groupFilters.push(\"true\");\r", + " op = \"and\";\r", + " }\r", + "\r", + " // Create the filter object and push it onto the filters array\r", + " groupFilter = { op: op, filters: groupFilters };\r", + " filters.push(groupFilter);\r", + " }\r", + "\r", + " return groupFilter;\r", + "\r", + "}\r", + "\r", + "function checkResponse(inputString, product) {\r", + " console.log(\"Input String: \" + inputString);\r", + " //console.log(\"Product:\");\r", + " //console.log(product);\r", + " var responseProperties = Object.keys(product);\r", + " var responseAttributes = {};\r", + "\r", + " //Attribute\r", + " if (inputString.includes(\"any(\") && inputString.includes(\"/Name\") && inputString.includes(\"/Value\")) {\r", + " //Attribute Logic Assertion\r", + " if (responseProperties.indexOf(\"Attributes\") >= 0) {\r", + " product['Attributes'].forEach(function (el) {\r", + " responseAttributes[el.Name] = el.Value;\r", + " });\r", + "\r", + " //functions in Attribute Value\r", + " var cleanedInputString = inputString.split(\"any(\").pop();\r", + " console.log(\"CLEANED ATTRIBUTE INPUTSTRING: \" + cleanedInputString);\r", + " if (cleanedInputString.includes(\"(\") && cleanedInputString.includes(\")\")) {\r", + " //get the function name\r", + " var functionName = cleanedInputString.split(\"(\")[0].split(\" \").pop();\r", + " if (supportedFunctions.indexOf(functionName) >= 0) {\r", + " console.log(\"Found Attribute Function: \" + functionName);\r", + " //get the attribute\r", + " var attrToCheck = cleanedInputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", + " console.log(\"Attribute KEY Found: \" + attrToCheck);\r", + " //get the cleaned value\r", + " var attrValueToCheck = cleanedInputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", + " console.log(\"Attribute VALUE Found: \" + attrValueToCheck);\r", + "\r", + " switch (functionName) {\r", + " case \"contains\":\r", + " attributesUnderTest.push(attrToCheck + \" contains \" + attrValueToCheck);\r", + " return (responseAttributes[attrToCheck].includes(attrValueToCheck)) ? true : false;\r", + " case \"startswith\":\r", + " attributesUnderTest.push(attrToCheck + \" startswith \" + attrValueToCheck);\r", + " return responseAttributes[attrToCheck].startsWith(attrValueToCheck) ? true : false;\r", + " case \"endswith\":\r", + " attributesUnderTest.push(attrToCheck + \" endswith \" + attrValueToCheck);\r", + " return responseAttributes[attrToCheck].endsWith(attrValueToCheck) ? true : false;\r", + " }\r", + " }\r", + " } else {\r", + " //simple any(Attributes Name and Value)\r", + " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", + " console.log(\"Extracted Attribute KEY: \" + attrToCheck);\r", + " var attrValueToCheck = inputString.split('Value eq ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\\\/g, \"\");\r", + " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck);\r", + "\r", + " attributesUnderTest.push(\"attr:\" + attrToCheck + \" eq \" + attrValueToCheck);\r", + "\r", + " return responseAttributes[attrToCheck] == attrValueToCheck;\r", + " }\r", + " }\r", + " } else {\r", + " //inputString contains a function on a Property -> complex property not supported!\r", + " if (inputString.includes(\"(\") && inputString.includes(\")\")) {\r", + " //get the function name\r", + " var functionName = inputString.split(\"(\")[0];\r", + " if (supportedFunctions.indexOf(functionName) >= 0) {\r", + " console.log(\"Found Function: \" + functionName);\r", + " //get the property\r", + " var propertyToCheck = inputString.split(\"(\")[1].split(\",\")[0].trim();\r", + " console.log(\"Property Found: \" + propertyToCheck);\r", + "\r", + " //get the cleaned value\r", + " var propValueToCheck = inputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", + " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", + "\r", + " switch (functionName) {\r", + " case \"contains\":\r", + " propertiesUnderTest.push(propertyToCheck + \" contains \" + propValueToCheck);\r", + " return (product[propertyToCheck].includes(propValueToCheck)) ? true : false;\r", + " case \"startswith\":\r", + " propertiesUnderTest.push(propertyToCheck + \" startswith \" + propValueToCheck);\r", + " return product[propertyToCheck].startsWith(propValueToCheck) ? true : false;\r", + " case \"endswith\":\r", + " propertiesUnderTest.push(propertyToCheck + \" endswith \" + propValueToCheck);\r", + " return product[propertyToCheck].endsWith(propValueToCheck) ? true : false;\r", + " }\r", + " } else {\r", + " console.log(\"Unsupported Function: \" + functionName);\r", + " return false;\r", + " }\r", + " } else {\r", + " // single logic assertion in \"AND\" with \"true\"\r", + " if (inputString === \"true\") {\r", + " console.log(\"True Value!\");\r", + " return true;\r", + " } else {\r", + " //direct Property\r", + " var propertyToCheck = inputString.split(\" \")[0].trim();\r", + " var operatorToApply = inputString.split(\" \")[1];\r", + " var propValueToCheck = inputString.split(\" \")[2].trim().replace(/'/g, \"\");\r", + "\r", + " console.log(\"Property Found: \" + propertyToCheck);\r", + " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", + "\r", + " if (supportedOperators.indexOf(operatorToApply) >= 0) {\r", + " console.log(\"Operator To Apply: \" + operatorToApply);\r", + " operator = opToJsFormat(operatorToApply);\r", + " propertiesUnderTest.push(propertyToCheck + \" \" + operatorToApply + \" \" + propValueToCheck);\r", + "\r", + " var toEvalString = \"\";\r", + " var subProperty = \"\";\r", + "\r", + " //Complex properties (ContentDate)\r", + " if(propertyToCheck.includes(\"/\")){\r", + " var rootPropertyToCheck = propertyToCheck.split(\"/\")[0];\r", + " subProperty = propertyToCheck.split(\"/\")[1];\r", + "\r", + " console.log(\"Complex Property: \" + rootPropertyToCheck);\r", + " console.log(\"Sub Property: \" + subProperty);\r", + "\r", + " toEvalString = \"product[rootPropertyToCheck][subProperty] \" + operator + \" propValueToCheck\";\r", + "\r", + " } else {\r", + " toEvalString = \"product[propertyToCheck] \" + operator + \" propValueToCheck\";\r", + " }\r", + "\r", + " return eval(toEvalString);\r", + " } else {\r", + " console.log(\"Operator not supported\");\r", + " return false;\r", + " }\r", + " }\r", + " }\r", + " }\r", + " console.log(\"Logic Assertion not computed: \" + inputString);\r", + " return Math.random() >= 0.5;\r", + "}\r", + "\r", + "function treeIterator(tree, product) {\r", + " if (tree['filters'].length >= 0) {\r", + " var conditions = [];\r", + "\r", + " var logicOperator = getOperator(tree['op'], supportedOperators);\r", + " var logicOperator = opToJsFormat(logicOperator);\r", + "\r", + " //general tree: iterates over all filters (child nodes)\r", + " for (elem in tree['filters']) {\r", + " var currentCondition = typeof ((tree['filters'][elem])) == \"object\" ? treeIterator(tree['filters'][elem], product) : checkResponse(tree['filters'][elem], product);\r", + " conditions.push(currentCondition);\r", + " //optimize AND and OR\r", + " if(logicOperator == \"||\" && currentCondition){\r", + " break;\r", + " }\r", + " if(logicOperator == \"&&\" && !currentCondition){\r", + " break;\r", + " }\r", + " }\r", + " console.log(\"CURRENT CONDITIONS\");\r", + " console.log(conditions);\r", + "\r", + " //building return string\r", + " var resString = \"(\";\r", + " for (elem in conditions) {\r", + " resString += conditions[elem] + \" \" + logicOperator.toString() + \" \";\r", + " }\r", + " resString = resString.substring(0, resString.length - 3);\r", + " resString += \")\";\r", + "\r", + " console.log(\"RES String: \" + resString);\r", + "\r", + " return resString;\r", + " }\r", + "}\r", + "\r", + "properties_map = {};\r", + "\r", + "properties_map[\"@odata.context\"]=function(element){\r", + " pm.expect(element[\"@odata.context\"]).to.include(\"$metadata#Notifications\");\r", + "};\r", + "\r", + "properties_map.SubscriptionId=function (element) {pm.expect(element.SubscriptionId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.ProductId=function (element) {pm.expect(element.ProductId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.NotificationDate=function (element) {pm.expect(element.NotificationDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "\r", + "properties_map.Name=function (element) {\r", + " pm.expect(element.Name).to.be.a(\"string\");\r", + "};\r", + "\r", + "properties_map.SubscriptionEvent=function (element) {\r", + " pm.expect(element.SubscriptionEvent).to.be.a(\"string\");\r", + " pm.expect(element.SubscriptionEvent).to.be.oneOf([\"created\"]);\r", + "};\r", + "\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Subscription: \" + order.SubscriptionId, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Subscription: \" + order.SubscriptionId);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().requests;\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var subscription = pm.collectionVariables.get('staging_subscription');\r", + " for(notification of jsonDataElements){\r", + " var current_notification = JSON.parse(notification[\"body\"]);\r", + " console.log(current_notification);\r", + " console.log(subscription[\"Id\"]);\r", + " if(current_notification[\"SubscriptionId\"] == subscription[\"Id\"]){\r", + " console.log(current_notification);\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, current_notification);\r", + " }\r", + "\r", + " //FilterParam Check\r", + " var filterParam = subscription[\"FilterParam\"];\r", + " parsed_filters = get_query_filters(subscription[\"FilterParam\"]);\r", + " console.log(parsed_filters);\r", + " if (typeof (parsed_filters) == \"object\") {\r", + " \r", + " attributesUnderTest = [];\r", + " propertiesUnderTest = [];\r", + "\r", + " var product = current_notification;\r", + " var treeExp = treeIterator(parsed_filters, product);\r", + " var booleanTreeExp = eval(treeExp);\r", + "\r", + " console.log(treeExp); console.log(booleanTreeExp);\r", + "\r", + " testMessage = \"FilterParam \" + filterParam + \" Check: \" + product.Name;\r", + "\r", + " pm.test(testMessage, function () {\r", + " pm.expect(booleanTreeExp, \"FilterParam Check\").to.be.true;\r", + " });\r", + " }\r", + " }\r", + " }\r", + "\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "{{subscription_auth_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"urlPattern\":\"/{{lta_path}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{mocklab_api_endpoint}}/{{notification_server_url}}/__admin/requests/find", + "host": [ + "{{mocklab_api_endpoint}}" + ], + "path": [ + "{{notification_server_url}}", + "__admin", + "requests", + "find" + ] + } + }, + "response": [] + }, + { + "name": "GetStagedOrders", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"in_progress\",\"queued\",\"failed\",\"completed\", \"cancelled\"]);\r", + "};\r", + "\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " switch(element.Status){\r", + " case \"in_progress\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"request is under processing\"]);\r", + " break;\r", + " case \"queued\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"request is queued\"]);\r", + " break;\r", + " case \"failed\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\r", + " \"product currently unavailable\",\r", + " \"product retrieval has failed\",\r", + " \"product not found on LTA\"]);\r", + " break;\r", + " case \"completed\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"request product is available\"]);\r", + " break;\r", + " case \"cancelled\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"request cancelled by user\"]);\r", + " break;\r", + " }\r", + "};\r", + "properties_map.Priority=function (element) {pm.expect(element.Priority).to.be.a(\"number\");}; \r", + "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "properties_map.EstimatedDate=function (element) {pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d\\d\\d(\\d*)Z/);};\r", + "\r", + "properties_map.OrderSize=function (element) {pm.expect(element.OrderSize).to.be.a(\"number\");};\r", + "properties_map.CompletedDate=function (element) {\r", + " if(element.CompletedDate){\r", + " switch(element.Status){\r", + " case \"completed\":\r", + " pm.expect(element.CompletedDate).to.be.a(\"string\");\r", + " pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + " break;\r", + " default:\r", + " pm.expect(element.CompletedDate).to.be.equal(null)\r", + " }\r", + " }\r", + "}\r", + " \r", + "properties_map.EvictionDate=function (element) {\r", + " if(element.EvictionDate){\r", + " switch(element.Status){\r", + " case \"completed\":\r", + " pm.expect(element.EvictionDate).to.be.a(\"string\");\r", + " pm.expect(element.EvictionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + " break;\r", + " default:\r", + " pm.expect(element.EvictionDate).to.be.equal(null) \r", + " }\r", + " }\r", + "}\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Order: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Order: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().value[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Orders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var order_response = {};\r", + "\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, jsonDataElements);\r", + " }\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Subscriptions({{subscription_id}})/Orders", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Subscriptions({{subscription_id}})", + "Orders" + ] + } + }, + "response": [] + }, + { + "name": "CreateSubscription_deletion", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.FilterParam=function (element) {\r", + " pm.expect(element.FilterParam).to.be.a(\"string\");\r", + " pm.expect(element.FilterParam).to.be.not.equal(null);\r", + "};\r", + "\r", + "properties_map.LastNotificationDate=function (element) {pm.expect(element.LastNotificationDate).to.be.equal(null);};\r", + "\r", + "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "\r", + "properties_map.Priority=function (element) {\r", + " pm.expect(element.Priority).to.be.equal(null);\r", + "};\r", + "\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"running\"]);\r", + "};\r", + "\r", + "properties_map.StageOrder=function (element) {\r", + " pm.expect(element.StageOrder).to.be.equal(false);\r", + "};\r", + "\r", + "properties_map.SubscriptionEvent=function (element) {\r", + " pm.expect(element.SubscriptionEvent).to.be.a(\"string\");\r", + " pm.expect(element.SubscriptionEvent).to.be.oneOf([\"deleted\"]);\r", + "};\r", + "\r", + "properties_map.NotificationEndpoint=function (element) {\r", + " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", + "};\r", + "\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Subscription: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Subscription: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json();\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Subscription\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, jsonDataElements);\r", + " }\r", + "\r", + " pm.collectionVariables.set('product_deleted_subscription', jsonDataElements);\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"@odata.context\": \"$metadata#Subscription/entity\",\r\n \"FilterParam\": \"startswith(Name,'S1')\",\r\n \"SubscriptionEvent\": \"deleted\",\r\n \"StageOrder\": false,\r\n \"Priority\": 25,\r\n \"NotificationEndpoint\": \"http://{{notification_server_url}}/{{lta_path}}\",\r\n \"NotificationEpUsername\": \"{{notification_username}}\",\r\n \"NotificationEpPassword\": \"{{notification_password}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/Subscriptions", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Subscriptions" + ] + } + }, + "response": [] + }, + { + "name": "GetProductDeletedNotifications", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const supportedOperators = [\"eq\", \"ne\", \"gt\", \"ge\", \"lt\", \"le\", \"and\", \"or\", \"not\"];\r", + "const supportedFunctions = [\"startswith\", \"contains\", \"endswith\"];\r", + "\r", + "function compare(a, b){\r", + " if(isNaN(a)){\r", + " return String(a).localeCompare(String(b));\r", + " } else {\r", + " return a > b;\r", + " } \r", + "}\r", + "\r", + "function getOperator(inputString, possibleOperators) {\r", + " var op = null;\r", + " possibleOperators.forEach(function (el) { if (inputString.indexOf(el) >= 0) { op = el; } });\r", + " return op;\r", + "}\r", + "\r", + "function opToJsFormat(op) {\r", + " res = null;\r", + " switch (op) {\r", + " case \"and\":\r", + " return \"&&\";\r", + " case \"or\":\r", + " return \"||\";\r", + " case \"not\":\r", + " return \"!\";\r", + " case \"eq\":\r", + " return \"==\";\r", + " case \"ne\":\r", + " return \"!=\";\r", + " case \"gt\":\r", + " return \">\";\r", + " case \"ge\":\r", + " return \">=\";\r", + " case \"lt\":\r", + " return \"<\";\r", + " case \"le\":\r", + " return \"<=\";\r", + " }\r", + "}\r", + "\r", + "function get_query_filters(input_query) {\r", + "\r", + " console.log(\"Parsing Filter...\");\r", + "\r", + " var matcher = /(contains\\((.+?)\\)|startswith\\((.+?)\\)|endswith\\((.+?)\\)|any\\(.*?\\)|ContentDate\\/Start.*Z|ContentDate\\/End.*Z|[\\w.]+?\\s(?:eq|ne|gt|ge|lt|le)\\s(?:\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)|[+-]?([0-9]*[.])?[0-9]+|\\w+|'.+?'))/g\r", + "\r", + " var filters = input_query.match(matcher);\r", + " var i = 0;\r", + " var simpleString = input_query.replace(matcher, function () {\r", + " return i++;\r", + " });\r", + "\r", + " console.log(simpleString);\r", + " console.log(filters);\r", + "\r", + " var filterString = simpleString;\r", + "\r", + " var groupString;\r", + " var groupFilter = null;\r", + " var testNextLevel = true;\r", + "\r", + " while (testNextLevel) {\r", + " var closeParenthesisIndex = filterString.indexOf(')');\r", + " if (closeParenthesisIndex !== -1) {\r", + " var openParenthesisIndex = filterString.lastIndexOf('(', closeParenthesisIndex);\r", + "\r", + " // Extract the string between the first deepest set of parenthesis\r", + " groupString = filterString.substring(openParenthesisIndex + 1, closeParenthesisIndex);\r", + "\r", + " // Modify the filter string replacing the contents of the group string in addition to the parenthesis with the length of the filters array (which will be the index of the filter object that we push)\r", + " filterString = filterString.substring(0, openParenthesisIndex) + filters.length + filterString.substring(closeParenthesisIndex + 1);\r", + " } else {\r", + "\r", + " // There are no more parenthesis groups\r", + " groupString = filterString;\r", + " testNextLevel = false;\r", + " }\r", + "\r", + " // If the group uses both 'and' and 'or' then return null as an invalid filter string.\r", + " if (groupString.indexOf('and') >= 0 && groupString.indexOf('or') >= 0) {\r", + " console.log(\"Invalid Filter!\");\r", + " return null;\r", + " }\r", + "\r", + " // Get the group indexes out of the group string\r", + " var groupFilterIndexes = groupString.match(/[0-9]+/g);\r", + " var groupFilters = [];\r", + "\r", + " // Create an array with each of the filters who's index matches the group indexes\r", + " for (i = 0; i < groupFilterIndexes.length; i++) {\r", + " groupFilters.push(filters[Number(groupFilterIndexes[i])]);\r", + " }\r", + "\r", + " //cycling over the supported operators\r", + " var op = getOperator(groupString, supportedOperators);\r", + "\r", + " //redundant brakets management\r", + " if (op == null) {\r", + " groupFilters.push(\"true\");\r", + " op = \"and\";\r", + " }\r", + "\r", + " // Create the filter object and push it onto the filters array\r", + " groupFilter = { op: op, filters: groupFilters };\r", + " filters.push(groupFilter);\r", + " }\r", + "\r", + " return groupFilter;\r", + "\r", + "}\r", + "\r", + "function checkResponse(inputString, product) {\r", + " console.log(\"Input String: \" + inputString);\r", + " //console.log(\"Product:\");\r", + " //console.log(product);\r", + " var responseProperties = Object.keys(product);\r", + " var responseAttributes = {};\r", + "\r", + " //Attribute\r", + " if (inputString.includes(\"any(\") && inputString.includes(\"/Name\") && inputString.includes(\"/Value\")) {\r", + " //Attribute Logic Assertion\r", + " if (responseProperties.indexOf(\"Attributes\") >= 0) {\r", + " product['Attributes'].forEach(function (el) {\r", + " responseAttributes[el.Name] = el.Value;\r", + " });\r", + "\r", + " //functions in Attribute Value\r", + " var cleanedInputString = inputString.split(\"any(\").pop();\r", + " console.log(\"CLEANED ATTRIBUTE INPUTSTRING: \" + cleanedInputString);\r", + " if (cleanedInputString.includes(\"(\") && cleanedInputString.includes(\")\")) {\r", + " //get the function name\r", + " var functionName = cleanedInputString.split(\"(\")[0].split(\" \").pop();\r", + " if (supportedFunctions.indexOf(functionName) >= 0) {\r", + " console.log(\"Found Attribute Function: \" + functionName);\r", + " //get the attribute\r", + " var attrToCheck = cleanedInputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", + " console.log(\"Attribute KEY Found: \" + attrToCheck);\r", + " //get the cleaned value\r", + " var attrValueToCheck = cleanedInputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", + " console.log(\"Attribute VALUE Found: \" + attrValueToCheck);\r", + "\r", + " switch (functionName) {\r", + " case \"contains\":\r", + " attributesUnderTest.push(attrToCheck + \" contains \" + attrValueToCheck);\r", + " return (responseAttributes[attrToCheck].includes(attrValueToCheck)) ? true : false;\r", + " case \"startswith\":\r", + " attributesUnderTest.push(attrToCheck + \" startswith \" + attrValueToCheck);\r", + " return responseAttributes[attrToCheck].startsWith(attrValueToCheck) ? true : false;\r", + " case \"endswith\":\r", + " attributesUnderTest.push(attrToCheck + \" endswith \" + attrValueToCheck);\r", + " return responseAttributes[attrToCheck].endsWith(attrValueToCheck) ? true : false;\r", + " }\r", + " }\r", + " } else {\r", + " //simple any(Attributes Name and Value)\r", + " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", + " console.log(\"Extracted Attribute KEY: \" + attrToCheck);\r", + " var attrValueToCheck = inputString.split('Value eq ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\\\/g, \"\");\r", + " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck);\r", + "\r", + " attributesUnderTest.push(\"attr:\" + attrToCheck + \" eq \" + attrValueToCheck);\r", + "\r", + " return responseAttributes[attrToCheck] == attrValueToCheck;\r", + " }\r", + " }\r", + " } else {\r", + " //inputString contains a function on a Property -> complex property not supported!\r", + " if (inputString.includes(\"(\") && inputString.includes(\")\")) {\r", + " //get the function name\r", + " var functionName = inputString.split(\"(\")[0];\r", + " if (supportedFunctions.indexOf(functionName) >= 0) {\r", + " console.log(\"Found Function: \" + functionName);\r", + " //get the property\r", + " var propertyToCheck = inputString.split(\"(\")[1].split(\",\")[0].trim();\r", + " console.log(\"Property Found: \" + propertyToCheck);\r", + "\r", + " //get the cleaned value\r", + " var propValueToCheck = inputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", + " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", + "\r", + " switch (functionName) {\r", + " case \"contains\":\r", + " propertiesUnderTest.push(propertyToCheck + \" contains \" + propValueToCheck);\r", + " return (product[propertyToCheck].includes(propValueToCheck)) ? true : false;\r", + " case \"startswith\":\r", + " propertiesUnderTest.push(propertyToCheck + \" startswith \" + propValueToCheck);\r", + " return product[propertyToCheck].startsWith(propValueToCheck) ? true : false;\r", + " case \"endswith\":\r", + " propertiesUnderTest.push(propertyToCheck + \" endswith \" + propValueToCheck);\r", + " return product[propertyToCheck].endsWith(propValueToCheck) ? true : false;\r", + " }\r", + " } else {\r", + " console.log(\"Unsupported Function: \" + functionName);\r", + " return false;\r", + " }\r", + " } else {\r", + " // single logic assertion in \"AND\" with \"true\"\r", + " if (inputString === \"true\") {\r", + " console.log(\"True Value!\");\r", + " return true;\r", + " } else {\r", + " //direct Property\r", + " var propertyToCheck = inputString.split(\" \")[0].trim();\r", + " var operatorToApply = inputString.split(\" \")[1];\r", + " var propValueToCheck = inputString.split(\" \")[2].trim().replace(/'/g, \"\");\r", + "\r", + " console.log(\"Property Found: \" + propertyToCheck);\r", + " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", + "\r", + " if (supportedOperators.indexOf(operatorToApply) >= 0) {\r", + " console.log(\"Operator To Apply: \" + operatorToApply);\r", + " operator = opToJsFormat(operatorToApply);\r", + " propertiesUnderTest.push(propertyToCheck + \" \" + operatorToApply + \" \" + propValueToCheck);\r", + "\r", + " var toEvalString = \"\";\r", + " var subProperty = \"\";\r", + "\r", + " //Complex properties (ContentDate)\r", + " if(propertyToCheck.includes(\"/\")){\r", + " var rootPropertyToCheck = propertyToCheck.split(\"/\")[0];\r", + " subProperty = propertyToCheck.split(\"/\")[1];\r", + "\r", + " console.log(\"Complex Property: \" + rootPropertyToCheck);\r", + " console.log(\"Sub Property: \" + subProperty);\r", + "\r", + " toEvalString = \"product[rootPropertyToCheck][subProperty] \" + operator + \" propValueToCheck\";\r", + "\r", + " } else {\r", + " toEvalString = \"product[propertyToCheck] \" + operator + \" propValueToCheck\";\r", + " }\r", + "\r", + " return eval(toEvalString);\r", + " } else {\r", + " console.log(\"Operator not supported\");\r", + " return false;\r", + " }\r", + " }\r", + " }\r", + " }\r", + " console.log(\"Logic Assertion not computed: \" + inputString);\r", + " return Math.random() >= 0.5;\r", + "}\r", + "\r", + "function treeIterator(tree, product) {\r", + " if (tree['filters'].length >= 0) {\r", + " var conditions = [];\r", + "\r", + " var logicOperator = getOperator(tree['op'], supportedOperators);\r", + " var logicOperator = opToJsFormat(logicOperator);\r", + "\r", + " //general tree: iterates over all filters (child nodes)\r", + " for (elem in tree['filters']) {\r", + " var currentCondition = typeof ((tree['filters'][elem])) == \"object\" ? treeIterator(tree['filters'][elem], product) : checkResponse(tree['filters'][elem], product);\r", + " conditions.push(currentCondition);\r", + " //optimize AND and OR\r", + " if(logicOperator == \"||\" && currentCondition){\r", + " break;\r", + " }\r", + " if(logicOperator == \"&&\" && !currentCondition){\r", + " break;\r", + " }\r", + " }\r", + " console.log(\"CURRENT CONDITIONS\");\r", + " console.log(conditions);\r", + "\r", + " //building return string\r", + " var resString = \"(\";\r", + " for (elem in conditions) {\r", + " resString += conditions[elem] + \" \" + logicOperator.toString() + \" \";\r", + " }\r", + " resString = resString.substring(0, resString.length - 3);\r", + " resString += \")\";\r", + "\r", + " console.log(\"RES String: \" + resString);\r", + "\r", + " return resString;\r", + " }\r", + "}\r", + "\r", + "properties_map = {};\r", + "\r", + "properties_map[\"@odata.context\"]=function(element){\r", + " pm.expect(element[\"@odata.context\"]).to.include(\"$metadata#Notifications\");\r", + "};\r", + "\r", + "properties_map.SubscriptionId=function (element) {pm.expect(element.SubscriptionId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.ProductId=function (element) {pm.expect(element.ProductId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.NotificationDate=function (element) {pm.expect(element.NotificationDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "\r", + "properties_map.Name=function (element) {\r", + " pm.expect(element.Name).to.be.a(\"string\");\r", + "};\r", + "\r", + "properties_map.SubscriptionEvent=function (element) {\r", + " pm.expect(element.SubscriptionEvent).to.be.a(\"string\");\r", + " pm.expect(element.SubscriptionEvent).to.be.oneOf([\"deleted\"]);\r", + "};\r", + "\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Subscription: \" + order.SubscriptionId, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Subscription: \" + order.SubscriptionId);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().requests;\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var subscription = pm.collectionVariables.get('product_deleted_subscription');\r", + " for(notification of jsonDataElements){\r", + " var current_notification = JSON.parse(notification[\"body\"]);\r", + " console.log(current_notification);\r", + " console.log(subscription[\"Id\"]);\r", + " if(current_notification[\"SubscriptionId\"] == subscription[\"Id\"]){\r", + " console.log(current_notification);\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, current_notification);\r", + " }\r", + "\r", + " //FilterParam Check\r", + " var filterParam = subscription[\"FilterParam\"];\r", + " parsed_filters = get_query_filters(subscription[\"FilterParam\"]);\r", + " console.log(parsed_filters);\r", + " if (typeof (parsed_filters) == \"object\") {\r", + " \r", + " attributesUnderTest = [];\r", + " propertiesUnderTest = [];\r", + "\r", + " var product = current_notification;\r", + " var treeExp = treeIterator(parsed_filters, product);\r", + " var booleanTreeExp = eval(treeExp);\r", + "\r", + " console.log(treeExp); console.log(booleanTreeExp);\r", + "\r", + " testMessage = \"FilterParam \" + filterParam + \" Check: \" + product.Name;\r", + "\r", + " pm.test(testMessage, function () {\r", + " pm.expect(booleanTreeExp, \"FilterParam Check\").to.be.true;\r", + " });\r", + " }\r", + " }\r", + " }\r", + "\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "{{subscription_auth_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"urlPattern\":\"/{{lta_path}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{mocklab_api_endpoint}}/{{notification_server_url}}/__admin/requests/find", + "host": [ + "{{mocklab_api_endpoint}}" + ], + "path": [ + "{{notification_server_url}}", + "__admin", + "requests", + "find" + ] + } + }, + "response": [] + }, + { + "name": "Get_Offline_Products", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "try {\r", + " var jsonDataElements = pm.response.json().value;\r", + "\r", + " console.log(\"Response: \");\r", + " console.log(jsonDataElements);\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " //MIN number of Records Test\r", + " var minimumExpRecords = parseInt(pm.collectionVariables.get('resp_min_records'));\r", + " pm.test(\"Expected minimum number of products Test: \" + minimumExpRecords, function(){\r", + " pm.expect(jsonDataElements.length).to.be.gte(minimumExpRecords);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " query_string = pm.request.url.getQueryString();\r", + " if(query_string.includes(\"$expand=Attributes\")){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Products(Attributes())\");\r", + " } else{\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Products\");\r", + " }\r", + " });\r", + "\r", + " for (var counter = 0; counter < jsonDataElements.length; counter++){\r", + " var product = jsonDataElements[counter];\r", + " console.log(\"Processing Product: \"+product.Name+\" - \"+product.Id);\r", + "\r", + " pm.test(\"Test Properties for product: \" + product.Id, function(){\r", + " pm.expect(product).to.have.property(\"Id\");\r", + " pm.expect(product.Id).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"Name\");\r", + " pm.expect(product.Name).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"ContentType\");\r", + " pm.expect(product.ContentType).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"ContentLength\");\r", + " pm.expect(product.ContentLength).to.be.a(\"number\");\r", + " pm.expect(product).to.have.property(\"OriginDate\");\r", + " pm.expect(product.OriginDate).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"PublicationDate\");\r", + " pm.expect(product.PublicationDate).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"ModificationDate\");\r", + " pm.expect(product.ModificationDate).to.be.a(\"string\");\r", + " pm.expect(product).to.have.property(\"Online\");\r", + " pm.expect(product.Online).to.be.a(\"boolean\");\r", + " pm.expect(product).to.have.property(\"Checksum\");\r", + " pm.expect(product.Checksum).to.be.an(\"array\");\r", + " pm.expect(product).to.have.property(\"ContentDate\");\r", + " pm.expect(product.ContentDate).to.be.an(\"object\");\r", + " }); \r", + " \r", + " if(\"Attributes\" in jsonDataElements[counter]){\r", + " schema_seen = {};\r", + "\r", + " pm.test(\"Test Attributes list for product: \" + jsonDataElements[counter].Id, function(){\r", + " pm.expect(jsonDataElements[counter].Attributes.length).to.be.above(0);\r", + " jsonDataElements[counter].Attributes.forEach(function(elem){\r", + " pm.expect(elem).to.have.all.keys(\"Name\", \"Value\", \"ValueType\");\r", + " });\r", + " }); \r", + " }\r", + " }\r", + "\r", + " pm.collectionVariables.set('offline_products', jsonDataElements);\r", + " \r", + "}\r", + "\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{password}}", + "type": "string" + }, + { + "key": "username", + "value": "{{username}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Products?$filter=Online eq false", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Products" + ], + "query": [ + { + "key": "$filter", + "value": "Online eq false" + } + ] + } + }, + "response": [] + }, + { + "name": "Order_Offline_Product", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "try {\r", + "\r", + " var current_offline_product_id = decodeURIComponent(pm.request.url.getPathWithQuery()).split(\"Products(\")[1].split(\")/OData.CSC.Order\")[0];\r", + "\r", + " pm.variables.unset(\"current_offline_product_id\");\r", + " if(current_offline_product_id == \"{{current_offline_product_id}}\"){\r", + " var current_offline_products = pm.collectionVariables.get('offline_products');\r", + " //get random product from collected offline products\r", + " var random_product = current_offline_products[Math.floor(Math.random()*current_offline_products.length)];\r", + " pm.variables.set(\"current_offline_product_id\", random_product[\"Id\"]);\r", + " } else {\r", + " pm.variables.set(\"current_offline_product_id\", current_offline_product_id);\r", + " }\r", + "\r", + " console.log(pm.variables.get(\"current_offline_product_id\"));\r", + " \r", + "} catch (err) {\r", + " pm.test(\"Filters Test\", function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"in_progress\",\"queued\",\"failed\",\"completed\", \"cancelled\"]);\r", + "};\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\r", + " \"request is under processing\",\r", + " \"request is queued\",\r", + " \"request product is available\",\r", + " \"product currently unavailable\",\r", + " \"request cancelled by user\"]);\r", + "};\r", + "properties_map.Priority=function (element) {pm.expect(element.Priority).to.be.a(\"number\");}; \r", + "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "properties_map.EstimatedDate=function (element) {pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d\\d\\d(\\d*)Z/);};\r", + "\r", + "// properties_map.OrderSize=function (element) {pm.expect(element.OrderSize).to.be.a(\"number\");};\r", + "// properties_map.CompletedDate=function (element) {pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "// properties_map.EvictionDate=function (element) {if(element.EvictionDate){ pm.expect(element.EvictionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/); }};\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Order: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Order: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json();\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Order\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, jsonDataElements);\r", + " //filling the collection variable order array\r", + " }\r", + "\r", + " pm.collectionVariables.set(\"current_order_id\", jsonDataElements.Id);\r", + "\r", + "} catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{password}}", + "type": "string" + }, + { + "key": "username", + "value": "{{username}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"Priority\":43,\r\n \"NotificationEndpoint\": \"http://{{notification_server_url}}/{{lta_path}}\",\r\n \"NotificationEpUsername\": \"{{notification_username}}\",\r\n \"NotificationEpPassword\": \"{{notification_password}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/Products({{current_offline_product_id}})/OData.CSC.Order", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Products({{current_offline_product_id}})", + "OData.CSC.Order" + ] + } + }, + "response": [] + }, + { + "name": "GetOrderNotification", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "\r", + "properties_map[\"@odata.context\"]=function(element){\r", + " pm.expect(element[\"@odata.context\"]).to.include(\"$metadata#Notifications\");\r", + "};\r", + "\r", + "properties_map.OrderId=function (element) {pm.expect(element.OrderId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.ProductId=function (element) {pm.expect(element.ProductId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.NotificationDate=function (element) {pm.expect(element.NotificationDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "\r", + "properties_map.Name=function (element) {\r", + " pm.expect(element.Name).to.be.a(\"string\");\r", + "};\r", + "\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Notification: \" + order.Name + \" Order: \" + order.OrderId, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Notification: \" + order.Name + \" Order: \" + order.OrderId);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().requests;\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var order_id = pm.collectionVariables.get('current_order_id');\r", + " for(notification of jsonDataElements){\r", + " var current_notification = JSON.parse(notification[\"body\"]);\r", + " console.log(current_notification);\r", + " console.log(order_id);\r", + " if(current_notification[\"OrderId\"] == order_id){\r", + " console.log(current_notification);\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, current_notification);\r", + " }\r", + " }\r", + " }\r", + "\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "{{subscription_auth_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"urlPattern\":\"/{{lta_path}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{mocklab_api_endpoint}}/{{notification_server_url}}/__admin/requests/find", + "host": [ + "{{mocklab_api_endpoint}}" + ], + "path": [ + "{{notification_server_url}}", + "__admin", + "requests", + "find" + ] + } + }, + "response": [] + }, + { + "name": "BulkCreateMaxParams_with_Notification", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"created\"]);\r", + "};\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"Bulk has been created but no BatchOrders have been triggered\"]);\r", + "};\r", + "properties_map.FilterParam=function (element) {\r", + " pm.expect(element.FilterParam).to.be.a(\"string\");\r", + " pm.expect(element.FilterParam).to.be.not.equal(null);\r", + "};\r", + "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "\r", + "properties_map.BatchsizeProducts=function (element) {\r", + " pm.expect(element.BatchsizeProducts).to.be.a(\"number\");\r", + "};\r", + "properties_map.BatchsizeVolume=function (element) {\r", + " pm.expect(element.BatchsizeVolume).to.be.a(\"number\");\r", + "};\r", + "properties_map.NotificationEndpoint=function (element) {\r", + " if(element.NotificationEndpoint){\r", + " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", + " }\r", + "};\r", + "properties_map.OrderbyParam=function (element) {\r", + " if(element.OrderbyParam){\r", + " pm.expect(element.OrderbyParam).to.be.a(\"string\"); \r", + " }\r", + "};\r", + "\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Bulk: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Bulk: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().value[0];\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Bulk\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var order_response = {};\r", + "\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, jsonDataElements);\r", + " //filling the collection variable order array\r", + " order_response[key] = jsonDataElements[key];\r", + " pm.collectionVariables.set(\"current_order_\" + key, jsonDataElements[key]);\r", + " }\r", + "\r", + " pm.collectionVariables.set('bulk_id', jsonDataElements['Id']);\r", + " pm.collectionVariables.set('bulk_batchsize_products', jsonDataElements['BatchsizeProducts']);\r", + "\r", + " pm.collectionVariables.set('current_batch_filter_param', JSON.parse(request.data)[\"FilterParam\"]);\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n\"@odata.context\": \"$metadata#Bulk/$entity\",\r\n\"FilterParam\": \"contains(Name,'S2A')\",\r\n\"BatchsizeProducts\": 10,\r\n\"BatchsizeVolume\": 50,\r\n\"OrderbyParam\": \"Name asc\",\r\n\"NotificationEndpoint\": \"http://{{notification_server_url}}/{{lta_path}}\",\r\n\"NotificationEpUsername\": \"{{notification_username}}\",\r\n\"NotificationEpPassword\": \"{{notification_password}}\"\r\n} ", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/Bulks", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Bulks" + ] + } + }, + "response": [] + }, + { + "name": "BatchOrdersViaBulk", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"queued\", \"in_progress\", \"completed\", \"failed\", \"cancelled\"]);\r", + "};\r", + "properties_map.StatusMessage=function (element) {\r", + " pm.expect(element.StatusMessage).to.be.a(\"string\");\r", + " switch(element.Status){\r", + " case \"queued\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder request is queued\"]);\r", + " break;\r", + " case \"in_progress\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder is under processing\"]);\r", + " break;\r", + " case \"completed\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"requested products of BatchOrder are available\"]);\r", + " break;\r", + " case \"cancelled\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"BatchOrder cancelled by user\"]);\r", + " break;\r", + " case \"failed\":\r", + " pm.expect(element.StatusMessage).to.be.oneOf([\"at least one product retrieval has failed\", \"at least one product currently unavailable\", \"at least one product not found on LTA\"]);\r", + " break;\r", + " }\r", + "};\r", + "properties_map.CompletedDate=function (element) {\r", + " switch(element.Status){\r", + " case \"completed\":\r", + " pm.expect(element.CompletedDate).to.be.a(\"string\");\r", + " pm.expect(element.CompletedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + " break;\r", + " default:\r", + " if(element.CompletedDate){\r", + " pm.expect(element.CompletedDate).to.be.equal(null)\r", + " }\r", + " }\r", + "};\r", + "properties_map.SubmissionDate=function (element) {\r", + " switch(element.Status){\r", + " case \"queued\":\r", + " if(element.SubmissionDate){\r", + " pm.expect(element.SubmissionDate).to.be.oneOf([null]);\r", + " }\r", + " break;\r", + " case \"in_progress\", \"completed\":\r", + " pm.expect(element.SubmissionDate).to.be.a(\"string\");\r", + " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + " break;\r", + " case \"cancelled\", \"failed\":\r", + " if(typeof(element.SubmissionDate)==\"string\"){\r", + " pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + " } else pm.expect(element.SubmissionDate).to.be.oneOf([null]);\r", + " break;\r", + " }\r", + "};\r", + "properties_map.EstimatedDate=function (element) {\r", + " switch(element.Status){\r", + " case \"queued\":\r", + " if(element.EstimatedDate){\r", + " pm.expect(element.EstimatedDate).to.be.oneOf([null]);\r", + " }\r", + " break;\r", + " case \"in_progress\", \"completed\":\r", + " pm.expect(element.EstimatedDate).to.be.a(\"string\");\r", + " pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + " break;\r", + " case \"cancelled\", \"failed\":\r", + " if(typeof(element.EstimatedDate)==\"string\"){\r", + " pm.expect(element.EstimatedDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);\r", + " } else pm.expect(element.EstimatedDate).to.be.oneOf([null]);\r", + " break;\r", + " }\r", + "};\r", + "properties_map.OrderSize=function (element) {\r", + " switch(element.Status){\r", + " case \"queued\", \"in_progress\", \"cancelled\", \"failed\":\r", + " if(element.OrderSize){\r", + " pm.expect(element.OrderSize).to.be.oneOf([null]);\r", + " } \r", + " break;\r", + " case \"completed\":\r", + " pm.expect(element.OrderSize).to.be.a(\"number\");\r", + " break;\r", + " }\r", + "};\r", + "properties_map.Priority=function (element) {\r", + " pm.expect(element.Priority).to.be.a(\"number\");\r", + "};\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for BatchOrder: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for BatchOrder: \" + order.Id);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().value;\r", + " pm.collectionVariables.set('batch_orders', jsonDataElements);\r", + " var random_batch_order = jsonDataElements[Math.floor(Math.random()*jsonDataElements.length)];\r", + " pm.collectionVariables.set(\"current_batch_order_id\", random_batch_order[\"Id\"]);\r", + "\r", + " console.log(random_batch_order);\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#BatchOrders\");\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " for (var counter = 0; counter < jsonDataElements.length; counter++){\r", + " var batch = jsonDataElements[counter];\r", + " console.log(\"Processing Batch: \"+batch.Id);\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, batch);\r", + " }\r", + " }\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/Bulks({{bulk_id}})/BatchOrders", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Bulks({{bulk_id}})", + "BatchOrders" + ] + } + }, + "response": [] + }, + { + "name": "BatchOrderTriggering", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "try {\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([204]);\r", + " });\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"Priority\": 33\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{service-root-uri}}/odata/v1/BatchOrders({{current_batch_order_id}})/OData.CSC.BatchOrder", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "BatchOrders({{current_batch_order_id}})", + "OData.CSC.BatchOrder" + ] + } + }, + "response": [] + }, + { + "name": "GetBulkStagedOrdersNotifications", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "properties_map = {};\r", + "\r", + "properties_map[\"@odata.context\"]=function(element){\r", + " pm.expect(element[\"@odata.context\"]).to.include(\"$metadata#Notifications\");\r", + "};\r", + "\r", + "properties_map.BatchOrderId=function (element) {pm.expect(element.BatchOrderId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.ProductId=function (element) {pm.expect(element.ProductId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.NotificationDate=function (element) {pm.expect(element.NotificationDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "\r", + "properties_map.Name=function (element) {\r", + " pm.expect(element.Name).to.be.a(\"string\");\r", + "};\r", + "\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Notification: \" + order.Name + \" BatchOrder: \" + order.BatchOrderId, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Notification: \" + order.Name + \" BatchOrder: \" + order.BatchOrderId);\r", + " }\r", + "}\r", + "\r", + "try {\r", + " var jsonDataElements = pm.response.json().requests;\r", + "\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", + " });\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " var batchorder_id = pm.collectionVariables.get('current_batch_order_id');\r", + " for(notification of jsonDataElements){\r", + " var current_notification = JSON.parse(notification[\"body\"]);\r", + " console.log(current_notification);\r", + " console.log(batchorder_id);\r", + " if(current_notification[\"BatchOrderId\"] == batchorder_id){\r", + " console.log(current_notification);\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, current_notification);\r", + " }\r", + " }\r", + " }\r", + "\r", + "}\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "{{subscription_auth_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"urlPattern\":\"/{{lta_path}}\"\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{mocklab_api_endpoint}}/{{notification_server_url}}/__admin/requests/find", + "host": [ + "{{mocklab_api_endpoint}}" + ], + "path": [ + "{{notification_server_url}}", + "__admin", + "requests", + "find" + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Metrics", + "item": [ + { + "name": "LTA_Archived_productType_platformShortName_platformSerialIdentifier_size", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "try {\r", + " var jsonDataElements = pm.response.json().value;\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " query_string = pm.request.url.getQueryString();\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Metrics\");\r", + " });\r", + "\r", + " var metricName = decodeURIComponent(pm.request.url.getQueryString()).split(\"$filter=Name eq \")[1].replace(\"'\",\"\").split(\".\")[0];\r", + " console.log(metricName);\r", + "\r", + " for(var elem of jsonDataElements){\r", + " pm.test(\"Test Metrics properties\", function(){\r", + "\r", + " if(elem[\"Name\"]) pm.expect(elem[\"Name\"].split(\".\")[0]).to.be.equal(metricName);\r", + " else pm.expect.fail(\"Name not found in element properties\");\r", + " \r", + " if(elem[\"Timestamp\"]) pm.expect(elem[\"Timestamp\"]).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d\\d\\d(\\d*)Z/);\r", + " else pm.expect.fail(\"Timestamp not found in element properties\");\r", + " \r", + " switch(metricName){\r", + " case \"systematic_production\":\r", + " case \"on-demand default\":\r", + " case \"on-demand non-default\":\r", + " case \"Archived\":\r", + " case \"Retrieved\":\r", + " case \"Download\":\r", + " console.log(\"Expected Counter\");\r", + " if(elem[\"MetricType\"]) pm.expect(elem[\"MetricType\"]).to.be.equal(\"Counter\");\r", + " else pm.expect.fail(\"MetricType not found in element properties\");\r", + " if(elem[\"Counter\"]) pm.expect(elem[\"Counter\"]).to.be.a(\"number\");\r", + " else pm.expect.fail(\"Counter not found in element properties\");\r", + " //pm.expect(elem[\"Gauge\"]).to.be.equal(null);\r", + " break;\r", + " case \"SensingToPublication\":\r", + " case \"OriginToPublication\":\r", + " case \"SubmissionToCompletion\":\r", + " case \"Service\":\r", + " console.log(\"Expected Gauge\");\r", + " if(elem[\"MetricType\"]) pm.expect(elem[\"MetricType\"]).to.be.equal(\"Gauge\");\r", + " else pm.expect.fail(\"MetricType not found in element properties\");\r", + " if(elem[\"Gauge\"]){\r", + " pm.expect(elem[\"Gauge\"]).to.be.a(\"string\");\r", + " pm.expect(parseInt(elem[\"Gauge\"])).to.be.a(\"number\");\r", + " } else pm.expect.fail(\"Gauge not found in element properties\");\r", + " //pm.expect(elem[\"Counter\"]).to.be.equal(null);\r", + " break;\r", + " }\r", + " });\r", + " }\r", + "}\r", + "\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{password}}", + "type": "string" + }, + { + "key": "username", + "value": "{{username}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Archived.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.size'", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Metrics" + ], + "query": [ + { + "key": "$filter", + "value": "Name eq 'Archived.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.size'" + } + ] + } + }, + "response": [] + }, + { + "name": "LTA_Archived_productType_platformShortName_platformSerialIdentifier_count", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "try {\r", + " var jsonDataElements = pm.response.json().value;\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " query_string = pm.request.url.getQueryString();\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Metrics\");\r", + " });\r", + "\r", + " var metricName = decodeURIComponent(pm.request.url.getQueryString()).split(\"$filter=Name eq \")[1].replace(\"'\",\"\").split(\".\")[0];\r", + " console.log(metricName);\r", + "\r", + " for(var elem of jsonDataElements){\r", + " pm.test(\"Test Metrics properties\", function(){\r", + "\r", + " if(elem[\"Name\"]) pm.expect(elem[\"Name\"].split(\".\")[0]).to.be.equal(metricName);\r", + " else pm.expect.fail(\"Name not found in element properties\");\r", + " \r", + " if(elem[\"Timestamp\"]) pm.expect(elem[\"Timestamp\"]).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d\\d\\d(\\d*)Z/);\r", + " else pm.expect.fail(\"Timestamp not found in element properties\");\r", + " \r", + " switch(metricName){\r", + " case \"systematic_production\":\r", + " case \"on-demand default\":\r", + " case \"on-demand non-default\":\r", + " case \"Archived\":\r", + " case \"Retrieved\":\r", + " case \"Download\":\r", + " console.log(\"Expected Counter\");\r", + " if(elem[\"MetricType\"]) pm.expect(elem[\"MetricType\"]).to.be.equal(\"Counter\");\r", + " else pm.expect.fail(\"MetricType not found in element properties\");\r", + " if(elem[\"Counter\"]) pm.expect(elem[\"Counter\"]).to.be.a(\"number\");\r", + " else pm.expect.fail(\"Counter not found in element properties\");\r", + " //pm.expect(elem[\"Gauge\"]).to.be.equal(null);\r", + " break;\r", + " case \"SensingToPublication\":\r", + " case \"OriginToPublication\":\r", + " case \"SubmissionToCompletion\":\r", + " case \"Service\":\r", + " console.log(\"Expected Gauge\");\r", + " if(elem[\"MetricType\"]) pm.expect(elem[\"MetricType\"]).to.be.equal(\"Gauge\");\r", + " else pm.expect.fail(\"MetricType not found in element properties\");\r", + " if(elem[\"Gauge\"]){\r", + " pm.expect(elem[\"Gauge\"]).to.be.a(\"string\");\r", + " pm.expect(parseInt(elem[\"Gauge\"])).to.be.a(\"number\");\r", + " } else pm.expect.fail(\"Gauge not found in element properties\");\r", + " //pm.expect(elem[\"Counter\"]).to.be.equal(null);\r", + " break;\r", + " }\r", + " });\r", + " }\r", + "}\r", + "\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{password}}", + "type": "string" + }, + { + "key": "username", + "value": "{{username}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Archived.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.count'", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Metrics" + ], + "query": [ + { + "key": "$filter", + "value": "Name eq 'Archived.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.count'" + } + ] + } + }, + "response": [] + }, + { + "name": "LTA_Archived_platformShortName_platformSerialIdentifier_size", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "try {\r", + " var jsonDataElements = pm.response.json().value;\r", + "\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", + "\r", + " pm.test(\"Test OData context\", function(){\r", + " query_string = pm.request.url.getQueryString();\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Metrics\");\r", + " });\r", + "\r", + " var metricName = decodeURIComponent(pm.request.url.getQueryString()).split(\"$filter=Name eq \")[1].replace(\"'\",\"\").split(\".\")[0];\r", + " console.log(metricName);\r", + "\r", + " for(var elem of jsonDataElements){\r", + " pm.test(\"Test Metrics properties\", function(){\r", + "\r", + " if(elem[\"Name\"]) pm.expect(elem[\"Name\"].split(\".\")[0]).to.be.equal(metricName);\r", + " else pm.expect.fail(\"Name not found in element properties\");\r", + " \r", + " if(elem[\"Timestamp\"]) pm.expect(elem[\"Timestamp\"]).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d\\d\\d(\\d*)Z/);\r", + " else pm.expect.fail(\"Timestamp not found in element properties\");\r", + " \r", + " switch(metricName){\r", + " case \"systematic_production\":\r", + " case \"on-demand default\":\r", + " case \"on-demand non-default\":\r", + " case \"Archived\":\r", + " case \"Retrieved\":\r", + " case \"Download\":\r", + " console.log(\"Expected Counter\");\r", + " if(elem[\"MetricType\"]) pm.expect(elem[\"MetricType\"]).to.be.equal(\"Counter\");\r", + " else pm.expect.fail(\"MetricType not found in element properties\");\r", + " if(elem[\"Counter\"]) pm.expect(elem[\"Counter\"]).to.be.a(\"number\");\r", + " else pm.expect.fail(\"Counter not found in element properties\");\r", + " //pm.expect(elem[\"Gauge\"]).to.be.equal(null);\r", + " break;\r", + " case \"SensingToPublication\":\r", + " case \"OriginToPublication\":\r", + " case \"SubmissionToCompletion\":\r", + " case \"Service\":\r", + " console.log(\"Expected Gauge\");\r", + " if(elem[\"MetricType\"]) pm.expect(elem[\"MetricType\"]).to.be.equal(\"Gauge\");\r", + " else pm.expect.fail(\"MetricType not found in element properties\");\r", + " if(elem[\"Gauge\"]){\r", + " pm.expect(elem[\"Gauge\"]).to.be.a(\"string\");\r", + " pm.expect(parseInt(elem[\"Gauge\"])).to.be.a(\"number\");\r", + " } else pm.expect.fail(\"Gauge not found in element properties\");\r", + " //pm.expect(elem[\"Counter\"]).to.be.equal(null);\r", + " break;\r", + " }\r", + " });\r", + " }\r", + "}\r", + "\r", + "catch (err) {\r", + " pm.test(request.name, function () {\r", + " pm.expect.fail(err.toString());\r", + " });\r", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{password}}", + "type": "string" + }, + { + "key": "username", + "value": "{{username}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Archived.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.size'", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Metrics" + ], + "query": [ + { + "key": "$filter", + "value": "Name eq 'Archived.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.size'" + } + ] + } + }, + "response": [] }, - "url": { - "raw": "{{mocklab_api_endpoint}}/{{notification_server_url}}/__admin/requests/find", - "host": [ - "{{mocklab_api_endpoint}}" - ], - "path": [ - "{{notification_server_url}}", - "__admin", - "requests", - "find" - ] - } - }, - "response": [] - } - ], - "protocolProfileBehavior": {}, - "_postman_isSubFolder": true - }, - { - "name": "Metrics", - "item": [ - { - "name": "LTA", - "item": [ { - "name": "LTA_Archived_productType_platformShortName_platformSerialIdentifier_size", + "name": "LTA_Archived_platformShortName_platformSerialIdentifier_count", "event": [ { "listen": "test", @@ -27955,7 +28284,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Archived.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.size'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Archived.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.count'", "host": [ "{{service-root-uri}}" ], @@ -27967,7 +28296,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'Archived.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.size'" + "value": "Name eq 'Archived.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.count'" } ] } @@ -27975,7 +28304,7 @@ "response": [] }, { - "name": "LTA_Archived_productType_platformShortName_platformSerialIdentifier_count", + "name": "LTA_Retrieved_productType_platformShortName_platformSerialIdentifier_size", "event": [ { "listen": "test", @@ -28066,7 +28395,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Archived.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.count'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Retrieved.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.size'", "host": [ "{{service-root-uri}}" ], @@ -28078,7 +28407,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'Archived.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.count'" + "value": "Name eq 'Retrieved.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.size'" } ] } @@ -28086,7 +28415,7 @@ "response": [] }, { - "name": "LTA_Archived_platformShortName_platformSerialIdentifier_size", + "name": "LTA_Retrieved_productType_platformShortName_platformSerialIdentifier_completed", "event": [ { "listen": "test", @@ -28177,7 +28506,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Archived.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.size'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Retrieved.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.completed'", "host": [ "{{service-root-uri}}" ], @@ -28189,7 +28518,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'Archived.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.size'" + "value": "Name eq 'Retrieved.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.completed'" } ] } @@ -28197,7 +28526,7 @@ "response": [] }, { - "name": "LTA_Archived_platformShortName_platformSerialIdentifier_count", + "name": "LTA_Retrieved_productType_platformShortName_platformSerialIdentifier_failed", "event": [ { "listen": "test", @@ -28288,7 +28617,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Archived.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.count'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Retrieved.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.failed'", "host": [ "{{service-root-uri}}" ], @@ -28300,7 +28629,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'Archived.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.count'" + "value": "Name eq 'Retrieved.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.failed'" } ] } @@ -28308,7 +28637,7 @@ "response": [] }, { - "name": "LTA_Retrieved_productType_platformShortName_platformSerialIdentifier_size", + "name": "LTA_Download_productType_platformShortName_platformSerialIdentifier_ServiceAlias_completed", "event": [ { "listen": "test", @@ -28399,7 +28728,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Retrieved.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.size'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Download.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.{{metric_ServiceAlias}}.completed'", "host": [ "{{service-root-uri}}" ], @@ -28411,7 +28740,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'Retrieved.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.size'" + "value": "Name eq 'Download.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.{{metric_ServiceAlias}}.completed'" } ] } @@ -28419,7 +28748,7 @@ "response": [] }, { - "name": "LTA_Retrieved_productType_platformShortName_platformSerialIdentifier_completed", + "name": "LTA_Download_productType_platformShortName_platformSerialIdentifier_ServiceAlias_failed", "event": [ { "listen": "test", @@ -28510,7 +28839,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Retrieved.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.completed'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Download.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.{{metric_ServiceAlias}}.failed'", "host": [ "{{service-root-uri}}" ], @@ -28522,7 +28851,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'Retrieved.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.completed'" + "value": "Name eq 'Download.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.{{metric_ServiceAlias}}.failed'" } ] } @@ -28530,7 +28859,7 @@ "response": [] }, { - "name": "LTA_Retrieved_productType_platformShortName_platformSerialIdentifier_failed", + "name": "LTA_Download_productType_platformShortName_platformSerialIdentifier_ServiceAlias_size", "event": [ { "listen": "test", @@ -28621,7 +28950,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Retrieved.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.failed'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Download.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.{{metric_ServiceAlias}}.size'", "host": [ "{{service-root-uri}}" ], @@ -28633,7 +28962,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'Retrieved.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.failed'" + "value": "Name eq 'Download.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.{{metric_ServiceAlias}}.size'" } ] } @@ -28641,7 +28970,7 @@ "response": [] }, { - "name": "LTA_Download_productType_platformShortName_platformSerialIdentifier_ServiceAlias_completed", + "name": "LTA_OriginToPublication_Daily_min_time_productType_platformShortName_platformSerialIdentifier", "event": [ { "listen": "test", @@ -28732,7 +29061,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Download.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.{{metric_ServiceAlias}}.completed'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'OriginToPublication.Daily.min.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'", "host": [ "{{service-root-uri}}" ], @@ -28744,7 +29073,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'Download.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.{{metric_ServiceAlias}}.completed'" + "value": "Name eq 'OriginToPublication.Daily.min.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'" } ] } @@ -28752,7 +29081,7 @@ "response": [] }, { - "name": "LTA_Download_productType_platformShortName_platformSerialIdentifier_ServiceAlias_failed", + "name": "LTA_OriginToPublication_Daily_max_time_productType_platformShortName_platformSerialIdentifier", "event": [ { "listen": "test", @@ -28843,7 +29172,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Download.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.{{metric_ServiceAlias}}.failed'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'OriginToPublication.Daily.max.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'", "host": [ "{{service-root-uri}}" ], @@ -28855,7 +29184,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'Download.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.{{metric_ServiceAlias}}.failed'" + "value": "Name eq 'OriginToPublication.Daily.max.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'" } ] } @@ -28863,7 +29192,7 @@ "response": [] }, { - "name": "LTA_Download_productType_platformShortName_platformSerialIdentifier_ServiceAlias_size", + "name": "LTA_OriginToPublication_Daily_avg_time_productType_platformShortName_platformSerialIdentifier", "event": [ { "listen": "test", @@ -28954,7 +29283,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Download.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.{{metric_ServiceAlias}}.size'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'OriginToPublication.Daily.avg.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'", "host": [ "{{service-root-uri}}" ], @@ -28966,7 +29295,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'Download.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}.{{metric_ServiceAlias}}.size'" + "value": "Name eq 'OriginToPublication.Daily.avg.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'" } ] } @@ -28974,7 +29303,7 @@ "response": [] }, { - "name": "LTA_OriginToPublication_Daily_min_time_productType_platformShortName_platformSerialIdentifier", + "name": "LTA_OriginToPublication_Monthly_min_time_productType_platformShortName_platformSerialIdentifier", "event": [ { "listen": "test", @@ -29065,7 +29394,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'OriginToPublication.Daily.min.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'OriginToPublication.Monthly.min.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'", "host": [ "{{service-root-uri}}" ], @@ -29077,7 +29406,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'OriginToPublication.Daily.min.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'" + "value": "Name eq 'OriginToPublication.Monthly.min.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'" } ] } @@ -29085,7 +29414,7 @@ "response": [] }, { - "name": "LTA_OriginToPublication_Daily_max_time_productType_platformShortName_platformSerialIdentifier", + "name": "LTA_OriginToPublication_Monthly_max_time_productType_platformShortName_platformSerialIdentifier", "event": [ { "listen": "test", @@ -29176,7 +29505,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'OriginToPublication.Daily.max.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'OriginToPublication.Monthly.max.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'", "host": [ "{{service-root-uri}}" ], @@ -29188,7 +29517,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'OriginToPublication.Daily.max.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'" + "value": "Name eq 'OriginToPublication.Monthly.max.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'" } ] } @@ -29196,7 +29525,7 @@ "response": [] }, { - "name": "LTA_OriginToPublication_Daily_avg_time_productType_platformShortName_platformSerialIdentifier", + "name": "LTA_OriginToPublication_Monthly_avg_time_productType_platformShortName_platformSerialIdentifier", "event": [ { "listen": "test", @@ -29287,7 +29616,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'OriginToPublication.Daily.avg.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'OriginToPublication.Monthly.avg.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'", "host": [ "{{service-root-uri}}" ], @@ -29299,7 +29628,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'OriginToPublication.Daily.avg.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'" + "value": "Name eq 'OriginToPublication.Monthly.avg.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'" } ] } @@ -29307,7 +29636,7 @@ "response": [] }, { - "name": "LTA_OriginToPublication_Monthly_min_time_productType_platformShortName_platformSerialIdentifier", + "name": "LTA_SubmissionToCompletion_Daily_min_time", "event": [ { "listen": "test", @@ -29398,7 +29727,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'OriginToPublication.Monthly.min.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'SubmissionToCompletion.Daily.min.time'", "host": [ "{{service-root-uri}}" ], @@ -29410,7 +29739,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'OriginToPublication.Monthly.min.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'" + "value": "Name eq 'SubmissionToCompletion.Daily.min.time'" } ] } @@ -29418,7 +29747,7 @@ "response": [] }, { - "name": "LTA_OriginToPublication_Monthly_max_time_productType_platformShortName_platformSerialIdentifier", + "name": "LTA_SubmissionToCompletion_Daily_max_time", "event": [ { "listen": "test", @@ -29509,7 +29838,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'OriginToPublication.Monthly.max.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'SubmissionToCompletion.Daily.max.time'", "host": [ "{{service-root-uri}}" ], @@ -29521,7 +29850,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'OriginToPublication.Monthly.max.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'" + "value": "Name eq 'SubmissionToCompletion.Daily.max.time'" } ] } @@ -29529,7 +29858,7 @@ "response": [] }, { - "name": "LTA_OriginToPublication_Monthly_avg_time_productType_platformShortName_platformSerialIdentifier", + "name": "LTA_SubmissionToCompletion_Daily_avg_time", "event": [ { "listen": "test", @@ -29620,7 +29949,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'OriginToPublication.Monthly.avg.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'SubmissionToCompletion.Daily.avg.time'", "host": [ "{{service-root-uri}}" ], @@ -29632,7 +29961,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'OriginToPublication.Monthly.avg.time.{{metric_productType}}.{{metric_platformShortName}}.{{metric_platformSerialIdentifier}}'" + "value": "Name eq 'SubmissionToCompletion.Daily.avg.time'" } ] } @@ -29640,7 +29969,7 @@ "response": [] }, { - "name": "LTA_SubmissionToCompletion_Daily_min_time", + "name": "LTA_SubmissionToCompletion_Monthly_min_time", "event": [ { "listen": "test", @@ -29731,7 +30060,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'SubmissionToCompletion.Daily.min.time'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'SubmissionToCompletion.Monthly.min.time'", "host": [ "{{service-root-uri}}" ], @@ -29743,7 +30072,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'SubmissionToCompletion.Daily.min.time'" + "value": "Name eq 'SubmissionToCompletion.Monthly.min.time'" } ] } @@ -29751,7 +30080,7 @@ "response": [] }, { - "name": "LTA_SubmissionToCompletion_Daily_max_time", + "name": "LTA_SubmissionToCompletion_Monthly_max_time", "event": [ { "listen": "test", @@ -29842,7 +30171,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'SubmissionToCompletion.Daily.max.time'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'SubmissionToCompletion.Monthly.max.time'", "host": [ "{{service-root-uri}}" ], @@ -29854,7 +30183,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'SubmissionToCompletion.Daily.max.time'" + "value": "Name eq 'SubmissionToCompletion.Monthly.max.time'" } ] } @@ -29862,7 +30191,7 @@ "response": [] }, { - "name": "LTA_SubmissionToCompletion_Daily_avg_time", + "name": "LTA_SubmissionToCompletion_Monthly_avg_time", "event": [ { "listen": "test", @@ -29953,7 +30282,7 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'SubmissionToCompletion.Daily.avg.time'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'SubmissionToCompletion.Monthly.avg.time'", "host": [ "{{service-root-uri}}" ], @@ -29965,7 +30294,7 @@ "query": [ { "key": "$filter", - "value": "Name eq 'SubmissionToCompletion.Daily.avg.time'" + "value": "Name eq 'SubmissionToCompletion.Monthly.avg.time'" } ] } @@ -29973,7 +30302,7 @@ "response": [] }, { - "name": "LTA_SubmissionToCompletion_Monthly_min_time", + "name": "LTA_Service_KPI_value", "event": [ { "listen": "test", @@ -30064,19 +30393,626 @@ "method": "GET", "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'SubmissionToCompletion.Monthly.min.time'", + "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Service.{{metric_KPI}}.value'", + "host": [ + "{{service-root-uri}}" + ], + "path": [ + "odata", + "v1", + "Metrics" + ], + "query": [ + { + "key": "$filter", + "value": "Name eq 'Service.{{metric_KPI}}.value'" + } + ] + } + }, + "response": [] + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "PRIP", + "item": [ + { + "name": "Filters", + "item": [ + { + "name": "Dynamic_filters", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const supportedOperators = [\"eq\", \"ne\", \"gt\", \"ge\", \"lt\", \"le\", \"and\", \"or\", \"not\", \"in\"];", + "const supportedFunctions = [\"startswith\", \"contains\", \"endswith\"];", + "", + "function compare(a, b){", + " if(isNaN(a)){", + " return String(a).localeCompare(String(b));", + " } else {", + " return a > b;", + " } ", + "}", + "", + "function getOperator(inputString, possibleOperators) {", + " var op = null;", + " console.log(\"getOperator inputString: \" + inputString);", + " possibleOperators.forEach(function (el) { ", + "", + " if(inputString.includes(\"Attributes/OData.CSC.StringAttribute/\")){", + " if(inputString.includes(\" \" + el + \" \")){", + " op = el;", + " }", + " } else if (inputString.indexOf(el) >= 0) { ", + " op = el; ", + " } ", + " });", + " return op;", + "}", + "", + "function opToJsFormat(op) {", + " res = null;", + " switch (op) {", + " case \"and\":", + " return \"&&\";", + " case \"or\":", + " return \"||\";", + " case \"not\":", + " return \"!\";", + " case \"eq\":", + " return \"==\";", + " case \"ne\":", + " return \"!=\";", + " case \"gt\":", + " return \">\";", + " case \"ge\":", + " return \">=\";", + " case \"lt\":", + " return \"<\";", + " case \"le\":", + " return \"<=\";", + " case \"in\":", + " return \"in\";", + " }", + "}", + "", + "function get_query_filters(input_query) {", + "", + " console.log(\"Parsing Filter...\");", + "", + " var matcher = /(contains\\((.+?)\\)|startswith\\((.+?)\\)|endswith\\((.+?)\\)|any\\(.*?\\)|ContentDate\\/Start.*Z|ContentDate\\/End.*Z|[\\w.]+?\\s(?:eq|ne|gt|ge|lt|le)\\s(?:\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)|[+-]?([0-9]*[.])?[0-9]+|\\w+|'.+?'))/g", + "", + " var filters = input_query.match(matcher);", + " var i = 0;", + " var simpleString = input_query.replace(matcher, function () {", + " return i++;", + " });", + "", + " console.log(simpleString);", + " console.log(\"Filters: \")", + " console.log(filters);", + "", + " var filterString = simpleString;", + "", + " var groupString;", + " var groupFilter = null;", + " var testNextLevel = true;", + "", + " while (testNextLevel) {", + " var closeParenthesisIndex = filterString.indexOf(')');", + " if (closeParenthesisIndex !== -1) {", + " var openParenthesisIndex = filterString.lastIndexOf('(', closeParenthesisIndex);", + "", + " // Extract the string between the first deepest set of parenthesis", + " groupString = filterString.substring(openParenthesisIndex + 1, closeParenthesisIndex);", + "", + " // Modify the filter string replacing the contents of the group string in addition to the parenthesis with the length of the filters array (which will be the index of the filter object that we push)", + " filterString = filterString.substring(0, openParenthesisIndex) + filters.length + filterString.substring(closeParenthesisIndex + 1);", + " } else {", + "", + " // There are no more parenthesis groups", + " groupString = filterString;", + " testNextLevel = false;", + " }", + "", + " // If the group uses both 'and' and 'or' then return null as an invalid filter string.", + " if (groupString.indexOf('and') >= 0 && groupString.indexOf('or') >= 0) {", + " console.log(\"Invalid Filter!\");", + " return null;", + " }", + "", + " // Get the group indexes out of the group string", + " var groupFilterIndexes = groupString.match(/[0-9]+/g);", + " var groupFilters = [];", + "", + " // Create an array with each of the filters who's index matches the group indexes", + " for (i = 0; i < groupFilterIndexes.length; i++) {", + " groupFilters.push(filters[Number(groupFilterIndexes[i])]);", + " }", + "", + " //cycling over the supported operators", + " console.log(\"groupString: \" + groupString);", + " var op = getOperator(groupString, supportedOperators);", + " console.log(\"Found Operator: \" + op);", + "", + " //redundant brakets management", + " if (op == null) {", + " groupFilters.push(\"true\");", + " op = \"and\";", + " }", + "", + " // Create the filter object and push it onto the filters array", + " groupFilter = { op: op, filters: groupFilters };", + " filters.push(groupFilter);", + " }", + "", + " return groupFilter;", + "", + "}", + "", + "function checkResponse(inputString, product) {", + " console.log(\"Input String: \" + inputString);", + " //console.log(\"Product:\");", + " //console.log(product);", + " var responseProperties = Object.keys(product);", + " var responseAttributes = {};", + "", + " //Attribute", + " if (inputString.includes(\"any(\") && inputString.includes(\"/Name\") && inputString.includes(\"/Value\")) {", + " //Attribute Logic Assertion", + " if (responseProperties.indexOf(\"Attributes\") >= 0) {", + " product['Attributes'].forEach(function (el) {", + " responseAttributes[el.Name] = el.Value;", + " });", + "", + " //functions in Attribute Value", + " var cleanedInputString = inputString.split(\"any(\").pop();", + " console.log(\"CLEANED ATTRIBUTE INPUTSTRING: \" + cleanedInputString);", + "", + " if (cleanedInputString.includes(\" in (\")){", + " console.log(\"IN OPERATOR CASE...\");", + " //simple any(Attributes Name and Value)", + " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();", + " console.log(\"Extracted Attribute KEY: \" + attrToCheck);", + " var attrValueToCheck = inputString.split('Value in ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\(/g, \"\").replace(/\\\\/g, \"\").split(\",\");", + " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck.toString());", + "", + " attributesUnderTest.push(\"attr:\" + attrToCheck + \" in \" + attrValueToCheck);", + "", + " var in_computing = false;", + " for(let i = 0; i < attrValueToCheck.length; i++) {", + " console.log(\"checking: \" + attrValueToCheck[i]);", + " if (responseAttributes[attrToCheck] == attrValueToCheck[i]){", + " return true;", + " }", + " }", + " return in_computing;", + " }", + " else if (cleanedInputString.includes(\"(\") && cleanedInputString.includes(\")\")) {", + " //get the function name", + " var functionName = cleanedInputString.split(\"(\")[0].split(\" \").pop();", + " if (supportedFunctions.indexOf(functionName) >= 0) {", + " console.log(\"Found Attribute Function: \" + functionName);", + " //get the attribute", + " var attrToCheck = cleanedInputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();", + " console.log(\"Attribute KEY Found: \" + attrToCheck);", + " //get the cleaned value", + " var attrValueToCheck = cleanedInputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");", + " console.log(\"Attribute VALUE Found: \" + attrValueToCheck);", + "", + " switch (functionName) {", + " case \"contains\":", + " attributesUnderTest.push(attrToCheck + \" contains \" + attrValueToCheck);", + " return (responseAttributes[attrToCheck].includes(attrValueToCheck)) ? true : false;", + " case \"startswith\":", + " attributesUnderTest.push(attrToCheck + \" startswith \" + attrValueToCheck);", + " return responseAttributes[attrToCheck].startsWith(attrValueToCheck) ? true : false;", + " case \"endswith\":", + " attributesUnderTest.push(attrToCheck + \" endswith \" + attrValueToCheck);", + " return responseAttributes[attrToCheck].endsWith(attrValueToCheck) ? true : false;", + " }", + " }", + " } else {", + " //simple any(Attributes Name and Value)", + " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();", + " console.log(\"Extracted Attribute KEY: \" + attrToCheck);", + " var attrValueToCheck = inputString.split('Value eq ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\\\/g, \"\");", + " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck);", + "", + " attributesUnderTest.push(\"attr:\" + attrToCheck + \" eq \" + attrValueToCheck);", + "", + " return responseAttributes[attrToCheck] == attrValueToCheck;", + " }", + " }", + " } else {", + " //inputString contains a function on a Property -> complex property not supported!", + " if (inputString.includes(\"(\") && inputString.includes(\")\")) {", + " //get the function name", + " var functionName = inputString.split(\"(\")[0];", + " if (supportedFunctions.indexOf(functionName) >= 0) {", + " console.log(\"Found Function: \" + functionName);", + " //get the property", + " var propertyToCheck = inputString.split(\"(\")[1].split(\",\")[0].trim();", + " console.log(\"Property Found: \" + propertyToCheck);", + "", + " //get the cleaned value", + " var propValueToCheck = inputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");", + " console.log(\"PropertyValue Found: \" + propValueToCheck);", + "", + " switch (functionName) {", + " case \"contains\":", + " propertiesUnderTest.push(propertyToCheck + \" contains \" + propValueToCheck);", + " return (product[propertyToCheck].includes(propValueToCheck)) ? true : false;", + " case \"startswith\":", + " propertiesUnderTest.push(propertyToCheck + \" startswith \" + propValueToCheck);", + " return product[propertyToCheck].startsWith(propValueToCheck) ? true : false;", + " case \"endswith\":", + " propertiesUnderTest.push(propertyToCheck + \" endswith \" + propValueToCheck);", + " return product[propertyToCheck].endsWith(propValueToCheck) ? true : false;", + " }", + " } else {", + " console.log(\"Unsupported Function: \" + functionName);", + " return false;", + " }", + " } else {", + " // single logic assertion in \"AND\" with \"true\"", + " if (inputString === \"true\") {", + " console.log(\"True Value!\");", + " return true;", + " } else {", + " //direct Property", + " var propertyToCheck = inputString.split(\" \")[0].trim();", + " var operatorToApply = inputString.split(\" \")[1];", + " var propValueToCheck = inputString.split(\" \")[2].trim().replace(/'/g, \"\");", + "", + " console.log(\"Property Found: \" + propertyToCheck);", + " console.log(\"PropertyValue Found: \" + propValueToCheck);", + "", + " if (supportedOperators.indexOf(operatorToApply) >= 0) {", + " console.log(\"Operator To Apply: \" + operatorToApply);", + " operator = opToJsFormat(operatorToApply);", + " propertiesUnderTest.push(propertyToCheck + \" \" + operatorToApply + \" \" + propValueToCheck);", + "", + " var toEvalString = \"\";", + " var subProperty = \"\";", + "", + " //Complex properties (ContentDate)", + " if(propertyToCheck.includes(\"/\")){", + " var rootPropertyToCheck = propertyToCheck.split(\"/\")[0];", + " subProperty = propertyToCheck.split(\"/\")[1];", + "", + " console.log(\"Complex Property: \" + rootPropertyToCheck);", + " console.log(\"Sub Property: \" + subProperty);", + "", + " toEvalString = \"product[rootPropertyToCheck][subProperty] \" + operator + \" propValueToCheck\";", + "", + " } else {", + " toEvalString = \"product[propertyToCheck] \" + operator + \" propValueToCheck\";", + " }", + "", + " return eval(toEvalString);", + " } else {", + " console.log(\"Operator not supported\");", + " return false;", + " }", + " }", + " }", + " }", + " console.log(\"Logic Assertion not computed: \" + inputString);", + " return Math.random() >= 0.5;", + "}", + "", + "function treeIterator(tree, product) {", + " if (tree['filters'].length >= 0) {", + " var conditions = [];", + "", + " var logicOperator = getOperator(tree['op'], supportedOperators);", + "", + " console.log(\"logicoOperator from supported: \" + logicOperator);", + "", + " var logicOperator = opToJsFormat(logicOperator);", + "", + " console.log(\"logicoOperator to JS format: \" + logicOperator);", + "", + " //general tree: iterates over all filters (child nodes)", + " for (elem in tree['filters']) {", + " var currentCondition = typeof ((tree['filters'][elem])) == \"object\" ? treeIterator(tree['filters'][elem], product) : checkResponse(tree['filters'][elem], product);", + " conditions.push(currentCondition);", + " //optimize AND and OR", + " if(logicOperator == \"||\" && currentCondition){", + " break;", + " }", + " if(logicOperator == \"&&\" && !currentCondition){", + " break;", + " }", + " }", + " console.log(\"CURRENT CONDITIONS\");", + " console.log(conditions);", + "", + " //building return string", + " var resString = \"(\";", + " for (elem in conditions) {", + " resString += conditions[elem] + \" \" + logicOperator.toString() + \" \";", + " }", + " resString = resString.substring(0, resString.length - 4);", + " resString += \")\";", + "", + " console.log(\"RES String: \" + resString);", + "", + " return resString;", + " }", + "}", + "", + "try {", + " var jsonDataElements = pm.response.json().value;", + "", + " console.log(\"Response: \");", + " console.log(jsonDataElements);", + "", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));", + " });", + "", + " //MIN number of Records Test", + " var minimumExpRecords = parseInt(pm.collectionVariables.get('resp_min_records'));", + " pm.test(\"Expected minimum number of products Test: \" + minimumExpRecords, function(){", + " pm.expect(jsonDataElements.length).to.be.gte(minimumExpRecords);", + " });", + "", + " //TOP and ORDERBY", + " var topFilterString = pm.request.url.getQueryString();", + " var topFilterValue = 0;", + "", + " if(topFilterString.includes(\"$top=\")){", + " topFilterValue = parseInt(topFilterString.split(\"$top=\").pop());", + " console.log(jsonDataElements.length);", + "", + " pm.test(\"TOP Filter - Response list lenght \" + jsonDataElements.length + \" is less or equal to TOP param Value: \" + topFilterValue, function(){", + " pm.expect(jsonDataElements.length).to.be.lte(topFilterValue);", + " });", + " }", + " ", + " var orderString = pm.request.url.getQueryString();", + " var orderParameters;", + "", + " if(orderString.includes(\"$orderby=\")){", + " orderParameters = decodeURIComponent(orderString.split(\"$orderby=\").pop().split(\"&\")[0]);", + "", + " var orderProperty = orderParameters;", + " var orderCriteria = \"asc\";", + "", + " if(orderParameters.includes(\" \")){", + " orderProperty = orderParameters.split(\" \")[0];", + " orderCriteria = orderParameters.split(\" \")[1];", + " }", + "", + " console.log(\"order Property: \" + orderProperty);", + " console.log(\"order Criteria: \" + orderCriteria);", + "", + " //if with complex Property management", + " if(orderProperty.includes(\"/\")){", + " var complexProperty = orderProperty.split(\"/\")[0];", + " var subProperty = orderProperty.split(\"/\").pop();", + "", + " console.log(complexProperty);", + " console.log(subProperty);", + "", + " var simplerSortingList = jsonDataElements.map(ex=>ex[complexProperty][subProperty]);", + " var serverSorting = jsonDataElements.map(ex=>ex[complexProperty][subProperty]);", + " } else {", + " var simplerSortingList = jsonDataElements.map(ex=>ex[orderProperty]);", + " var serverSorting = jsonDataElements.map(ex=>ex[orderProperty]);", + " }", + "", + " console.log(\"Unsorted list: \");", + " console.log(simplerSortingList);", + " ", + " simplerSortingList.sort(function(a, b){return compare(a, b)});", + "", + "", + " if(orderCriteria == \"desc\"){", + " simplerSortingList.reverse(); ", + " }", + "", + " console.log(\"Sorted list: \");", + " console.log(simplerSortingList);", + " ", + " pm.test(\"ORDERBY Filter Test - Sort check\", function(){", + " pm.expect(simplerSortingList).to.deep.equal(serverSorting);", + " });", + " }", + "", + " //FILTERS", + "", + " var parsed_filters;", + "", + " //POST or GET query", + " if (pm.request.method == \"POST\" && pm.request.body.raw) {", + " var productsFilters = JSON.parse(pm.request.body.raw);", + "", + " var jsonBodyToLogicAssertions = \"\";", + "", + " for (elem in productsFilters['products']) {", + " console.log(productsFilters['products'][elem]);", + " var currentAssertion = \"\";", + "", + " var keys = [];", + " for (var k in productsFilters['products'][elem]) keys.push(k);", + " //console.log(keys);", + " var currentKey = keys[0];", + " console.log(\"Current Key: \" + currentKey);", + "", + " var currentValue = productsFilters['products'][elem][currentKey].toString();", + " console.log(\"Current Value: \" + currentValue);", + "", + " currentAssertion = \"\" + currentKey + \" eq '\" + currentValue + \"'\";", + " jsonBodyToLogicAssertions += currentAssertion + \" or \";", + " }", + "", + " //cutting last \" or \"", + " jsonBodyToLogicAssertions = jsonBodyToLogicAssertions.substring(0, jsonBodyToLogicAssertions.length - 4);", + " console.log(\"PARSED POST: \" + jsonBodyToLogicAssertions);", + "", + " parsed_filters = get_query_filters(jsonBodyToLogicAssertions);", + "", + " } else if (pm.request.method == \"GET\" && pm.request.url.getQueryString().includes(\"$filter=\")) {", + " var filter_query = pm.request.url.getQueryString().split(\"$filter=\")[1];", + " filter_query = decodeURIComponent(filter_query.split(\"&\")[0]);", + " console.log(filter_query);", + " parsed_filters = get_query_filters(filter_query);", + "", + " }", + "", + " console.log(parsed_filters);", + "", + " var attributesUnderTest = [];", + " var propertiesUnderTest = [];", + "", + " if (typeof (parsed_filters) == \"object\") {", + " for (var counter = 0; counter < jsonDataElements.length; counter++) {", + "", + " attributesUnderTest = [];", + " propertiesUnderTest = [];", + "", + " var product = jsonDataElements[counter];", + " var treeExp = treeIterator(parsed_filters, product);", + " var booleanTreeExp = eval(treeExp);", + "", + " console.log(treeExp); console.log(booleanTreeExp);", + "", + " testMessage = product.Name;", + "", + " /*", + " if(attributesUnderTest.length > 0){", + " testMessage += \" \";", + " for(elem in attributesUnderTest){", + " testMessage += attributesUnderTest[elem] + \"; \";", + " }", + " }", + " if(propertiesUnderTest.length > 0){", + " testMessage += \" \";", + " for(elem in propertiesUnderTest){", + " testMessage += propertiesUnderTest[elem] + \"; \";", + " }", + " }", + " */", + "", + " pm.test(testMessage, function () {", + " pm.expect(booleanTreeExp).to.be.true;", + " });", + " }", + " }", + "}", + "", + "catch (err) {", + " pm.test(\"Filters Test\", function () {", + " pm.expect.fail(err.toString());", + " });", + "}" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{password}}", + "type": "string" + }, + { + "key": "username", + "value": "{{username}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{service-root-uri}}/odata/v1/Products?$top=10&$expand=Attributes&$filter=Attributes/OData.CSC.StringAttribute/any(att:att/Name eq 'productType' and att/OData.CSC.StringAttribute/Value in ('TEST_PROD_TYPE','AUX_ICE','AUX_WND'))", "host": [ "{{service-root-uri}}" ], "path": [ "odata", "v1", - "Metrics" + "Products" ], "query": [ + { + "key": "$top", + "value": "10" + }, + { + "key": "$expand", + "value": "Attributes" + }, { "key": "$filter", - "value": "Name eq 'SubmissionToCompletion.Monthly.min.time'" + "value": "PublicationDate eq 2020-06-08T16:14:02.036Z", + "description": "Simple Property PublicationDate", + "disabled": true + }, + { + "key": "$filter", + "value": "ContentDate/Start eq 2019-08-26T06:36:56.989Z", + "description": "Complex Property ContentDate", + "disabled": true + }, + { + "key": "$filter", + "value": "ContentLength eq 5979870 and OriginDate eq 2020-06-22T15:33:15.998Z", + "description": "Properties Combination ContentLength OriginDate", + "disabled": true + }, + { + "key": "$orderby", + "value": "ContentDate/Start desc", + "description": "TOP and ORDERBY", + "disabled": true + }, + { + "key": "$filter", + "value": "Attributes/OData.CSC.DateTimeOffsetAttribute/any(att:att/Name eq 'processingDate' and att/OData.CSC.DateTimeOffsetAttribute/Value eq '2020-09-17T13:43:25.252809Z')", + "description": "Query by Attributes", + "disabled": true + }, + { + "key": "$filter", + "value": "Attributes/OData.CSC.StringAttribute/any(att:att/Name eq 'productType' and att/OData.CSC.StringAttribute/Value in ('TEST_PROD_TYPE','AUX_ICE','AUX_WND'))" + }, + { + "key": "$filter", + "value": "Name eq 'S3A_SR___MDO_AX_20200104T215523_20200106T002323_20200106T084646___________________CNE_O_ST_001.SEN3.zip'", + "disabled": true + }, + { + "key": "$filter", + "value": "contains(Name,'SL_2_LSTVAX') and Attributes/OData.CSC.StringAttribute/any(att:att/Name eq 'productType' and startswith(att/OData.CSC.StringAttribute/Value,'TEST_PROD_TYPE'))", + "disabled": true } ] } @@ -30084,76 +31020,510 @@ "response": [] }, { - "name": "LTA_SubmissionToCompletion_Monthly_max_time", + "name": "POST FilterList", "event": [ { "listen": "test", "script": { "exec": [ - "try {\r", - " var jsonDataElements = pm.response.json().value;\r", - "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", - " });\r", - "\r", - " pm.test(\"Test OData context\", function(){\r", - " query_string = pm.request.url.getQueryString();\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Metrics\");\r", - " });\r", - "\r", - " var metricName = decodeURIComponent(pm.request.url.getQueryString()).split(\"$filter=Name eq \")[1].replace(\"'\",\"\").split(\".\")[0];\r", - " console.log(metricName);\r", - "\r", - " for(var elem of jsonDataElements){\r", - " pm.test(\"Test Metrics properties\", function(){\r", - "\r", - " if(elem[\"Name\"]) pm.expect(elem[\"Name\"].split(\".\")[0]).to.be.equal(metricName);\r", - " else pm.expect.fail(\"Name not found in element properties\");\r", - " \r", - " if(elem[\"Timestamp\"]) pm.expect(elem[\"Timestamp\"]).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d\\d\\d(\\d*)Z/);\r", - " else pm.expect.fail(\"Timestamp not found in element properties\");\r", - " \r", - " switch(metricName){\r", - " case \"systematic_production\":\r", - " case \"on-demand default\":\r", - " case \"on-demand non-default\":\r", - " case \"Archived\":\r", - " case \"Retrieved\":\r", - " case \"Download\":\r", - " console.log(\"Expected Counter\");\r", - " if(elem[\"MetricType\"]) pm.expect(elem[\"MetricType\"]).to.be.equal(\"Counter\");\r", - " else pm.expect.fail(\"MetricType not found in element properties\");\r", - " if(elem[\"Counter\"]) pm.expect(elem[\"Counter\"]).to.be.a(\"number\");\r", - " else pm.expect.fail(\"Counter not found in element properties\");\r", - " //pm.expect(elem[\"Gauge\"]).to.be.equal(null);\r", - " break;\r", - " case \"SensingToPublication\":\r", - " case \"OriginToPublication\":\r", - " case \"SubmissionToCompletion\":\r", - " case \"Service\":\r", - " console.log(\"Expected Gauge\");\r", - " if(elem[\"MetricType\"]) pm.expect(elem[\"MetricType\"]).to.be.equal(\"Gauge\");\r", - " else pm.expect.fail(\"MetricType not found in element properties\");\r", - " if(elem[\"Gauge\"]){\r", - " pm.expect(elem[\"Gauge\"]).to.be.a(\"string\");\r", - " pm.expect(parseInt(elem[\"Gauge\"])).to.be.a(\"number\");\r", - " } else pm.expect.fail(\"Gauge not found in element properties\");\r", - " //pm.expect(elem[\"Counter\"]).to.be.equal(null);\r", - " break;\r", - " }\r", - " });\r", - " }\r", - "}\r", - "\r", - "catch (err) {\r", - " pm.test(request.name, function () {\r", - " pm.expect.fail(err.toString());\r", - " });\r", + "const supportedOperators = [\"eq\", \"ne\", \"gt\", \"ge\", \"lt\", \"le\", \"and\", \"or\", \"not\", \"in\"];", + "const supportedFunctions = [\"startswith\", \"contains\", \"endswith\"];", + "", + "function compare(a, b){", + " if(isNaN(a)){", + " return String(a).localeCompare(String(b));", + " } else {", + " return a > b;", + " } ", + "}", + "", + "function getOperator(inputString, possibleOperators) {", + " var op = null;", + " console.log(\"getOperator inputString: \" + inputString);", + " possibleOperators.forEach(function (el) { ", + "", + " if(inputString.includes(\"Attributes/OData.CSC.StringAttribute/\")){", + " if(inputString.includes(\" \" + el + \" \")){", + " op = el;", + " }", + " } else if (inputString.indexOf(el) >= 0) { ", + " op = el; ", + " } ", + " });", + " return op;", + "}", + "", + "function opToJsFormat(op) {", + " res = null;", + " switch (op) {", + " case \"and\":", + " return \"&&\";", + " case \"or\":", + " return \"||\";", + " case \"not\":", + " return \"!\";", + " case \"eq\":", + " return \"==\";", + " case \"ne\":", + " return \"!=\";", + " case \"gt\":", + " return \">\";", + " case \"ge\":", + " return \">=\";", + " case \"lt\":", + " return \"<\";", + " case \"le\":", + " return \"<=\";", + " case \"in\":", + " return \"in\";", + " }", + "}", + "", + "function get_query_filters(input_query) {", + "", + " console.log(\"Parsing Filter...\");", + "", + " var matcher = /(contains\\((.+?)\\)|startswith\\((.+?)\\)|endswith\\((.+?)\\)|any\\(.*?\\)|ContentDate\\/Start.*Z|ContentDate\\/End.*Z|[\\w.]+?\\s(?:eq|ne|gt|ge|lt|le)\\s(?:\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)|[+-]?([0-9]*[.])?[0-9]+|\\w+|'.+?'))/g", + "", + " var filters = input_query.match(matcher);", + " var i = 0;", + " var simpleString = input_query.replace(matcher, function () {", + " return i++;", + " });", + "", + " console.log(simpleString);", + " console.log(\"Filters: \")", + " console.log(filters);", + "", + " var filterString = simpleString;", + "", + " var groupString;", + " var groupFilter = null;", + " var testNextLevel = true;", + "", + " while (testNextLevel) {", + " var closeParenthesisIndex = filterString.indexOf(')');", + " if (closeParenthesisIndex !== -1) {", + " var openParenthesisIndex = filterString.lastIndexOf('(', closeParenthesisIndex);", + "", + " // Extract the string between the first deepest set of parenthesis", + " groupString = filterString.substring(openParenthesisIndex + 1, closeParenthesisIndex);", + "", + " // Modify the filter string replacing the contents of the group string in addition to the parenthesis with the length of the filters array (which will be the index of the filter object that we push)", + " filterString = filterString.substring(0, openParenthesisIndex) + filters.length + filterString.substring(closeParenthesisIndex + 1);", + " } else {", + "", + " // There are no more parenthesis groups", + " groupString = filterString;", + " testNextLevel = false;", + " }", + "", + " // If the group uses both 'and' and 'or' then return null as an invalid filter string.", + " if (groupString.indexOf('and') >= 0 && groupString.indexOf('or') >= 0) {", + " console.log(\"Invalid Filter!\");", + " return null;", + " }", + "", + " // Get the group indexes out of the group string", + " var groupFilterIndexes = groupString.match(/[0-9]+/g);", + " var groupFilters = [];", + "", + " // Create an array with each of the filters who's index matches the group indexes", + " for (i = 0; i < groupFilterIndexes.length; i++) {", + " groupFilters.push(filters[Number(groupFilterIndexes[i])]);", + " }", + "", + " //cycling over the supported operators", + " console.log(\"groupString: \" + groupString);", + " var op = getOperator(groupString, supportedOperators);", + " console.log(\"Found Operator: \" + op);", + "", + " //redundant brakets management", + " if (op == null) {", + " groupFilters.push(\"true\");", + " op = \"and\";", + " }", + "", + " // Create the filter object and push it onto the filters array", + " groupFilter = { op: op, filters: groupFilters };", + " filters.push(groupFilter);", + " }", + "", + " return groupFilter;", + "", + "}", + "", + "function checkResponse(inputString, product) {", + " console.log(\"Input String: \" + inputString);", + " //console.log(\"Product:\");", + " //console.log(product);", + " var responseProperties = Object.keys(product);", + " var responseAttributes = {};", + "", + " //Attribute", + " if (inputString.includes(\"any(\") && inputString.includes(\"/Name\") && inputString.includes(\"/Value\")) {", + " //Attribute Logic Assertion", + " if (responseProperties.indexOf(\"Attributes\") >= 0) {", + " product['Attributes'].forEach(function (el) {", + " responseAttributes[el.Name] = el.Value;", + " });", + "", + " //functions in Attribute Value", + " var cleanedInputString = inputString.split(\"any(\").pop();", + " console.log(\"CLEANED ATTRIBUTE INPUTSTRING: \" + cleanedInputString);", + "", + " if (cleanedInputString.includes(\" in (\")){", + " console.log(\"IN OPERATOR CASE...\");", + " //simple any(Attributes Name and Value)", + " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();", + " console.log(\"Extracted Attribute KEY: \" + attrToCheck);", + " var attrValueToCheck = inputString.split('Value in ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\(/g, \"\").replace(/\\\\/g, \"\").split(\",\");", + " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck.toString());", + "", + " attributesUnderTest.push(\"attr:\" + attrToCheck + \" in \" + attrValueToCheck);", + "", + " var in_computing = false;", + " for(let i = 0; i < attrValueToCheck.length; i++) {", + " console.log(\"checking: \" + attrValueToCheck[i]);", + " if (responseAttributes[attrToCheck] == attrValueToCheck[i]){", + " return true;", + " }", + " }", + " return in_computing;", + " }", + " else if (cleanedInputString.includes(\"(\") && cleanedInputString.includes(\")\")) {", + " //get the function name", + " var functionName = cleanedInputString.split(\"(\")[0].split(\" \").pop();", + " if (supportedFunctions.indexOf(functionName) >= 0) {", + " console.log(\"Found Attribute Function: \" + functionName);", + " //get the attribute", + " var attrToCheck = cleanedInputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();", + " console.log(\"Attribute KEY Found: \" + attrToCheck);", + " //get the cleaned value", + " var attrValueToCheck = cleanedInputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");", + " console.log(\"Attribute VALUE Found: \" + attrValueToCheck);", + "", + " switch (functionName) {", + " case \"contains\":", + " attributesUnderTest.push(attrToCheck + \" contains \" + attrValueToCheck);", + " return (responseAttributes[attrToCheck].includes(attrValueToCheck)) ? true : false;", + " case \"startswith\":", + " attributesUnderTest.push(attrToCheck + \" startswith \" + attrValueToCheck);", + " return responseAttributes[attrToCheck].startsWith(attrValueToCheck) ? true : false;", + " case \"endswith\":", + " attributesUnderTest.push(attrToCheck + \" endswith \" + attrValueToCheck);", + " return responseAttributes[attrToCheck].endsWith(attrValueToCheck) ? true : false;", + " }", + " }", + " } else {", + " //simple any(Attributes Name and Value)", + " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();", + " console.log(\"Extracted Attribute KEY: \" + attrToCheck);", + " var attrValueToCheck = inputString.split('Value eq ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\\\/g, \"\");", + " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck);", + "", + " attributesUnderTest.push(\"attr:\" + attrToCheck + \" eq \" + attrValueToCheck);", + "", + " return responseAttributes[attrToCheck] == attrValueToCheck;", + " }", + " }", + " } else {", + " //inputString contains a function on a Property -> complex property not supported!", + " if (inputString.includes(\"(\") && inputString.includes(\")\")) {", + " //get the function name", + " var functionName = inputString.split(\"(\")[0];", + " if (supportedFunctions.indexOf(functionName) >= 0) {", + " console.log(\"Found Function: \" + functionName);", + " //get the property", + " var propertyToCheck = inputString.split(\"(\")[1].split(\",\")[0].trim();", + " console.log(\"Property Found: \" + propertyToCheck);", + "", + " //get the cleaned value", + " var propValueToCheck = inputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");", + " console.log(\"PropertyValue Found: \" + propValueToCheck);", + "", + " switch (functionName) {", + " case \"contains\":", + " propertiesUnderTest.push(propertyToCheck + \" contains \" + propValueToCheck);", + " return (product[propertyToCheck].includes(propValueToCheck)) ? true : false;", + " case \"startswith\":", + " propertiesUnderTest.push(propertyToCheck + \" startswith \" + propValueToCheck);", + " return product[propertyToCheck].startsWith(propValueToCheck) ? true : false;", + " case \"endswith\":", + " propertiesUnderTest.push(propertyToCheck + \" endswith \" + propValueToCheck);", + " return product[propertyToCheck].endsWith(propValueToCheck) ? true : false;", + " }", + " } else {", + " console.log(\"Unsupported Function: \" + functionName);", + " return false;", + " }", + " } else {", + " // single logic assertion in \"AND\" with \"true\"", + " if (inputString === \"true\") {", + " console.log(\"True Value!\");", + " return true;", + " } else {", + " //direct Property", + " var propertyToCheck = inputString.split(\" \")[0].trim();", + " var operatorToApply = inputString.split(\" \")[1];", + " var propValueToCheck = inputString.split(\" \")[2].trim().replace(/'/g, \"\");", + "", + " console.log(\"Property Found: \" + propertyToCheck);", + " console.log(\"PropertyValue Found: \" + propValueToCheck);", + "", + " if (supportedOperators.indexOf(operatorToApply) >= 0) {", + " console.log(\"Operator To Apply: \" + operatorToApply);", + " operator = opToJsFormat(operatorToApply);", + " propertiesUnderTest.push(propertyToCheck + \" \" + operatorToApply + \" \" + propValueToCheck);", + "", + " var toEvalString = \"\";", + " var subProperty = \"\";", + "", + " //Complex properties (ContentDate)", + " if(propertyToCheck.includes(\"/\")){", + " var rootPropertyToCheck = propertyToCheck.split(\"/\")[0];", + " subProperty = propertyToCheck.split(\"/\")[1];", + "", + " console.log(\"Complex Property: \" + rootPropertyToCheck);", + " console.log(\"Sub Property: \" + subProperty);", + "", + " toEvalString = \"product[rootPropertyToCheck][subProperty] \" + operator + \" propValueToCheck\";", + "", + " } else {", + " toEvalString = \"product[propertyToCheck] \" + operator + \" propValueToCheck\";", + " }", + "", + " return eval(toEvalString);", + " } else {", + " console.log(\"Operator not supported\");", + " return false;", + " }", + " }", + " }", + " }", + " console.log(\"Logic Assertion not computed: \" + inputString);", + " return Math.random() >= 0.5;", + "}", + "", + "function treeIterator(tree, product) {", + " if (tree['filters'].length >= 0) {", + " var conditions = [];", + "", + " var logicOperator = getOperator(tree['op'], supportedOperators);", + "", + " console.log(\"logicoOperator from supported: \" + logicOperator);", + "", + " var logicOperator = opToJsFormat(logicOperator);", + "", + " console.log(\"logicoOperator to JS format: \" + logicOperator);", + "", + " //general tree: iterates over all filters (child nodes)", + " for (elem in tree['filters']) {", + " var currentCondition = typeof ((tree['filters'][elem])) == \"object\" ? treeIterator(tree['filters'][elem], product) : checkResponse(tree['filters'][elem], product);", + " conditions.push(currentCondition);", + " //optimize AND and OR", + " if(logicOperator == \"||\" && currentCondition){", + " break;", + " }", + " if(logicOperator == \"&&\" && !currentCondition){", + " break;", + " }", + " }", + " console.log(\"CURRENT CONDITIONS\");", + " console.log(conditions);", + "", + " //building return string", + " var resString = \"(\";", + " for (elem in conditions) {", + " resString += conditions[elem] + \" \" + logicOperator.toString() + \" \";", + " }", + " resString = resString.substring(0, resString.length - 4);", + " resString += \")\";", + "", + " console.log(\"RES String: \" + resString);", + "", + " return resString;", + " }", + "}", + "", + "try {", + " var jsonDataElements = pm.response.json().value;", + "", + " console.log(\"Response: \");", + " console.log(jsonDataElements);", + "", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));", + " });", + "", + " //MIN number of Records Test", + " var minimumExpRecords = parseInt(pm.collectionVariables.get('resp_min_records'));", + " pm.test(\"Expected minimum number of products Test: \" + minimumExpRecords, function(){", + " pm.expect(jsonDataElements.length).to.be.gte(minimumExpRecords);", + " });", + "", + " //TOP and ORDERBY", + " var topFilterString = pm.request.url.getQueryString();", + " var topFilterValue = 0;", + "", + " if(topFilterString.includes(\"$top=\")){", + " topFilterValue = parseInt(topFilterString.split(\"$top=\").pop());", + " console.log(jsonDataElements.length);", + "", + " pm.test(\"TOP Filter - Response list lenght \" + jsonDataElements.length + \" is less or equal to TOP param Value: \" + topFilterValue, function(){", + " pm.expect(jsonDataElements.length).to.be.lte(topFilterValue);", + " });", + " }", + " ", + " var orderString = pm.request.url.getQueryString();", + " var orderParameters;", + "", + " if(orderString.includes(\"$orderby=\")){", + " orderParameters = decodeURIComponent(orderString.split(\"$orderby=\").pop().split(\"&\")[0]);", + "", + " var orderProperty = orderParameters;", + " var orderCriteria = \"asc\";", + "", + " if(orderParameters.includes(\" \")){", + " orderProperty = orderParameters.split(\" \")[0];", + " orderCriteria = orderParameters.split(\" \")[1];", + " }", + "", + " console.log(\"order Property: \" + orderProperty);", + " console.log(\"order Criteria: \" + orderCriteria);", + "", + " //if with complex Property management", + " if(orderProperty.includes(\"/\")){", + " var complexProperty = orderProperty.split(\"/\")[0];", + " var subProperty = orderProperty.split(\"/\").pop();", + "", + " console.log(complexProperty);", + " console.log(subProperty);", + "", + " var simplerSortingList = jsonDataElements.map(ex=>ex[complexProperty][subProperty]);", + " var serverSorting = jsonDataElements.map(ex=>ex[complexProperty][subProperty]);", + " } else {", + " var simplerSortingList = jsonDataElements.map(ex=>ex[orderProperty]);", + " var serverSorting = jsonDataElements.map(ex=>ex[orderProperty]);", + " }", + "", + " console.log(\"Unsorted list: \");", + " console.log(simplerSortingList);", + " ", + " simplerSortingList.sort(function(a, b){return compare(a, b)});", + "", + "", + " if(orderCriteria == \"desc\"){", + " simplerSortingList.reverse(); ", + " }", + "", + " console.log(\"Sorted list: \");", + " console.log(simplerSortingList);", + " ", + " pm.test(\"ORDERBY Filter Test - Sort check\", function(){", + " pm.expect(simplerSortingList).to.deep.equal(serverSorting);", + " });", + " }", + "", + " //FILTERS", + "", + " var parsed_filters;", + "", + " //POST or GET query", + " if (pm.request.method == \"POST\" && pm.request.body.raw) {", + " var productsFilters = JSON.parse(pm.request.body.raw);", + "", + " var jsonBodyToLogicAssertions = \"\";", + "", + " for (elem in productsFilters['FilterProducts']) {", + " console.log(productsFilters['FilterProducts'][elem]);", + " var currentAssertion = \"\";", + "", + " var keys = [];", + " for (var k in productsFilters['FilterProducts'][elem]) keys.push(k);", + " //console.log(keys);", + " var currentKey = keys[0];", + " console.log(\"Current Key: \" + currentKey);", + "", + " var currentValue = productsFilters['FilterProducts'][elem][currentKey].toString();", + " console.log(\"Current Value: \" + currentValue);", + "", + " currentAssertion = \"\" + currentKey + \" eq '\" + currentValue + \"'\";", + " jsonBodyToLogicAssertions += currentAssertion + \" or \";", + " }", + "", + " //cutting last \" or \"", + " jsonBodyToLogicAssertions = jsonBodyToLogicAssertions.substring(0, jsonBodyToLogicAssertions.length - 4);", + " console.log(\"PARSED POST: \" + jsonBodyToLogicAssertions);", + "", + " parsed_filters = get_query_filters(jsonBodyToLogicAssertions);", + "", + " } else if (pm.request.method == \"GET\" && pm.request.url.getQueryString().includes(\"$filter=\")) {", + " var filter_query = pm.request.url.getQueryString().split(\"$filter=\")[1];", + " filter_query = decodeURIComponent(filter_query.split(\"&\")[0]);", + " console.log(filter_query);", + " parsed_filters = get_query_filters(filter_query);", + "", + " }", + "", + " console.log(parsed_filters);", + "", + " var attributesUnderTest = [];", + " var propertiesUnderTest = [];", + "", + " if (typeof (parsed_filters) == \"object\") {", + " for (var counter = 0; counter < jsonDataElements.length; counter++) {", + "", + " attributesUnderTest = [];", + " propertiesUnderTest = [];", + "", + " var product = jsonDataElements[counter];", + " var treeExp = treeIterator(parsed_filters, product);", + " var booleanTreeExp = eval(treeExp);", + "", + " console.log(treeExp); console.log(booleanTreeExp);", + "", + " testMessage = product.Name;", + "", + " /*", + " if(attributesUnderTest.length > 0){", + " testMessage += \" \";", + " for(elem in attributesUnderTest){", + " testMessage += attributesUnderTest[elem] + \"; \";", + " }", + " }", + " if(propertiesUnderTest.length > 0){", + " testMessage += \" \";", + " for(elem in propertiesUnderTest){", + " testMessage += propertiesUnderTest[elem] + \"; \";", + " }", + " }", + " */", + "", + " pm.test(testMessage, function () {", + " pm.expect(booleanTreeExp).to.be.true;", + " });", + " }", + " }", + "}", + "", + "catch (err) {", + " pm.test(\"Filters Test\", function () {", + " pm.expect.fail(err.toString());", + " });", "}" ], "type": "text/javascript" } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript" + } } ], "request": { @@ -30172,91 +31542,97 @@ } ] }, - "method": "GET", + "method": "POST", "header": [], + "body": { + "mode": "raw", + "raw": "{\"FilterProducts\":[\r\n\t{\"Name\": \"S1A_IW_GRDH_1SDV_20200121T201716_20200121T201741_030903_038C0F_DAEC.SAFE.zip\"},\r\n\t{\"Name\": \"S1A_EW_GRDM_1ADH_20200121T014322_20200121T014427_030892_038BA2_CD80.SAFE.zip\"},\r\n\t{\"Name\": \"S1A_S4_GRDH_1SDV_20190827T045540_20190827T045605_028750_03416A_B108.SAFE.zip\"}\r\n]}", + "options": { + "raw": { + "language": "json" + } + } + }, "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'SubmissionToCompletion.Monthly.max.time'", + "raw": "{{service-root-uri}}/odata/v1/Products/OData.CSC.FilterList", "host": [ "{{service-root-uri}}" ], "path": [ "odata", "v1", - "Metrics" - ], - "query": [ - { - "key": "$filter", - "value": "Name eq 'SubmissionToCompletion.Monthly.max.time'" - } + "Products", + "OData.CSC.FilterList" ] } }, "response": [] - }, + } + ], + "protocolProfileBehavior": {}, + "_postman_isSubFolder": true + }, + { + "name": "Subscriptions", + "item": [ { - "name": "LTA_SubmissionToCompletion_Monthly_avg_time", + "name": "CreateSubscription", "event": [ { "listen": "test", "script": { "exec": [ + "properties_map = {};\r", + "properties_map.Id=function (element) {pm.expect(element.Id).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.FilterParam=function (element) {\r", + " pm.expect(element.FilterParam).to.be.a(\"string\");\r", + " pm.expect(element.FilterParam).to.be.not.equal(null);\r", + "};\r", + "\r", + "properties_map.SubmissionDate=function (element) {pm.expect(element.SubmissionDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "\r", + "properties_map.Status=function (element) {\r", + " pm.expect(element.Status).to.be.a(\"string\");\r", + " pm.expect(element.Status).to.be.oneOf([\"running\"]);\r", + "};\r", + "\r", + "properties_map.NotificationEndpoint=function (element) {\r", + " pm.expect(element.NotificationEndpoint).to.be.a(\"string\");\r", + "};\r", + "\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Subscription: \" + order.Id, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Subscription: \" + order.Id);\r", + " }\r", + "}\r", + "\r", "try {\r", - " var jsonDataElements = pm.response.json().value;\r", + " var jsonDataElements = pm.response.json();\r", "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([201,202]);\r", " });\r", "\r", " pm.test(\"Test OData context\", function(){\r", - " query_string = pm.request.url.getQueryString();\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Metrics\");\r", + " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#OData.CSC.Subscription\");\r", " });\r", "\r", - " var metricName = decodeURIComponent(pm.request.url.getQueryString()).split(\"$filter=Name eq \")[1].replace(\"'\",\"\").split(\".\")[0];\r", - " console.log(metricName);\r", - "\r", - " for(var elem of jsonDataElements){\r", - " pm.test(\"Test Metrics properties\", function(){\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " });\r", "\r", - " if(elem[\"Name\"]) pm.expect(elem[\"Name\"].split(\".\")[0]).to.be.equal(metricName);\r", - " else pm.expect.fail(\"Name not found in element properties\");\r", - " \r", - " if(elem[\"Timestamp\"]) pm.expect(elem[\"Timestamp\"]).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d\\d\\d(\\d*)Z/);\r", - " else pm.expect.fail(\"Timestamp not found in element properties\");\r", - " \r", - " switch(metricName){\r", - " case \"systematic_production\":\r", - " case \"on-demand default\":\r", - " case \"on-demand non-default\":\r", - " case \"Archived\":\r", - " case \"Retrieved\":\r", - " case \"Download\":\r", - " console.log(\"Expected Counter\");\r", - " if(elem[\"MetricType\"]) pm.expect(elem[\"MetricType\"]).to.be.equal(\"Counter\");\r", - " else pm.expect.fail(\"MetricType not found in element properties\");\r", - " if(elem[\"Counter\"]) pm.expect(elem[\"Counter\"]).to.be.a(\"number\");\r", - " else pm.expect.fail(\"Counter not found in element properties\");\r", - " //pm.expect(elem[\"Gauge\"]).to.be.equal(null);\r", - " break;\r", - " case \"SensingToPublication\":\r", - " case \"OriginToPublication\":\r", - " case \"SubmissionToCompletion\":\r", - " case \"Service\":\r", - " console.log(\"Expected Gauge\");\r", - " if(elem[\"MetricType\"]) pm.expect(elem[\"MetricType\"]).to.be.equal(\"Gauge\");\r", - " else pm.expect.fail(\"MetricType not found in element properties\");\r", - " if(elem[\"Gauge\"]){\r", - " pm.expect(elem[\"Gauge\"]).to.be.a(\"string\");\r", - " pm.expect(parseInt(elem[\"Gauge\"])).to.be.a(\"number\");\r", - " } else pm.expect.fail(\"Gauge not found in element properties\");\r", - " //pm.expect(elem[\"Counter\"]).to.be.equal(null);\r", - " break;\r", - " }\r", - " });\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, jsonDataElements);\r", " }\r", - "}\r", + " \r", + " pm.collectionVariables.set('prip_subscription', jsonDataElements);\r", "\r", + "}\r", "catch (err) {\r", " pm.test(request.name, function () {\r", " pm.expect.fail(err.toString());\r", @@ -30268,106 +31644,393 @@ } ], "request": { - "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "{{password}}", - "type": "string" - }, - { - "key": "username", - "value": "{{username}}", - "type": "string" + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"@odata.context\": \"$metadata#Subscription/entity\",\r\n \"FilterParam\": \"startswith(Name,'S1')\",\r\n \"NotificationEndpoint\": \"http://{{notification_server_url}}/{{prip_path}}\",\r\n \"NotificationEpUsername\": \"{{notification_username}}\",\r\n \"NotificationEpPassword\": \"{{notification_password}}\"\r\n}", + "options": { + "raw": { + "language": "json" } - ] + } }, - "method": "GET", - "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'SubmissionToCompletion.Monthly.avg.time'", + "raw": "{{service-root-uri}}/odata/v1/Subscriptions", "host": [ "{{service-root-uri}}" ], "path": [ "odata", "v1", - "Metrics" - ], - "query": [ - { - "key": "$filter", - "value": "Name eq 'SubmissionToCompletion.Monthly.avg.time'" - } + "Subscriptions" ] } }, "response": [] }, { - "name": "LTA_Service_KPI_value", + "name": "GetProductAvailabilityNotifications", "event": [ { "listen": "test", "script": { "exec": [ + "const supportedOperators = [\"eq\", \"ne\", \"gt\", \"ge\", \"lt\", \"le\", \"and\", \"or\", \"not\"];\r", + "const supportedFunctions = [\"startswith\", \"contains\", \"endswith\"];\r", + "\r", + "function compare(a, b){\r", + " if(isNaN(a)){\r", + " return String(a).localeCompare(String(b));\r", + " } else {\r", + " return a > b;\r", + " } \r", + "}\r", + "\r", + "function getOperator(inputString, possibleOperators) {\r", + " var op = null;\r", + " possibleOperators.forEach(function (el) { if (inputString.indexOf(el) >= 0) { op = el; } });\r", + " return op;\r", + "}\r", + "\r", + "function opToJsFormat(op) {\r", + " res = null;\r", + " switch (op) {\r", + " case \"and\":\r", + " return \"&&\";\r", + " case \"or\":\r", + " return \"||\";\r", + " case \"not\":\r", + " return \"!\";\r", + " case \"eq\":\r", + " return \"==\";\r", + " case \"ne\":\r", + " return \"!=\";\r", + " case \"gt\":\r", + " return \">\";\r", + " case \"ge\":\r", + " return \">=\";\r", + " case \"lt\":\r", + " return \"<\";\r", + " case \"le\":\r", + " return \"<=\";\r", + " }\r", + "}\r", + "\r", + "function get_query_filters(input_query) {\r", + "\r", + " console.log(\"Parsing Filter...\");\r", + "\r", + " var matcher = /(contains\\((.+?)\\)|startswith\\((.+?)\\)|endswith\\((.+?)\\)|any\\(.*?\\)|ContentDate\\/Start.*Z|ContentDate\\/End.*Z|[\\w.]+?\\s(?:eq|ne|gt|ge|lt|le)\\s(?:\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)|[+-]?([0-9]*[.])?[0-9]+|\\w+|'.+?'))/g\r", + "\r", + " var filters = input_query.match(matcher);\r", + " var i = 0;\r", + " var simpleString = input_query.replace(matcher, function () {\r", + " return i++;\r", + " });\r", + "\r", + " console.log(simpleString);\r", + " console.log(filters);\r", + "\r", + " var filterString = simpleString;\r", + "\r", + " var groupString;\r", + " var groupFilter = null;\r", + " var testNextLevel = true;\r", + "\r", + " while (testNextLevel) {\r", + " var closeParenthesisIndex = filterString.indexOf(')');\r", + " if (closeParenthesisIndex !== -1) {\r", + " var openParenthesisIndex = filterString.lastIndexOf('(', closeParenthesisIndex);\r", + "\r", + " // Extract the string between the first deepest set of parenthesis\r", + " groupString = filterString.substring(openParenthesisIndex + 1, closeParenthesisIndex);\r", + "\r", + " // Modify the filter string replacing the contents of the group string in addition to the parenthesis with the length of the filters array (which will be the index of the filter object that we push)\r", + " filterString = filterString.substring(0, openParenthesisIndex) + filters.length + filterString.substring(closeParenthesisIndex + 1);\r", + " } else {\r", + "\r", + " // There are no more parenthesis groups\r", + " groupString = filterString;\r", + " testNextLevel = false;\r", + " }\r", + "\r", + " // If the group uses both 'and' and 'or' then return null as an invalid filter string.\r", + " if (groupString.indexOf('and') >= 0 && groupString.indexOf('or') >= 0) {\r", + " console.log(\"Invalid Filter!\");\r", + " return null;\r", + " }\r", + "\r", + " // Get the group indexes out of the group string\r", + " var groupFilterIndexes = groupString.match(/[0-9]+/g);\r", + " var groupFilters = [];\r", + "\r", + " // Create an array with each of the filters who's index matches the group indexes\r", + " for (i = 0; i < groupFilterIndexes.length; i++) {\r", + " groupFilters.push(filters[Number(groupFilterIndexes[i])]);\r", + " }\r", + "\r", + " //cycling over the supported operators\r", + " var op = getOperator(groupString, supportedOperators);\r", + "\r", + " //redundant brakets management\r", + " if (op == null) {\r", + " groupFilters.push(\"true\");\r", + " op = \"and\";\r", + " }\r", + "\r", + " // Create the filter object and push it onto the filters array\r", + " groupFilter = { op: op, filters: groupFilters };\r", + " filters.push(groupFilter);\r", + " }\r", + "\r", + " return groupFilter;\r", + "\r", + "}\r", + "\r", + "function checkResponse(inputString, product) {\r", + " console.log(\"Input String: \" + inputString);\r", + " //console.log(\"Product:\");\r", + " //console.log(product);\r", + " var responseProperties = Object.keys(product);\r", + " var responseAttributes = {};\r", + "\r", + " //Attribute\r", + " if (inputString.includes(\"any(\") && inputString.includes(\"/Name\") && inputString.includes(\"/Value\")) {\r", + " //Attribute Logic Assertion\r", + " if (responseProperties.indexOf(\"Attributes\") >= 0) {\r", + " product['Attributes'].forEach(function (el) {\r", + " responseAttributes[el.Name] = el.Value;\r", + " });\r", + "\r", + " //functions in Attribute Value\r", + " var cleanedInputString = inputString.split(\"any(\").pop();\r", + " console.log(\"CLEANED ATTRIBUTE INPUTSTRING: \" + cleanedInputString);\r", + " if (cleanedInputString.includes(\"(\") && cleanedInputString.includes(\")\")) {\r", + " //get the function name\r", + " var functionName = cleanedInputString.split(\"(\")[0].split(\" \").pop();\r", + " if (supportedFunctions.indexOf(functionName) >= 0) {\r", + " console.log(\"Found Attribute Function: \" + functionName);\r", + " //get the attribute\r", + " var attrToCheck = cleanedInputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", + " console.log(\"Attribute KEY Found: \" + attrToCheck);\r", + " //get the cleaned value\r", + " var attrValueToCheck = cleanedInputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", + " console.log(\"Attribute VALUE Found: \" + attrValueToCheck);\r", + "\r", + " switch (functionName) {\r", + " case \"contains\":\r", + " attributesUnderTest.push(attrToCheck + \" contains \" + attrValueToCheck);\r", + " return (responseAttributes[attrToCheck].includes(attrValueToCheck)) ? true : false;\r", + " case \"startswith\":\r", + " attributesUnderTest.push(attrToCheck + \" startswith \" + attrValueToCheck);\r", + " return responseAttributes[attrToCheck].startsWith(attrValueToCheck) ? true : false;\r", + " case \"endswith\":\r", + " attributesUnderTest.push(attrToCheck + \" endswith \" + attrValueToCheck);\r", + " return responseAttributes[attrToCheck].endsWith(attrValueToCheck) ? true : false;\r", + " }\r", + " }\r", + " } else {\r", + " //simple any(Attributes Name and Value)\r", + " var attrToCheck = inputString.split('Name eq ').pop().split(\" \")[0].replace(/'/g, \"\").trim();\r", + " console.log(\"Extracted Attribute KEY: \" + attrToCheck);\r", + " var attrValueToCheck = inputString.split('Value eq ').pop().split(\" \")[0].trim().replace(/'/g, \"\").replace(/\\)/g, \"\").replace(/\\\\/g, \"\");\r", + " console.log(\"Extracted Attribute VALUE: \" + attrValueToCheck);\r", + "\r", + " attributesUnderTest.push(\"attr:\" + attrToCheck + \" eq \" + attrValueToCheck);\r", + "\r", + " return responseAttributes[attrToCheck] == attrValueToCheck;\r", + " }\r", + " }\r", + " } else {\r", + " //inputString contains a function on a Property -> complex property not supported!\r", + " if (inputString.includes(\"(\") && inputString.includes(\")\")) {\r", + " //get the function name\r", + " var functionName = inputString.split(\"(\")[0];\r", + " if (supportedFunctions.indexOf(functionName) >= 0) {\r", + " console.log(\"Found Function: \" + functionName);\r", + " //get the property\r", + " var propertyToCheck = inputString.split(\"(\")[1].split(\",\")[0].trim();\r", + " console.log(\"Property Found: \" + propertyToCheck);\r", + "\r", + " //get the cleaned value\r", + " var propValueToCheck = inputString.split(\"(\")[1].split(\")\")[0].split(\",\")[1].trim().replace(/'/g, \"\");\r", + " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", + "\r", + " switch (functionName) {\r", + " case \"contains\":\r", + " propertiesUnderTest.push(propertyToCheck + \" contains \" + propValueToCheck);\r", + " return (product[propertyToCheck].includes(propValueToCheck)) ? true : false;\r", + " case \"startswith\":\r", + " propertiesUnderTest.push(propertyToCheck + \" startswith \" + propValueToCheck);\r", + " return product[propertyToCheck].startsWith(propValueToCheck) ? true : false;\r", + " case \"endswith\":\r", + " propertiesUnderTest.push(propertyToCheck + \" endswith \" + propValueToCheck);\r", + " return product[propertyToCheck].endsWith(propValueToCheck) ? true : false;\r", + " }\r", + " } else {\r", + " console.log(\"Unsupported Function: \" + functionName);\r", + " return false;\r", + " }\r", + " } else {\r", + " // single logic assertion in \"AND\" with \"true\"\r", + " if (inputString === \"true\") {\r", + " console.log(\"True Value!\");\r", + " return true;\r", + " } else {\r", + " //direct Property\r", + " var propertyToCheck = inputString.split(\" \")[0].trim();\r", + " var operatorToApply = inputString.split(\" \")[1];\r", + " var propValueToCheck = inputString.split(\" \")[2].trim().replace(/'/g, \"\");\r", + "\r", + " console.log(\"Property Found: \" + propertyToCheck);\r", + " console.log(\"PropertyValue Found: \" + propValueToCheck);\r", + "\r", + " if (supportedOperators.indexOf(operatorToApply) >= 0) {\r", + " console.log(\"Operator To Apply: \" + operatorToApply);\r", + " operator = opToJsFormat(operatorToApply);\r", + " propertiesUnderTest.push(propertyToCheck + \" \" + operatorToApply + \" \" + propValueToCheck);\r", + "\r", + " var toEvalString = \"\";\r", + " var subProperty = \"\";\r", + "\r", + " //Complex properties (ContentDate)\r", + " if(propertyToCheck.includes(\"/\")){\r", + " var rootPropertyToCheck = propertyToCheck.split(\"/\")[0];\r", + " subProperty = propertyToCheck.split(\"/\")[1];\r", + "\r", + " console.log(\"Complex Property: \" + rootPropertyToCheck);\r", + " console.log(\"Sub Property: \" + subProperty);\r", + "\r", + " toEvalString = \"product[rootPropertyToCheck][subProperty] \" + operator + \" propValueToCheck\";\r", + "\r", + " } else {\r", + " toEvalString = \"product[propertyToCheck] \" + operator + \" propValueToCheck\";\r", + " }\r", + "\r", + " return eval(toEvalString);\r", + " } else {\r", + " console.log(\"Operator not supported\");\r", + " return false;\r", + " }\r", + " }\r", + " }\r", + " }\r", + " console.log(\"Logic Assertion not computed: \" + inputString);\r", + " return Math.random() >= 0.5;\r", + "}\r", + "\r", + "function treeIterator(tree, product) {\r", + " if (tree['filters'].length >= 0) {\r", + " var conditions = [];\r", + "\r", + " var logicOperator = getOperator(tree['op'], supportedOperators);\r", + " var logicOperator = opToJsFormat(logicOperator);\r", + "\r", + " //general tree: iterates over all filters (child nodes)\r", + " for (elem in tree['filters']) {\r", + " var currentCondition = typeof ((tree['filters'][elem])) == \"object\" ? treeIterator(tree['filters'][elem], product) : checkResponse(tree['filters'][elem], product);\r", + " conditions.push(currentCondition);\r", + " //optimize AND and OR\r", + " if(logicOperator == \"||\" && currentCondition){\r", + " break;\r", + " }\r", + " if(logicOperator == \"&&\" && !currentCondition){\r", + " break;\r", + " }\r", + " }\r", + " console.log(\"CURRENT CONDITIONS\");\r", + " console.log(conditions);\r", + "\r", + " //building return string\r", + " var resString = \"(\";\r", + " for (elem in conditions) {\r", + " resString += conditions[elem] + \" \" + logicOperator.toString() + \" \";\r", + " }\r", + " resString = resString.substring(0, resString.length - 3);\r", + " resString += \")\";\r", + "\r", + " console.log(\"RES String: \" + resString);\r", + "\r", + " return resString;\r", + " }\r", + "}\r", + "\r", + "properties_map = {};\r", + "\r", + "properties_map[\"@odata.context\"]=function(element){\r", + " pm.expect(element[\"@odata.context\"]).to.include(\"$metadata#Notification\");\r", + "};\r", + "\r", + "properties_map.SubscriptionId=function (element) {pm.expect(element.SubscriptionId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.ProductId=function (element) {pm.expect(element.ProductId).to.match(/[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}/);};\r", + "\r", + "properties_map.NotificationDate=function (element) {pm.expect(element.NotificationDate).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/);};\r", + "\r", + "properties_map.Name=function (element) {\r", + " pm.expect(element.Name).to.be.a(\"string\");\r", + "};\r", + "\r", + "\r", + "function propertySpecific(key, order){\r", + " if (properties_map[key]) {\r", + " pm.test(\"Test Property \"+key+\" for Subscription: \" + order.SubscriptionId, function(){properties_map[key](order)});\r", + " }\r", + " else {\r", + " pm.test.skip(\"Test Property \"+key+\" for Subscription: \" + order.SubscriptionId);\r", + " }\r", + "}\r", + "\r", "try {\r", - " var jsonDataElements = pm.response.json().value;\r", + " var jsonDataElements = pm.response.json().requests;\r", "\r", - " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function () {\r", - " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", + " pm.test(\"Test Response Status Code\", function(){\r", + " pm.expect(pm.response.code).to.be.oneOf([200]);\r", " });\r", "\r", - " pm.test(\"Test OData context\", function(){\r", - " query_string = pm.request.url.getQueryString();\r", - " pm.expect( pm.response.json()['@odata.context']).to.include(\"$metadata#Metrics\");\r", + " pm.test(\"Response time is less than \" + environment[\"query-timeout\"] + \"ms\", function(){\r", + " pm.expect(pm.response.responseTime).to.be.below(parseInt(environment[\"query-timeout\"]));\r", " });\r", "\r", - " var metricName = decodeURIComponent(pm.request.url.getQueryString()).split(\"$filter=Name eq \")[1].replace(\"'\",\"\").split(\".\")[0];\r", - " console.log(metricName);\r", + " var subscription = pm.collectionVariables.get('prip_subscription');\r", + " \r", + " console.log(\"Notifications:\");\r", + " console.log(jsonDataElements);\r", + " \r", + " for(notification of jsonDataElements){\r", + " var current_notification = JSON.parse(notification[\"body\"]);\r", + " if(current_notification[\"SubscriptionId\"] == subscription[\"Id\"]){\r", + " console.log(current_notification);\r", + " for (const[key, value] of Object.entries(properties_map)){\r", + " propertySpecific(key, current_notification);\r", + " }\r", "\r", - " for(var elem of jsonDataElements){\r", - " pm.test(\"Test Metrics properties\", function(){\r", + " //FilterParam Check\r", + " var filterParam = subscription[\"FilterParam\"];\r", + " parsed_filters = get_query_filters(subscription[\"FilterParam\"]);\r", + " console.log(parsed_filters);\r", + " if (typeof (parsed_filters) == \"object\") {\r", + " \r", + " attributesUnderTest = [];\r", + " propertiesUnderTest = [];\r", "\r", - " if(elem[\"Name\"]) pm.expect(elem[\"Name\"].split(\".\")[0]).to.be.equal(metricName);\r", - " else pm.expect.fail(\"Name not found in element properties\");\r", - " \r", - " if(elem[\"Timestamp\"]) pm.expect(elem[\"Timestamp\"]).to.match(/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d\\d\\d(\\d*)Z/);\r", - " else pm.expect.fail(\"Timestamp not found in element properties\");\r", - " \r", - " switch(metricName){\r", - " case \"systematic_production\":\r", - " case \"on-demand default\":\r", - " case \"on-demand non-default\":\r", - " case \"Archived\":\r", - " case \"Retrieved\":\r", - " case \"Download\":\r", - " console.log(\"Expected Counter\");\r", - " if(elem[\"MetricType\"]) pm.expect(elem[\"MetricType\"]).to.be.equal(\"Counter\");\r", - " else pm.expect.fail(\"MetricType not found in element properties\");\r", - " if(elem[\"Counter\"]) pm.expect(elem[\"Counter\"]).to.be.a(\"number\");\r", - " else pm.expect.fail(\"Counter not found in element properties\");\r", - " //pm.expect(elem[\"Gauge\"]).to.be.equal(null);\r", - " break;\r", - " case \"SensingToPublication\":\r", - " case \"OriginToPublication\":\r", - " case \"SubmissionToCompletion\":\r", - " case \"Service\":\r", - " console.log(\"Expected Gauge\");\r", - " if(elem[\"MetricType\"]) pm.expect(elem[\"MetricType\"]).to.be.equal(\"Gauge\");\r", - " else pm.expect.fail(\"MetricType not found in element properties\");\r", - " if(elem[\"Gauge\"]){\r", - " pm.expect(elem[\"Gauge\"]).to.be.a(\"string\");\r", - " pm.expect(parseInt(elem[\"Gauge\"])).to.be.a(\"number\");\r", - " } else pm.expect.fail(\"Gauge not found in element properties\");\r", - " //pm.expect(elem[\"Counter\"]).to.be.equal(null);\r", - " break;\r", + " var product = current_notification;\r", + " var treeExp = treeIterator(parsed_filters, product);\r", + " var booleanTreeExp = eval(treeExp);\r", + "\r", + " console.log(treeExp); console.log(booleanTreeExp);\r", + "\r", + " testMessage = \"FilterParam \" + filterParam + \" Check: \" + product.Name;\r", + "\r", + " pm.test(testMessage, function () {\r", + " pm.expect(booleanTreeExp, \"FilterParam Check\").to.be.true;\r", + " });\r", " }\r", - " });\r", + " }\r", " }\r", - "}\r", "\r", + "}\r", "catch (err) {\r", " pm.test(request.name, function () {\r", " pm.expect.fail(err.toString());\r", @@ -30380,37 +32043,35 @@ ], "request": { "auth": { - "type": "basic", - "basic": [ - { - "key": "password", - "value": "{{password}}", - "type": "string" - }, - { - "key": "username", - "value": "{{username}}", - "type": "string" + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Authorization", + "type": "text", + "value": "{{subscription_auth_token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\r\n \"urlPattern\":\"/{{prip_path}}\"\r\n}", + "options": { + "raw": { + "language": "json" } - ] + } }, - "method": "GET", - "header": [], "url": { - "raw": "{{service-root-uri}}/odata/v1/Metrics?$filter=Name eq 'Service.{{metric_KPI}}.value'", + "raw": "{{mocklab_api_endpoint}}/{{notification_server_url}}/__admin/requests/find", "host": [ - "{{service-root-uri}}" + "{{mocklab_api_endpoint}}" ], "path": [ - "odata", - "v1", - "Metrics" - ], - "query": [ - { - "key": "$filter", - "value": "Name eq 'Service.{{metric_KPI}}.value'" - } + "{{notification_server_url}}", + "__admin", + "requests", + "find" ] } }, @@ -30421,7 +32082,7 @@ "_postman_isSubFolder": true }, { - "name": "PRIP", + "name": "Metrics", "item": [ { "name": "PRIP_productionType_productType_platformShortName_platformSerialIdentifier_size", @@ -32784,6 +34445,10 @@ "key": "lta_path", "value": "current_lta" }, + { + "key": "prip_path", + "value": "current_prip" + }, { "key": "mocklab_api_endpoint", "value": "https://api.mocklab.io/proxy/mock-api"