Author: agilliland
Date: Mon Apr 10 15:33:42 2006
New Revision: 393107
URL: http://svn.apache.org/viewcvs?rev=393107&view=rev
Log:
code reformatting.
Modified:
incubator/roller/branches/roller-newbackend/tests/org/roller/business/FileManagerTest.java
incubator/roller/branches/roller-newbackend/tests/org/roller/business/IndexManagerTest.java
Modified:
incubator/roller/branches/roller-newbackend/tests/org/roller/business/FileManagerTest.java
URL:
http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/tests/org/roller/business/FileManagerTest.java?rev=393107&r1=393106&r2=393107&view=diff
==============================================================================
---
incubator/roller/branches/roller-newbackend/tests/org/roller/business/FileManagerTest.java
(original)
+++
incubator/roller/branches/roller-newbackend/tests/org/roller/business/FileManagerTest.java
Mon Apr 10 15:33:42 2006
@@ -3,11 +3,9 @@
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
-
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-
import org.roller.model.FileManager;
import org.roller.model.PropertiesManager;
import org.roller.model.Roller;
@@ -18,28 +16,32 @@
import org.roller.pojos.WebsiteData;
import org.roller.util.RollerMessages;
+
/**
- * @author David M Johnson
+ * Test File Management business layer operations.
*/
-public class FileManagerTest extends TestCase
-{
- //private Roller mRoller = null;
- //private WebsiteData mWebsite = null;
+public class FileManagerTest extends TestCase {
+
+
+ public FileManagerTest(String name) {
+ super(name);
+ }
+
+
+ public static Test suite() {
+ return new TestSuite(FileManagerTest.class);
+ }
- public void setUp() throws Exception
- {
-
+
+ public void setUp() throws Exception {
}
- public void tearDown() throws Exception
- {
- // No need to clean up, we are using mocks
+ public void tearDown() throws Exception {
}
- public void testCanSave()
- {
- try
- {
+
+ public void testCanSave() {
+ try {
// do some setup for our test
Roller mRoller = RollerFactory.getRoller();
@@ -63,17 +65,14 @@
RollerMessages msgs = new RollerMessages();
assertFalse(fmgr.canSave(mWebsite.getHandle(), "test.gif",
2500000, msgs));
//assertEquals(4, msgs.getErrorCount());
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
e.printStackTrace();
}
}
- public void testSave()
- {
- try
- {
+
+ public void testSave() {
+ try {
// do some setup for our test
Roller roller = RollerFactory.getRoller();
UserManager umgr = roller.getUserManager();
@@ -92,7 +91,7 @@
pmgr.store(config);
roller.commit();
- /* NOTE: upload dir for unit tests is set in
+ /* NOTE: upload dir for unit tests is set in
roller/personal/testing/roller-custom.properties */
FileManager fmgr = new FileManagerImpl();
RollerMessages msgs = new RollerMessages();
@@ -104,22 +103,21 @@
fmgr.deleteFile(mWebsite.getHandle(), "bookmarks.opml");
Thread.sleep(2000);
assertEquals(0, fmgr.getFiles(mWebsite.getHandle()).length);
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
e.printStackTrace();
}
}
+
private WebsiteData createTestUser() throws Exception {
// do some setup for our test
- Roller mRoller = RollerFactory.getRoller();
+ Roller mRoller = RollerFactory.getRoller();
UserManager umgr = mRoller.getUserManager();
UserData user = new UserData(null,
- "FileManagerTest_userName",
- "FileManagerTest_password",
- "FileManagerTest_description",
- "[EMAIL PROTECTED]",
+ "FileManagerTest_userName",
+ "FileManagerTest_password",
+ "FileManagerTest_description",
+ "[EMAIL PROTECTED]",
"en_US_WIN", "America/Los_Angeles",
new java.util.Date(), Boolean.TRUE);
Map pages = new HashMap();
@@ -127,16 +125,12 @@
pages.put("_day","Day page content");
pages.put("css","CSS page content");
umgr.addUser(user);
- umgr.createWebsite(user, pages,
- user.getUserName(), user.getUserName(), user.getUserName(),
+ umgr.createWebsite(user, pages,
+ user.getUserName(), user.getUserName(), user.getUserName(),
"[EMAIL PROTECTED]","basic", "en_US_WIN",
"America/Los_Angeles");
mRoller.commit();
WebsiteData website = (WebsiteData)umgr.getWebsites(user,null,
null).get(0);
return website;
}
-
- public static Test suite()
- {
- return new TestSuite(FileManagerTest.class);
- }
+
}
Modified:
incubator/roller/branches/roller-newbackend/tests/org/roller/business/IndexManagerTest.java
URL:
http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/tests/org/roller/business/IndexManagerTest.java?rev=393107&r1=393106&r2=393107&view=diff
==============================================================================
---
incubator/roller/branches/roller-newbackend/tests/org/roller/business/IndexManagerTest.java
(original)
+++
incubator/roller/branches/roller-newbackend/tests/org/roller/business/IndexManagerTest.java
Mon Apr 10 15:33:42 2006
@@ -2,31 +2,40 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-
import org.roller.RollerTestBase;
import org.roller.business.search.operations.AddEntryOperation;
import org.roller.business.search.operations.SearchOperation;
import org.roller.model.IndexManager;
import org.roller.pojos.WeblogEntryData;
+
/**
- * @author Dave Johnson
+ * Test Search Manager business layer operations.
*/
-public class IndexManagerTest extends RollerTestBase
-{
- public void testSearch() throws Exception
- {
- try
- {
+public class IndexManagerTest extends RollerTestBase {
+
+
+ public IndexManagerTest(String name) {
+ super(name);
+ }
+
+
+ public static Test suite() {
+ return new TestSuite(IndexManagerTest.class);
+ }
+
+
+ public void testSearch() throws Exception {
+ try {
IndexManager imgr = getRoller().getIndexManager();
WeblogEntryData wd1 = new WeblogEntryData();
wd1.setId("dummy");
wd1.setTitle("The Tholian Web");
wd1.setText(
- "When the Enterprise attempts to ascertain the fate of the
U.S.S. "
- +"Defiant which vanished 3 weeks ago, the warp engines begin to
lose "
- +"power, and Spock reports strange sensor readings.");
+ "When the Enterprise attempts to ascertain the fate of the
U.S.S. "
+ +"Defiant which vanished 3 weeks ago, the warp engines
begin to lose "
+ +"power, and Spock reports strange sensor readings.");
imgr.executeIndexOperationNow(
new AddEntryOperation((IndexManagerImpl)imgr, wd1));
@@ -34,9 +43,9 @@
wd2.setId("dummy");
wd2.setTitle("A Piece of the Action");
wd2.setText(
- "The crew of the Enterprise attempts to make contact with "
- +"the inhabitants of planet Sigma Iotia II, and Uhura puts Kirk
"
- +"in communication with Boss Oxmyx.");
+ "The crew of the Enterprise attempts to make contact with "
+ +"the inhabitants of planet Sigma Iotia II, and Uhura puts
Kirk "
+ +"in communication with Boss Oxmyx.");
imgr.executeIndexOperationNow(
new AddEntryOperation((IndexManagerImpl)imgr, wd2));
@@ -49,18 +58,9 @@
search2.setTerm("Tholian");
imgr.executeIndexOperationNow(search2);
assertTrue(search2.getResultsCount() == 1);
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
e.printStackTrace();
}
}
- public static Test suite()
- {
- return new TestSuite(IndexManagerTest.class);
- }
- public static void main(String[] args)
- {
- junit.textui.TestRunner.run(IndexManagerTest.class);
- }
+
}