From 663b617aa8b703d07a5ce1be0028510870128981 Mon Sep 17 00:00:00 2001 From: AlokTechno Date: Fri, 26 Jun 2020 16:34:18 +0530 Subject: [PATCH 1/6] createMISP class added just for testing --- .../src/main/java/io/mosip/pmp/tests/CreateMISP.java | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 automationtests/src/main/java/io/mosip/pmp/tests/CreateMISP.java diff --git a/automationtests/src/main/java/io/mosip/pmp/tests/CreateMISP.java b/automationtests/src/main/java/io/mosip/pmp/tests/CreateMISP.java new file mode 100644 index 0000000000..50c9af64d6 --- /dev/null +++ b/automationtests/src/main/java/io/mosip/pmp/tests/CreateMISP.java @@ -0,0 +1,5 @@ +package io.mosip.pmp.tests; + +public class CreateMISP { + +} From d537ae889d2eb6d9b212c3c953e2ebc609892357 Mon Sep 17 00:00:00 2001 From: AlokTechno Date: Fri, 26 Jun 2020 20:55:24 +0530 Subject: [PATCH 2/6] MISP Management service : automation script added --- .../mosip/admin/fw/util/AdminRunConfig.java | 49 ++++ .../authentication/fw/util/IdaRunConfig.java | 40 ++++ .../authentication/fw/util/RunConfig.java | 10 + .../idRepository/fw/util/IdRepoRunConfig.java | 48 ++++ .../mosip/pmp/fw/util/PartnerRunConfig.java | 72 ++++++ .../tests/ActivateDeactivateMISPLincense.java | 197 ++++++++++++++++ .../java/io/mosip/pmp/tests/ApproveMISP.java | 198 ++++++++++++++++ .../java/io/mosip/pmp/tests/CreateMISP.java | 194 +++++++++++++++- .../java/io/mosip/pmp/tests/RejectMISP.java | 207 +++++++++++++++++ .../mosip/pmp/tests/RetrieveMISPByMispID.java | 213 ++++++++++++++++++ .../java/io/mosip/pmp/tests/UpdateMISP.java | 196 ++++++++++++++++ .../mosip/pmp/tests/ValidateMISPLicense.java | 198 ++++++++++++++++ .../resident/fw/util/ResidentRunConfig.java | 47 ++++ .../config/partnerQueries.properties | 12 + .../input/activate-misp-request.json | 11 + .../mapping.properties | 16 ++ .../output-1-expected-error-response.json | 13 ++ .../output-1-expected-pos-response.json | 10 + ...ActivateDeactivateMISPLincense.mapping.yml | 16 ++ .../input/approve-misp-request.json | 9 + .../TestData/ApproveMISP/mapping.properties | 18 ++ .../output-1-expected-error-response.json | 13 ++ .../output-1-expected-pos-response.json | 16 ++ .../testdata.partner.ApproveMISP.mapping.yml | 34 +++ .../CreateMISP/input/create-misp-request.json | 13 ++ .../TestData/CreateMISP/mapping.properties | 17 ++ .../output-1-expected-error-response.json | 13 ++ .../output-1-expected-pos-response.json | 11 + .../testdata.partner.CreateMISP.mapping.yml | 17 ++ .../RejectMISP/input/reject-misp-request.json | 9 + .../TestData/RejectMISP/mapping.properties | 18 ++ .../output-1-expected-error-response.json | 13 ++ .../output-1-expected-pos-response.json | 16 ++ .../testdata.partner.RejectMISP.mapping.yml | 34 +++ .../input/retrieve-misp-by-id-request.json | 3 + .../RetrieveMISPByMispID/mapping.properties | 36 +++ .../output-1-expected-error-response.json | 13 ++ .../output-1-expected-pos-response.json | 43 ++++ ...a.partner.RetrieveMISPByMispID.mapping.yml | 33 +++ .../RunConfig/envRunConfig.properties | 9 + .../RunConfig/runConfiguration.properties | 31 +++ .../UpdateMISP/input/update-misp-request.json | 17 ++ .../TestData/UpdateMISP/mapping.properties | 23 ++ .../output-1-expected-error-response.json | 13 ++ .../output-1-expected-pos-response.json | 14 ++ .../testdata.partner.UpdateMISP.mapping.yml | 23 ++ .../input/validate-misp-license-request.json | 9 + .../ValidateMISPLicense/mapping.properties | 20 ++ .../output-1-expected-error-response.json | 13 ++ .../output-1-expected-pos-response.json | 18 ++ ...ta.partner.ValidateMISPLicense.mapping.yml | 38 ++++ automationtests/testNgXmlFiles/partnerApi.xml | 9 + 52 files changed, 2362 insertions(+), 1 deletion(-) create mode 100644 automationtests/src/main/java/io/mosip/pmp/tests/ActivateDeactivateMISPLincense.java create mode 100644 automationtests/src/main/java/io/mosip/pmp/tests/ApproveMISP.java create mode 100644 automationtests/src/main/java/io/mosip/pmp/tests/RejectMISP.java create mode 100644 automationtests/src/main/java/io/mosip/pmp/tests/RetrieveMISPByMispID.java create mode 100644 automationtests/src/main/java/io/mosip/pmp/tests/UpdateMISP.java create mode 100644 automationtests/src/main/java/io/mosip/pmp/tests/ValidateMISPLicense.java create mode 100644 automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/input/activate-misp-request.json create mode 100644 automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/mapping.properties create mode 100644 automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/output/output-1-expected-error-response.json create mode 100644 automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/output/output-1-expected-pos-response.json create mode 100644 automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/testdata.partner.ActivateDeactivateMISPLincense.mapping.yml create mode 100644 automationtests/src/main/resources/partner/TestData/ApproveMISP/input/approve-misp-request.json create mode 100644 automationtests/src/main/resources/partner/TestData/ApproveMISP/mapping.properties create mode 100644 automationtests/src/main/resources/partner/TestData/ApproveMISP/output/output-1-expected-error-response.json create mode 100644 automationtests/src/main/resources/partner/TestData/ApproveMISP/output/output-1-expected-pos-response.json create mode 100644 automationtests/src/main/resources/partner/TestData/ApproveMISP/testdata.partner.ApproveMISP.mapping.yml create mode 100644 automationtests/src/main/resources/partner/TestData/CreateMISP/input/create-misp-request.json create mode 100644 automationtests/src/main/resources/partner/TestData/CreateMISP/mapping.properties create mode 100644 automationtests/src/main/resources/partner/TestData/CreateMISP/output/output-1-expected-error-response.json create mode 100644 automationtests/src/main/resources/partner/TestData/CreateMISP/output/output-1-expected-pos-response.json create mode 100644 automationtests/src/main/resources/partner/TestData/CreateMISP/testdata.partner.CreateMISP.mapping.yml create mode 100644 automationtests/src/main/resources/partner/TestData/RejectMISP/input/reject-misp-request.json create mode 100644 automationtests/src/main/resources/partner/TestData/RejectMISP/mapping.properties create mode 100644 automationtests/src/main/resources/partner/TestData/RejectMISP/output/output-1-expected-error-response.json create mode 100644 automationtests/src/main/resources/partner/TestData/RejectMISP/output/output-1-expected-pos-response.json create mode 100644 automationtests/src/main/resources/partner/TestData/RejectMISP/testdata.partner.RejectMISP.mapping.yml create mode 100644 automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/input/retrieve-misp-by-id-request.json create mode 100644 automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/mapping.properties create mode 100644 automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/output/output-1-expected-error-response.json create mode 100644 automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/output/output-1-expected-pos-response.json create mode 100644 automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/testdata.partner.RetrieveMISPByMispID.mapping.yml create mode 100644 automationtests/src/main/resources/partner/TestData/UpdateMISP/input/update-misp-request.json create mode 100644 automationtests/src/main/resources/partner/TestData/UpdateMISP/mapping.properties create mode 100644 automationtests/src/main/resources/partner/TestData/UpdateMISP/output/output-1-expected-error-response.json create mode 100644 automationtests/src/main/resources/partner/TestData/UpdateMISP/output/output-1-expected-pos-response.json create mode 100644 automationtests/src/main/resources/partner/TestData/UpdateMISP/testdata.partner.UpdateMISP.mapping.yml create mode 100644 automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/input/validate-misp-license-request.json create mode 100644 automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/mapping.properties create mode 100644 automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/output/output-1-expected-error-response.json create mode 100644 automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/output/output-1-expected-pos-response.json create mode 100644 automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/testdata.partner.ValidateMISPLicense.mapping.yml diff --git a/automationtests/src/main/java/io/mosip/admin/fw/util/AdminRunConfig.java b/automationtests/src/main/java/io/mosip/admin/fw/util/AdminRunConfig.java index 58e1f0c188..cf7e954b82 100644 --- a/automationtests/src/main/java/io/mosip/admin/fw/util/AdminRunConfig.java +++ b/automationtests/src/main/java/io/mosip/admin/fw/util/AdminRunConfig.java @@ -2096,4 +2096,53 @@ public String getUpdateTheStatusActivateDeactivateForTheGivenPolicyIdPath() { // TODO Auto-generated method stub return null; } + + + @Override + public String getCreateMISPPath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setUpdateMISPPath(String updateMISPPath) { + // TODO Auto-generated method stub + + } + + @Override + public String getUpdateMISPPath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getValidateMISPLicensePath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getApproveMISPPath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getRejectMISPPath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getActivateMISPLicense() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getRetrieveMISPByMispIDPath() { + // TODO Auto-generated method stub + return null; + } } diff --git a/automationtests/src/main/java/io/mosip/authentication/fw/util/IdaRunConfig.java b/automationtests/src/main/java/io/mosip/authentication/fw/util/IdaRunConfig.java index c9c660de49..6b6ec9e55a 100644 --- a/automationtests/src/main/java/io/mosip/authentication/fw/util/IdaRunConfig.java +++ b/automationtests/src/main/java/io/mosip/authentication/fw/util/IdaRunConfig.java @@ -1682,4 +1682,44 @@ public String getUpdateTheStatusActivateDeactivateForTheGivenPolicyIdPath() { // TODO Auto-generated method stub return null; } + @Override + public String getCreateMISPPath() { + // TODO Auto-generated method stub + return null; + } + @Override + public void setUpdateMISPPath(String updateMISPPath) { + // TODO Auto-generated method stub + + } + @Override + public String getUpdateMISPPath() { + // TODO Auto-generated method stub + return null; + } + @Override + public String getValidateMISPLicensePath() { + // TODO Auto-generated method stub + return null; + } + @Override + public String getApproveMISPPath() { + // TODO Auto-generated method stub + return null; + } + @Override + public String getRejectMISPPath() { + // TODO Auto-generated method stub + return null; + } + @Override + public String getActivateMISPLicense() { + // TODO Auto-generated method stub + return null; + } + @Override + public String getRetrieveMISPByMispIDPath() { + // TODO Auto-generated method stub + return null; + } } diff --git a/automationtests/src/main/java/io/mosip/authentication/fw/util/RunConfig.java b/automationtests/src/main/java/io/mosip/authentication/fw/util/RunConfig.java index b85e082539..b81a87900b 100644 --- a/automationtests/src/main/java/io/mosip/authentication/fw/util/RunConfig.java +++ b/automationtests/src/main/java/io/mosip/authentication/fw/util/RunConfig.java @@ -554,4 +554,14 @@ public abstract class RunConfig { public abstract void setUpdateTheStatusActivateDeactivateForTheGivenPolicyIdPath(String updateTheStatusActivateDeactivateForTheGivenPolicyIdPath); public abstract String getUpdateTheStatusActivateDeactivateForTheGivenPolicyIdPath(); + + public abstract String getCreateMISPPath(); + public abstract void setUpdateMISPPath(String updateMISPPath); + public abstract String getUpdateMISPPath(); + public abstract String getValidateMISPLicensePath(); + public abstract String getApproveMISPPath(); + public abstract String getRejectMISPPath(); + public abstract String getActivateMISPLicense(); + public abstract String getRetrieveMISPByMispIDPath(); + } diff --git a/automationtests/src/main/java/io/mosip/authentication/idRepository/fw/util/IdRepoRunConfig.java b/automationtests/src/main/java/io/mosip/authentication/idRepository/fw/util/IdRepoRunConfig.java index 7545e9f550..bea38f2570 100644 --- a/automationtests/src/main/java/io/mosip/authentication/idRepository/fw/util/IdRepoRunConfig.java +++ b/automationtests/src/main/java/io/mosip/authentication/idRepository/fw/util/IdRepoRunConfig.java @@ -1864,4 +1864,52 @@ public String getUpdateTheStatusActivateDeactivateForTheGivenPolicyIdPath() { // TODO Auto-generated method stub return null; } + + @Override + public String getCreateMISPPath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setUpdateMISPPath(String updateMISPPath) { + // TODO Auto-generated method stub + + } + + @Override + public String getUpdateMISPPath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getValidateMISPLicensePath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getApproveMISPPath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getRejectMISPPath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getActivateMISPLicense() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getRetrieveMISPByMispIDPath() { + // TODO Auto-generated method stub + return null; + } } diff --git a/automationtests/src/main/java/io/mosip/pmp/fw/util/PartnerRunConfig.java b/automationtests/src/main/java/io/mosip/pmp/fw/util/PartnerRunConfig.java index b7df661c4a..82458ab9a6 100644 --- a/automationtests/src/main/java/io/mosip/pmp/fw/util/PartnerRunConfig.java +++ b/automationtests/src/main/java/io/mosip/pmp/fw/util/PartnerRunConfig.java @@ -119,6 +119,71 @@ public class PartnerRunConfig extends RunConfig { private String updateExistingPolicyForPolicyGroupPath; private String updateTheStatusActivateDeactivateForTheGivenPolicyIdPath; + private String createMISPPath; + private String updateMISPPath; + private String validateMISPLicensePath; + private String approveMISPPath; + private String rejectMISPPath; + private String activateMISPLicense; + private String retrieveMISPByMispIDPath; + + public String getRetrieveMISPByMispIDPath() { + return retrieveMISPByMispIDPath; + } + + public void setRetrieveMISPByMispIDPath(String retrieveMISPByMispIDPath) { + this.retrieveMISPByMispIDPath = retrieveMISPByMispIDPath; + } + + public String getActivateMISPLicense() { + return activateMISPLicense; + } + + public void setActivateMISPLicense(String activateMISPLicense) { + this.activateMISPLicense = activateMISPLicense; + } + + public String getRejectMISPPath() { + return rejectMISPPath; + } + + public void setRejectMISPPath(String rejectMISPPath) { + this.rejectMISPPath = rejectMISPPath; + } + + public String getApproveMISPPath() { + return approveMISPPath; + } + + public void setApproveMISPPath(String approveMISPPath) { + this.approveMISPPath = approveMISPPath; + } + + public String getValidateMISPLicensePath() { + return validateMISPLicensePath; + } + + public void setValidateMISPLicensePath(String validateMISPLicensePath) { + this.validateMISPLicensePath = validateMISPLicensePath; + } + + public String getUpdateMISPPath() { + return updateMISPPath; + } + + public void setUpdateMISPPath(String updateMISPPath) { + this.updateMISPPath = updateMISPPath; + } + + public String getCreateMISPPath() { + return createMISPPath; + } + + public void setCreateMISPPath(String createMISPPath) { + this.createMISPPath = createMISPPath; + } + + public String getUpdateTheStatusActivateDeactivateForTheGivenPolicyIdPath() { return updateTheStatusActivateDeactivateForTheGivenPolicyIdPath; } @@ -363,6 +428,13 @@ public void setConfig(String testDataPath, String testDataFileName, String testT setUpdateExistingPolicyForPolicyGroupPath(PartnerTestUtil.getPropertyValue("updateExistingPolicyForPolicyGroupPath")); setUpdateTheStatusActivateDeactivateForTheGivenPolicyIdPath(PartnerTestUtil.getPropertyValue("updateTheStatusActivateDeactivateForTheGivenPolicyIdPath")); + setCreateMISPPath(PartnerTestUtil.getPropertyValue("createMISPPath")); + setUpdateMISPPath(PartnerTestUtil.getPropertyValue("updateMISPPath")); + setValidateMISPLicensePath(PartnerTestUtil.getPropertyValue("validateMISPLicensePath")); + setApproveMISPPath(PartnerTestUtil.getPropertyValue("approveMISPPath")); + setRejectMISPPath(PartnerTestUtil.getPropertyValue("rejectMISPPath")); + setActivateMISPLicense(PartnerTestUtil.getPropertyValue("activateMISPLicense")); + setRetrieveMISPByMispIDPath(PartnerTestUtil.getPropertyValue("retrieveMISPByMispIDPath")); } private void setFilePathFromTestdataFileName(File filePath, String testDataPath) { diff --git a/automationtests/src/main/java/io/mosip/pmp/tests/ActivateDeactivateMISPLincense.java b/automationtests/src/main/java/io/mosip/pmp/tests/ActivateDeactivateMISPLincense.java new file mode 100644 index 0000000000..a8dfbf293a --- /dev/null +++ b/automationtests/src/main/java/io/mosip/pmp/tests/ActivateDeactivateMISPLincense.java @@ -0,0 +1,197 @@ +package io.mosip.pmp.tests; + +import java.io.File; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.testng.ITest; +import org.testng.ITestResult; +import org.testng.Reporter; +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import org.testng.internal.BaseTestMethod; +import org.testng.internal.TestResult; + +import io.mosip.admin.fw.util.AdminTestException; +import io.mosip.authentication.fw.dto.OutputValidationDto; +import io.mosip.authentication.fw.util.AuthenticationTestException; +import io.mosip.authentication.fw.util.DataProviderClass; +import io.mosip.authentication.fw.util.FileUtil; +import io.mosip.authentication.fw.util.OutputValidationUtil; +import io.mosip.authentication.fw.util.ReportUtil; +import io.mosip.authentication.fw.util.RunConfigUtil; +import io.mosip.authentication.fw.util.TestParameters; +import io.mosip.authentication.testdata.TestDataProcessor; +import io.mosip.kernel.util.KernelDataBaseAccess; +import io.mosip.pmp.fw.util.PartnerTestUtil; + +public class ActivateDeactivateMISPLincense extends PartnerTestUtil implements ITest { + private static final Logger logger = Logger.getLogger(ActivateDeactivateMISPLincense.class); + protected String testCaseName = ""; + private String TESTDATA_PATH; + private String TESTDATA_FILENAME; + private String testType; + private int invocationCount = 0; + KernelDataBaseAccess masterDB = new KernelDataBaseAccess(); + + /** + * Set Test Type - Smoke, Regression or Integration + * + * @param testType + */ + @BeforeClass + public void setTestType() { + this.testType = RunConfigUtil.getTestLevel(); + String createMISIPQuery = partnerQueries.get("createMISP").toString(); + String validateMISIPLicenceQuery = partnerQueries.get("validateMISPLicence").toString(); + if (masterDB.executeQuery(createMISIPQuery, "pmp") + && masterDB.executeQuery(validateMISIPLicenceQuery, "pmp")) + logger.info("misp Activated successfully using query from partnerQueries.properties"); + else + logger.info("not able to Activate misp using query from partnerQueries.properties"); + + } + + /** + * Method set Test data path and its filename + * + * @param index + */ + public void setTestDataPathsAndFileNames(int index) { + this.TESTDATA_PATH = getTestDataPath(getClass().getSimpleName().toString(), index); + this.TESTDATA_FILENAME = getTestDataFileName(getClass().getSimpleName().toString(), index); + } + + /** + * Method set configuration + * + * @param testType + */ + public void setConfigurations(String testType) { + RunConfigUtil.getRunConfigObject("partner"); + RunConfigUtil.objRunConfig.setConfig(this.TESTDATA_PATH, this.TESTDATA_FILENAME, testType); + TestDataProcessor.initateTestDataProcess(this.TESTDATA_FILENAME, this.TESTDATA_PATH, "partner"); + } + + /** + * The method set test case name + * + * @param method + * @param testData + */ + @BeforeMethod + public void testData(Method method, Object[] testData) { + String testCase = ""; + if (testData != null && testData.length > 0) { + TestParameters testParams = null; + // Check if test method has actually received required parameters + for (Object testParameter : testData) { + if (testParameter instanceof TestParameters) { + testParams = (TestParameters) testParameter; + break; + } + } + if (testParams != null) { + testCase = testParams.getTestCaseName(); + } + } + testCaseName = String.format(testCase); + if(!kernelCmnLib.isValidToken(partnerCookie)) + partnerCookie = kernelAuthLib.getAuthForPartner(); + } + + /** + * Data provider class provides test case list + * + * @return object of data provider + */ + @DataProvider(name = "testcaselist") + public Object[][] getTestCaseList() { + invocationCount++; + setTestDataPathsAndFileNames(invocationCount); + setConfigurations(testType); + return DataProviderClass.getDataProvider( + RunConfigUtil.getResourcePath() + RunConfigUtil.objRunConfig.getScenarioPath(), + RunConfigUtil.objRunConfig.getScenarioPath(), RunConfigUtil.objRunConfig.getTestType()); + } + + /** + * Set current testcaseName + */ + @Override + public String getTestName() { + return testCaseName; + } + + /** + * The method ser current test name to result + * + * @param result + */ + @AfterMethod(alwaysRun = true) + public void setResultTestName(ITestResult result) { + try { + Field method = TestResult.class.getDeclaredField("m_method"); + method.setAccessible(true); + method.set(result, result.getMethod().clone()); + BaseTestMethod baseTestMethod = (BaseTestMethod) result.getMethod(); + Field f = baseTestMethod.getClass().getSuperclass().getDeclaredField("m_methodName"); + f.setAccessible(true); + f.set(baseTestMethod, testCaseName); + } catch (Exception e) { + Reporter.log("Exception : " + e.getMessage()); + } + } + + /** + * Test method for OTP Generation execution + * + * @param objTestParameters + * @param testScenario + * @param testcaseName + * @throws AuthenticationTestException + * @throws AdminTestException + */ + @Test(dataProvider = "testcaselist") + public void ActivateDeactiveMISPLicense(TestParameters objTestParameters, String testScenario, String testcaseName) throws AuthenticationTestException, AdminTestException { + File testCaseName = objTestParameters.getTestCaseFile(); + int testCaseNumber = Integer.parseInt(objTestParameters.getTestId()); + displayLog(testCaseName, testCaseNumber); + setTestFolder(testCaseName); + setTestCaseId(testCaseNumber); + setTestCaseName(testCaseName.getName()); + displayContentInFile(testCaseName.listFiles(), "request"); + String url=RunConfigUtil.objRunConfig.getAdminEndPointUrl() + RunConfigUtil.objRunConfig.getActivateMISPLicense(); + logger.info("******Post request Json to EndPointUrl: " + url+ + " *******"); + putRequestAndGenerateOuputFileWithCookie(testCaseName.listFiles(), url, "request", "output-1-actual-response", 0, AUTHORIZATHION_COOKIENAME, partnerCookie); + Map> ouputValid = OutputValidationUtil.doOutputValidation( + FileUtil.getFilePath(testCaseName, "output-1-actual").toString(), + FileUtil.getFilePath(testCaseName, "output-1-expected").toString()); + Reporter.log(ReportUtil.getOutputValiReport(ouputValid)); + if(!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); +} + /** + * this method is for deleting or updating the inserted data in db for testing + * (managing class level data not test case level data) + * @throws AdminTestException + */ + @AfterClass(alwaysRun = true) + public void cleanup() throws AdminTestException { + if (masterDB.executeQuery(partnerQueries.get("deleteValidateMISPLicence").toString(), "pmp") + && masterDB.executeQuery(partnerQueries.get("deleteMISP").toString(), "pmp")) + logger.info("deleted all activated misp data successfully"); + else { + logger.info("not able to delete activated misp data using query from query.properties"); + } + logger.info("END"); + } +} diff --git a/automationtests/src/main/java/io/mosip/pmp/tests/ApproveMISP.java b/automationtests/src/main/java/io/mosip/pmp/tests/ApproveMISP.java new file mode 100644 index 0000000000..5faeee8464 --- /dev/null +++ b/automationtests/src/main/java/io/mosip/pmp/tests/ApproveMISP.java @@ -0,0 +1,198 @@ +package io.mosip.pmp.tests; + +import java.io.File; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.testng.ITest; +import org.testng.ITestResult; +import org.testng.Reporter; +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import org.testng.internal.BaseTestMethod; +import org.testng.internal.TestResult; + +import io.mosip.admin.fw.util.AdminTestException; +import io.mosip.authentication.fw.dto.OutputValidationDto; +import io.mosip.authentication.fw.util.AuthenticationTestException; +import io.mosip.authentication.fw.util.DataProviderClass; +import io.mosip.authentication.fw.util.FileUtil; +import io.mosip.authentication.fw.util.OutputValidationUtil; +import io.mosip.authentication.fw.util.ReportUtil; +import io.mosip.authentication.fw.util.RunConfigUtil; +import io.mosip.authentication.fw.util.TestParameters; +import io.mosip.authentication.testdata.TestDataProcessor; +import io.mosip.kernel.util.KernelDataBaseAccess; +import io.mosip.pmp.fw.util.PartnerTestUtil; + +public class ApproveMISP extends PartnerTestUtil implements ITest { + private static final Logger logger = Logger.getLogger(ApproveMISP.class); + protected String testCaseName = ""; + private String TESTDATA_PATH; + private String TESTDATA_FILENAME; + private String testType; + private int invocationCount = 0; + KernelDataBaseAccess masterDB = new KernelDataBaseAccess(); + + /** + * Set Test Type - Smoke, Regression or Integration + * + * @param testType + */ + @BeforeClass + public void setTestType() { + this.testType = RunConfigUtil.getTestLevel(); + String createMISIPQuery = partnerQueries.get("createMISP").toString(); + String validateMISIPLicenceQuery = partnerQueries.get("validateMISPLicence").toString(); + if (masterDB.executeQuery(createMISIPQuery, "pmp") + && masterDB.executeQuery(validateMISIPLicenceQuery, "pmp")) + logger.info("ApproveMISP Test successfully using query from partnerQueries.properties"); + else + logger.info("not able to ApproveMISP using query from partnerQueries.properties"); + + } + + /** + * Method set Test data path and its filename + * + * @param index + */ + public void setTestDataPathsAndFileNames(int index) { + this.TESTDATA_PATH = getTestDataPath(getClass().getSimpleName().toString(), index); + this.TESTDATA_FILENAME = getTestDataFileName(getClass().getSimpleName().toString(), index); + } + + /** + * Method set configuration + * + * @param testType + */ + public void setConfigurations(String testType) { + RunConfigUtil.getRunConfigObject("partner"); + RunConfigUtil.objRunConfig.setConfig(this.TESTDATA_PATH, this.TESTDATA_FILENAME, testType); + TestDataProcessor.initateTestDataProcess(this.TESTDATA_FILENAME, this.TESTDATA_PATH, "partner"); + } + + /** + * The method set test case name + * + * @param method + * @param testData + */ + @BeforeMethod + public void testData(Method method, Object[] testData) { + String testCase = ""; + if (testData != null && testData.length > 0) { + TestParameters testParams = null; + // Check if test method has actually received required parameters + for (Object testParameter : testData) { + if (testParameter instanceof TestParameters) { + testParams = (TestParameters) testParameter; + break; + } + } + if (testParams != null) { + testCase = testParams.getTestCaseName(); + } + } + testCaseName = String.format(testCase); + if(!kernelCmnLib.isValidToken(partnerCookie)) + partnerCookie = kernelAuthLib.getAuthForPartner(); + } + + /** + * Data provider class provides test case list + * + * @return object of data provider + */ + @DataProvider(name = "testcaselist") + public Object[][] getTestCaseList() { + invocationCount++; + setTestDataPathsAndFileNames(invocationCount); + setConfigurations(testType); + return DataProviderClass.getDataProvider( + RunConfigUtil.getResourcePath() + RunConfigUtil.objRunConfig.getScenarioPath(), + RunConfigUtil.objRunConfig.getScenarioPath(), RunConfigUtil.objRunConfig.getTestType()); + } + + /** + * Set current testcaseName + */ + @Override + public String getTestName() { + return testCaseName; + } + + /** + * The method ser current test name to result + * + * @param result + */ + @AfterMethod(alwaysRun = true) + public void setResultTestName(ITestResult result) { + try { + Field method = TestResult.class.getDeclaredField("m_method"); + method.setAccessible(true); + method.set(result, result.getMethod().clone()); + BaseTestMethod baseTestMethod = (BaseTestMethod) result.getMethod(); + Field f = baseTestMethod.getClass().getSuperclass().getDeclaredField("m_methodName"); + f.setAccessible(true); + f.set(baseTestMethod, testCaseName); + } catch (Exception e) { + Reporter.log("Exception : " + e.getMessage()); + } + } + + /** + * Test method for OTP Generation execution + * + * @param objTestParameters + * @param testScenario + * @param testcaseName + * @throws AuthenticationTestException + * @throws AdminTestException + */ + @Test(dataProvider = "testcaselist") + public void approveMISP(TestParameters objTestParameters, String testScenario, String testcaseName) throws AuthenticationTestException, AdminTestException { + File testCaseName = objTestParameters.getTestCaseFile(); + int testCaseNumber = Integer.parseInt(objTestParameters.getTestId()); + displayLog(testCaseName, testCaseNumber); + setTestFolder(testCaseName); + setTestCaseId(testCaseNumber); + setTestCaseName(testCaseName.getName()); + displayContentInFile(testCaseName.listFiles(), "request"); + String url=RunConfigUtil.objRunConfig.getAdminEndPointUrl() + RunConfigUtil.objRunConfig.getApproveMISPPath(); + logger.info("******Patch request Json to EndPointUrl: " + url+ + " *******"); + patchRequestAndGenerateOuputFileWithCookie(testCaseName.listFiles(), url, "request", "output-1-actual-response", 0, AUTHORIZATHION_COOKIENAME, partnerCookie); + + Map> ouputValid = OutputValidationUtil.doOutputValidation( + FileUtil.getFilePath(testCaseName, "output-1-actual").toString(), + FileUtil.getFilePath(testCaseName, "output-1-expected").toString()); + Reporter.log(ReportUtil.getOutputValiReport(ouputValid)); + if(!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); +} + /** + * this method is for deleting or updating the inserted data in db for testing + * (managing class level data not test case level data) + * @throws AdminTestException + */ + @AfterClass(alwaysRun = true) + public void cleanup() throws AdminTestException { + if (masterDB.executeQuery(partnerQueries.get("deleteValidateMISPLicence").toString(), "pmp") + && masterDB.executeQuery(partnerQueries.get("deleteMISP").toString(), "pmp")) + logger.info("deleted all ApproveMISP data successfully"); + else { + logger.info("not able to delete ApproveMISP data using query from query.properties"); + } + logger.info("END"); + } +} \ No newline at end of file diff --git a/automationtests/src/main/java/io/mosip/pmp/tests/CreateMISP.java b/automationtests/src/main/java/io/mosip/pmp/tests/CreateMISP.java index 50c9af64d6..5af87b4b08 100644 --- a/automationtests/src/main/java/io/mosip/pmp/tests/CreateMISP.java +++ b/automationtests/src/main/java/io/mosip/pmp/tests/CreateMISP.java @@ -1,5 +1,197 @@ package io.mosip.pmp.tests; -public class CreateMISP { +import java.io.File; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; +import org.apache.log4j.Logger; +import org.testng.ITest; +import org.testng.ITestResult; +import org.testng.Reporter; +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import org.testng.internal.BaseTestMethod; +import org.testng.internal.TestResult; + +import io.mosip.admin.fw.util.AdminTestException; +import io.mosip.authentication.fw.dto.OutputValidationDto; +import io.mosip.authentication.fw.util.AuthenticationTestException; +import io.mosip.authentication.fw.util.DataProviderClass; +import io.mosip.authentication.fw.util.FileUtil; +import io.mosip.authentication.fw.util.OutputValidationUtil; +import io.mosip.authentication.fw.util.ReportUtil; +import io.mosip.authentication.fw.util.RunConfigUtil; +import io.mosip.authentication.fw.util.TestParameters; +import io.mosip.authentication.testdata.TestDataProcessor; +import io.mosip.kernel.util.KernelDataBaseAccess; +import io.mosip.pmp.fw.util.PartnerTestUtil; + +public class CreateMISP extends PartnerTestUtil implements ITest { + private static final Logger logger = Logger.getLogger(RegisterPartner.class); + protected String testCaseName = ""; + private String TESTDATA_PATH; + private String TESTDATA_FILENAME; + private String testType; + private int invocationCount = 0; + KernelDataBaseAccess masterDB = new KernelDataBaseAccess(); + + /** + * Set Test Type - Smoke, Regression or Integration + * + * @param testType + */ + @BeforeClass + public void setTestType() { + this.testType = RunConfigUtil.getTestLevel(); + /* + * String query = partnerQueries.get("registerPartner").toString(); if + * (masterDB.executeQuery(query, "pmp")) logger. + * info("register partner with id as Test successfully using query from partnerQueries.properties" + * ); else logger. + * info("not able to register partner using query from partnerQueries.properties" + * ); + */ + } + + /** + * Method set Test data path and its filename + * + * @param index + */ + public void setTestDataPathsAndFileNames(int index) { + this.TESTDATA_PATH = getTestDataPath(getClass().getSimpleName().toString(), index); + this.TESTDATA_FILENAME = getTestDataFileName(getClass().getSimpleName().toString(), index); + } + + /** + * Method set configuration + * + * @param testType + */ + public void setConfigurations(String testType) { + RunConfigUtil.getRunConfigObject("partner"); + RunConfigUtil.objRunConfig.setConfig(this.TESTDATA_PATH, this.TESTDATA_FILENAME, testType); + TestDataProcessor.initateTestDataProcess(this.TESTDATA_FILENAME, this.TESTDATA_PATH, "partner"); + } + + /** + * The method set test case name + * + * @param method + * @param testData + */ + @BeforeMethod + public void testData(Method method, Object[] testData) { + String testCase = ""; + if (testData != null && testData.length > 0) { + TestParameters testParams = null; + // Check if test method has actually received required parameters + for (Object testParameter : testData) { + if (testParameter instanceof TestParameters) { + testParams = (TestParameters) testParameter; + break; + } + } + if (testParams != null) { + testCase = testParams.getTestCaseName(); + } + } + testCaseName = String.format(testCase); + if(!kernelCmnLib.isValidToken(partnerCookie)) + partnerCookie = kernelAuthLib.getAuthForPartner(); + } + + /** + * Data provider class provides test case list + * + * @return object of data provider + */ + @DataProvider(name = "testcaselist") + public Object[][] getTestCaseList() { + invocationCount++; + setTestDataPathsAndFileNames(invocationCount); + setConfigurations(testType); + return DataProviderClass.getDataProvider( + RunConfigUtil.getResourcePath() + RunConfigUtil.objRunConfig.getScenarioPath(), + RunConfigUtil.objRunConfig.getScenarioPath(), RunConfigUtil.objRunConfig.getTestType()); + } + + /** + * Set current testcaseName + */ + @Override + public String getTestName() { + return testCaseName; + } + + /** + * The method ser current test name to result + * + * @param result + */ + @AfterMethod(alwaysRun = true) + public void setResultTestName(ITestResult result) { + try { + Field method = TestResult.class.getDeclaredField("m_method"); + method.setAccessible(true); + method.set(result, result.getMethod().clone()); + BaseTestMethod baseTestMethod = (BaseTestMethod) result.getMethod(); + Field f = baseTestMethod.getClass().getSuperclass().getDeclaredField("m_methodName"); + f.setAccessible(true); + f.set(baseTestMethod, testCaseName); + } catch (Exception e) { + Reporter.log("Exception : " + e.getMessage()); + } + } + + /** + * Test method for OTP Generation execution + * + * @param objTestParameters + * @param testScenario + * @param testcaseName + * @throws AuthenticationTestException + * @throws AdminTestException + */ + @Test(dataProvider = "testcaselist") + public void createMISP(TestParameters objTestParameters, String testScenario, String testcaseName) throws AuthenticationTestException, AdminTestException { + File testCaseName = objTestParameters.getTestCaseFile(); + int testCaseNumber = Integer.parseInt(objTestParameters.getTestId()); + displayLog(testCaseName, testCaseNumber); + setTestFolder(testCaseName); + setTestCaseId(testCaseNumber); + setTestCaseName(testCaseName.getName()); + displayContentInFile(testCaseName.listFiles(), "request"); + String url=RunConfigUtil.objRunConfig.getAdminEndPointUrl() + RunConfigUtil.objRunConfig.getCreateMISPPath(); + logger.info("******Post request Json to EndPointUrl: " + url+ + " *******"); + postRequestAndGenerateOuputFileWithCookie(testCaseName.listFiles(), url, "request", "output-1-actual-response", 0, AUTHORIZATHION_COOKIENAME, partnerCookie); + + Map> ouputValid = OutputValidationUtil.doOutputValidation( + FileUtil.getFilePath(testCaseName, "output-1-actual").toString(), + FileUtil.getFilePath(testCaseName, "output-1-expected").toString()); + Reporter.log(ReportUtil.getOutputValiReport(ouputValid)); + if(!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); +} + /** + * this method is for deleting or updating the inserted data in db for testing + * (managing class level data not test case level data) + * @throws AdminTestException + */ + @AfterClass(alwaysRun = true) + public void cleanup() throws AdminTestException { + if (masterDB.executeQuery(partnerQueries.get("deleteMISP").toString(), "pmp")) + logger.info("deleted all created misp data successfully"); + else { + logger.info("not able to delete created misp data using query from query.properties"); + } + logger.info("END"); + } } diff --git a/automationtests/src/main/java/io/mosip/pmp/tests/RejectMISP.java b/automationtests/src/main/java/io/mosip/pmp/tests/RejectMISP.java new file mode 100644 index 0000000000..818577c5d1 --- /dev/null +++ b/automationtests/src/main/java/io/mosip/pmp/tests/RejectMISP.java @@ -0,0 +1,207 @@ +package io.mosip.pmp.tests; + +import java.io.File; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.testng.ITest; +import org.testng.ITestResult; +import org.testng.Reporter; +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import org.testng.internal.BaseTestMethod; +import org.testng.internal.TestResult; + +import io.mosip.admin.fw.util.AdminTestException; +import io.mosip.authentication.fw.dto.OutputValidationDto; +import io.mosip.authentication.fw.util.AuthenticationTestException; +import io.mosip.authentication.fw.util.DataProviderClass; +import io.mosip.authentication.fw.util.FileUtil; +import io.mosip.authentication.fw.util.OutputValidationUtil; +import io.mosip.authentication.fw.util.ReportUtil; +import io.mosip.authentication.fw.util.RunConfigUtil; +import io.mosip.authentication.fw.util.TestParameters; +import io.mosip.authentication.testdata.TestDataProcessor; +import io.mosip.kernel.util.KernelDataBaseAccess; +import io.mosip.pmp.fw.util.PartnerTestUtil; + +public class RejectMISP extends PartnerTestUtil implements ITest { + private static final Logger logger = Logger.getLogger(RejectMISP.class); + protected String testCaseName = ""; + private String TESTDATA_PATH; + private String TESTDATA_FILENAME; + private String testType; + private int invocationCount = 0; + KernelDataBaseAccess masterDB = new KernelDataBaseAccess(); + + /** + * Set Test Type - Smoke, Regression or Integration + * + * @param testType + */ + @BeforeClass + public void setTestType() { + + this.testType = RunConfigUtil.getTestLevel(); + String createMISIPQuery = partnerQueries.get("createMISP").toString(); + //String validateMISIPLicenceQuery = partnerQueries.get("validateMISPLicence").toString(); + if (masterDB.executeQuery(createMISIPQuery, "pmp") + //&& masterDB.executeQuery(validateMISIPLicenceQuery, "pmp") + ) + + logger.info("RejectMISP Test successfully using query from partnerQueries.properties"); + else + logger.info("not able to RejectMISP using query from partnerQueries.properties"); + + } + + /** + * Method set Test data path and its filename + * + * @param index + */ + public void setTestDataPathsAndFileNames(int index) { + this.TESTDATA_PATH = getTestDataPath(getClass().getSimpleName().toString(), index); + this.TESTDATA_FILENAME = getTestDataFileName(getClass().getSimpleName().toString(), index); + } + + /** + * Method set configuration + * + * @param testType + */ + public void setConfigurations(String testType) { + RunConfigUtil.getRunConfigObject("partner"); + RunConfigUtil.objRunConfig.setConfig(this.TESTDATA_PATH, this.TESTDATA_FILENAME, testType); + TestDataProcessor.initateTestDataProcess(this.TESTDATA_FILENAME, this.TESTDATA_PATH, "partner"); + } + + /** + * The method set test case name + * + * @param method + * @param testData + */ + @BeforeMethod + public void testData(Method method, Object[] testData) { + String testCase = ""; + if (testData != null && testData.length > 0) { + TestParameters testParams = null; + // Check if test method has actually received required parameters + for (Object testParameter : testData) { + if (testParameter instanceof TestParameters) { + testParams = (TestParameters) testParameter; + break; + } + } + if (testParams != null) { + testCase = testParams.getTestCaseName(); + } + } + testCaseName = String.format(testCase); + if (!kernelCmnLib.isValidToken(partnerCookie)) + partnerCookie = kernelAuthLib.getAuthForPartner(); + } + + /** + * Data provider class provides test case list + * + * @return object of data provider + */ + @DataProvider(name = "testcaselist") + public Object[][] getTestCaseList() { + invocationCount++; + setTestDataPathsAndFileNames(invocationCount); + setConfigurations(testType); + return DataProviderClass.getDataProvider( + RunConfigUtil.getResourcePath() + RunConfigUtil.objRunConfig.getScenarioPath(), + RunConfigUtil.objRunConfig.getScenarioPath(), RunConfigUtil.objRunConfig.getTestType()); + } + + /** + * Set current testcaseName + */ + @Override + public String getTestName() { + return testCaseName; + } + + /** + * The method ser current test name to result + * + * @param result + */ + @AfterMethod(alwaysRun = true) + public void setResultTestName(ITestResult result) { + try { + Field method = TestResult.class.getDeclaredField("m_method"); + method.setAccessible(true); + method.set(result, result.getMethod().clone()); + BaseTestMethod baseTestMethod = (BaseTestMethod) result.getMethod(); + Field f = baseTestMethod.getClass().getSuperclass().getDeclaredField("m_methodName"); + f.setAccessible(true); + f.set(baseTestMethod, testCaseName); + } catch (Exception e) { + Reporter.log("Exception : " + e.getMessage()); + } + } + + /** + * Test method for OTP Generation execution + * + * @param objTestParameters + * @param testScenario + * @param testcaseName + * @throws AuthenticationTestException + * @throws AdminTestException + */ + @Test(dataProvider = "testcaselist") + public void rejectMISP(TestParameters objTestParameters, String testScenario, String testcaseName) + throws AuthenticationTestException, AdminTestException { + File testCaseName = objTestParameters.getTestCaseFile(); + int testCaseNumber = Integer.parseInt(objTestParameters.getTestId()); + displayLog(testCaseName, testCaseNumber); + setTestFolder(testCaseName); + setTestCaseId(testCaseNumber); + setTestCaseName(testCaseName.getName()); + displayContentInFile(testCaseName.listFiles(), "request"); + String url = RunConfigUtil.objRunConfig.getAdminEndPointUrl() + RunConfigUtil.objRunConfig.getRejectMISPPath(); + logger.info("******Patch request Json to EndPointUrl: " + url + " *******"); + patchRequestAndGenerateOuputFileWithCookie(testCaseName.listFiles(), url, "request", "output-1-actual-response", + 0, AUTHORIZATHION_COOKIENAME, partnerCookie); + + Map> ouputValid = OutputValidationUtil.doOutputValidation( + FileUtil.getFilePath(testCaseName, "output-1-actual").toString(), + FileUtil.getFilePath(testCaseName, "output-1-expected").toString()); + Reporter.log(ReportUtil.getOutputValiReport(ouputValid)); + if (!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + } + /** + * this method is for deleting or updating the inserted data in db for testing + * (managing class level data not test case level data) + * + * @throws AdminTestException + */ + + @AfterClass(alwaysRun = true) + public void cleanup() throws AdminTestException { + if ( + //masterDB.executeQuery(partnerQueries.get("deleteValidateMISPLicence").toString(), "pmp") && + masterDB.executeQuery(partnerQueries.get("deleteMISP").toString(), "pmp") + ) + logger.info("deleted all RejectMISP data successfully"); + else { + logger.info("not able to delete RejectMISP data using query from query.properties"); + } + logger.info("END"); + } + +} \ No newline at end of file diff --git a/automationtests/src/main/java/io/mosip/pmp/tests/RetrieveMISPByMispID.java b/automationtests/src/main/java/io/mosip/pmp/tests/RetrieveMISPByMispID.java new file mode 100644 index 0000000000..7925e47c37 --- /dev/null +++ b/automationtests/src/main/java/io/mosip/pmp/tests/RetrieveMISPByMispID.java @@ -0,0 +1,213 @@ +package io.mosip.pmp.tests; + +import java.io.File; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.testng.ITest; +import org.testng.ITestResult; +import org.testng.Reporter; +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import org.testng.internal.BaseTestMethod; +import org.testng.internal.TestResult; + +import io.mosip.admin.fw.util.AdminTestException; +import io.mosip.authentication.fw.dto.OutputValidationDto; +import io.mosip.authentication.fw.util.AuthenticationTestException; +import io.mosip.authentication.fw.util.DataProviderClass; +import io.mosip.authentication.fw.util.FileUtil; +import io.mosip.authentication.fw.util.OutputValidationUtil; +import io.mosip.authentication.fw.util.ReportUtil; +import io.mosip.authentication.fw.util.RunConfigUtil; +import io.mosip.authentication.fw.util.TestParameters; +import io.mosip.authentication.testdata.TestDataProcessor; +import io.mosip.authentication.testdata.TestDataUtil; +import io.mosip.kernel.util.KernelDataBaseAccess; +import io.mosip.pmp.fw.util.PartnerTestUtil; + +public class RetrieveMISPByMispID extends PartnerTestUtil implements ITest { + private static final Logger logger = Logger.getLogger(RetrieveMISPByMispID.class); + protected static String testCaseName = ""; + private String TESTDATA_PATH; + private String TESTDATA_FILENAME; + private String testType; + private int invocationCount = 0; + KernelDataBaseAccess masterDB = new KernelDataBaseAccess(); + + /** + * Set Test Type - Smoke, Regression or Integration + * + * @param testType + */ + @BeforeClass + public void setTestType() { + this.testType = RunConfigUtil.getTestLevel(); + String createMISIPQuery = partnerQueries.get("createMISP").toString(); + String validateMISIPLicenceQuery = partnerQueries.get("validateMISPLicence").toString(); + if (masterDB.executeQuery(createMISIPQuery, "pmp") + && masterDB.executeQuery(validateMISIPLicenceQuery, "pmp")) + logger.info("RetrieveMISPByMispID Test successfully using query from partnerQueries.properties"); + else + logger.info("not able to RetrieveMISPByMispID using query from partnerQueries.properties"); + } + + /** + * Method set Test data path and its filename + * + * @param index + */ + public void setTestDataPathsAndFileNames(int index) { + this.TESTDATA_PATH = getTestDataPath(getClass().getSimpleName().toString(), index); + this.TESTDATA_FILENAME = getTestDataFileName(getClass().getSimpleName().toString(), index); + } + + /** + * Method set configuration + * + * @param testType + */ + public void setConfigurations(String testType) { + RunConfigUtil.getRunConfigObject("partner"); + RunConfigUtil.objRunConfig.setConfig(this.TESTDATA_PATH, this.TESTDATA_FILENAME, testType); + TestDataProcessor.initateTestDataProcess(this.TESTDATA_FILENAME, this.TESTDATA_PATH, "partner"); + } + + /** + * The method set test case name + * + * @param method + * @param testData + */ + @BeforeMethod + public void testData(Method method, Object[] testData) { + String testCase = ""; + if (testData != null && testData.length > 0) { + TestParameters testParams = null; + // Check if test method has actually received required parameters + for (Object testParameter : testData) { + if (testParameter instanceof TestParameters) { + testParams = (TestParameters) testParameter; + break; + } + } + if (testParams != null) { + testCase = testParams.getTestCaseName(); + } + } + testCaseName = String.format(testCase); + } + + /** + * Data provider class provides test case list + * + * @return object of data provider + */ + @DataProvider(name = "testcaselist") + public Object[][] getTestCaseList() { + System.out.println("inside dataprovider"); + invocationCount++; + setTestDataPathsAndFileNames(invocationCount); + setConfigurations(testType); + return DataProviderClass.getDataProvider( + RunConfigUtil.getResourcePath() + RunConfigUtil.objRunConfig.getScenarioPath(), + RunConfigUtil.objRunConfig.getScenarioPath(), RunConfigUtil.objRunConfig.getTestType()); + } + + /** + * Set current testcaseName + */ + @Override + public String getTestName() { + return testCaseName; + } + + /** + * The method ser current test name to result + * + * @param result + */ + @AfterMethod(alwaysRun = true) + public void setResultTestName(ITestResult result) { + try { + Field method = TestResult.class.getDeclaredField("m_method"); + method.setAccessible(true); + method.set(result, result.getMethod().clone()); + BaseTestMethod baseTestMethod = (BaseTestMethod) result.getMethod(); + Field f = baseTestMethod.getClass().getSuperclass().getDeclaredField("m_methodName"); + f.setAccessible(true); + f.set(baseTestMethod, testCaseName); + } catch (Exception e) { + Reporter.log("Exception : " + e.getMessage()); + } + } + + /** + * Test method for OTP Generation execution + * + * @param objTestParameters + * @param testScenario + * @param testcaseName + * @throws AuthenticationTestException + * @throws AdminTestException + */ + @Test(dataProvider = "testcaselist") + public void retrieveMISPByMispID(TestParameters objTestParameters, String testScenario, String testcaseName) throws AuthenticationTestException, AdminTestException { + File testCaseName = objTestParameters.getTestCaseFile(); + int testCaseNumber = Integer.parseInt(objTestParameters.getTestId()); + String cookieValue=null; + displayLog(testCaseName, testCaseNumber); + setTestFolder(testCaseName); + setTestCaseId(testCaseNumber); + setTestCaseName(testCaseName.getName()); + //String mapping = TestDataUtil.getMappingPath(); + displayContentInFile(testCaseName.listFiles(), "request"); + String url = RunConfigUtil.objRunConfig.getAdminEndPointUrl() + RunConfigUtil.objRunConfig.getRetrieveMISPByMispIDPath(); + logger.info("******Get request Json to EndPointUrl: " + url+" *******"); + if(testcaseName.contains("smoke")) + { + cookieValue = getAuthorizationCookie(getCookieRequestFilePath("northZonalPartner"),"https://"+ + System.getProperty("env.user")+".mosip.io/v1/authmanager/authenticate/useridPwd",AUTHORIZATHION_COOKIENAME); + } + else if (testcaseName.toLowerCase().contains("northuser")) { + cookieValue = getAuthorizationCookie(getCookieRequestFilePath("northZonalPartner"),"https://"+ + System.getProperty("env.user")+".mosip.io/v1/authmanager/authenticate/useridPwd",AUTHORIZATHION_COOKIENAME); + } + else if (testcaseName.toLowerCase().contains("nozonemap")) { + cookieValue = getAuthorizationCookie(getCookieRequestFilePath("noZoneMap"),"https://"+ + System.getProperty("env.user")+".mosip.io/v1/authmanager/authenticate/useridPwd",AUTHORIZATHION_COOKIENAME); + } + else + { + cookieValue = getAuthorizationCookie(getCookieRequestFilePath("northZonalPartner"), + System.getProperty("env.endpoint")+"/v1/authmanager/authenticate/useridPwd",AUTHORIZATHION_COOKIENAME); + } + getRequestAndGenerateOuputFileWithCookie(testCaseName.listFiles(), url,"request", "output-1-actual-response", 0, AUTHORIZATHION_COOKIENAME, + cookieValue); + Map> ouputValid = OutputValidationUtil.doOutputValidation( + FileUtil.getFilePath(testCaseName, "output-1-actual").toString(), + FileUtil.getFilePath(testCaseName, "output-1-expected").toString()); + Reporter.log(ReportUtil.getOutputValiReport(ouputValid)); + if(!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); + + } + + @AfterClass(alwaysRun = true) + public void cleanup() throws AdminTestException { + if (masterDB.executeQuery(partnerQueries.get("deleteValidateMISPLicence").toString(), "pmp") + && masterDB.executeQuery(partnerQueries.get("deleteMISP").toString(), "pmp")) + logger.info("deleted all MispID data successfully"); + else { + logger.info("not able to delete MispID data using query from query.properties"); + } + logger.info("END"); + } +} \ No newline at end of file diff --git a/automationtests/src/main/java/io/mosip/pmp/tests/UpdateMISP.java b/automationtests/src/main/java/io/mosip/pmp/tests/UpdateMISP.java new file mode 100644 index 0000000000..ca5a72dec2 --- /dev/null +++ b/automationtests/src/main/java/io/mosip/pmp/tests/UpdateMISP.java @@ -0,0 +1,196 @@ +package io.mosip.pmp.tests; + +import java.io.File; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.testng.ITest; +import org.testng.ITestResult; +import org.testng.Reporter; +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import org.testng.internal.BaseTestMethod; +import org.testng.internal.TestResult; + +import io.mosip.admin.fw.util.AdminTestException; +import io.mosip.authentication.fw.dto.OutputValidationDto; +import io.mosip.authentication.fw.util.AuthenticationTestException; +import io.mosip.authentication.fw.util.DataProviderClass; +import io.mosip.authentication.fw.util.FileUtil; +import io.mosip.authentication.fw.util.OutputValidationUtil; +import io.mosip.authentication.fw.util.ReportUtil; +import io.mosip.authentication.fw.util.RunConfigUtil; +import io.mosip.authentication.fw.util.TestParameters; +import io.mosip.authentication.testdata.TestDataProcessor; +import io.mosip.kernel.util.KernelDataBaseAccess; +import io.mosip.pmp.fw.util.PartnerTestUtil; + +public class UpdateMISP extends PartnerTestUtil implements ITest { + private static final Logger logger = Logger.getLogger(RegisterPartner.class); + protected String testCaseName = ""; + private String TESTDATA_PATH; + private String TESTDATA_FILENAME; + private String testType; + private int invocationCount = 0; + KernelDataBaseAccess masterDB = new KernelDataBaseAccess(); + + /** + * Set Test Type - Smoke, Regression or Integration + * + * @param testType + */ + @BeforeClass + public void setTestType() { + this.testType = RunConfigUtil.getTestLevel(); + + String query = partnerQueries.get("createMISP").toString(); + if(masterDB.executeQuery(query, "pmp")) + logger.info("misp updated successfully using query from partnerQueries.properties"); + else + logger.info("not able to update misp using query from partnerQueries.properties"); + + } + + /** + * Method set Test data path and its filename + * + * @param index + */ + public void setTestDataPathsAndFileNames(int index) { + this.TESTDATA_PATH = getTestDataPath(getClass().getSimpleName().toString(), index); + this.TESTDATA_FILENAME = getTestDataFileName(getClass().getSimpleName().toString(), index); + } + + /** + * Method set configuration + * + * @param testType + */ + public void setConfigurations(String testType) { + RunConfigUtil.getRunConfigObject("partner"); + RunConfigUtil.objRunConfig.setConfig(this.TESTDATA_PATH, this.TESTDATA_FILENAME, testType); + TestDataProcessor.initateTestDataProcess(this.TESTDATA_FILENAME, this.TESTDATA_PATH, "partner"); + } + + /** + * The method set test case name + * + * @param method + * @param testData + */ + @BeforeMethod + public void testData(Method method, Object[] testData) { + String testCase = ""; + if (testData != null && testData.length > 0) { + TestParameters testParams = null; + // Check if test method has actually received required parameters + for (Object testParameter : testData) { + if (testParameter instanceof TestParameters) { + testParams = (TestParameters) testParameter; + break; + } + } + if (testParams != null) { + testCase = testParams.getTestCaseName(); + } + } + testCaseName = String.format(testCase); + if(!kernelCmnLib.isValidToken(partnerCookie)) + partnerCookie = kernelAuthLib.getAuthForPartner(); + } + + /** + * Data provider class provides test case list + * + * @return object of data provider + */ + @DataProvider(name = "testcaselist") + public Object[][] getTestCaseList() { + invocationCount++; + setTestDataPathsAndFileNames(invocationCount); + setConfigurations(testType); + return DataProviderClass.getDataProvider( + RunConfigUtil.getResourcePath() + RunConfigUtil.objRunConfig.getScenarioPath(), + RunConfigUtil.objRunConfig.getScenarioPath(), RunConfigUtil.objRunConfig.getTestType()); + } + + /** + * Set current testcaseName + */ + @Override + public String getTestName() { + return testCaseName; + } + + /** + * The method ser current test name to result + * + * @param result + */ + @AfterMethod(alwaysRun = true) + public void setResultTestName(ITestResult result) { + try { + Field method = TestResult.class.getDeclaredField("m_method"); + method.setAccessible(true); + method.set(result, result.getMethod().clone()); + BaseTestMethod baseTestMethod = (BaseTestMethod) result.getMethod(); + Field f = baseTestMethod.getClass().getSuperclass().getDeclaredField("m_methodName"); + f.setAccessible(true); + f.set(baseTestMethod, testCaseName); + } catch (Exception e) { + Reporter.log("Exception : " + e.getMessage()); + } + } + + /** + * Test method for OTP Generation execution + * + * @param objTestParameters + * @param testScenario + * @param testcaseName + * @throws AuthenticationTestException + * @throws AdminTestException + */ + @Test(dataProvider = "testcaselist") + public void updateMISP(TestParameters objTestParameters, String testScenario, String testcaseName) throws AuthenticationTestException, AdminTestException { + File testCaseName = objTestParameters.getTestCaseFile(); + int testCaseNumber = Integer.parseInt(objTestParameters.getTestId()); + displayLog(testCaseName, testCaseNumber); + setTestFolder(testCaseName); + setTestCaseId(testCaseNumber); + setTestCaseName(testCaseName.getName()); + displayContentInFile(testCaseName.listFiles(), "request"); + String url=RunConfigUtil.objRunConfig.getAdminEndPointUrl() + RunConfigUtil.objRunConfig.getUpdateMISPPath(); + logger.info("******Post request Json to EndPointUrl: " + url+ + " *******"); + putRequestAndGenerateOuputFileWithCookie(testCaseName.listFiles(), url, "request", "output-1-actual-response", 0, AUTHORIZATHION_COOKIENAME, partnerCookie); + + Map> ouputValid = OutputValidationUtil.doOutputValidation( + FileUtil.getFilePath(testCaseName, "output-1-actual").toString(), + FileUtil.getFilePath(testCaseName, "output-1-expected").toString()); + Reporter.log(ReportUtil.getOutputValiReport(ouputValid)); + if(!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); +} + /** + * this method is for deleting or updating the inserted data in db for testing + * (managing class level data not test case level data) + * @throws AdminTestException + */ + @AfterClass(alwaysRun = true) + public void cleanup() throws AdminTestException { + if (masterDB.executeQuery(partnerQueries.get("deleteMISP").toString(), "pmp")) + logger.info("deleted all created misp data successfully"); + else { + logger.info("not able to delete created misp data using query from query.properties"); + } + logger.info("END"); + } +} diff --git a/automationtests/src/main/java/io/mosip/pmp/tests/ValidateMISPLicense.java b/automationtests/src/main/java/io/mosip/pmp/tests/ValidateMISPLicense.java new file mode 100644 index 0000000000..ec63958c81 --- /dev/null +++ b/automationtests/src/main/java/io/mosip/pmp/tests/ValidateMISPLicense.java @@ -0,0 +1,198 @@ +package io.mosip.pmp.tests; + +import java.io.File; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.testng.ITest; +import org.testng.ITestResult; +import org.testng.Reporter; +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import org.testng.internal.BaseTestMethod; +import org.testng.internal.TestResult; + +import io.mosip.admin.fw.util.AdminTestException; +import io.mosip.authentication.fw.dto.OutputValidationDto; +import io.mosip.authentication.fw.util.AuthenticationTestException; +import io.mosip.authentication.fw.util.DataProviderClass; +import io.mosip.authentication.fw.util.FileUtil; +import io.mosip.authentication.fw.util.OutputValidationUtil; +import io.mosip.authentication.fw.util.ReportUtil; +import io.mosip.authentication.fw.util.RunConfigUtil; +import io.mosip.authentication.fw.util.TestParameters; +import io.mosip.authentication.testdata.TestDataProcessor; +import io.mosip.kernel.util.KernelDataBaseAccess; +import io.mosip.pmp.fw.util.PartnerTestUtil; + +public class ValidateMISPLicense extends PartnerTestUtil implements ITest { + private static final Logger logger = Logger.getLogger(ValidateMISPLicense.class); + protected String testCaseName = ""; + private String TESTDATA_PATH; + private String TESTDATA_FILENAME; + private String testType; + private int invocationCount = 0; + KernelDataBaseAccess masterDB = new KernelDataBaseAccess(); + + /** + * Set Test Type - Smoke, Regression or Integration + * + * @param testType + */ + @BeforeClass + public void setTestType() { + this.testType = RunConfigUtil.getTestLevel(); + String createMISIPQuery = partnerQueries.get("createMISP").toString(); + String validateMISIPLicenceQuery = partnerQueries.get("validateMISPLicence").toString(); + if (masterDB.executeQuery(createMISIPQuery, "pmp") + && masterDB.executeQuery(validateMISIPLicenceQuery, "pmp")) + logger.info("ValidateMISPLicense Test successfully using query from partnerQueries.properties"); + else + logger.info("not able to ValidateMISPLicense using query from partnerQueries.properties"); + + } + + /** + * Method set Test data path and its filename + * + * @param index + */ + public void setTestDataPathsAndFileNames(int index) { + this.TESTDATA_PATH = getTestDataPath(getClass().getSimpleName().toString(), index); + this.TESTDATA_FILENAME = getTestDataFileName(getClass().getSimpleName().toString(), index); + } + + /** + * Method set configuration + * + * @param testType + */ + public void setConfigurations(String testType) { + RunConfigUtil.getRunConfigObject("partner"); + RunConfigUtil.objRunConfig.setConfig(this.TESTDATA_PATH, this.TESTDATA_FILENAME, testType); + TestDataProcessor.initateTestDataProcess(this.TESTDATA_FILENAME, this.TESTDATA_PATH, "partner"); + } + + /** + * The method set test case name + * + * @param method + * @param testData + */ + @BeforeMethod + public void testData(Method method, Object[] testData) { + String testCase = ""; + if (testData != null && testData.length > 0) { + TestParameters testParams = null; + // Check if test method has actually received required parameters + for (Object testParameter : testData) { + if (testParameter instanceof TestParameters) { + testParams = (TestParameters) testParameter; + break; + } + } + if (testParams != null) { + testCase = testParams.getTestCaseName(); + } + } + testCaseName = String.format(testCase); + if(!kernelCmnLib.isValidToken(partnerCookie)) + partnerCookie = kernelAuthLib.getAuthForPartner(); + } + + /** + * Data provider class provides test case list + * + * @return object of data provider + */ + @DataProvider(name = "testcaselist") + public Object[][] getTestCaseList() { + invocationCount++; + setTestDataPathsAndFileNames(invocationCount); + setConfigurations(testType); + return DataProviderClass.getDataProvider( + RunConfigUtil.getResourcePath() + RunConfigUtil.objRunConfig.getScenarioPath(), + RunConfigUtil.objRunConfig.getScenarioPath(), RunConfigUtil.objRunConfig.getTestType()); + } + + /** + * Set current testcaseName + */ + @Override + public String getTestName() { + return testCaseName; + } + + /** + * The method ser current test name to result + * + * @param result + */ + @AfterMethod(alwaysRun = true) + public void setResultTestName(ITestResult result) { + try { + Field method = TestResult.class.getDeclaredField("m_method"); + method.setAccessible(true); + method.set(result, result.getMethod().clone()); + BaseTestMethod baseTestMethod = (BaseTestMethod) result.getMethod(); + Field f = baseTestMethod.getClass().getSuperclass().getDeclaredField("m_methodName"); + f.setAccessible(true); + f.set(baseTestMethod, testCaseName); + } catch (Exception e) { + Reporter.log("Exception : " + e.getMessage()); + } + } + + /** + * Test method for OTP Generation execution + * + * @param objTestParameters + * @param testScenario + * @param testcaseName + * @throws AuthenticationTestException + * @throws AdminTestException + */ + @Test(dataProvider = "testcaselist") + public void validateMISPLicense(TestParameters objTestParameters, String testScenario, String testcaseName) throws AuthenticationTestException, AdminTestException { + File testCaseName = objTestParameters.getTestCaseFile(); + int testCaseNumber = Integer.parseInt(objTestParameters.getTestId()); + displayLog(testCaseName, testCaseNumber); + setTestFolder(testCaseName); + setTestCaseId(testCaseNumber); + setTestCaseName(testCaseName.getName()); + displayContentInFile(testCaseName.listFiles(), "request"); + String url=RunConfigUtil.objRunConfig.getAdminEndPointUrl() + RunConfigUtil.objRunConfig.getValidateMISPLicensePath(); + logger.info("******Patch request Json to EndPointUrl: " + url+ + " *******"); + patchRequestAndGenerateOuputFileWithCookie(testCaseName.listFiles(), url, "request", "output-1-actual-response", 0, AUTHORIZATHION_COOKIENAME, partnerCookie); + + Map> ouputValid = OutputValidationUtil.doOutputValidation( + FileUtil.getFilePath(testCaseName, "output-1-actual").toString(), + FileUtil.getFilePath(testCaseName, "output-1-expected").toString()); + Reporter.log(ReportUtil.getOutputValiReport(ouputValid)); + if(!OutputValidationUtil.publishOutputResult(ouputValid)) + throw new AdminTestException("Failed at output validation"); +} + /** + * this method is for deleting or updating the inserted data in db for testing + * (managing class level data not test case level data) + * @throws AdminTestException + */ + @AfterClass(alwaysRun = true) + public void cleanup() throws AdminTestException { + if (masterDB.executeQuery(partnerQueries.get("deleteValidateMISPLicence").toString(), "pmp") + && masterDB.executeQuery(partnerQueries.get("deleteMISP").toString(), "pmp")) + logger.info("deleted all ValidateMISPLicense data successfully"); + else { + logger.info("not able to delete ValidateMISPLicense data using query from query.properties"); + } + logger.info("END"); + } +} diff --git a/automationtests/src/main/java/io/mosip/resident/fw/util/ResidentRunConfig.java b/automationtests/src/main/java/io/mosip/resident/fw/util/ResidentRunConfig.java index b50e89c07a..267292e7b4 100644 --- a/automationtests/src/main/java/io/mosip/resident/fw/util/ResidentRunConfig.java +++ b/automationtests/src/main/java/io/mosip/resident/fw/util/ResidentRunConfig.java @@ -1732,6 +1732,53 @@ public String getUpdateTheStatusActivateDeactivateForTheGivenPolicyIdPath() { // TODO Auto-generated method stub return null; } + @Override + public String getCreateMISPPath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setUpdateMISPPath(String updateMISPPath) { + // TODO Auto-generated method stub + + } + + @Override + public String getUpdateMISPPath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getValidateMISPLicensePath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getApproveMISPPath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getRejectMISPPath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getActivateMISPLicense() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getRetrieveMISPByMispIDPath() { + // TODO Auto-generated method stub + return null; + } } diff --git a/automationtests/src/main/resources/config/partnerQueries.properties b/automationtests/src/main/resources/config/partnerQueries.properties index 72677b6167..5b309953f7 100644 --- a/automationtests/src/main/resources/config/partnerQueries.properties +++ b/automationtests/src/main/resources/config/partnerQueries.properties @@ -48,4 +48,16 @@ VALUES('TF-AUTH-ID-01', 'TF-POLICY-ID-01', 'TF POLICY', 'DESCR TF POLICY', '{"au deleteTFAuth=DELETE FROM auth_policy WHERE "name"='TF POLICY' AND cr_by='pm_testuser'; +deleteMISP= delete from pmp.misp where cr_by='pm_testuser'; + +createMISP= INSERT INTO pmp.misp(\ +id,name, address, contact_no, email_id, user_id, is_active, status_code, cr_by, cr_dtimes, upd_by, upd_dtimes, is_deleted, del_dtimes)\ +VALUES('MISP-FUN-ID-01','MISP_Test0002','Bangalore','9840587080','misp@telecom.com','pm_testuser','true','Active','pm_testuser','2020-06-17T05:10:51.169Z',null,null,null,null); +validateMISPLicence=INSERT INTO pmp.misp_license(\ + misp_id, license_key, valid_from_date, valid_to_date, is_active, cr_by, cr_dtimes, upd_by, upd_dtimes, is_deleted, del_dtimes)\ + VALUES ('MISP-FUN-ID-01','r9YUOi2BvC9QVdZP5snsCeonXqdEZ9rQ0TroekqHMhX3c8mPfrtestfun','202-06-18T09:48:43.394Z','2020-08-20T09:48:43.394Z',true,'pm_testuser','2019-06-18T09:48:43.394Z',null,null,null,null); + +deleteValidateMISPLicence= delete from pmp.misp_license where cr_by='pm_testuser'; +approveMISP=UPDATE pmp.misp SET status_code='approved',upd_by='pm_testuser', upd_dtimes='2019-06-19T09:48:43.394Z' WHERE id='MISP-FUN-ID-01'; + diff --git a/automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/input/activate-misp-request.json b/automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/input/activate-misp-request.json new file mode 100644 index 0000000000..0a092abb4e --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/input/activate-misp-request.json @@ -0,0 +1,11 @@ +{ + "id": "mosip.partnermanagement.misp.license.update", + "version": "1.0", + "requesttime": "2019-05-20T09:48:43.394Z", + "metadata": {}, + "request": { + "mispStatus": "string", + "mispLicenseKey": "r9YUOi2BvC9QVdZP5snsCeonXqdEZ9rQ0TroekqHMhX3c8mPfr", + "mispLicenseKeyStatus": "Active" + } +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/mapping.properties b/automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/mapping.properties new file mode 100644 index 0000000000..e04fb8a9e6 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/mapping.properties @@ -0,0 +1,16 @@ +mispId=mispId + +version=version +mispStatus=request.mispStatus +RmispLicenseKeyStatus=request.mispLicenseKeyStatus +mispLicenseKey=request.mispLicenseKey +requesttime=requesttime +id=id + +metadata=metadata +mispLicenseKeyStatus=response.mispLicenseKeyStatus +responsetime=responsetime + +response=response +errorCodeerrors0=(errors)[0].errorCode +messageerrors0=(errors)[0].message diff --git a/automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/output/output-1-expected-error-response.json b/automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/output/output-1-expected-error-response.json new file mode 100644 index 0000000000..954b6b83f0 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/output/output-1-expected-error-response.json @@ -0,0 +1,13 @@ +{ + "id": null, + "version": null, + "responsetime": "2020-06-20T06:39:39.167Z", + "metadata": null, + "response": null, + "errors": [ + { + "errorCode": "PMS_MSP_006", + "message": "MISP License Key does not exists r9YUOi2BvC9QVdZP5snsCeonXqdEZ9rQ0TroekqHMhX3c8mPfr11" + } + ] +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/output/output-1-expected-pos-response.json b/automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/output/output-1-expected-pos-response.json new file mode 100644 index 0000000000..dd178f9feb --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/output/output-1-expected-pos-response.json @@ -0,0 +1,10 @@ +{ + "id": "mosip.partnermanagement.misp.license.update", + "version": "1.0", + "responsetime": "2020-06-20T06:11:40.018Z", + "metadata": null, + "response": { + "mispLicenseKeyStatus": "Active" + }, + "errors": [] +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/testdata.partner.ActivateDeactivateMISPLincense.mapping.yml b/automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/testdata.partner.ActivateDeactivateMISPLincense.mapping.yml new file mode 100644 index 0000000000..de432080e3 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/ActivateDeactivateMISPLincense/testdata.partner.ActivateDeactivateMISPLincense.mapping.yml @@ -0,0 +1,16 @@ +testdata: + Partner_ActivateDeactivateMISPLincense_All_Valid_Smoke: + input.activate-misp-request: + mispId: MISP-FUN-ID-01 + mispStatus: Active + mispLicenseKey: r9YUOi2BvC9QVdZP5snsCeonXqdEZ9rQ0TroekqHMhX3c8mPfrtestfun + RmispLicenseKeyStatus: Active + output.output-1-expected-pos-response: + responsetime: $IGNORE$ + mispLicenseKeyStatus: $input.activate-misp-request:RmispLicenseKeyStatus$ + id: $IGNORE$ + version: $IGNORE$ + + + + \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/ApproveMISP/input/approve-misp-request.json b/automationtests/src/main/resources/partner/TestData/ApproveMISP/input/approve-misp-request.json new file mode 100644 index 0000000000..1a04685787 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/ApproveMISP/input/approve-misp-request.json @@ -0,0 +1,9 @@ +{ + "id": "mosip.partnermanagement.misp.status.update", + "version": "1.0", + "requesttime": "2019-05-20T09:48:43.394Z", + "metadata": {}, + "request": { + "mispStatus": "string" + } +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/ApproveMISP/mapping.properties b/automationtests/src/main/resources/partner/TestData/ApproveMISP/mapping.properties new file mode 100644 index 0000000000..2041f1503a --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/ApproveMISP/mapping.properties @@ -0,0 +1,18 @@ +version=version +RmispStatus=request.mispStatus +requesttime=requesttime +id=id + +mispID=response.mispID +mispLicenseKeyExpiry=response.mispLicenseKeyExpiry +mispLicenseKey=response.mispLicenseKey +mispLicenseKeyStatus=response.mispLicenseKeyStatus +responsetime=responsetime +mispStatusCode=response.mispStatusCode +mispStatus=response.mispStatus +message=response.message + +response=response +errorCodeerrors0=(errors)[0].errorCode +metadata=metadata +messageerrors0=(errors)[0].message diff --git a/automationtests/src/main/resources/partner/TestData/ApproveMISP/output/output-1-expected-error-response.json b/automationtests/src/main/resources/partner/TestData/ApproveMISP/output/output-1-expected-error-response.json new file mode 100644 index 0000000000..88e9d26e27 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/ApproveMISP/output/output-1-expected-error-response.json @@ -0,0 +1,13 @@ +{ + "id": null, + "version": null, + "responsetime": "2020-06-18T05:10:27.404Z", + "metadata": null, + "response": null, + "errors": [ + { + "errorCode": "PMS_MSP_014", + "message": "Misp already approved" + } + ] +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/ApproveMISP/output/output-1-expected-pos-response.json b/automationtests/src/main/resources/partner/TestData/ApproveMISP/output/output-1-expected-pos-response.json new file mode 100644 index 0000000000..f2f1fb3380 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/ApproveMISP/output/output-1-expected-pos-response.json @@ -0,0 +1,16 @@ +{ + "id": "mosip.partnermanagement.misp.status.update", + "version": "1.0", + "responsetime": "2020-06-18T05:10:04.168Z", + "metadata": null, + "response": { + "mispStatus": "Active", + "mispLicenseKey": "y3uNS2e9Xj0kpyA5AWf1COMudHHK2Rb8siApig9Z3yYjTsAIWp", + "mispLicenseKeyExpiry": "2020-09-16T05:10:04.184", + "mispLicenseKeyStatus": "active", + "mispID": "105", + "mispStatusCode": "approved", + "message": "MISP approved successfully" + }, + "errors": [] +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/ApproveMISP/testdata.partner.ApproveMISP.mapping.yml b/automationtests/src/main/resources/partner/TestData/ApproveMISP/testdata.partner.ApproveMISP.mapping.yml new file mode 100644 index 0000000000..6eebd9b755 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/ApproveMISP/testdata.partner.ApproveMISP.mapping.yml @@ -0,0 +1,34 @@ +testdata: + Partner_ApproveMISP_All_Valid_Smoke: + input.approve-misp-request: + RmispStatus: approved + output.output-1-expected-pos-response: + responsetime: $IGNORE$ + mispStatus: Active + mispStatusCode: $input.approve-misp-request:RmispStatus$ + message: MISP approved successfully + mispLicenseKeyStatus: active + mispLicenseKey: $IGNORE$ + mispLicenseKeyExpiry: $IGNORE$ + mispID: MISP-FUN-ID-01 + id: $IGNORE$ + version: $IGNORE$ + + Partner_ValidateMISPLicense_InvalidParameter_MISP_Allready_Approved: + input.approve-misp-request: + RmispStatus: approved + output.output-1-expected-error-response: + responsetime: $IGNORE$ + errorCodeerrors0: PMS_MSP_014 + messageerrors0: Misp already approved + id: $IGNORE$ + version: $IGNORE$ + response: $IGNORE$ + metadata: $IGNORE$ + + + + + + + \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/CreateMISP/input/create-misp-request.json b/automationtests/src/main/resources/partner/TestData/CreateMISP/input/create-misp-request.json new file mode 100644 index 0000000000..dc26fd7fc6 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/CreateMISP/input/create-misp-request.json @@ -0,0 +1,13 @@ +{ + "id": "string", + "version": "1.0", + "requesttime": "2020-06-16T19:22:01.018Z", + "metadata": {}, + "request": { + "organizationName": "string", + "contactNumber": "string", + "emailId": "string", + "name": "string", + "address": "string" + } +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/CreateMISP/mapping.properties b/automationtests/src/main/resources/partner/TestData/CreateMISP/mapping.properties new file mode 100644 index 0000000000..07dc947a41 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/CreateMISP/mapping.properties @@ -0,0 +1,17 @@ +version=version +address=request.address +name=request.name +emailId=request.emailId +requesttime=requesttime +contactNumber=request.contactNumber +id=id +organizationName=request.organizationName + +metadata=metadata +mispStatus=response.mispStatus +mispID=response.mispID +responsetime=responsetime + +response=response +errorCodeerrors0=(errors)[0].errorCode +messageerrors0=(errors)[0].message diff --git a/automationtests/src/main/resources/partner/TestData/CreateMISP/output/output-1-expected-error-response.json b/automationtests/src/main/resources/partner/TestData/CreateMISP/output/output-1-expected-error-response.json new file mode 100644 index 0000000000..3623537660 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/CreateMISP/output/output-1-expected-error-response.json @@ -0,0 +1,13 @@ +{ + "id": null, + "version": null, + "responsetime": "2020-06-16T19:14:52.789Z", + "metadata": null, + "response": null, + "errors": [ + { + "errorCode": "PMS_MSP_003", + "message": "MISP already registred with name : MISP_Test02" + } + ] +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/CreateMISP/output/output-1-expected-pos-response.json b/automationtests/src/main/resources/partner/TestData/CreateMISP/output/output-1-expected-pos-response.json new file mode 100644 index 0000000000..ad18dac911 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/CreateMISP/output/output-1-expected-pos-response.json @@ -0,0 +1,11 @@ +{ + "id": "mosip.partnermanagement.misp.create", + "version": "1.0", + "responsetime": "2020-06-16T19:13:19.389Z", + "metadata": null, + "response": { + "mispStatus": "Active", + "mispID": "114" + }, + "errors": [] +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/CreateMISP/testdata.partner.CreateMISP.mapping.yml b/automationtests/src/main/resources/partner/TestData/CreateMISP/testdata.partner.CreateMISP.mapping.yml new file mode 100644 index 0000000000..da2dae5744 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/CreateMISP/testdata.partner.CreateMISP.mapping.yml @@ -0,0 +1,17 @@ +testdata: + Partner_CreateMISP_All_Valid_Smoke: + input.create-misp-request: + organizationName: Telecom + contactNumber: 9840587089 + emailId: misp@telecom.com + name: MISP_Test03 + address: India + output.output-1-expected-pos-response: + responsetime: $IGNORE$ + mispStatus: Active + id: $IGNORE$ + mispID: $IGNORE$ + + + + \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/RejectMISP/input/reject-misp-request.json b/automationtests/src/main/resources/partner/TestData/RejectMISP/input/reject-misp-request.json new file mode 100644 index 0000000000..7c61b53713 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/RejectMISP/input/reject-misp-request.json @@ -0,0 +1,9 @@ +{ + "id": "mosip.partnermanagement.misp.status.update", + "version": "1.0", + "requesttime": "2019-05-20T09:48:43.394Z", + "metadata": {}, + "request": { + "mispStatus": "rejected" + } +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/RejectMISP/mapping.properties b/automationtests/src/main/resources/partner/TestData/RejectMISP/mapping.properties new file mode 100644 index 0000000000..2041f1503a --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/RejectMISP/mapping.properties @@ -0,0 +1,18 @@ +version=version +RmispStatus=request.mispStatus +requesttime=requesttime +id=id + +mispID=response.mispID +mispLicenseKeyExpiry=response.mispLicenseKeyExpiry +mispLicenseKey=response.mispLicenseKey +mispLicenseKeyStatus=response.mispLicenseKeyStatus +responsetime=responsetime +mispStatusCode=response.mispStatusCode +mispStatus=response.mispStatus +message=response.message + +response=response +errorCodeerrors0=(errors)[0].errorCode +metadata=metadata +messageerrors0=(errors)[0].message diff --git a/automationtests/src/main/resources/partner/TestData/RejectMISP/output/output-1-expected-error-response.json b/automationtests/src/main/resources/partner/TestData/RejectMISP/output/output-1-expected-error-response.json new file mode 100644 index 0000000000..88e9d26e27 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/RejectMISP/output/output-1-expected-error-response.json @@ -0,0 +1,13 @@ +{ + "id": null, + "version": null, + "responsetime": "2020-06-18T05:10:27.404Z", + "metadata": null, + "response": null, + "errors": [ + { + "errorCode": "PMS_MSP_014", + "message": "Misp already approved" + } + ] +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/RejectMISP/output/output-1-expected-pos-response.json b/automationtests/src/main/resources/partner/TestData/RejectMISP/output/output-1-expected-pos-response.json new file mode 100644 index 0000000000..f2f1fb3380 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/RejectMISP/output/output-1-expected-pos-response.json @@ -0,0 +1,16 @@ +{ + "id": "mosip.partnermanagement.misp.status.update", + "version": "1.0", + "responsetime": "2020-06-18T05:10:04.168Z", + "metadata": null, + "response": { + "mispStatus": "Active", + "mispLicenseKey": "y3uNS2e9Xj0kpyA5AWf1COMudHHK2Rb8siApig9Z3yYjTsAIWp", + "mispLicenseKeyExpiry": "2020-09-16T05:10:04.184", + "mispLicenseKeyStatus": "active", + "mispID": "105", + "mispStatusCode": "approved", + "message": "MISP approved successfully" + }, + "errors": [] +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/RejectMISP/testdata.partner.RejectMISP.mapping.yml b/automationtests/src/main/resources/partner/TestData/RejectMISP/testdata.partner.RejectMISP.mapping.yml new file mode 100644 index 0000000000..d6d501128e --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/RejectMISP/testdata.partner.RejectMISP.mapping.yml @@ -0,0 +1,34 @@ +testdata: + Partner_RejectMISP_All_Valid_Smoke: + input.reject-misp-request: + RmispStatus: rejected + output.output-1-expected-pos-response: + responsetime: $IGNORE$ + mispStatus: Active + mispStatusCode: $input.reject-misp-request:RmispStatus$ + message: MISP rejected successfully + mispLicenseKeyStatus: $IGNORE$ + mispLicenseKey: $IGNORE$ + mispLicenseKeyExpiry: $IGNORE$ + mispID: $IGNORE$ + id: $IGNORE$ + version: $IGNORE$ + + Partner_RejectMISP_InvalidParameter_MISP_Allready_Rejected: + input.reject-misp-request: + RmispStatus: rejected + output.output-1-expected-error-response: + responsetime: $IGNORE$ + errorCodeerrors0: PMS_MSP_014 + messageerrors0: 'Misp already rejected' + id: $IGNORE$ + version: $IGNORE$ + response: $IGNORE$ + metadata: $IGNORE$ + + + + + + + \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/input/retrieve-misp-by-id-request.json b/automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/input/retrieve-misp-by-id-request.json new file mode 100644 index 0000000000..a6d33f4e69 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/input/retrieve-misp-by-id-request.json @@ -0,0 +1,3 @@ +{ + "mispId": "" +} diff --git a/automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/mapping.properties b/automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/mapping.properties new file mode 100644 index 0000000000..5e8ff09dbd --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/mapping.properties @@ -0,0 +1,36 @@ +mispId=mispId + +responsetime=responsetime +createdDateTime=response.misp.createdDateTime +deletedDateTimemisp_licenses0=response.(misp_licenses)[0].deletedDateTime +misp_id=response.(misp_licenses)[0].mispLicenseUniqueKey.misp_id +updatedDateTimemisp_licenses0=response.(misp_licenses)[0].updatedDateTime +version=version +address=response.misp.address +license_key=response.(misp_licenses)[0].mispLicenseUniqueKey.license_key +createdDateTimemisp_licenses0=response.(misp_licenses)[0].createdDateTime +status_code=response.misp.status_code +isActivemisp_licenses0=response.(misp_licenses)[0].isActive +updatedBymisp_licenses0=response.(misp_licenses)[0].updatedBy +ID=response.misp.ID +updatedDateTime=response.misp.updatedDateTime +validFromDatemisp_licenses0=response.(misp_licenses)[0].validFromDate +isDeleted=response.misp.isDeleted +createdBymisp_licenses0=response.(misp_licenses)[0].createdBy +deletedDateTime=response.misp.deletedDateTime +metadata=metadata +id=id +createdBy=response.misp.createdBy +isActive=response.misp.isActive +contactNumber=response.misp.contactNumber +emailId=response.misp.emailId +userID=response.misp.userID +isDeletedmisp_licenses0=response.(misp_licenses)[0].isDeleted +validToDatemisp_licenses0=response.(misp_licenses)[0].validToDate +updatedBy=response.misp.updatedBy +name=response.misp.name + + +response=response +errorCodeerrors0=(errors)[0].errorCode +messageerrors0=(errors)[0].message diff --git a/automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/output/output-1-expected-error-response.json b/automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/output/output-1-expected-error-response.json new file mode 100644 index 0000000000..0b06c8631c --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/output/output-1-expected-error-response.json @@ -0,0 +1,13 @@ +{ + "id": null, + "version": null, + "responsetime": "2020-06-22T06:24:15.627Z", + "metadata": null, + "response": null, + "errors": [ + { + "errorCode": "PMS_MSP_005", + "message": "MISP ID does not exist 99" + } + ] +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/output/output-1-expected-pos-response.json b/automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/output/output-1-expected-pos-response.json new file mode 100644 index 0000000000..3626929c2b --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/output/output-1-expected-pos-response.json @@ -0,0 +1,43 @@ +{ + "id": null, + "version": null, + "responsetime": "2020-06-22T06:23:09.066Z", + "metadata": null, + "response": { + "misp": { + "isActive": true, + "createdBy": "110118", + "createdDateTime": "2020-06-06T05:22:47.047", + "updatedBy": "110118", + "updatedDateTime": "2020-06-06T05:32:51.031", + "isDeleted": null, + "deletedDateTime": null, + "ID": "102", + "name": "MISP_Test", + "address": "India", + "contactNumber": "9840587089", + "emailId": "misp@telecom.com", + "userID": "110118", + "status_code": "approved", + "id": "102" + }, + "misp_licenses": [ + { + "isActive": true, + "createdBy": "110118", + "createdDateTime": "2020-06-06T05:32:51.058", + "updatedBy": "110125", + "updatedDateTime": "2020-06-20T06:39:29.623", + "isDeleted": null, + "deletedDateTime": null, + "mispLicenseUniqueKey": { + "misp_id": "102", + "license_key": "r9YUOi2BvC9QVdZP5snsCeonXqdEZ9rQ0TroekqHMhX3c8mPfr" + }, + "validFromDate": "2020-06-06T05:32:51.058", + "validToDate": "2021-06-08T05:32:51" + } + ] + }, + "errors": [] +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/testdata.partner.RetrieveMISPByMispID.mapping.yml b/automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/testdata.partner.RetrieveMISPByMispID.mapping.yml new file mode 100644 index 0000000000..89b9a1253d --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/RetrieveMISPByMispID/testdata.partner.RetrieveMISPByMispID.mapping.yml @@ -0,0 +1,33 @@ +testdata: + Partner_RetrieveMISPByMispID_All_Valid_Smoke: + input.retrieve-misp-by-id-request: + mispId: MISP-FUN-ID-01 + output.output-1-expected-pos-response: + responsetime: $IGNORE$ + id: $IGNORE$ + isActive: true + createdBy: $IGNORE$ + createdDateTime: $IGNORE$ + updatedBy: $IGNORE$ + updatedDateTime: $IGNORE$ + isDeleted: $IGNORE$ + deletedDateTime: $IGNORE$ + ID: $IGNORE$ + name: MISP_Test0002 + address: Bangalore + contactNumber: 9840587080 + emailId: misp@telecom.com + userID: $IGNORE$ + status_code: Active + isActivemisp_licenses0: true + createdBymisp_licenses0: $IGNORE$ + createdDateTimemisp_licenses0: $IGNORE$ + updatedBymisp_licenses0: $IGNORE$ + updatedDateTimemisp_licenses0: $IGNORE$ + isDeletedmisp_licenses0: $IGNORE$ + deletedDateTimemisp_licenses0: $IGNORE$ + misp_id: $input.retrieve-misp-by-id-request:mispId$ + license_key: r9YUOi2BvC9QVdZP5snsCeonXqdEZ9rQ0TroekqHMhX3c8mPfrtestfun + validFromDatemisp_licenses0: $IGNORE$ + validToDatemisp_licenses0: $IGNORE$ + \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/RunConfig/envRunConfig.properties b/automationtests/src/main/resources/partner/TestData/RunConfig/envRunConfig.properties index 5eda1d159d..38cdf73251 100644 --- a/automationtests/src/main/resources/partner/TestData/RunConfig/envRunConfig.properties +++ b/automationtests/src/main/resources/partner/TestData/RunConfig/envRunConfig.properties @@ -22,3 +22,12 @@ getPolicyBasedOnPolicyIdPath=/partnermanagement/v1/policies/policies/policyId/{p retrievePartnerPolicyDetailsForGivenPartnerAPIKeyPath=/partnermanagement/v1/policies/policies/partnerApiKey/{partnerApiKey} updateExistingPolicyForPolicyGroupPath=/partnermanagement/v1/policies/policies/MOSIP-POLICY-ID-01 updateTheStatusActivateDeactivateForTheGivenPolicyIdPath=/partnermanagement/v1/policies/policies/MOSIP-POLICY-ID-01 + + +createMISPPath=/partnermanagement/v1/misps/misps +updateMISPPath=/partnermanagement/v1/misps/misps/MISP-FUN-ID-01 +validateMISPLicensePath=/partnermanagement/v1/misps/misps/MISP-FUN-ID-01/licenseKey +approveMISPPath=/partnermanagement/v1/misps/misps/MISP-FUN-ID-01/status +rejectMISPPath=/partnermanagement/v1/misps/misps/MISP-FUN-ID-01/status +activateMISPLicense=/partnermanagement/v1/misps/misps/MISP-FUN-ID-01/licenseKey +retrieveMISPByMispIDPath=/partnermanagement/v1/misps/misps/mispId/{mispId} diff --git a/automationtests/src/main/resources/partner/TestData/RunConfig/runConfiguration.properties b/automationtests/src/main/resources/partner/TestData/RunConfig/runConfiguration.properties index 042485adab..9c82274594 100644 --- a/automationtests/src/main/resources/partner/TestData/RunConfig/runConfiguration.properties +++ b/automationtests/src/main/resources/partner/TestData/RunConfig/runConfiguration.properties @@ -68,4 +68,35 @@ UpdateTheStatusActivateDeactivateForTheGivenPolicyId.testDataPath[1]=partner/Tes UpdateTheStatusActivateDeactivateForTheGivenPolicyId.testDataFileName[1]=testdata.partner.UpdateTheStatusActivateDeactivateForTheGivenPolicyId.mapping.yml UpdateTheStatusActivateDeactivateForTheGivenPolicyId.invocationCount=1 +//############################# + +CreateMISP.testDataPath[1]=partner/TestData/CreateMISP/ +CreateMISP.testDataFileName[1]=testdata.partner.CreateMISP.mapping.yml +CreateMISP.invocationCount=1 + +UpdateMISP.testDataPath[1]=partner/TestData/UpdateMISP/ +UpdateMISP.testDataFileName[1]=testdata.partner.UpdateMISP.mapping.yml +UpdateMISP.invocationCount=1 + +ValidateMISPLicense.testDataPath[1]=partner/TestData/ValidateMISPLicense/ +ValidateMISPLicense.testDataFileName[1]=testdata.partner.ValidateMISPLicense.mapping.yml +ValidateMISPLicense.invocationCount=1 + +ApproveMISP.testDataPath[1]=partner/TestData/ApproveMISP/ +ApproveMISP.testDataFileName[1]=testdata.partner.ApproveMISP.mapping.yml +ApproveMISP.invocationCount=1 + +RejectMISP.testDataPath[1]=partner/TestData/RejectMISP/ +RejectMISP.testDataFileName[1]=testdata.partner.RejectMISP.mapping.yml +RejectMISP.invocationCount=1 + + +ActivateDeactivateMISPLincense.testDataPath[1]=partner/TestData/ActivateDeactivateMISPLincense/ +ActivateDeactivateMISPLincense.testDataFileName[1]=testdata.partner.ActivateDeactivateMISPLincense.mapping.yml +ActivateDeactivateMISPLincense.invocationCount=1 + +RetrieveMISPByMispID.testDataPath[1]=partner/TestData/RetrieveMISPByMispID/ +RetrieveMISPByMispID.testDataFileName[1]=testdata.partner.RetrieveMISPByMispID.mapping.yml +RetrieveMISPByMispID.invocationCount=1 + diff --git a/automationtests/src/main/resources/partner/TestData/UpdateMISP/input/update-misp-request.json b/automationtests/src/main/resources/partner/TestData/UpdateMISP/input/update-misp-request.json new file mode 100644 index 0000000000..42a58242a2 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/UpdateMISP/input/update-misp-request.json @@ -0,0 +1,17 @@ +{ + "id": "mosip.partnermanagement.misp.update", + "version": "1.0", + "requesttime": "2019-05-20T09:48:43.394Z", + "metadata": {}, + "request": { + "organizationName": "string", + "contactNumber": "string", + "emailId": "string", + "mispID": "string", + "address": "string", + "name": "string", + "status_code": "string" + } +} + + diff --git a/automationtests/src/main/resources/partner/TestData/UpdateMISP/mapping.properties b/automationtests/src/main/resources/partner/TestData/UpdateMISP/mapping.properties new file mode 100644 index 0000000000..6995b02055 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/UpdateMISP/mapping.properties @@ -0,0 +1,23 @@ +Rname=request.name +id=id +status_code=request.status_code +RmispID=request.mispID +version=version +RemailId=request.emailId +organizationName=request.organizationName +RcontactNumber=request.contactNumber +requesttime=requesttime +Raddress=request.address + +name=response.name +mispID=response.mispID +emailId=response.emailId +contactNumber=response.contactNumber +responsetime=responsetime +metadata=metadata +address=response.address + +response=response +errorCodeerrors0=(errors)[0].errorCode +responsetime=responsetime +messageerrors0=(errors)[0].message diff --git a/automationtests/src/main/resources/partner/TestData/UpdateMISP/output/output-1-expected-error-response.json b/automationtests/src/main/resources/partner/TestData/UpdateMISP/output/output-1-expected-error-response.json new file mode 100644 index 0000000000..fd3764b832 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/UpdateMISP/output/output-1-expected-error-response.json @@ -0,0 +1,13 @@ +{ + "id": null, + "version": null, + "responsetime": "2020-06-17T04:45:23.333Z", + "metadata": null, + "response": null, + "errors": [ + { + "errorCode": "PMS_COR_001", + "message": "Missing Input Parameter - request.name" + } + ] +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/UpdateMISP/output/output-1-expected-pos-response.json b/automationtests/src/main/resources/partner/TestData/UpdateMISP/output/output-1-expected-pos-response.json new file mode 100644 index 0000000000..c858b9e379 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/UpdateMISP/output/output-1-expected-pos-response.json @@ -0,0 +1,14 @@ +{ + "id": "mosip.partnermanagement.misp.update", + "version": "1.0", + "responsetime": "2020-06-17T04:43:08.544Z", + "metadata": null, + "response": { + "name": "MISP_Test002", + "contactNumber": "9840587080", + "emailId": null, + "address": "Bangalore", + "mispID": "115" + }, + "errors": [] +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/UpdateMISP/testdata.partner.UpdateMISP.mapping.yml b/automationtests/src/main/resources/partner/TestData/UpdateMISP/testdata.partner.UpdateMISP.mapping.yml new file mode 100644 index 0000000000..41dc6a2427 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/UpdateMISP/testdata.partner.UpdateMISP.mapping.yml @@ -0,0 +1,23 @@ +testdata: + Partner_UpdateMISP_All_Valid_Smoke: + input.update-misp-request: + organizationName: Telecom + RcontactNumber: 9840587080 + RemailId: misp@telecom.com + RmispID: MISP-FUN-ID-01 + Rname: MISP_Test0002 + Raddress: HSR Bangalore + status_code: Active + output.output-1-expected-pos-response: + responsetime: $IGNORE$ + name: $input.update-misp-request:Rname$ + contactNumber: $input.update-misp-request:RcontactNumber$ + emailId: $IGNORE$ + address: $input.update-misp-request:Raddress$ + mispID: $input.update-misp-request:RmispID$ + id: $IGNORE$ + version: $IGNORE$ + + + + \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/input/validate-misp-license-request.json b/automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/input/validate-misp-license-request.json new file mode 100644 index 0000000000..719df7a120 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/input/validate-misp-license-request.json @@ -0,0 +1,9 @@ +{ + "id": "mosip.partnermanagement.misp.license.validate", + "version": "1.0", + "requesttime": "2019-05-20T09:48:43.394Z", + "metadata": {}, + "request": { + "mispLicenseKey": "string" + } +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/mapping.properties b/automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/mapping.properties new file mode 100644 index 0000000000..72c383f88b --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/mapping.properties @@ -0,0 +1,20 @@ +version=version +mispLicenseKey=request.mispLicenseKey +requesttime=requesttime +id=id + +valid=response.valid +licenseKey=response.licenseKey +active=response.active +responsetime=responsetime +metadata=metadata +validTo=response.validTo +misp_id=response.misp_id +validFrom=response.validFrom +isActive=response.isActive +isValid=response.isValid +message=response.message + +response=response +errorCodeerrors0=(errors)[0].errorCode +messageerrors0=(errors)[0].message diff --git a/automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/output/output-1-expected-error-response.json b/automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/output/output-1-expected-error-response.json new file mode 100644 index 0000000000..a69d9c7ce9 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/output/output-1-expected-error-response.json @@ -0,0 +1,13 @@ +{ + "id": null, + "version": null, + "responsetime": "2020-06-18T07:04:29.745Z", + "metadata": null, + "response": null, + "errors": [ + { + "errorCode": "PMS_MSP_006", + "message": "MISP License Key does not exists 4g7rMcn6xxmmV2MOB8FCuzeLgSQU0PX1rNwHLbTkKiIO6vEJEK1" + } + ] +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/output/output-1-expected-pos-response.json b/automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/output/output-1-expected-pos-response.json new file mode 100644 index 0000000000..1e4ca05322 --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/output/output-1-expected-pos-response.json @@ -0,0 +1,18 @@ +{ + "id": "mosip.partnermanagement.misp.license.validate", + "version": "1.0", + "responsetime": "2020-06-18T05:29:03.349Z", + "metadata": null, + "response": { + "message": "MISP 105 with license key 4g7rMcn6xxmmV2MOB8FCuzeLgSQU0PX1rNwHLbTkKiIO6vEJEK is Valid", + "misp_id": "105", + "isActive": false, + "isValid": true, + "licenseKey": "4g7rMcn6xxmmV2MOB8FCuzeLgSQU0PX1rNwHLbTkKiIO6vEJEK", + "validFrom": "2020-06-17T16:35:49.237", + "validTo": "2020-09-15T16:35:49.237", + "valid": true, + "active": false + }, + "errors": [] +} \ No newline at end of file diff --git a/automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/testdata.partner.ValidateMISPLicense.mapping.yml b/automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/testdata.partner.ValidateMISPLicense.mapping.yml new file mode 100644 index 0000000000..fd4ce8132a --- /dev/null +++ b/automationtests/src/main/resources/partner/TestData/ValidateMISPLicense/testdata.partner.ValidateMISPLicense.mapping.yml @@ -0,0 +1,38 @@ +testdata: + Partner_ValidateMISPLicense_All_Valid_Smoke: + input.validate-misp-license-request: + mispLicenseKey: r9YUOi2BvC9QVdZP5snsCeonXqdEZ9rQ0TroekqHMhX3c8mPfrtestfun + metadata: $REMOVE$ + output.output-1-expected-pos-response: + responsetime: $IGNORE$ + licenseKey: $input.validate-misp-license-request:mispLicenseKey$ + valid: true + active: true + id: $IGNORE$ + metadata: $IGNORE$ + message: $IGNORE$ + validFrom: $IGNORE$ + validTo: $IGNORE$ + isActive: true + isValid: $IGNORE$ + misp_id: MISP-FUN-ID-01 + + + Partner_ValidateMISPLicense_InvalidParameter_MISPLicenseKey: + input.validate-misp-license-request: + mispLicenseKey: 4g7rMcn6xxmmV2MOB8FCuzeLgSQU0PX1rNwHLbTkKiIO6vEJEK111 + output.output-1-expected-error-response: + responsetime: $IGNORE$ + errorCodeerrors0: PMS_MSP_006 + messageerrors0: 'MISP License Key does not exists 4g7rMcn6xxmmV2MOB8FCuzeLgSQU0PX1rNwHLbTkKiIO6vEJEK111' + id: $IGNORE$ + version: $IGNORE$ + response: $IGNORE$ + metadata: $IGNORE$ + + + + + + + \ No newline at end of file diff --git a/automationtests/testNgXmlFiles/partnerApi.xml b/automationtests/testNgXmlFiles/partnerApi.xml index d73f944776..d407654671 100644 --- a/automationtests/testNgXmlFiles/partnerApi.xml +++ b/automationtests/testNgXmlFiles/partnerApi.xml @@ -29,6 +29,15 @@ + + + + + + + + + From 288dc75f2f96a5cfa1639115110b672aff1f2a70 Mon Sep 17 00:00:00 2001 From: Ravikant-M1044571 <42865066+Ravikant-M1044571@users.noreply.github.com> Date: Fri, 26 Jun 2020 21:20:40 +0530 Subject: [PATCH 3/6] Update BaseTestCase.java --- .../src/main/java/io/mosip/service/BaseTestCase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automationtests/src/main/java/io/mosip/service/BaseTestCase.java b/automationtests/src/main/java/io/mosip/service/BaseTestCase.java index 6d6315ddae..e19d5fef05 100644 --- a/automationtests/src/main/java/io/mosip/service/BaseTestCase.java +++ b/automationtests/src/main/java/io/mosip/service/BaseTestCase.java @@ -154,8 +154,8 @@ public static void suiteSetup() { logger.info("Done with BeforeSuite and test case setup! BEGINNING TEST EXECUTION!\n\n"); logger.info("Inserting device management data"); - AdminTestUtil.deleteDeviceManagementData(); - AdminTestUtil.createDeviceManagementData(); + //AdminTestUtil.deleteDeviceManagementData(); + //AdminTestUtil.createDeviceManagementData(); String[] modulesSpecified = System.getProperty("modules").split(","); List listOfModules = new ArrayList(Arrays.asList(modulesSpecified)); From 8cc4e78fef7c79d252fa120fe6590d747050d295 Mon Sep 17 00:00:00 2001 From: Ravikant-M1044571 <42865066+Ravikant-M1044571@users.noreply.github.com> Date: Fri, 26 Jun 2020 21:46:22 +0530 Subject: [PATCH 4/6] Update BaseTestCase.java --- .../src/main/java/io/mosip/service/BaseTestCase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automationtests/src/main/java/io/mosip/service/BaseTestCase.java b/automationtests/src/main/java/io/mosip/service/BaseTestCase.java index e19d5fef05..6d6315ddae 100644 --- a/automationtests/src/main/java/io/mosip/service/BaseTestCase.java +++ b/automationtests/src/main/java/io/mosip/service/BaseTestCase.java @@ -154,8 +154,8 @@ public static void suiteSetup() { logger.info("Done with BeforeSuite and test case setup! BEGINNING TEST EXECUTION!\n\n"); logger.info("Inserting device management data"); - //AdminTestUtil.deleteDeviceManagementData(); - //AdminTestUtil.createDeviceManagementData(); + AdminTestUtil.deleteDeviceManagementData(); + AdminTestUtil.createDeviceManagementData(); String[] modulesSpecified = System.getProperty("modules").split(","); List listOfModules = new ArrayList(Arrays.asList(modulesSpecified)); From 456c34a7087ac2e57087bdc054433d34189fec45 Mon Sep 17 00:00:00 2001 From: Ravikant-M1044571 <42865066+Ravikant-M1044571@users.noreply.github.com> Date: Tue, 30 Jun 2020 12:35:09 +0530 Subject: [PATCH 5/6] Update BaseTestCase.java --- .../src/main/java/io/mosip/service/BaseTestCase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automationtests/src/main/java/io/mosip/service/BaseTestCase.java b/automationtests/src/main/java/io/mosip/service/BaseTestCase.java index 6d6315ddae..e19d5fef05 100644 --- a/automationtests/src/main/java/io/mosip/service/BaseTestCase.java +++ b/automationtests/src/main/java/io/mosip/service/BaseTestCase.java @@ -154,8 +154,8 @@ public static void suiteSetup() { logger.info("Done with BeforeSuite and test case setup! BEGINNING TEST EXECUTION!\n\n"); logger.info("Inserting device management data"); - AdminTestUtil.deleteDeviceManagementData(); - AdminTestUtil.createDeviceManagementData(); + //AdminTestUtil.deleteDeviceManagementData(); + //AdminTestUtil.createDeviceManagementData(); String[] modulesSpecified = System.getProperty("modules").split(","); List listOfModules = new ArrayList(Arrays.asList(modulesSpecified)); From 1f86d3990e27be021871f138401abf4b3b6799b9 Mon Sep 17 00:00:00 2001 From: Ravikant-M1044571 <42865066+Ravikant-M1044571@users.noreply.github.com> Date: Tue, 30 Jun 2020 19:27:26 +0530 Subject: [PATCH 6/6] Update BaseTestCase.java --- .../src/main/java/io/mosip/service/BaseTestCase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automationtests/src/main/java/io/mosip/service/BaseTestCase.java b/automationtests/src/main/java/io/mosip/service/BaseTestCase.java index e19d5fef05..6d6315ddae 100644 --- a/automationtests/src/main/java/io/mosip/service/BaseTestCase.java +++ b/automationtests/src/main/java/io/mosip/service/BaseTestCase.java @@ -154,8 +154,8 @@ public static void suiteSetup() { logger.info("Done with BeforeSuite and test case setup! BEGINNING TEST EXECUTION!\n\n"); logger.info("Inserting device management data"); - //AdminTestUtil.deleteDeviceManagementData(); - //AdminTestUtil.createDeviceManagementData(); + AdminTestUtil.deleteDeviceManagementData(); + AdminTestUtil.createDeviceManagementData(); String[] modulesSpecified = System.getProperty("modules").split(","); List listOfModules = new ArrayList(Arrays.asList(modulesSpecified));