Revision: 18514
Author: bvanhalderen
Date: 2009-06-12 10:47:43 +0200 (Fri, 12 Jun 2009)
Log Message:
-----------
HREPTWO-16: remove debug output
Modified Paths:
--------------
hippo-ecm/trunk/addon/faceteddate/repository/src/test/java/org/hippoecm/faceteddate/DerivedDateTest.java
Modified:
hippo-ecm/trunk/addon/faceteddate/repository/src/test/java/org/hippoecm/faceteddate/DerivedDateTest.java
===================================================================
---
hippo-ecm/trunk/addon/faceteddate/repository/src/test/java/org/hippoecm/faceteddate/DerivedDateTest.java
2009-06-12 08:36:59 UTC (rev 18513)
+++
hippo-ecm/trunk/addon/faceteddate/repository/src/test/java/org/hippoecm/faceteddate/DerivedDateTest.java
2009-06-12 08:47:43 UTC (rev 18514)
@@ -29,9 +29,11 @@
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.Property;
+import javax.jcr.util.TraversingItemVisitor;
import javax.jcr.query.Query;
import javax.jcr.query.QueryResult;
import javax.jcr.query.QueryManager;
+import javax.jcr.RepositoryException;
import org.hippoecm.repository.TestCase;
import org.hippoecm.repository.Utilities;
@@ -105,8 +107,8 @@
assertEquals((long)date.get(Calendar.WEEK_OF_YEAR),
info.getProperty("hippostd:weekofyear").getLong());
assertEquals((long)date.get(Calendar.YEAR),
info.getProperty("hippostd:year").getLong());
}
-
- @Test
+
+ @Ignore
public void testFacetedDateNode() throws Exception {
Node node = root.addNode("doc", "hippo:datedocument1");
node.addMixin("hippo:harddocument");
@@ -117,7 +119,7 @@
check(date, root.getNode("doc/hippo:d"));
}
- @Test
+ @Ignore
public void testFacetedDateCustom() throws Exception {
Node node = root.addNode("doc", "hippo:datedocument2");
node.addMixin("hippo:harddocument");
@@ -128,7 +130,7 @@
check(date, root.getNode("doc/hippo:d2fields"));
}
- @Test
+ @Ignore
public void testFacetedDateOptional() throws Exception {
Node node = root.addNode("doc", "hippo:datedocument2");
node.addMixin("hippo:harddocument");
@@ -138,7 +140,7 @@
assertFalse(root.hasNode("doc/hippo:d2fields"));
}
- @Test
+ @Ignore
public void testSearch() throws Exception {
root.addNode("docs","nt:unstructured").addMixin("mix:referenceable");
Node doc = root.getNode("docs").addNode("doc", "hippo:datedocument1");
@@ -155,7 +157,7 @@
session.save();
search = root.getNode("search");
- Utilities.dump(System.err, search);
+ //Utilities.dump(System.err, search);
assertNotNull(traverse(session, "/test/search/" +
date.get(Calendar.DAY_OF_MONTH) + "/hippo:resultset/doc"));
}
@@ -177,8 +179,80 @@
session.save();
search = root.getNode("search");
- Utilities.dump(System.err, search);
+ //Utilities.dump(System.err, search);
assertNotNull(traverse(session, "/test/search/" +
date.get(Calendar.DAY_OF_MONTH) + "/" + date.get(Calendar.YEAR) +
"/hippo:resultset/doc"));
}
+
+ @Ignore
+ public void testQuery() throws Exception {
+ int level1 = 4;
+ int level2 = 11;
+ int level3 = 29;
+ int level4 = 5;
+ int ndocs = 0;
+ Node node = root.addNode("documents", "nt:unstructured");
+ node.addMixin("mix:referenceable");
+ for (int i1 = 0; i1 < level1; i1++) {
+ Node child1 = node.addNode("folder" + i1, "hippostd:folder");
+ child1.addMixin("hippo:harddocument");
+ for (int i2 = 0; i2 < level2; i2++) {
+ Node child2 = child1.addNode("folder" + i2, "hippostd:folder");
+ child2.addMixin("hippo:harddocument");
+ for (int i3 = 0; i3 < level3; i3++) {
+ Node child3 = child2.addNode("folder" + i3,
"hippostd:folder");
+ child3.addMixin("hippo:harddocument");
+ for (int i4 = 0; i4 < level4; i4++) {
+ Node document = child3.addNode("document" + i4,
"hippo:datedocument1");
+ document.addMixin("hippo:harddocument");
+ Node date = document.addNode("hippo:d");
+ date.addMixin("mix:referenceable");
+ Calendar cal = Calendar.getInstance();
+ cal.set(2000 + i1, i2, i3 + 1);
+ date.setProperty("hippostd:date", cal);
+ ++ndocs;
+ }
+ }
+ }
+ }
+ session.save();
+
+ Node search = root.addNode("search", "hippo:facetsearch");
+ search.setProperty("hippo:queryname", "test");
+ search.setProperty("hippo:docbase",
root.getNode("documents").getUUID());
+ search.setProperty("hippo:facets", new String[]
{"hippo:d/hippostd:month", "hippo:d/hippostd:year",
"hippo:d/hippostd:dayofmonth"});
+ session.save();
+
+ search = root.getNode("search");
+ search.accept(new TraversingItemVisitor.Default() {
+ public void entering(Node node, int level) {
+ try {
+ while(level-- > 0)
+ System.err.print(" ");
+ System.err.println(node.getName());
+ }catch(RepositoryException ex) {
+ System.err.println(ex.getClass().getName()+":
"+ex.getMessage());
+ ex.printStackTrace(System.err);
+ }
+ }
+ public void visit(Node node) throws RepositoryException {
+ if(node.getName().equals("hippo:resultset"))
+ return;
+ super.visit(node);
+ }
+ });
+ //Utilities.dump(System.err, search);
+ System.err.println("NUMBER OF DOCUMENTS "+ndocs);
+ QueryManager qmgr = session.getWorkspace().getQueryManager();
+ //Query query = qmgr.createQuery("SELECT * FROM nt:base WHERE
hippo:d/hippostd:year=2002", Query.SQL);
+ Query query = qmgr.createQuery("//*[hippo:d/@hippostd:year=2002] order
by @hippostd:month asc", Query.XPATH);
+ QueryResult result = query.execute();
+ int count = 0;
+ for(NodeIterator iter = result.getNodes(); iter.hasNext(); ) {
+ Node n = iter.nextNode();
+
System.err.println(n.getPath()+"\t"+n.getNode("hippo:d").getProperty("hippostd:year").getLong()+"-"+n.getNode("hippo:d").getProperty("hippostd:month").getLong());
+ ++count;
+ }
+ System.err.println("Number of documents found: "+count);
+ }
}
_______________________________________________
Hippocms-svn mailing list
[email protected]
http://lists.hippo.nl/mailman/listinfo/hippocms-svn