Esempio n. 1
0
 @After
 public void after() throws Exception {
   EmbeddedContainer.stop();
   Thread.sleep(1000);
   dispatcher = null;
   deployment = null;
 }
Esempio n. 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);
 }
  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);
  }
  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;
  }
 @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);
 }
Esempio n. 6
0
  @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.
    }
  }
 private static void stopDeployment() throws Exception {
   app.getCache().stop();
   deployment = null;
   app = null;
   EmbeddedContainer.stop();
 }
Esempio n. 8
0
 @AfterClass
 public static void after() throws Exception {
   EmbeddedContainer.stop();
 }
Esempio n. 9
0
 @BeforeClass
 public static void before() throws Exception {
   dispatcher = EmbeddedContainer.start().getDispatcher();
   dispatcher.getRegistry().addPerRequestResource(CookieResource.class);
 }
 @After
 public void after() throws Exception {
   EmbeddedContainer.stop();
   deployment = null;
 }
 @Before
 public void before() throws Exception {
   deployment = EmbeddedContainer.start();
   deployment.getRegistry().addPerRequestResource(TestResource.class);
 }
 public static void shutdown() throws Exception {
   manager.stop();
   manager = null;
   EmbeddedContainer.stop();
   deployment = null;
 }
Esempio n. 13
0
 @BeforeClass
 public static void beforeClass() throws Exception {
   dispatcher = EmbeddedContainer.start().getDispatcher();
 }
 @BeforeClass
 public static void before() throws Exception {
   dispatcher = EmbeddedContainer.start().getDispatcher();
   forwardingResource = new ForwardingResource();
   dispatcher.getRegistry().addSingletonResource(forwardingResource);
 }
 @AfterClass
 public static void shutdown() throws Exception {
   client.close();
   EmbeddedContainer.stop();
   deployment = null;
 }
 @BeforeClass
 public static void setup() throws Exception {
   deployment = EmbeddedContainer.start();
   deployment.getRegistry().addPerRequestResource(TestResource.class);
   client = new ResteasyClientBuilder().build();
 }