[jbosscache-commits] JBoss Cache SVN: r6794 - in searchable/trunk: src/main/java/org/jboss/cache/search and 1 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Thu Sep 25 13:08:40 EDT 2008


Author: navssurtani
Date: 2008-09-25 13:08:40 -0400 (Thu, 25 Sep 2008)
New Revision: 6794

Modified:
   searchable/trunk/pom.xml
   searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java
   searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java
Log:
Removed pojo dep

Modified: searchable/trunk/pom.xml
===================================================================
--- searchable/trunk/pom.xml	2008-09-25 16:41:32 UTC (rev 6793)
+++ searchable/trunk/pom.xml	2008-09-25 17:08:40 UTC (rev 6794)
@@ -40,11 +40,11 @@
          <version>1.0.4</version>
       </dependency>
 
-      <dependency>
+<!--      <dependency>
          <groupId>org.jboss.cache</groupId>
          <artifactId>jbosscache-pojo</artifactId>
          <version>2.2.0.CR7</version>
-      </dependency>
+      </dependency>   -->
 
 
       <!-- Test dependencies -->

Modified: searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java
===================================================================
--- searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java	2008-09-25 16:41:32 UTC (rev 6793)
+++ searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java	2008-09-25 17:08:40 UTC (rev 6794)
@@ -1,100 +1,100 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat Middleware LLC, and individual contributors
- * 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.cache.search;
-
-import org.hibernate.search.impl.SearchFactoryImpl;
-import org.hibernate.search.backend.TransactionContext;
-import org.hibernate.search.backend.Work;
-import org.hibernate.search.backend.WorkType;
-import org.hibernate.search.engine.SearchFactoryImplementor;
-import org.jboss.cache.notifications.event.NodeModifiedEvent;
-import org.jboss.cache.pojo.notification.annotation.*;
-import org.jboss.cache.pojo.notification.event.AttachedEvent;
-import org.jboss.cache.pojo.notification.event.DetachedEvent;
-import org.jboss.cache.pojo.notification.event.Event;
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.Fqn;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.transaction.Transaction;
-
-/**
- * @author Navin Surtani (<a href="mailto:nsurtani at redhat.com">nsurtani at redhat.com</a>)
- */
-
- at PojoCacheListener
-public class SearchablePojoListener
-{
-   private SearchFactoryImplementor searchFactory;
-   private static final Log log = LogFactory.getLog(SearchablePojoListener.class);
-   private String pojoKey = "pojoKey";
-
-   public SearchablePojoListener(SearchFactoryImplementor searchFactory)
-   {
-      this.searchFactory = searchFactory;
-   }
-
-   /**
-    * Takes in a NodeModifiedEvent and updates the Lucene indexes using methods on the NodeModifiedEvent class.
-    *
-    * @param event that has occured - or a node that has been changed. {@link org.jboss.cache.notifications.event.NodeModifiedEvent}
-    * @throws InvalidKeyException if an invalid key is given.
-    */
-
-   @Attached
-   public void handleAttach(AttachedEvent event) throws InvalidKeyException
-   {
-      System.out.println("Pojocache.attach() called");
-      Object added = event.getSource();
-      Fqn fqn = event.getContext().getPojoCache().getInternalFqn(added);
-
-      CacheEntityId cacheEntityId = new CacheEntityId(fqn, pojoKey);
-
-      TransactionContext ctx = new PojoTransactionContext(event);
-
-      searchFactory.getWorker().performWork(new Work(added, cacheEntityId.getDocumentId(), WorkType.ADD), ctx);
-   }
-
-
-   @Detached
-   public void handleDetach (DetachedEvent event) throws InvalidKeyException
-   {
-      Object deleted = event.getSource();
-      Fqn fqn = event.getContext().getPojoCache().getInternalFqn(deleted);
-
-      CacheEntityId cacheEntityId = new CacheEntityId(fqn, pojoKey);
-
-      TransactionContext ctx = new PojoTransactionContext(event);
-
-      searchFactory.getWorker().performWork(new Work(deleted, cacheEntityId.getDocumentId(), WorkType.DELETE), ctx);
-   }
-
-
-   //TODO: Sort out updating Lucene for the following annotations: -
-//   @FieldModified
-//   @ListModified
-//   @ArrayModified
-//   @SetModified
-
-}
+///*
+// * JBoss, Home of Professional Open Source
+// * Copyright ${year}, Red Hat Middleware LLC, and individual contributors
+// * 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.cache.search;
+//
+//import org.hibernate.search.impl.SearchFactoryImpl;
+//import org.hibernate.search.backend.TransactionContext;
+//import org.hibernate.search.backend.Work;
+//import org.hibernate.search.backend.WorkType;
+//import org.hibernate.search.engine.SearchFactoryImplementor;
+//import org.jboss.cache.notifications.event.NodeModifiedEvent;
+//import org.jboss.cache.pojo.notification.annotation.*;
+//import org.jboss.cache.pojo.notification.event.AttachedEvent;
+//import org.jboss.cache.pojo.notification.event.DetachedEvent;
+//import org.jboss.cache.pojo.notification.event.Event;
+//import org.jboss.cache.pojo.PojoCache;
+//import org.jboss.cache.Fqn;
+//import org.apache.commons.logging.Log;
+//import org.apache.commons.logging.LogFactory;
+//
+//import javax.transaction.Transaction;
+//
+///**
+// * @author Navin Surtani (<a href="mailto:nsurtani at redhat.com">nsurtani at redhat.com</a>)
+// */
+//
+//@PojoCacheListener
+//public class SearchablePojoListener
+//{
+//   private SearchFactoryImplementor searchFactory;
+//   private static final Log log = LogFactory.getLog(SearchablePojoListener.class);
+//   private String pojoKey = "pojoKey";
+//
+//   public SearchablePojoListener(SearchFactoryImplementor searchFactory)
+//   {
+//      this.searchFactory = searchFactory;
+//   }
+//
+//   /**
+//    * Takes in a NodeModifiedEvent and updates the Lucene indexes using methods on the NodeModifiedEvent class.
+//    *
+//    * @param event that has occured - or a node that has been changed. {@link org.jboss.cache.notifications.event.NodeModifiedEvent}
+//    * @throws InvalidKeyException if an invalid key is given.
+//    */
+//
+//   @Attached
+//   public void handleAttach(AttachedEvent event) throws InvalidKeyException
+//   {
+//      System.out.println("Pojocache.attach() called");
+//      Object added = event.getSource();
+//      Fqn fqn = event.getContext().getPojoCache().getInternalFqn(added);
+//
+//      CacheEntityId cacheEntityId = new CacheEntityId(fqn, pojoKey);
+//
+//      TransactionContext ctx = new PojoTransactionContext(event);
+//
+//      searchFactory.getWorker().performWork(new Work(added, cacheEntityId.getDocumentId(), WorkType.ADD), ctx);
+//   }
+//
+//
+//   @Detached
+//   public void handleDetach (DetachedEvent event) throws InvalidKeyException
+//   {
+//      Object deleted = event.getSource();
+//      Fqn fqn = event.getContext().getPojoCache().getInternalFqn(deleted);
+//
+//      CacheEntityId cacheEntityId = new CacheEntityId(fqn, pojoKey);
+//
+//      TransactionContext ctx = new PojoTransactionContext(event);
+//
+//      searchFactory.getWorker().performWork(new Work(deleted, cacheEntityId.getDocumentId(), WorkType.DELETE), ctx);
+//   }
+//
+//
+//   //TODO: Sort out updating Lucene for the following annotations: -
+////   @FieldModified
+////   @ListModified
+////   @ArrayModified
+////   @SetModified
+//
+//}

Modified: searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java
===================================================================
--- searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java	2008-09-25 16:41:32 UTC (rev 6793)
+++ searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java	2008-09-25 17:08:40 UTC (rev 6794)
@@ -1,188 +1,188 @@
-package org.jboss.cache.search.blackbox;
-
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Query;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.Cache;
-import org.jboss.cache.DefaultCacheFactory;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.config.Configuration;
-import org.jboss.cache.pojo.PojoCache;
-import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.search.CacheQuery;
-import org.jboss.cache.search.SearchableCache;
-import org.jboss.cache.search.SearchableCacheFactory;
-import org.jboss.cache.search.helper.IndexCleanUp;
-import org.jboss.cache.search.test.Person;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import java.util.List;
-
-/**
- * Same as LocalCacheTest except that you will use a POJO Cache instead and use pojoCache.attach() ad pojoCache.detach()
- * instead of cache.put() and cache.remove().
- * <p/>
- *
- * @author Navin Surtani (<a href="mailto:nsurtani at redhat.com">nsurtani at redhat.com</a>)
- */
-
- at Test(groups = "functional", enabled = false)
-public class LocalPOJOCacheTest
-{
-   SearchableCache searchableCache;
-   PojoCache pojo;
-   Person person1;
-   Person person2;
-   Person person3;
-   Person person4;
-   QueryParser queryParser;
-   Query luceneQuery;
-   CacheQuery cacheQuery;
-   List found;
-   private static final Log log = LogFactory.getLog(LocalPOJOCacheTest.class);
-
-
-   @BeforeMethod
-   public void setUp()
-   {
-      boolean toStart = false;
-      pojo = PojoCacheFactory.createCache(new Configuration(), toStart);
-      pojo.start(); // if toStart above is true, it will starts the cache automatically.
-      searchableCache = new SearchableCacheFactory().createSearchableCache(pojo.getCache(), Person.class);
-
-      person1 = new Person();
-      person1.setName("Navin Surtani");
-      person1.setBlurb("Likes playing WoW");
-
-      person2 = new Person();
-      person2.setName("BigGoat");
-      person2.setBlurb("Eats grass");
-
-      person3 = new Person();
-      person3.setName("MiniGoat");
-      person3.setBlurb("Eats cheese");
-
-      pojo.attach(Fqn.fromString("/a/b/c"), person1);
-      pojo.attach(Fqn.fromString("/a/b/d"), person2);
-      pojo.attach(Fqn.fromString("/a/b/c"), person3);
-
-
-   }
-
-   @AfterMethod
-   public void tearDown()
-   {
-      if (pojo != null) pojo.stop();
-      if (searchableCache != null) searchableCache.stop();
-      IndexCleanUp.cleanUpIndexes();
-   }
-
-   public void testSimple() throws ParseException
-   {
-      queryParser = new QueryParser("blurb", new StandardAnalyzer());
-      luceneQuery = queryParser.parse("playing");
-      cacheQuery = searchableCache.createQuery(luceneQuery);
-
-      found = cacheQuery.list();
-
-   }
-
-   public void testMultipleResults() throws ParseException
-   {
-      queryParser = new QueryParser("blurb", new StandardAnalyzer());
-      luceneQuery = queryParser.parse("Eats");
-      cacheQuery = searchableCache.createQuery(luceneQuery);
-      found = cacheQuery.list();
-
-      assert found.size() == 2;
-      assert !found.get(1).equals(person2);
-      assert !found.get(0).equals(person3);
-
-   }
-
-   public void testModified() throws ParseException
-   {
-      queryParser = new QueryParser("blurb", new StandardAnalyzer());
-      luceneQuery = queryParser.parse("playing");
-      cacheQuery = searchableCache.createQuery(luceneQuery);
-
-      found = cacheQuery.list();
-
-      assert found.size() == 1;
-//      assert found.get(0).equals(person1);
-
-      person1.setBlurb("Likes pizza");
-
-      pojo.attach(Fqn.fromString("/a/b/c/"), person1);
-
-      queryParser = new QueryParser("blurb", new StandardAnalyzer());
-      luceneQuery = queryParser.parse("pizza");
-      cacheQuery = searchableCache.createQuery(luceneQuery);
-
-      found = cacheQuery.list();
-
-      assert found.size() == 1;
-//      assert found.get(0).equals(person1);
-   }
-
-   public void testAdded() throws ParseException
-   {
-      queryParser = new QueryParser("blurb", new StandardAnalyzer());
-      luceneQuery = queryParser.parse("eats");
-      cacheQuery = searchableCache.createQuery(luceneQuery);
-      found = cacheQuery.list();
-
-      assert found.size() == 2 : "Size of list should be 2";
-      assert found.contains(person2);
-      assert found.contains(person3);
-      assert !found.contains(person4) : "This should not contain object person4";
-
-      person4 = new Person();
-      person4.setName("MightyGoat");
-      person4.setBlurb("Also eats grass");
-
-      pojo.attach(Fqn.fromString("/r/a/m/"), person4);
-
-      luceneQuery = queryParser.parse("eats");
-      cacheQuery = searchableCache.createQuery(luceneQuery);
-      found = cacheQuery.list();
-
-      assert found.size() == 3 : "Size of list should be 3";
-      assert found.contains(person2);
-      assert found.contains(person3);
-      assert found.contains(person4) : "This should now contain object person4";
-   }
-
-   public void testRemoved() throws ParseException
-   {
-      queryParser = new QueryParser("blurb", new StandardAnalyzer());
-      luceneQuery = queryParser.parse("eats");
-      cacheQuery = searchableCache.createQuery(luceneQuery);
-      found = cacheQuery.list();
-
-      assert found.size() == 2;
-      assert found.contains(person2);
-      assert found.contains(person3) : "This should still contain object person3";
-
-      pojo.detach("/a/b/d");
-
-      luceneQuery = queryParser.parse("eats");
-      cacheQuery = searchableCache.createQuery(luceneQuery);
-      found = cacheQuery.list();
-                                 
-      assert found.size() == 1;
-      assert found.contains(person2);
-      assert !found.contains(person3) : "The search should not return person3";
-
-
-   }
-
-}
-
-
-
+//package org.jboss.cache.search.blackbox;
+//
+//import org.apache.lucene.analysis.standard.StandardAnalyzer;
+//import org.apache.lucene.queryParser.ParseException;
+//import org.apache.lucene.queryParser.QueryParser;
+//import org.apache.lucene.search.Query;
+//import org.apache.commons.logging.Log;
+//import org.apache.commons.logging.LogFactory;
+//import org.jboss.cache.Cache;
+//import org.jboss.cache.DefaultCacheFactory;
+//import org.jboss.cache.Fqn;
+//import org.jboss.cache.config.Configuration;
+//import org.jboss.cache.pojo.PojoCache;
+//import org.jboss.cache.pojo.PojoCacheFactory;
+//import org.jboss.cache.search.CacheQuery;
+//import org.jboss.cache.search.SearchableCache;
+//import org.jboss.cache.search.SearchableCacheFactory;
+//import org.jboss.cache.search.helper.IndexCleanUp;
+//import org.jboss.cache.search.test.Person;
+//import org.testng.annotations.AfterMethod;
+//import org.testng.annotations.BeforeMethod;
+//import org.testng.annotations.Test;
+//
+//import java.util.List;
+//
+///**
+// * Same as LocalCacheTest except that you will use a POJO Cache instead and use pojoCache.attach() ad pojoCache.detach()
+// * instead of cache.put() and cache.remove().
+// * <p/>
+// *
+// * @author Navin Surtani (<a href="mailto:nsurtani at redhat.com">nsurtani at redhat.com</a>)
+// */
+//
+//@Test(groups = "functional", enabled = false)
+//public class LocalPOJOCacheTest
+//{
+//   SearchableCache searchableCache;
+//   PojoCache pojo;
+//   Person person1;
+//   Person person2;
+//   Person person3;
+//   Person person4;
+//   QueryParser queryParser;
+//   Query luceneQuery;
+//   CacheQuery cacheQuery;
+//   List found;
+//   private static final Log log = LogFactory.getLog(LocalPOJOCacheTest.class);
+//
+//
+//   @BeforeMethod
+//   public void setUp()
+//   {
+//      boolean toStart = false;
+//      pojo = PojoCacheFactory.createCache(new Configuration(), toStart);
+//      pojo.start(); // if toStart above is true, it will starts the cache automatically.
+//      searchableCache = new SearchableCacheFactory().createSearchableCache(pojo.getCache(), Person.class);
+//
+//      person1 = new Person();
+//      person1.setName("Navin Surtani");
+//      person1.setBlurb("Likes playing WoW");
+//
+//      person2 = new Person();
+//      person2.setName("BigGoat");
+//      person2.setBlurb("Eats grass");
+//
+//      person3 = new Person();
+//      person3.setName("MiniGoat");
+//      person3.setBlurb("Eats cheese");
+//
+//      pojo.attach(Fqn.fromString("/a/b/c"), person1);
+//      pojo.attach(Fqn.fromString("/a/b/d"), person2);
+//      pojo.attach(Fqn.fromString("/a/b/c"), person3);
+//
+//
+//   }
+//
+//   @AfterMethod
+//   public void tearDown()
+//   {
+//      if (pojo != null) pojo.stop();
+//      if (searchableCache != null) searchableCache.stop();
+//      IndexCleanUp.cleanUpIndexes();
+//   }
+//
+//   public void testSimple() throws ParseException
+//   {
+//      queryParser = new QueryParser("blurb", new StandardAnalyzer());
+//      luceneQuery = queryParser.parse("playing");
+//      cacheQuery = searchableCache.createQuery(luceneQuery);
+//
+//      found = cacheQuery.list();
+//
+//   }
+//
+//   public void testMultipleResults() throws ParseException
+//   {
+//      queryParser = new QueryParser("blurb", new StandardAnalyzer());
+//      luceneQuery = queryParser.parse("Eats");
+//      cacheQuery = searchableCache.createQuery(luceneQuery);
+//      found = cacheQuery.list();
+//
+//      assert found.size() == 2;
+//      assert !found.get(1).equals(person2);
+//      assert !found.get(0).equals(person3);
+//
+//   }
+//
+//   public void testModified() throws ParseException
+//   {
+//      queryParser = new QueryParser("blurb", new StandardAnalyzer());
+//      luceneQuery = queryParser.parse("playing");
+//      cacheQuery = searchableCache.createQuery(luceneQuery);
+//
+//      found = cacheQuery.list();
+//
+//      assert found.size() == 1;
+////      assert found.get(0).equals(person1);
+//
+//      person1.setBlurb("Likes pizza");
+//
+//      pojo.attach(Fqn.fromString("/a/b/c/"), person1);
+//
+//      queryParser = new QueryParser("blurb", new StandardAnalyzer());
+//      luceneQuery = queryParser.parse("pizza");
+//      cacheQuery = searchableCache.createQuery(luceneQuery);
+//
+//      found = cacheQuery.list();
+//
+//      assert found.size() == 1;
+////      assert found.get(0).equals(person1);
+//   }
+//
+//   public void testAdded() throws ParseException
+//   {
+//      queryParser = new QueryParser("blurb", new StandardAnalyzer());
+//      luceneQuery = queryParser.parse("eats");
+//      cacheQuery = searchableCache.createQuery(luceneQuery);
+//      found = cacheQuery.list();
+//
+//      assert found.size() == 2 : "Size of list should be 2";
+//      assert found.contains(person2);
+//      assert found.contains(person3);
+//      assert !found.contains(person4) : "This should not contain object person4";
+//
+//      person4 = new Person();
+//      person4.setName("MightyGoat");
+//      person4.setBlurb("Also eats grass");
+//
+//      pojo.attach(Fqn.fromString("/r/a/m/"), person4);
+//
+//      luceneQuery = queryParser.parse("eats");
+//      cacheQuery = searchableCache.createQuery(luceneQuery);
+//      found = cacheQuery.list();
+//
+//      assert found.size() == 3 : "Size of list should be 3";
+//      assert found.contains(person2);
+//      assert found.contains(person3);
+//      assert found.contains(person4) : "This should now contain object person4";
+//   }
+//
+//   public void testRemoved() throws ParseException
+//   {
+//      queryParser = new QueryParser("blurb", new StandardAnalyzer());
+//      luceneQuery = queryParser.parse("eats");
+//      cacheQuery = searchableCache.createQuery(luceneQuery);
+//      found = cacheQuery.list();
+//
+//      assert found.size() == 2;
+//      assert found.contains(person2);
+//      assert found.contains(person3) : "This should still contain object person3";
+//
+//      pojo.detach("/a/b/d");
+//
+//      luceneQuery = queryParser.parse("eats");
+//      cacheQuery = searchableCache.createQuery(luceneQuery);
+//      found = cacheQuery.list();
+//
+//      assert found.size() == 1;
+//      assert found.contains(person2);
+//      assert !found.contains(person3) : "The search should not return person3";
+//
+//
+//   }
+//
+//}
+//
+//
+//




More information about the jbosscache-commits mailing list