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


Java TestContainerException类代码示例

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


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

示例1: start

import org.glassfish.jersey.test.spi.TestContainerException; //导入依赖的package包/类
@Override
public void start() {
    System.out.println("Starting GrizzlyTestContainer...");
    try {
        this.server = GrizzlyHttpServerFactory.createHttpServer(uri, rc);

        // Initialize and register Jersey Servlet
        WebappContext context = new WebappContext("WebappContext", "");
        ServletRegistration registration = context.addServlet("ServletContainer", ServletContainer.class);
        registration.setInitParameter("javax.ws.rs.Application", rc.getClass().getName());
        // Add an init parameter - this could be loaded from a parameter in the constructor
        registration.setInitParameter("myparam", "myvalue");

        registration.addMapping("/*");
        context.deploy(server);
    } catch (ProcessingException e) {
        throw new TestContainerException(e);
    }
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:20,代码来源:MCRJerseyTest.java

示例2: SpringContextJerseyTest

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

示例3: getTestContainerFactory

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

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

示例6: getTestContainerFactory

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

示例7: getTestContainerFactory

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

示例8: getTestContainerFactory

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

示例9: getTestContainerFactory

import org.glassfish.jersey.test.spi.TestContainerException; //导入依赖的package包/类
@Override
protected TestContainerFactory getTestContainerFactory() throws TestContainerException {
  return new TestContainerFactory() {
    @Override
    public TestContainer create(final URI baseUri, DeploymentContext deploymentContext) {
      return new TestContainer() {
        private HelixRestServer _helixRestServer;

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

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

        @Override
        public void start() {
          // Create namespace manifest map
          List<HelixRestNamespace> namespaces = new ArrayList<>();
          // Add test namespace
          namespaces.add(new HelixRestNamespace(TEST_NAMESPACE, HelixRestNamespace.HelixMetadataStoreType.ZOOKEEPER,
              _zkAddrTestNS, false));
          // Add default namesapce
          namespaces.add(new HelixRestNamespace(ZK_ADDR));
          try {
            _helixRestServer = new HelixRestServer(namespaces, baseUri.getPort(), baseUri.getPath(),
                Arrays.<AuditLogger>asList(_auditLogger));
            _helixRestServer.start();
          } catch (Exception ex) {
            throw new TestContainerException(ex);
          }
        }
        @Override
        public void stop() {
          _helixRestServer.shutdown();
        }
      };
    }
  };
}
 
开发者ID:apache,项目名称:helix,代码行数:44,代码来源:AbstractTestClass.java

示例10: JerseyTestOnPojo

import org.glassfish.jersey.test.spi.TestContainerException; //导入依赖的package包/类
public JerseyTestOnPojo() throws TestContainerException {
    super(new InMemoryTestContainerFactory());
}
 
开发者ID:nhl,项目名称:link-rest,代码行数:4,代码来源:JerseyTestOnPojo.java

示例11: JerseyTestOnDerby

import org.glassfish.jersey.test.spi.TestContainerException; //导入依赖的package包/类
public JerseyTestOnDerby() throws TestContainerException {
    super(new InMemoryTestContainerFactory());
}
 
开发者ID:nhl,项目名称:link-rest,代码行数:4,代码来源:JerseyTestOnDerby.java

示例12: RemoteConverterTestDelegate

import org.glassfish.jersey.test.spi.TestContainerException; //导入依赖的package包/类
public RemoteConverterTestDelegate(boolean operational) throws TestContainerException {
    this.operational = operational;
    this.jerseyTest = new ConfiguredJerseyTest();
}
 
开发者ID:documents4j,项目名称:documents4j,代码行数:5,代码来源:RemoteConverterTestDelegate.java

示例13: getTestContainerFactory

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

示例14: getTestContainerFactory

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

示例15: getTestContainerFactory

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


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