Changeset 2158
- Timestamp:
- 08/28/12 12:11:18 (12 years ago)
- Location:
- ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/RssCreator.java
r2150 r2158 3 3 4 4 import clarin.cmdi.componentregistry.model.AbstractDescription; 5 import clarin.cmdi.componentregistry.model.ProfileDescription; 5 6 6 import clarin.cmdi.componentregistry.rss.RssItem; 7 7 … … 40 40 //retval.setEnclosure(desc.???); 41 41 //retval.setGuid(desc.getId()); type mismatch 42 retval.setLink(desc.getHref()); //???42 retval.setLink(desc.getHref()); 43 43 retval.setPubDate(desc.getRegistrationDate()); 44 44 //retval.setSource(desc.???); -
ComponentRegistry/branches/ComponentRegistry-1.13.0-olha/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/RssCreatorTest.java
r2150 r2158 5 5 package clarin.cmdi.componentregistry; 6 6 7 import clarin.cmdi.componentregistry.model.AbstractDescription; 8 import clarin.cmdi.componentregistry.model.ComponentDescription; 9 import clarin.cmdi.componentregistry.model.ProfileDescription; 7 10 import clarin.cmdi.componentregistry.rss.RssItem; 8 11 import org.junit.After; … … 22 25 } 23 26 27 // ???????????????? 24 28 @BeforeClass 25 29 public static void setUpClass() { … … 43 47 @Test 44 48 public void nullTestToRssItem() { 45 System.out.println("toRssItem"); 46 RssCreator instance = new RssCreator(null); 47 RssItem expResult = null; 48 RssItem result = instance.toRssItem(); 49 assertEquals(expResult, result); 50 // TODO review the generated test code and remove the default call to fail. 51 // fail("The test case is a prototype."); 49 50 RssCreator creator = new RssCreator(null); 51 RssItem result = creator.toRssItem(); 52 assertEquals(null, result); 53 54 } 55 56 57 58 private ProfileDescription createTestProfileDescription(int commentcount, String creatorname, 59 String description, String domainname, String groupname, String href, 60 String name, boolean editorflag, String uid){ 61 62 ProfileDescription pdesc = ProfileDescription.createNewDescription(); 63 64 pdesc.setCommentsCount(commentcount); 65 pdesc.setCreatorName(creatorname); 66 pdesc.setDescription(description); 67 pdesc.setDomainName(domainname); 68 pdesc.setGroupName(groupname); 69 pdesc.setHref(href); 70 pdesc.setName(name); 71 pdesc.setShowInEditor(editorflag); 72 pdesc.setUserId(uid); 73 74 return pdesc; 75 76 77 } 78 79 private ComponentDescription createTestComponentDescription(int commentcount, String creatorname, 80 String description, String domainname, String groupname, String href, 81 String name, String uid){ 82 83 ComponentDescription cdesc = ComponentDescription.createNewDescription(); 84 85 cdesc.setCommentsCount(commentcount); 86 cdesc.setCreatorName(creatorname); 87 cdesc.setDescription(description); 88 cdesc.setDomainName(domainname); 89 cdesc.setGroupName(groupname); 90 cdesc.setHref(href); 91 cdesc.setName(name); 92 cdesc.setUserId(uid); 93 94 return cdesc; 95 96 97 } 98 99 private void assertEqualDescriptions(AbstractDescription desc, RssItem item){ 100 assertEquals(desc.getCreatorName(), item.getAuthor()); 101 assertEquals(desc.getDescription(), item.getDescription()); 102 assertEquals(desc.getHref(), item.getLink()); 103 assertEquals(desc.getRegistrationDate(), item.getPubDate()); 104 assertEquals(desc.getName(), item.getTitle()); 105 } 106 107 @Test 108 public void profileTestToRssItem() { 109 110 ProfileDescription pdesc= 111 createTestProfileDescription(23, "creatorname", 112 "description", "domainname", "groupname", "href", "name", true, "uid"); 113 114 RssCreator creator = new RssCreator(pdesc); 115 RssItem result = creator.toRssItem(); 116 assertEqualDescriptions(pdesc, result); 117 118 } 119 120 @Test 121 public void componentTestToRssItem() { 122 123 ComponentDescription cdesc= 124 createTestComponentDescription(67, "creatorname", 125 "description", "domainname", "groupname", "href", "name", "uid"); 126 127 RssCreator creator = new RssCreator(cdesc); 128 RssItem result = creator.toRssItem(); 129 assertEqualDescriptions(cdesc, result); 130 52 131 } 53 132 }
Note: See TracChangeset
for help on using the changeset viewer.