• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java YamlConfigurationFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中io.dropwizard.configuration.YamlConfigurationFactory的典型用法代码示例。如果您正苦于以下问题:Java YamlConfigurationFactory类的具体用法?Java YamlConfigurationFactory怎么用?Java YamlConfigurationFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



YamlConfigurationFactory类属于io.dropwizard.configuration包,在下文中一共展示了YamlConfigurationFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testGetAuthFilters

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
@Test
public void testGetAuthFilters() throws Exception {
    final TrellisConfiguration config = new YamlConfigurationFactory<>(TrellisConfiguration.class,
            Validators.newValidator(), Jackson.newObjectMapper(), "")
        .build(new File(getClass().getResource("/config1.yml").toURI()));

    final Optional<List<AuthFilter>> filters = TrellisUtils.getAuthFilters(config);
    assertTrue(filters.isPresent());
    filters.ifPresent(f -> assertEquals(3L, f.size()));

    config.getAuth().getAnon().setEnabled(false);
    config.getAuth().getBasic().setEnabled(false);
    config.getAuth().getJwt().setEnabled(false);

    assertFalse(TrellisUtils.getAuthFilters(config).isPresent());
}
 
开发者ID:trellis-ldp,项目名称:trellis-rosid,代码行数:17,代码来源:TrellisUtilsTest.java


示例2: testConfigurationAuth1

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
@Test
public void testConfigurationAuth1() throws Exception {
    final TrellisConfiguration config = new YamlConfigurationFactory<>(TrellisConfiguration.class,
            Validators.newValidator(), Jackson.newObjectMapper(), "")
        .build(new File(getClass().getResource("/config1.yml").toURI()));

    assertTrue(config.getAuth().getWebac().getEnabled());
    assertEquals((Long) 100L, config.getAuth().getWebac().getCacheSize());
    assertEquals((Long) 10L, config.getAuth().getWebac().getCacheExpireSeconds());
    assertTrue(config.getAuth().getAnon().getEnabled());
    assertTrue(config.getAuth().getBasic().getEnabled());
    assertEquals("users.auth", config.getAuth().getBasic().getUsersFile());
    assertTrue(config.getAuth().getJwt().getEnabled());
    assertEquals("secret", config.getAuth().getJwt().getKey());
    assertFalse(config.getAuth().getJwt().getBase64Encoded());
}
 
开发者ID:trellis-ldp,项目名称:trellis-rosid,代码行数:17,代码来源:TrellisConfigurationTest.java


示例3: canDeserializeCorrectly

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
@Test
public void canDeserializeCorrectly() throws IOException, ConfigurationException {
    final HikariDataSourceFactory factory = new YamlConfigurationFactory<>(HikariDataSourceFactory.class,
            BaseValidator.newValidator(), Jackson.newObjectMapper(), "dw")
            .build(new ResourceConfigurationSourceProvider(), "config.yaml");

    assertThat(factory.getUser()).isEqualTo("nick");
    assertThat(factory.getPassword()).isEqualTo("nickss");
    assertThat(factory.getDatasourceClassName()).isEqualTo("org.postgresql.ds.PGSimpleDataSource");
    assertThat(factory.getProperties()).containsExactly(entry("databaseName", "postgres"));
    assertThat(factory.getMinSize()).isEqualTo(OptionalInt.empty());
    assertThat(factory.getMaxSize()).isEqualTo(12);
    assertThat(factory.isAutoCommit()).isTrue();
}
 
开发者ID:nickbabcock,项目名称:dropwizard-hikaricp-benchmark,代码行数:15,代码来源:HikariDataSourceFactoryTest.java


示例4: testGetAssetConfigurations

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
@Test
public void testGetAssetConfigurations() throws Exception {
    final TrellisConfiguration config = new YamlConfigurationFactory<>(TrellisConfiguration.class,
            Validators.newValidator(), Jackson.newObjectMapper(), "")
        .build(new File(getClass().getResource("/config1.yml").toURI()));

    final Map<String, String> assets = TrellisUtils.getAssetConfiguration(config);
    assertEquals(3L, assets.size());
    assertEquals("http://example.org/image.icon", assets.get("icon"));
    assertEquals("http://example.org/styles1.css,http://example.org/styles2.css",
            assets.get("css"));
    assertEquals("http://example.org/scripts1.js,http://example.org/scripts2.js",
            assets.get("js"));
}
 
开发者ID:trellis-ldp,项目名称:trellis-rosid,代码行数:15,代码来源:TrellisUtilsTest.java


示例5: testGetKafkaProperties

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
@Test
public void testGetKafkaProperties() throws Exception {
    final TrellisConfiguration config = new YamlConfigurationFactory<>(TrellisConfiguration.class,
            Validators.newValidator(), Jackson.newObjectMapper(), "")
        .build(new File(getClass().getResource("/config1.yml").toURI()));

    final Properties props = TrellisUtils.getKafkaProperties(config);

    assertEquals("org.apache.kafka.common.serialization.StringSerializer", props.getProperty("key.serializer"));
    assertEquals("org.apache.kafka.common.serialization.StringSerializer", props.getProperty("value.serializer"));
    assertEquals("localhost:9092", props.getProperty("bootstrap.servers"));
}
 
开发者ID:trellis-ldp,项目名称:trellis-rosid,代码行数:13,代码来源:TrellisUtilsTest.java


示例6: testGetCurator

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
@Test
public void testGetCurator() throws Exception {
    final TestingServer zk = new TestingServer(true);

    final TrellisConfiguration config = new YamlConfigurationFactory<>(TrellisConfiguration.class,
            Validators.newValidator(), Jackson.newObjectMapper(), "")
        .build(new File(getClass().getResource("/config1.yml").toURI()));

    config.getZookeeper().setEnsembleServers(zk.getConnectString());

    final CuratorFramework curator = TrellisUtils.getCuratorClient(config);
    assertEquals(CuratorFrameworkState.STARTED, curator.getState());
}
 
开发者ID:trellis-ldp,项目名称:trellis-rosid,代码行数:14,代码来源:TrellisUtilsTest.java


示例7: testConfigurationGeneral1

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
@Test
public void testConfigurationGeneral1() throws Exception {
    final TrellisConfiguration config = new YamlConfigurationFactory<>(TrellisConfiguration.class,
            Validators.newValidator(), Jackson.newObjectMapper(), "")
        .build(new File(getClass().getResource("/config1.yml").toURI()));

    assertTrue(config.getAsync());
    assertEquals("Trellis", config.getDefaultName());
    assertEquals((Integer) 86400, config.getCacheMaxAge());
    assertEquals((Long) 100L, config.getJsonLdCacheSize());
    assertEquals((Long) 24L, config.getJsonLdCacheExpireHours());
    assertTrue(config.getJsonLdDomainWhitelist().isEmpty());
    assertTrue(config.getJsonLdWhitelist().contains("http://example.org/context.json"));
}
 
开发者ID:trellis-ldp,项目名称:trellis-rosid,代码行数:15,代码来源:TrellisConfigurationTest.java


示例8: testConfigurationAssets1

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
@Test
public void testConfigurationAssets1() throws Exception {
    final TrellisConfiguration config = new YamlConfigurationFactory<>(TrellisConfiguration.class,
            Validators.newValidator(), Jackson.newObjectMapper(), "")
        .build(new File(getClass().getResource("/config1.yml").toURI()));

    assertEquals("http://example.org/image.icon", config.getAssets().getIcon());
    assertTrue(config.getAssets().getJs().contains("http://example.org/scripts1.js"));
    assertTrue(config.getAssets().getCss().contains("http://example.org/styles1.css"));
}
 
开发者ID:trellis-ldp,项目名称:trellis-rosid,代码行数:11,代码来源:TrellisConfigurationTest.java


示例9: testConfigurationLocations

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
@Test
public void testConfigurationLocations() throws Exception {
    final TrellisConfiguration config = new YamlConfigurationFactory<>(TrellisConfiguration.class,
            Validators.newValidator(), Jackson.newObjectMapper(), "")
        .build(new File(getClass().getResource("/config1.yml").toURI()));

    assertEquals("/tmp/trellisData/binaries", config.getBinaries().getPath());
    assertEquals("/tmp/trellisData/resources", config.getResources().getPath());
    assertEquals("http://localhost:8080/", config.getBaseUrl());
    assertEquals((Integer) 4, config.getBinaries().getLevels());
    assertEquals((Integer) 2, config.getBinaries().getLength());
}
 
开发者ID:trellis-ldp,项目名称:trellis-rosid,代码行数:13,代码来源:TrellisConfigurationTest.java


示例10: testConfigurationNamespaces1

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
@Test
public void testConfigurationNamespaces1() throws Exception {
    final TrellisConfiguration config = new YamlConfigurationFactory<>(TrellisConfiguration.class,
            Validators.newValidator(), Jackson.newObjectMapper(), "")
        .build(new File(getClass().getResource("/config1.yml").toURI()));

    assertEquals("/tmp/trellisData/namespaces.json", config.getNamespaces().getFile());
}
 
开发者ID:trellis-ldp,项目名称:trellis-rosid,代码行数:9,代码来源:TrellisConfigurationTest.java


示例11: testConfigurationCORS1

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
@Test
public void testConfigurationCORS1() throws Exception {
    final TrellisConfiguration config = new YamlConfigurationFactory<>(TrellisConfiguration.class,
            Validators.newValidator(), Jackson.newObjectMapper(), "")
        .build(new File(getClass().getResource("/config1.yml").toURI()));

    assertTrue(config.getCors().getEnabled());
    assertTrue(config.getCors().getAllowOrigin().contains("*"));
    assertTrue(config.getCors().getAllowHeaders().contains("Link"));
    assertTrue(config.getCors().getAllowMethods().contains("PATCH"));
    assertTrue(config.getCors().getExposeHeaders().contains("Location"));
    assertEquals((Integer) 180, config.getCors().getMaxAge());
    assertTrue(config.getCors().getAllowCredentials());
}
 
开发者ID:trellis-ldp,项目名称:trellis-rosid,代码行数:15,代码来源:TrellisConfigurationTest.java


示例12: testConfigurationZookeeper1

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
@Test
public void testConfigurationZookeeper1() throws Exception {
    final TrellisConfiguration config = new YamlConfigurationFactory<>(TrellisConfiguration.class,
            Validators.newValidator(), Jackson.newObjectMapper(), "")
        .build(new File(getClass().getResource("/config1.yml").toURI()));

    assertEquals("localhost:2181", config.getZookeeper().getEnsembleServers());
    assertEquals((Integer) 100, config.getZookeeper().getTimeout());
    assertEquals((Integer) 1000, config.getZookeeper().getRetryMs());
    assertEquals((Integer) 10, config.getZookeeper().getRetryMax());
    assertEquals((Integer) 50, config.getZookeeper().getRetryMaxMs());
}
 
开发者ID:trellis-ldp,项目名称:trellis-rosid,代码行数:13,代码来源:TrellisConfigurationTest.java


示例13: testConfigurationKafka1

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
@Test
public void testConfigurationKafka1() throws Exception {
    final TrellisConfiguration config = new YamlConfigurationFactory<>(TrellisConfiguration.class,
            Validators.newValidator(), Jackson.newObjectMapper(), "")
        .build(new File(getClass().getResource("/config1.yml").toURI()));

    assertEquals("localhost:9092", config.getKafka().getBootstrapServers());

    final Properties props = config.getKafka().asProperties();
    assertEquals("all", props.getProperty("acks"));
    assertEquals("16384", props.getProperty("batch.size"));
    assertEquals("otherValue", props.getProperty("otherProperty"));
}
 
开发者ID:trellis-ldp,项目名称:trellis-rosid,代码行数:14,代码来源:TrellisConfigurationTest.java


示例14: getPac4jFactory

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
protected Pac4jFactory getPac4jFactory(
        Collection<Pac4jFeatureSupport> featuresSupported,
        String resourceName) throws Exception {
    ObjectMapper om = Jackson.newObjectMapper();
    Bootstrap<?> b = mock(Bootstrap.class);
    when(b.getObjectMapper()).thenReturn(om);

    for (Pac4jFeatureSupport fs : featuresSupported) {
        fs.setup(b);
    }

    return new YamlConfigurationFactory<>(Pac4jFactory.class,
            Validators.newValidator(), om, "dw").build(
                    new File(Resources.getResource(resourceName).toURI()));
}
 
开发者ID:pac4j,项目名称:dropwizard-pac4j,代码行数:16,代码来源:AbstractConfigurationTest.java


示例15: load

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
private JettyClientConfiguration load(String configLocation) {
    try {
        return new YamlConfigurationFactory<>(JettyClientConfiguration.class,
                Validators.newValidator(),
                Jackson.newObjectMapper(), "dw-http-client")
                .build(new File(Resources.getResource(configLocation).toURI()));
    } catch (Exception e) {
        throw new IllegalArgumentException(e);
    }
}
 
开发者ID:arteam,项目名称:dropwizard-http2-client,代码行数:11,代码来源:JettyClientConfigurationTest.java


示例16: withConfigurationClass

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
public AdminConsoleAppBuilder<T> withConfigurationClass(final Class<T> configurationClass)
{
    factoryFactory = new ConfigurationFactoryFactory<T>()
    {
        @Override
        public ConfigurationFactory<T> create(Class<T> klass, Validator validator, ObjectMapper objectMapper, String propertyPrefix)
        {
            return new YamlConfigurationFactory<>(configurationClass, validator, objectMapper, propertyPrefix);
        }
    };
    return this;
}
 
开发者ID:soabase,项目名称:soabase,代码行数:13,代码来源:AdminConsoleAppBuilder.java


示例17: YamlInstanceDiscovery

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
public YamlInstanceDiscovery(Path path,
                             Validator validator,
                             ObjectMapper objectMapper) {
    this.path = path;
    this.configurationFactory = new YamlConfigurationFactory<>(
            YamlInstanceConfiguration.class,
            validator,
            objectMapper,
            "dw");
    parseYamlInstanceConfiguration();
}
 
开发者ID:yammer,项目名称:breakerbox,代码行数:12,代码来源:YamlInstanceDiscovery.java


示例18: setupTest

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
@Before
public void setupTest() throws Exception {
    azureTableConfiguration = new YamlConfigurationFactory<>(
            AzureTableConfiguration.class,
            Validation.buildDefaultValidatorFactory().getValidator(),
            Jackson.newObjectMapper(),
            "dw.").build(new File(Resources.getResource("azure-test.yml").toURI()));
}
 
开发者ID:yammer,项目名称:breakerbox,代码行数:9,代码来源:WithConfiguration.java


示例19: connect

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
private void connect() throws URISyntaxException, IOException, ConfigurationException {
    final File yml = new File(Resources.getResource(serializer).toURI());
    final YamlConfigurationFactory<TinkerPopFactory> factory =
            new YamlConfigurationFactory<>(TinkerPopFactory.class, validator, objectMapper, "dw");
    final Cluster cluster = factory.build(yml).build();
    final Graph graph = EmptyGraph.instance();
    client = cluster.connect();
    g = graph.traversal().withRemote(DriverRemoteConnection.using(cluster, "g"));
}
 
开发者ID:experoinc,项目名称:dropwizard-tinkerpop,代码行数:10,代码来源:TinkerPopFactoryTest.java


示例20: testFactory

import io.dropwizard.configuration.YamlConfigurationFactory; //导入依赖的package包/类
protected T testFactory(YamlConfigurationFactory<T> factory, String yamlFile, Class clazz) throws Exception {
    final File yml = new File(Resources.getResource(yamlFile).toURI());
    T t = factory.build(yml);
    assertThat(t).isInstanceOf(clazz);
    return t;
}
 
开发者ID:ExpediaDotCom,项目名称:haystack-client-java,代码行数:7,代码来源:BaseFactoryTest.java



注:本文中的io.dropwizard.configuration.YamlConfigurationFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Method类代码示例发布时间:2022-05-22
下一篇:
Java StringMap类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap