View Javadoc
1 package net.sf.flock.support; 2 3 import java.net.MalformedURLException; 4 import java.net.URL; 5 6 import junit.framework.TestCase; 7 8 import net.sf.flock.FlockResourceException; 9 import net.sf.flock.SubscriptionInfoI; 10 11 import org.jdom.Document; 12 import org.jdom.Element; 13 14 /*** 15 * @version $Revision: 1.4 $ 16 * @author $Author: phraktle $ 17 */ 18 public class OpmlSubscriptionImportTest extends TestCase { 19 20 // private MockControl controlManager; 21 // private SubscriptionManagerI mockManager; 22 23 /*** 24 * Constructor for OpmlLoaderTest. 25 * @param arg0 26 */ 27 public OpmlSubscriptionImportTest(String arg0) { 28 super(arg0); 29 } 30 31 protected void setUp() throws Exception { 32 // this.controlManager = EasyMock.controlFor(SubscriptionManagerI.class); 33 // this.mockManager = (SubscriptionManagerI) controlManager.getMock(); 34 } 35 36 /* 37 * Test for void load(Document) 38 */ 39 public void testLoadDocument() throws FlockResourceException, MalformedURLException { 40 41 Element root = new Element("opml"); 42 root.setAttribute("version", "1.0"); 43 44 Element head = new Element("head"); 45 head.addContent( new Element("title").addContent("Flock tree") ); 46 root.addContent( head ); 47 48 Element body = new Element("body"); 49 50 Element outline = new Element("outline"); 51 outline.setAttribute("text", "Dummy title"); 52 53 outline.setAttribute("type", "link"); 54 outline.setAttribute("xmlurl", "http://foo.bar.net"); 55 outline.setAttribute("path", "/foo/bar" ); 56 body.addContent( outline ); 57 58 root.addContent( body ); 59 60 Document doc = new Document(root); 61 62 // this.mockManager.subscribe( new URL("http://foo.bar.net"), "/foo/bar" ); 63 // this.controlManager.setReturnValue(null); 64 // this.controlManager.activate(); 65 // 66 // OpmlSubscriptionImport loader = new OpmlSubscriptionImport(this.mockManager, null); 67 // loader.load( doc ); 68 // 69 // this.controlManager.verify(); 70 71 OpmlSubscriptionImport loader = new OpmlSubscriptionImport(); 72 assertTrue( loader.isSuitable(doc) ); 73 SubscriptionInfoI[] subs = loader.load(doc); 74 assertEquals( 1, subs.length ); 75 assertEquals( new URL("http://foo.bar.net"), subs[0].getLocation() ); 76 assertEquals( "/foo/bar", subs[0].getMetaData().get("path") ); 77 } 78 79 }

This page was automatically generated by Maven