Package com.salas.bb.domain.query.articles

Examples of com.salas.bb.domain.query.articles.Query


    }

    private String collectKeywordsFromSearchFeed(SearchFeed aFeed)
    {
        StringBuffer keywords = new StringBuffer();
        Query query = aFeed.getQuery();
        int criteriaCount = query.getCriteriaCount();
        for (int i = 0; i < criteriaCount; i++)
        {
            ICriteria criteria = query.getCriteriaAt(i);
            if (isKeywordsSearchCriteria(criteria))
            {
                String keywordsList = criteria.getValue();
                String[] keywordsArray = StringUtils.keywordsToArray(keywordsList);
View Full Code Here


    /**
     * Tests scenario with new and existing queries.
     */
    public void testWorkingWithQuery()
    {
        Query query = new Query();
        ICriteria criteria = query.addCriteria();
        criteria.setProperty(ArticleStatusProperty.INSTANCE);
        criteria.setComparisonOperation(StringEqualsCO.INSTANCE);
        criteria.setValue(ArticleStatusProperty.VALUE_UNREAD);

        Query clone = query.getClone();

        builder.setQuery(query);

        assertEquals("Default criteria should be added to empty query.",
            1, query.getCriteriaCount());
View Full Code Here

    /**
     * Tests validation of query feeds.
     */
    public void testValidateSearchFeedData()
    {
        Query query = new Query();

        assertNotNull("Query is empty.", SmartFeedDialog.validateSearchFeedData(query, true, 1));

        ICriteria criteria = query.addCriteria();

        assertNotNull("Criteria is bad.", SmartFeedDialog.validateSearchFeedData(query, true, 1));

        IProperty someProperty = (IProperty)query.getAvailableProperties().toArray()[0];
        IComparisonOperation someOperation = (IComparisonOperation)someProperty.getComparsonOperations().toArray()[0];
        criteria.setProperty(someProperty);
        criteria.setComparisonOperation(someOperation);
        criteria.setValue("1");

View Full Code Here

     *
     * NOTE: It was the reason for most of "Article is not in database" errors
     */
    public void testClearFeedIDSearchFeed()
    {
        Query query = new Query();
        ICriteria criteria = query.addCriteria();
        criteria.setProperty(ArticleTextProperty.INSTANCE);
        criteria.setComparisonOperation(StringContainsCO.INSTANCE);
        criteria.setValue("*a*");

        SearchFeed feed = new SearchFeed();
View Full Code Here

        guide.add(feed);
        manager.insertFeed(feed);
        manager.addFeedToGuide(guide, feed);
        pm.commit();

        Query otherQuery = new Query();
        ICriteria criteria = otherQuery.addCriteria();
        criteria.setProperty(ArticleTextProperty.INSTANCE);
        criteria.setComparisonOperation(StringContainsCO.INSTANCE);
        criteria.setValue("other");

        feed.setQuery(otherQuery);
View Full Code Here

        listener.verify();

        // Wen we will be changing query we expect the unread article to be replaced
        // with read article.
        Query readQuery = createArticlesQuery(true);

        expectUnreadCounterChange(1, 0);
        expectQueryChange(searchFeed.getQuery(), readQuery);
        expectProcessingChange(true);
        expectArticleRemoved(unreadArticle2);
View Full Code Here

        verifySearchFeedProperties(feed, (SearchFeed)guide.getFeedAt(0));
    }

    private static SearchFeed createSearchFeed()
    {
        Query query = new Query();
        ICriteria criteria = query.addCriteria();
        criteria.setProperty(ArticleTextProperty.INSTANCE);
        criteria.setComparisonOperation(StringContainsCO.INSTANCE);
        criteria.setValue("test");

        SearchFeed feed = new SearchFeed();
View Full Code Here

        return article;
    }

    private static Query createArticlesQuery(boolean read)
    {
        Query sampleQuery = new Query();
        ICriteria sampleCriteria = sampleQuery.addCriteria();
        sampleCriteria.setProperty(ArticleStatusProperty.INSTANCE);
        sampleCriteria.setComparisonOperation(StringEqualsCO.INSTANCE);
        sampleCriteria.setValue(read
            ? ArticleStatusProperty.VALUE_READ
            : ArticleStatusProperty.VALUE_UNREAD);
View Full Code Here

    /**
     * Simple feed creating scenario.
     */
    public void testCreatingFeed()
    {
        Query sampleQuery = createUnreadArticlesQuery();
        createSearchFeed(sampleQuery, 10);
    }
View Full Code Here

    /**
     * Fetching articles from feeds and replacements scenario.
     */
    public void testFetchingData()
    {
        Query sampleQuery = createUnreadArticlesQuery();
        SearchFeed sampleFeed = createSearchFeed(sampleQuery, 1);

        // Suppose we have some article at some data feed
        IArticle articleFromSomeFeed = createArticle(10);
        IArticle olderArticleFromSomeFeed = createArticle(9);
View Full Code Here

TOP

Related Classes of com.salas.bb.domain.query.articles.Query

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.