Package com.testdomain

Examples of com.testdomain.ArticleIndex


    List groupedResult = sqlMap.queryForList("getJira260GroupedResult", null);

    HashMap test = new HashMap();
    Iterator indexIterator = groupedResult.iterator();
    while (indexIterator.hasNext()) {
      ArticleIndex articleIndex = (ArticleIndex) indexIterator.next();
      Iterator topicIterator = articleIndex.getTopics().iterator();
      while (topicIterator.hasNext()) {
        Topic topic = (Topic) topicIterator.next();
        Iterator descriptionIterator = topic.getDescriptionList().iterator();
        while (descriptionIterator.hasNext()) {
          TopicDescription desc = (TopicDescription) descriptionIterator.next();

          // Put a flattened key in the hashMap
          test.put(articleIndex.getCategoryTitle() + "||" +
              topic.getTopicTitle() + "||" +
              desc.getDescription(), null);
        }
      }
    }

    // Iterate over the flat version of the results and remove
    // all those keys from the hashMap. If an entry does not exists
    // the test case fails. If at the end the hashMap is not empty
    // the test case also fails.
    String key = null;
    List flatResult = sqlMap.queryForList("getJira260FlatResult", null);
    Iterator iterator = flatResult.iterator();
    while (iterator.hasNext()) {
      ArticleIndexDenorm articleIndex =
          (ArticleIndexDenorm) iterator.next();
      key = articleIndex.getCategoryTitle() + "||" +
          articleIndex.getTopicTitle() + "||" +
          articleIndex.getDescription();
      if (!test.containsKey(key)) {
        throw new Exception("Key \"" + key + "\" does not exist in the hashMap, regression test fails");
      } else {
        test.remove(key);
      }
View Full Code Here

TOP

Related Classes of com.testdomain.ArticleIndex

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.