Examples of loadAs()


Examples of br.com.objectos.way.etc.Config.loadAs()

        .user(USER_A)
        .build();

    Config config = configProvider.get();
    String data = config.toString(global);
    Global res = config.loadAs(data, Global.class);

    User user = res.getUser();
    assertThat(user.getName(), equalTo(USER_A.getName()));
    assertThat(user.getEmail(), equalTo(USER_A.getEmail()));
  }
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.loadAs()

   * @return ClusterConfig Java wrapper of the configuration file
   */
  public YAMLClusterConfig setupCluster(InputStream input) {
    // parse the YAML
    Yaml yaml = new Yaml();
    YAMLClusterConfig cfg = yaml.loadAs(input, YAMLClusterConfig.class);

    // create the cluster
    HelixAdmin helixAdmin = new ZKHelixAdmin(_zkAddress);
    if (cfg.clusterName == null) {
      throw new HelixException("Cluster name is required!");
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.loadAs()

        settingsDescription.putListPropertyType("hosts", String.class);
        settingsDescription.putListPropertyType("serializers", SerializerSettings.class);
        constructor.addTypeDescription(settingsDescription);

        final Yaml yaml = new Yaml(constructor);
        return yaml.loadAs(stream, Settings.class);
    }

    static class ConnectionPoolSettings {
        public boolean enableSsl = false;
        public int minSize = ConnectionPool.MIN_POOL_SIZE;
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.loadAs()

  public static void main(String[] args) {

    Yaml yaml = new Yaml();
    InputStream resourceAsStream =
        ClassLoader.getSystemClassLoader().getResourceAsStream("hello_world_app_spec.yaml");
    HelloworldAppSpec spec = yaml.loadAs(resourceAsStream, HelloworldAppSpec.class);
    String dump = yaml.dump(spec);
    System.out.println(dump);
    System.out.println(spec.getServiceConfig("HelloWorld").getStringField("num_containers", "1"));

  }
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.loadAs()

  public static void main(String[] args) {

    Yaml yaml = new Yaml();
    InputStream resourceAsStream =
        ClassLoader.getSystemClassLoader().getResourceAsStream("job_runner_app_spec.yaml");
    MyTaskAppSpec spec = yaml.loadAs(resourceAsStream, MyTaskAppSpec.class);
    String dump = yaml.dump(spec);
    System.out.println(dump);
    System.out.println(spec.getServiceConfig("JobRunner").getStringField("num_containers", "1"));

  }
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.loadAs()

   * @return ClusterConfig Java wrapper of the configuration file
   */
  public YAMLClusterConfig setupCluster(InputStream input) {
    // parse the YAML
    Yaml yaml = new Yaml();
    YAMLClusterConfig cfg = yaml.loadAs(input, YAMLClusterConfig.class);

    // create the cluster
    HelixAdmin helixAdmin = new ZKHelixAdmin(_zkAddress);
    if (cfg.clusterName == null) {
      throw new HelixException("Cluster name is required!");
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.loadAs()

            Constructor constructor = new Constructor(StressYaml.class);

            Yaml yaml = new Yaml(constructor);

            StressYaml profileYaml = yaml.loadAs(new ByteArrayInputStream(profileBytes), StressYaml.class);

            StressProfile profile = new StressProfile();
            profile.init(profileYaml);

            return profile;
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.loadAs()

    Config config;
    if (Files.exists(configFile)) {
      try (InputStream is = Files.newInputStream(configFile)) {
        Yaml yaml = new Yaml();
        config = yaml.loadAs(is, Config.class);
      }
    } else {
      config = new Config();
    }
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.loadAs()

    Config config;
    if (Files.exists(configFile)) {
      try (InputStream is = Files.newInputStream(configFile)) {
        Yaml yaml = new Yaml();
        config = yaml.loadAs(is, Config.class);
      }
    } else {
      config = new Config();
    }
View Full Code Here

Examples of org.yaml.snakeyaml.Yaml.loadAs()

            seedDesc.putMapPropertyType("parameters", String.class, String.class);
            constructor.addTypeDescription(seedDesc);
            MissingPropertiesChecker propertiesChecker = new MissingPropertiesChecker();
            constructor.setPropertyUtils(propertiesChecker);
            Yaml yaml = new Yaml(constructor);
            Config result = yaml.loadAs(new ByteArrayInputStream(configBytes), Config.class);
            propertiesChecker.check();
            return result;
        }
        catch (YAMLException e)
        {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.