axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r226929 [4/4] - in /webservices/axis/trunk/archive/java/scratch/Google_SoC: ./ FeedGenerator/ FeedGenerator/src/ FeedGenerator/src/org/ FeedGenerator/src/org/apache/ FeedGenerator/src/org/apache/axis/ FeedGenerator/src/org/apache/axis/feed/...
Date Tue, 02 Aug 2005 02:46:39 GMT
Added: webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/ATOMFeedImplTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/ATOMFeedImplTest.java?rev=226929&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/ATOMFeedImplTest.java
(added)
+++ webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/ATOMFeedImplTest.java
Mon Aug  1 19:43:54 2005
@@ -0,0 +1,112 @@
+/*
+ * Created on Jul 27, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.feed.feedmodel.atom.impl;
+
+import junit.framework.TestCase;
+import org.apache.axis.feed.feedmodel.atom.*;
+import org.apache.axis.feed.feedmodel.atom.factory.ATOMFactory;
+import org.apache.axis.feed.feedmodel.AbstractFeedFactory;
+
+import java.util.ArrayList;
+import java.util.Date;
+
+/**
+ * @author INDIKA
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class ATOMFeedImplTest extends TestCase {
+    private String versionAttr;
+    private ContentElement titleElement;
+    private DateElement modifiedElement;
+    private DateElement issuedDateElement;
+    private LinkElement linkElement;
+
+    private PersonalElement authorElement;
+    private ATOMEntry atomEntry;
+    private ATOMFeed atomFeed;
+
+	public static void main(String[] args) {
+
+	}
+     /*
+	 * @see TestCase#setUp()
+	 */
+	protected void setUp() throws Exception {
+		super.setUp();
+
+        ATOMFactory fac = (ATOMFactory) AbstractFeedFactory.getFeedFactory("ATOM");
+        atomFeed = fac.createFeedElement("0.3", new ATOMTitleElement("title "), new ATOMModifiedElement(new
Date()), fac.createATOMLinkElement("alternate", "http://www.ws.apache.org/", "text/html"),
new ATOMAuthorElement(new PersonalNameElementImpl("auother name")));
+        titleElement = fac.createATOMTitleElement("entrytile");
+        modifiedElement=   fac.createATOMModifiedElement(new Date());
+        issuedDateElement=     fac.createATOMIsuuedElement(new Date());
+        authorElement= fac.createATOMAuthorElement(fac.createPersonalNameElement("indika"));
+        linkElement= fac.createATOMLinkElement("alternate", "http://www.ws.apache.org/",
"text/html");
+        atomEntry = fac.createEntryElement(titleElement, modifiedElement, linkElement,issuedDateElement
);
+
+
+	}
+
+	/*
+	 * @see TestCase#tearDown()
+	 */
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+	public void testAddEntry() {
+        assertFalse(atomFeed.getEntries().hasNext());
+        atomFeed.addEntry(atomEntry);
+        assertTrue(atomFeed.getEntries().hasNext());
+	}
+
+	public void testGetTitleElement() {
+        assertNotNull(atomFeed.getTitleElement());
+        assertNotSame(titleElement,atomFeed.getTitleElement());
+	}
+
+	public void testSetTitleElement() {
+        assertNotSame(titleElement,atomFeed.getTitleElement());
+        atomFeed.setTitleElement(titleElement);
+        assertEquals(titleElement,atomFeed.getTitleElement());
+	}
+
+	public void testGetModifiedElement() {
+        assertNotNull(atomFeed.getModifiedElement());
+        assertNotSame(modifiedElement,atomFeed.getModifiedElement());
+
+	}
+
+	public void testSetModifiedElement() {
+         assertNotSame(modifiedElement,atomFeed.getModifiedElement());
+        atomFeed.setModifiedElement(modifiedElement);
+        assertEquals(modifiedElement,atomFeed.getModifiedElement());
+	}
+
+	public void testGetLinkElement() {
+        assertNotNull(atomFeed.getLinkElement());
+        assertNotSame(linkElement,atomFeed.getLinkElement());
+
+	}
+
+	public void testSetLinkElement() {
+         assertNotSame(linkElement,atomFeed.getLinkElement());
+         atomFeed.setLinkElement(linkElement);
+        assertEquals(linkElement,atomFeed.getLinkElement());
+
+	}
+
+	public void testGetVersionAttr() {
+        assertNotNull(atomFeed.getVersionAttr());
+	}
+
+	public void testSetVersionAttr() {
+        atomFeed.setVersionAttr("1.0");
+        assertNotSame("0.3",atomFeed.getVersionAttr());
+	}
+
+}

Added: webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/ATOMModelTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/ATOMModelTest.java?rev=226929&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/ATOMModelTest.java
(added)
+++ webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/ATOMModelTest.java
Mon Aug  1 19:43:54 2005
@@ -0,0 +1,69 @@
+package org.apache.axis.feed.feedmodel.atom.impl;
+
+import junit.framework.TestCase;
+
+import java.util.Date;
+import java.util.Iterator;
+
+import org.apache.axis.feed.feedmodel.atom.*;
+import org.apache.axis.feed.feedmodel.atom.factory.ATOMFactory;
+import org.apache.axis.feed.feedmodel.AbstractFeedFactory;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: INDIKA
+ * Date: Jul 27, 2005
+ * Time: 4:32:42 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class ATOMModelTest extends TestCase{
+    private ATOMEntry atomEntry;
+    private  ATOMFeed  atomFeed;
+    private ContentElement titleElement;
+    private DateElement modifiedDateElement;
+    private DateElement issuedDateElement;
+    private LinkElement linkElement;
+    private ATOMID atomid;
+
+
+    public static void main(String[] args) {
+	}
+
+	/*
+	 * @see TestCase#setUp()
+	 */
+	protected void setUp() throws Exception {
+		super.setUp();
+
+        ATOMFactory fac = (ATOMFactory) AbstractFeedFactory.getFeedFactory("ATOM");
+        atomFeed = fac.createFeedElement("0.3", new ATOMTitleElement("title "), new ATOMModifiedElement(new
Date()), new ATOMLinkElement("alternate", "herf", "text/palin"), new ATOMAuthorElement(new
PersonalNameElementImpl("anoter name")));
+        titleElement = fac.createATOMTitleElement("entrytile");
+        modifiedDateElement=   fac.createATOMModifiedElement(new Date());
+        issuedDateElement=     fac.createATOMIsuuedElement(new Date());
+        atomid = new ATOMID("id") ;
+        linkElement= fac.createATOMLinkElement("alternate", "http://www.ws.apache.org/",
"text/html");
+        atomEntry = fac.createEntryElement(titleElement, modifiedDateElement, linkElement,issuedDateElement
);
+        atomFeed.addEntry(atomEntry);
+        atomEntry.setATOMId(atomid);
+	}
+
+	/*
+	 * @see TestCase#tearDown()
+	 */
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+    public void testAll(){
+        Iterator iterator = atomFeed.getEntries();
+        while(iterator.hasNext()){
+            ATOMEntry  entry = (ATOMEntry)iterator.next();
+        assertEquals(atomEntry,entry);
+        assertEquals(titleElement,entry.getTitleElement());
+        assertEquals(modifiedDateElement,entry.getModifiedElement());
+        assertEquals(issuedDateElement,entry.getIssuedElement());
+        assertEquals(linkElement,entry.getLinkElement());
+        assertEquals(atomid,entry.getATOMId());
+        }
+    }
+
+}

Added: webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/ContentElementImplTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/ContentElementImplTest.java?rev=226929&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/ContentElementImplTest.java
(added)
+++ webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/ContentElementImplTest.java
Mon Aug  1 19:43:54 2005
@@ -0,0 +1,86 @@
+/*
+ * Created on Jul 28, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.feed.feedmodel.atom.impl;
+
+import junit.framework.TestCase;
+import org.apache.axis.feed.feedmodel.atom.ModeAttribute;
+import org.apache.axis.feed.feedmodel.atom.TypeAttribute;
+
+/**
+ * @author INDIKA
+ *         <p/>
+ *         TODO To change the template for this generated type comment go to
+ *         Window - Preferences - Java - Code Style - Code Templates
+ */
+public class ContentElementImplTest extends TestCase {
+
+    private TypeAttribute typeAttribute = null;
+    private ModeAttribute modeAttribute = null;
+    private String content;
+    private ATOMTitleElement atomTitleElement;
+
+    public static void main(String[] args) {
+    }
+
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+        content = "new content";
+        atomTitleElement = new ATOMTitleElement("title");
+        typeAttribute = new TypeAttributeImpl("text/xml");
+        modeAttribute = new ModeAttributeImpl("xml");
+
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Constructor for ContentElementImplTest.
+     *
+     * @param name
+     */
+    public ContentElementImplTest(String name) {
+        super(name);
+    }
+
+
+    public void testGetTypeAttribute() {
+        assertNull(atomTitleElement.getTypeAttribute());
+    }
+
+    public void testSetTypeAttribute() {
+        atomTitleElement.setTypeAttribute(typeAttribute);
+        assertEquals(typeAttribute, atomTitleElement.getTypeAttribute());
+    }
+
+    public void testGetModeAttribute() {
+        assertNull(atomTitleElement.getModeAttribute());
+    }
+
+    public void testSetModeAttribute() {
+        atomTitleElement.setModeAttribute(modeAttribute);
+        assertEquals(modeAttribute, atomTitleElement.getModeAttribute());
+    }
+
+    public void testGetContent() {
+        assertNotNull(atomTitleElement.getContent());
+    }
+
+    public void testSetContent() {
+        atomTitleElement.setContent(content);
+        assertEquals(content, atomTitleElement.getContent());
+
+    }
+
+}

Added: webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/DateElementImplTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/DateElementImplTest.java?rev=226929&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/DateElementImplTest.java
(added)
+++ webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/DateElementImplTest.java
Mon Aug  1 19:43:54 2005
@@ -0,0 +1,63 @@
+/*
+ * Created on Jul 28, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.feed.feedmodel.atom.impl;
+
+import junit.framework.TestCase;
+import org.apache.axis.feed.feedmodel.atom.DateElement;
+
+import java.util.Date;
+
+/**
+ * @author INDIKA
+ *         <p/>
+ *         TODO To change the template for this generated type comment go to
+ *         Window - Preferences - Java - Code Style - Code Templates
+ */
+public class DateElementImplTest extends TestCase {
+    private Date date;
+    private DateElement dateElement;
+
+    public static void main(String[] args) {
+    }
+
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+        dateElement = new ATOMIssuedElement(new Date());
+        date = new Date();
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Constructor for DateElementImplTest.
+     *
+     * @param name
+     */
+    public DateElementImplTest(String name) {
+        super(name);
+    }
+
+
+    public void testGetDate() {
+        assertNotNull(dateElement.getDate());
+    }
+
+    public void testSetDate() {
+        assertEquals(date, dateElement.getDate());
+        dateElement.setDate(date);
+        assertEquals(date, dateElement.getDate());
+    }
+
+}

Added: webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/LinkElementImplTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/LinkElementImplTest.java?rev=226929&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/LinkElementImplTest.java
(added)
+++ webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/LinkElementImplTest.java
Mon Aug  1 19:43:54 2005
@@ -0,0 +1,96 @@
+/*
+ * Created on Jul 28, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.feed.feedmodel.atom.impl;
+
+import junit.framework.TestCase;
+import org.apache.axis.feed.feedmodel.atom.LinkElement;
+
+/**
+ * @author INDIKA
+ *         <p/>
+ *         TODO To change the template for this generated type comment go to
+ *         Window - Preferences - Java - Code Style - Code Templates
+ */
+public class LinkElementImplTest extends TestCase {
+    private String relAttribute;
+    private String typeAttribute;
+    private String titleAttribute = null;
+    private String herfAttribute;
+    private LinkElement linkElement;
+
+    public static void main(String[] args) {
+    }
+
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+        relAttribute = "alternate";
+        typeAttribute = "text/html";
+        titleAttribute = "Title";
+        herfAttribute = "http://www.ws.apache.org/";
+        linkElement = new ATOMLinkElement("alternate", "http://www.ws.apache.org/", "text/html");
+
+    }
+
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Constructor for LinkElementImplTest.
+     *
+     * @param name
+     */
+    public LinkElementImplTest(String name) {
+        super(name);
+    }
+
+
+    public void testGetRelAttribute() {
+        assertNotNull(linkElement.getRelAttribute());
+    }
+
+    public void testSetRelAttribute() {
+        linkElement.setRelAttribute(relAttribute);
+        assertEquals(relAttribute, linkElement.getRelAttribute());
+
+    }
+
+    public void testGetTypeAttribute() {
+        assertNotNull(linkElement.getTypeAttribute());
+    }
+
+    public void testSetTypeAttribute() {
+        linkElement.setTypeAttribute(typeAttribute);
+        assertEquals(typeAttribute, linkElement.getTypeAttribute());
+    }
+
+    public void testGetTitleAttribute() {
+        assertNull(linkElement.getTitleAttribute());
+    }
+
+    public void testSetTitleAttribute() {
+        linkElement.setTitleAttribute(titleAttribute);
+        assertEquals(titleAttribute, linkElement.getTitleAttribute());
+    }
+
+    public void testGetHerfAttribute() {
+        assertNotNull(linkElement.getHerfAttribute());
+    }
+
+    public void testSetHerfAttribute() {
+        linkElement.setHerfAttribute(herfAttribute);
+        assertEquals(herfAttribute, linkElement.getHerfAttribute());
+    }
+
+}

Added: webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/PersonalElementImplTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/PersonalElementImplTest.java?rev=226929&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/PersonalElementImplTest.java
(added)
+++ webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/atom/impl/PersonalElementImplTest.java
Mon Aug  1 19:43:54 2005
@@ -0,0 +1,88 @@
+/*
+ * Created on Jul 28, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.feed.feedmodel.atom.impl;
+
+import junit.framework.TestCase;
+import org.apache.axis.feed.feedmodel.atom.PersonalElement;
+import org.apache.axis.feed.feedmodel.atom.PersonalEmailElement;
+import org.apache.axis.feed.feedmodel.atom.PersonalNameElement;
+import org.apache.axis.feed.feedmodel.atom.PersonalURLElement;
+
+import java.net.URL;
+
+/**
+ * @author INDIKA
+ *         <p/>
+ *         TODO To change the template for this generated type comment go to
+ *         Window - Preferences - Java - Code Style - Code Templates
+ */
+public class PersonalElementImplTest extends TestCase {
+    private PersonalNameElement name = null;
+    private PersonalURLElement UrL = null;
+    private PersonalEmailElement email = null;
+    private PersonalElement personalElement;
+
+    public static void main(String[] args) {
+    }
+
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+        name = new PersonalNameElementImpl("indika");
+        UrL = new PersonalURLElementImpl(new URL("http://wiki.apache.org/ws/SummerOfCode/2005/RSSFeedGenerator"));
+        email = new PersonalEmailElementImpl("ipkumara2003@yahoo.co.uk");
+        personalElement = new ATOMAuthorElement(new PersonalNameElementImpl("indika kumara"));
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Constructor for PersonalElementImplTest.
+     *
+     * @param name
+     */
+    public PersonalElementImplTest(String name) {
+        super(name);
+    }
+
+
+    public void testGetName() {
+        assertNotNull(personalElement.getName());
+    }
+
+    public void testSetName() {
+        personalElement.setName(name);
+        assertEquals(name, personalElement.getName());
+    }
+
+    public void testGetURL() {
+        assertNull(personalElement.getURL());
+    }
+
+    public void testSetURL() {
+        personalElement.setURL(UrL);
+        assertNotNull(personalElement.getURL());
+        assertEquals(UrL, personalElement.getURL());
+    }
+
+    public void testGetEmail() {
+        assertNull(personalElement.getEmail());
+    }
+
+    public void testSetEmail() {
+        personalElement.setEmail(email);
+        assertEquals(email, personalElement.getEmail());
+    }
+
+}

Added: webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/factory/impl/RSSFactoryImplTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/factory/impl/RSSFactoryImplTest.java?rev=226929&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/factory/impl/RSSFactoryImplTest.java
(added)
+++ webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/factory/impl/RSSFactoryImplTest.java
Mon Aug  1 19:43:54 2005
@@ -0,0 +1,142 @@
+/*
+ * Created on Jul 28, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.feed.feedmodel.rss.factory.impl;
+
+import junit.framework.TestCase;
+import org.apache.axis.feed.feedmodel.rss.*;
+import org.apache.axis.feed.feedmodel.rss.factory.RSSFactory;
+import org.apache.axis.feed.feedmodel.rss.impl.*;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Date;
+
+/**
+ * @author INDIKA
+ *         <p/>
+ *         TODO To change the template for this generated type comment go to
+ *         Window - Preferences - Java - Code Style - Code Templates
+ */
+public class RSSFactoryImplTest extends TestCase {
+
+    private RSSFactory feedFactory;
+
+    private Item item = null;
+
+
+    private GuidElement guidElement = null;
+
+    private LastBuildDate lastBuildDate = null;
+    private String domain = null;
+
+    private GeneratorElement generatorElement;
+
+    private LanguageElement languageElement;
+
+    private DocsElement docsElement;
+
+
+    public static void main(String[] args) {
+    }
+
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+        feedFactory = new RSSFactoryImpl();
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Constructor for RSSFactoryImplTest.
+     *
+     * @param name
+     */
+    public RSSFactoryImplTest(String name) {
+        super(name);
+    }
+
+
+    /*
+     * Class under test for Item createItem()
+     */
+    public void testCreateItem() {
+        item = new RSSItem();
+        assertEquals(item, feedFactory.createItem());
+    }
+
+    /*
+     * Class under test for Item createItem(String, URL, String)
+     */
+    public void testCreateItemStringURLString() {
+        try {
+            item = new RSSItem("title", new URL("http://www.google.com/"), "description");
+            assertEquals(item, feedFactory.createItem("title", new URL("http://www.google.com/"),
"description"));
+
+        } catch (MalformedURLException e) {
+            fail(e.toString());
+        }
+
+
+    }
+
+
+    /*
+     * Class under test for GuidElement createGuidElement(String)
+     */
+    public void testCreateGuidElementString() {
+        guidElement = new RSSGuidElement("123");
+        assertEquals(guidElement, feedFactory.createGuidElement("123"));
+    }
+
+    /*
+     * Class under test for GuidElement createGuidElement(String, boolean)
+     */
+    public void testCreateGuidElementStringboolean() {
+        guidElement = new RSSGuidElement("123", false);
+        assertEquals(guidElement, feedFactory.createGuidElement("123", false));
+    }
+
+
+    public void testCreateLastBuildDate() {
+        lastBuildDate = new LastBuildDateImpl(new Date());
+        assertEquals(lastBuildDate, feedFactory.createLastBuildDate(new Date()));
+
+    }
+
+
+    public void testCreateDocsElement() {
+        try {
+            docsElement = new RSSDocsElement(new URL("http://www.google.com/"));
+            assertEquals(docsElement, feedFactory.createDocsElement(new URL("http://www.google.com/")));
+        } catch (MalformedURLException e) {
+            fail(e.toString());
+        }
+
+
+    }
+
+
+    public void testCreateGeneratorElement() {
+        generatorElement = new RSSGeneratorElement("feeder 2.0");
+        assertEquals(generatorElement, feedFactory.createGeneratorElement("feeder 2.0"));
+    }
+
+    public void testCreateLanguageElement() {
+        languageElement = new RSSLanguageElement("en-us");
+        assertEquals(languageElement, feedFactory.createLanguageElement("en-us"));
+    }
+
+}

Added: webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/impl/RSSChannelTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/impl/RSSChannelTest.java?rev=226929&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/impl/RSSChannelTest.java
(added)
+++ webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/impl/RSSChannelTest.java
Mon Aug  1 19:43:54 2005
@@ -0,0 +1,133 @@
+/*
+ * Created on Jul 27, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.feed.feedmodel.rss.impl;
+
+import junit.framework.TestCase;
+import org.apache.axis.feed.feedmodel.rss.*;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Date;
+
+
+public class RSSChannelTest extends TestCase {
+
+    private Channel  channel;
+    private Item item;
+    private PubDate pubDate;
+    private LastBuildDate lastBuildDate;
+
+    private CategoryElement categoryElement;
+
+	public static void main(String[] args) {
+
+	}
+
+	/*
+	 * @see TestCase#setUp()
+	 */
+	protected void setUp() throws Exception {
+		super.setUp();
+        channel= new RSSChannel("axis2",new URL("http://ws.apache.org/axis2/"),"test case
for feed channel");
+         pubDate = new PubDateImpl(new Date());
+        categoryElement= new RSSCategoryElement("web servise");
+        lastBuildDate = new LastBuildDateImpl(new Date());
+	}
+
+	/*
+	 * @see TestCase#tearDown()
+	 */
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+
+	/**
+	 * Constructor for RSSChannelTest.
+	 * @param name
+	 */
+	public RSSChannelTest(String name) {
+		super(name);
+	}
+
+	public void testAddItem() {
+
+        assertNotNull(channel);
+        assertNotNull(channel.getItems());
+        Iterator iterator =  channel.getItems();
+        assertFalse(iterator.hasNext());
+        item =new RSSItem();
+        channel.addItem(item);
+        assertTrue(iterator.hasNext());
+        iterator= channel.getItems();
+        assertNotNull(iterator.next());
+
+
+
+	}
+
+	public void testRemove() {
+        item = new RSSItem();
+        channel.remove(item);
+        channel.addItem(item);
+        assertTrue(channel.getItems().hasNext());
+        channel.remove(item);
+        assertFalse(channel.getItems().hasNext());
+
+	}
+
+	public void testAddPudDate() {
+         assertNull(channel.getPubDate());
+        channel.addPudDate(pubDate);
+        assertNotNull(channel.getPubDate());
+        assertEquals(pubDate,channel.getPubDate());
+	}
+
+	public void testAddLastBuildDate() {
+         assertNull(channel.getLastBuildDate());
+        channel.addLastBuildDate(lastBuildDate);
+        assertNotNull(channel.getLastBuildDate());
+        assertEquals(lastBuildDate,channel.getLastBuildDate());
+	}
+
+	public void testGetTitle() {
+        assertNotNull(channel.getTitle());
+	}
+
+	public void testGetLink() {
+        assertNotNull(channel.getLink());
+	}
+
+	public void testGetDescription() {
+        assertNotNull(channel.getDescription());
+	}
+
+	public void testAddCategoryElement() {
+        assertNull(channel.getCategoryElement());
+        assertNotNull(categoryElement.getCategoryName());
+        categoryElement.setDomain("axis2");
+        assertEquals("axis2",categoryElement.getDomain());
+        channel.addCategoryElement(categoryElement);
+        assertNotNull(channel.getCategoryElement());
+        assertEquals(categoryElement,channel.getCategoryElement());
+	}
+
+	public void testGetPubDate() {
+        assertNull(channel.getPubDate());
+        channel.addPudDate(pubDate);
+        assertNotNull(channel.getPubDate());
+        assertEquals(pubDate,channel.getPubDate());
+	}
+
+	public void testGetLastBuildDate() {
+        assertNull(channel.getLastBuildDate());
+        channel.addLastBuildDate(lastBuildDate);
+        assertNotNull(channel.getLastBuildDate());
+        assertEquals(lastBuildDate,channel.getLastBuildDate());
+
+	}
+
+}

Added: webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/impl/RSSFeedTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/impl/RSSFeedTest.java?rev=226929&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/impl/RSSFeedTest.java
(added)
+++ webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/impl/RSSFeedTest.java
Mon Aug  1 19:43:54 2005
@@ -0,0 +1,67 @@
+/*
+ * Created on Jul 27, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.feed.feedmodel.rss.impl;
+
+import junit.framework.TestCase;
+import org.apache.axis.feed.feedmodel.rss.Channel;
+
+import java.net.URL;
+
+/**
+ * @author INDIKA
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class RSSFeedTest extends TestCase {
+    private Channel  channel;
+    private RSSFeed rssFeed;
+
+	public static void main(String[] args) {
+	}
+
+	/*
+	 * @see TestCase#setUp()
+	 */
+	protected void setUp() throws Exception {
+		super.setUp();
+        channel= new RSSChannel("axis2",new URL("http://ws.apache.org/axis2/"),"test case
for feed channel");
+        rssFeed = new RSSFeed("2.0") ;
+
+	}
+
+	/*
+	 * @see TestCase#tearDown()
+	 */
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+
+	/**
+	 * Constructor for RSSFeedTest.
+	 * @param name
+	 */
+	public RSSFeedTest(String name) {
+		super(name);
+	}
+
+	public void testAddChannel() {
+       rssFeed.addChannel(channel);
+        assertNotNull(rssFeed.getChannel());
+        assertEquals(channel,rssFeed.getChannel());
+	}
+
+	public void testGetVersion() {
+        assertNotNull(rssFeed.getVersion());
+        assertEquals("2.0",rssFeed.getVersion());
+	}
+
+	public void testGetChannel() {
+         assertNull(rssFeed.getChannel());
+	}
+
+}

Added: webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/impl/RSSItemTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/impl/RSSItemTest.java?rev=226929&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/impl/RSSItemTest.java
(added)
+++ webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/impl/RSSItemTest.java
Mon Aug  1 19:43:54 2005
@@ -0,0 +1,155 @@
+/*
+ * Created on Jul 27, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.feed.feedmodel.rss.impl;
+
+import junit.framework.TestCase;
+import org.apache.axis.feed.feedmodel.rss.Item;
+import org.apache.axis.feed.feedmodel.rss.GuidElement;
+import org.apache.axis.feed.feedmodel.rss.PubDate;
+import org.apache.axis.feed.feedmodel.rss.CategoryElement;
+
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.util.Date;
+
+/**
+ * @author INDIKA
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class RSSItemTest extends TestCase {
+	private Item item;
+    private URL link;
+    private GuidElement guidElement;
+    private PubDate pubDate;
+    private CategoryElement categoryElement;
+	public static void main(String[] args) {
+	}
+
+	/*
+	 * @see TestCase#setUp()
+	 */
+	protected void setUp() throws Exception {
+		super.setUp();
+		item = new RSSItem();
+         guidElement = new RSSGuidElement("guid");
+        pubDate = new PubDateImpl(new Date());
+        categoryElement= new RSSCategoryElement("web servise");
+
+
+	}
+
+	/*
+	 * @see TestCase#tearDown()
+	 */
+	protected void tearDown() throws Exception {
+		super.tearDown();
+	}
+
+	/**
+	 * Constructor for RSSItemTest.
+	 * @param name
+	 */
+	public RSSItemTest(String name) {
+		super(name);
+	}
+
+	public void testGetTitle() {
+        assertEquals(null,item.getTitle());
+        item.setTitle("title");
+        assertEquals("title",item.getTitle());
+	}
+
+	public void testSetTitle() {
+        assertNotSame("titleNEW",item.getTitle());
+        item.setTitle("titleNEW");
+        assertEquals("titleNEW",item.getTitle());
+	}
+
+	public void testGetLink() {
+        assertEquals(null,item.getLink());
+        try {
+            item.setLink(link=new URL("http://www.apache.org/"));
+        } catch (MalformedURLException e) {
+            fail(e.toString());
+
+        }
+        assertEquals(link,item.getLink());
+	}
+
+	public void testSetLink() {
+        try {
+            link= new URL("http://ws.apache.org/axis2/")   ;
+
+        } catch (MalformedURLException e) {
+            fail(e.toString());
+        }
+        assertNotSame(link,item.getLink());
+        item.setLink(link);
+        assertEquals(link,item.getLink());
+    }
+
+	public void testAddGuidElement() {
+
+        assertNull(item.getGuidElement());
+        assertTrue(guidElement.isPermaLink());
+        guidElement.setPermaLink(false);
+        assertFalse(guidElement.isPermaLink());
+        item.addGuidElement(guidElement);
+        assertNotNull(item.getGuidElement());
+        assertEquals(guidElement,item.getGuidElement());
+	}
+
+	public void testAddPubDate() {
+        assertNull(item.getPubDate());
+        item.addPubDate(pubDate);
+        assertNotNull(item.getPubDate());
+        assertEquals(pubDate,item.getPubDate());
+
+	}
+
+	public void testAddCategoryElement() {
+        assertNull(item.getCategoryElement());
+        assertNotNull(categoryElement.getCategoryName());
+        categoryElement.setDomain("axis2");
+        assertEquals("axis2",categoryElement.getDomain());
+        item.addCategoryElement(categoryElement);
+        assertNotNull(item.getCategoryElement());
+        assertEquals(categoryElement,item.getCategoryElement());
+	}
+
+	public void testGetGuidElement() {
+
+        assertNotSame(guidElement,item.getGuidElement());
+        assertNull(item.getGuidElement());
+        item.addGuidElement(guidElement);
+        assertEquals(guidElement.getGuid(),item.getGuidElement().getGuid());
+        guidElement.setGuid("guidNEW");
+        assertEquals(guidElement,item.getGuidElement());
+        assertEquals("guidNEW",item.getGuidElement().getGuid());
+	}
+
+	public void testGetPubDate() {
+        assertNull(item.getPubDate());
+        item.addPubDate(pubDate);
+        assertNotNull(item.getPubDate());
+        assertEquals(pubDate,item.getPubDate());
+	}
+
+	public void testGetCategoryElement() {
+        assertNull(item.getCategoryElement());
+        assertNotNull(categoryElement.getCategoryName());
+        categoryElement.setDomain("axis2");
+        assertEquals("axis2",categoryElement.getDomain());
+        item.addCategoryElement(categoryElement);
+        assertNotNull(item.getCategoryElement());
+        assertEquals(categoryElement,item.getCategoryElement());
+
+	}
+
+}

Added: webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/impl/RSSModelTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/impl/RSSModelTest.java?rev=226929&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/impl/RSSModelTest.java
(added)
+++ webservices/axis/trunk/archive/java/scratch/Google_SoC/FeedGenerator/test/org/apache/axis/feed/feedmodel/rss/impl/RSSModelTest.java
Mon Aug  1 19:43:54 2005
@@ -0,0 +1,98 @@
+package org.apache.axis.feed.feedmodel.rss.impl;
+
+import junit.framework.TestCase;
+import org.apache.axis.feed.feedmodel.AbstractFeedFactory;
+import org.apache.axis.feed.feedmodel.rss.*;
+import org.apache.axis.feed.feedmodel.rss.factory.RSSFactory;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Date;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: INDIKA
+ * Date: Jul 27, 2005
+ * Time: 3:48:32 PM
+ * To change this template use File | Settings | File Templates.
+ */
+public class RSSModelTest extends TestCase {
+
+    private RSSFeed rssFeed;
+    private Channel channel;
+    private Item item;
+    private String description;
+    private String title;
+    private URL link;
+    private SourceElement sourceElement;
+
+    private LastBuildDate lastBuildDate ;
+
+    private GuidElement guidElement;
+    private PubDate pubDate;
+    private CategoryElement categoryElement;
+
+
+    public static void main(String[] args) {
+    }
+
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+        RSSFactory fac = (RSSFactory) AbstractFeedFactory.getFeedFactory("RSS");
+        rssFeed = (RSSFeed) fac.createFeed("2.0");
+        channel = fac.createChannel("title", new URL("http://www.apache.org"), "feedChannel");
+        rssFeed.addChannel(channel);
+        item = fac.createItem();
+        description = "descriptoon";
+        title = "tilte";
+        link = new URL("http://ws.apache.org/axis2/");
+        sourceElement = new RSSSourceElement("sourceElement");
+        guidElement = new RSSGuidElement("guidElement") ;
+        pubDate= new PubDateImpl(new Date()) ;
+        categoryElement = new RSSCategoryElement("category");
+        lastBuildDate= new LastBuildDateImpl(new Date()) ;
+        item.setTitle(title);
+        item.setDescription(description);
+        item.setLink(link);
+        rssFeed.getChannel().addItem(item);
+        item.addGuidElement(guidElement);
+        item.addSourceElement(sourceElement);
+        item.addPubDate(pubDate);
+        item.addCategoryElement(categoryElement);
+        channel.addLastBuildDate(lastBuildDate);
+
+    }
+
+    public void testAll() {
+
+        assertEquals(channel, rssFeed.getChannel());
+        Iterator iterator = rssFeed.getChannel().getItems();
+        while (iterator.hasNext()) {
+            Item item1 = (Item) iterator.next();
+            assertEquals(item, item1);
+            assertEquals(description, item1.getDescription());
+            assertEquals(title, item1.getTitle());
+            assertEquals(link, item1.getLink());
+            assertEquals(sourceElement,item1.getSourceElement());
+            assertEquals(guidElement,item1.getGuidElement());
+            assertEquals(pubDate,item1.getPubDate());
+            assertEquals(sourceElement,item1.getSourceElement());
+            assertEquals(categoryElement,item1.getCategoryElement());
+
+        }
+        assertEquals(lastBuildDate,rssFeed.getChannel().getLastBuildDate());
+
+    }
+
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+
+}



Mime
View raw message