本文整理汇总了Java中com.sun.jersey.test.framework.AppDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java AppDescriptor类的具体用法?Java AppDescriptor怎么用?Java AppDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AppDescriptor类属于com.sun.jersey.test.framework包,在下文中一共展示了AppDescriptor类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import com.sun.jersey.test.framework.AppDescriptor; //导入依赖的package包/类
@Override
protected AppDescriptor configure() {
this.requestConfiguration = RequestConfiguration.builder().withApiKeyQueryParamName("passkey")
.withSignatureHttpHeader("duck-duck-signature-header")
.withTimestampHttpHeader("duck-duck-timestamp-header")
.withVersionHttpHeader("duck-duck-version-header")
.build();
final Authenticator<String> authenticator = new Authenticator<String>() {
@Override
public String authenticate(Credentials credentials) {
if (GOOD_API_KEY.equals(credentials.getApiKey())) {
return GOOD_API_KEY;
}
if (INTERNAL_ERROR.equals(credentials.getApiKey())) {
throw new IllegalStateException("An internal error occurred");
}
return null;
}
};
ResourceConfig config = new ScanningResourceConfig();
config.getSingletons().add(new HmacAuthProvider<String>(new DefaultRequestHandler<String>(authenticator, requestConfiguration)));
config.getSingletons().add(new AuthResource());
return new LowLevelAppDescriptor.Builder(config).build();
}
示例2: beforeTestCase
import com.sun.jersey.test.framework.AppDescriptor; //导入依赖的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: configure
import com.sun.jersey.test.framework.AppDescriptor; //导入依赖的package包/类
@Override
protected AppDescriptor configure() {
ClientConfig clientConfig = new DefaultClientConfig();
clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING,
Boolean.TRUE);
clientConfig.getClasses().add(ObjectMapperProvider.class);
;
Builder builder = (new WebAppDescriptor.Builder())
.contextListenerClass(getListener())
.filterClass(getFilter())
.clientConfig(clientConfig);
return builder.build();
}
示例4: configure
import com.sun.jersey.test.framework.AppDescriptor; //导入依赖的package包/类
@Override
protected AppDescriptor configure() {
final DefaultResourceConfig config = new DefaultResourceConfig();
final ViewRenderer renderer = new TrimouViewRenderer.Builder().build();
config.getSingletons().add(new ViewMessageBodyWriter(new MetricRegistry(), ImmutableList.of(renderer)));
config.getSingletons().add(new TestResource());
return new LowLevelAppDescriptor.Builder(config).build();
}
示例5: configure
import com.sun.jersey.test.framework.AppDescriptor; //导入依赖的package包/类
@Override
protected AppDescriptor configure() {
gson = new GsonBuilder().create();
return new WebAppDescriptor.Builder().contextListenerClass(TestContextListener.class)
.initParam("com.sun.jersey.config.property.packages",
"io.joynr.accesscontrol.global")
.filterClass(com.google.inject.servlet.GuiceFilter.class)
.contextPath("")
.servletPath("/")
.build();
}
示例6: configure
import com.sun.jersey.test.framework.AppDescriptor; //导入依赖的package包/类
@Override
public AppDescriptor configure() {
return new WebAppDescriptor.Builder("org.onosproject.rest").build();
}
示例7: configure
import com.sun.jersey.test.framework.AppDescriptor; //导入依赖的package包/类
@Override
protected AppDescriptor configure(){
return new WebAppDescriptor.Builder().build();
}
示例8: configure
import com.sun.jersey.test.framework.AppDescriptor; //导入依赖的package包/类
@Override
protected AppDescriptor configure() {
return new WebAppDescriptor.Builder("org.moskito.central.connectors.rest;org.codehaus.jackson.jaxrs")
.initParam(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS, HttpBasicAuthFilter.class.getName()).build();
}