main/src/test/java/org/onap/policy/pap/main/rest/e2e/End2EndBase.java
/**
     * Loads an object from a YAML file.
     *
     * @param fileName name of the file from which to load
     * @param clazz the class of the object to be loaded
     * @return the object that was loaded from the file
     */
Loads an object from a YAML file.
@param fileName name of the file from which to load
@param clazz the class of the object to be loaded
@return the object that was loaded from the file
Loads an object from a YAML file . @param fileName name of the file from which to load @param clazz the class of the object to be loaded @return the object that was loaded from the file
protected static <T> T loadYamlFile(String fileName, Class<T> clazz) {
        File propFile = new File(ResourceUtils.getFilePath4Resource("e2e/" + fileName));
        try (FileInputStream input = new FileInputStream(propFile)) {
            Object yamlObject = yaml.load(input);
            String json = coder.encode(yamlObject);
            T result = coder.decode(json, clazz);
            if (result == null) {
                throw new PolicyPapRuntimeException("cannot decode " + clazz.getSimpleName() + " from " + fileName);
            }
            return result;
        } catch (FileNotFoundException e) {
            throw new PolicyPapRuntimeException("cannot find " + fileName, e);
        } catch (IOException | CoderException e) {
            throw new PolicyPapRuntimeException("cannot decode " + fileName, e);
        }
    }
protected static < T > T loadYamlFile ( String fileName , Class < T > clazz ) { File propFile = new File ( ResourceUtils . getFilePath4Resource ( "e2e/" + fileName ) ) ; try ( FileInputStream input = new FileInputStream ( propFile ) ) { Object yamlObject = yaml . load ( input ) ; String json = coder . encode ( yamlObject ) ; T result = coder . decode ( json , clazz ) ; if ( result == null ) { throw new PolicyPapRuntimeException ( "cannot decode " + clazz . getSimpleName ( ) + " from " + fileName ) ; } return result ; } catch ( FileNotFoundException e ) { throw new PolicyPapRuntimeException ( "cannot find " + fileName , e ) ; } catch ( IOException | CoderException e ) { throw new PolicyPapRuntimeException ( "cannot decode " + fileName , e ) ; } }
Loads an object from a YAML file.
Loads an object from a YAML file .