Author: navssurtani
Date: 2008-12-02 05:45:00 -0500 (Tue, 02 Dec 2008)
New Revision: 7232
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java
searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java
Log:
Only null objects are being put into the lists, iterators etc for pojo
Modified:
searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java
===================================================================
---
searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java 2008-12-02
10:00:49 UTC (rev 7231)
+++
searchable/trunk/src/main/java/org/jboss/cache/search/SearchablePojoListener.java 2008-12-02
10:45:00 UTC (rev 7232)
@@ -67,33 +67,35 @@
@NodeModified
public void handleNodeModified(NodeModifiedEvent nme)
{
- if (!nme.isPre()) return;
- Fqn f = nme.getFqn();
- System.out.println("Node modified called for Fqn " + f);
- if (InternalHelper.isInternalNode(f))
- {
- System.out.println("Is internal and I dont care");
- }
- else
- {
- savedFqn.set(f);
- }
+ if (!nme.isPre()) return;
+ Fqn f = nme.getFqn();
+ if(log.isDebugEnabled()) log.debug("Node modified called for Fqn " + f);
+ if (InternalHelper.isInternalNode(f))
+ {
+ if(log.isDebugEnabled()) log.debug("Is internal and I dont care");
+ }
+ else
+ {
+ savedFqn.set(f);
+ if(log.isDebugEnabled()) log.debug("Saved Fqn to ThreadLocal.");
+ }
}
- @NodeCreated
+ @NodeCreated
public void handleNodeKreated(NodeCreatedEvent nce)
{
- if (!nce.isPre()) return;
- Fqn f = nce.getFqn();
- System.out.println("Node kreated called for Fqn " + f);
- if (InternalHelper.isInternalNode(f))
- {
- System.out.println("Is internal and I dont care");
- }
- else
- {
- savedFqn.set(f);
- }
+ if (!nce.isPre()) return;
+ Fqn f = nce.getFqn();
+ if(log.isDebugEnabled()) log.debug("Node kreated called for Fqn " + f);
+ if (InternalHelper.isInternalNode(f))
+ {
+ if(log.isDebugEnabled()) log.debug("Is internal and I dont care");
+ }
+ else
+ {
+ savedFqn.set(f);
+ if(log.isDebugEnabled()) log.debug("savedFqn.set() called");
+ }
}
/**
@@ -118,8 +120,8 @@
System.out.println("pojo is " + pojo);
// Fqn fqn = pojo.getInternalFqn(added);
- Fqn fqn = savedFqn.get();
- savedFqn.remove();
+ Fqn fqn = savedFqn.get();
+ savedFqn.remove();
System.out.println("Fqn is " + fqn);
@@ -131,7 +133,7 @@
}
@Detached
- public void handleDetach (DetachedEvent event) throws InvalidKeyException
+ public void handleDetach(DetachedEvent event) throws InvalidKeyException
{
Object deleted = event.getSource();
Fqn fqn = event.getContext().getPojoCache().getInternalFqn(deleted);
@@ -143,7 +145,6 @@
searchFactory.getWorker().performWork(new Work(deleted,
cacheEntityId.getDocumentId(), WorkType.DELETE), ctx);
}
-
//TODO: Sort out updating Lucene for the following annotations: -
// @FieldModified
// @ListModified
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-12-02
10:00:49 UTC (rev 7231)
+++
searchable/trunk/src/test/java/org/jboss/cache/search/blackbox/LocalPOJOCacheTest.java 2008-12-02
10:45:00 UTC (rev 7232)
@@ -13,6 +13,7 @@
import org.jboss.cache.search.CacheQuery;
import org.jboss.cache.search.SearchableCache;
import org.jboss.cache.search.SearchableCacheFactory;
+import org.jboss.cache.search.QueryResultIterator;
import org.jboss.cache.search.helper.IndexCleanUp;
import org.jboss.cache.search.test.Person;
import org.testng.annotations.AfterMethod;
@@ -20,6 +21,7 @@
import org.testng.annotations.Test;
import java.util.List;
+import java.util.Iterator;
/**
* Same as LocalCacheTest except that you will use a POJO Cache instead and use
pojoCache.attach() ad pojoCache.detach()
@@ -67,7 +69,7 @@
pojo.attach("/a/b/c", person1);
pojo.attach("/a/b/d", person2);
- pojo.attach("/a/b/c", person3);
+ pojo.attach("/c/a/t", person3);
}
@@ -86,8 +88,9 @@
luceneQuery = queryParser.parse("playing");
cacheQuery = searchableCache.createQuery(luceneQuery);
- found = cacheQuery.list();
-
+ QueryResultIterator found = cacheQuery.iterator();
+ found.first();
+ System.out.println("First object is " + found.next());
}
public void testMultipleResults() throws ParseException
@@ -97,7 +100,11 @@
cacheQuery = searchableCache.createQuery(luceneQuery);
found = cacheQuery.list();
+ System.out.println("size is " + found.size());
assert found.size() == 2;
+
+ System.out.println("object 0 is " + found.get(0));
+ System.out.println("object 1 is " + found.get(1));
assert !found.get(1).equals(person2);
assert !found.get(0).equals(person3);
Show replies by date