Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WFLY-5179 Some tests are unable to init arquillian protocol with secu…
…rity manager
- Loading branch information
1 parent
faf0f51
commit 5fb8f04
Showing
8 changed files
with
241 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...as/test/integration/ee/injection/resource/ejblocalref/EjbLocalRefNoInjectionTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright (c) 2011, Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. See the copyright.txt file in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
package org.jboss.as.test.integration.ee.injection.resource.ejblocalref; | ||
|
||
import javax.naming.InitialContext; | ||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* A test for injection via env-entry in web.xml | ||
* | ||
* @author Stuart Douglas | ||
*/ | ||
@RunWith(Arquillian.class) | ||
public class EjbLocalRefNoInjectionTestCase { | ||
|
||
@Deployment | ||
public static WebArchive deployment() { | ||
WebArchive war = ShrinkWrap.create(WebArchive.class, "war-example.war"); | ||
war.addClasses(EjbLocalRefNoInjectionTestCase.class, EjbLocalRefInjectionServlet.class, NamedSLSB.class, SimpleSLSB.class, Hello.class); | ||
war.addAsWebInfResource(EjbLocalRefNoInjectionTestCase.class.getPackage(), "web.xml", "web.xml"); | ||
return war; | ||
} | ||
|
||
@Test | ||
public void testNoInjectionPoint() throws Exception { | ||
Hello bean = (Hello) new InitialContext().lookup("java:comp/env/noInjection"); | ||
assertEquals("Simple Hello", bean.sayHello()); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...sic/src/test/java/org/jboss/as/test/integration/ee/injection/resource/ejblocalref/web.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<web-app version="3.0" | ||
xmlns="http://java.sun.com/xml/ns/javaee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | ||
metadata-complete="false"> | ||
|
||
<ejb-local-ref> | ||
<ejb-ref-name>simple</ejb-ref-name> | ||
<lookup-name>java:module/SimpleSLSB</lookup-name> | ||
<injection-target> | ||
<injection-target-class>org.jboss.as.test.integration.ee.injection.resource.ejblocalref.EjbLocalRefInjectionServlet</injection-target-class> | ||
<injection-target-name>simple</injection-target-name> | ||
</injection-target> | ||
</ejb-local-ref> | ||
<ejb-local-ref> | ||
<ejb-ref-name>noInjection</ejb-ref-name> | ||
<lookup-name>java:module/SimpleSLSB</lookup-name> | ||
<local>org.jboss.as.test.integration.ee.injection.resource.ejblocalref.SimpleSLSB</local> | ||
</ejb-local-ref> | ||
<ejb-local-ref> | ||
<ejb-ref-name>named</ejb-ref-name> | ||
<ejb-link>namedBean</ejb-link> | ||
<injection-target> | ||
<injection-target-class>org.jboss.as.test.integration.ee.injection.resource.ejblocalref.EjbLocalRefInjectionServlet</injection-target-class> | ||
<injection-target-name>named</injection-target-name> | ||
</injection-target> | ||
</ejb-local-ref> | ||
|
||
</web-app> |
66 changes: 66 additions & 0 deletions
66
.../as/test/integration/ee/injection/resource/enventry/EnvEntryInjectionServletTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright (c) 2011, Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. See the copyright.txt file in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
package org.jboss.as.test.integration.ee.injection.resource.enventry; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.container.test.api.RunAsClient; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.arquillian.test.api.ArquillianResource; | ||
import org.jboss.as.arquillian.container.ManagementClient; | ||
import org.jboss.as.test.integration.common.HttpRequest; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import static org.junit.Assert.assertEquals; | ||
|
||
/** | ||
* A test for injection via env-entry in web.xml | ||
* | ||
* @author Stuart Douglas | ||
*/ | ||
@RunWith(Arquillian.class) | ||
@RunAsClient | ||
public class EnvEntryInjectionServletTestCase { | ||
|
||
@ArquillianResource | ||
private ManagementClient managementClient; | ||
|
||
@Deployment | ||
public static WebArchive deployment() { | ||
WebArchive war = ShrinkWrap.create(WebArchive.class, "war-example.war"); | ||
war.addClasses(EnvEntryInjectionServlet.class, EnvEntryManagedBean.class); | ||
war.addAsWebInfResource(EnvEntryInjectionServletTestCase.class.getPackage(), "EnvEntryInjectionTestCase-web.xml", "web.xml"); | ||
return war; | ||
} | ||
|
||
private String performCall(String urlPattern) throws Exception { | ||
return HttpRequest.get(managementClient.getWebUri() + "/war-example/" + urlPattern, 5, TimeUnit.SECONDS); | ||
} | ||
|
||
@Test | ||
public void testEnvEntryInjectionIntoServlet() throws Exception { | ||
String result = performCall("envEntry"); | ||
assertEquals("injection!", result); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...boss/as/test/integration/ee/injection/resource/enventry/EnvEntryInjectionTestCase-web.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<web-app version="3.0" | ||
xmlns="http://java.sun.com/xml/ns/javaee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | ||
metadata-complete="false"> | ||
|
||
<env-entry> | ||
<env-entry-name>foo</env-entry-name> | ||
<env-entry-value>injection!</env-entry-value> | ||
<injection-target> | ||
<injection-target-class>org.jboss.as.test.integration.ee.injection.resource.enventry.EnvEntryInjectionServlet</injection-target-class> | ||
<injection-target-name>field</injection-target-name> | ||
</injection-target> | ||
</env-entry> | ||
|
||
<env-entry> | ||
<env-entry-name>org.jboss.as.test.integration.ee.injection.resource.enventry.EnvEntryManagedBean/existingString</env-entry-name> | ||
<env-entry-value>bye</env-entry-value> | ||
<env-entry-type>java.lang.String</env-entry-type> | ||
</env-entry> | ||
|
||
|
||
<env-entry> | ||
<env-entry-name>otherByte</env-entry-name> | ||
<env-entry-value>10</env-entry-value> | ||
<env-entry-type>java.lang.Byte</env-entry-type> | ||
<injection-target> | ||
<injection-target-class>org.jboss.as.test.integration.ee.injection.resource.enventry.EnvEntryManagedBean</injection-target-class> | ||
<injection-target-name>byteField</injection-target-name> | ||
</injection-target> | ||
</env-entry> | ||
|
||
</web-app> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.