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


Java TestContainerFactory类代码示例

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


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

示例1: SpringContextJerseyTest

import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
/**
 * An extending class must implement the {@link #configure()} method to
 * provide an application descriptor.
 *
 * @throws TestContainerException if the default test container factory
 *                                cannot be obtained, or the application descriptor is not
 *                                supported by the test container factory.
 */
public SpringContextJerseyTest() throws TestContainerException {
    ResourceConfig config = getResourceConfig(configure());
    config.register(new ServiceFinderBinder<TestContainerFactory>(TestContainerFactory.class, null, RuntimeType.SERVER));

    if (isLogRecordingEnabled()) {
        registerLogHandler();
    }
    this.application = new ApplicationHandler(config);
    this.tc = getContainer(application, getTestContainerFactory());
    if (isLogRecordingEnabled()) {
        loggedStartupRecords.addAll(loggedRuntimeRecords);
        loggedRuntimeRecords.clear();
        unregisterLogHandler();
    }
}
 
开发者ID:Ellychou,项目名称:Todo-Jersey-Spring-MyBatis,代码行数:24,代码来源:SpringContextJerseyTest.java

示例2: getTestContainerFactory

import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
@Override
protected TestContainerFactory getTestContainerFactory() {
    final URI baseURI = getBaseURI();
    return (uri, deploymentContext) -> new TestContainer() {
        @Override
        public ClientConfig getClientConfig() {
            return clientConfig;
        }

        @Override
        public URI getBaseUri() {
            return baseURI;
        }

        @Override
        public void start() {
            // noop
        }

        @Override
        public void stop() {
            // noop
        }
    };
}
 
开发者ID:apache,项目名称:usergrid,代码行数:26,代码来源:AbstractRestIT.java

示例3: getTestContainerFactory

import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
protected TestContainerFactory getTestContainerFactory() throws TestContainerException {
	final TestContainerFactory testContainerFactory = super.getTestContainerFactory();

	return new TestContainerFactory() {

		@Override
		public TestContainer create(URI baseUri, DeploymentContext deploymentContext) {
			TestContainer container = testContainerFactory.create(baseUri, deploymentContext);
			try {
				Field field = container.getClass().getDeclaredField("server");
				field.setAccessible(true);
				Server server = (Server) field.get(container);

				Handler handler = server.getHandler();
				SecurityHandler securityHandler = identityManager.getSecurityHandler();
				if (securityHandler.getHandler() == null) {
					securityHandler.setHandler(handler);
				}
				server.setHandler(securityHandler);
			}
			catch (Exception e) {
				throw new IllegalStateException(e);
			}
			return container;
		}
	};
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:28,代码来源:SecurityModuleIntTest.java

示例4: setup

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

示例5: getContainer

import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
private TestContainer getContainer(ApplicationHandler application, TestContainerFactory tcf) {
    if (application == null) {
        throw new IllegalArgumentException("The application cannot be null");
    }

    return tcf.create(getBaseUri(), application);
}
 
开发者ID:Ellychou,项目名称:Todo-Jersey-Spring-MyBatis,代码行数:8,代码来源:SpringContextJerseyTest.java

示例6: initServer

import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
private void initServer() {
    if (testContainer != null) {
        testContainer.stop();
    }
    DeploymentContext context = DeploymentContext.builder(resourceConfig).build();
    TestContainerFactory tcf = new InMemoryTestContainerFactory();

    this.testContainer = tcf.create(getBaseUri(), context);

    testContainer.start();

    this.client = getClient(testContainer.getClientConfig());
}
 
开发者ID:binout,项目名称:jaxrs-unit,代码行数:14,代码来源:JerseyServer.java

示例7: getTestContainerFactory

import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
@Override
protected TestContainerFactory getTestContainerFactory() {
    final URI baseURI = getBaseUri();
    
    return new TestContainerFactory() {
        @Override
        public TestContainer create(URI uri, DeploymentContext deploymentContext) {
            return new TestContainer() {

                @Override
                public ClientConfig getClientConfig() {
                    return clientConfig;
                }

                @Override
                public URI getBaseUri() {
                    return baseURI;
                }

                @Override
                public void start() {
                    // noop
                }

                @Override
                public void stop() {
                    // noop
                }
            };
        }
    };

}
 
开发者ID:apache,项目名称:usergrid,代码行数:34,代码来源:OrganizationTest.java

示例8: getTestContainerFactory

import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
@Override
protected TestContainerFactory getTestContainerFactory() {
	return new JettyTestContainerFactory();
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:5,代码来源:UriInfoServiceUrlProviderTest.java

示例9: getTestContainerFactory

import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
@Override
protected TestContainerFactory getTestContainerFactory() throws TestContainerException {
    return new InMemoryTestContainerFactory();
}
 
开发者ID:aruld,项目名称:dropwizard-pagination,代码行数:5,代码来源:LinkWebAppTest.java

示例10: getTestContainerFactory

import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
@Override
protected TestContainerFactory getTestContainerFactory() {
    return new GrizzlyWebTestContainerFactory();
}
 
开发者ID:openNaEF,项目名称:openNaEF,代码行数:5,代码来源:ConfigurableMvoApiTest.java

示例11: getTestContainerFactory

import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
@Override
public final TestContainerFactory getTestContainerFactory() {
  return new GrizzlyWebTestContainerFactory();
}
 
开发者ID:oncewang,项目名称:oryx2,代码行数:5,代码来源:AbstractServingTest.java

示例12: getTestContainerFactory

import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
@Override
protected TestContainerFactory getTestContainerFactory() throws TestContainerException {
    return new ExtendedGrizzlyTestContainerFactory();
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:5,代码来源:MCRJerseyTest.java

示例13: getTestContainerFactory

import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
@Override
protected TestContainerFactory getTestContainerFactory() {
    return new JettyTestContainerFactory();
}
 
开发者ID:katharsis-project,项目名称:katharsis-framework,代码行数:5,代码来源:KatharsisControllerWithoutPrefixTest.java

示例14: getTestContainerFactory

import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
@Override
protected TestContainerFactory getTestContainerFactory() {
    return new GrizzlyTestContainerFactory();
}
 
开发者ID:pac4j,项目名称:jax-rs-pac4j,代码行数:5,代码来源:JerseyGrizzlyRule.java

示例15: getTestContainerFactory

import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
@Override
protected TestContainerFactory getTestContainerFactory() {
    return new InMemoryTestContainerFactory();
}
 
开发者ID:pac4j,项目名称:jax-rs-pac4j,代码行数:5,代码来源:JerseyInMemoryRule.java


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