Skip to content

Commit

Permalink
Merge pull request #180 from anup-nehe/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
aranaravi authored Sep 12, 2023
2 parents 346fdd6 + 95adeba commit f5195d9
Show file tree
Hide file tree
Showing 11 changed files with 131 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,26 @@ public class CommonLibrary extends BaseTestCaseFunc {


public String getResourcePath() {
return TestRunner.getGlobalResourcePath() + "/resources/";
if(TestRunner.checkRunType().equals("JAR")) {
return TestRunner.getGlobalResourcePath() + "/resources/";
}else if(TestRunner.checkRunType().equals("IDE")) {
return TestRunner.getResourcePath();
}
return null;
}

public String getResourcePathForKernel() {
return TestRunner.getResourcePath() + "/resources/";
String kernelpath=null;
if(TestRunner.checkRunType().equals("JAR")) {
logger.info("file location for kernal"+TestRunner.getResourcePath() + "/" + "resources/config/Kernel.properties");

kernelpath = getproperty(TestRunner.getResourcePath() + "/" + "resources/config/Kernel.properties").toString();
}else if(TestRunner.checkRunType().equals("IDE")){
logger.info("file location for kernal"+TestRunner.getResourcePath() + "/config/Kernel.properties");

kernelpath = (TestRunner.getResourcePath() + "/config/Kernel.properties").toString();
}
return kernelpath;
}


Expand Down Expand Up @@ -67,9 +82,7 @@ public boolean isValidToken(String cookie) {
public Map<String, String> readProperty(String propertyFileName) {
Properties prop = new Properties();
try {
logger.info("propertyFileName: " + propertyFileName + "Path :" + getResourcePathForKernel() + "config/" + propertyFileName + ".properties");
logger.info("propertyFileName: " + propertyFileName + "Path :" + getResourcePathForKernel() + "config/" + propertyFileName + ".properties");
File propertyFile = new File(getResourcePathForKernel() + "config/" + propertyFileName + ".properties");
File propertyFile = new File( getResourcePathForKernel());
prop.load(new FileInputStream(propertyFile));

} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,10 @@ public static String getValueForKey(String key) {

public static void init() {
// Loading Kernel property
logger.info("file location for kernal"+TestRunner.getResourcePath() + "/" + "resources/config/Kernel.properties");

logger.info("file location for kernal"+TestRunner.getResourcePath() + "/config/Kernel.properties");

propsKernel = getproperty(TestRunner.getResourcePath() + "/" + "resources/config/Kernel.properties");
propsKernel = getproperty(TestRunner.getResourcePath() + "/config/Kernel.properties");



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class KernelAuthentication extends io.mosip.testrig.pmpui.utility.BaseTestCaseFunc {
private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(KernelAuthentication.class);
private String authRequest="/config/Authorization/request.json";
private String authInternalRequest="config/Authorization/internalAuthRequest.json";
private String authInternalRequest="/config/Authorization/internalAuthRequest.json";
public String zonemapCookie = null;
String cookie;
static String dataKey = "response";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,16 @@ public static Properties getproperty(String path) {

public static void createUsers() {
try {
List<String> needsToBeCreatedUsers = List.of(ConfigManager.getIAMUsersToCreate().split(","));
List<String> needsToBeCreatedUsers = List.of(ConfigManager.getIAMUsersToCreate());
Keycloak keycloakInstance = getKeycloakInstance();
for (String needsToBeCreatedUser : needsToBeCreatedUsers) {
UserRepresentation user = new UserRepresentation();

if (needsToBeCreatedUser.equals("globaladmin")) {
moduleSpecificUser = needsToBeCreatedUser;
}
else if(needsToBeCreatedUser.equals("masterdata-220005")){
moduleSpecificUser = needsToBeCreatedUser;

}

else {


moduleSpecificUser = BaseTestCaseFunc.currentModule+"-"+ needsToBeCreatedUser;
}


logger.info(moduleSpecificUser);
user.setEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,20 @@ public Object[] authDataProvider() {

public static String[] readFolderJsonList(String str) {
String contents[] = null;
File directoryPath=null;
try {
File directoryPath = new File(TestRunner.getResourcePath() + "/" + "resources" + str);

if (TestRunner.checkRunType().equalsIgnoreCase("JAR")) {
directoryPath = new File(TestRunner.getResourcePath() + "/" + "resources" + str);
} else if (TestRunner.checkRunType().equalsIgnoreCase("IDE")) {
directoryPath= new File(System.getProperty("user.dir") + System.getProperty("path.config")+"/"+str);


}




logger.info("file directory for "+directoryPath);
if (directoryPath.exists()) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,61 @@

public class BaseTestCaseFunc {
private static final org.slf4j.Logger logger= org.slf4j.LoggerFactory.getLogger(BaseTestCaseFunc.class);
private static String zoneMappingRequest = "config/Authorization/zoneMappingRequest.json";
private static String zoneMappingRequest = "/config/Authorization/zoneMappingRequest.json";

public static String environment;
public static List<String> languageList = new ArrayList<>();
public static String ApplnURI;
public static String ApplnURIForKeyCloak;
public static String testLevel;
public static Properties props = getproperty(
TestRunner.getResourcePath() + "/" + "resources/config/application.properties");
TestRunner.getResourcePath() + "/config/application.properties");
public static Properties propsKernel = getproperty(
TestRunner.getResourcePath() + "/" + "resources/config/Kernel.properties");
TestRunner.getResourcePath() + "/config/Kernel.properties");
public static Properties propsMap = getproperty(
TestRunner.getResourcePath() + "/" + "resources/config/valueMapping.properties");
TestRunner.getResourcePath() + "/config/valueMapping.properties");
public static Properties propsBio = getproperty(
TestRunner.getGlobalResourcePath() + "/" + "resources/config/bioValue.properties");
TestRunner.getGlobalResourcePath() + "/config/bioValue.properties");

/*
public static Properties props;
public static Properties propsKernel;
public static Properties propsMap ;
public static Properties propsBio;
public static Properties getProps() {
return props;
}
public static void setProps(Properties props) {
getproperty(TestRunner.getResourcePath() + "/" + "resources/config/application.properties");
BaseTestCaseFunc.props = props;
}
public static Properties getPropsKernel() {
return propsKernel;
}
public static void setPropsKernel(Properties propsKernel) {
BaseTestCaseFunc.propsKernel = propsKernel;
}
public static Properties getPropsMap() {
return propsMap;
}
public static void setPropsMap(Properties propsMap) {
BaseTestCaseFunc.propsMap = propsMap;
}
public static Properties getPropsBio() {
return propsBio;
}
public static void setPropsBio(Properties propsBio) {
BaseTestCaseFunc.propsBio = propsBio;
}
*/
public static String SEPRATOR = "";
public static String currentModule = "pmpui";
public final static String COOKIENAME = "Authorization";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,11 +355,11 @@ public static String getTestData()
}



public static String getJsonData()
{
return JsonUtil.readJsonFileText("PolicyData.json");
}
//
// public static String getJsonData()
// {
// return JsonUtil.readJsonFileText("PolicyData.json");
// }



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,18 @@ public static List<String> JsonObjArrayListParsing(String jsonIdentity, String i
public static String readJsonFileText(String document) {

String jsonTxt = null;
File f=null;

try {


if (TestRunner.checkRunType().equalsIgnoreCase("JAR")) {
f = new File(TestRunner.getResourcePath() + "/" + "resources/"+document);
} else if (TestRunner.checkRunType().equalsIgnoreCase("IDE")) {


File f = new File(TestRunner.getResourcePath() + "/" + "resources/"+document);
f = new File(System.getProperty("user.dir") + System.getProperty("path.config")+ "/"+document);
}

if (f.exists()) {
InputStream is = new FileInputStream(f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ public static String getGlobalResourcePath() {

public static String getResourcePath() {
if (checkRunType().equalsIgnoreCase("JAR")) {
return new File(jarUrl).getParentFile().getAbsolutePath();
return new File(jarUrl).getParentFile().getAbsolutePath()+"/resources/";
} else if (checkRunType().equalsIgnoreCase("IDE")) {
String path = new File(TestRunner.class.getClassLoader().getResource("").getPath()).getAbsolutePath()
.toString();
String path = System.getProperty("user.dir") + System.getProperty("path.config");

// String path = new File(TestRunner.class.getClassLoader().getResource("").getPath()).getAbsolutePath()
// .toString();
if (path.contains("test-classes"))
path = path.replace("test-classes", "classes");
return path;
Expand Down
2 changes: 1 addition & 1 deletion pmptest/src/main/resources/TestData.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"dataSharepolicyData":"{\"shareableAttributes\":[{\"attributeName\":\"fullName\",\"source\":[{\"attribute\":\"fullName\"}],\"encrypted\":true},{\"attributeName\":\"dateOfBirth\",\"source\":[{\"attribute\":\"dateOfBirth\"}],\"encrypted\":true},{\"attributeName\":\"gender\",\"source\":[{\"attribute\":\"gender\"}],\"encrypted\":true},{\"attributeName\":\"residenceStatus\",\"source\":[{\"attribute\":\"residenceStatus\"}],\"encrypted\":true},{\"attributeName\":\"phone\",\"source\":[{\"attribute\":\"phone\"}],\"encrypted\":true},{\"attributeName\":\"email\",\"source\":[{\"attribute\":\"email\"}],\"encrypted\":true},{\"attributeName\":\"dualCitizenshipAvailability\",\"source\":[{\"attribute\":\"dualCitizenshipAvailability\"}],\"encrypted\":true},{\"attributeName\":\"fatherName\",\"source\":[{\"attribute\":\"fatherName\"}],\"encrypted\":true},{\"attributeName\":\"shortenedPrintedName\",\"source\":[{\"attribute\":\"shortenedPrintedName\"}],\"encrypted\":true},{\"attributeName\":\"layName\",\"source\":[{\"attribute\":\"layName\"}],\"encrypted\":true},{\"attributeName\":\"nationalIdentityNumber\",\"source\":[{\"attribute\":\"nationalIdentityNumber\"}],\"encrypted\":true},{\"attributeName\":\"permanentAddress\",\"source\":[{\"attribute\":\"permanentAddress\"}],\"encrypted\":true},{\"attributeName\":\"temporaryAddress\",\"source\":[{\"attribute\":\"temporaryAddress\"}],\"encrypted\":true},{\"attributeName\":\"addressLine1\",\"source\":[{\"attribute\":\"addressLine1\"}],\"encrypted\":true},{\"attributeName\":\"addressLine2\",\"source\":[{\"attribute\":\"addressLine2\"}],\"encrypted\":true},{\"attributeName\":\"addressLine3\",\"source\":[{\"attribute\":\"addressLine3\"}],\"encrypted\":true},{\"attributeName\":\"region\",\"source\":[{\"attribute\":\"region\"}],\"encrypted\":true},{\"attributeName\":\"province\",\"source\":[{\"attribute\":\"province\"}],\"encrypted\":true},{\"attributeName\":\"profession\",\"source\":[{\"attribute\":\"profession\"}],\"encrypted\":true},{\"attributeName\":\"city\",\"source\":[{\"attribute\":\"city\"}],\"encrypted\":true},{\"attributeName\":\"postalCode\",\"source\":[{\"attribute\":\"postalCode\"}],\"encrypted\":true},{\"attributeName\":\"zone\",\"source\":[{\"attribute\":\"zone\"}],\"encrypted\":true},{\"attributeName\":\"preferredLang\",\"source\":[{\"attribute\":\"preferredLang\"}],\"encrypted\":false},{\"attributeName\":\"individualBiometrics\",\"group\":\"CBEFF\",\"source\":[{\"attribute\":\"individualBiometrics\"}],\"encrypted\":true,\"format\":\"extraction\"}],\"dataSharePolicies\":{\"typeOfShare\":\"Data Share\",\"validForInMinutes\":\"30\",\"transactionsAllowed\":\"2\",\"encryptionType\":\"Partner Based\",\"shareDomain\":\"datashare.datashare\",\"source\":\"IDRepository\"}}",
"publicKey": "ZAEACwACAHIAIINxl2dEhLP4GpDMjUal1yT9UtduBlILZPKh2hszFGmqABAAFwALCAAAAQABAQDCHegKJ3vRn__8h1knXKiLA8qfO5LebzBlRO2tAcI3HvLyL9rPkVrXWYQ6wAn4VQk015C1hViU-7k752dYE5WUAUbgsxOHvvDPH1t72CNHNj9dyE86wGqR9AtK3yz0yf1IP_xgtWpiaQ2V9t2d3LtgPYWnRuPJbcl97nLXXL6PGfh1mRwsQUi94coEBPMZ9YLLOAFckPuDZt-lEcXIMkj8r0uNwAZUSEvGifTNWbLjC5BRlJBmvScIlptXqIwBaq2kSMVK2X1KbQ6TM8zkA_co4LEAIZfcpMgPn6RdW0yFtcx24HqrCY8v0DHregwoCPPpw8HvB-r5aR09mXG64zsJ",
"signPublicKey": "AAZABAAEAHIAAAAQABQACwgAAAEAAQEAr93rKokeZGIzcCtFX3iyCvwpmfnd9jz0nF__0bxWr0mH8Zs0rhlG6vKRagx31I4CdrLAECOwMZ0r7Y3utTqHqelQE3MJLtboKITOqYRpBkqHSm1jGaEb8a1E9yoJri3tZrBCrAShimrN_SbtS1uKbJUG3cuVuE0gtGLI1d5wMfS_4PSz3RwvZtGHisEb3zbV6SLcJkgcDeMbUD7P25SVJd1xrJybuGIgyeSZxOgLzy1P-qHCiOXiAO9o06fwyIhIYbeZYz5th4rq7Rb6mRK9EWFpLrLvBL0F6USiidl8qNCxxZZFUp3W5xFANVYfRvgLKI33zBYniZ7aTE8PgrYa2w",
"headless": "yes",
"headless": "no",
"langcode": [
{
"language": "tam",
Expand Down
55 changes: 27 additions & 28 deletions pmptest/src/main/resources/config/Kernel.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,62 +12,62 @@ bulkUploadUrl=/v1/admin/bulkupload
#IDREPO
mosip_idrepo_app_id=idrepo
mosip_idrepo_client_id=mosip-idrepo-client
mosip_idrepo_client_secret=EqQjQHyJFyIrM4ow
mosip_idrepo_client_secret=GpFzjpxln5BLnkzT
#IDREPO
mosip_idrepo_app_id=idrepo
mosip_idrepo_client_id=mosip-idrepo-client
mosip_idrepo_client_secret=mosip-idrepo-client
mosip_idrepo_client_secret=GpFzjpxln5BLnkzT
keycloak-realm-id=mosip
keycloak-external-url=https://iam.dev.mosip.net
keycloak-external-url=https://iam.upgrade2.mosip.net
mosip_testrig_client_id=mosip-testrig-client
mosip_testrig_client_secret=XVEvFNPzTkvb4PwI
mosip_testrig_client_secret=Vvg1357vfq6EFYu4
admin
mosip_admin_app_id=admin
admin_password=mosip123
admin_userName=auto12
admin_userName=auto32
mosip_admin_client_id=mosip-admin-client
mosip_admin_client_secret=6TeZjfErY4qMUeKL
mosip_admin_client_secret=c8G64FPSF9YoMFJ2
#admin
admin_zone_password=mosip123
admin_zone_userName=globaladmin
mosip_regclient_app_id=registrationclient
mosip_reg_client_id=mosip-reg-client
mosip_reg_client_secret=3yd5YF6rgvCScifd
iam-users-to-create=auto12,globaladmin
mosip_reg_client_secret=JWVbi1IyOrejsLWx
iam-users-to-create=auto32
#iam-users-to-create=111997,220005,111992
iam-users-password=mosip123,mosip123
roles.auto12=GLOBAL_ADMIN,ID_AUTHENTICATION,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_ADMIN,REGISTRATION_SUPERVISOR,ZONAL_ADMIN
roles=GLOBAL_ADMIN,ID_AUTHENTICATION,REGISTRATION_ADMIN,REGISTRATION_SUPERVISOR,ZONAL_ADMIN,AUTH_PARTNER,PARTNER_ADMIN,PMS_ADMIN,POLICYMANAGER,REGISTRATION_SUPERVISOR,DATA_READ
roles.globaladmin=GLOBAL_ADMIN,REGISTRATION_ADMIN,uma_authorization,ZONAL_ADMIN,default-roles-mosip
partner_url=jdbc:postgresql://dev.mosip.net:5432/mosip_ida
partner_url=jdbc:postgresql://upgrade2.mosip.net:5432/mosip_ida
#----------------------------------Database properties----------------------------------------------------------#
postgresqlUser=postgresql
db-port=5432
db-server=dev.mosip.net
db-server=upgrade2.mosip.net
hibernate.connection.driver_class=org.postgresql.Driver
hibernate.connection.pool_size=1
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.show_sql=true
hibernate.current_session_context_class=thread
db-su-user=postgres
postgresql-password=2s5NfaKPkg
postgresql-password=mosip123
pms_db_schema=pms
km_db_schema=keymgr
master_db_schema=master
audit_db_schema=audit
ida_db_schema=ida
db-server=dev.mosip.net
keycloak-external-url=https://iam.dev.mosip.net
audit_url=jdbc:postgresql://dev.mosip.net:5432/mosip_audit
db-server=upgrade2.mosip.net
keycloak-external-url=https://iam.upgrade2.mosip.net
audit_url=jdbc:postgresql://upgrade2.mosip.net:5432/mosip_audit
driver_class=org.postgresql.Driver
pool_size=1
dialect=org.hibernate.dialect.PostgreSQLDialect
show_sql=true
current_session_context_class=thread
db-su-user=postgres
postgresql-password=2s5NfaKPkg
postgresql-password=mosip123
postgresqlUser=postgresql
db-port=5432
db-server=dev.mosip.net
db-server=upgrade2.mosip.net


s3-user-key=minioadmin
Expand All @@ -77,20 +77,20 @@ s3-account=uiautomation
s3-region=null
reportExpirationInDays=3
# supported values yes or no
push-reports-to-s3=no
push-reports-to-s3=yes
enableDebug=no
# supported values are 1 to 8
threadCount=1
# supported values are 0 ,1, 2 based on number of env languages
langselect=0
#----------------------------------AuthDemoService Host properties----------------------------------------------------------#
#To run locally
#authDemoServiceBaseURL=http://localhost
#authDemoServicePort=8082
authDemoServiceBaseURL=http://localhost
authDemoServicePort=8082

#To run in Docker
authDemoServiceBaseURL=http://authdemo.apitestrig
authDemoServicePort=80
#authDemoServiceBaseURL=http://authdemo.apitestrig
#authDemoServicePort=80


#----------------------------------IdP properties----------------------------------------------------------#
Expand All @@ -103,12 +103,11 @@ tokenEndpoint=/v1/esignet/oauth/token
validateBindingEndpoint=esignet-binding

#To run in Docker
authCertsPath=/home/mosip/authcerts
#authCertsPath=/home/mosip/authcerts

#To run locally
#authCertsPath=
authCertsPath=

PmpPortalPath=https://pmp.dev.mosip.net/
apiEnvUser=api-internal.dev
#ENDPOINT replaced by apiInternalEndPoint
apiInternalEndPoint=https://api-internal.dev.mosip.net
PmpPortalPath=https://pmp.upgrade2.mosip.net/
apiEnvUser=api-internal.upgrade2
apiInternalEndPoint=https://api-internal.upgrade2.mosip.net

0 comments on commit f5195d9

Please sign in to comment.