当前位置: 首页>>代码示例>>Java>>正文


Java DropwizardResourceConfig类代码示例

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


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

示例1: setUp

import io.dropwizard.jersey.DropwizardResourceConfig; //导入依赖的package包/类
@Before
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
    when(environment.jersey()).thenReturn(jerseyEnvironment);
    when(jerseyEnvironment.getResourceConfig()).thenReturn(new DropwizardResourceConfig());
    when(environment.healthChecks()).thenReturn(healthChecks);

    when(factory.build(eq(bundle),
            any(Environment.class),
            any(DataSourceFactory.class),
            anyList(),
            eq("hibernate-entitymanager"))).thenReturn(entityManagerFactory);

    when(sharedEntityManagerFactory.build(any(EntityManagerContext.class)))
            .thenReturn(sharedEntityManager);
}
 
开发者ID:scottescue,项目名称:dropwizard-entitymanager,代码行数:17,代码来源:EntityManagerBundleTest.java

示例2: beforeTestCase

import io.dropwizard.jersey.DropwizardResourceConfig; //导入依赖的package包/类
@BeforeMethod
protected void beforeTestCase() throws Exception {
  singletons.clear();
  providers.clear();
  features.clear();
  properties.clear();
  setupResources();

  test = new JerseyTest() {
    @Override
    protected AppDescriptor configure() {
      final DropwizardResourceConfig config = DropwizardResourceConfig.forTesting(metricRegistry);
      for (Class<?> provider : providers)
        config.getClasses().add(provider);
      for (Map.Entry<String, Boolean> feature : features.entrySet())
        config.getFeatures().put(feature.getKey(), feature.getValue());
      for (Map.Entry<String, Object> property : properties.entrySet())
        config.getProperties().put(property.getKey(), property.getValue());
      config.getSingletons().add(new JacksonMessageBodyProvider(objectMapper, validator));
      config.getSingletons().addAll(singletons);
      return new LowLevelAppDescriptor.Builder(config).build();
    }
  };

  test.setUp();
}
 
开发者ID:openstack,项目名称:monasca-common,代码行数:27,代码来源:AbstractResourceTest.java

示例3: createTypicalAuthBootstrap

import io.dropwizard.jersey.DropwizardResourceConfig; //导入依赖的package包/类
private static AuthenticationBootstrap createTypicalAuthBootstrap() {
    final UserDAO userDAO = mock(UserDAO.class);
    final Server s = new Server(0);
    final Servlet se = new ServletContainer();
    final JerseyEnvironment env = new JerseyEnvironment(new JerseyContainerHolder(se), new DropwizardResourceConfig());

    return new AuthenticationBootstrap(env, userDAO);
}
 
开发者ID:adamkewley,项目名称:jobson,代码行数:9,代码来源:CustomAuthenticatorConfigTest.java

示例4: configure

import io.dropwizard.jersey.DropwizardResourceConfig; //导入依赖的package包/类
@Override
protected Application configure() {
    forceSet(TestProperties.CONTAINER_PORT, "0");
    return DropwizardResourceConfig.forTesting(new MetricRegistry())
            .register(LazyParamFeature.class)
            .register(TestResource.class);
}
 
开发者ID:dropwizard,项目名称:dropwizard-vavr,代码行数:8,代码来源:LazyParamConverterProviderTest.java

示例5: configure

import io.dropwizard.jersey.DropwizardResourceConfig; //导入依赖的package包/类
@Override
protected Application configure() {
    forceSet(TestProperties.CONTAINER_PORT, "0");
    return DropwizardResourceConfig.forTesting(new MetricRegistry())
            .register(OptionParamFeature.class)
            .register(TestResource.class);
}
 
开发者ID:dropwizard,项目名称:dropwizard-vavr,代码行数:8,代码来源:OptionParamConverterProviderTest.java

示例6: configure

import io.dropwizard.jersey.DropwizardResourceConfig; //导入依赖的package包/类
@Override
protected Application configure() {
    forceSet(TestProperties.CONTAINER_PORT, "0");
    return DropwizardResourceConfig.forTesting(new MetricRegistry())
            .register(ValueMessageBodyWriter.class)
            .register(EmptyValueExceptionMapper.class)
            .register(TestResource.class);
}
 
开发者ID:dropwizard,项目名称:dropwizard-vavr,代码行数:9,代码来源:ValueMessageBodyWriterTest.java

示例7: configure

import io.dropwizard.jersey.DropwizardResourceConfig; //导入依赖的package包/类
@Override
protected Application configure() {
    forceSet(TestProperties.CONTAINER_PORT, "0");
    return DropwizardResourceConfig.forTesting(new MetricRegistry())
            .register(EitherMessageBodyWriter.class)
            .register(EmptyValueExceptionMapper.class)
            .register(TestResource.class);
}
 
开发者ID:dropwizard,项目名称:dropwizard-vavr,代码行数:9,代码来源:EitherMessageBodyWriterTest.java

示例8: configure

import io.dropwizard.jersey.DropwizardResourceConfig; //导入依赖的package包/类
@Override
protected Application configure() {
    forceSet(TestProperties.CONTAINER_PORT, "0");
    return DropwizardResourceConfig.forTesting(new MetricRegistry())
            .register(EmptyValueExceptionMapper.class)
            .register(TestResource.class);
}
 
开发者ID:dropwizard,项目名称:dropwizard-vavr,代码行数:8,代码来源:EmptyValueExceptionMapperTest.java

示例9: setUp

import io.dropwizard.jersey.DropwizardResourceConfig; //导入依赖的package包/类
@Before
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
    when(environment.healthChecks()).thenReturn(healthChecks);
    when(environment.jersey()).thenReturn(jerseyEnvironment);
    when(jerseyEnvironment.getResourceConfig()).thenReturn(new DropwizardResourceConfig());


    when(factory.build(eq(bundle),
                       any(Environment.class),
                       any(DataSourceFactory.class),
                       anyList(),
                       eq("hibernate"))).thenReturn(sessionFactory);
}
 
开发者ID:mtakaki,项目名称:CredentialStorageService-dw-hibernate,代码行数:15,代码来源:HibernateBundleTest.java

示例10: setup

import io.dropwizard.jersey.DropwizardResourceConfig; //导入依赖的package包/类
@Before
public void setup() throws Exception {
    testConfig.shards.setShards(ImmutableList.of(createConfig("1"), createConfig("2")));
    when(jerseyEnvironment.getResourceConfig()).thenReturn(new DropwizardResourceConfig());
    when(environment.jersey()).thenReturn(jerseyEnvironment);
    when(environment.lifecycle()).thenReturn(lifecycleEnvironment);
    when(environment.healthChecks()).thenReturn(healthChecks);

}
 
开发者ID:santanusinha,项目名称:dropwizard-db-sharding-bundle,代码行数:10,代码来源:DBShardingBundleBaseTest.java

示例11: setup

import io.dropwizard.jersey.DropwizardResourceConfig; //导入依赖的package包/类
public void setup() throws Exception {
  singletons.add(new InternalExceptionMapper());

  test = new JerseyTest() {
    @Override
    protected TestContainerFactory getTestContainerFactory() throws TestContainerException {
      return new InMemoryTestContainerFactory();
    }

    @Override
    protected DeploymentContext configureDeployment() {
      final DropwizardResourceConfig resourceConfig = new DropwizardResourceConfig();

      for (Object singleton : singletons) {
        resourceConfig.register(singleton);
      }

      ServletDeploymentContext deploymentContext = ServletDeploymentContext.builder(resourceConfig)
          .initParam(ServletProperties.JAXRS_APPLICATION_CLASS, DropwizardResourceConfig.class.getName())
          .build();

      return deploymentContext;

    }

    @Override
    protected void configureClient(ClientConfig config) {
      JacksonJsonProvider jsonProvider = new JacksonJsonProvider();
      jsonProvider.setMapper(Jackson.newObjectMapper());
      config.register(jsonProvider);
    }
  };

  test.setUp();
}
 
开发者ID:zeelichsheng,项目名称:auth,代码行数:36,代码来源:ResourceTestHelper.java

示例12: initJerseyAdmin

import io.dropwizard.jersey.DropwizardResourceConfig; //导入依赖的package包/类
private void initJerseyAdmin(SoaConfiguration configuration, SoaFeaturesImpl features, Ports ports, final Environment environment, AbstractBinder binder)
{
    if ( (configuration.getAdminJerseyPath() == null) || !ports.adminPort.hasPort() )
    {
        return;
    }

    String jerseyRootPath = configuration.getAdminJerseyPath();
    if ( !jerseyRootPath.endsWith("/*") )
    {
        if ( jerseyRootPath.endsWith("/") )
        {
            jerseyRootPath += "*";
        }
        else
        {
            jerseyRootPath += "/*";
        }
    }

    DropwizardResourceConfig jerseyConfig = new DropwizardResourceConfig(environment.metrics());
    jerseyConfig.setUrlPattern(jerseyRootPath);

    JerseyContainerHolder jerseyServletContainer = new JerseyContainerHolder(new ServletContainer(jerseyConfig));
    environment.admin().addServlet("soa-admin-jersey", jerseyServletContainer.getContainer()).addMapping(jerseyRootPath);

    JerseyEnvironment jerseyEnvironment = new JerseyEnvironment(jerseyServletContainer, jerseyConfig);
    features.putNamed(jerseyEnvironment, JerseyEnvironment.class, SoaFeatures.ADMIN_NAME);
    jerseyEnvironment.register(SoaApis.class);
    jerseyEnvironment.register(DiscoveryApis.class);
    jerseyEnvironment.register(DynamicAttributeApis.class);
    jerseyEnvironment.register(LoggingApis.class);
    jerseyEnvironment.register(binder);
    jerseyEnvironment.setUrlPattern(jerseyConfig.getUrlPattern());
    jerseyEnvironment.register(new JacksonMessageBodyProvider(environment.getObjectMapper()));

    checkCorsFilter(configuration, environment.admin());
    checkAdminGuiceFeature(environment, jerseyEnvironment);
}
 
开发者ID:soabase,项目名称:soabase,代码行数:40,代码来源:SoaBundle.java

示例13: configure

import io.dropwizard.jersey.DropwizardResourceConfig; //导入依赖的package包/类
@Override
protected Application configure() {
    forceSet(TestProperties.CONTAINER_PORT, "0");
    return DropwizardResourceConfig.forTesting(new MetricRegistry())
            .register(OptionalParamFeature.class)
            .register(OptionalQueryParamResource.class)
            .register(MyMessageParamConverterProvider.class);
}
 
开发者ID:dropwizard,项目名称:dropwizard-java8,代码行数:9,代码来源:OptionalQueryParamResourceTest.java

示例14: configure

import io.dropwizard.jersey.DropwizardResourceConfig; //导入依赖的package包/类
@Override
protected Application configure() {
    forceSet(TestProperties.CONTAINER_PORT, "0");
    return DropwizardResourceConfig.forTesting(new MetricRegistry())
            .register(OptionalMessageBodyWriter.class)
            .register(OptionalReturnResource.class);
}
 
开发者ID:dropwizard,项目名称:dropwizard-java8,代码行数:8,代码来源:OptionalMessageBodyWriterTest.java

示例15: configure

import io.dropwizard.jersey.DropwizardResourceConfig; //导入依赖的package包/类
@Override
protected Application configure() {
    forceSet(TestProperties.CONTAINER_PORT, "0");
    return DropwizardResourceConfig.forTesting(new MetricRegistry())
            .register(OptionalParamFeature.class)
            .register(OptionalCookieParamResource.class)
            .register(MyMessageParamConverterProvider.class);
}
 
开发者ID:dropwizard,项目名称:dropwizard-java8,代码行数:9,代码来源:OptionalCookieParamResourceTest.java


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