com.rometools.rome.io.XmlReader Java Examples

The following examples show how to use com.rometools.rome.io.XmlReader. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PodloveSimpleChapterParserTest.java    From rome with Apache License 2.0 6 votes vote down vote up
public void testParseAtom() throws Exception {

        log.debug("testParseAtom");

        final SyndFeedInput input = new SyndFeedInput();
        final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("psc/atom.xml")).toURI().toURL()));
        final SyndEntry entry = feed.getEntries().get(0);
        final PodloveSimpleChapterModule simpleChapters = (PodloveSimpleChapterModule) entry.getModule(PodloveSimpleChapterModule.URI);

        assertNotNull(simpleChapters);
        for (SimpleChapter c : simpleChapters.getChapters()) {
            assertEquals("00:00:00.000", c.getStart());
            assertEquals("Lorem Ipsum", c.getTitle());
            assertEquals("http://example.org", c.getHref());
            assertEquals("http://example.org/cover", c.getImage());
        }
    }
 
Example #2
Source File: PodloveSimpleChapterParserTest.java    From rome with Apache License 2.0 6 votes vote down vote up
public void testParseRss() throws Exception {

        log.debug("testParseRss");

        final SyndFeedInput input = new SyndFeedInput();
        final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("psc/rss.xml")).toURI().toURL()));
        final SyndEntry entry = feed.getEntries().get(0);
        final PodloveSimpleChapterModule simpleChapters = (PodloveSimpleChapterModule) entry.getModule(PodloveSimpleChapterModule.URI);

        assertNotNull(simpleChapters);
        for (SimpleChapter c : simpleChapters.getChapters()) {
            assertEquals("00:00:00.000", c.getStart());
            assertEquals("Lorem Ipsum", c.getTitle());
            assertEquals("http://example.org", c.getHref());
            assertEquals("http://example.org/cover", c.getImage());
        }
    }
 
Example #3
Source File: ITunesGeneratorTest.java    From rome with Apache License 2.0 6 votes vote down vote up
private void testFile(final String filename) throws Exception {
    final File feed = new File(getTestFile(filename));
    final SyndFeedInput input = new SyndFeedInput();
    final SyndFeed syndfeed = input.build(new XmlReader(feed.toURI().toURL()));

    final SyndFeedOutput output = new SyndFeedOutput();
    final File outfeed = new File("target/" + feed.getName());
    output.output(syndfeed, outfeed);

    final SyndFeed syndCheck = input.build(new XmlReader(outfeed.toURI().toURL()));
    LOG.debug(syndCheck.getModule(AbstractITunesObject.URI).toString());
    assertEquals("Feed Level: ", syndfeed.getModule(AbstractITunesObject.URI).toString(), syndCheck.getModule(AbstractITunesObject.URI).toString());

    final List<SyndEntry> syndEntries = syndfeed.getEntries();
    final List<SyndEntry> syndChecks = syndCheck.getEntries();

    for (int i = 0; i < syndEntries.size(); i++) {
        final SyndEntry entry = syndEntries.get(i);
        final SyndEntry check = syndChecks.get(i);
        LOG.debug("Original: {}", entry.getModule(AbstractITunesObject.URI));
        LOG.debug("Check:    {}", check.getModule(AbstractITunesObject.URI));
        assertEquals("Entry Level: ", entry.getModule(AbstractITunesObject.URI).toString(), check.getModule(AbstractITunesObject.URI).toString());
    }
}
 
Example #4
Source File: SSEParserTest.java    From rome with Apache License 2.0 6 votes vote down vote up
public void xtestParseGenerateV5() throws Exception {
    final URL feedURL = new File(getTestFile("xml/v/v5.xml")).toURI().toURL();
    // parse the document for comparison
    final SAXBuilder builder = new SAXBuilder();
    final Document directlyBuilt = builder.build(feedURL);

    // generate the feed back into a document
    final SyndFeedInput input = new SyndFeedInput();
    final SyndFeed inputFeed = input.build(new XmlReader(feedURL));

    final SyndFeedOutput output = new SyndFeedOutput();
    final Document parsedAndGenerated = output.outputJDom(inputFeed);

    // XMLOutputter outputter = new XMLOutputter();
    // outputter.setFormat(Format.getPrettyFormat());
    // outputter.output(directlyBuilt, new
    // FileOutputStream("c:\\cygwin\\tmp\\sync-direct.xml"));
    // outputter.output(parsedAndGenerated, new
    // FileOutputStream("c:\\cygwin\\tmp\\sync-pg.xml"));

    assertDocumentsEqual(directlyBuilt, parsedAndGenerated);
}
 
Example #5
Source File: GeoRSSModuleTest.java    From rome with Apache License 2.0 6 votes vote down vote up
/**
 * test expected latitude and longitude values in items of test file.
 *
 * @param in testfeed
 * @param expectedLat expected latitude values
 * @param expectedLng expected longitude values
 * @throws Exception if file not found or not accessible
 */
private void assertTestInputStream(final InputStream in, final Double[] expectedLat, final Double[] expectedLng) throws Exception {
    final SyndFeedInput input = new SyndFeedInput();

    final SyndFeed feed = input.build(new XmlReader(in));

    final List<SyndEntry> entries = feed.getEntries();
    for (int i = 0; i < entries.size(); i++) {
        final SyndEntry entry = entries.get(i);
        final GeoRSSModule geoRSSModule = GeoRSSUtils.getGeoRSS(entry);
        final Position position = geoRSSModule.getPosition();
        if (expectedLat[i] == null || expectedLng[i] == null) {
            assertNull("position " + i, position);
        } else {
            assertEquals("lat " + i, expectedLat[i], position.getLatitude(), DELTA);
            assertEquals("lng " + i, expectedLng[i], position.getLongitude(), DELTA);
        }
    }
}
 
Example #6
Source File: ContentModuleGeneratorTest.java    From rome with Apache License 2.0 6 votes vote down vote up
/**
 * Test of generate method, of class com.totsp.xml.syndication.content.ContentModuleGenerator.
 */
public void testGenerate() throws Exception {

    LOG.debug("testGenerate");

    final SyndFeedInput input = new SyndFeedInput();
    final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("xml/test-rdf.xml")).toURI().toURL()));
    final SyndEntry entry = feed.getEntries().get(0);
    entry.getModule(ContentModule.URI);
    final SyndFeedOutput output = new SyndFeedOutput();
    final StringWriter writer = new StringWriter();
    output.output(feed, writer);

    LOG.debug("{}", writer);

}
 
Example #7
Source File: ITunesParserTest.java    From rome with Apache License 2.0 6 votes vote down vote up
/**
 * Test of parse method, of class com.rometools.modules.itunes.io.ITunesParser.
 */
public void testParseItem() throws Exception {
    File feed = new File(getTestFile("xml/leshow.xml"));
    final SyndFeedInput input = new SyndFeedInput();
    SyndFeed syndfeed = input.build(new XmlReader(feed.toURI().toURL()));

    SyndEntry entry = syndfeed.getEntries().get(0);

    EntryInformationImpl entryInfo = (EntryInformationImpl) entry.getModule(AbstractITunesObject.URI);
    assertEquals(true, entryInfo.getClosedCaptioned());
    assertEquals(Integer.valueOf(2), entryInfo.getOrder());
    assertEquals("http://example.org/image.png", entryInfo.getImage().toString());
    assertFalse(entryInfo.getExplicit());
    assertEquals("test-itunes-title", entryInfo.getTitle());

    SyndEntry entry1 = syndfeed.getEntries().get(1);
    EntryInformationImpl entryInfo1 = (EntryInformationImpl) entry1.getModule(AbstractITunesObject.URI);
    assertTrue(entryInfo1.getExplicit());

    SyndEntry entry2 = syndfeed.getEntries().get(2);
    EntryInformationImpl entryInfo2 = (EntryInformationImpl) entry2.getModule(AbstractITunesObject.URI);
    assertFalse(entryInfo2.getExplicit());
    assertNull(entryInfo2.getExplicitNullable());
}
 
Example #8
Source File: ContentModuleParserTest.java    From rome with Apache License 2.0 6 votes vote down vote up
/**
 * Test of parse method, of class com.rometools.rome.feed.module.content.ContentModuleParser.
 * It will test through the whole ROME framework.
 */
public void testParse() throws Exception {

    final SyndFeedInput input = new SyndFeedInput();
    final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("xml/test-rdf.xml")).toURI().toURL()));
    final SyndEntry entry = feed.getEntries().get(0);
    final ContentModule module = (ContentModule) entry.getModule(ContentModule.URI);
    final List<ContentItem> items = module.getContentItems();

    for (int i = 0; i < items.size(); i++) {
        // FIXME
        // final ContentItem item = ContentModuleImplTest.contentItems.get(i);
        // assertEquals (item , items.get(i));
    }

}
 
Example #9
Source File: ITunesGeneratorTest.java    From rome with Apache License 2.0 6 votes vote down vote up
public void testImageTakesPrecedenceOverImageUri() throws Exception {
    SyndFeed feed = new SyndFeedImpl();
    feed.setFeedType("rss_2.0");
    feed.setTitle("title");
    feed.setDescription("description");
    feed.setLink("https://example.org");

    FeedInformation itunesFeed = new FeedInformationImpl();
    itunesFeed.setImage(new URL("https://example.org/test1.png"));
    itunesFeed.setImageUri(new java.net.URI("https://example.org/test2.png"));
    feed.getModules().add(itunesFeed);

    String xml = new SyndFeedOutput().outputString(feed);

    AbstractITunesObject parsedItunesFeed =
            (AbstractITunesObject) new SyndFeedInput()
                    .build(new XmlReader(new ByteArrayInputStream(xml.getBytes("UTF-8"))))
                    .getModule(AbstractITunesObject.URI);
    assertEquals(new URL("https://example.org/test1.png"), parsedItunesFeed.getImage());
    assertEquals(new java.net.URI("https://example.org/test1.png"),
            parsedItunesFeed.getImageUri());
}
 
Example #10
Source File: ITunesGeneratorTest.java    From rome with Apache License 2.0 6 votes vote down vote up
public void testImageUri() throws Exception {
    SyndFeed feed = new SyndFeedImpl();
    feed.setFeedType("rss_2.0");
    feed.setTitle("title");
    feed.setDescription("description");
    feed.setLink("https://example.org");

    FeedInformation itunesFeed = new FeedInformationImpl();
    itunesFeed.setImageUri(new java.net.URI("https://example.org/test.png"));
    feed.getModules().add(itunesFeed);

    String xml = new SyndFeedOutput().outputString(feed);

    AbstractITunesObject parsedItunesFeed =
            (AbstractITunesObject) new SyndFeedInput()
                    .build(new XmlReader(new ByteArrayInputStream(xml.getBytes("UTF-8"))))
                    .getModule(AbstractITunesObject.URI);
    assertEquals(new java.net.URI("https://example.org/test.png"),
            parsedItunesFeed.getImageUri());
    assertEquals(new URL("https://example.org/test.png"),
            parsedItunesFeed.getImage());
}
 
Example #11
Source File: ITunesGeneratorTest.java    From rome with Apache License 2.0 6 votes vote down vote up
public void testImage() throws Exception {
    SyndFeed feed = new SyndFeedImpl();
    feed.setFeedType("rss_2.0");
    feed.setTitle("title");
    feed.setDescription("description");
    feed.setLink("https://example.org");

    FeedInformation itunesFeed = new FeedInformationImpl();
    itunesFeed.setImage(new URL("https://example.org/test.png"));
    feed.getModules().add(itunesFeed);

    String xml = new SyndFeedOutput().outputString(feed);

    AbstractITunesObject parsedItunesFeed =
            (AbstractITunesObject) new SyndFeedInput()
                    .build(new XmlReader(new ByteArrayInputStream(xml.getBytes("UTF-8"))))
                    .getModule(AbstractITunesObject.URI);
    assertEquals(new URL("https://example.org/test.png"), parsedItunesFeed.getImage());
    assertEquals(new java.net.URI("https://example.org/test.png"),
            parsedItunesFeed.getImageUri());
}
 
Example #12
Source File: PodloveSimpleChapterGeneratorTest.java    From rome with Apache License 2.0 6 votes vote down vote up
public void testGenerateRss() throws Exception {

        log.debug("testGenerateRss");

        final SyndFeedInput input = new SyndFeedInput();
        final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("psc/rss.xml")).toURI().toURL()));
        final SyndEntry entry = feed.getEntries().get(0);
        entry.getModule(PodloveSimpleChapterModule.URI);
        final SyndFeedOutput output = new SyndFeedOutput();
        final StringWriter writer = new StringWriter();
        output.output(feed, writer);

        final String xml = writer.toString();
        log.debug("{}", writer);

        assertTrue(xml.contains("xmlns:psc=\"http://podlove.org/simple-chapters\""));
        assertTrue(xml.contains("<psc:chapters version=\"1.2\">"));
        assertTrue(xml.contains("<psc:chapter start=\"00:00:00.000\" title=\"Lorem Ipsum\" href=\"http://example.org\" image=\"http://example.org/cover\" />"));
    }
 
Example #13
Source File: PodloveSimpleChapterGeneratorTest.java    From rome with Apache License 2.0 6 votes vote down vote up
public void testGenerateAtom() throws Exception {

        log.debug("testGenerateAtom");

        final SyndFeedInput input = new SyndFeedInput();
        final SyndFeed feed = input.build(new XmlReader(new File(getTestFile("psc/atom.xml")).toURI().toURL()));
        final SyndEntry entry = feed.getEntries().get(0);
        entry.getModule(PodloveSimpleChapterModule.URI);
        final SyndFeedOutput output = new SyndFeedOutput();
        final StringWriter writer = new StringWriter();
        output.output(feed, writer);

        final String xml = writer.toString();
        log.debug("{}", writer);

        assertTrue(xml.contains("xmlns:psc=\"http://podlove.org/simple-chapters\""));
        assertTrue(xml.contains("<psc:chapters version=\"1.2\">"));
        assertTrue(xml.contains("<psc:chapter start=\"00:00:00.000\" title=\"Lorem Ipsum\" href=\"http://example.org\" image=\"http://example.org/cover\" />"));
    }
 
Example #14
Source File: Issue1Test.java    From rome with Apache License 2.0 5 votes vote down vote up
protected void testXmlParse(final String garbish, final String xmlDoc) throws Exception {
    final InputStream is = getStream(garbish, xmlDoc);
    Reader reader = new XmlReader(is);
    reader = new XmlFixerReader(reader);

    final SAXBuilder saxBuilder = new SAXBuilder();
    saxBuilder.build(reader);
}
 
Example #15
Source File: CategoryUpdater.java    From SimpleNews with Apache License 2.0 5 votes vote down vote up
@Override
public List<Entry> call() throws Exception {
    List<Entry> feedEntries = new ArrayList<>();
    try {
        SyndFeed syndFeed = input.build(new XmlReader(new URL(mFeed.getXmlUrl())));
        String title = syndFeed.getTitle();
        if (mFeed.getTitle() == null) {
            mFeed.setTitle(title);
            databaseHandler.updateFeed(mFeed);
        }
        for (SyndEntry item : syndFeed.getEntries()) {
            Entry entry = Utilities.getEntryFromRSSItem(item, mFeed.getId(), title, category.getId());
            if (entry == null) {
                continue;
            }
            if (deprecatedTime == null || (entry.getDate() != null && entry.getDate() > deprecatedTime)) {
                feedEntries.add(entry);
            }
        }
    } catch (Exception e) {
        Log.e("CategoryUpdater", "XmlReader could not read feed", e);
        return null;
    }
    databaseHandler.removeEntries(category.getId(), mFeed.getId(), null);
    databaseHandler.addEntries(category.getId(), mFeed.getId(), feedEntries);
    getPartResult(feedEntries);
    return feedEntries;
}
 
Example #16
Source File: TestXmlFixerReader.java    From rome with Apache License 2.0 5 votes vote down vote up
protected void testXmlParse(final String garbish, final String xmlDoc) throws Exception {
    final InputStream is = getStream(garbish, xmlDoc);
    Reader reader = new XmlReader(is);
    reader = new XmlFixerReader(reader);
    final SAXBuilder saxBuilder = new SAXBuilder();
    saxBuilder.build(reader);
}
 
Example #17
Source File: TestXmlReader.java    From rome with Apache License 2.0 5 votes vote down vote up
protected void _testRawNoBomInvalid(final String encoding) throws Exception {
    final InputStream is = getXmlStream("no-bom", "xml-prolog-encoding", encoding, encoding);
    try {
        final XmlReader xmlReader = new XmlReader(is, false);
        fail("It should have failed");
        xmlReader.close();
    } catch (final IOException ex) {
        assertTrue(ex.getMessage().indexOf("Invalid encoding,") > -1);
    }
}
 
Example #18
Source File: TestXmlReader.java    From rome with Apache License 2.0 5 votes vote down vote up
protected void _testRawBomValid(final String encoding) throws Exception {
    final InputStream is = getXmlStream(encoding + "-bom", "xml-prolog-encoding", encoding, encoding);
    final XmlReader xmlReader = new XmlReader(is, false);
    if (!encoding.equals("UTF-16")) {
        assertEquals(xmlReader.getEncoding(), encoding);
    } else {
        assertEquals(xmlReader.getEncoding().substring(0, encoding.length()), encoding);
    }
    xmlReader.close();
}
 
Example #19
Source File: TestXmlReader.java    From rome with Apache License 2.0 5 votes vote down vote up
protected void _testRawBomInvalid(final String bomEnc, final String streamEnc, final String prologEnc) throws Exception {
    final InputStream is = getXmlStream(bomEnc, "xml-prolog-encoding", streamEnc, prologEnc);
    try {
        final XmlReader xmlReader = new XmlReader(is, false);
        fail("It should have failed for BOM " + bomEnc + ", streamEnc " + streamEnc + " and prologEnc " + prologEnc);
        xmlReader.close();
    } catch (final IOException ex) {
        assertTrue(ex.getMessage().indexOf("Invalid encoding,") > -1);
    }
}
 
Example #20
Source File: TestXmlReader.java    From rome with Apache License 2.0 5 votes vote down vote up
public void _testHttpValid(final String cT, final String bomEnc, final String streamEnc, final String prologEnc) throws Exception {
    final InputStream is = getXmlStream(bomEnc, prologEnc == null ? "xml" : "xml-prolog-encoding", streamEnc, prologEnc);
    final XmlReader xmlReader = new XmlReader(is, cT, false);
    if (!streamEnc.equals("UTF-16")) {
        // we can not assert things here becuase UTF-8, US-ASCII and ISO-8859-1 look alike for
        // the chars used for detection
    } else {
        assertEquals(xmlReader.getEncoding().substring(0, streamEnc.length()), streamEnc);
    }
    xmlReader.close();
}
 
Example #21
Source File: TestXmlReader.java    From rome with Apache License 2.0 5 votes vote down vote up
protected void _testHttpInvalid(final String cT, final String bomEnc, final String streamEnc, final String prologEnc) throws Exception {
    final InputStream is = getXmlStream(bomEnc, prologEnc == null ? "xml-prolog" : "xml-prolog-encoding", streamEnc, prologEnc);
    try {
        final XmlReader xmlReader = new XmlReader(is, cT, false);
        fail("It should have failed for HTTP Content-type " + cT + ", BOM " + bomEnc + ", streamEnc " + streamEnc + " and prologEnc " + prologEnc);
        xmlReader.close();
    } catch (final IOException ex) {
        assertTrue(ex.getMessage().indexOf("Invalid encoding,") > -1);
    }
}
 
Example #22
Source File: TestXmlReader.java    From rome with Apache License 2.0 5 votes vote down vote up
protected void _testHttpLenient(final String cT, final String bomEnc, final String streamEnc, final String prologEnc, final String shouldbe)
        throws Exception {
    final InputStream is = getXmlStream(bomEnc, prologEnc == null ? "xml-prolog" : "xml-prolog-encoding", streamEnc, prologEnc);
    final XmlReader xmlReader = new XmlReader(is, cT, true);
    assertEquals(xmlReader.getEncoding(), shouldbe);
    xmlReader.close();
}
 
Example #23
Source File: TestXmlFixerReader.java    From rome with Apache License 2.0 5 votes vote down vote up
protected void _testXmlParse(final String garbish, final String xmlDoc) throws Exception {
    final InputStream is = getStream(garbish, xmlDoc);
    Reader reader = new XmlReader(is);
    reader = new XmlFixerReader(reader);
    final SAXBuilder saxBuilder = new SAXBuilder();
    saxBuilder.build(reader);
}
 
Example #24
Source File: CsdbReleasesSD2IEC.java    From petscii-bbs with Mozilla Public License 2.0 5 votes vote down vote up
private static List<NewsFeed> getFeeds(String urlString) throws IOException, FeedException {
    URL url = new URL(urlString);
    SyndFeedInput input = new SyndFeedInput();
    SyndFeed feed = input.build(new XmlReader(url));
    List<CsdbReleasesSD2IEC.NewsFeed> result = new LinkedList<>();
    List<SyndEntry> entries = feed.getEntries();
    for (SyndEntry e : entries)
        result.add(new CsdbReleasesSD2IEC.NewsFeed(
                e.getPublishedDate(),
                e.getTitle().replaceAll("(?is) by .*?$", EMPTY),
                e.getDescription().getValue(),
                e.getUri()));
    return result;
}
 
Example #25
Source File: ITunesGeneratorTest.java    From rome with Apache License 2.0 5 votes vote down vote up
private void testFile(final String filename) throws Exception {
    final File feed = new File(getTestFile(filename));
    final SyndFeedInput input = new SyndFeedInput();
    final SyndFeed syndfeed = input.build(new XmlReader(feed.toURI().toURL()));

    final SyndFeedOutput output = new SyndFeedOutput();
    final File outfeed = new File(feed.getAbsolutePath() + ".output");
    output.output(syndfeed, outfeed);

    final SyndFeed syndCheck = input.build(new XmlReader(outfeed.toURI().toURL()));
    LOG.debug(syndCheck.getModule(AbstractITunesObject.URI).toString());
    assertEquals("Feed Level: ", syndfeed.getModule(AbstractITunesObject.URI).toString(), syndCheck.getModule(AbstractITunesObject.URI).toString());

    final List<SyndEntry> syndEntries = syndfeed.getEntries();
    final List<SyndEntry> syndChecks = syndCheck.getEntries();

    for (int i = 0; i < syndEntries.size(); i++) {
        final SyndEntry entry = syndEntries.get(i);
        final SyndEntry check = syndChecks.get(i);
        LOG.debug("Original: " + entry.getModule(AbstractITunesObject.URI));
        LOG.debug("Check:    " + check.getModule(AbstractITunesObject.URI));
        LOG.debug(entry.getModule(AbstractITunesObject.URI).toString());
        LOG.debug("-----------------------------------------");
        LOG.debug(check.getModule(AbstractITunesObject.URI).toString());
        assertEquals("Entry Level: ", entry.getModule(AbstractITunesObject.URI).toString(), check.getModule(AbstractITunesObject.URI).toString());
    }
}
 
Example #26
Source File: ITunesParserTest.java    From rome with Apache License 2.0 5 votes vote down vote up
public void testParseNonHttpUris() throws Exception {
    File feed = new File(getTestFile("itunes/no-http-uris.xml"));
    final SyndFeedInput input = new SyndFeedInput();
    SyndFeed syndfeed = input.build(new XmlReader(feed.toURI().toURL()));

    final FeedInformationImpl feedInfo = (FeedInformationImpl) syndfeed.getModule(AbstractITunesObject.URI);

    assertEquals(URI.create("file://some-location/1.jpg"), feedInfo.getImageUri());

    SyndEntry entry = syndfeed.getEntries().get(0);
    EntryInformationImpl module = (EntryInformationImpl) entry.getModule(AbstractITunesObject.URI);

    assertEquals(URI.create("gs://some-location/2.jpg"), module.getImageUri());
}
 
Example #27
Source File: ITunesParserTest.java    From rome with Apache License 2.0 5 votes vote down vote up
public void testExplicitnessFalse() throws Exception {
    ArrayList<String> xmlFiles = new ArrayList<String>();
    xmlFiles.add("explicitness-no.xml");
    xmlFiles.add("explicitness-clean.xml");

    for (String xml : xmlFiles) {
        SyndFeed feed = new SyndFeedInput().build(new XmlReader(getClass().getResource(xml)));
        FeedInformationImpl module = (FeedInformationImpl) feed.getModule(AbstractITunesObject.URI);

        assertFalse(module.getExplicitNullable());
    }
}
 
Example #28
Source File: ITunesParserTest.java    From rome with Apache License 2.0 5 votes vote down vote up
public void testExplicitnessTrue() throws Exception {
    ArrayList<String> xmlFiles = new ArrayList<String>();
    xmlFiles.add("explicitness-capital-yes.xml");
    xmlFiles.add("explicitness-yes.xml");

    for (String xml : xmlFiles) {
        SyndFeed feed = new SyndFeedInput().build(new XmlReader(getClass().getResource(xml)));
        FeedInformationImpl module = (FeedInformationImpl) feed.getModule(AbstractITunesObject.URI);

        assertTrue(module.getExplicitNullable());
    }
}
 
Example #29
Source File: ITunesParserTest.java    From rome with Apache License 2.0 5 votes vote down vote up
public void testDurationBad() throws Exception {
    SyndFeed feed = new SyndFeedInput().build(new XmlReader(getClass().getResource("duration-bad.xml")));
    SyndEntry entry = feed.getEntries().get(0);
    EntryInformationImpl module = (EntryInformationImpl) entry.getModule(AbstractITunesObject.URI);

    assertNull(module.getDuration());
}
 
Example #30
Source File: ITunesParserTest.java    From rome with Apache License 2.0 5 votes vote down vote up
public void testDurationEmpty() throws Exception {
    SyndFeed feed = new SyndFeedInput().build(new XmlReader(getClass().getResource("duration-empty.xml")));
    SyndEntry entry = feed.getEntries().get(0);
    EntryInformationImpl module = (EntryInformationImpl) entry.getModule(AbstractITunesObject.URI);

    assertNull(module.getDuration());
}