Guest User

11

a guest
Oct 7th, 2020
902
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pm.variables.get("queryParam1")
  2. if (pm.collectionVariables.get("flag") == "false")
  3. {
  4. pm.sendRequest(pm.variables.get("baseUrl") + "/operator/initJobsTable?configType=JSON", function (err, response) {
  5.     if (err){
  6.         console.log(err)
  7.     } else {
  8.         console.log(response.code + " initJobsTable is done")
  9.     }  
  10. });
  11. pm.sendRequest(pm.variables.get("baseUrl") + "/operator/initJobSchedulesTable", function (err, response) {
  12.     if (err){
  13.         console.log(err)
  14.     } else {
  15.         console.log(response.code + " initJobSchedulesTable is done")
  16.     }
  17. });
  18. //consumptionPostProcessing
  19. const putConsumptionPostProcessing = {
  20.   url: pm.environment.get("baseUrl") + '/ui/admin/configurations',
  21.   method: 'PUT',
  22.   header: {
  23.     'Content-Type': 'application/json',
  24.     'X-Foo': 'bar'
  25.   },
  26.   body: {
  27.     mode: 'raw',
  28.     raw: JSON.stringify({"jobId":"consumptionPostProcessing","configId":"consumptionPostProcessingConfiguration","configType":"JSON","xmlFileName":"consumptionPostProcessingConfiguration.xml","configJson":"[{\"timeFrameCalculator\":{\"startDate\":\"2017-01-01T00:00:00\",\"endDate\":\"2017-01-02T00:00:00\",\"mode\":\"MANUAL\",\"offsetDays\":0,\"offsetMinutes\":0,\"numOfDays\":1,\"alignWithStartOfDay\":false,\"periodicSlidingWindowDirection\":\"BACKWARD\"},\"configImports\":null,\"entityIds\":[],\"deviceTypes\":[],\"excludedEntityIds\":[],\"maxRecordsIntervalForRecovery\":6,\"takeForecast\":false,\"targetResolutionMinutes\":60,\"maxIntervalForDataAggregationMinutes\":60,\"shouldOverrideNegative\":false,\"overrideNegativeValue\":377,\"meterPosition\":\"DEVICE\"}]"})
  29.   }
  30. };
  31. pm.sendRequest(putConsumptionPostProcessing, (error, response) => {
  32.    if (error){
  33.         console.log(err)
  34.     } else {
  35.         console.log(response.code + " consumptionPostProcessing is done")
  36.     }
  37. });
  38. //socCreator
  39. const putSocCreator = {
  40.   url: pm.environment.get("baseUrl") + '/ui/admin/configurations',
  41.   method: 'PUT',
  42.   header: {
  43.     'Content-Type': 'application/json',
  44.     'X-Foo': 'bar'
  45.   },
  46.   body: {
  47.     mode: 'raw',
  48.     raw: JSON.stringify({"jobId":"socCreator","configId":"socCreatorConfiguration","configType":"JSON","xmlFileName":"socCreatorConfiguration.xml","configJson":"[{\"timeFrameCalculator\":{\"startDate\":\"2019-01-01T00:00:00\",\"endDate\":\"2019-01-10T00:00:00\",\"mode\":\"MANUAL\",\"offsetDays\":0,\"offsetMinutes\":0,\"numOfDays\":1,\"alignWithStartOfDay\":false,\"periodicSlidingWindowDirection\":\"FORWARD\"},\"configImports\":[],\"entityIds\":[],\"deviceTypes\":[],\"excludedEntityIds\":[]}]"})
  49.   }
  50. };
  51. pm.sendRequest(putSocCreator, (error, response) => {
  52.    if (error){
  53.         console.log(err)
  54.     } else {
  55.         console.log(response.code + " socCreator is done")
  56.     }
  57. });
  58. //priceCreator
  59. const putPriceCreator = {
  60.   url: pm.environment.get("baseUrl") + '/ui/admin/configurations',
  61.   method: 'PUT',
  62.   header: {
  63.     'Content-Type': 'application/json',
  64.     'X-Foo': 'bar'
  65.   },
  66.   body: {
  67.     mode: 'raw',
  68.     raw: JSON.stringify({"jobId":"priceCreator","configId":"priceCreatorConfiguration","configType":"JSON","xmlFileName":"priceCreatorConfiguration.xml","configJson":"[{\"timeFrameCalculator\":{\"startDate\":\"2018-04-01T00:00:00\",\"endDate\":\"2018-05-01T00:00:00\",\"mode\":\"PERIODIC\",\"offsetDays\":0,\"offsetMinutes\":0,\"numOfDays\":1,\"alignWithStartOfDay\":false,\"periodicSlidingWindowDirection\":\"BACKWARD\"},\"configImports\":null,\"entityIds\":[],\"deviceTypes\":[],\"excludedEntityIds\":[],\"persistentMode\":false,\"takeRecordsFromForecast\":false,\"takeBatteryRecordsFromActions\":false,\"createWeightedTariff\":true}]"})
  69.   }
  70. };
  71. pm.sendRequest(putPriceCreator, (error, response) => {
  72.    if (error){
  73.         console.log(err)
  74.     } else {
  75.         console.log(response.code + " priceCreator is done")
  76.     }
  77. });
  78. //communityMetricsJob
  79. const putCommunityMetricsJob = {
  80.   url: pm.environment.get("baseUrl") + '/ui/admin/configurations',
  81.   method: 'PUT',
  82.   header: {
  83.     'Content-Type': 'application/json',
  84.     'X-Foo': 'bar'
  85.   },
  86.   body: {
  87.     mode: 'raw',
  88.     raw: JSON.stringify({"jobId":"communityMetricsJob","configId":"communityMetricsConfiguration","configType":"JSON","xmlFileName":"communityMetricsConfiguration.xml","configJson":"[{\"timeFrameCalculator\":{\"startDate\":\"2019-01-01T00:00:00\",\"endDate\":\"2019-01-10T00:00:00\",\"mode\":\"MANUAL\",\"offsetDays\":0,\"offsetMinutes\":0,\"numOfDays\":1,\"alignWithStartOfDay\":false,\"periodicSlidingWindowDirection\":\"FORWARD\"},\"configImports\":null,\"entityIds\":[],\"deviceTypes\":[],\"excludedEntityIds\":[]}]"})
  89.   }
  90. };
  91. pm.sendRequest(putCommunityMetricsJob, (error, response) => {
  92.    if (error){
  93.         console.log(err)
  94.     } else {
  95.         console.log(response.code + " communityMetricsJob is done")
  96.     }
  97. });
  98.  
  99.     pm.collectionVariables.set("flag", "true")
  100. }
Advertisement
Add Comment
Please, Sign In to add comment