Beispiel #1
0
  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");
  }
Beispiel #2
0
  private void initLocale() {

    LOCALES LOC = LOCALES.valueOf(PROPS.getProperty(PROPERTIES.LOCALE.name()));
    switch (LOC) {
      case ENGLISH:
        LocaleGenerator.setProps(FILES_NAMES.LOCALE_EN.toString());
        break;
      case FRENCH:
        LocaleGenerator.setProps(FILES_NAMES.LOCALE_FR.toString());
        break;
      case ARABIC:
        LocaleGenerator.setProps(FILES_NAMES.LOCALE_AR.toString());
        break;
      case INDONESIAN:
        LocaleGenerator.setProps(FILES_NAMES.LOCALE_IN.toString());
        break;
      case TURKISH:
        LocaleGenerator.setProps(FILES_NAMES.LOCALE_TU.toString());
        break;
      default:
        LocaleGenerator.setProps(FILES_NAMES.LOCALE_EN.toString());
        break;
    }
  }