Examples of TestContainer


Examples of com.sun.jersey.test.framework.spi.container.TestContainer

      public Class<LowLevelAppDescriptor> supports() {
        return LowLevelAppDescriptor.class;
      }

      public TestContainer create(final URI baseUri, final AppDescriptor ad) throws IllegalArgumentException {
        return new TestContainer() {

          private HttpServer server;

          public void stop() {
            if (server != null)
View Full Code Here

Examples of org.glassfish.jersey.test.spi.TestContainer

    public static class MyTestContainerFactory implements TestContainerFactory {

        @Override
        public TestContainer create(final URI baseUri, final DeploymentContext context) throws IllegalArgumentException {
            return new TestContainer() {

                @Override
                public ClientConfig getClientConfig() {
                    return null;
                }
View Full Code Here

Examples of org.glassfish.jersey.test.spi.TestContainer

        return testContainer;
    }

    @Override
    public TestContainer testContainer(final TestContainer testContainer) {
        final TestContainer old = this.testContainer;
        this.testContainer = testContainer;
        return old;
    }
View Full Code Here

Examples of org.glassfish.jersey.test.spi.TestContainer

        return testContainerLocal.get();
    }

    @Override
    public TestContainer testContainer(final TestContainer testContainer) {
        final TestContainer old = testContainerLocal.get();

        if (testContainer == null) {
            testContainerLocal.remove();
        } else {
            testContainerLocal.set(testContainer);
View Full Code Here

Examples of org.glassfish.jersey.test.spi.TestContainer

     *
     * @param testContainer a test container instance or {@code null} it the current test container should be released.
     * @return old test container instance.
     */
    /* package */ TestContainer setTestContainer(final TestContainer testContainer) {
        final TestContainer old = this.testContainer;
        this.testContainer = testContainer;
        return old;
    }
View Full Code Here

Examples of org.glassfish.jersey.test.spi.TestContainer

    public void setUp() throws Exception {
        if (isLogRecordingEnabled()) {
            registerLogHandler();
        }

        final TestContainer testContainer = createTestContainer(context);

        // Set current instance of test container and start it.
        setTestContainer(testContainer);
        testContainer.start();

        // Create an set new client.
        setClient(getClient(testContainer.getClientConfig()));
    }
View Full Code Here

Examples of org.glassfish.jersey.test.spi.TestContainer

     *
     * @return the base URI of the tested application.
     */
    // TODO make final
    protected URI getBaseUri() {
        final TestContainer container = getTestContainer();

        if (container != null) {
            // called from outside of JerseyTest constructor
            return container.getBaseUri();
        }

        // called from within JerseyTest constructor
        return UriBuilder.fromUri("http://localhost/").port(getPort()).build();
    }
View Full Code Here

Examples of org.glassfish.jersey.test.spi.TestContainer

     * Get the port to be used for test application deployments.
     *
     * @return The HTTP port of the URI
     */
    protected final int getPort() {
        final TestContainer container = getTestContainer();

        if (container != null) {
            // called from outside of JerseyTest constructor
            return container.getBaseUri().getPort();
        }

        // called from within JerseyTest constructor
        final String value = getProperty(TestProperties.CONTAINER_PORT);
        if (value != null) {
View Full Code Here

Examples of org.jboss.arquillian.container.weld.ee.embedded_1_1.mock.TestContainer

     * @return
     */
    public static Test suite() {
        // Create and start the TestContainer, which takes care of starting the container, deploying the
        // classes, starting the contexts etc.
        TestContainer container = new TestContainer(

                // The classes to deploy as beans
                Convertible.class,
                Seat.class,
                V8Engine.class,
                Cupholder.class,
                FuelTank.class,
                Tire.class,
                // Producer Methods allowing to expose DriversSeat, SpareTire, @Named("spare") SpareTire, @Drivers Seat
                Producers.class
        );
        container.startContainer();

        // Our entry point is the single bean deployment archive
        BeanManager beanManager = container.getBeanManager(container.getDeployment().getBeanDeploymentArchives().iterator().next());

        // Obtain a reference to the Car and pass it to the TCK to generate the testsuite
        Bean<?> bean = beanManager.resolve(beanManager.getBeans(Car.class));
        Car instance = (Car) beanManager.getReference(bean, Car.class, beanManager.createCreationalContext(bean));

View Full Code Here

Examples of org.jboss.arquillian.container.weld.ee.embedded_1_1.mock.TestContainer

public class InjectionServicesTest {

    @Test
    public void testInjectionOfTarget() {
        TestContainer container = new TestContainer(Foo.class, Bar.class);
        CheckableInjectionServices ijs = new CheckableInjectionServices();
        for (BeanDeploymentArchive bda : container.getDeployment().getBeanDeploymentArchives()) {
            bda.getServices().add(InjectionServices.class, ijs);
        }
        container.startContainer();
        container.ensureRequestActive();

        BeanManager manager = getBeanManager(container);

        Bean<? extends Object> bean = manager.resolve(manager.getBeans(Foo.class));
        ijs.reset();
        Foo foo = (Foo) manager.getReference(bean, Foo.class, manager.createCreationalContext(bean));

        Assert.assertTrue(ijs.isBefore());
        Assert.assertTrue(ijs.isAfter());
        Assert.assertTrue(ijs.isInjectedAfter());
        Assert.assertTrue(ijs.isInjectionTargetCorrect());
        Assert.assertEquals(ijs.getAroundInjectForFooCalled(), 1);
        Assert.assertEquals(ijs.getAroundInjectForBarCalled(), 1);

        Assert.assertNotNull(foo.getBar());
        Assert.assertEquals("hi!", foo.getMessage());


        container.stopContainer();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.