本文整理汇总了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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}