當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。