summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManor, Yanir (ym903w) <ym903w@intl.att.com>2018-10-21 09:34:56 +0300
committerManor, Yanir (ym903w) <ym903w@intl.att.com>2018-10-21 09:34:56 +0300
commitc88cb68410da3e91698a2a2eab6be84ada83ba02 (patch)
tree496bd05755d305378c59a78f50cf6437336bfb58
parent3de8b11db3f72a579ba9d725a1a995854c616be0 (diff)
upgrade dace-d ci
upgrade dace-d ci Change-Id: I4295bdf14706b8e678b3274585440148017d23d6 Issue-ID: DCAEGEN2-838 Signed-off-by: Manor, Yanir (ym903w) <ym903w@intl.att.com>
-rw-r--r--.gitignore1
-rw-r--r--cypress-docker/test/src/cypress.json7
-rw-r--r--cypress-docker/test/src/cypress.json.tpl1
-rw-r--r--cypress-docker/test/src/cypress/fixtures/McTable.json114
-rw-r--r--cypress-docker/test/src/cypress/integration/mocks/newApp/generalPage-spec.js9
-rw-r--r--cypress-docker/test/src/cypress/integration/mocks/newApp/homePage-spec.js158
-rw-r--r--cypress-docker/test/src/cypress/integration/mocks/newApp/ruleEngine-spec.js47
-rw-r--r--cypress-docker/test/src/cypress/support/homeCommands.js41
-rw-r--r--src/main/java/org/onap/dcae/ci/api/tests/composition/SaveAndSubmitCompositionFullFlowTest.java133
-rw-r--r--src/main/java/org/onap/dcae/ci/api/tests/configuration/ConfigurationControllerApiTest.java1
-rw-r--r--src/main/java/org/onap/dcae/ci/utilities/DcaeRestClient.java14
11 files changed, 443 insertions, 83 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5a50b7f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/target/*
diff --git a/cypress-docker/test/src/cypress.json b/cypress-docker/test/src/cypress.json
index 0967ef4..4cd57ec 100644
--- a/cypress-docker/test/src/cypress.json
+++ b/cypress-docker/test/src/cypress.json
@@ -1 +1,6 @@
-{}
+{
+ "viewportWidth": 1280,
+ "chromeWebSecurity": true,
+ "requestTimeout": 60000,
+ "responseTimeout": 100000
+}
diff --git a/cypress-docker/test/src/cypress.json.tpl b/cypress-docker/test/src/cypress.json.tpl
index 5a33747..075e021 100644
--- a/cypress-docker/test/src/cypress.json.tpl
+++ b/cypress-docker/test/src/cypress.json.tpl
@@ -1,4 +1,5 @@
{
+ "viewportWidth": 1280,
"chromeWebSecurity": false,
"requestTimeout": 60000,
"responseTimeout": 100000,
diff --git a/cypress-docker/test/src/cypress/fixtures/McTable.json b/cypress-docker/test/src/cypress/fixtures/McTable.json
new file mode 100644
index 0000000..73f700f
--- /dev/null
+++ b/cypress-docker/test/src/cypress/fixtures/McTable.json
@@ -0,0 +1,114 @@
+{
+ "monitoringComponents": [
+ {
+ "uuid": "01136abe-26d9-4fb0-98e7-cd652a51ff7b",
+ "name": "importTest",
+ "version": "0.3",
+ "lastUpdaterUserId": "ym903w",
+ "description": "xx",
+ "lifecycleState": "NOT_CERTIFIED_CHECKIN",
+ "status": "Not Submitted",
+ "vfiName": "enrich0",
+ "invariantUuid": "91ca20b4-4cf9-4b12-9a0a-b592f60b9e09",
+ "submittedUuid": null
+ },
+ {
+ "uuid": "942cdc80-a541-4d7f-b3ec-c0d3c84ab446",
+ "name": "testImportInGroup",
+ "version": "0.17",
+ "lastUpdaterUserId": "jh0003",
+ "description": "xx",
+ "lifecycleState": "NOT_CERTIFIED_CHECKOUT",
+ "status": "Not Submitted",
+ "vfiName": "enrich0",
+ "invariantUuid": "39fd85b6-58f5-45ab-9256-7989d63a611b",
+ "submittedUuid": null
+ },
+ {
+ "uuid": "01e17e43-cc2e-4762-9822-c97c69394e30",
+ "name": "ron",
+ "version": "0.9",
+ "lastUpdaterUserId": "ym903w",
+ "description": "xx",
+ "lifecycleState": "NOT_CERTIFIED_CHECKIN",
+ "status": "Not Submitted",
+ "vfiName": "enrich0",
+ "invariantUuid": "f99ebc8a-d16c-4d56-a0fa-8b1f3d2b1977",
+ "submittedUuid": null
+ },
+ {
+ "uuid": "79a4d5f7-783e-454c-883f-caad0100266b",
+ "name": "HpT",
+ "version": "0.25",
+ "lastUpdaterUserId": "ym903w",
+ "description": "xxx",
+ "lifecycleState": "NOT_CERTIFIED_CHECKOUT",
+ "status": "Not Submitted",
+ "vfiName": "enrich0",
+ "invariantUuid": "c1a57eac-6068-4eed-9b32-0641676683e7",
+ "submittedUuid": null
+ },
+ {
+ "uuid": "b497430a-e414-4fbd-aa0a-d936deb39297",
+ "name": "hptest1",
+ "version": "0.2",
+ "lastUpdaterUserId": "ym903w",
+ "description": "xxx",
+ "lifecycleState": "NOT_CERTIFIED_CHECKIN",
+ "status": "Not Submitted",
+ "vfiName": "enrich0",
+ "invariantUuid": "88017fc9-0480-4abb-9c72-bd4f213bdd18",
+ "submittedUuid": null
+ },
+ {
+ "uuid": "d2a361f5-e000-4ffb-a3f7-e90d2c1ca76d",
+ "name": "vosk",
+ "version": "0.4",
+ "lastUpdaterUserId": "ym903w",
+ "description": "xxx",
+ "lifecycleState": "NOT_CERTIFIED_CHECKOUT",
+ "status": "Not Submitted",
+ "vfiName": "enrich0",
+ "invariantUuid": "aa14a42f-2346-458d-8c03-7f44a5e9df5b",
+ "submittedUuid": null
+ },
+ {
+ "uuid":
+ "bff53682-4ae1-42d0-9e8f-a6f80a1f6f02/d960e45b-7fda-4421-805c-b5815d7cda5b",
+ "name": "dror",
+ "version": "1.0",
+ "lastUpdaterUserId": "ym903w",
+ "description": "xxx",
+ "lifecycleState": "CERTIFIED",
+ "status": "Submitted",
+ "vfiName": "enrich0",
+ "invariantUuid": "94543a61-41d2-4f8b-80c6-b1985a6484c6",
+ "submittedUuid": "bff53682-4ae1-42d0-9e8f-a6f80a1f6f02"
+ },
+ {
+ "uuid":
+ "8b75d1bc-35fe-4cfb-a1a9-d7c4be38c8d5/d97a7e78-2231-4c39-a12a-4a44d756f28b",
+ "name": "stone",
+ "version": "1.0",
+ "lastUpdaterUserId": "ym903w",
+ "description": "z",
+ "lifecycleState": "CERTIFIED",
+ "status": "Submitted",
+ "vfiName": "enrich0",
+ "invariantUuid": "529ddd17-527a-4421-bfa8-843f62a18e0c",
+ "submittedUuid": "8b75d1bc-35fe-4cfb-a1a9-d7c4be38c8d5"
+ },
+ {
+ "uuid": "f6523ef3-37d5-4ec4-845c-6b76697728e6",
+ "name": "gal",
+ "version": "1.4",
+ "lastUpdaterUserId": "ym903w",
+ "description": "xxx",
+ "lifecycleState": "NOT_CERTIFIED_CHECKOUT",
+ "status": "Submitted",
+ "vfiName": "enrich0",
+ "invariantUuid": "cc70a75e-c37b-498d-bf85-3416d4c13f1a",
+ "submittedUuid": "c3b47bbb-0e9a-43f3-ba04-93aa5d5d3c87"
+ }
+ ]
+}
diff --git a/cypress-docker/test/src/cypress/integration/mocks/newApp/generalPage-spec.js b/cypress-docker/test/src/cypress/integration/mocks/newApp/generalPage-spec.js
index 45badf1..91a2b91 100644
--- a/cypress-docker/test/src/cypress/integration/mocks/newApp/generalPage-spec.js
+++ b/cypress-docker/test/src/cypress/integration/mocks/newApp/generalPage-spec.js
@@ -11,8 +11,8 @@ describe("General Page - E2E test flow with mock", () => {
// it.only("Check boolean DDL with value undefined - using true, true - using
// true and false" + " - using false.", () => { cy.fillNewMcForm(); cy
- // .get('button[data-tests-id="createMonitoring"]') .as("createButton")
- // .not("[disabled]") .should("not.contain", "Disabled");
+ // .get('button[data-tests-id="createMonitoring"]') .as("createButton")
+ // .not("[disabled]") .should("not.contain", "Disabled");
// cy.httpCreateNewMcWithBooleanDDL(); cy.emptyRuleEngine("Type1"); cy
// .get("@createButton") .click(); cy .get("#ui-tabpanel-1-label")
// .should("contain", "map") .click(); cy
@@ -22,8 +22,8 @@ describe("General Page - E2E test flow with mock", () => {
// .get(".map-setting-list > form > #valueUndefined > select")
// .should("have.value", "true"); cy .get(".map-setting-list > form >
// #valueTrue > select") .should("have.value", "true"); cy
- // .get(".map-setting-list > form > #valueFalse > select")
- // .should("have.value", "false"); });
+ // .get(".map-setting-list > form > #valueFalse > select") .should("have.value",
+ // "false"); });
});
describe("Create new MC", () => {
@@ -59,6 +59,7 @@ describe("General Page - E2E test flow with mock", () => {
.click();
cy
.get('button[data-tests-id="setting-gear"]')
+ .first()
.should("be.visible")
.first()
.click({ multiple: true });
diff --git a/cypress-docker/test/src/cypress/integration/mocks/newApp/homePage-spec.js b/cypress-docker/test/src/cypress/integration/mocks/newApp/homePage-spec.js
index 4be1dde..ee2d512 100644
--- a/cypress-docker/test/src/cypress/integration/mocks/newApp/homePage-spec.js
+++ b/cypress-docker/test/src/cypress/integration/mocks/newApp/homePage-spec.js
@@ -2,7 +2,7 @@ export const buttonCreateMC = () => {
return cy.get('button[data-tests-id="btn-create-mc"]');
};
export const buttonCreateMCSpan = () => {
- return cy.get('span[data-tests-id="btn-span-create-mc"]');
+ return cy.get('[data-tests-id="btn-span-create-mc"]');
};
export const tableItems = () => {
@@ -29,7 +29,7 @@ export const popupGetCancelBtn = () => {
};
export const getMonitoringConfiguration = () => {
- return cy.get('div[data-tests-id="tableItemsMonitoringConfiguration"]');
+ return cy.get('div[data-tests-id="editMC"]');
};
export const doHoverOverFirstLine = () => {
@@ -45,7 +45,7 @@ export const doHoverOverFirstLineMonitoringConfiguration = () => {
return getMonitoringConfiguration();
};
-const NUMBER_OF_ITEMS = 12;
+const NUMBER_OF_ITEMS = 9;
const navigateButtonDisabled = () => {
return buttonCreateMC()
@@ -82,10 +82,131 @@ describe("Home Page - E2E test flow with mock", () => {
cy.saveMonitoringComponent();
});
- it("Edit VFCMT", () => {
- doHoverOverFirstLineMonitoringConfiguration()
+ it("Edit VFCMT icon visablity", () => {
+ doHoverOverFirstLine();
+ cy.get('[data-tests-id="editMC"').should("be.visible");
+ });
+ });
+
+ describe("Revert Mc table item", () => {
+ beforeEach(() => {
+ cy.getMCList();
+ cy.homePage();
+ cy.getMC();
+ cy.submitMonitoringComponent();
+ cy.saveMonitoringComponent();
+ });
+
+ it("should not see revert icon on version that is lower then 1.x", () => {
+ tableItems()
.first()
- .click({ force: true });
+ .trigger("mouseover");
+ cy.get('[data-tests-id="revertMC"').should("not.be.visible");
+ });
+
+ it("should get revert icon on version that is above then 1.x", () => {
+ tableItems()
+ .last()
+ .click()
+ .trigger("mouseover");
+ cy.get('[data-tests-id="revertMC"]').should("be.visible");
+ });
+ it("should get revert open model", () => {
+ tableItems()
+ .last()
+ .click()
+ .trigger("mouseover");
+ cy
+ .get('[data-tests-id="revertMC"]')
+ .should("be.visible")
+ .click({ force: true })
+ .get('[data-tests-id="revert-dialog-title"]')
+ .should("contain", "Are you sure you want to revert?");
+ });
+
+ it("should get revert open model clicking on cancel should close popup", () => {
+ tableItems()
+ .last()
+ .click()
+ .trigger("mouseover");
+ cy
+ .get('[data-tests-id="revertMC"]')
+ .should("be.visible")
+ .click({ force: true })
+ .get('[data-tests-id="revert-cancel"]')
+ .click()
+ .get('[data-tests-id="revert-dialog-title"]')
+ .should("not.be.visible");
+ });
+ });
+
+ describe("View only", () => {
+ beforeEach(() => {
+ cy.getMCList();
+ cy.homePage();
+ cy.getMC();
+ cy.submitMonitoringComponent();
+ cy.saveMonitoringComponent();
+ });
+
+ it("should not see view Submitted icon in 0.x version", () => {
+ tableItems()
+ .first()
+ .click()
+ .trigger("mouseover");
+ cy.get('[data-tests-id="viewSubmitted"]').should("not.be.visible");
+ });
+ it("should see view Submitted icon in 1.x version", () => {
+ tableItems()
+ .last()
+ .click()
+ .trigger("mouseover");
+ cy.get('[data-tests-id="viewSubmitted"]').should("be.visible");
+ });
+ it("should see view Submitted status in mc data page", () => {
+ tableItems()
+ .last()
+ .click()
+ .trigger("mouseover");
+ cy
+ .get('[data-tests-id="viewSubmitted"]')
+ .should("be.visible")
+ .click()
+ .get('[data-tests-id="viewOnlyLabel"]')
+ .should("contain", "view only");
+ });
+ it("save and submit buttons need to be disabled on view only mode", () => {
+ tableItems()
+ .last()
+ .click()
+ .trigger("mouseover");
+ cy
+ .get('[data-tests-id="viewSubmitted"]')
+ .should("be.visible")
+ .click()
+ .get('[data-tests-id="save-btn"]')
+ .should("be.disabled")
+ .get('[data-tests-id="submit-btn"]')
+ .should("be.disabled");
+ });
+ it("setting inputs need to be disabled on view only mode", () => {
+ tableItems()
+ .last()
+ .click()
+ .trigger("mouseover");
+ cy
+ .get('[data-tests-id="viewSubmitted"]')
+ .should("be.visible")
+ .click()
+ .get("#ui-tabpanel-1-label")
+ .should("be.visible")
+ .click()
+ .get('[data-tests-id="setting-gear"]')
+ .first()
+ .click()
+ .get(".field-text")
+ .first()
+ .should("be.disabled");
});
});
@@ -159,17 +280,17 @@ describe("Home Page - E2E test flow with mock", () => {
});
});
- describe("Show Info icon", () => {
- beforeEach(() => {
- cy.getMCList();
- cy.homePageCertified();
- });
- it("Mouse hover over item, delete is not visible, info visible", () => {
- doHoverOverFirstLine();
- tableItemsInfoButton().should("be.visible");
- tableItemsDeleteButton().should("not.be.visible");
- });
- });
+ // describe("Show Info icon", () => {
+ // beforeEach(() => {
+ // cy.getMCList();
+ // cy.homePageCertified();
+ // });
+ // it("Mouse hover over item, delete is not visible, info visible", () => {
+ // doHoverOverFirstLine();
+ // tableItemsInfoButton().should("be.visible");
+ // tableItemsDeleteButton().should("not.be.visible");
+ // });
+ // });
describe("Successfully Entry Home Page Monitoring Configuration", () => {
beforeEach(() => {
@@ -184,7 +305,8 @@ describe("Home Page - E2E test flow with mock", () => {
.and("be.visible")
.and("not.be.disabled");
- buttonCreateMCSpan()
+ cy
+ .get('[data-tests-id="btn-span-create-mc"]')
.should("contain", "Add First MC")
.and("be.visible")
.and("not.be.disabled");
diff --git a/cypress-docker/test/src/cypress/integration/mocks/newApp/ruleEngine-spec.js b/cypress-docker/test/src/cypress/integration/mocks/newApp/ruleEngine-spec.js
index 9be6636..f9645e3 100644
--- a/cypress-docker/test/src/cypress/integration/mocks/newApp/ruleEngine-spec.js
+++ b/cypress-docker/test/src/cypress/integration/mocks/newApp/ruleEngine-spec.js
@@ -16,9 +16,7 @@ function verifyCopyActionNotExist(actionType) {
.select(actionType)
.get('button[data-tests-id="btnAddAction"]')
.click();
- cy
- .get('[data-tests-id="makeCopyOfAction"]')
- .should("not.be.visible");
+ cy.get('[data-tests-id="makeCopyOfAction"]').should("not.be.visible");
}
export const selectVersionAndTypeAndAddFirstRule = () => {
@@ -185,18 +183,14 @@ describe("Rule engine - E2E test flow with mock", () => {
cy.httpGetDDLData();
cy.getMCListEmpty();
cy.homePage();
- cy
- .get('button[data-tests-id="btn-create-mc"]')
- .click();
+ cy.get('button[data-tests-id="btn-create-mc"]').click();
cy.fillNewMcForm();
cy.httpCreateNewMc();
cy.getPhases();
cy.httpGenerateMappingRulesFileName();
cy.httpTargetTree();
cy.emptyRuleEngine("Type1");
- cy
- .get('button[data-tests-id="createMonitoring"]')
- .click();
+ cy.get('button[data-tests-id="createMonitoring"]').click();
cy
.get("#ui-tabpanel-1-label")
.should("contain", "map")
@@ -206,9 +200,7 @@ describe("Rule engine - E2E test flow with mock", () => {
addCopyAction();
cy.getLatestMcUuid();
cy.doneSaveRule();
- cy
- .get('button[data-tests-id="btnDone"]')
- .click();
+ cy.get('button[data-tests-id="btnDone"]').click();
});
it("apply filter", () => {
@@ -233,9 +225,7 @@ describe("Rule engine - E2E test flow with mock", () => {
.click()
.get('[data-tests-id="removeConditionNode"]')
.click();
- cy
- .get('input[data-tests-id="left"]')
- .should("not.be.visible");
+ cy.get('input[data-tests-id="left"]').should("not.be.visible");
});
it("Delete filter with button delete", () => {
@@ -255,9 +245,7 @@ describe("Rule engine - E2E test flow with mock", () => {
.get('[data-tests-id="removeConditionNode"]')
.click();
- cy
- .get('input[data-tests-id="left"]')
- .should("not.be.visible");
+ cy.get('input[data-tests-id="left"]').should("not.be.visible");
});
});
@@ -342,25 +330,25 @@ describe("Rule engine - E2E test flow with mock", () => {
.get('button[data-tests-id="btnAddAction"]')
.click()
.get('[data-tests-id="searchField"]')
- .type("searchField", {force: true})
+ .type("searchField", { force: true })
.get('[data-tests-id="searchValue"]')
- .type("searchValue", {force: true})
+ .type("searchValue", { force: true })
.get('[data-tests-id="searchLeft"]')
- .type("searchLeft", {force: true})
+ .type("searchLeft", { force: true })
.get('[data-tests-id="searchOperator"]')
- .select("notEqual", {force: true})
+ .select("notEqual", { force: true })
.get('[data-tests-id="searchRight"]')
- .type("searchRight", {force: true})
+ .type("searchRight", { force: true })
.get('[data-tests-id="updatesKey"]')
- .type("updatesKey", {force: true})
+ .type("updatesKey", { force: true })
.get('[data-tests-id="updatesValue"]')
- .type("updatesValue", {force: true})
+ .type("updatesValue", { force: true })
.get('[data-tests-id="radioEnrich"]')
.click()
.get('[data-tests-id="searchFieldValue"]')
- .type("searchFieldValue", {force: true})
+ .type("searchFieldValue", { force: true })
.get('[data-tests-id="searchPrefix"]')
- .type("searchPrefix", {force: true});
+ .type("searchPrefix", { force: true });
});
it("add string transform action ", () => {
cy
@@ -1360,6 +1348,11 @@ describe("Rule engine - E2E test flow with mock", () => {
cy.get('button[data-tests-id="btnDone"]').click();
cy.wait("@doneSaveCopyRule").httpTransalte();
cy
+ .get('[data-tests-id="entryPhase"]')
+ .type("x")
+ .get('[data-tests-id="publishPhase"]')
+ .type("y");
+ cy
.get('button[data-tests-id="btnTranslate"]')
.click()
.get(".toast-container")
diff --git a/cypress-docker/test/src/cypress/support/homeCommands.js b/cypress-docker/test/src/cypress/support/homeCommands.js
index 77b4010..9e7f54e 100644
--- a/cypress-docker/test/src/cypress/support/homeCommands.js
+++ b/cypress-docker/test/src/cypress/support/homeCommands.js
@@ -1,7 +1,7 @@
// functionality
function sdcIsOwnerFalse() {
cy.visit(
- "home?userId=cs0008&userRole=DESIGNER&displayType=context&contextType=SERVICES&uu" +
+ "home?userId=ym903w&userRole=DESIGNER&displayType=context&contextType=SERVICES&uu" +
"id=06c7d927-4e2f-47e1-a29d-b6ed229ebc0a&lifecycleState=NOT_CERTIFIED_CHECKOUT&is" +
"Owner=false&version=0.1"
);
@@ -9,7 +9,7 @@ function sdcIsOwnerFalse() {
function sdcUserNotCheckout() {
cy.visit(
- "home?userId=cs0008&userRole=DESIGNER&displayType=context&contextType=SERVICES&uu" +
+ "home?userId=ym903w&userRole=DESIGNER&displayType=context&contextType=SERVICES&uu" +
"id=06c7d927-4e2f-47e1-a29d-b6ed229ebc0a&lifecycleState=READY_FOR_CERTIFICATION&i" +
"sOwner=true&version=0.1"
);
@@ -17,7 +17,7 @@ function sdcUserNotCheckout() {
function homePage() {
cy.visit(
- "home?userId=cs0008&userRole=DESIGNER&displayType=context&contextType=SERVICES&uu" +
+ "home?userId=ym903w&userRole=DESIGNER&displayType=context&contextType=SERVICES&uu" +
"id=06c7d927-4e2f-47e1-a29d-b6ed229ebc0a&lifecycleState=NOT_CERTIFIED_CHECKOUT&is" +
"Owner=true&version=0.1"
);
@@ -25,7 +25,7 @@ function homePage() {
function homePageCertified() {
cy.visit(
- "home?userId=cs0008&userRole=DESIGNER&displayType=context&contextType=SERVICES&uu" +
+ "home?userId=ym903w&userRole=DESIGNER&displayType=context&contextType=SERVICES&uu" +
"id=06c7d927-4e2f-47e1-a29d-b6ed229ebc0a&lifecycleState=CERTIFIED_CHECKOUT&isOwne" +
"r=true&version=0.1"
);
@@ -37,9 +37,7 @@ function deleteMonitoringComponent() {
.route({
method: "DELETE",
url:
- Cypress.env("backendUrl") +
- "/SERVICES/06c7d927-4e2f-47e1-a29d-b6ed229ebc0a/vfb53dd48360ff4fa2b66e6ceb1961bd9" +
- "b0/cba37ed8-94e1-406f-b4f5-b5edbc31ac85/deleteVfcmtReference",
+ Cypress.env("backendUrl") + "/SERVICES/**/**/**/deleteVfcmtReference",
response: "{}"
})
.as("deleteMonitoringComponent");
@@ -50,10 +48,7 @@ function saveMonitoringComponent() {
.server()
.route({
method: "POST",
- url:
- Cypress.env("backendUrl") +
- "/SERVICES/06c7d927-4e2f-47e1-a29d-b6ed229ebc0a/vfb53dd48360ff4fa2b66e6ceb1961bd9" +
- "b0/saveComposition/cba37ed8-94e1-406f-b4f5-b5edbc31ac85",
+ url: Cypress.env("backendUrl") + "/SERVICES/**/**/saveComposition/**",
response: "{}"
})
.as("saveMonitoringComponent");
@@ -64,10 +59,7 @@ function submitMonitoringComponent() {
.server()
.route({
method: "POST",
- url:
- Cypress.env("backendUrl") +
- "/SERVICES/createBluePrint/cba37ed8-94e1-406f-b4f5-b5edbc31ac85/06c7d927-4e2f-47e" +
- "1-a29d-b6ed229ebc0a/vfb53dd48360ff4fa2b66e6ceb1961bd9b0/",
+ url: Cypress.env("backendUrl") + "/SERVICES/createBluePrint/**/**/**/",
response: "{}"
})
.as("submitMonitoringComponent");
@@ -79,9 +71,7 @@ function deleteMonitoringComponentWithBlueprint() {
.route({
method: "DELETE",
url:
- Cypress.env("backendUrl") +
- "/SERVICES/06c7d927-4e2f-47e1-a29d-b6ed229ebc0a/dump0/64471437-8feb-40d9-a8b0-940" +
- "7a81dd5c0/deleteVfcmtReference",
+ Cypress.env("backendUrl") + "/SERVICES/**/**/**/deleteVfcmtReference",
response: "{}"
})
.as("deleteMonitoringComponentWithBlueprint");
@@ -92,12 +82,11 @@ function getMCList() {
.server()
.route({
method: "GET",
- url:
- Cypress.env("backendUrl") +
- "/SERVICES/06c7d927-4e2f-47e1-a29d-b6ed229ebc0a/0.1/monitoringComponents",
- response: "fixture:monitoringComponentsMock"
+ url: Cypress.env("backendUrl") + "/SERVICES/**/**/monitoringComponents",
+ response: "fixture:McTable"
})
.as("mcList");
+ // monitoringComponentsMock
}
function getMC() {
@@ -105,9 +94,7 @@ function getMC() {
.server()
.route({
method: "GET",
- url:
- Cypress.env("backendUrl") +
- "/getMC/cba37ed8-94e1-406f-b4f5-b5edbc31ac85",
+ url: Cypress.env("backendUrl") + "/getMC/**",
response: "fixture:getMCMock"
})
.as("getMC");
@@ -118,9 +105,7 @@ function getMCListEmpty() {
.server()
.route({
method: "GET",
- url:
- Cypress.env("backendUrl") +
- "/SERVICES/06c7d927-4e2f-47e1-a29d-b6ed229ebc0a/0.1/monitoringComponents",
+ url: Cypress.env("backendUrl") + "/SERVICES/**/**/monitoringComponents",
response: "{}"
})
.as("mcListEmpty");
diff --git a/src/main/java/org/onap/dcae/ci/api/tests/composition/SaveAndSubmitCompositionFullFlowTest.java b/src/main/java/org/onap/dcae/ci/api/tests/composition/SaveAndSubmitCompositionFullFlowTest.java
index f2d7a24..127c5aa 100644
--- a/src/main/java/org/onap/dcae/ci/api/tests/composition/SaveAndSubmitCompositionFullFlowTest.java
+++ b/src/main/java/org/onap/dcae/ci/api/tests/composition/SaveAndSubmitCompositionFullFlowTest.java
@@ -2,6 +2,7 @@ package org.onap.dcae.ci.api.tests.composition;
import com.aventstack.extentreports.Status;
+import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import org.onap.dcae.ci.api.tests.DcaeRestBaseTest;
import org.onap.dcae.ci.entities.RestResponse;
@@ -96,7 +97,9 @@ public class SaveAndSubmitCompositionFullFlowTest extends DcaeRestBaseTest {
Report.log(Status.INFO, "Verify service vfi has references to both mc versions");
Type typeToken = new TypeToken<Map<String, List<MonitoringComponent>>>(){}.getType();
Map<String, List<MonitoringComponent>> monitoringComponents = gson.fromJson(response.getResponse(), typeToken);
- assertThat(monitoringComponents.get("monitoringComponents").size()).isEqualTo(2);
+ assertThat(monitoringComponents.get("monitoringComponents").size()).isEqualTo(1);
+ MonitoringComponent monitoringComponent = monitoringComponents.get("monitoringComponents").get(0);
+ assertThat(monitoringComponent.getSubmittedUuid()).isEqualTo(initialUuid);
Report.log(Status.INFO, "About to re-submit the composition");
response = DcaeRestClient.submitComposition(request.getServiceUuid(), request.getVfiName(), mc.getUuid());
assertThat(response.getStatusCode())
@@ -111,7 +114,6 @@ public class SaveAndSubmitCompositionFullFlowTest extends DcaeRestBaseTest {
List<MonitoringComponent> mcList = monitoringComponents.get("monitoringComponents");
assertThat(mcList.size()).isEqualTo(1);
assertThat(mcList.get(0).getUuid()).isEqualTo(mc.getUuid());
-
}
@@ -132,7 +134,7 @@ public class SaveAndSubmitCompositionFullFlowTest extends DcaeRestBaseTest {
.isEqualTo(200);
CreateMcResponse mcResponse = gson.fromJson(response.getResponse(), CreateMcResponse.class);
- String initialUuid = mcResponse.getVfcmt().getUuid();
+ String initialUuid = mcResponse.getVfcmt().getUuid();
response = DcaeRestClient.getLatestMcUuid(request.getContextType(), request.getServiceUuid(), request.getVfiName(), initialUuid);
assertThat(response.getStatusCode())
@@ -149,6 +151,8 @@ public class SaveAndSubmitCompositionFullFlowTest extends DcaeRestBaseTest {
Type typeToken = new TypeToken<Map<String, List<MonitoringComponent>>>(){}.getType();
Map<String, List<MonitoringComponent>> monitoringComponents = gson.fromJson(response.getResponse(), typeToken);
assertThat(monitoringComponents.get("monitoringComponents").size()).isEqualTo(1);
+ MonitoringComponent monitoringComponent = monitoringComponents.get("monitoringComponents").get(0);
+ assertThat(monitoringComponent.getSubmittedUuid()).isNull();
Report.log(Status.INFO, "About to submit the composition");
response = DcaeRestClient.submitComposition(request.getServiceUuid(), request.getVfiName(), initialUuid);
assertThat(response.getStatusCode())
@@ -169,8 +173,129 @@ public class SaveAndSubmitCompositionFullFlowTest extends DcaeRestBaseTest {
Report.log(Status.INFO, "Verify service vfi has references to both mc versions");
monitoringComponents = gson.fromJson(response.getResponse(), typeToken);
- assertThat(monitoringComponents.get("monitoringComponents").size()).isEqualTo(2);
+ assertThat(monitoringComponents.get("monitoringComponents").size()).isEqualTo(1);
+ monitoringComponent = monitoringComponents.get("monitoringComponents").get(0);
+ assertThat(monitoringComponent.getSubmittedUuid()).isEqualTo(initialUuid);
}
+ @Test
+ public void revertOverwriteRevertedAndDeleteMcTest() throws IOException {
+
+ CreateVFCMTRequest request = new CreateVFCMTRequest();
+ // If you crashed here (below) it is because your environment has no Base Monitoring Templates
+ request.setTemplateUuid(baseTemplate.getUuid());
+ Service service = createServiceWithVFiAsSdcDesigner();
+ request.setVfiName(service.getResources().get(0).getResourceInstanceName());
+ request.setServiceUuid(service.getUuid());
+ DcaeRestClient.fillCreateMcRequestMandatoryFields(request);
+
+ RestResponse response = DcaeRestClient.createMc(gson.toJson(request));
+ assertThat(response.getStatusCode())
+ .as("status code")
+ .isEqualTo(200);
+
+ CreateMcResponse mcResponse = gson.fromJson(response.getResponse(), CreateMcResponse.class);
+ Report.log(Status.INFO, "Vfcmt created successfully. About to submit composition");
+ String initialUuid = mcResponse.getVfcmt().getUuid();
+
+ Report.log(Status.INFO, "About to submit the composition");
+ response = DcaeRestClient.submitComposition(request.getServiceUuid(), request.getVfiName(), initialUuid);
+ assertThat(response.getStatusCode())
+ .as("status code")
+ .isEqualTo(200);
+ // the submit action should certify the mc.
+ Report.log(Status.INFO, "Save new composition version after submit");
+ String nid = "12313";
+ response = DcaeRestClient.saveComposition(request.getServiceUuid(), request.getVfiName(), initialUuid, String.format("{\"nid\":\"%s\"}", nid));
+ assertThat(response.getStatusCode())
+ .as("status code")
+ .isEqualTo(200);
+ // the save action should promote the mc version to 1.1 and a new reference should be created - both references should be kept at this point
+ ResourceDetailed mc = gson.fromJson(response.getResponse(), ResourceDetailed.class);
+ assertThat(mc.getLifecycleState()).isEqualTo(DcaeBeConstants.LifecycleStateEnum.NOT_CERTIFIED_CHECKIN.name());
+ assertThat(mc.getVersion()).isEqualTo("1.1");
+ response = DcaeRestClient.saveRule(mc.getUuid(), "dcaeComp", nid, "configParam", "{version:4.1,eventType:syslogFields,description:newRule,actions:[{from:{state:closed,value:fromField,regex:\"\"},target:event.commonEventHeader.target,id:id,actionType:copy}]}");
+ assertThat(response.getStatusCode())
+ .as("status code")
+ .isEqualTo(200);
+ response = DcaeRestClient.getServiceExternalReferences(service.getUuid(), service.getVersion());
+ assertThat(response.getStatusCode())
+ .as("status code")
+ .isEqualTo(200);
+ Report.log(Status.INFO, "Verify service vfi has references to both mc versions");
+ Type typeToken = new TypeToken<Map<String, List<MonitoringComponent>>>(){}.getType();
+ Map<String, List<MonitoringComponent>> monitoringComponents = gson.fromJson(response.getResponse(), typeToken);
+ assertThat(monitoringComponents.get("monitoringComponents").size()).isEqualTo(1);
+ MonitoringComponent monitoringComponent = monitoringComponents.get("monitoringComponents").get(0);
+ String revertableUuid = monitoringComponent.getUuid();
+ assertThat(monitoringComponent.getSubmittedUuid()).isEqualTo(initialUuid);
+ Report.log(Status.INFO, "About to revert to the submitted composition");
+ response = DcaeRestClient.revertToSubmittedComposition(request.getServiceUuid(), request.getVfiName(), monitoringComponent.getUuid(), initialUuid);
+ assertThat(response.getStatusCode())
+ .as("status code")
+ .isEqualTo(200);
+ // a successful revert of the new version should result in the submitted MC referencing it
+ response = DcaeRestClient.getServiceExternalReferences(service.getUuid(), service.getVersion());
+ assertThat(response.getStatusCode())
+ .as("status code")
+ .isEqualTo(200);
+ monitoringComponents = gson.fromJson(response.getResponse(), typeToken);
+ List<MonitoringComponent> mcList = monitoringComponents.get("monitoringComponents");
+ assertThat(mcList.size()).isEqualTo(1);
+ monitoringComponent = monitoringComponents.get("monitoringComponents").get(0);
+ assertThat(monitoringComponent.getUuid()).isEqualTo(initialUuid.concat("/").concat(revertableUuid));
+ // before saving the composition the reverted MC has 3 artifacts - ref, cdump and rule.
+ response = DcaeRestClient.getResourceDetails(revertableUuid);
+ assertThat(response.getStatusCode())
+ .as("status code")
+ .isEqualTo(200);
+ mc = gson.fromJson(response.getResponse(), ResourceDetailed.class);
+ assertThat(mc.getArtifacts().size()).isEqualTo(3);
+ // after saving the composition the reverted MC should be overwritten by the initial version and only contain 2 artifacts - ref and cdump (no rule).
+ response = DcaeRestClient.saveComposition(service.getUuid(), request.getVfiName(), monitoringComponent.getUuid(), gson.toJson(mcResponse.getCdump()));
+ assertThat(response.getStatusCode())
+ .as("status code")
+ .isEqualTo(200);
+ response = DcaeRestClient.getResourceDetails(revertableUuid);
+ assertThat(response.getStatusCode())
+ .as("status code")
+ .isEqualTo(200);
+ mc = gson.fromJson(response.getResponse(), ResourceDetailed.class);
+ assertThat(mc.getArtifacts().size()).isEqualTo(2);
+ // a save rule request should now fail with the provided nid as the composition has been reset to the initial one
+ response = DcaeRestClient.saveRule(mc.getUuid(), "dcaeComp", nid, "configParam", "{version:4.1,eventType:syslogFields,description:newRule,actions:[{from:{state:closed,value:fromField,regex:\"\"},target:event.commonEventHeader.target,id:id,actionType:copy}]}");
+ assertThat(response.getStatusCode())
+ .as("status code")
+ .isEqualTo(400);
+ assertThat(response.getResponse()).isEqualTo("{\"requestError\":{\"serviceException\":{\"messageId\":\"SVC6114\",\"text\":\"DCAE component %1 not found in composition\",\"variables\":[\"dcaeComp\"],\"formattedErrorMessage\":\"DCAE component dcaeComp not found in composition\"}},\"notes\":\"\"}");
+ response = DcaeRestClient.getServiceExternalReferences(service.getUuid(), service.getVersion());
+ assertThat(response.getStatusCode())
+ .as("status code")
+ .isEqualTo(200);
+ monitoringComponents = gson.fromJson(response.getResponse(), typeToken);
+ mcList = monitoringComponents.get("monitoringComponents");
+ assertThat(mcList.size()).isEqualTo(1);
+ monitoringComponent = monitoringComponents.get("monitoringComponents").get(0);
+ assertThat(monitoringComponent.getUuid()).isEqualTo(revertableUuid);
+ // revert again and then delete. table should be empty
+ Report.log(Status.INFO, "About to revert to the submitted composition");
+ response = DcaeRestClient.revertToSubmittedComposition(request.getServiceUuid(), request.getVfiName(), revertableUuid, initialUuid);
+ assertThat(response.getStatusCode())
+ .as("status code")
+ .isEqualTo(200);
+ monitoringComponent = gson.fromJson(response.getResponse(), MonitoringComponent.class);
+ Report.log(Status.INFO, "About to delete the submitted MC");
+ response = DcaeRestClient.deleteMcReferenceAndBP(monitoringComponent.getName(), request.getServiceUuid(), request.getVfiName(), monitoringComponent.getUuid());
+ assertThat(response.getStatusCode())
+ .as("status code")
+ .isEqualTo(200);
+ response = DcaeRestClient.getServiceExternalReferences(service.getUuid(), service.getVersion());
+ assertThat(response.getStatusCode())
+ .as("status code")
+ .isEqualTo(200);
+ monitoringComponents = gson.fromJson(response.getResponse(), typeToken);
+ mcList = monitoringComponents.get("monitoringComponents");
+ assertThat(mcList.size()).isEqualTo(0);
+ }
}
diff --git a/src/main/java/org/onap/dcae/ci/api/tests/configuration/ConfigurationControllerApiTest.java b/src/main/java/org/onap/dcae/ci/api/tests/configuration/ConfigurationControllerApiTest.java
index 62e7e6b..550d32e 100644
--- a/src/main/java/org/onap/dcae/ci/api/tests/configuration/ConfigurationControllerApiTest.java
+++ b/src/main/java/org/onap/dcae/ci/api/tests/configuration/ConfigurationControllerApiTest.java
@@ -1,7 +1,6 @@
package org.onap.dcae.ci.api.tests.configuration;
import com.aventstack.extentreports.Status;
-import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import org.onap.dcae.ci.api.tests.DcaeRestBaseTest;
import org.onap.dcae.ci.entities.RestResponse;
diff --git a/src/main/java/org/onap/dcae/ci/utilities/DcaeRestClient.java b/src/main/java/org/onap/dcae/ci/utilities/DcaeRestClient.java
index d754dfd..88fbd4d 100644
--- a/src/main/java/org/onap/dcae/ci/utilities/DcaeRestClient.java
+++ b/src/main/java/org/onap/dcae/ci/utilities/DcaeRestClient.java
@@ -169,10 +169,24 @@ public class DcaeRestClient extends BaseRestUtils {
public static RestResponse getComposition(String componentId) throws IOException{
return sendGet(getApiUrl("/getComposition/"+ componentId), designerDefaultId);
}
+
public static RestResponse submitComposition(String componentId, String serviceUuid, String vnfiName, String monitoringType) throws IOException{
return sendPost(getApiUrl("/createBluePrint/"+ componentId +"/"+ serviceUuid +"/"+ UrlEscapers.urlFragmentEscaper().escape(vnfiName) + "/"+ UrlEscapers.urlFragmentEscaper().escape(monitoringType)), "" ,designerDefaultId, "application/json");
}
+ public static RestResponse revertToSubmittedComposition(String serviceUuid, String vnfiName, String vfcmtUuid, String submittedUuid) throws IOException{
+ return sendPost(getApiUrl("/service/" + serviceUuid +"/"+ UrlEscapers.urlFragmentEscaper().escape(vnfiName) + "/"+ vfcmtUuid + "/revert/" + submittedUuid), "" ,designerDefaultId, "application/json");
+ }
+
+ public static RestResponse deleteMcReferenceAndBP(String mcName, String serviceUuid, String vnfiName, String vfcmtUuid) throws IOException{
+ return sendDelete(getApiUrl("/service/" + mcName + "/" + serviceUuid +"/"+ UrlEscapers.urlFragmentEscaper().escape(vnfiName) + "/"+ vfcmtUuid + "/deleteVfcmtReference"), designerDefaultId);
+ }
+
+ public static RestResponse deleteMcReferenceAndBP(String mcName, String serviceUuid, String vnfiName, String vfcmtUuid, String submittedUuid) throws IOException{
+ return sendDelete(getApiUrl(String.format("/service/%s/%s/%s/%s/deleteVfcmtReference/%s", mcName, serviceUuid, UrlEscapers.urlFragmentEscaper().escape(vnfiName), vfcmtUuid, submittedUuid)), designerDefaultId);
+ }
+
+
/* Life Cycle */
public static RestResponse checkinVfcmt(String vfcmtUuid, String userId) throws IOException {