Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pm.variables.get("queryParam1")
- if (pm.collectionVariables.get("flag") == "false")
- {
- pm.sendRequest(pm.variables.get("baseUrl") + "/operator/initJobsTable?configType=JSON", function (err, response) {
- if (err){
- console.log(err)
- } else {
- console.log(response.code + " initJobsTable is done")
- }
- });
- pm.sendRequest(pm.variables.get("baseUrl") + "/operator/initJobSchedulesTable", function (err, response) {
- if (err){
- console.log(err)
- } else {
- console.log(response.code + " initJobSchedulesTable is done")
- }
- });
- //consumptionPostProcessing
- const putConsumptionPostProcessing = {
- url: pm.environment.get("baseUrl") + '/ui/admin/configurations',
- method: 'PUT',
- header: {
- 'Content-Type': 'application/json',
- 'X-Foo': 'bar'
- },
- body: {
- mode: 'raw',
- 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\"}]"})
- }
- };
- pm.sendRequest(putConsumptionPostProcessing, (error, response) => {
- if (error){
- console.log(err)
- } else {
- console.log(response.code + " consumptionPostProcessing is done")
- }
- });
- //socCreator
- const putSocCreator = {
- url: pm.environment.get("baseUrl") + '/ui/admin/configurations',
- method: 'PUT',
- header: {
- 'Content-Type': 'application/json',
- 'X-Foo': 'bar'
- },
- body: {
- mode: 'raw',
- 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\":[]}]"})
- }
- };
- pm.sendRequest(putSocCreator, (error, response) => {
- if (error){
- console.log(err)
- } else {
- console.log(response.code + " socCreator is done")
- }
- });
- //priceCreator
- const putPriceCreator = {
- url: pm.environment.get("baseUrl") + '/ui/admin/configurations',
- method: 'PUT',
- header: {
- 'Content-Type': 'application/json',
- 'X-Foo': 'bar'
- },
- body: {
- mode: 'raw',
- 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}]"})
- }
- };
- pm.sendRequest(putPriceCreator, (error, response) => {
- if (error){
- console.log(err)
- } else {
- console.log(response.code + " priceCreator is done")
- }
- });
- //communityMetricsJob
- const putCommunityMetricsJob = {
- url: pm.environment.get("baseUrl") + '/ui/admin/configurations',
- method: 'PUT',
- header: {
- 'Content-Type': 'application/json',
- 'X-Foo': 'bar'
- },
- body: {
- mode: 'raw',
- 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\":[]}]"})
- }
- };
- pm.sendRequest(putCommunityMetricsJob, (error, response) => {
- if (error){
- console.log(err)
- } else {
- console.log(response.code + " communityMetricsJob is done")
- }
- });
- pm.collectionVariables.set("flag", "true")
- }
Advertisement
Add Comment
Please, Sign In to add comment