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


Java JerseyTest类代码示例

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


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

示例1: createJerseyTest

import org.glassfish.jersey.test.JerseyTest; //导入依赖的package包/类
private JerseyTest createJerseyTest(Boolean binaryCompressionOnly) {
	return new JerseyTest() {
		@Override
		protected Application configure() {
			ResourceConfig config = new ResourceConfig();
			config.register(TestResource.class);
			config.register(EncodingFilter.class);
			config.register(GZipEncoder.class);
			config.register(GatewayBinaryResponseFilter.class);
			if (binaryCompressionOnly != null) {
				config.property(GatewayBinaryResponseFilter.BINARY_COMPRESSION_ONLY_PROPERTY,
						binaryCompressionOnly);
			}
			return config;
		}
	};
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:18,代码来源:GatewayBinaryResponseFilterIntTest.java

示例2: configure

import org.glassfish.jersey.test.JerseyTest; //导入依赖的package包/类
@Override
protected Application configure() {
    ResourceConfig resourceConfig = new ResourceConfig()
            .register(LocatorFeature.class)
            .register(JacksonFeature.class)
            .register(RxJerseyClientFeature.class)
            .register(ServerResource.class)
            .register(new AbstractBinder() {
                @Override
                protected void configure() {
                    bind(RxJerseyTest.this).to(JerseyTest.class);
                }
            });

    configure(resourceConfig);

    return resourceConfig;
}
 
开发者ID:alex-shpak,项目名称:rx-jersey,代码行数:19,代码来源:RxJerseyTest.java

示例3: setup

import org.glassfish.jersey.test.JerseyTest; //导入依赖的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

示例4: setApplicationContext

import org.glassfish.jersey.test.JerseyTest; //导入依赖的package包/类
@Autowired
public void setApplicationContext(final ApplicationContext context)
{
    _jerseyTest = new JerseyTest()
    {
        @Override
        protected Application configure()
        {
            // Find first available port.
            forceSet(TestProperties.CONTAINER_PORT, "0");

            ResourceConfig application = new GraviteeApplication(authenticationProviderManager);

            application.property("contextConfig", context);
            decorate(application);

            return application;
        }

        @Override
        protected void configureClient(ClientConfig config) {
            super.configureClient(config);

            config.register(ObjectMapperResolver.class);
        }
    };
}
 
开发者ID:gravitee-io,项目名称:gravitee-management-rest-api,代码行数:28,代码来源:JerseySpringTest.java

示例5: signUpUser

import org.glassfish.jersey.test.JerseyTest; //导入依赖的package包/类
public static synchronized Credentials signUpUser(JerseyTest test) throws Exception{
    PublicKey publicKey = getPublicKey(test);
    Credentials signInUser = TestUtils.getTestUser();
    signInUser.encryptPassword(publicKey);
    String user = test.target("/auth").request().post(TestUtils.toEntity(signInUser), String.class);
    Credentials returnedUser = TestUtils.getGson().fromJson(user,Credentials.class);

    assertEquals(signInUser.getUsername(), returnedUser.getUsername());
    return returnedUser;
}
 
开发者ID:williamwebb,项目名称:divide,代码行数:11,代码来源:AuthenticationEndpointTest.java

示例6: registerToken

import org.glassfish.jersey.test.JerseyTest; //导入依赖的package包/类
private Response registerToken(Credentials user, PublicKey key, JerseyTest test){
    EncryptedEntity.Writter entity = new EncryptedEntity.Writter(key);
    entity.put("token", "whatwhat");

    Response response = target("/push")
            .request()
            .header(ContainerRequest.AUTHORIZATION, "CUSTOM " + user.getAuthToken())
            .buildPost(TestUtils.toEntity(entity)).invoke();
    int statusCode = response.getStatus();
    assertEquals(200,statusCode);
    return response;
}
 
开发者ID:williamwebb,项目名称:divide,代码行数:13,代码来源:PushEndpointTest.java

示例7: getJerseyTest

import org.glassfish.jersey.test.JerseyTest; //导入依赖的package包/类
protected JerseyTest getJerseyTest() {
  // This is instantiated on demand since we need subclasses to register the resources they need
  // passed along, but JerseyTest calls configure() from its constructor.
  if (test == null) {
    test = new JettyJerseyTest();
  }
  return test;
}
 
开发者ID:confluentinc,项目名称:rest-utils,代码行数:9,代码来源:EmbeddedServerTestHarness.java

示例8: getHarness

import org.glassfish.jersey.test.JerseyTest; //导入依赖的package包/类
public JerseyTest getHarness() {
    return harness;
}
 
开发者ID:yahoo,项目名称:fili,代码行数:4,代码来源:JerseyTestBinder.java

示例9: getPublicKey

import org.glassfish.jersey.test.JerseyTest; //导入依赖的package包/类
public static synchronized PublicKey getPublicKey(JerseyTest test) throws Exception{
        String publicKeyBytes = test.target("/auth/key").request().get(String.class);
        byte[] bytes = TestUtils.getGson().fromJson(publicKeyBytes,byte[].class);
    return Crypto.pubKeyFromBytes(bytes);
}
 
开发者ID:williamwebb,项目名称:divide,代码行数:6,代码来源:AuthenticationEndpointTest.java

示例10: runJerseyTest

import org.glassfish.jersey.test.JerseyTest; //导入依赖的package包/类
/**
 * <ol>
 * <li>calls {@link JerseyTest#setUp()}
 * <li>passes the initialized JerseyTest to the consumer.
 * <li>calls {@link JerseyTest#tearDown()}
 * </ol>
 *
 * @param jerseyTest
 * @param test
 * @throws Exception
 */
public void runJerseyTest(JerseyTest jerseyTest, ThrowingConsumer<JerseyTest> test) throws Exception {
	try {
		jerseyTest.setUp();
		test.accept(jerseyTest);
	} finally {
		jerseyTest.tearDown();
	}
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:20,代码来源:DynamicJerseyTestRunner.java


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