本文整理汇总了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();
}
}
示例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
}
};
}
示例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;
}
};
}
示例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();
}
示例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);
}
示例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());
}
示例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
}
};
}
};
}
示例8: getTestContainerFactory
import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
@Override
protected TestContainerFactory getTestContainerFactory() {
return new JettyTestContainerFactory();
}
示例9: getTestContainerFactory
import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
@Override
protected TestContainerFactory getTestContainerFactory() throws TestContainerException {
return new InMemoryTestContainerFactory();
}
示例10: getTestContainerFactory
import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
@Override
protected TestContainerFactory getTestContainerFactory() {
return new GrizzlyWebTestContainerFactory();
}
示例11: getTestContainerFactory
import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
@Override
public final TestContainerFactory getTestContainerFactory() {
return new GrizzlyWebTestContainerFactory();
}
示例12: getTestContainerFactory
import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
@Override
protected TestContainerFactory getTestContainerFactory() throws TestContainerException {
return new ExtendedGrizzlyTestContainerFactory();
}
示例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();
}
示例15: getTestContainerFactory
import org.glassfish.jersey.test.spi.TestContainerFactory; //导入依赖的package包/类
@Override
protected TestContainerFactory getTestContainerFactory() {
return new InMemoryTestContainerFactory();
}