PageRenderTime 37ms CodeModel.GetById 22ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 0ms

/jboss-as-7.1.1.Final/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxr/JaxrConnectionFactoryBindingTestCase.java

#
Java | 73 lines | 39 code | 7 blank | 27 comment | 0 complexity | 340924956ee3a2ff3f0c8a6e35b0914e MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
 1/*
 2 * JBoss, Home of Professional Open Source.
 3 * Copyright 2008, Red Hat Middleware LLC, and individual contributors
 4 * as indicated by the @author tags. See the copyright.txt file in the
 5 * distribution for a full listing of individual contributors.
 6 *
 7 * This is free software; you can redistribute it and/or modify it
 8 * under the terms of the GNU Lesser General Public License as
 9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */
22package org.jboss.as.test.integration.jaxr;
23
24import java.net.URL;
25import java.util.concurrent.TimeUnit;
26
27import org.jboss.arquillian.container.test.api.Deployment;
28import org.jboss.arquillian.container.test.api.RunAsClient;
29import org.jboss.arquillian.junit.Arquillian;
30import org.jboss.arquillian.test.api.ArquillianResource;
31import org.jboss.as.test.integration.common.HttpRequest;
32import org.jboss.shrinkwrap.api.ShrinkWrap;
33import org.jboss.shrinkwrap.api.spec.WebArchive;
34import org.junit.Assert;
35import org.junit.Test;
36import org.junit.runner.RunWith;
37
38/**
39 * Tests the JAXR connection factory bound to JNDI
40 *
41 * @author Thomas.Diesler@jboss.com
42 * @since 26-Oct-2011
43 */
44@RunAsClient
45@RunWith(Arquillian.class)
46public class JaxrConnectionFactoryBindingTestCase {
47
48    @ArquillianResource
49    private URL url;
50
51    @Deployment
52    public static WebArchive deployment() {
53        WebArchive archive = ShrinkWrap.create(WebArchive.class, "jaxr-connection-test.war");
54        archive.addClasses(JaxrServlet.class);
55        archive.addAsWebInfResource("jaxr/webA.xml", "web.xml");
56        archive.addAsWebInfResource("jaxr/jboss-webA.xml", "jboss-web.xml");
57        return archive;
58    }
59
60    @Test
61    public void testConnectionFactoryLookup() throws Exception {
62        String reqpath = url.toExternalForm() + "?method=lookup";
63        String response = HttpRequest.get(reqpath, 10, TimeUnit.SECONDS);
64        Assert.assertEquals("org.apache.ws.scout.registry.ConnectionFactoryImpl", response.trim());
65    }
66
67    @Test
68    public void testConnectionFactoryNewInstance() throws Exception {
69        String reqpath = url.toExternalForm() + "?method=new";
70        String response = HttpRequest.get(reqpath, 10, TimeUnit.SECONDS);
71        Assert.assertEquals("org.apache.ws.scout.registry.ConnectionFactoryImpl", response.trim());
72    }
73}