You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2006/05/23 16:44:52 UTC
svn commit: r408909 - in
/incubator/roller/branches/roller_3.0/tests/org/apache/roller: business/
presentation/ presentation/bookmarks/ presentation/filters/
presentation/velocity/ presentation/velocity/plugins/smileys/
presentation/velocity/plugins/te...
Author: snoopdave
Date: Tue May 23 07:44:50 2006
New Revision: 408909
URL: http://svn.apache.org/viewvc?rev=408909&view=rev
Log:
tests were not compiling due to new presentation package structure
Added:
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/ApplicationResourcesTest.java
- copied, changed from r408650, incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/ApplicationResourcesTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/LanguageUtilTest.java
- copied, changed from r408650, incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/LanguageUtilTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/SearchServletTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/StrutsActionTestBase.java
- copied, changed from r408650, incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/StrutsActionTestBase.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/TestAll.java
- copied, changed from r408650, incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/TestAll.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/authoring/
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/authoring/struts/
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/authoring/struts/actions/
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/authoring/struts/actions/BookmarksActionTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/authoring/struts/actions/WeblogEntryActionTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/MockPrincipal.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/MockRollerContext.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/MockRollerRequest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/filters/
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/filters/RequestFilterTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/filters/
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/ArchiveParserTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/ExportRssTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/VelocityServletTestBase.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/plugins/
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/plugins/smileys/
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/plugins/smileys/SmileysTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/plugins/textile/
incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/plugins/textile/TextileTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/webservices/xmlrpc/
incubator/roller/branches/roller_3.0/tests/org/apache/roller/webservices/xmlrpc/RollerXmlRpcServerTest.java
Removed:
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/ApplicationResourcesTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/ArchiveParserTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/LanguageUtilTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/MockPrincipal.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/MockRollerContext.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/MockRollerRequest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/SearchServletTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/StrutsActionTestBase.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/TestAll.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/VelocityServletTestBase.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/bookmarks/BookmarksActionTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/filters/RequestFilterTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/velocity/ExportRssTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/velocity/plugins/smileys/SmileysTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/velocity/plugins/textile/TextileTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/weblog/WeblogEntryActionTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/xmlrpc/RollerXmlRpcServerTest.java
Modified:
incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/ (props changed)
incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/PlanetManagerLocalTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/PlanetManagerTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/velocity/plugins/smileys/ (props changed)
incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/velocity/plugins/textile/ (props changed)
incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/LRUCache2Test.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/LinkbackExtractorTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/RegexUtilTest.java
incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/UtilitiesTest.java
Propchange: incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May 23 07:44:50 2006
@@ -0,0 +1 @@
+.LCKPlanetManagerTest.java~
Modified: incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/PlanetManagerLocalTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/PlanetManagerLocalTest.java?rev=408909&r1=408908&r2=408909&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/PlanetManagerLocalTest.java (original)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/PlanetManagerLocalTest.java Tue May 23 07:44:50 2006
@@ -22,11 +22,8 @@
import org.apache.roller.RollerTestBase;
import org.apache.roller.model.PlanetManager;
-import org.apache.roller.pojos.PlanetGroupData;
-import org.apache.roller.pojos.UserData;
-import org.apache.roller.presentation.planet.RefreshEntriesTask;
-import org.apache.roller.presentation.planet.SyncWebsitesTask;
-
+import org.apache.roller.ui.admin.struts.actions.RefreshEntriesTask;
+import org.apache.roller.ui.admin.struts.actions.SyncWebsitesTask;
/**
* Test database implementation of PlanetManager for local feeds.
Modified: incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/PlanetManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/PlanetManagerTest.java?rev=408909&r1=408908&r2=408909&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/PlanetManagerTest.java (original)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/PlanetManagerTest.java Tue May 23 07:44:50 2006
@@ -16,6 +16,7 @@
package org.apache.roller.business;
import java.io.File;
+import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
@@ -26,7 +27,6 @@
import junit.framework.TestSuite;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
import org.apache.roller.TestUtils;
import org.apache.roller.config.RollerConfig;
import org.apache.roller.model.PlanetManager;
@@ -202,17 +202,17 @@
assertNotNull(sub);
PlanetEntryData entry1 = new PlanetEntryData();
- entry1.setPermalink("test_entry1");
+ entry1.setPermaLink("test_entry1");
entry1.setCategoriesString("test,test2");
entry1.setSubscription(sub);
- entry1.setPublished(new Date());
+ entry1.setPubTime(new Timestamp(System.currentTimeMillis()));
sub.addEntry(entry1);
PlanetEntryData entry2 = new PlanetEntryData();
- entry2.setPermalink("test_entry2");
+ entry2.setPermaLink("test_entry2");
entry2.setCategoriesString("test_cat1,test_cat2,test_cat3");
entry2.setSubscription(sub);
- entry2.setPublished(new Date());
+ entry2.setPubTime(new Timestamp(System.currentTimeMillis()));
sub.addEntry(entry2);
// save entries
@@ -229,10 +229,10 @@
assertNotNull(sub);
PlanetEntryData entry3 = new PlanetEntryData();
- entry3.setPermalink("test_entry3");
+ entry3.setPermaLink("test_entry3");
entry3.setCategoriesString("test,test3");
entry3.setSubscription(sub);
- entry3.setPublished(new Date());
+ entry3.setPubTime(new Timestamp(System.currentTimeMillis()));
planet.saveEntry(entry3);
TestUtils.endSession(true);
Propchange: incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/velocity/plugins/smileys/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May 23 07:44:50 2006
@@ -0,0 +1 @@
+.LCKSmileysTest.java~
Propchange: incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/velocity/plugins/textile/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May 23 07:44:50 2006
@@ -0,0 +1 @@
+.LCKTextileTest.java~
Copied: incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/ApplicationResourcesTest.java (from r408650, incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/ApplicationResourcesTest.java)
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/ApplicationResourcesTest.java?p2=incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/ApplicationResourcesTest.java&p1=incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/ApplicationResourcesTest.java&r1=408650&r2=408909&rev=408909&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/ApplicationResourcesTest.java (original)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/ApplicationResourcesTest.java Tue May 23 07:44:50 2006
@@ -20,7 +20,7 @@
*
* Created on 24-May-04
*/
-package org.apache.roller.presentation;
+package org.apache.roller.ui;
import java.io.FileInputStream;
import java.util.Iterator;
Copied: incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/LanguageUtilTest.java (from r408650, incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/LanguageUtilTest.java)
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/LanguageUtilTest.java?p2=incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/LanguageUtilTest.java&p1=incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/LanguageUtilTest.java&r1=408650&r2=408909&rev=408909&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/LanguageUtilTest.java (original)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/LanguageUtilTest.java Tue May 23 07:44:50 2006
@@ -20,10 +20,9 @@
*
* Created on 13-Jul-04
*/
-package org.apache.roller.presentation;
+package org.apache.roller.ui;
import java.util.Locale;
-import java.util.Vector;
import javax.servlet.ServletContext;
@@ -36,6 +35,7 @@
import junit.framework.TestSuite;
import com.mockrunner.mock.web.MockServletContext;
+import org.apache.roller.ui.core.LanguageUtil;
/**
* The purpose of this class is to
Added: incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/SearchServletTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/SearchServletTest.java?rev=408909&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/SearchServletTest.java (added)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/SearchServletTest.java Tue May 23 07:44:50 2006
@@ -0,0 +1,66 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.roller.ui;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import com.mockrunner.mock.web.MockHttpServletRequest;
+import org.apache.roller.ui.core.filters.PersistenceSessionFilter;
+import org.apache.roller.ui.core.filters.RequestFilter;
+import org.apache.roller.ui.rendering.search.SearchServlet;
+import org.apache.roller.ui.rendering.velocity.VelocityServletTestBase;
+
+
+/**
+ * @author Dave Johnson
+ */
+public class SearchServletTest extends VelocityServletTestBase
+{
+ public void testSearch() throws Exception
+ {
+ servletModule.setServlet(
+ servletModule.createServlet(SearchServlet.class));
+ MockHttpServletRequest mockRequest = getMockFactory().getMockRequest();
+
+ mockRequest.setContextPath("/search");
+ mockRequest.setupAddParameter("q","test");
+
+ servletModule.createFilter(PersistenceSessionFilter.class);
+ servletModule.createFilter(RequestFilter.class);
+ servletModule.setDoChain(true);
+
+ servletModule.doFilter();
+ getMockFactory().addRequestWrapper(new HttpServletRequestWrapper(
+ (HttpServletRequest)servletModule.getFilteredRequest()));
+ servletModule.doGet();
+ assertNotNull(
+ servletModule.getRequestAttribute("zzz_VelocityContext_zzz"));
+ }
+ public static Test suite()
+ {
+ return new TestSuite(SearchServletTest.class);
+ }
+ public static void main(String[] args)
+ {
+ junit.textui.TestRunner.run(SearchServletTest.class);
+ }
+}
Copied: incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/StrutsActionTestBase.java (from r408650, incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/StrutsActionTestBase.java)
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/StrutsActionTestBase.java?p2=incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/StrutsActionTestBase.java&p1=incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/StrutsActionTestBase.java&r1=408650&r2=408909&rev=408909&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/StrutsActionTestBase.java (original)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/StrutsActionTestBase.java Tue May 23 07:44:50 2006
@@ -1,21 +1,21 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. The ASF licenses this file to You
-* under the Apache License, Version 2.0 (the "License"); you may not
-* use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License. For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
-package org.apache.roller.presentation;
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.roller.ui;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
@@ -25,9 +25,6 @@
import org.apache.roller.RollerTestBase;
import org.apache.roller.model.UserManager;
import org.apache.roller.pojos.UserData;
-import org.apache.roller.pojos.WebsiteData;
-import org.apache.roller.presentation.filters.PersistenceSessionFilter;
-import org.apache.roller.presentation.filters.RequestFilter;
import com.mockrunner.mock.web.ActionMockObjectFactory;
import com.mockrunner.mock.web.MockHttpServletRequest;
@@ -36,6 +33,11 @@
import com.mockrunner.servlet.ServletTestModule;
import com.mockrunner.struts.ActionTestModule;
import com.mockrunner.struts.MapMessageResources;
+import org.apache.roller.ui.core.MockPrincipal;
+import org.apache.roller.ui.core.MockRollerContext;
+import org.apache.roller.ui.core.RollerSession;
+import org.apache.roller.ui.core.filters.PersistenceSessionFilter;
+import org.apache.roller.ui.core.filters.RequestFilter;
/**
* Base for Struts Action testing.
Copied: incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/TestAll.java (from r408650, incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/TestAll.java)
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/TestAll.java?p2=incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/TestAll.java&p1=incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/TestAll.java&r1=408650&r2=408909&rev=408909&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/presentation/TestAll.java (original)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/TestAll.java Tue May 23 07:44:50 2006
@@ -15,7 +15,7 @@
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
-package org.apache.roller.presentation;
+package org.apache.roller.ui;
import junit.framework.Test;
import junit.framework.TestCase;
@@ -23,12 +23,12 @@
import org.apache.roller.BlacklistTest;
import org.apache.roller.DateTest;
-import org.apache.roller.presentation.bookmarks.BookmarksActionTest;
-import org.apache.roller.presentation.filters.RequestFilterTest;
-import org.apache.roller.presentation.velocity.plugins.smileys.SmileysTest;
-import org.apache.roller.presentation.velocity.plugins.textile.TextileTest;
-import org.apache.roller.presentation.weblog.WeblogEntryActionTest;
-import org.apache.roller.presentation.xmlrpc.RollerXmlRpcServerTest;
+import org.apache.roller.ui.authoring.struts.actions.BookmarksActionTest;
+import org.apache.roller.ui.core.filters.RequestFilterTest;
+import org.apache.roller.ui.rendering.velocity.plugins.smileys.SmileysTest;
+import org.apache.roller.ui.rendering.velocity.plugins.textile.TextileTest;
+import org.apache.roller.ui.authoring.struts.actions.WeblogEntryActionTest;
+import org.apache.roller.webservices.xmlrpc.RollerXmlRpcServerTest;
import org.apache.roller.util.LRUCache2Test;
import org.apache.roller.util.LinkbackExtractorTest;
import org.apache.roller.util.RegexUtilTest;
Added: incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/authoring/struts/actions/BookmarksActionTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/authoring/struts/actions/BookmarksActionTest.java?rev=408909&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/authoring/struts/actions/BookmarksActionTest.java (added)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/authoring/struts/actions/BookmarksActionTest.java Tue May 23 07:44:50 2006
@@ -0,0 +1,110 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+/*
+ * Created on Oct 27, 2003
+ */
+package org.apache.roller.ui.authoring.struts.actions;
+
+
+import javax.servlet.http.HttpServletRequest;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.roller.RollerException;
+import org.apache.roller.model.UserManager;
+import org.apache.roller.pojos.FolderData;
+import org.apache.roller.pojos.UserData;
+
+import com.mockrunner.mock.web.MockActionMapping;
+import com.mockrunner.mock.web.MockHttpServletRequest;
+import com.mockrunner.mock.web.MockServletContext;
+import org.apache.roller.ui.StrutsActionTestBase;
+import org.apache.roller.ui.authoring.struts.formbeans.BookmarksForm;
+import org.apache.roller.ui.core.BasePageModel;
+import org.apache.roller.ui.core.RollerRequest;
+
+/**
+ * Test BookmarkAction (proof-of-concept for Mockrunner Struts testing)
+ * @author Dave Johnson
+ */
+public class BookmarksActionTest extends StrutsActionTestBase
+{
+ public void testSelectFolder()
+ {
+ MockServletContext ctx = getMockFactory().getMockServletContext();
+ ctx.setServletContextName("/roller");
+ MockHttpServletRequest request = getMockFactory().getMockRequest();
+ request.setContextPath("/roller");
+
+ UserManager umgr = null;
+ UserData user = null;
+ try
+ {
+ umgr = getRoller().getUserManager();
+ user = (UserData)umgr.getUsers(mWebsite, null).get(0);
+ doFilters();
+ authenticateUser(user.getUserName(), "editor");
+ }
+ catch (RollerException e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+
+ // Setup form bean
+ BookmarksForm form = (BookmarksForm)
+ strutsModule.createActionForm(BookmarksForm.class);
+
+ // Setup mapping and request parameters
+ MockActionMapping mapping = strutsModule.getMockActionMapping();
+ mapping.setupForwards(new String[] {"access-denied","BookmarksForm"});
+ mapping.setParameter("method");
+ strutsModule.addRequestParameter("weblog",mWebsite.getHandle());
+ strutsModule.addRequestParameter("method","selectFolder");
+
+ try {
+ RollerRequest rreq = new RollerRequest(strutsModule.getMockPageContext());
+ rreq.setWebsite(mWebsite);
+ strutsModule.setRequestAttribute(RollerRequest.ROLLER_REQUEST, rreq);
+ strutsModule.actionPerform(BookmarksAction.class, form);
+ } catch (Throwable e) {
+ e.printStackTrace();
+ fail();
+ }
+ // Test for success
+ strutsModule.verifyNoActionMessages();
+ strutsModule.verifyForward("BookmarksForm");
+
+ // Verify objects we put in context for JSP page
+ verifyPageContext();
+ }
+
+ protected void verifyPageContext()
+ {
+ HttpServletRequest req = (HttpServletRequest)
+ servletModule.getFilteredRequest();
+ assertTrue(req.getAttribute("folder") instanceof FolderData);
+ assertTrue(req.getAttribute("model") instanceof BasePageModel);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(BookmarksActionTest.class);
+ }
+}
Added: incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/authoring/struts/actions/WeblogEntryActionTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/authoring/struts/actions/WeblogEntryActionTest.java?rev=408909&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/authoring/struts/actions/WeblogEntryActionTest.java (added)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/authoring/struts/actions/WeblogEntryActionTest.java Tue May 23 07:44:50 2006
@@ -0,0 +1,103 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.roller.ui.authoring.struts.actions;
+
+import javax.servlet.http.HttpServletRequest;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.roller.RollerException;
+import org.apache.roller.model.UserManager;
+import org.apache.roller.pojos.UserData;
+
+import com.mockrunner.mock.web.MockActionMapping;
+import com.mockrunner.mock.web.MockHttpServletRequest;
+import org.apache.roller.ui.StrutsActionTestBase;
+import org.apache.roller.ui.authoring.struts.formbeans.WeblogEntryFormEx;
+import org.apache.roller.ui.core.RollerRequest;
+
+/**
+ * @author dave
+ */
+public class WeblogEntryActionTest extends StrutsActionTestBase
+{
+ public void testCreateWeblogEntry()
+ {
+ MockHttpServletRequest mockRequest = getMockFactory().getMockRequest();
+ mockRequest.setContextPath("/dummy");
+ doFilters();
+
+ UserManager umgr = null;
+ UserData user = null;
+ try
+ {
+ umgr = getRoller().getUserManager();
+ user = (UserData)umgr.getUsers(mWebsite, null).get(0);
+ authenticateUser(user.getUserName(), "editor");
+ }
+ catch (RollerException e)
+ {
+ e.printStackTrace();
+ fail();
+ }
+
+ // Setup mapping and request parameters
+ MockActionMapping mapping = strutsModule.getMockActionMapping();
+ mapping.setupForwards(new String[] {
+ "access-denied","weblogEdit.page","weblogEntryRemove.page"});
+ mapping.setParameter("method");
+ strutsModule.addRequestParameter("weblog",mWebsite.getHandle());
+ strutsModule.addRequestParameter("method","create");
+
+ // Setup form bean
+ WeblogEntryFormEx form = (WeblogEntryFormEx)
+ strutsModule.createActionForm(WeblogEntryFormEx.class);
+ form.setTitle("test_title");
+ form.setText("Test blog text");
+
+ try {
+ RollerRequest rreq = new RollerRequest(strutsModule.getMockPageContext());
+ rreq.setWebsite(mWebsite);
+ strutsModule.setRequestAttribute(RollerRequest.ROLLER_REQUEST, rreq);
+ strutsModule.actionPerform(WeblogEntryFormAction.class, form);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ fail();
+ }
+ // Test for success
+ strutsModule.verifyNoActionMessages();
+ strutsModule.verifyForward("weblogEdit.page");
+
+ // Verify objects we put in context for JSP page
+ verifyPageContext();
+ }
+
+ protected void verifyPageContext()
+ {
+ HttpServletRequest req = (HttpServletRequest)
+ servletModule.getFilteredRequest();
+ assertNotNull(req.getAttribute("model"));
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(WeblogEntryActionTest.class);
+ }
+
+}
Added: incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/MockPrincipal.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/MockPrincipal.java?rev=408909&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/MockPrincipal.java (added)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/MockPrincipal.java Tue May 23 07:44:50 2006
@@ -0,0 +1,34 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+/*
+ * Created on Mar 8, 2004
+ */
+package org.apache.roller.ui.core;
+
+public class MockPrincipal implements java.security.Principal
+{
+ String mName;
+ public MockPrincipal(String name)
+ {
+ mName = name;
+ }
+ public String getName()
+ {
+ return mName;
+ }
+}
\ No newline at end of file
Added: incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/MockRollerContext.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/MockRollerContext.java?rev=408909&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/MockRollerContext.java (added)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/MockRollerContext.java Tue May 23 07:44:50 2006
@@ -0,0 +1 @@
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. The ASF licenses this file to You
* under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. For additional information regarding
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
/*
* Created on Mar 4, 2004
*/
package org.apache.roller.ui.core;
import java.io.File;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.RollerException;
/**
* @author lance.lavandowska
*/
public class MockRollerContext extends RollerContext
{
private static Log mLogger =
LogFactory.getFactory().getInstance(MockRollerContext.class);
private static ServletContext mContext = null;
public void init(ServletContext sc)
{
mLogger.debug("MockRollerContext initializing");
// initialize super
super.contextInitialized(new ServletContextEvent(sc));
// Save context in self and self in context
mContext = sc;
mContext.setAttribute(ROLLER_CONTEXT, this);
mContext.setAttribute("org.apache.roller.absoluteContextURL", "/");
}
//-----------------------------------------------------------------------
/** Because I cannot set the super's values, I have to
* o
veride the methods as well */
public static RollerContext getRollerContext()
{
// get roller from servlet context
return (RollerContext) mContext.getAttribute(ROLLER_CONTEXT);
}
//-----------------------------------------------------------------------
/** Because I cannot set the super's values, I have to
* overide the methods as well */
public static ServletContext getServletContext()
{
return mContext;
}
//-----------------------------------------------------------------------
/** Because I cannot set the super's values, I have to
* overide the methods as well */
public String getRollerVersion()
{
return super.getRollerVersion();
}
//-----------------------------------------------------------------------
/** Because I cannot set the super's values, I have to
* overide the methods as well */
public String getRollerBuildTime()
{
return super.getRoll
erBuildTime();
}
//-----------------------------------------------------------------------
/** Because I cannot set the super's values, I have to
* overide the methods as well */
public String getRollerBuildUser()
{
return super.getRollerBuildUser();
}
//-----------------------------------------------------------------------
/** Because I cannot set the super's values, I have to
* overide the methods as well */
public String getAbsoluteContextUrl()
{
return "";
}
//-----------------------------------------------------------------------
/** Because I cannot set the super's values, I have to
* overide the methods as well */
public String getAbsoluteContextUrl(HttpServletRequest request)
{
return request.getScheme() +"://" + request.getServerName() + "";
}
//-----------------------------------------------------------------------
/** Because I cannot set the super's va
lues, I have to
* overide the methods as well */
/* not available anymore ... use the new config classes instead -- Allen G
public RollerConfigData getRollerConfig()
{
return super.getRollerConfig();
}
*/
//------------------------------------------------------------------------
public String getConfigPath()
{
String root = System.getProperty("ro.build");
String configPath =
root
+ File.separator
+ "roller"
+ File.separator
+ "WEB-INF"
+ File.separator
+ "roller-config.xml";
return configPath;
}
protected void upgradeDatabaseIfNeeded() throws RollerException
{
// for now, this is a no-op
}
}
\ No newline at end of file
Added: incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/MockRollerRequest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/MockRollerRequest.java?rev=408909&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/MockRollerRequest.java (added)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/MockRollerRequest.java Tue May 23 07:44:50 2006
@@ -0,0 +1,42 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+/*
+ * Created on Jun 8, 2004
+ */
+package org.apache.roller.ui.core;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.roller.RollerException;
+
+/**
+ * @author lance.lavandowska
+ */
+public class MockRollerRequest extends RollerRequest
+{
+ /**
+ * @param req
+ * @param ctx
+ * @throws RollerException
+ */
+ public MockRollerRequest(HttpServletRequest req, ServletContext ctx) throws RollerException
+ {
+ super(req, ctx);
+ }
+
+}
Added: incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/filters/RequestFilterTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/filters/RequestFilterTest.java?rev=408909&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/filters/RequestFilterTest.java (added)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/core/filters/RequestFilterTest.java Tue May 23 07:44:50 2006
@@ -0,0 +1,65 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.roller.ui.core.filters;
+
+import javax.servlet.http.HttpServletRequest;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import com.mockrunner.mock.web.MockHttpServletRequest;
+import org.apache.roller.ui.rendering.velocity.VelocityServletTestBase;
+import org.apache.roller.ui.core.RollerRequest;
+import org.apache.roller.ui.rendering.velocity.PageServlet;
+
+/**
+ * @author Dave Johnson
+ */
+public class RequestFilterTest extends VelocityServletTestBase {
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ }
+ public RequestFilterTest() {
+ }
+ public void testRequestFilter() throws Exception {
+
+ servletModule.setServlet(
+ servletModule.createServlet(PageServlet.class));
+
+ MockHttpServletRequest mockRequest = getMockFactory().getMockRequest();
+ mockRequest.setContextPath("/roller/page");
+ mockRequest.setPathInfo("/testuser/20050101");
+ mockRequest.setRequestURL("http://localost:8080");
+
+ servletModule.createFilter(PersistenceSessionFilter.class);
+ servletModule.createFilter(RequestFilter.class);
+ servletModule.setDoChain(true);
+
+ servletModule.doFilter();
+
+ HttpServletRequest req = (HttpServletRequest)
+ servletModule.getFilteredRequest();
+ RollerRequest rreq = RollerRequest.getRollerRequest(req);
+ assertNotNull(rreq);
+ }
+ public static Test suite()
+ {
+ return new TestSuite(RequestFilterTest.class);
+ }
+}
Added: incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/ArchiveParserTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/ArchiveParserTest.java?rev=408909&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/ArchiveParserTest.java (added)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/ArchiveParserTest.java Tue May 23 07:44:50 2006
@@ -0,0 +1,129 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+/*
+ * Created on May 4, 2004
+ */
+package org.apache.roller.ui.rendering.velocity;
+
+import java.io.File;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.roller.RollerException;
+import org.apache.roller.RollerTestBase;
+import org.apache.roller.business.FileManagerTest;
+import org.apache.roller.pojos.RollerConfigData;
+
+import com.mockrunner.mock.web.MockServletContext;
+
+/**
+ * TODO: revisit this class once Atom 1.0 support comes to Rome
+ * @author lance.lavandowska
+ */
+public class ArchiveParserTest extends RollerTestBase
+{
+ MockServletContext mContext = null;
+ RollerConfigData rollerConfig = null;
+
+ private static String FILE_LOCATION = "./build/junk/";
+ private static String RSS_ARCHIVE = "export-test.rss.xml";
+ private static String ATOM_ARCHIVE = "export-test.atom.xml";
+
+ public void _testAtomParsing() throws RollerException
+ {
+ File archiveFile = new File(FILE_LOCATION +
+ mWebsite.getHandle() +
+ "/" + ATOM_ARCHIVE);
+ parseFile(archiveFile);
+ }
+
+ public void _testRssParsing() throws RollerException
+ {
+ File archiveFile = new File(FILE_LOCATION +
+ mWebsite.getHandle() +
+ "/" + RSS_ARCHIVE);
+ parseFile(archiveFile);
+ }
+
+ /**
+ * @param archiveFile
+ * @throws RollerException
+ */
+ private void parseFile(File archiveFile) throws RollerException
+ {
+ if (archiveFile.exists())
+ {
+ //ArchiveParser parser = new ArchiveParser(getRoller(), mWebsite, archiveFile);
+ //getRoller().begin(UserData.SYSTEM_USER);
+ String result = null; // parser.parse();
+ getRoller().flush();
+ assertTrue(result.length() > 0);
+ System.out.println(result);
+ }
+ else
+ {
+ //try again, use export test to create necessary files
+ ExportRssTest exportTest = new ExportRssTest();
+ try
+ {
+ exportTest.setUp();
+ exportTest.testExportRecent();
+ exportTest.tearDown();
+
+ parseFile(archiveFile);
+ }
+ catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ // if it *still* isn't there, then fail
+ if (!archiveFile.exists())
+ {
+ fail(archiveFile.getAbsolutePath() + " does not exist.");
+ }
+ }
+ }
+
+ /*
+ * Need to change the UploadPath location for testing.
+ * @see junit.framework.TestCase#setUp()
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ //rollerConfig = rollerContext.getRollerConfig();
+ }
+
+ /*
+ * Need to reset the UploadPath after testing.
+ * @see junit.framework.TestCase#tearDown()
+ */
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(ArchiveParserTest.class);
+ }
+}
Added: incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/ExportRssTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/ExportRssTest.java?rev=408909&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/ExportRssTest.java (added)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/ExportRssTest.java Tue May 23 07:44:50 2006
@@ -0,0 +1,152 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+/*
+ * Created on Mar 25, 2004
+ */
+package org.apache.roller.ui.rendering.velocity;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.List;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.roller.ui.StrutsActionTestBase;
+
+import com.mockrunner.mock.web.MockServletContext;
+
+/**
+ * Not really a servlet test, the ExportRss class does require
+ * that RollerContext has been loaded and initialized.
+ *
+ * @author lance.lavandowska
+ */
+public class ExportRssTest extends StrutsActionTestBase
+{
+ private String oldUploadPath;
+
+ /**
+ * Not sure how to test that the file was generated, so if
+ * there was no Exception we passed.
+ */
+ public void testExportRecent() throws Exception
+ {
+ ExportRss exporter = null; // new ExportRss(mWebsite);
+
+ //List entries = getRoller().getWeblogManager().getAllRecentWeblogEntries(new Date(), 5);
+
+ List entries = getRoller().getWeblogManager().getWeblogEntries(
+ null, // userName
+ null, // startDate
+ new Date(), // endDate
+ null, // catName
+ null, // status
+ null, // sortby
+ new Integer(5)); // maxEntries
+
+ try
+ {
+ // test RSS output
+ exporter.exportEntries(entries, "export-test.rss.xml");
+
+ // test Atom output
+ exporter.setExportAtom(true);
+ exporter.exportEntries(entries, "export-test.atom.xml");
+ }
+ catch (Exception e)
+ {
+ mLogger.error(e);
+ // I'm not sure how best to test the output!
+ // I guess no exceptions will have to do.
+ fail("Find a better way to test than checking Exceptions, bozo!");
+ }
+ finally
+ {
+ }
+ }
+
+ /*
+ * Need to change the UploadPath location for testing.
+ * @see junit.framework.TestCase#setUp()
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ MockServletContext mContext = getMockFactory().getMockServletContext();
+ mContext.setRealPath("build/junk", "./build/junk");
+
+ setupVelocityProperties(mContext);
+ }
+
+ /**
+ * ExportRss needs to load velocity.properties from ServletContext.
+ * For the mock implementation we need to set the 'resource stream'.
+ * @param mContext
+ * @throws IOException
+ */
+ private void setupVelocityProperties(MockServletContext mContext) throws IOException
+ {
+ InputStream is = this.getClass().getClassLoader().getResourceAsStream("velocity.properties");
+ if (is == null) fail("Unable to find velocity.properties");
+ BufferedInputStream bis = new BufferedInputStream(is, 1);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ int buf = bis.read();
+ do
+ {
+ bos.write(buf);
+ buf = bis.read();
+ }
+ while(buf != -1);
+
+ byte[] bytes = bos.toByteArray();
+ mContext.setResourceAsStream("/WEB-INF/velocity.properties", bytes);
+ try
+ {
+ bos.close();
+ bis.close();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /*
+ * Need to reset the UploadPath after testing.
+ * @see junit.framework.TestCase#tearDown()
+ */
+ public void tearDown() throws Exception
+ {
+ //getRoller().begin(UserData.SYSTEM_USER);
+ //RollerConfigData rollerConfig = rollerContext.getRollerConfig();
+ //rollerConfig.setUploadPath(oldUploadPath);
+ //rollerConfig.save();
+ //getRoller().commit();
+
+ super.tearDown();
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(ExportRssTest.class);
+ }
+}
Added: incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/VelocityServletTestBase.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/VelocityServletTestBase.java?rev=408909&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/VelocityServletTestBase.java (added)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/VelocityServletTestBase.java Tue May 23 07:44:50 2006
@@ -0,0 +1,130 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.roller.ui.rendering.velocity;
+
+import java.io.FileInputStream;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.jsp.JspEngineInfo;
+import javax.servlet.jsp.JspFactory;
+import javax.servlet.jsp.PageContext;
+
+import org.apache.roller.RollerTestBase;
+
+import com.mockrunner.mock.web.ActionMockObjectFactory;
+import com.mockrunner.mock.web.MockHttpServletRequest;
+import com.mockrunner.mock.web.MockServletConfig;
+import com.mockrunner.mock.web.MockServletContext;
+import com.mockrunner.mock.web.WebMockObjectFactory;
+import com.mockrunner.servlet.ServletTestModule;
+import com.mockrunner.struts.ActionTestModule;
+import com.mockrunner.struts.MapMessageResources;
+import org.apache.roller.ui.core.MockPrincipal;
+import org.apache.roller.ui.core.MockRollerContext;
+import org.apache.roller.ui.core.filters.PersistenceSessionFilter;
+import org.apache.roller.ui.core.filters.RequestFilter;
+
+
+/**
+ * Base for VelocityServlet testing.
+ * @author Dave Johnson
+ */
+public abstract class VelocityServletTestBase extends RollerTestBase
+{
+ protected ServletTestModule servletModule;
+ private WebMockObjectFactory mockFactory;
+ protected MockRollerContext rollerContext;
+ protected ActionTestModule strutsModule; // need Struts for message resources
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ getMockFactory().refresh();
+ servletModule = new ServletTestModule(getMockFactory());
+ strutsModule = new ActionTestModule(getStrutsMockFactory());
+
+ MockServletContext app = getMockFactory().getMockServletContext();
+ app.addResourcePath("/WEB-INF/toolbox.xml","/WEB-INF/toolbox.xml");
+ app.setResourceAsStream("/WEB-INF/toolbox.xml",
+ new FileInputStream("./WEB-INF/toolbox.xml"));
+
+ MockServletConfig config = getMockFactory().getMockServletConfig();
+ config.setInitParameter(
+ "org.apache.velocity.properties","WEB-INF/velocity.properties");
+
+ MapMessageResources resources = new MapMessageResources();
+ resources.putMessages("WEB-INF/classes/ApplicationResources.properties");
+ strutsModule.setResources(resources);
+
+ MockServletContext ctx = getMockFactory().getMockServletContext();
+ ctx.setRealPath("/", "");
+ rollerContext = new MockRollerContext();
+ rollerContext.init(ctx);
+
+ JspFactory.setDefaultFactory(new MockJspFactory(getMockFactory()));
+ }
+ protected void authenticateUser(String username, String role)
+ {
+ MockHttpServletRequest mockRequest = getMockFactory().getMockRequest();
+ mockRequest.setRemoteUser(username);
+ mockRequest.setUserPrincipal(new MockPrincipal(username));
+ mockRequest.setUserInRole(role, true);
+ }
+ protected void doFilters()
+ {
+ servletModule.createFilter(PersistenceSessionFilter.class);
+ servletModule.createFilter(RequestFilter.class);
+ servletModule.setDoChain(false);
+ servletModule.doFilter();
+ getMockFactory().addRequestWrapper(new HttpServletRequestWrapper(
+ (HttpServletRequest)servletModule.getFilteredRequest()));
+ }
+ /** MockRunner doesn't have one of these */
+ public class MockJspFactory extends JspFactory
+ {
+ public WebMockObjectFactory factory;
+ public MockJspFactory(WebMockObjectFactory factory)
+ {
+ this.factory = factory;
+ }
+ public PageContext getPageContext(
+ Servlet arg0, ServletRequest arg1, ServletResponse arg2,
+ String arg3, boolean arg4, int arg5, boolean arg6)
+ {
+ return factory.getMockPageContext();
+ }
+ public void releasePageContext(PageContext arg0) {}
+ public JspEngineInfo getEngineInfo() {return null;}
+ }
+ protected ActionMockObjectFactory getStrutsMockFactory()
+ {
+ return (ActionMockObjectFactory)getMockFactory();
+ }
+ protected WebMockObjectFactory getMockFactory()
+ {
+ if (mockFactory == null)
+ {
+ mockFactory = new ActionMockObjectFactory();
+ }
+ return mockFactory;
+ }
+}
Added: incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/plugins/smileys/SmileysTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/plugins/smileys/SmileysTest.java?rev=408909&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/plugins/smileys/SmileysTest.java (added)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/plugins/smileys/SmileysTest.java Tue May 23 07:44:50 2006
@@ -0,0 +1,70 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+/*
+ * Created on Jun 8, 2004
+ */
+package org.apache.roller.ui.rendering.velocity.plugins.smileys;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.roller.ui.core.MockRollerRequest;
+import org.apache.roller.ui.rendering.velocity.VelocityServletTestBase;
+
+import com.mockrunner.mock.web.MockHttpServletRequest;
+import com.mockrunner.mock.web.MockServletContext;
+import org.apache.roller.presentation.velocity.plugins.smileys.*;
+
+/**
+ * @author lance.lavandowska
+ */
+public class SmileysTest extends VelocityServletTestBase
+{
+ public void testSmileEmoticon() throws Exception
+ {
+ MockServletContext ctx = getMockFactory().getMockServletContext();
+ ctx.setServletContextName("/roller");
+
+ MockHttpServletRequest request = getMockFactory().getMockRequest();
+ request.setContextPath("/roller");
+
+ doFilters();
+
+ SmileysPlugin plugin = new SmileysPlugin();
+ plugin.init(mWebsite, ctx, "/roller", null);
+ assertTrue( SmileysPlugin.smileyPatterns.length > 0 );
+
+ String test = "put on a happy :-) face";
+ String expected =
+ "put on a happy <img src=\"/roller/images/smileys/smile.gif" +
+ "\" class=\"smiley\" alt=\":-)\" title=\":-)\"> face";
+ String result = plugin.render(test);
+ //System.out.println(result);
+ assertEquals(expected, result);
+ }
+
+ public SmileysTest()
+ {
+ super();
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(SmileysTest.class);
+ }
+}
Added: incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/plugins/textile/TextileTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/plugins/textile/TextileTest.java?rev=408909&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/plugins/textile/TextileTest.java (added)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/ui/rendering/velocity/plugins/textile/TextileTest.java Tue May 23 07:44:50 2006
@@ -0,0 +1 @@
+/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. The ASF licenses this file to You
* under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. For additional information regarding
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
/*
* Created on Oct 31, 2003
*/
package org.apache.roller.ui.rendering.velocity.plugins.textile;
import junit.framework.Test;
import junit.framework.TestCase;
impor
t junit.framework.TestSuite;
import org.apache.roller.ui.authoring.struts.actions.BookmarksActionTest;
import org.apache.roller.model.PagePlugin;import org.apache.roller.presentation.velocity.plugins.textile.*;
import org.apache.roller.presentation.velocity.plugins.textile.TextilePlugin;
/**
* We really need to solve webtesting to adequately test our Presentation classes.
*
* @author lance
*/
public class TextileTest extends TestCase
{
String textileStr = "*strong* plain _emphasis_ * _emphaticStrong_ * ";
String expected = "<p><strong>strong</strong> plain <em>emphasis</em> <strong> <em>emphaticStrong</em> </strong></p>";
/*
* This fails because Textile4J appears to place a tab (\t)
* at the beginning of the result. If the result is .trim()'ed
* then it passes.
*/
public void testTextile()
{
PagePlugin textile = new TextilePlugin();
String result = textile.render(textileStr);
//System.out.p
rintln(expected);
//System.out.println(result);
assertEquals("this will fail until Textile4J is fixed.", expected, result);
}
/* (non-Javadoc)
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception
{
super.setUp();
}
/* (non-Javadoc)
* @see junit.framework.TestCase#tearDown()
*/
protected void tearDown() throws Exception
{
super.tearDown();
}
public static Test suite()
{
return new TestSuite(TextileTest.class);
}
}
\ No newline at end of file
Modified: incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/LRUCache2Test.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/LRUCache2Test.java?rev=408909&r1=408908&r2=408909&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/LRUCache2Test.java (original)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/LRUCache2Test.java Tue May 23 07:44:50 2006
@@ -20,7 +20,7 @@
*/
package org.apache.roller.util;
-import org.apache.roller.presentation.bookmarks.BookmarksActionTest;
+import org.apache.roller.ui.authoring.struts.actions.BookmarksActionTest;
import junit.framework.Test;
import junit.framework.TestCase;
Modified: incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/LinkbackExtractorTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/LinkbackExtractorTest.java?rev=408909&r1=408908&r2=408909&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/LinkbackExtractorTest.java (original)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/LinkbackExtractorTest.java Tue May 23 07:44:50 2006
@@ -18,7 +18,7 @@
package org.apache.roller.util;
-import org.apache.roller.presentation.bookmarks.BookmarksActionTest;
+import org.apache.roller.ui.authoring.struts.actions.BookmarksActionTest;
import junit.framework.Test;
import junit.framework.TestCase;
Modified: incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/RegexUtilTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/RegexUtilTest.java?rev=408909&r1=408908&r2=408909&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/RegexUtilTest.java (original)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/RegexUtilTest.java Tue May 23 07:44:50 2006
@@ -20,7 +20,7 @@
*/
package org.apache.roller.util;
-import org.apache.roller.presentation.bookmarks.BookmarksActionTest;
+import org.apache.roller.ui.authoring.struts.actions.BookmarksActionTest;
import junit.framework.Test;
import junit.framework.TestCase;
Modified: incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/UtilitiesTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/UtilitiesTest.java?rev=408909&r1=408908&r2=408909&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/UtilitiesTest.java (original)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/util/UtilitiesTest.java Tue May 23 07:44:50 2006
@@ -20,7 +20,7 @@
*/
package org.apache.roller.util;
-import org.apache.roller.presentation.bookmarks.BookmarksActionTest;
+import org.apache.roller.ui.authoring.struts.actions.BookmarksActionTest;
import junit.framework.Test;
import junit.framework.TestCase;
Added: incubator/roller/branches/roller_3.0/tests/org/apache/roller/webservices/xmlrpc/RollerXmlRpcServerTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/tests/org/apache/roller/webservices/xmlrpc/RollerXmlRpcServerTest.java?rev=408909&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/tests/org/apache/roller/webservices/xmlrpc/RollerXmlRpcServerTest.java (added)
+++ incubator/roller/branches/roller_3.0/tests/org/apache/roller/webservices/xmlrpc/RollerXmlRpcServerTest.java Tue May 23 07:44:50 2006
@@ -0,0 +1,179 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+/*
+ * Created on Jun 15, 2004
+ */
+package org.apache.roller.webservices.xmlrpc;
+
+import com.mockrunner.mock.web.MockHttpServletRequest;
+import com.mockrunner.mock.web.MockHttpServletResponse;
+import com.mockrunner.mock.web.MockServletContext;
+import com.mockrunner.mock.web.WebMockObjectFactory;
+import com.mockrunner.servlet.ServletTestModule;
+
+import org.apache.roller.RollerTestBase;
+import org.apache.roller.util.RegexUtil;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.regex.Pattern;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.roller.ui.core.MockRollerContext;
+import org.apache.roller.ui.core.RollerRequest;
+
+/**
+ * Makes calls to the RollerXmlRpcServer, which should handle a
+ * post just as it would with a real XML-RPC call.
+ *
+ * @author lance.lavandowska
+ */
+public class RollerXmlRpcServerTest extends RollerTestBase
+{
+ private static HashMap typeMap = new HashMap();
+ static {
+ typeMap.put(Boolean.class, "boolean");
+ typeMap.put(Double.class, "double");
+ typeMap.put(Date.class, "dateTime.iso8601");
+ typeMap.put(Integer.class, "int");
+ }
+
+ protected WebMockObjectFactory mockFactory;
+ protected MockRollerContext rollerContext;
+ protected MockHttpServletRequest mockRequest;
+ protected ServletTestModule servletTestModule;
+
+ public void testBloggerGetRecentPosts()
+ {
+ ArrayList params = new ArrayList();
+ params.add("roller"); // appkey
+ params.add("testuser0"); // blogid
+ params.add("testuser0"); // userid
+ params.add("password"); // password
+ params.add(new Integer(5)); // numposts
+ String message = buildXmlRpcString("blogger.getRecentPosts", params);
+
+ mockRequest.setBodyContent(message);
+ servletTestModule.doPost();
+ MockHttpServletResponse response = mockFactory.getMockResponse();
+ String responseBody = response.getOutputStreamContent();
+
+ // assert no fault code
+ assertTrue(responseBody,
+ responseBody.indexOf("<name>faultCode</name>") == -1);
+
+ // make sure all/any userids returned belong to our test user
+ Pattern userPattern =
+ Pattern.compile("<name>userid</name><value>(.*?)</value>");
+ ArrayList users = RegexUtil.getMatches(userPattern, responseBody, 1);
+ Iterator it = users.iterator();
+ while (it.hasNext())
+ {
+ String user = (String)it.next();
+ //System.out.println(user);
+ if (user.equals("testuser0"))
+ {
+ continue;
+ }
+ else
+ {
+ fail("getRecentPosts() returned entry for a user ["
+ + user + "] other than " + testUsername);
+ }
+ }
+ }
+
+ /**
+ * Build an XML-RPC message from methodName and params.
+ *
+ * @param methodName
+ * @param params
+ * @return
+ */
+ private String buildXmlRpcString(String methodName, ArrayList params)
+ {
+ StringBuffer buf = new StringBuffer("<?xml version=\"1.0\"?>");
+ buf.append("<methodCall>");
+ buf.append("<methodName>").append(methodName).append("</methodName>");
+ buf.append("<params>");
+ Iterator it = params.iterator();
+ while (it.hasNext()) {
+ buf.append("<param><value>");
+ Object param = it.next();
+ String paramType = (String)typeMap.get(param.getClass());
+ if (paramType != null)
+ {
+ buf.append("<").append(paramType).append(">")
+ .append(param)
+ .append("</").append(paramType).append(">");
+ }
+ else
+ {
+ buf.append("<string>").append(param).append("</string>");
+ }
+ buf.append("</value></param>");
+ }
+ buf.append("</params> ");
+ buf.append("</methodCall>");
+ return buf.toString();
+ }
+
+ //-----------------------------------------------------------------------
+ public void setUp() throws Exception
+ {
+ // must do super.setup() before creating MockRollerContext
+ super.setUp();
+ setUpTestWeblogs();
+
+ mockFactory = new WebMockObjectFactory();
+
+ // create mock RollerContext
+ MockServletContext ctx = mockFactory.getMockServletContext();
+ ctx.setRealPath("/", ".");
+ rollerContext = new MockRollerContext();
+ rollerContext.init(ctx);
+
+ mockRequest = mockFactory.getMockRequest();
+ mockRequest.setContextPath("/roller");
+ RollerRequest.getRollerRequest(
+ mockRequest, mockFactory.getMockServletContext());
+
+ servletTestModule = new ServletTestModule(mockFactory);
+ servletTestModule.createServlet(RollerXMLRPCServlet.class);
+ }
+
+ //-----------------------------------------------------------------------
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ mockRequest = null;
+ servletTestModule.clearOutput();
+ servletTestModule.releaseFilters();
+ servletTestModule = null;
+ rollerContext = null;
+ mockFactory = null;
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(RollerXmlRpcServerTest.class);
+ }
+}
\ No newline at end of file