com.paypal.selion.internal.platform.pageyaml.YamlV1Reader Maven / Gradle / Ivy
/*-------------------------------------------------------------------------------------------------------------------*\
| Copyright (C) 2014-2016 PayPal |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance |
| with the License. |
| |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software distributed under the License is distributed |
| on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for |
| the specific language governing permissions and limitations under the License. |
\*-------------------------------------------------------------------------------------------------------------------*/
package com.paypal.selion.internal.platform.pageyaml;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Level;
import com.google.common.collect.Lists;
import com.paypal.selion.internal.platform.grid.WebDriverPlatform;
import com.paypal.selion.platform.dataprovider.impl.FileSystemResource;
/**
* Concrete Yaml reader that is capable of reading Yaml v1 format file.
*/
class YamlV1Reader extends AbstractYamlReader {
/**
* This is a public constructor to create an input stream & Yaml instance for the input file.
*
* @param fileName
* the name of the YAML data file.
* @throws IOException
*/
public YamlV1Reader(String fileName) throws IOException {
super();
logger.entering(fileName);
FileSystemResource resource = new FileSystemResource(fileName);
processPage(resource);
logger.exiting();
}
/**
* The user needs to provide the locale for which data needs to be read. After successfully reading the data from
* the input stream, it is placed in the hash map and returned to the users.
*
* If the locale provided is not set for a certain element it will fall back to the default locale that is set in
* the Yaml. If default locale is not provided in the Yaml it will use US.
*
* @param locale
* Signifies the language or site language to read.
*/
@SuppressWarnings("unchecked")
@Override
public Map getGuiMap(String locale) {
logger.entering(locale);
Map instanceMap = new HashMap<>();
List © 2015 - 2025 Weber Informatics LLC | Privacy Policy