Return-Path: Delivered-To: apmail-incubator-roller-commits-archive@www.apache.org Received: (qmail 88459 invoked from network); 30 Jan 2007 22:52:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Jan 2007 22:52:18 -0000 Received: (qmail 76008 invoked by uid 500); 30 Jan 2007 22:52:21 -0000 Delivered-To: apmail-incubator-roller-commits-archive@incubator.apache.org Received: (qmail 75967 invoked by uid 500); 30 Jan 2007 22:52:21 -0000 Mailing-List: contact roller-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: roller-dev@incubator.apache.org Delivered-To: mailing list roller-commits@incubator.apache.org Received: (qmail 75888 invoked by uid 99); 30 Jan 2007 22:52:21 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Jan 2007 14:52:21 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Jan 2007 14:52:14 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 0BFDE1A981C; Tue, 30 Jan 2007 14:51:54 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r501622 - /incubator/roller/trunk/tests/org/apache/roller/TestUtils.java Date: Tue, 30 Jan 2007 22:51:53 -0000 To: roller-commits@incubator.apache.org From: agilliland@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070130225154.0BFDE1A981C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: agilliland Date: Tue Jan 30 14:51:53 2007 New Revision: 501622 URL: http://svn.apache.org/viewvc?view=rev&rev=501622 Log: setup and teardown methods for a weblog category. Modified: incubator/roller/trunk/tests/org/apache/roller/TestUtils.java Modified: incubator/roller/trunk/tests/org/apache/roller/TestUtils.java URL: http://svn.apache.org/viewvc/incubator/roller/trunk/tests/org/apache/roller/TestUtils.java?view=diff&rev=501622&r1=501621&r2=501622 ============================================================================== --- incubator/roller/trunk/tests/org/apache/roller/TestUtils.java (original) +++ incubator/roller/trunk/tests/org/apache/roller/TestUtils.java Tue Jan 30 14:51:53 2007 @@ -183,6 +183,54 @@ /** + * Convenience method for creating a weblog category. + */ + public static WeblogCategoryData setupWeblogCategory(WebsiteData weblog, + String name, + WeblogCategoryData parent) + throws Exception { + + WeblogManager mgr = RollerFactory.getRoller().getWeblogManager(); + WeblogCategoryData root = mgr.getRootWeblogCategory(weblog); + + WeblogCategoryData catParent = root; + if(parent != null) { + catParent = parent; + } + WeblogCategoryData testCat = new WeblogCategoryData(weblog, catParent, name, null, null); + mgr.saveWeblogCategory(testCat); + + // flush to db + RollerFactory.getRoller().flush(); + + // query for object + WeblogCategoryData cat = mgr.getWeblogCategory(testCat.getId()); + + if(cat == null) + throw new RollerException("error setting up weblog category"); + + return cat; + } + + + /** + * Convenience method for removing a weblog category. + */ + public static void teardownWeblogCategory(String id) throws Exception { + + // lookup the cat + WeblogManager mgr = RollerFactory.getRoller().getWeblogManager(); + WeblogCategoryData cat = mgr.getWeblogCategory(id); + + // remove the cat + mgr.removeWeblogCategory(cat); + + // flush to db + RollerFactory.getRoller().flush(); + } + + + /** * Convenience method for creating a weblog entry. */ public static WeblogEntryData setupWeblogEntry(String anchor,