Rename packages in order to make future stable documentation clearer.
[lgpl/argeo-commons.git] / org.argeo.cms / ext / test / org / argeo / cms / tabular / JcrTabularTest.java
index 112562c3fd68f0f061f83a1d41bf47f3f6d43cda..893067f6165af18c49df01dd1c9c24c8a2e5f78c 100644 (file)
@@ -25,27 +25,27 @@ import javax.jcr.PropertyType;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jackrabbit.commons.cnd.CndImporter;
-import org.argeo.cms.ArgeoNames;
+import org.argeo.api.tabular.TabularColumn;
+import org.argeo.api.tabular.TabularRow;
+import org.argeo.api.tabular.TabularRowIterator;
+import org.argeo.api.tabular.TabularWriter;
 import org.argeo.cms.ArgeoTypes;
 import org.argeo.jackrabbit.unit.AbstractJackrabbitTestCase;
-import org.argeo.node.tabular.TabularColumn;
-import org.argeo.node.tabular.TabularRow;
-import org.argeo.node.tabular.TabularRowIterator;
-import org.argeo.node.tabular.TabularWriter;
 
 public class JcrTabularTest extends AbstractJackrabbitTestCase {
        private final static Log log = LogFactory.getLog(JcrTabularTest.class);
 
        public void testWriteReadCsv() throws Exception {
-               session().setNamespacePrefix("argeo", ArgeoNames.ARGEO_NAMESPACE);
-               InputStreamReader reader = new InputStreamReader(getClass()
-                               .getResourceAsStream("/org/argeo/node/node.cnd"));
+               // session().setNamespacePrefix("argeo", ArgeoNames.ARGEO_NAMESPACE);
+               InputStreamReader reader = new InputStreamReader(getClass().getResourceAsStream("/org/argeo/api/ldap.cnd"));
                CndImporter.registerNodeTypes(reader, session());
                reader.close();
-               reader = new InputStreamReader(getClass()
-                               .getResourceAsStream("/org/argeo/cms/cms.cnd"));
+               reader = new InputStreamReader(getClass().getResourceAsStream("/org/argeo/cms/argeo.cnd"));
                CndImporter.registerNodeTypes(reader, session());
                reader.close();
+//             reader = new InputStreamReader(getClass().getResourceAsStream("/org/argeo/cms/cms.cnd"));
+//             CndImporter.registerNodeTypes(reader, session());
+//             reader.close();
 
                // write
                Integer columnCount = 15;
@@ -56,10 +56,8 @@ public class JcrTabularTest extends AbstractJackrabbitTestCase {
                for (int i = 0; i < columnCount; i++) {
                        header.add(new TabularColumn("col" + i, PropertyType.STRING));
                }
-               Node tableNode = session().getRootNode().addNode("table",
-                               ArgeoTypes.ARGEO_TABLE);
-               TabularWriter writer = new JcrTabularWriter(tableNode, header,
-                               ArgeoTypes.ARGEO_CSV);
+               Node tableNode = session().getRootNode().addNode("table", ArgeoTypes.ARGEO_TABLE);
+               TabularWriter writer = new JcrTabularWriter(tableNode, header, ArgeoTypes.ARGEO_CSV);
                for (int i = 0; i < rowCount; i++) {
                        List<Object> objs = new ArrayList<Object>();
                        for (int j = 0; j < columnCount; j++) {
@@ -71,8 +69,7 @@ public class JcrTabularTest extends AbstractJackrabbitTestCase {
                session().save();
 
                if (log.isDebugEnabled())
-                       log.debug("Wrote tabular content " + rowCount + " rows, "
-                                       + columnCount + " columns");
+                       log.debug("Wrote tabular content " + rowCount + " rows, " + columnCount + " columns");
                // read
                TabularRowIterator rowIt = new JcrTabularRowIterator(tableNode);
                Long count = 0l;
@@ -83,7 +80,6 @@ public class JcrTabularTest extends AbstractJackrabbitTestCase {
                }
                assertEquals(rowCount, count);
                if (log.isDebugEnabled())
-                       log.debug("Read tabular content " + rowCount + " rows, "
-                                       + columnCount + " columns");
+                       log.debug("Read tabular content " + rowCount + " rows, " + columnCount + " columns");
        }
 }