java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceAbstractTest.java | 134 ---------- java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceAbstractTestCase.java | 134 ++++++++++ java/code/src/com/redhat/rhn/frontend/security/test/PxtAuthenticationServiceTest.java | 2 java/spacewalk-java.spec | 11 rel-eng/packages/spacewalk-java | 2 5 files changed, 146 insertions(+), 137 deletions(-)
New commits: commit 9dac0b1e3cf72596f2cab88eba4201b4b235ec80 Author: Grant Gainey ggainey@redhat.com Date: Sat Apr 27 13:36:34 2013 -0400
Automatic commit of package [spacewalk-java] release [1.10.71-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec index c4efdcb..39abb32 100644 --- a/java/spacewalk-java.spec +++ b/java/spacewalk-java.spec @@ -28,7 +28,7 @@ Name: spacewalk-java Summary: Spacewalk Java site packages Group: Applications/Internet License: GPLv2 -Version: 1.10.70 +Version: 1.10.71 Release: 1%{?dist} URL: https://fedorahosted.org/spacewalk Source0: https://fedorahosted.org/releases/s/p/spacewalk/%%7Bname%7D-%%7Bversion%7D.t... @@ -751,6 +751,15 @@ fi %{jardir}/postgresql-jdbc.jar
%changelog +* Sat Apr 27 2013 Grant Gainey 1.10.71-1 +- Abstract classes' names can't end in 'Test.java' or JUnit tries to execute + them +- Checkstyle fixes +- Junit teting for errors that we don't even reach on Postgres +- Unit-test depends on specific contents of a jar. It changed. Sigh. +- Separate test from DB (and specifically from Oracle) +- With 07504b3d we stopped special-casing # in cfg-files - drop the tests + * Sat Apr 27 2013 Grant Gainey 1.10.70-1 - Fixing some minor query-data-type issues - ActivationKeys cannot include both a base-channel and children of a diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java index b096332..31c02da 100644 --- a/rel-eng/packages/spacewalk-java +++ b/rel-eng/packages/spacewalk-java @@ -1 +1 @@ -1.10.70-1 java/ +1.10.71-1 java/
commit d5570d08358a965bf34309668028b8c1dc68ab43 Author: Grant Gainey ggainey@redhat.com Date: Sat Apr 27 13:27:01 2013 -0400
Abstract classes' names can't end in 'Test.java' or JUnit tries to execute them
diff --git a/java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceAbstractTest.java b/java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceAbstractTest.java deleted file mode 100644 index 0d58f84..0000000 --- a/java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceAbstractTest.java +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Copyright (c) 2009--2012 Red Hat, Inc. - * - * This software is licensed to you under the GNU General Public License, - * version 2 (GPLv2). There is NO WARRANTY for this software, express or - * implied, including the implied warranties of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 - * along with this software; if not, see - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * Red Hat trademarks are not licensed under GPLv2. No permission is - * granted to use or replicate Red Hat trademarks that are incorporated - * in this software or its documentation. - */ -package com.redhat.rhn.frontend.security.test; - -import com.redhat.rhn.frontend.servlets.PxtSessionDelegate; - -import org.jmock.Mock; -import org.jmock.MockObjectTestCase; -import org.jmock.core.Constraint; -import org.jmock.core.Invocation; -import org.jmock.core.stub.CustomStub; - -import java.util.Enumeration; -import java.util.Vector; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * AuthenticationServiceTest is a base test class for testing AuthenticationService - * implementations. - * - * @version $Rev$ - */ -public abstract class AuthenticationServiceAbstractTest extends MockObjectTestCase { - - protected Mock mockRequest; - protected Mock mockResponse; - protected Constraint[] requestResponseArgs; - protected Mock mockPxtDelegate; - protected String[] requestParamNames; - protected String[] requestParamValues; - private String requestUrl; - - /** - * @param name The test case name - */ - public AuthenticationServiceAbstractTest(String name) { - super(name); - } - - - public AuthenticationServiceAbstractTest() { - } - - /** - * {@inheritDoc} - */ - protected void setUp() throws Exception { - super.setUp(); - - mockRequest = mock(HttpServletRequest.class); - mockResponse = mock(HttpServletResponse.class); - mockPxtDelegate = mock(PxtSessionDelegate.class); - - requestResponseArgs = new Constraint[] { - isA(HttpServletRequest.class), - isA(HttpServletResponse.class) - }; - - requestParamNames = new String[] {"question", "answer"}; - requestParamValues = new String[] { - "param 1 = 'Who is the one?'", - "param 2 = 'Neo is the one!'" - }; - - requestUrl = "https://rhn.redhat.com/rhn/YourRhn.do"; - } - - - protected HttpServletRequest getRequest() { - return (HttpServletRequest)mockRequest.proxy(); - } - - - protected HttpServletResponse getResponse() { - return (HttpServletResponse)mockResponse.proxy(); - } - - protected PxtSessionDelegate getPxtDelegate() { - return (PxtSessionDelegate)mockPxtDelegate.proxy(); - } - - protected Enumeration getParameterNames() { - Vector vector = new Vector(); - vector.add(requestParamNames[0]); - vector.add(requestParamNames[1]); - - return vector.elements(); - } - - protected String getRequestURL() { - return requestUrl; - } - - - protected void setUpRedirectToLogin() { - mockRequest.stubs().method("getParameterNames").will( - new CustomStub("Returns parameter names enumeration.") { - public Object invoke(Invocation arg0) throws Throwable { - return getParameterNames(); - } - }); - - mockRequest.stubs().method("getParameter").with(eq(requestParamNames[0])).will( - returnValue(requestParamValues[0])); - - mockRequest.stubs().method("getParameter").with(eq(requestParamNames[1])).will( - returnValue(requestParamValues[1])); - - mockRequest.stubs().method("getRequestURL").will(returnValue( - new StringBuffer(getRequestURL()))); - - mockRequest.stubs().method("getQueryString").will(returnValue(null)); - - mockRequest.stubs().method("getMethod") - .will(returnValue(new String("POST"))); - - mockRequest.stubs().method("setAttribute"); - } - -} diff --git a/java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceAbstractTestCase.java b/java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceAbstractTestCase.java new file mode 100644 index 0000000..a28da2f --- /dev/null +++ b/java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceAbstractTestCase.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) 2009--2012 Red Hat, Inc. + * + * This software is licensed to you under the GNU General Public License, + * version 2 (GPLv2). There is NO WARRANTY for this software, express or + * implied, including the implied warranties of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 + * along with this software; if not, see + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * + * Red Hat trademarks are not licensed under GPLv2. No permission is + * granted to use or replicate Red Hat trademarks that are incorporated + * in this software or its documentation. + */ +package com.redhat.rhn.frontend.security.test; + +import com.redhat.rhn.frontend.servlets.PxtSessionDelegate; + +import org.jmock.Mock; +import org.jmock.MockObjectTestCase; +import org.jmock.core.Constraint; +import org.jmock.core.Invocation; +import org.jmock.core.stub.CustomStub; + +import java.util.Enumeration; +import java.util.Vector; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * AuthenticationServiceTest is a base test class for testing AuthenticationService + * implementations. + * + * @version $Rev$ + */ +public abstract class AuthenticationServiceAbstractTestCase extends MockObjectTestCase { + + protected Mock mockRequest; + protected Mock mockResponse; + protected Constraint[] requestResponseArgs; + protected Mock mockPxtDelegate; + protected String[] requestParamNames; + protected String[] requestParamValues; + private String requestUrl; + + /** + * @param name The test case name + */ + public AuthenticationServiceAbstractTestCase(String name) { + super(name); + } + + + public AuthenticationServiceAbstractTestCase() { + } + + /** + * {@inheritDoc} + */ + protected void setUp() throws Exception { + super.setUp(); + + mockRequest = mock(HttpServletRequest.class); + mockResponse = mock(HttpServletResponse.class); + mockPxtDelegate = mock(PxtSessionDelegate.class); + + requestResponseArgs = new Constraint[] { + isA(HttpServletRequest.class), + isA(HttpServletResponse.class) + }; + + requestParamNames = new String[] {"question", "answer"}; + requestParamValues = new String[] { + "param 1 = 'Who is the one?'", + "param 2 = 'Neo is the one!'" + }; + + requestUrl = "https://rhn.redhat.com/rhn/YourRhn.do"; + } + + + protected HttpServletRequest getRequest() { + return (HttpServletRequest)mockRequest.proxy(); + } + + + protected HttpServletResponse getResponse() { + return (HttpServletResponse)mockResponse.proxy(); + } + + protected PxtSessionDelegate getPxtDelegate() { + return (PxtSessionDelegate)mockPxtDelegate.proxy(); + } + + protected Enumeration getParameterNames() { + Vector vector = new Vector(); + vector.add(requestParamNames[0]); + vector.add(requestParamNames[1]); + + return vector.elements(); + } + + protected String getRequestURL() { + return requestUrl; + } + + + protected void setUpRedirectToLogin() { + mockRequest.stubs().method("getParameterNames").will( + new CustomStub("Returns parameter names enumeration.") { + public Object invoke(Invocation arg0) throws Throwable { + return getParameterNames(); + } + }); + + mockRequest.stubs().method("getParameter").with(eq(requestParamNames[0])).will( + returnValue(requestParamValues[0])); + + mockRequest.stubs().method("getParameter").with(eq(requestParamNames[1])).will( + returnValue(requestParamValues[1])); + + mockRequest.stubs().method("getRequestURL").will(returnValue( + new StringBuffer(getRequestURL()))); + + mockRequest.stubs().method("getQueryString").will(returnValue(null)); + + mockRequest.stubs().method("getMethod") + .will(returnValue(new String("POST"))); + + mockRequest.stubs().method("setAttribute"); + } + +} diff --git a/java/code/src/com/redhat/rhn/frontend/security/test/PxtAuthenticationServiceTest.java b/java/code/src/com/redhat/rhn/frontend/security/test/PxtAuthenticationServiceTest.java index 06ea5b2..1f20672 100644 --- a/java/code/src/com/redhat/rhn/frontend/security/test/PxtAuthenticationServiceTest.java +++ b/java/code/src/com/redhat/rhn/frontend/security/test/PxtAuthenticationServiceTest.java @@ -30,7 +30,7 @@ import javax.servlet.http.HttpServletRequest; * @version $Rev$ */ // TODO Review Test classes in package to factor out common code -public class PxtAuthenticationServiceTest extends AuthenticationServiceAbstractTest { +public class PxtAuthenticationServiceTest extends AuthenticationServiceAbstractTestCase {
private class PxtAuthenticationServiceStub extends PxtAuthenticationService { }
spacewalk-commits@lists.fedorahosted.org