[portal-commits] JBoss Portal SVN: r5855 - trunk/search/src/main/org/jboss/portal/search/test

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Thu Dec 14 09:51:25 EST 2006


Author: thomas.heute at jboss.com
Date: 2006-12-14 09:51:24 -0500 (Thu, 14 Dec 2006)
New Revision: 5855

Added:
   trunk/search/src/main/org/jboss/portal/search/test/FederationTest.java
Log:
Federated search

Added: trunk/search/src/main/org/jboss/portal/search/test/FederationTest.java
===================================================================
--- trunk/search/src/main/org/jboss/portal/search/test/FederationTest.java	2006-12-14 14:49:08 UTC (rev 5854)
+++ trunk/search/src/main/org/jboss/portal/search/test/FederationTest.java	2006-12-14 14:51:24 UTC (rev 5855)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portal.search.test;
+
+import org.jboss.portal.search.federation.SearchFederation;
+import org.jboss.portal.search.federation.impl.SearchFederationService;
+import org.jboss.portal.search.query.Query;
+import org.jboss.portal.search.query.impl.FieldQueryTerm;
+import org.jboss.portal.search.result.Results;
+import org.jboss.portal.search.result.impl.SimpleResult;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class FederationTest extends TestCase
+{
+   public void test01()
+   {
+      SearchFederation federation = new SearchFederationService();
+      DummySearchFederated federated = new DummySearchFederated();
+      federation.register(federated);
+      federation.reindexAll();
+      
+      Query query = new Query();
+      query.addMandatoryTerm(new FieldQueryTerm("id", "1"));
+      
+      Results results = federation.search(query);
+      
+      assertEquals("Result 1", (((SimpleResult)results.getResult(0)).getValue()));
+      assertEquals("Result 2", (((SimpleResult)results.getResult(1)).getValue()));
+      assertEquals("Result 3", (((SimpleResult)results.getResult(2)).getValue()));
+   }
+}




More information about the portal-commits mailing list