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


Java AppDescriptor类代码示例

本文整理汇总了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();
}
 
开发者ID:bazaarvoice,项目名称:jersey-hmac-auth,代码行数:26,代码来源:HmacAuthProviderTest.java

示例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();
}
 
开发者ID:openstack,项目名称:monasca-common,代码行数:27,代码来源:AbstractResourceTest.java

示例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();
}
 
开发者ID:eurekaclinical,项目名称:eureka,代码行数:15,代码来源:AbstractResourceTest.java

示例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();
}
 
开发者ID:trimou,项目名称:trimou,代码行数:9,代码来源:TrimouViewRendererTest.java

示例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();
}
 
开发者ID:bmwcarit,项目名称:joynr,代码行数:12,代码来源:AclServletTest.java

示例6: configure

import com.sun.jersey.test.framework.AppDescriptor; //导入依赖的package包/类
@Override
public AppDescriptor configure() {
    return new WebAppDescriptor.Builder("org.onosproject.rest").build();
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:5,代码来源:ResourceTest.java

示例7: configure

import com.sun.jersey.test.framework.AppDescriptor; //导入依赖的package包/类
@Override
protected AppDescriptor configure(){
	return new WebAppDescriptor.Builder().build();
}
 
开发者ID:HareDB,项目名称:HareDBWebRESTful,代码行数:5,代码来源:HBaseAdminResourceTest.java

示例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();
}
 
开发者ID:anotheria,项目名称:moskito-central,代码行数:6,代码来源:RESTConnectorHttpBasicAuthTest.java


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