Search in sources :

Example 1 with RssContent

use of org.mamute.model.interfaces.RssContent in project mamute by caelum.

the class QuestionDAOTest method should_find_questions_visible_and_order_by_creation_date_of_a_tag.

@Test
public void should_find_questions_visible_and_order_by_creation_date_of_a_tag() throws Exception {
    Question question1 = question(author, java);
    Question question2 = question(author, defaultTag);
    Question invisible = question(author, defaultTag);
    invisible.remove();
    session.save(question1);
    session.save(question2);
    session.save(invisible);
    List<RssContent> questions = questionsForAnyone.orderedByCreationDate(30, defaultTag);
    assertEquals(1, questions.size());
}
Also used : Question(org.mamute.model.Question) RssContent(org.mamute.model.interfaces.RssContent) Test(org.junit.Test)

Example 2 with RssContent

use of org.mamute.model.interfaces.RssContent in project mamute by caelum.

the class QuestionDAOTest method should_find_questions_visible_and_order_by_creation_date.

@Test
public void should_find_questions_visible_and_order_by_creation_date() throws Exception {
    Question question1 = question(author, java);
    Question question2 = question(author, java);
    question2.remove();
    session.save(question1);
    session.save(question2);
    List<RssContent> questions = questionsForAnyone.orderedByCreationDate(5);
    assertEquals(1, questions.size());
}
Also used : Question(org.mamute.model.Question) RssContent(org.mamute.model.interfaces.RssContent) Test(org.junit.Test)

Example 3 with RssContent

use of org.mamute.model.interfaces.RssContent in project mamute by caelum.

the class RssController method rssByTag.

@Get
public void rssByTag(String tagName) throws IOException {
    Tag tag = tags.findByName(tagName);
    if (tag == null) {
        result.notFound();
        return;
    }
    List<RssContent> orderedByDate = questions.orderedByCreationDate(MAX_RESULTS, tag);
    String title = bundle.getMessage("questions.rss.title", bundle.getMessage("site.name"));
    String description = bundle.getMessage("questions.rss.description", bundle.getMessage("site.name"));
    buildRss(orderedByDate, title, description);
}
Also used : Tag(org.mamute.model.Tag) RssContent(org.mamute.model.interfaces.RssContent) Get(br.com.caelum.vraptor.Get)

Example 4 with RssContent

use of org.mamute.model.interfaces.RssContent in project mamute by caelum.

the class RssFeedFactory method build.

public void build(List<RssContent> rssContents, OutputStream output, String rssTitle, String rssDescription) {
    stream = new PrintStream(output);
    open(output, rssTitle, rssDescription);
    for (RssContent rssContent : rssContents) {
        entryFactory.writeEntry(rssContent, output);
        stream.print('\n');
    }
    close(output);
}
Also used : PrintStream(java.io.PrintStream) RssContent(org.mamute.model.interfaces.RssContent)

Aggregations

RssContent (org.mamute.model.interfaces.RssContent)4 Test (org.junit.Test)2 Question (org.mamute.model.Question)2 Get (br.com.caelum.vraptor.Get)1 PrintStream (java.io.PrintStream)1 Tag (org.mamute.model.Tag)1