java/code/src/com/redhat/rhn/common/localization/test/LocalizationServiceTest.java | 2 java/code/src/com/redhat/rhn/frontend/action/errata/test/PublishedDeleteConfirmActionTest.java | 4 java/code/src/com/redhat/rhn/frontend/action/errata/test/UnpublishedDeleteConfirmActionTest.java | 4 java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceAbstractTest.java | 134 ++++++++++ java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceTest.java | 130 --------- java/code/src/com/redhat/rhn/frontend/security/test/PxtAuthenticationServiceTest.java | 2 java/code/src/com/redhat/rhn/frontend/servlets/test/AuthFilterTest.java | 6 java/code/src/com/redhat/rhn/frontend/servlets/test/PxtSessionDelegateImplTest.java | 23 + java/code/src/com/redhat/rhn/frontend/struts/test/RequestContextTest.java | 10 java/code/src/com/redhat/rhn/testing/BaseDeleteErrataActionAbstractTest.java | 102 +++++++ java/code/src/com/redhat/rhn/testing/BaseDeleteErrataActionTest.java | 102 ------- java/scripts/unittest.xml | 7 java/spacewalk-java.spec | 40 ++ rel-eng/packages/spacewalk-java | 2 14 files changed, 316 insertions(+), 252 deletions(-)
New commits: commit b203e9e37b121c5bbf5805435e67ee2a39fcb7b9 Author: Tomas Lestach tlestach@redhat.com Date: Wed Mar 21 19:42:19 2012 +0100
Automatic commit of package [spacewalk-java] release [1.8.23-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec index 9f964cb..f71245f 100644 --- a/java/spacewalk-java.spec +++ b/java/spacewalk-java.spec @@ -22,7 +22,7 @@ Name: spacewalk-java Summary: Spacewalk Java site packages Group: Applications/Internet License: GPLv2 -Version: 1.8.22 +Version: 1.8.23 Release: 1%{?dist} URL: https://fedorahosted.org/spacewalk Source0: https://fedorahosted.org/releases/s/p/spacewalk/%%7Bname%7D-%%7Bversion%7D.t... @@ -603,6 +603,44 @@ fi %{jardir}/postgresql-jdbc.jar
%changelog +* Wed Mar 21 2012 Tomas Lestach tlestach@redhat.com 1.8.23-1 +- fix LocalizationServiceTest (tlestach@redhat.com) +- fix AuthFilterTest (tlestach@redhat.com) +- fix PxtAuthenticationServiceTest (tlestach@redhat.com) +- fix RequestContextTest (tlestach@redhat.com) +- fix PxtSessionDelegateImplTest (tlestach@redhat.com) +- rename AuthenticationServiceTest (tlestach@redhat.com) +- rename BaseDeleteErrataActionTest (tlestach@redhat.com) +- skip executing Abstract test classes (tlestach@redhat.com) +- clean up classpath (tlestach@redhat.com) +- add slf4j.jar to classpath (tlestach@redhat.com) +- add struts.jar explicitelly to classpath (tlestach@redhat.com) +- we need to extract also the rhn.jar into the temp directory + (tlestach@redhat.com) +- 805275 - fix for configchannel.deployAllSystems (shughes@redhat.com) +- checkstyle fixes (sherr@redhat.com) +- Ensure the comparison uses correct type (slukasik@redhat.com) +- Set column name explicitly, because it varies by db backend. + (slukasik@redhat.com) +- Revert "removing unused string with trans-id + 'systemsearch_cpu_mhz_gt_column'" (msuchy@redhat.com) +- Revert "removing unused string with trans-id + 'systemsearch_cpu_mhz_lt_column'" (msuchy@redhat.com) +- Revert "removing unused string with trans-id + 'systemsearch_name_and_description_column'" (msuchy@redhat.com) +- Revert "removing unused string with trans-id + 'systemsearch_num_of_cpus_gt_column'" (msuchy@redhat.com) +- Revert "removing unused string with trans-id + 'systemsearch_num_of_cpus_lt_column'" (msuchy@redhat.com) +- Revert "removing unused string with trans-id 'systemsearch_ram_gt_column'" + (msuchy@redhat.com) +- Revert "removing unused string with trans-id 'systemsearch_ram_lt_column'" + (msuchy@redhat.com) +- 804810 - Taught SSM to look at flex as well as regular entitlements when + trying to add child channels (sherr@redhat.com) +- 804702 - fixed apidoc deployAllSystems() including the date parameter + (mmello@redhat.com) + * Mon Mar 19 2012 Jan Pazdziora 1.8.22-1 - Add a missing colon. (slukasik@redhat.com) - Show legend on details page; suggesting what to search for diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java index 66a09a3..8ec5e6f 100644 --- a/rel-eng/packages/spacewalk-java +++ b/rel-eng/packages/spacewalk-java @@ -1 +1 @@ -1.8.22-1 java/ +1.8.23-1 java/
commit 490c50806a38a71566514e4b5e99b52b460d15f2 Author: Tomas Lestach tlestach@redhat.com Date: Wed Mar 21 18:30:12 2012 +0100
fix LocalizationServiceTest
diff --git a/java/code/src/com/redhat/rhn/common/localization/test/LocalizationServiceTest.java b/java/code/src/com/redhat/rhn/common/localization/test/LocalizationServiceTest.java index 9e01517..5f44acc 100644 --- a/java/code/src/com/redhat/rhn/common/localization/test/LocalizationServiceTest.java +++ b/java/code/src/com/redhat/rhn/common/localization/test/LocalizationServiceTest.java @@ -205,7 +205,7 @@ public class LocalizationServiceTest extends RhnBaseTestCase { // Now test formatting it to German format in a DE TimeZone. ctx.setTimezone(TimeZone.getTimeZone("Europe/Paris")); String deDate = ls.formatDate(dt, Locale.GERMAN); - expected = "10.12.04 22:20:00 MEZ"; + expected = "10.12.04 22:20:00 CET"; assertEquals(expected, deDate);
String shortDeDate = ls.formatShortDate(dt, Locale.GERMAN);
commit b63c69b808cbd7fc85412a312229dd7240ec6e0d Author: Tomas Lestach tlestach@redhat.com Date: Wed Mar 21 18:21:15 2012 +0100
fix AuthFilterTest
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 index 455815e..7117411 100644 --- a/java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceAbstractTest.java +++ b/java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceAbstractTest.java @@ -93,7 +93,6 @@ public abstract class AuthenticationServiceAbstractTest extends MockObjectTestCa return (PxtSessionDelegate)mockPxtDelegate.proxy(); }
- protected Enumeration getParameterNames() { Vector vector = new Vector(); vector.add(requestParamNames[0]); diff --git a/java/code/src/com/redhat/rhn/frontend/servlets/test/AuthFilterTest.java b/java/code/src/com/redhat/rhn/frontend/servlets/test/AuthFilterTest.java index cd002ca..84e26e6 100644 --- a/java/code/src/com/redhat/rhn/frontend/servlets/test/AuthFilterTest.java +++ b/java/code/src/com/redhat/rhn/frontend/servlets/test/AuthFilterTest.java @@ -82,6 +82,12 @@ public class AuthFilterTest extends MockObjectTestCase { returnValue(mockDispatcher.proxy())); mockRequest.stubs().method("getHeaders").will(returnValue(new Vector().elements()));
+ mockRequest.stubs().method("getRemoteAddr") + .will(returnValue(new String("aaa.bbb.ccc.ddd"))); + + mockRequest.stubs().method("getMethod") + .will(returnValue(new String("GET"))); + filter.setAuthenticationService((AuthenticationService)mockAuthService.proxy()); }
commit 93319ae6cdcb2d5b533a450ed1f2d9dd3124b58f Author: Tomas Lestach tlestach@redhat.com Date: Wed Mar 21 18:17:48 2012 +0100
fix PxtAuthenticationServiceTest
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 index 57ef802..455815e 100644 --- a/java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceAbstractTest.java +++ b/java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceAbstractTest.java @@ -125,6 +125,11 @@ public abstract class AuthenticationServiceAbstractTest extends MockObjectTestCa new StringBuffer(getRequestURL())));
mockRequest.stubs().method("getQueryString").will(returnValue(null)); + + mockRequest.stubs().method("getMethod") + .will(returnValue(new String("POST"))); + + mockRequest.stubs().method("setAttribute"); }
}
commit c20537d95698642fa96f34a316e566aba4f81e81 Author: Tomas Lestach tlestach@redhat.com Date: Wed Mar 21 18:00:36 2012 +0100
fix RequestContextTest
diff --git a/java/code/src/com/redhat/rhn/frontend/struts/test/RequestContextTest.java b/java/code/src/com/redhat/rhn/frontend/struts/test/RequestContextTest.java index 1b88cf8..9aa68c1 100644 --- a/java/code/src/com/redhat/rhn/frontend/struts/test/RequestContextTest.java +++ b/java/code/src/com/redhat/rhn/frontend/struts/test/RequestContextTest.java @@ -14,13 +14,13 @@ */ package com.redhat.rhn.frontend.struts.test;
-import com.redhat.rhn.frontend.action.test.LoginActionTest; -import com.redhat.rhn.frontend.struts.RequestContext; -import com.redhat.rhn.testing.RhnMockHttpServletRequest; +import javax.servlet.http.HttpServletRequest;
import org.jmock.MockObjectTestCase;
-import javax.servlet.http.HttpServletRequest; +import com.redhat.rhn.frontend.action.test.LoginActionTest; +import com.redhat.rhn.frontend.struts.RequestContext; +import com.redhat.rhn.testing.RhnMockHttpServletRequest;
/** * RequestContextTest @@ -126,7 +126,7 @@ public class RequestContextTest extends MockObjectTestCase { // works long term. Thankfully in most cases we don't care about // the parameters order. assertEquals("http://localhost/rhn/somePage.do?" + - "otherparam=foo&barparam=beer&someparam=zzzzz", url); + "someparam=zzzzz&barparam=beer&otherparam=foo", url); }
}
commit 1597da2536b532c8616fbc1e39ffb736f86e886c Author: Tomas Lestach tlestach@redhat.com Date: Wed Mar 21 16:16:13 2012 +0100
fix PxtSessionDelegateImplTest
diff --git a/java/code/src/com/redhat/rhn/frontend/servlets/test/PxtSessionDelegateImplTest.java b/java/code/src/com/redhat/rhn/frontend/servlets/test/PxtSessionDelegateImplTest.java index ab408f0..16716e7 100644 --- a/java/code/src/com/redhat/rhn/frontend/servlets/test/PxtSessionDelegateImplTest.java +++ b/java/code/src/com/redhat/rhn/frontend/servlets/test/PxtSessionDelegateImplTest.java @@ -14,9 +14,10 @@ */ package com.redhat.rhn.frontend.servlets.test;
-import com.redhat.rhn.domain.session.WebSession; -import com.redhat.rhn.frontend.servlets.PxtCookieManager; -import com.redhat.rhn.frontend.servlets.PxtSessionDelegateImpl; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession;
import org.apache.commons.collections.Transformer; import org.apache.commons.collections.TransformerUtils; @@ -24,9 +25,9 @@ import org.jmock.Mock; import org.jmock.MockObjectTestCase; import org.jmock.core.Constraint;
-import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import com.redhat.rhn.domain.session.WebSession; +import com.redhat.rhn.frontend.servlets.PxtCookieManager; +import com.redhat.rhn.frontend.servlets.PxtSessionDelegateImpl;
/** * PxtSessionDelegateImplTest @@ -91,6 +92,7 @@ public class PxtSessionDelegateImplTest extends MockObjectTestCase { private Mock mockRequest; private Mock mockResponse; private Mock mockPxtSession; + private Mock mockHttpSession;
private PxtSessionDelegateImplStub pxtSessionDelegate;
@@ -115,6 +117,10 @@ public class PxtSessionDelegateImplTest extends MockObjectTestCase { return (WebSession)mockPxtSession.proxy(); }
+ private HttpSession getSession() { + return (HttpSession) mockHttpSession.proxy(); + } + private Cookie getPxtCookie() { return pxtCookieManager.createPxtCookie(PXT_SESSION_ID, getRequest(), 3600); } @@ -139,6 +145,7 @@ public class PxtSessionDelegateImplTest extends MockObjectTestCase { mockRequest = mock(HttpServletRequest.class); mockResponse = mock(HttpServletResponse.class); mockPxtSession = mock(WebSession.class); + mockHttpSession = mock(HttpSession.class); pxtSessionDelegate = new PxtSessionDelegateImplStub(); pxtCookieManager = new PxtCookieManager();
@@ -245,12 +252,16 @@ public class PxtSessionDelegateImplTest extends MockObjectTestCase { mockRequest.stubs().method("getAttribute").with(eq("session")).will( returnValue(getPxtSession()));
+ mockRequest.stubs().method("getSession").will(returnValue(getSession())); + mockPxtSession.stubs().method("getId").will(returnValue(PXT_SESSION_ID));
mockPxtSession.stubs().method("setExpires");
mockPxtSession.stubs().method("setWebUserId");
+ mockHttpSession.stubs().method("setAttribute"); + mockResponse.stubs().method("addCookie");
}
commit 10a8e1db9e46bbfc049320def44f1cb4e58955a8 Author: Tomas Lestach tlestach@redhat.com Date: Wed Mar 21 13:30:15 2012 +0100
rename AuthenticationServiceTest
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 new file mode 100644 index 0000000..57ef802 --- /dev/null +++ b/java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceAbstractTest.java @@ -0,0 +1,130 @@ +/** + * Copyright (c) 2009--2010 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)); + } + +} diff --git a/java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceTest.java b/java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceTest.java deleted file mode 100644 index 401cbf7..0000000 --- a/java/code/src/com/redhat/rhn/frontend/security/test/AuthenticationServiceTest.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright (c) 2009--2010 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 AuthenticationServiceTest 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 AuthenticationServiceTest(String name) { - super(name); - } - - - public AuthenticationServiceTest() { - } - - /** - * {@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)); - } - -} 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 68c8882..06ea5b2 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 AuthenticationServiceTest { +public class PxtAuthenticationServiceTest extends AuthenticationServiceAbstractTest {
private class PxtAuthenticationServiceStub extends PxtAuthenticationService { }
commit 3fce72fe8935e1dd7d0fd4496386249f5ec393da Author: Tomas Lestach tlestach@redhat.com Date: Wed Mar 21 13:28:26 2012 +0100
rename BaseDeleteErrataActionTest
diff --git a/java/code/src/com/redhat/rhn/frontend/action/errata/test/PublishedDeleteConfirmActionTest.java b/java/code/src/com/redhat/rhn/frontend/action/errata/test/PublishedDeleteConfirmActionTest.java index 7f000fc..11bbae8 100644 --- a/java/code/src/com/redhat/rhn/frontend/action/errata/test/PublishedDeleteConfirmActionTest.java +++ b/java/code/src/com/redhat/rhn/frontend/action/errata/test/PublishedDeleteConfirmActionTest.java @@ -17,13 +17,13 @@ package com.redhat.rhn.frontend.action.errata.test; import com.redhat.rhn.domain.errata.Errata; import com.redhat.rhn.domain.errata.test.ErrataFactoryTest; import com.redhat.rhn.domain.user.User; -import com.redhat.rhn.testing.BaseDeleteErrataActionTest; +import com.redhat.rhn.testing.BaseDeleteErrataActionAbstractTest;
/** * PublishedDeleteConfirmActionTest * @version $Rev$ */ -public class PublishedDeleteConfirmActionTest extends BaseDeleteErrataActionTest { +public class PublishedDeleteConfirmActionTest extends BaseDeleteErrataActionAbstractTest {
/** * {@inheritDoc} diff --git a/java/code/src/com/redhat/rhn/frontend/action/errata/test/UnpublishedDeleteConfirmActionTest.java b/java/code/src/com/redhat/rhn/frontend/action/errata/test/UnpublishedDeleteConfirmActionTest.java index b5252eb..952ddbd 100644 --- a/java/code/src/com/redhat/rhn/frontend/action/errata/test/UnpublishedDeleteConfirmActionTest.java +++ b/java/code/src/com/redhat/rhn/frontend/action/errata/test/UnpublishedDeleteConfirmActionTest.java @@ -17,13 +17,13 @@ package com.redhat.rhn.frontend.action.errata.test; import com.redhat.rhn.domain.errata.Errata; import com.redhat.rhn.domain.errata.test.ErrataFactoryTest; import com.redhat.rhn.domain.user.User; -import com.redhat.rhn.testing.BaseDeleteErrataActionTest; +import com.redhat.rhn.testing.BaseDeleteErrataActionAbstractTest;
/** * UnpublishedDeleteConfirmActionTest * @version $Rev$ */ -public class UnpublishedDeleteConfirmActionTest extends BaseDeleteErrataActionTest { +public class UnpublishedDeleteConfirmActionTest extends BaseDeleteErrataActionAbstractTest {
/** * {@inheritDoc} diff --git a/java/code/src/com/redhat/rhn/testing/BaseDeleteErrataActionAbstractTest.java b/java/code/src/com/redhat/rhn/testing/BaseDeleteErrataActionAbstractTest.java new file mode 100644 index 0000000..3d8b9d8 --- /dev/null +++ b/java/code/src/com/redhat/rhn/testing/BaseDeleteErrataActionAbstractTest.java @@ -0,0 +1,102 @@ +/** + * Copyright (c) 2009--2010 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.testing; + +import com.redhat.rhn.domain.errata.Errata; +import com.redhat.rhn.domain.org.OrgFactory; +import com.redhat.rhn.domain.role.RoleFactory; +import com.redhat.rhn.domain.user.User; + +/** + * BaseDeleteActionTest + * @version $Rev$ + */ +public abstract class BaseDeleteErrataActionAbstractTest extends RhnMockStrutsTestCase { + + /** + * {@inheritDoc} + */ + public void setUp() throws Exception { + super.setUp(); + setRequestPathInfo(getRequestPath()); + user.getOrg().getEntitlements().add(OrgFactory.getEntitlementEnterprise()); + user.getOrg().addRole(RoleFactory.CHANNEL_ADMIN); + } + + /** + * {@inheritDoc} + */ + public void testExecuteSatellite() throws Exception { + /* This test never finishes correctly on hosted + * due to the errata deletion stored procedure + * being painfully slow on hosted. Therefore + * we will not run the test there. + */ + return; + +// if (!Config.get().isSatellite()) { +// return; +// } + +// RhnSet errataToDelete = RhnSetFactory.createRhnSet(user.getId(), +// "errata_to_delete", +// SetCleanup.NOOP); +// +// List list = new ArrayList(); +// +// for (int j = 0; j < 5; ++j) { +// Errata e = createAnErrata(user); +// list.add(e); +// errataToDelete.addElement(e.getId()); +// } +// +// RhnSetManager.store(errataToDelete); +// +// RhnSet set = RhnSetDecl.ERRATA_TO_DELETE.get(user); +// assertEquals(5, set.size()); +// +// actionPerform(); +// verifyForward("default"); +// +// set = RhnSetDecl.ERRATA_TO_DELETE.get(user); +// +// assertEquals(0, set.size()); +// +// Iterator i = list.iterator(); +// +// /* verify that the errata have indeed been deleted */ +// while (i.hasNext()) { +// Errata e = (Errata) i.next(); +// TestUtils.flushAndEvict(e); +// e = ErrataFactory.lookupById(e.getId()); +// assertNull(e); +// } + } + + /** + * Creates a published or unpublished errata depending on which + * type is being tested + * @param user user who is creating the errata + * @return the errata + * @throws Exception if error + * + */ + public abstract Errata createAnErrata(User user) throws Exception; + + /** + * @return the request path + */ + public abstract String getRequestPath(); +} diff --git a/java/code/src/com/redhat/rhn/testing/BaseDeleteErrataActionTest.java b/java/code/src/com/redhat/rhn/testing/BaseDeleteErrataActionTest.java deleted file mode 100644 index a6c66fe..0000000 --- a/java/code/src/com/redhat/rhn/testing/BaseDeleteErrataActionTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright (c) 2009--2010 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.testing; - -import com.redhat.rhn.domain.errata.Errata; -import com.redhat.rhn.domain.org.OrgFactory; -import com.redhat.rhn.domain.role.RoleFactory; -import com.redhat.rhn.domain.user.User; - -/** - * BaseDeleteActionTest - * @version $Rev$ - */ -public abstract class BaseDeleteErrataActionTest extends RhnMockStrutsTestCase { - - /** - * {@inheritDoc} - */ - public void setUp() throws Exception { - super.setUp(); - setRequestPathInfo(getRequestPath()); - user.getOrg().getEntitlements().add(OrgFactory.getEntitlementEnterprise()); - user.getOrg().addRole(RoleFactory.CHANNEL_ADMIN); - } - - /** - * {@inheritDoc} - */ - public void testExecuteSatellite() throws Exception { - /* This test never finishes correctly on hosted - * due to the errata deletion stored procedure - * being painfully slow on hosted. Therefore - * we will not run the test there. - */ - return; - -// if (!Config.get().isSatellite()) { -// return; -// } - -// RhnSet errataToDelete = RhnSetFactory.createRhnSet(user.getId(), -// "errata_to_delete", -// SetCleanup.NOOP); -// -// List list = new ArrayList(); -// -// for (int j = 0; j < 5; ++j) { -// Errata e = createAnErrata(user); -// list.add(e); -// errataToDelete.addElement(e.getId()); -// } -// -// RhnSetManager.store(errataToDelete); -// -// RhnSet set = RhnSetDecl.ERRATA_TO_DELETE.get(user); -// assertEquals(5, set.size()); -// -// actionPerform(); -// verifyForward("default"); -// -// set = RhnSetDecl.ERRATA_TO_DELETE.get(user); -// -// assertEquals(0, set.size()); -// -// Iterator i = list.iterator(); -// -// /* verify that the errata have indeed been deleted */ -// while (i.hasNext()) { -// Errata e = (Errata) i.next(); -// TestUtils.flushAndEvict(e); -// e = ErrataFactory.lookupById(e.getId()); -// assertNull(e); -// } - } - - /** - * Creates a published or unpublished errata depending on which - * type is being tested - * @param user user who is creating the errata - * @return the errata - * @throws Exception if error - * - */ - public abstract Errata createAnErrata(User user) throws Exception; - - /** - * @return the request path - */ - public abstract String getRequestPath(); -}
commit baa9efc86081510b11457409648d48479846f81d Author: Tomas Lestach tlestach@redhat.com Date: Wed Mar 21 13:27:24 2012 +0100
skip executing Abstract test classes
diff --git a/java/scripts/unittest.xml b/java/scripts/unittest.xml index 358eaf7..108e7f5 100644 --- a/java/scripts/unittest.xml +++ b/java/scripts/unittest.xml @@ -49,6 +49,7 @@ <batchtest fork="yes" todir="${reports.tests}"> <fileset dir="${tmpdir}"> <include name="**/*${testcase}.class"/> + <exclude name="**/*Abstract*.class"/> </fileset> </batchtest> </junit>
commit b5a4c43d406d7dcb201077e35719f5916db086f6 Author: Tomas Lestach tlestach@redhat.com Date: Mon Mar 19 15:20:22 2012 +0100
clean up classpath
diff --git a/java/scripts/unittest.xml b/java/scripts/unittest.xml index a6bcaca..358eaf7 100644 --- a/java/scripts/unittest.xml +++ b/java/scripts/unittest.xml @@ -37,7 +37,6 @@ <include name="webapps/rhn/WEB-INF/lib/*.jar" /> <include name="**/lib/*.jar" /> </fileset> - <pathelement location="${test-jar}" /> <path location="/usr/share/java/jmock.jar"/> <path location="/usr/share/java/jmock-cglib.jar"/> <path location="/usr/share/java/struts.jar"/>
commit 9dcce85a050102b6aeb8170bcea5a5efa4b9319d Author: Tomas Lestach tlestach@redhat.com Date: Mon Mar 19 14:59:51 2012 +0100
add slf4j.jar to classpath
diff --git a/java/scripts/unittest.xml b/java/scripts/unittest.xml index e583284..a6bcaca 100644 --- a/java/scripts/unittest.xml +++ b/java/scripts/unittest.xml @@ -42,6 +42,7 @@ <path location="/usr/share/java/jmock-cglib.jar"/> <path location="/usr/share/java/struts.jar"/> <path location="/usr/share/java/struts*.jar"/> + <path location="/usr/share/java/slf4j/api.jar"/> </classpath>
<formatter type="plain"/>
commit 5f556ba0e5adf0a2b2b41ca92332629f656732c1 Author: Tomas Lestach tlestach@redhat.com Date: Mon Mar 19 14:41:23 2012 +0100
add struts.jar explicitelly to classpath
struts*.jar doesn't match struts.jar
diff --git a/java/scripts/unittest.xml b/java/scripts/unittest.xml index 0c66952..e583284 100644 --- a/java/scripts/unittest.xml +++ b/java/scripts/unittest.xml @@ -40,6 +40,7 @@ <pathelement location="${test-jar}" /> <path location="/usr/share/java/jmock.jar"/> <path location="/usr/share/java/jmock-cglib.jar"/> + <path location="/usr/share/java/struts.jar"/> <path location="/usr/share/java/struts*.jar"/> </classpath>
commit 3848f6579892584f4c4f3976a97be860931c6ced Author: Tomas Lestach tlestach@redhat.com Date: Mon Mar 19 14:39:37 2012 +0100
we need to extract also the rhn.jar into the temp directory
diff --git a/java/scripts/unittest.xml b/java/scripts/unittest.xml index da0007b..0c66952 100644 --- a/java/scripts/unittest.xml +++ b/java/scripts/unittest.xml @@ -2,6 +2,7 @@ <project name="RHN" default="all" basedir=".">
<property name="reports.tests" location="/tmp/reports" /> + <property name="app-jar" location="/usr/share/rhn/lib/rhn.jar"/> <property name="test-jar" location="/usr/share/rhn/lib/rhn-test.jar"/> <property name="tmpdir" value="${java.io.tmpdir}/spacewalk-test" />
@@ -21,6 +22,7 @@ <delete dir="${reports.tests}" /> <mkdir dir="${reports.tests}"/> <mkdir dir="${tmpdir}"/> + <unzip src="${app-jar}" dest="${tmpdir}" /> <unzip src="${test-jar}" dest="${tmpdir}" />
<junit forkmode="once" fork="yes" printsummary="yes" haltonfailure="no"> @@ -29,6 +31,7 @@ <jvmarg value="-Djava.compiler=NONE" /> <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8002,server=y,suspend=n" /> <classpath> + <pathelement location="${tmpdir}" /> <pathelement path="/var/lib/${tomcat}/webapps/rhn"/> <fileset dir="/usr/share/${tomcat}"> <include name="webapps/rhn/WEB-INF/lib/*.jar" />
spacewalk-commits@lists.fedorahosted.org