[jboss-cvs] JBossAS SVN: r108464 - in branches/JBPAPP_4_2_0_GA_CP/testsuite: src/main/org/jboss/test/security/test and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 6 10:01:38 EDT 2010
Author: rsvoboda at redhat.com
Date: 2010-10-06 10:01:38 -0400 (Wed, 06 Oct 2010)
New Revision: 108464
Added:
branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/config/tests-secured.xml
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/AbstractHttpAuthenticationUnitTest.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestJBossWSAuthenticationUnitTestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestJmxAuthenticationUnitTestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestStatusServletAuthenticationUnitTestCase.java
branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestWebConsoleAuthenticationUnitTestCase.java
Log:
JBQA-3817 fix for commit #108449 which broke testsuite
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/config/tests-secured.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/config/tests-secured.xml (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/imports/config/tests-secured.xml 2010-10-06 14:01:38 UTC (rev 108464)
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+
+<!--
+ | Targets that run the Secured Mask tests
+-->
+
+<project name="main.server.config.secured" xmlns:server="http://jboss.org/ns/test/ant/server">
+
+ <!--
+ | Define the Pattern Sets Here
+ -->
+ <patternset id="secured.mask.includes">
+ <include name="org/jboss/test/security/test/authorization/secured/*TestCase.class"/>
+ </patternset>
+
+ <!--
+ | Targets
+ -->
+ <target name="tests-secured"
+ description="Run tests on secured profiles">
+
+ <server:start name="production"/>
+ <run-junit junit.patternset="secured.mask.includes"/>
+ <server:stop name="production"/>
+
+ </target>
+</project>
+
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/AbstractHttpAuthenticationUnitTest.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/AbstractHttpAuthenticationUnitTest.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/AbstractHttpAuthenticationUnitTest.java 2010-10-06 14:01:38 UTC (rev 108464)
@@ -0,0 +1,96 @@
+package org.jboss.test.security.test.authorization.secured;
+
+import java.net.*;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.JBossTestSetup;
+
+/**
+ * Test verifies that there is no jmx-console security baypass in secured profiles.
+ * Reused test from JBPAPP-3952, JBPAPP-4160.
+ *
+ * @author bshim at redhat.com
+ * @author rsvoboda at redhat.com
+ */
+public abstract class AbstractHttpAuthenticationUnitTest extends JBossTestCase {
+
+ private URL u;
+ private HttpURLConnection con;
+ private static final String GET = "GET";
+ private static final String POST = "POST";
+ private static final String HEAD = "HEAD";
+ private static final String OPTIONS = "OPTIONS";
+ private static final String PUT = "PUT";
+ private static final String DELETE = "DELETE";
+ private static final String TRACE = "TRACE";
+
+ public AbstractHttpAuthenticationUnitTest(String name){
+ super(name);
+ }
+
+ public void testGet() throws Exception {
+ con.setRequestMethod(GET);
+ con.connect();
+ assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
+ }
+
+ public void testPost() throws Exception {
+ con.setRequestMethod(POST);
+ con.connect();
+ assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
+ }
+
+ public void testHead() throws Exception {
+ con.setRequestMethod(HEAD);
+ con.connect();
+ assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
+ }
+
+ public void testOptions() throws Exception {
+ con.setRequestMethod(OPTIONS);
+ con.connect();
+ assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
+ }
+
+ public void testPut() throws Exception {
+ con.setRequestMethod(PUT);
+ con.connect();
+ assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
+ }
+
+ public void testTrace() throws Exception {
+ con.setRequestMethod(TRACE);
+ con.connect();
+ assertEquals(HttpURLConnection.HTTP_BAD_METHOD, con.getResponseCode());
+ }
+
+ public void testDelete() throws Exception {
+ con.setRequestMethod(DELETE);
+ con.connect();
+ assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, con.getResponseCode());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+// u = new URL("http://" + getServerHost() + ":8080/jmx-console");
+ u = getURL();
+ con = (HttpURLConnection) u.openConnection();
+ try {
+ con.setDoInput(true);
+ con.setRequestProperty("Cookie","MODIFY ME IF NEEDED");
+ } finally {
+ con.disconnect();
+ }
+ }
+
+ protected abstract URL getURL() throws MalformedURLException;
+
+ protected void tearDown(){
+ if (con != null)
+ con.disconnect();
+ }
+}
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestJBossWSAuthenticationUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestJBossWSAuthenticationUnitTestCase.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestJBossWSAuthenticationUnitTestCase.java 2010-10-06 14:01:38 UTC (rev 108464)
@@ -0,0 +1,20 @@
+package org.jboss.test.security.test.authorization.secured;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * Test verifies that there is no jbossws console security baypass in secured profiles.
+ *
+ * @author rsvoboda at redhat.com
+ */
+public class HttpRequestJBossWSAuthenticationUnitTestCase extends AbstractHttpAuthenticationUnitTest {
+
+ public HttpRequestJBossWSAuthenticationUnitTestCase(String name) {
+ super(name);
+ }
+
+ protected URL getURL() throws MalformedURLException {
+ return new URL("http://" + getServerHost() + ":8080/jbossws");
+ }
+}
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestJmxAuthenticationUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestJmxAuthenticationUnitTestCase.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestJmxAuthenticationUnitTestCase.java 2010-10-06 14:01:38 UTC (rev 108464)
@@ -0,0 +1,20 @@
+package org.jboss.test.security.test.authorization.secured;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * Test verifies that there is no jmx-console security baypass in secured profiles.
+ *
+ * @author rsvoboda at redhat.com
+ */
+public class HttpRequestJmxAuthenticationUnitTestCase extends AbstractHttpAuthenticationUnitTest {
+
+ public HttpRequestJmxAuthenticationUnitTestCase(String name) {
+ super(name);
+ }
+
+ protected URL getURL() throws MalformedURLException {
+ return new URL("http://" + getServerHost() + ":8080/jmx-console");
+ }
+}
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestStatusServletAuthenticationUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestStatusServletAuthenticationUnitTestCase.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestStatusServletAuthenticationUnitTestCase.java 2010-10-06 14:01:38 UTC (rev 108464)
@@ -0,0 +1,20 @@
+package org.jboss.test.security.test.authorization.secured;
+
+import java.net.URL;
+import java.net.MalformedURLException;
+
+/**
+ * Test verifies that there is no /status servlet security baypass in secured profiles.
+ *
+ * @author rsvoboda at redhat.com
+ */
+public class HttpRequestStatusServletAuthenticationUnitTestCase extends AbstractHttpAuthenticationUnitTest {
+
+ public HttpRequestStatusServletAuthenticationUnitTestCase(String name) {
+ super(name);
+ }
+
+ protected URL getURL() throws MalformedURLException {
+ return new URL("http://" + getServerHost() + ":8080/status");
+ }
+}
Added: branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestWebConsoleAuthenticationUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestWebConsoleAuthenticationUnitTestCase.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/testsuite/src/main/org/jboss/test/security/test/authorization/secured/HttpRequestWebConsoleAuthenticationUnitTestCase.java 2010-10-06 14:01:38 UTC (rev 108464)
@@ -0,0 +1,20 @@
+package org.jboss.test.security.test.authorization.secured;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * Test verifies that there is no jmx-console security baypass in secured profiles.
+ *
+ * @author rsvoboda at redhat.com
+ */
+public class HttpRequestWebConsoleAuthenticationUnitTestCase extends AbstractHttpAuthenticationUnitTest {
+
+ public HttpRequestWebConsoleAuthenticationUnitTestCase(String name) {
+ super(name);
+ }
+
+ protected URL getURL() throws MalformedURLException {
+ return new URL("http://" + getServerHost() + ":8080/web-console");
+ }
+}
More information about the jboss-cvs-commits
mailing list