private void initTestServer() { SERVERS SERV = SERVERS.valueOf(PROPS.getProperty(PROPERTIES.SERVER.name())); switch (SERV) { case DEV: ServerGenerator.setProps(FILES_NAMES.DEV.toString()); CurrencyConversionRateGenerator.setProps(FILES_NAMES.CONVERSION_RATES_DEV.toString()); break; case STAGING: ServerGenerator.setProps(FILES_NAMES.STAGING.toString()); CurrencyConversionRateGenerator.setProps(FILES_NAMES.CONVERSION_RATES_STAGING.toString()); break; case LIVE: ServerGenerator.setProps(FILES_NAMES.LIVE.toString()); CurrencyConversionRateGenerator.setProps(FILES_NAMES.CONVERSION_RATES_LIVE.toString()); break; default: ServerGenerator.setProps(FILES_NAMES.DEV.toString()); CurrencyConversionRateGenerator.setProps(FILES_NAMES.CONVERSION_RATES_DEV.toString()); break; } // SECURE_PART = ServerGenerator.getServerKey(URL_CONST.HOME_URL); // SECURE_PART = ServerGenerator.getServerKey(URL_CONST.SECURE_HOME_URL); // SECURE_PART = ServerGenerator.getServerKey(URL_CONST.HOME_URL).replace("http", // "https"); SECURE_PART_PATTERN = "^(https?\\:\\/\\/)(|secure-)(" + ServerGenerator.getServerKey(URL_CONST.HOME_URL).split("://")[1] + ")"; }
private void initProperties(ITestContext context) { LOGGER.info("Initializing config.properties"); PROPS = new Properties(); try { WORKING_DIRECTORY = System.getProperty("user.dir"); LOGGER.info("Working Directory = " + System.getProperty("user.dir")); try { String configFile = context.getCurrentXmlTest().getParameter(CONFIG_FILE_NAME); PROPS.load(new FileInputStream(configFile)); } catch (NullPointerException e) { LOGGER.warn( "could not find the config file name in the xml suite, going to use the default " + CONFIG_FILE); try { String configFile = CONFIG_FILE; PROPS.load(new FileInputStream(configFile)); } catch (NullPointerException e2) { LOGGER.fatal("could not find the default config file in the project"); } } } catch (IOException e) { LOGGER.fatal("There was a problem to load the config file from " + CONFIG_FILE); e.printStackTrace(); } VERSION = PROPS.getProperty(PROPERTIES.VERSION.name()); PLATFORM = PROPS.getProperty(PROPERTIES.PLATFORM.name()); BROWSER = PROPS.getProperty(PROPERTIES.BROWSER.name()); LOCALE = PROPS.getProperty(PROPERTIES.LOCALE.name()); SERVER = PROPS.getProperty(PROPERTIES.SERVER.name()); LOGGER_LEVEL = PROPS.getProperty(PROPERTIES.LOGGER_LEVEL.name()); LOGGER.info("Finished to initialize properties"); }