コード例 #1
0
 @After
 public void after() throws Exception {
   EmbeddedContainer.stop();
   Thread.sleep(1000);
   dispatcher = null;
   deployment = null;
 }
コード例 #2
0
 public static void before(Hashtable<String, String> contextParams) throws Exception {
   Hashtable<String, String> initParams = new Hashtable<String, String>();
   deployment = EmbeddedContainer.start(initParams, contextParams);
   dispatcher = deployment.getDispatcher();
   deployment.getRegistry().addPerRequestResource(TestResource.class);
   deployment.getProviderFactory().register(TestExceptionMapper.class);
 }
コード例 #3
0
  public static void startup() throws Exception {
    deployment = EmbeddedContainer.start();

    manager = new MessageServiceManager();
    manager.start();
    deployment.getRegistry().addSingletonResource(manager.getQueueManager().getDestination());
    deployment.getRegistry().addSingletonResource(manager.getTopicManager().getDestination());

    deployment.getRegistry().addPerRequestResource(Receiver.class);
  }
コード例 #4
0
  private static void startDeployment() throws Exception {
    deployment = new ResteasyDeployment();
    deployment.setSecurityEnabled(true);
    deployment.setApplicationClass(SApp.class.getName());
    ResteasyProviderFactory factory = new ResteasyProviderFactory();
    deployment.setProviderFactory(factory);
    factory.setProperty(SkeletonKeyApplication.SKELETON_KEY_INFINISPAN_CONFIG_FILE, "cache.xml");
    factory.setProperty(SkeletonKeyApplication.SKELETON_KEY_INFINISPAN_CACHE_NAME, "idp-store");

    EmbeddedContainer.start(deployment);
    app = ((SApp) deployment.getApplication()).app;
  }
コード例 #5
0
 @BeforeClass
 public static void before() throws Exception {
   deployment = EmbeddedContainer.start("/odata/northwind");
   dispatcher = deployment.getDispatcher();
   deployment.getRegistry().addPerRequestResource(EntitiesRequestResource.class);
   deployment.getRegistry().addPerRequestResource(EntityRequestResource.class);
   deployment.getRegistry().addPerRequestResource(MetadataResource.class);
   deployment.getRegistry().addPerRequestResource(ServiceDocumentResource.class);
   deployment.getProviderFactory().registerProviderInstance(ODataBatchProvider.class);
   deployment.getProviderFactory().registerProviderInstance(ExceptionMappingProvider.class);
   deployment.getProviderFactory().addContextResolver(org.teiid.odata.MockProvider.class);
 }
コード例 #6
0
ファイル: TokenTest.java プロジェクト: rareddy/Resteasy
  @BeforeClass
  public static void before() throws Exception {
    deployment = new ResteasyDeployment();
    deployment.setSecurityEnabled(true);
    deployment.setApplicationClass(SApp.class.getName());

    EmbeddedContainer.start(deployment);
    SkeletonKeyApplication app = ((SApp) deployment.getApplication()).app;

    KeyPair keyPair = KeyPairGenerator.getInstance("RSA", "BC").generateKeyPair();
    privateKey = keyPair.getPrivate();
    certificate = KeyTools.generateTestCertificate(keyPair);
    app.getTokenService().setCertificate(certificate);
    app.getTokenService().setPrivateKey(privateKey);

    StoredUser admin = new StoredUser();
    admin.setName("Bill");
    admin.setUsername("wburke");
    HashMap<String, String> creds = new HashMap<String, String>();
    creds.put("password", "geheim");
    admin.setCredentials(creds);
    app.getUsers().create(admin);

    Project project = new Project();
    project.setName("Skeleton Key");
    project.setEnabled(true);
    app.getProjects().createProject(project);

    Role adminRole = new Role();
    adminRole.setName("admin");
    app.getRoles().create(adminRole);

    app.getProjects().addUserRole(project.getId(), admin.getId(), adminRole.getId());

    // Test export/import
    System.out.println(new Loader().export(app.getCache()));

    try {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      new Loader().export(app.getCache(), baos);
      ByteArrayInputStream bios = new ByteArrayInputStream(baos.toByteArray());
      app.getCache().clear();
      new Loader().importStore(bios, app.getCache());
    } catch (Exception e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    }
  }
コード例 #7
0
 private static void stopDeployment() throws Exception {
   app.getCache().stop();
   deployment = null;
   app = null;
   EmbeddedContainer.stop();
 }
コード例 #8
0
ファイル: CookieTest.java プロジェクト: soul2zimate/resteasy2
 @AfterClass
 public static void after() throws Exception {
   EmbeddedContainer.stop();
 }
コード例 #9
0
ファイル: CookieTest.java プロジェクト: soul2zimate/resteasy2
 @BeforeClass
 public static void before() throws Exception {
   dispatcher = EmbeddedContainer.start().getDispatcher();
   dispatcher.getRegistry().addPerRequestResource(CookieResource.class);
 }
コード例 #10
0
 @After
 public void after() throws Exception {
   EmbeddedContainer.stop();
   deployment = null;
 }
コード例 #11
0
 @Before
 public void before() throws Exception {
   deployment = EmbeddedContainer.start();
   deployment.getRegistry().addPerRequestResource(TestResource.class);
 }
コード例 #12
0
 public static void shutdown() throws Exception {
   manager.stop();
   manager = null;
   EmbeddedContainer.stop();
   deployment = null;
 }
コード例 #13
0
 @BeforeClass
 public static void beforeClass() throws Exception {
   dispatcher = EmbeddedContainer.start().getDispatcher();
 }
コード例 #14
0
 @BeforeClass
 public static void before() throws Exception {
   dispatcher = EmbeddedContainer.start().getDispatcher();
   forwardingResource = new ForwardingResource();
   dispatcher.getRegistry().addSingletonResource(forwardingResource);
 }
コード例 #15
0
 @AfterClass
 public static void shutdown() throws Exception {
   client.close();
   EmbeddedContainer.stop();
   deployment = null;
 }
コード例 #16
0
 @BeforeClass
 public static void setup() throws Exception {
   deployment = EmbeddedContainer.start();
   deployment.getRegistry().addPerRequestResource(TestResource.class);
   client = new ResteasyClientBuilder().build();
 }